| File: | Volumes/Data/worker/macOS-Safer-CPP-Checks-EWS/build/Source/WebCore/rendering/RenderMultiColumnFlow.cpp |
| Warning: | line 433, column 12 Call argument for 'this' parameter is uncounted and unsafe |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (C) 2012-2023 Apple Inc. All rights reserved. |
| 3 | * Copyright (C) 2014 Google Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 15 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 18 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 | * PROFITS; OR BUSINESS IN..0TERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #include "config.h" |
| 28 | #include "RenderMultiColumnFlow.h" |
| 29 | |
| 30 | #include "HitTestResult.h" |
| 31 | #include "RenderBoxInlines.h" |
| 32 | #include "RenderBoxModelObjectInlines.h" |
| 33 | #include "RenderIterator.h" |
| 34 | #include "RenderLayoutState.h" |
| 35 | #include "RenderMultiColumnSet.h" |
| 36 | #include "RenderMultiColumnSpannerPlaceholder.h" |
| 37 | #include "RenderStyle+GettersInlines.h" |
| 38 | #include "RenderTreeBuilder.h" |
| 39 | #include "RenderView.h" |
| 40 | #include "TransformState.h" |
| 41 | #include <wtf/TZoneMallocInlines.h> |
| 42 | |
| 43 | namespace WebCore { |
| 44 | |
| 45 | WTF_MAKE_TZONE_ALLOCATED_IMPL(RenderMultiColumnFlow)::bmalloc::api::HeapRef RenderMultiColumnFlow::s_heapRef; const TZoneSpecification RenderMultiColumnFlow::s_heapSpec = { & RenderMultiColumnFlow::s_heapRef, TZoneSpecification::encodeSize <RenderMultiColumnFlow>(), TZoneSpecification::encodeAlignment <RenderMultiColumnFlow>(), TZoneSpecification::encodeCategory <RenderMultiColumnFlow>(), ::bmalloc::api::compactAllocationMode <RenderMultiColumnFlow>(), TZoneSpecification::encodeDescriptor <RenderMultiColumnFlow>(), }; void* RenderMultiColumnFlow ::operatorNewSlow(size_t size) { if constexpr (::bmalloc::api ::compactAllocationMode<RenderMultiColumnFlow>() == CompactAllocationMode ::Compact) return ::bmalloc::api::tzoneAllocateCompactSlow(size , s_heapSpec); return ::bmalloc::api::tzoneAllocateNonCompactSlow (size, s_heapSpec); } using __makeBtzoneMallocedInlineMacroSemicolonifier __attribute__((unused)) = int; |
| 46 | |
| 47 | RenderMultiColumnFlow::RenderMultiColumnFlow(Document& document, RenderStyle&& style) |
| 48 | : RenderFragmentedFlow(Type::MultiColumnFlow, document, WTF::move(style)) |
| 49 | { |
| 50 | setFragmentedFlowState(FragmentedFlowState::InsideFlow); |
| 51 | ASSERT(isRenderMultiColumnFlow())((void)0); |
| 52 | } |
| 53 | |
| 54 | RenderMultiColumnFlow::~RenderMultiColumnFlow() = default; |
| 55 | |
| 56 | ASCIILiteral RenderMultiColumnFlow::renderName() const |
| 57 | { |
| 58 | return "RenderMultiColumnFlowThread"_s; |
| 59 | } |
| 60 | |
| 61 | RenderMultiColumnSet* RenderMultiColumnFlow::firstMultiColumnSet() const |
| 62 | { |
| 63 | for (RenderObject* sibling = nextSibling(); sibling; sibling = sibling->nextSibling()) { |
| 64 | if (auto* multiColumnSet = dynamicDowncast<RenderMultiColumnSet>(*sibling)) |
| 65 | return multiColumnSet; |
| 66 | } |
| 67 | return nullptr; |
| 68 | } |
| 69 | |
| 70 | RenderMultiColumnSet* RenderMultiColumnFlow::lastMultiColumnSet() const |
| 71 | { |
| 72 | ASSERT(multiColumnBlockFlow())((void)0); |
| 73 | |
| 74 | for (RenderObject* sibling = multiColumnBlockFlow()->lastChild(); sibling; sibling = sibling->previousSibling()) { |
| 75 | if (auto* multiColumnSet = dynamicDowncast<RenderMultiColumnSet>(*sibling)) |
| 76 | return multiColumnSet; |
| 77 | } |
| 78 | return nullptr; |
| 79 | } |
| 80 | |
| 81 | RenderBox* RenderMultiColumnFlow::firstColumnSetOrSpanner() const |
| 82 | { |
| 83 | if (RenderObject* sibling = nextSibling()) { |
| 84 | ASSERT(is<RenderBox>(*sibling))((void)0); |
| 85 | ASSERT(is<RenderMultiColumnSet>(*sibling) || findColumnSpannerPlaceholder(downcast<RenderBox>(*sibling)))((void)0); |
| 86 | return downcast<RenderBox>(sibling); |
| 87 | } |
| 88 | return nullptr; |
| 89 | } |
| 90 | |
| 91 | RenderBox* RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf(const RenderBox* child) |
| 92 | { |
| 93 | return child ? child->nextSiblingBox() : nullptr; |
| 94 | } |
| 95 | |
| 96 | RenderBox* RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf(const RenderBox* child) |
| 97 | { |
| 98 | if (!child) |
| 99 | return nullptr; |
| 100 | if (auto* sibling = child->previousSiblingBox()) { |
| 101 | if (!is<RenderFragmentedFlow>(*sibling)) |
| 102 | return sibling; |
| 103 | } |
| 104 | return nullptr; |
| 105 | } |
| 106 | |
| 107 | RenderMultiColumnSpannerPlaceholder* RenderMultiColumnFlow::findColumnSpannerPlaceholder(const RenderBox& spanner) const |
| 108 | { |
| 109 | return m_spannerMap.get(spanner); |
| 110 | } |
| 111 | |
| 112 | void RenderMultiColumnFlow::layout() |
| 113 | { |
| 114 | ASSERT(!m_inLayout)((void)0); |
| 115 | m_inLayout = true; |
| 116 | m_lastSetWorkedOn = nullptr; |
| 117 | if (RenderBox* first = firstColumnSetOrSpanner()) { |
| 118 | if (CheckedPtr multiColumnSet = dynamicDowncast<RenderMultiColumnSet>(*first)) { |
| 119 | m_lastSetWorkedOn = multiColumnSet.get(); |
| 120 | multiColumnSet->beginFlow(this); |
| 121 | } |
| 122 | } |
| 123 | RenderFragmentedFlow::layout(); |
| 124 | if (RenderMultiColumnSet* lastSet = lastMultiColumnSet()) { |
| 125 | if (!nextColumnSetOrSpannerSiblingOf(lastSet)) |
| 126 | lastSet->endFlow(this, logicalHeight()); |
| 127 | lastSet->expandToEncompassFragmentedFlowContentsIfNeeded(); |
| 128 | } |
| 129 | m_inLayout = false; |
| 130 | m_lastSetWorkedOn = nullptr; |
| 131 | } |
| 132 | |
| 133 | void RenderMultiColumnFlow::addFragmentToThread(RenderFragmentContainer* fragmentContainer) |
| 134 | { |
| 135 | auto* columnSet = downcast<RenderMultiColumnSet>(fragmentContainer); |
| 136 | if (RenderMultiColumnSet* nextSet = columnSet->nextSiblingMultiColumnSet()) { |
| 137 | auto it = m_fragmentList.find(*nextSet); |
| 138 | ASSERT(it != m_fragmentList.end())((void)0); |
| 139 | m_fragmentList.insertBefore(it, *columnSet); |
| 140 | } else |
| 141 | m_fragmentList.add(*columnSet); |
| 142 | fragmentContainer->setIsValid(true); |
| 143 | } |
| 144 | |
| 145 | void RenderMultiColumnFlow::willBeRemovedFromTree() |
| 146 | { |
| 147 | // Detach all column sets from the flow thread. Cannot destroy them at this point, since they |
| 148 | // are siblings of this object, and there may be pointers to this object's sibling somewhere |
| 149 | // further up on the call stack. |
| 150 | for (RenderMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; columnSet = columnSet->nextSiblingMultiColumnSet()) |
| 151 | columnSet->detachFragment(); |
| 152 | RenderFragmentedFlow::willBeRemovedFromTree(); |
| 153 | } |
| 154 | |
| 155 | void RenderMultiColumnFlow::fragmentedFlowDescendantBoxLaidOut(RenderBox* descendant) |
| 156 | { |
| 157 | CheckedPtr placeholder = dynamicDowncast<RenderMultiColumnSpannerPlaceholder>(*descendant); |
| 158 | if (!placeholder) |
| 159 | return; |
| 160 | |
| 161 | CheckedPtr container = placeholder->containingBlock(); |
| 162 | |
| 163 | for (RenderBox* prev = previousColumnSetOrSpannerSiblingOf(placeholder->spanner()); prev; prev = previousColumnSetOrSpannerSiblingOf(prev)) { |
| 164 | if (CheckedPtr multiColumnSet = dynamicDowncast<RenderMultiColumnSet>(*prev)) { |
| 165 | multiColumnSet->endFlow(container.get(), placeholder->logicalTop()); |
| 166 | break; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | for (RenderBox* next = nextColumnSetOrSpannerSiblingOf(placeholder->spanner()); next; next = nextColumnSetOrSpannerSiblingOf(next)) { |
| 171 | if (CheckedPtr multiColumnSet = dynamicDowncast<RenderMultiColumnSet>(*next)) { |
| 172 | m_lastSetWorkedOn = multiColumnSet.get(); |
| 173 | multiColumnSet->beginFlow(container.get()); |
| 174 | break; |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | RenderBox::LogicalExtentComputedValues RenderMultiColumnFlow::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop) const |
| 180 | { |
| 181 | // We simply remain at our intrinsic height. |
| 182 | return { logicalHeight, logicalTop, ComputedMarginValues() }; |
| 183 | } |
| 184 | |
| 185 | LayoutUnit RenderMultiColumnFlow::initialLogicalWidth() const |
| 186 | { |
| 187 | return columnWidth(); |
| 188 | } |
| 189 | |
| 190 | void RenderMultiColumnFlow::setPageBreak(const RenderBlock* block, LayoutUnit offset, LayoutUnit spaceShortage) |
| 191 | { |
| 192 | // Only positive values are interesting (and allowed) here. Zero space shortage may be reported |
| 193 | // when we're at the top of a column and the element has zero height. Ignore this, and also |
| 194 | // ignore any negative values, which may occur when we set an early break in order to honor |
| 195 | // widows in the next column. |
| 196 | if (spaceShortage <= 0) |
| 197 | return; |
| 198 | |
| 199 | if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) |
| 200 | multicolSet->recordSpaceShortage(spaceShortage); |
| 201 | } |
| 202 | |
| 203 | void RenderMultiColumnFlow::updateMinimumPageHeight(const RenderBlock* block, LayoutUnit offset, LayoutUnit minHeight) |
| 204 | { |
| 205 | if (!hasValidFragmentInfo()) |
| 206 | return; |
| 207 | |
| 208 | if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) |
| 209 | multicolSet->updateMinimumColumnHeight(minHeight); |
| 210 | } |
| 211 | |
| 212 | void RenderMultiColumnFlow::updateSpaceShortageForSizeContainment(const RenderBlock* block, LayoutUnit offset, LayoutUnit shortage) |
| 213 | { |
| 214 | if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) |
| 215 | multicolSet->updateSpaceShortageForSizeContainment(shortage); |
| 216 | } |
| 217 | |
| 218 | RenderFragmentContainer* RenderMultiColumnFlow::fragmentAtBlockOffset(const RenderBox* box, LayoutUnit offset, bool extendLastFragment) const |
| 219 | { |
| 220 | if (!m_inLayout) |
| 221 | return RenderFragmentedFlow::fragmentAtBlockOffset(box, offset, extendLastFragment); |
| 222 | |
| 223 | // Layout in progress. We are calculating the set heights as we speak, so the fragment range |
| 224 | // information is not up-to-date. |
| 225 | |
| 226 | if (m_lastSetWorkedOn && m_lastSetWorkedOn->fragmentedFlow() != this) |
| 227 | m_lastSetWorkedOn = nullptr; |
| 228 | |
| 229 | RenderMultiColumnSet* columnSet = m_lastSetWorkedOn ? m_lastSetWorkedOn.get() : firstMultiColumnSet(); |
| 230 | if (!columnSet) { |
| 231 | // If there's no set, bail. This multicol is empty or only consists of spanners. There |
| 232 | // are no fragments. |
| 233 | return nullptr; |
| 234 | } |
| 235 | // The last set worked on is a good guess. But if we're not within the bounds, search for the |
| 236 | // right one. |
| 237 | if (offset < columnSet->logicalTopInFragmentedFlow()) { |
| 238 | do { |
| 239 | if (RenderMultiColumnSet* prev = columnSet->previousSiblingMultiColumnSet()) |
| 240 | columnSet = prev; |
| 241 | else |
| 242 | break; |
| 243 | } while (offset < columnSet->logicalTopInFragmentedFlow()); |
| 244 | } else { |
| 245 | while (offset >= columnSet->logicalBottomInFragmentedFlow()) { |
| 246 | RenderMultiColumnSet* next = columnSet->nextSiblingMultiColumnSet(); |
| 247 | if (!next || !next->hasBeenFlowed()) |
| 248 | break; |
| 249 | columnSet = next; |
| 250 | } |
| 251 | } |
| 252 | return columnSet; |
| 253 | } |
| 254 | |
| 255 | void RenderMultiColumnFlow::setFragmentRangeForBox(const RenderBox& box, RenderFragmentContainer* startFragment, RenderFragmentContainer* endFragment) |
| 256 | { |
| 257 | // Some column sets may have zero height, which means that two or more sets may start at the |
| 258 | // exact same flow thread position, which means that some parts of the code may believe that a |
| 259 | // given box lives in sets that it doesn't really live in. Make some adjustments here and |
| 260 | // include such sets if they are adjacent to the start and/or end fragments. |
| 261 | for (RenderMultiColumnSet* columnSet = downcast<RenderMultiColumnSet>(*startFragment).previousSiblingMultiColumnSet(); columnSet; columnSet = columnSet->previousSiblingMultiColumnSet()) { |
| 262 | if (columnSet->logicalHeightInFragmentedFlow()) |
| 263 | break; |
| 264 | startFragment = columnSet; |
| 265 | } |
| 266 | for (RenderMultiColumnSet* columnSet = downcast<RenderMultiColumnSet>(*startFragment).nextSiblingMultiColumnSet(); columnSet; columnSet = columnSet->nextSiblingMultiColumnSet()) { |
| 267 | if (columnSet->logicalHeightInFragmentedFlow()) |
| 268 | break; |
| 269 | endFragment = columnSet; |
| 270 | } |
| 271 | |
| 272 | RenderFragmentedFlow::setFragmentRangeForBox(box, startFragment, endFragment); |
| 273 | } |
| 274 | |
| 275 | bool RenderMultiColumnFlow::addForcedFragmentBreak(const RenderBlock* block, LayoutUnit offset, RenderBox* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) |
| 276 | { |
| 277 | if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) { |
| 278 | multicolSet->addForcedBreak(offset); |
| 279 | if (offsetBreakAdjustment) |
| 280 | *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRemainingLogicalHeightForOffset(offset, IncludePageBoundary) : 0_lu; |
| 281 | return true; |
| 282 | } |
| 283 | return false; |
| 284 | } |
| 285 | |
| 286 | LayoutSize RenderMultiColumnFlow::offsetFromContainer(const RenderElement& enclosingContainer, const LayoutPoint& physicalPoint, bool* offsetDependsOnPoint) const |
| 287 | { |
| 288 | ASSERT(&enclosingContainer == container())((void)0); |
| 289 | |
| 290 | if (offsetDependsOnPoint) |
| 291 | *offsetDependsOnPoint = true; |
| 292 | |
| 293 | LayoutPoint translatedPhysicalPoint(physicalPoint); |
| 294 | if (RenderFragmentContainer* fragment = physicalTranslationFromFlowToFragment(translatedPhysicalPoint)) |
| 295 | translatedPhysicalPoint.moveBy(fragment->topLeftLocation()); |
| 296 | |
| 297 | LayoutSize offset(translatedPhysicalPoint.x(), translatedPhysicalPoint.y()); |
| 298 | if (auto* enclosingBox = dynamicDowncast<RenderBox>(enclosingContainer)) |
| 299 | offset -= toLayoutSize(enclosingBox->scrollPosition()); |
| 300 | return offset; |
| 301 | } |
| 302 | |
| 303 | void RenderMultiColumnFlow::mapAbsoluteToLocalPoint(OptionSet<MapCoordinatesMode> mode, TransformState& transformState) const |
| 304 | { |
| 305 | // First get the transform state's point into the block flow thread's physical coordinate space. |
| 306 | parent()->mapAbsoluteToLocalPoint(mode, transformState); |
| 307 | LayoutPoint transformPoint(transformState.mappedPoint()); |
| 308 | |
| 309 | // Now walk through each fragment. |
| 310 | const RenderMultiColumnSet* candidateColumnSet = nullptr; |
| 311 | LayoutPoint candidatePoint; |
| 312 | LayoutSize candidateContainerOffset; |
| 313 | |
| 314 | for (const auto& columnSet : childrenOfType<RenderMultiColumnSet>(*parent())) { |
| 315 | candidateContainerOffset = columnSet.offsetFromContainer(*parent(), LayoutPoint()); |
| 316 | |
| 317 | candidatePoint = transformPoint - candidateContainerOffset; |
| 318 | candidateColumnSet = &columnSet; |
| 319 | |
| 320 | // We really have no clue what to do with overflow. We'll just use the closest fragment to the point in that case. |
| 321 | LayoutUnit pointOffset = isHorizontalWritingMode() ? candidatePoint.y() : candidatePoint.x(); |
| 322 | LayoutUnit fragmentOffset = isHorizontalWritingMode() ? columnSet.topLeftLocation().y() : columnSet.topLeftLocation().x(); |
| 323 | if (pointOffset < fragmentOffset + columnSet.logicalHeight()) |
| 324 | break; |
| 325 | } |
| 326 | |
| 327 | // Once we have a good guess as to which fragment we hit tested through (and yes, this was just a heuristic, but it's |
| 328 | // the best we could do), then we can map from the fragment into the flow thread. |
| 329 | LayoutSize translationOffset = physicalTranslationFromFragmentToFlow(candidateColumnSet, candidatePoint) + candidateContainerOffset; |
| 330 | pushOntoTransformState(transformState, mode, nullptr, parent(), translationOffset, false); |
| 331 | } |
| 332 | |
| 333 | LayoutSize RenderMultiColumnFlow::physicalTranslationFromFragmentToFlow(const RenderMultiColumnSet* columnSet, const LayoutPoint& physicalPoint) const |
| 334 | { |
| 335 | LayoutPoint logicalPoint = columnSet->flipForWritingMode(physicalPoint); |
| 336 | LayoutPoint translatedPoint = columnSet->translateFragmentPointToFragmentedFlow(logicalPoint); |
| 337 | LayoutPoint physicalTranslatedPoint = columnSet->flipForWritingMode(translatedPoint); |
| 338 | return physicalPoint - physicalTranslatedPoint; |
| 339 | } |
| 340 | |
| 341 | RenderFragmentContainer* RenderMultiColumnFlow::mapFromFlowToFragment(TransformState& transformState) const |
| 342 | { |
| 343 | if (!hasValidFragmentInfo()) |
| 344 | return nullptr; |
| 345 | |
| 346 | // Get back into our local flow thread space. |
| 347 | LayoutRect boxRect = transformState.mappedQuad().enclosingBoundingBox(); |
| 348 | flipForWritingMode(boxRect); |
| 349 | |
| 350 | // FIXME: We need to refactor RenderObject::absoluteQuads to be able to split the quads across fragments, |
| 351 | // for now we just take the center of the mapped enclosing box and map it to a column. |
| 352 | LayoutPoint centerPoint = boxRect.center(); |
| 353 | LayoutUnit centerLogicalOffset = isHorizontalWritingMode() ? centerPoint.y() : centerPoint.x(); |
| 354 | auto* fragmentContainer = fragmentAtBlockOffset(this, centerLogicalOffset, true); |
| 355 | if (!fragmentContainer) |
| 356 | return nullptr; |
| 357 | transformState.move(physicalTranslationOffsetFromFlowToFragment(fragmentContainer, centerLogicalOffset)); |
| 358 | return fragmentContainer; |
| 359 | } |
| 360 | |
| 361 | LayoutSize RenderMultiColumnFlow::physicalTranslationOffsetFromFlowToFragment(const RenderFragmentContainer* fragmentContainer, const LayoutUnit logicalOffset) const |
| 362 | { |
| 363 | // Now that we know which multicolumn set we hit, we need to get the appropriate translation offset for the column. |
| 364 | const auto* columnSet = downcast<RenderMultiColumnSet>(fragmentContainer); |
| 365 | LayoutPoint translationOffset = columnSet->columnTranslationForOffset(logicalOffset); |
| 366 | |
| 367 | // Now we know how we want the rect to be translated into the fragment. At this point we're converting |
| 368 | // back to physical coordinates. |
| 369 | if (writingMode().isBlockFlipped()) { |
| 370 | LayoutRect portionRect(columnSet->fragmentedFlowPortionRect()); |
| 371 | LayoutRect columnRect = columnSet->columnRectAt(0); |
| 372 | LayoutUnit physicalDeltaFromPortionBottom = logicalHeight() - columnSet->logicalBottomInFragmentedFlow(); |
| 373 | if (isHorizontalWritingMode()) |
| 374 | columnRect.setHeight(portionRect.height()); |
| 375 | else |
| 376 | columnRect.setWidth(portionRect.width()); |
| 377 | columnSet->flipForWritingMode(columnRect); |
| 378 | if (isHorizontalWritingMode()) |
| 379 | translationOffset.move(0_lu, columnRect.y() - portionRect.y() - physicalDeltaFromPortionBottom); |
| 380 | else |
| 381 | translationOffset.move(columnRect.x() - portionRect.x() - physicalDeltaFromPortionBottom, 0_lu); |
| 382 | } |
| 383 | |
| 384 | return LayoutSize(translationOffset.x(), translationOffset.y()); |
| 385 | } |
| 386 | |
| 387 | RenderFragmentContainer* RenderMultiColumnFlow::physicalTranslationFromFlowToFragment(LayoutPoint& physicalPoint) const |
| 388 | { |
| 389 | if (!hasValidFragmentInfo()) |
| 390 | return nullptr; |
| 391 | |
| 392 | // Put the physical point into the flow thread's coordinate space. |
| 393 | LayoutPoint logicalPoint = flipForWritingMode(physicalPoint); |
| 394 | |
| 395 | // Now get the fragment that we are in. |
| 396 | LayoutUnit logicalOffset = isHorizontalWritingMode() ? logicalPoint.y() : logicalPoint.x(); |
| 397 | RenderFragmentContainer* fragmentContainer = fragmentAtBlockOffset(this, logicalOffset, true); |
| 398 | if (!fragmentContainer) |
| 399 | return nullptr; |
| 400 | |
| 401 | // Translate to the coordinate space of the fragment. |
| 402 | LayoutSize translationOffset = physicalTranslationOffsetFromFlowToFragment(fragmentContainer, logicalOffset); |
| 403 | |
| 404 | // Now shift the physical point into the fragment's coordinate space. |
| 405 | physicalPoint += translationOffset; |
| 406 | |
| 407 | return fragmentContainer; |
| 408 | } |
| 409 | |
| 410 | bool RenderMultiColumnFlow::isPageLogicalHeightKnown() const |
| 411 | { |
| 412 | if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) |
| 413 | return columnSet->columnHeightComputed(); |
| 414 | return false; |
| 415 | } |
| 416 | |
| 417 | bool RenderMultiColumnFlow::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) |
| 418 | { |
| 419 | // You cannot be inside an in-flow RenderFragmentedFlow without a corresponding DOM node. It's better to |
| 420 | // just let the ancestor figure out where we are instead. |
| 421 | if (hitTestAction == HitTestBlockBackground) |
| 422 | return false; |
| 423 | bool inside = RenderFragmentedFlow::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction); |
| 424 | if (inside && !result.innerNode()) |
| 425 | return false; |
| 426 | return inside; |
| 427 | } |
| 428 | |
| 429 | bool RenderMultiColumnFlow::shouldCheckColumnBreaks() const |
| 430 | { |
| 431 | if (!parent()->isRenderView()) |
| 432 | return true; |
| 433 | return view().frameView().pagination().behavesLikeColumns; |
Call argument for 'this' parameter is uncounted and unsafe | |
| 434 | } |
| 435 | |
| 436 | } |