| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 child->layoutIfNeeded(); | 430 child->layoutIfNeeded(); |
| 431 ASSERT(!child->needsLayout()); | 431 ASSERT(!child->needsLayout()); |
| 432 child = child->nextSibling(); | 432 child = child->nextSibling(); |
| 433 } | 433 } |
| 434 invalidateBackgroundObscurationStatus(); | 434 invalidateBackgroundObscurationStatus(); |
| 435 clearNeedsLayout(); | 435 clearNeedsLayout(); |
| 436 } | 436 } |
| 437 | 437 |
| 438 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object | 438 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object |
| 439 // excluding border and scrollbar. | 439 // excluding border and scrollbar. |
| 440 DISABLE_CFI_PERF |
| 440 LayoutUnit LayoutBox::clientWidth() const | 441 LayoutUnit LayoutBox::clientWidth() const |
| 441 { | 442 { |
| 442 return m_frameRect.width() - borderLeft() - borderRight() - verticalScrollba
rWidth(); | 443 return m_frameRect.width() - borderLeft() - borderRight() - verticalScrollba
rWidth(); |
| 443 } | 444 } |
| 444 | 445 |
| 446 DISABLE_CFI_PERF |
| 445 LayoutUnit LayoutBox::clientHeight() const | 447 LayoutUnit LayoutBox::clientHeight() const |
| 446 { | 448 { |
| 447 return m_frameRect.height() - borderTop() - borderBottom() - horizontalScrol
lbarHeight(); | 449 return m_frameRect.height() - borderTop() - borderBottom() - horizontalScrol
lbarHeight(); |
| 448 } | 450 } |
| 449 | 451 |
| 450 int LayoutBox::pixelSnappedClientWidth() const | 452 int LayoutBox::pixelSnappedClientWidth() const |
| 451 { | 453 { |
| 452 return snapSizeToPixel(clientWidth(), location().x() + clientLeft()); | 454 return snapSizeToPixel(clientWidth(), location().x() + clientLeft()); |
| 453 } | 455 } |
| 454 | 456 |
| 457 DISABLE_CFI_PERF |
| 455 int LayoutBox::pixelSnappedClientHeight() const | 458 int LayoutBox::pixelSnappedClientHeight() const |
| 456 { | 459 { |
| 457 return snapSizeToPixel(clientHeight(), location().y() + clientTop()); | 460 return snapSizeToPixel(clientHeight(), location().y() + clientTop()); |
| 458 } | 461 } |
| 459 | 462 |
| 460 int LayoutBox::pixelSnappedOffsetWidth(const Element*) const | 463 int LayoutBox::pixelSnappedOffsetWidth(const Element*) const |
| 461 { | 464 { |
| 462 return snapSizeToPixel(offsetWidth(), location().x() + clientLeft()); | 465 return snapSizeToPixel(offsetWidth(), location().x() + clientLeft()); |
| 463 } | 466 } |
| 464 | 467 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 #if ENABLE(ASSERT) | 1106 #if ENABLE(ASSERT) |
| 1104 SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<LayoutBox&
>(*this)); | 1107 SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<LayoutBox&
>(*this)); |
| 1105 #endif | 1108 #endif |
| 1106 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); | 1109 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); |
| 1107 ASSERT(!preferredLogicalWidthsDirty()); | 1110 ASSERT(!preferredLogicalWidthsDirty()); |
| 1108 } | 1111 } |
| 1109 | 1112 |
| 1110 return m_minPreferredLogicalWidth; | 1113 return m_minPreferredLogicalWidth; |
| 1111 } | 1114 } |
| 1112 | 1115 |
| 1116 DISABLE_CFI_PERF |
| 1113 LayoutUnit LayoutBox::maxPreferredLogicalWidth() const | 1117 LayoutUnit LayoutBox::maxPreferredLogicalWidth() const |
| 1114 { | 1118 { |
| 1115 if (preferredLogicalWidthsDirty()) { | 1119 if (preferredLogicalWidthsDirty()) { |
| 1116 #if ENABLE(ASSERT) | 1120 #if ENABLE(ASSERT) |
| 1117 SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<LayoutBox&
>(*this)); | 1121 SetLayoutNeededForbiddenScope layoutForbiddenScope(const_cast<LayoutBox&
>(*this)); |
| 1118 #endif | 1122 #endif |
| 1119 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); | 1123 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); |
| 1120 ASSERT(!preferredLogicalWidthsDirty()); | 1124 ASSERT(!preferredLogicalWidthsDirty()); |
| 1121 } | 1125 } |
| 1122 | 1126 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 if (childLocalRect.maxY() > childBox->size().height() || childLocalRect.
maxX() > childBox->size().width()) | 1495 if (childLocalRect.maxY() > childBox->size().height() || childLocalRect.
maxX() > childBox->size().width()) |
| 1492 continue; | 1496 continue; |
| 1493 if (childBox->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) | 1497 if (childBox->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) |
| 1494 return true; | 1498 return true; |
| 1495 if (childBox->foregroundIsKnownToBeOpaqueInRect(childLocalRect, maxDepth
ToTest - 1)) | 1499 if (childBox->foregroundIsKnownToBeOpaqueInRect(childLocalRect, maxDepth
ToTest - 1)) |
| 1496 return true; | 1500 return true; |
| 1497 } | 1501 } |
| 1498 return false; | 1502 return false; |
| 1499 } | 1503 } |
| 1500 | 1504 |
| 1505 DISABLE_CFI_PERF |
| 1501 bool LayoutBox::computeBackgroundIsKnownToBeObscured() const | 1506 bool LayoutBox::computeBackgroundIsKnownToBeObscured() const |
| 1502 { | 1507 { |
| 1503 if (scrollsOverflow()) | 1508 if (scrollsOverflow()) |
| 1504 return false; | 1509 return false; |
| 1505 // Test to see if the children trivially obscure the background. | 1510 // Test to see if the children trivially obscure the background. |
| 1506 if (!styleRef().hasBackground()) | 1511 if (!styleRef().hasBackground()) |
| 1507 return false; | 1512 return false; |
| 1508 // Root background painting is special. | 1513 // Root background painting is special. |
| 1509 if (isLayoutView()) | 1514 if (isLayoutView()) |
| 1510 return false; | 1515 return false; |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2255 // Make sure to compute the autosized width. | 2260 // Make sure to compute the autosized width. |
| 2256 if (itemMarker->needsLayout()) | 2261 if (itemMarker->needsLayout()) |
| 2257 itemMarker->layout(); | 2262 itemMarker->layout(); |
| 2258 maxWidth = std::max<float>(maxWidth, toLayoutListMarker(itemMarker)-
>logicalWidth().toFloat()); | 2263 maxWidth = std::max<float>(maxWidth, toLayoutListMarker(itemMarker)-
>logicalWidth().toFloat()); |
| 2259 break; | 2264 break; |
| 2260 } | 2265 } |
| 2261 } | 2266 } |
| 2262 return maxWidth; | 2267 return maxWidth; |
| 2263 } | 2268 } |
| 2264 | 2269 |
| 2270 DISABLE_CFI_PERF |
| 2265 void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
const | 2271 void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
const |
| 2266 { | 2272 { |
| 2267 computedValues.m_extent = style()->containsSize() ? borderAndPaddingLogicalW
idth() : logicalWidth(); | 2273 computedValues.m_extent = style()->containsSize() ? borderAndPaddingLogicalW
idth() : logicalWidth(); |
| 2268 computedValues.m_position = logicalLeft(); | 2274 computedValues.m_position = logicalLeft(); |
| 2269 computedValues.m_margins.m_start = marginStart(); | 2275 computedValues.m_margins.m_start = marginStart(); |
| 2270 computedValues.m_margins.m_end = marginEnd(); | 2276 computedValues.m_margins.m_end = marginEnd(); |
| 2271 | 2277 |
| 2272 if (isOutOfFlowPositioned()) { | 2278 if (isOutOfFlowPositioned()) { |
| 2273 computePositionedLogicalWidth(computedValues); | 2279 computePositionedLogicalWidth(computedValues); |
| 2274 return; | 2280 return; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 LayoutUnit LayoutBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, Lay
outUnit& marginStart, LayoutUnit& marginEnd) const | 2366 LayoutUnit LayoutBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, Lay
outUnit& marginStart, LayoutUnit& marginEnd) const |
| 2361 { | 2367 { |
| 2362 ASSERT(availableLogicalWidth >= 0); | 2368 ASSERT(availableLogicalWidth >= 0); |
| 2363 marginStart = minimumValueForLength(style()->marginStart(), availableLogical
Width); | 2369 marginStart = minimumValueForLength(style()->marginStart(), availableLogical
Width); |
| 2364 marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidt
h); | 2370 marginEnd = minimumValueForLength(style()->marginEnd(), availableLogicalWidt
h); |
| 2365 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd; | 2371 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd; |
| 2366 available = std::max(available, LayoutUnit()); | 2372 available = std::max(available, LayoutUnit()); |
| 2367 return available; | 2373 return available; |
| 2368 } | 2374 } |
| 2369 | 2375 |
| 2376 DISABLE_CFI_PERF |
| 2370 LayoutUnit LayoutBox::computeIntrinsicLogicalWidthUsing(const Length& logicalWid
thLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const | 2377 LayoutUnit LayoutBox::computeIntrinsicLogicalWidthUsing(const Length& logicalWid
thLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const |
| 2371 { | 2378 { |
| 2372 if (logicalWidthLength.type() == FillAvailable) | 2379 if (logicalWidthLength.type() == FillAvailable) |
| 2373 return std::max(borderAndPadding, fillAvailableMeasure(availableLogicalW
idth)); | 2380 return std::max(borderAndPadding, fillAvailableMeasure(availableLogicalW
idth)); |
| 2374 | 2381 |
| 2375 LayoutUnit minLogicalWidth; | 2382 LayoutUnit minLogicalWidth; |
| 2376 LayoutUnit maxLogicalWidth; | 2383 LayoutUnit maxLogicalWidth; |
| 2377 computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); | 2384 computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); |
| 2378 | 2385 |
| 2379 if (logicalWidthLength.type() == MinContent) | 2386 if (logicalWidthLength.type() == MinContent) |
| 2380 return minLogicalWidth + borderAndPadding; | 2387 return minLogicalWidth + borderAndPadding; |
| 2381 | 2388 |
| 2382 if (logicalWidthLength.type() == MaxContent) | 2389 if (logicalWidthLength.type() == MaxContent) |
| 2383 return maxLogicalWidth + borderAndPadding; | 2390 return maxLogicalWidth + borderAndPadding; |
| 2384 | 2391 |
| 2385 if (logicalWidthLength.type() == FitContent) { | 2392 if (logicalWidthLength.type() == FitContent) { |
| 2386 minLogicalWidth += borderAndPadding; | 2393 minLogicalWidth += borderAndPadding; |
| 2387 maxLogicalWidth += borderAndPadding; | 2394 maxLogicalWidth += borderAndPadding; |
| 2388 return std::max(minLogicalWidth, std::min(maxLogicalWidth, fillAvailable
Measure(availableLogicalWidth))); | 2395 return std::max(minLogicalWidth, std::min(maxLogicalWidth, fillAvailable
Measure(availableLogicalWidth))); |
| 2389 } | 2396 } |
| 2390 | 2397 |
| 2391 ASSERT_NOT_REACHED(); | 2398 ASSERT_NOT_REACHED(); |
| 2392 return LayoutUnit(); | 2399 return LayoutUnit(); |
| 2393 } | 2400 } |
| 2394 | 2401 |
| 2402 DISABLE_CFI_PERF |
| 2395 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const LayoutBlock* cb) const | 2403 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, const Length&
logicalWidth, LayoutUnit availableLogicalWidth, const LayoutBlock* cb) const |
| 2396 { | 2404 { |
| 2397 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalW
idth.isAuto()); | 2405 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalW
idth.isAuto()); |
| 2398 if (widthType == MinSize && logicalWidth.isAuto()) | 2406 if (widthType == MinSize && logicalWidth.isAuto()) |
| 2399 return adjustBorderBoxLogicalWidthForBoxSizing(0); | 2407 return adjustBorderBoxLogicalWidthForBoxSizing(0); |
| 2400 | 2408 |
| 2401 if (!logicalWidth.isIntrinsicOrAuto()) { | 2409 if (!logicalWidth.isIntrinsicOrAuto()) { |
| 2402 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. | 2410 // FIXME: If the containing block flow is perpendicular to our direction
we need to use the available logical height instead. |
| 2403 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); | 2411 return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWid
th, availableLogicalWidth)); |
| 2404 } | 2412 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 marginStart = availableWidth - childWidth - marginEnd; | 2592 marginStart = availableWidth - childWidth - marginEnd; |
| 2585 return; | 2593 return; |
| 2586 } | 2594 } |
| 2587 } | 2595 } |
| 2588 | 2596 |
| 2589 // Either no auto margins, or our margin box width is >= the container width
, auto margins will just turn into 0. | 2597 // Either no auto margins, or our margin box width is >= the container width
, auto margins will just turn into 0. |
| 2590 marginStart = marginStartWidth; | 2598 marginStart = marginStartWidth; |
| 2591 marginEnd = marginEndWidth; | 2599 marginEnd = marginEndWidth; |
| 2592 } | 2600 } |
| 2593 | 2601 |
| 2602 DISABLE_CFI_PERF |
| 2594 void LayoutBox::updateLogicalHeight() | 2603 void LayoutBox::updateLogicalHeight() |
| 2595 { | 2604 { |
| 2596 m_intrinsicContentLogicalHeight = contentLogicalHeight(); | 2605 m_intrinsicContentLogicalHeight = contentLogicalHeight(); |
| 2597 | 2606 |
| 2598 LogicalExtentComputedValues computedValues; | 2607 LogicalExtentComputedValues computedValues; |
| 2599 LayoutUnit height = style()->containsSize() ? borderAndPaddingLogicalHeight(
) : logicalHeight(); | 2608 LayoutUnit height = style()->containsSize() ? borderAndPaddingLogicalHeight(
) : logicalHeight(); |
| 2600 computeLogicalHeight(height, logicalTop(), computedValues); | 2609 computeLogicalHeight(height, logicalTop(), computedValues); |
| 2601 | 2610 |
| 2602 setLogicalHeight(computedValues.m_extent); | 2611 setLogicalHeight(computedValues.m_extent); |
| 2603 setLogicalTop(computedValues.m_position); | 2612 setLogicalTop(computedValues.m_position); |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3977 closestLayoutObject = layoutBox; | 3986 closestLayoutObject = layoutBox; |
| 3978 minDist = dist; | 3987 minDist = dist; |
| 3979 } | 3988 } |
| 3980 } | 3989 } |
| 3981 | 3990 |
| 3982 if (closestLayoutObject) | 3991 if (closestLayoutObject) |
| 3983 return closestLayoutObject->positionForPoint(adjustedPoint - closestLayo
utObject->locationOffset()); | 3992 return closestLayoutObject->positionForPoint(adjustedPoint - closestLayo
utObject->locationOffset()); |
| 3984 return createPositionWithAffinity(firstPositionInOrBeforeNode(nonPseudoNode(
))); | 3993 return createPositionWithAffinity(firstPositionInOrBeforeNode(nonPseudoNode(
))); |
| 3985 } | 3994 } |
| 3986 | 3995 |
| 3996 DISABLE_CFI_PERF |
| 3987 bool LayoutBox::shrinkToAvoidFloats() const | 3997 bool LayoutBox::shrinkToAvoidFloats() const |
| 3988 { | 3998 { |
| 3989 // Floating objects don't shrink. Objects that don't avoid floats don't shr
ink. | 3999 // Floating objects don't shrink. Objects that don't avoid floats don't shr
ink. |
| 3990 if (isInline() || !avoidsFloats() || isFloating()) | 4000 if (isInline() || !avoidsFloats() || isFloating()) |
| 3991 return false; | 4001 return false; |
| 3992 | 4002 |
| 3993 // Only auto width objects can possibly shrink to avoid floats. | 4003 // Only auto width objects can possibly shrink to avoid floats. |
| 3994 return style()->width().isAuto(); | 4004 return style()->width().isAuto(); |
| 3995 } | 4005 } |
| 3996 | 4006 |
| 3997 static bool shouldBeConsideredAsReplaced(Node* node) | 4007 static bool shouldBeConsideredAsReplaced(Node* node) |
| 3998 { | 4008 { |
| 3999 // Checkboxes and radioboxes are not isAtomicInlineLevel() nor do they have
their own layoutObject in which to override avoidFloats(). | 4009 // Checkboxes and radioboxes are not isAtomicInlineLevel() nor do they have
their own layoutObject in which to override avoidFloats(). |
| 4000 return node && node->isElementNode() && (toElement(node)->isFormControlEleme
nt() || isHTMLImageElement(toElement(node))); | 4010 return node && node->isElementNode() && (toElement(node)->isFormControlEleme
nt() || isHTMLImageElement(toElement(node))); |
| 4001 } | 4011 } |
| 4002 | 4012 |
| 4013 DISABLE_CFI_PERF |
| 4003 bool LayoutBox::avoidsFloats() const | 4014 bool LayoutBox::avoidsFloats() const |
| 4004 { | 4015 { |
| 4005 return isAtomicInlineLevel() || shouldBeConsideredAsReplaced(node()) || hasO
verflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemInclud
ingDeprecated() || style()->containsPaint() || style()->containsLayout(); | 4016 return isAtomicInlineLevel() || shouldBeConsideredAsReplaced(node()) || hasO
verflowClip() || isHR() || isLegend() || isWritingModeRoot() || isFlexItemInclud
ingDeprecated() || style()->containsPaint() || style()->containsLayout(); |
| 4006 } | 4017 } |
| 4007 | 4018 |
| 4008 bool LayoutBox::hasNonCompositedScrollbars() const | 4019 bool LayoutBox::hasNonCompositedScrollbars() const |
| 4009 { | 4020 { |
| 4010 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { | 4021 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) { |
| 4011 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->layerFo
rHorizontalScrollbar()) | 4022 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->layerFo
rHorizontalScrollbar()) |
| 4012 return true; | 4023 return true; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4086 int outlineOutset = style()->outlineOutsetExtent(); | 4097 int outlineOutset = style()->outlineOutsetExtent(); |
| 4087 top = std::max(top, -rect.y() + outlineOutset); | 4098 top = std::max(top, -rect.y() + outlineOutset); |
| 4088 right = std::max(right, rect.maxX() - size().width() + outlineOutset); | 4099 right = std::max(right, rect.maxX() - size().width() + outlineOutset); |
| 4089 bottom = std::max(bottom, rect.maxY() - size().height() + outlineOutset)
; | 4100 bottom = std::max(bottom, rect.maxY() - size().height() + outlineOutset)
; |
| 4090 left = std::max(left, -rect.x() + outlineOutset); | 4101 left = std::max(left, -rect.x() + outlineOutset); |
| 4091 } | 4102 } |
| 4092 | 4103 |
| 4093 return LayoutRectOutsets(top, right, bottom, left); | 4104 return LayoutRectOutsets(top, right, bottom, left); |
| 4094 } | 4105 } |
| 4095 | 4106 |
| 4107 DISABLE_CFI_PERF |
| 4096 void LayoutBox::addOverflowFromChild(LayoutBox* child, const LayoutSize& delta) | 4108 void LayoutBox::addOverflowFromChild(LayoutBox* child, const LayoutSize& delta) |
| 4097 { | 4109 { |
| 4098 // Never allow flow threads to propagate overflow up to a parent. | 4110 // Never allow flow threads to propagate overflow up to a parent. |
| 4099 if (child->isLayoutFlowThread()) | 4111 if (child->isLayoutFlowThread()) |
| 4100 return; | 4112 return; |
| 4101 | 4113 |
| 4102 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then | 4114 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then |
| 4103 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this | 4115 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this |
| 4104 // and just propagates the border box rect instead. | 4116 // and just propagates the border box rect instead. |
| 4105 LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation
(styleRef()); | 4117 LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation
(styleRef()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4119 bool LayoutBox::hasTopOverflow() const | 4131 bool LayoutBox::hasTopOverflow() const |
| 4120 { | 4132 { |
| 4121 return !style()->isLeftToRightDirection() && !isHorizontalWritingMode(); | 4133 return !style()->isLeftToRightDirection() && !isHorizontalWritingMode(); |
| 4122 } | 4134 } |
| 4123 | 4135 |
| 4124 bool LayoutBox::hasLeftOverflow() const | 4136 bool LayoutBox::hasLeftOverflow() const |
| 4125 { | 4137 { |
| 4126 return !style()->isLeftToRightDirection() && isHorizontalWritingMode(); | 4138 return !style()->isLeftToRightDirection() && isHorizontalWritingMode(); |
| 4127 } | 4139 } |
| 4128 | 4140 |
| 4141 DISABLE_CFI_PERF |
| 4129 void LayoutBox::addLayoutOverflow(const LayoutRect& rect) | 4142 void LayoutBox::addLayoutOverflow(const LayoutRect& rect) |
| 4130 { | 4143 { |
| 4131 if (rect.isEmpty()) | 4144 if (rect.isEmpty()) |
| 4132 return; | 4145 return; |
| 4133 | 4146 |
| 4134 LayoutRect clientBox = noOverflowRect(); | 4147 LayoutRect clientBox = noOverflowRect(); |
| 4135 if (clientBox.contains(rect)) | 4148 if (clientBox.contains(rect)) |
| 4136 return; | 4149 return; |
| 4137 | 4150 |
| 4138 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. | 4151 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4206 | 4219 |
| 4207 m_overflow->setLayoutOverflow(noOverflowRect()); | 4220 m_overflow->setLayoutOverflow(noOverflowRect()); |
| 4208 } | 4221 } |
| 4209 | 4222 |
| 4210 bool LayoutBox::percentageLogicalHeightIsResolvable() const | 4223 bool LayoutBox::percentageLogicalHeightIsResolvable() const |
| 4211 { | 4224 { |
| 4212 Length fakeLength(100, Percent); | 4225 Length fakeLength(100, Percent); |
| 4213 return computePercentageLogicalHeight(fakeLength) != -1; | 4226 return computePercentageLogicalHeight(fakeLength) != -1; |
| 4214 } | 4227 } |
| 4215 | 4228 |
| 4229 DISABLE_CFI_PERF |
| 4216 bool LayoutBox::hasUnsplittableScrollingOverflow() const | 4230 bool LayoutBox::hasUnsplittableScrollingOverflow() const |
| 4217 { | 4231 { |
| 4218 // We will paginate as long as we don't scroll overflow in the pagination di
rection. | 4232 // We will paginate as long as we don't scroll overflow in the pagination di
rection. |
| 4219 bool isHorizontal = isHorizontalWritingMode(); | 4233 bool isHorizontal = isHorizontalWritingMode(); |
| 4220 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf
lowX())) | 4234 if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverf
lowX())) |
| 4221 return false; | 4235 return false; |
| 4222 | 4236 |
| 4223 // We do have overflow. We'll still be willing to paginate as long as the bl
ock | 4237 // We do have overflow. We'll still be willing to paginate as long as the bl
ock |
| 4224 // has auto logical height, auto or undefined max-logical-height and a zero
or auto min-logical-height. | 4238 // has auto logical height, auto or undefined max-logical-height and a zero
or auto min-logical-height. |
| 4225 // Note this is just a heuristic, and it's still possible to have overflow u
nder these | 4239 // Note this is just a heuristic, and it's still possible to have overflow u
nder these |
| (...skipping 20 matching lines...) Expand all Loading... |
| 4246 return AllowAnyBreaks; | 4260 return AllowAnyBreaks; |
| 4247 } | 4261 } |
| 4248 | 4262 |
| 4249 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction
, LinePositionMode /*linePositionMode*/) const | 4263 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction
, LinePositionMode /*linePositionMode*/) const |
| 4250 { | 4264 { |
| 4251 if (isAtomicInlineLevel()) | 4265 if (isAtomicInlineLevel()) |
| 4252 return direction == HorizontalLine ? marginHeight() + size().height() :
marginWidth() + size().width(); | 4266 return direction == HorizontalLine ? marginHeight() + size().height() :
marginWidth() + size().width(); |
| 4253 return LayoutUnit(); | 4267 return LayoutUnit(); |
| 4254 } | 4268 } |
| 4255 | 4269 |
| 4270 DISABLE_CFI_PERF |
| 4256 int LayoutBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L
ineDirectionMode direction, LinePositionMode linePositionMode) const | 4271 int LayoutBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L
ineDirectionMode direction, LinePositionMode linePositionMode) const |
| 4257 { | 4272 { |
| 4258 ASSERT(linePositionMode == PositionOnContainingLine); | 4273 ASSERT(linePositionMode == PositionOnContainingLine); |
| 4259 if (isAtomicInlineLevel()) { | 4274 if (isAtomicInlineLevel()) { |
| 4260 int result = direction == HorizontalLine ? roundToInt(marginHeight() + s
ize().height()) : roundToInt(marginWidth() + size().width()); | 4275 int result = direction == HorizontalLine ? roundToInt(marginHeight() + s
ize().height()) : roundToInt(marginWidth() + size().width()); |
| 4261 if (baselineType == AlphabeticBaseline) | 4276 if (baselineType == AlphabeticBaseline) |
| 4262 return result; | 4277 return result; |
| 4263 return result - result / 2; | 4278 return result - result / 2; |
| 4264 } | 4279 } |
| 4265 return 0; | 4280 return 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4279 } | 4294 } |
| 4280 | 4295 |
| 4281 LayoutRect LayoutBox::logicalVisualOverflowRectForPropagation(const ComputedStyl
e& parentStyle) const | 4296 LayoutRect LayoutBox::logicalVisualOverflowRectForPropagation(const ComputedStyl
e& parentStyle) const |
| 4282 { | 4297 { |
| 4283 LayoutRect rect = visualOverflowRectForPropagation(parentStyle); | 4298 LayoutRect rect = visualOverflowRectForPropagation(parentStyle); |
| 4284 if (!parentStyle.isHorizontalWritingMode()) | 4299 if (!parentStyle.isHorizontalWritingMode()) |
| 4285 return rect.transposedRect(); | 4300 return rect.transposedRect(); |
| 4286 return rect; | 4301 return rect; |
| 4287 } | 4302 } |
| 4288 | 4303 |
| 4304 DISABLE_CFI_PERF |
| 4289 LayoutRect LayoutBox::visualOverflowRectForPropagation(const ComputedStyle& pare
ntStyle) const | 4305 LayoutRect LayoutBox::visualOverflowRectForPropagation(const ComputedStyle& pare
ntStyle) const |
| 4290 { | 4306 { |
| 4291 // If the writing modes of the child and parent match, then we don't have to | 4307 // If the writing modes of the child and parent match, then we don't have to |
| 4292 // do anything fancy. Just return the result. | 4308 // do anything fancy. Just return the result. |
| 4293 LayoutRect rect = visualOverflowRect(); | 4309 LayoutRect rect = visualOverflowRect(); |
| 4294 if (parentStyle.getWritingMode() == style()->getWritingMode()) | 4310 if (parentStyle.getWritingMode() == style()->getWritingMode()) |
| 4295 return rect; | 4311 return rect; |
| 4296 | 4312 |
| 4297 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch | 4313 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch |
| 4298 // in a particular axis, then we have to flip the rect along that axis. | 4314 // in a particular axis, then we have to flip the rect along that axis. |
| 4299 if (style()->getWritingMode() == RightToLeftWritingMode || parentStyle.getWr
itingMode() == RightToLeftWritingMode) | 4315 if (style()->getWritingMode() == RightToLeftWritingMode || parentStyle.getWr
itingMode() == RightToLeftWritingMode) |
| 4300 rect.setX(size().width() - rect.maxX()); | 4316 rect.setX(size().width() - rect.maxX()); |
| 4301 | 4317 |
| 4302 return rect; | 4318 return rect; |
| 4303 } | 4319 } |
| 4304 | 4320 |
| 4321 DISABLE_CFI_PERF |
| 4305 LayoutRect LayoutBox::logicalLayoutOverflowRectForPropagation(const ComputedStyl
e& parentStyle) const | 4322 LayoutRect LayoutBox::logicalLayoutOverflowRectForPropagation(const ComputedStyl
e& parentStyle) const |
| 4306 { | 4323 { |
| 4307 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle); | 4324 LayoutRect rect = layoutOverflowRectForPropagation(parentStyle); |
| 4308 if (!parentStyle.isHorizontalWritingMode()) | 4325 if (!parentStyle.isHorizontalWritingMode()) |
| 4309 return rect.transposedRect(); | 4326 return rect.transposedRect(); |
| 4310 return rect; | 4327 return rect; |
| 4311 } | 4328 } |
| 4312 | 4329 |
| 4330 DISABLE_CFI_PERF |
| 4313 LayoutRect LayoutBox::layoutOverflowRectForPropagation(const ComputedStyle& pare
ntStyle) const | 4331 LayoutRect LayoutBox::layoutOverflowRectForPropagation(const ComputedStyle& pare
ntStyle) const |
| 4314 { | 4332 { |
| 4315 // Only propagate interior layout overflow if we don't clip it. | 4333 // Only propagate interior layout overflow if we don't clip it. |
| 4316 LayoutRect rect = borderBoxRect(); | 4334 LayoutRect rect = borderBoxRect(); |
| 4317 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height | 4335 // We want to include the margin, but only when it adds height. Quirky margi
ns don't contribute height |
| 4318 // nor do the margins of self-collapsing blocks. | 4336 // nor do the margins of self-collapsing blocks. |
| 4319 if (!styleRef().hasMarginAfterQuirk() && !isSelfCollapsingBlock()) | 4337 if (!styleRef().hasMarginAfterQuirk() && !isSelfCollapsingBlock()) |
| 4320 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA
fter()) : LayoutSize(marginAfter(), LayoutUnit())); | 4338 rect.expand(isHorizontalWritingMode() ? LayoutSize(LayoutUnit(), marginA
fter()) : LayoutSize(marginAfter(), LayoutUnit())); |
| 4321 | 4339 |
| 4322 if (!hasOverflowClip()) | 4340 if (!hasOverflowClip()) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4345 return rect; | 4363 return rect; |
| 4346 | 4364 |
| 4347 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch | 4365 // We are putting ourselves into our parent's coordinate space. If there is
a flipped block mismatch |
| 4348 // in a particular axis, then we have to flip the rect along that axis. | 4366 // in a particular axis, then we have to flip the rect along that axis. |
| 4349 if (style()->getWritingMode() == RightToLeftWritingMode || parentStyle.getWr
itingMode() == RightToLeftWritingMode) | 4367 if (style()->getWritingMode() == RightToLeftWritingMode || parentStyle.getWr
itingMode() == RightToLeftWritingMode) |
| 4350 rect.setX(size().width() - rect.maxX()); | 4368 rect.setX(size().width() - rect.maxX()); |
| 4351 | 4369 |
| 4352 return rect; | 4370 return rect; |
| 4353 } | 4371 } |
| 4354 | 4372 |
| 4373 DISABLE_CFI_PERF |
| 4355 LayoutRect LayoutBox::noOverflowRect() const | 4374 LayoutRect LayoutBox::noOverflowRect() const |
| 4356 { | 4375 { |
| 4357 // Because of the special coordinate system used for overflow rectangles and
many other | 4376 // Because of the special coordinate system used for overflow rectangles and
many other |
| 4358 // rectangles (not quite logical, not quite physical), we need to flip the b
lock progression | 4377 // rectangles (not quite logical, not quite physical), we need to flip the b
lock progression |
| 4359 // coordinate in vertical-rl writing mode. In other words, the rectangle ret
urned is physical, | 4378 // coordinate in vertical-rl writing mode. In other words, the rectangle ret
urned is physical, |
| 4360 // except for the block direction progression coordinate (x in vertical writ
ing mode), which is | 4379 // except for the block direction progression coordinate (x in vertical writ
ing mode), which is |
| 4361 // always "logical top". Apart from the flipping, this method does the same
thing as | 4380 // always "logical top". Apart from the flipping, this method does the same
thing as |
| 4362 // clientBoxRect(). | 4381 // clientBoxRect(). |
| 4363 | 4382 |
| 4364 const int scrollBarWidth = verticalScrollbarWidth(); | 4383 const int scrollBarWidth = verticalScrollbarWidth(); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4817 m_rareData->m_snapAreas->remove(&snapArea); | 4836 m_rareData->m_snapAreas->remove(&snapArea); |
| 4818 } | 4837 } |
| 4819 } | 4838 } |
| 4820 | 4839 |
| 4821 SnapAreaSet* LayoutBox::snapAreas() const | 4840 SnapAreaSet* LayoutBox::snapAreas() const |
| 4822 { | 4841 { |
| 4823 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4842 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
| 4824 } | 4843 } |
| 4825 | 4844 |
| 4826 } // namespace blink | 4845 } // namespace blink |
| OLD | NEW |