| 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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 void LayoutBox::willBeRemovedFromTree() { | 148 void LayoutBox::willBeRemovedFromTree() { |
| 149 if (!documentBeingDestroyed() && isOrthogonalWritingModeRoot()) | 149 if (!documentBeingDestroyed() && isOrthogonalWritingModeRoot()) |
| 150 unmarkOrthogonalWritingModeRoot(); | 150 unmarkOrthogonalWritingModeRoot(); |
| 151 | 151 |
| 152 clearScrollSnapMapping(); | 152 clearScrollSnapMapping(); |
| 153 LayoutBoxModelObject::willBeRemovedFromTree(); | 153 LayoutBoxModelObject::willBeRemovedFromTree(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() { | 156 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() { |
| 157 ASSERT(isFloatingOrOutOfFlowPositioned()); | 157 DCHECK(isFloatingOrOutOfFlowPositioned()); |
| 158 | 158 |
| 159 if (documentBeingDestroyed()) | 159 if (documentBeingDestroyed()) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 if (isFloating()) { | 162 if (isFloating()) { |
| 163 LayoutBlockFlow* parentBlockFlow = nullptr; | 163 LayoutBlockFlow* parentBlockFlow = nullptr; |
| 164 for (LayoutObject* curr = parent(); curr; curr = curr->parent()) { | 164 for (LayoutObject* curr = parent(); curr; curr = curr->parent()) { |
| 165 if (curr->isLayoutBlockFlow()) { | 165 if (curr->isLayoutBlockFlow()) { |
| 166 LayoutBlockFlow* currBlockFlow = toLayoutBlockFlow(curr); | 166 LayoutBlockFlow* currBlockFlow = toLayoutBlockFlow(curr); |
| 167 if (!parentBlockFlow || currBlockFlow->containsFloat(this)) | 167 if (!parentBlockFlow || currBlockFlow->containsFloat(this)) |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to | 265 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to |
| 266 // adjust that value into the new zoomed coordinate space. Note that the new | 266 // adjust that value into the new zoomed coordinate space. Note that the new |
| 267 // scroll offset may be outside the normal min/max range of the scrollable | 267 // scroll offset may be outside the normal min/max range of the scrollable |
| 268 // area, which is weird but OK, because the scrollable area will update its | 268 // area, which is weird but OK, because the scrollable area will update its |
| 269 // min/max in updateAfterLayout(). | 269 // min/max in updateAfterLayout(). |
| 270 if (hasOverflowClip() && oldStyle && | 270 if (hasOverflowClip() && oldStyle && |
| 271 oldStyle->effectiveZoom() != newStyle.effectiveZoom()) { | 271 oldStyle->effectiveZoom() != newStyle.effectiveZoom()) { |
| 272 PaintLayerScrollableArea* scrollableArea = this->getScrollableArea(); | 272 PaintLayerScrollableArea* scrollableArea = this->getScrollableArea(); |
| 273 ASSERT(scrollableArea); | 273 DCHECK(scrollableArea); |
| 274 // We use getScrollOffset() rather than scrollPosition(), because scroll | 274 // We use getScrollOffset() rather than scrollPosition(), because scroll |
| 275 // offset is the distance from the beginning of flow for the box, which is | 275 // offset is the distance from the beginning of flow for the box, which is |
| 276 // the dimension we want to preserve. | 276 // the dimension we want to preserve. |
| 277 ScrollOffset oldOffset = scrollableArea->getScrollOffset(); | 277 ScrollOffset oldOffset = scrollableArea->getScrollOffset(); |
| 278 if (oldOffset.width() || oldOffset.height()) { | 278 if (oldOffset.width() || oldOffset.height()) { |
| 279 ScrollOffset newOffset = oldOffset.scaledBy(newStyle.effectiveZoom() / | 279 ScrollOffset newOffset = oldOffset.scaledBy(newStyle.effectiveZoom() / |
| 280 oldStyle->effectiveZoom()); | 280 oldStyle->effectiveZoom()); |
| 281 scrollableArea->setScrollOffsetUnconditionally(newOffset); | 281 scrollableArea->setScrollOffsetUnconditionally(newOffset); |
| 282 } | 282 } |
| 283 } | 283 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 void LayoutBox::updateFromStyle() { | 477 void LayoutBox::updateFromStyle() { |
| 478 LayoutBoxModelObject::updateFromStyle(); | 478 LayoutBoxModelObject::updateFromStyle(); |
| 479 | 479 |
| 480 const ComputedStyle& styleToUse = styleRef(); | 480 const ComputedStyle& styleToUse = styleRef(); |
| 481 setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating()); | 481 setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating()); |
| 482 setHasTransformRelatedProperty(styleToUse.hasTransformRelatedProperty()); | 482 setHasTransformRelatedProperty(styleToUse.hasTransformRelatedProperty()); |
| 483 setHasReflection(styleToUse.boxReflect()); | 483 setHasReflection(styleToUse.boxReflect()); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void LayoutBox::layout() { | 486 void LayoutBox::layout() { |
| 487 ASSERT(needsLayout()); | 487 DCHECK(needsLayout()); |
| 488 LayoutAnalyzer::Scope analyzer(*this); | 488 LayoutAnalyzer::Scope analyzer(*this); |
| 489 | 489 |
| 490 LayoutObject* child = slowFirstChild(); | 490 LayoutObject* child = slowFirstChild(); |
| 491 if (!child) { | 491 if (!child) { |
| 492 clearNeedsLayout(); | 492 clearNeedsLayout(); |
| 493 return; | 493 return; |
| 494 } | 494 } |
| 495 | 495 |
| 496 LayoutState state(*this); | 496 LayoutState state(*this); |
| 497 while (child) { | 497 while (child) { |
| 498 child->layoutIfNeeded(); | 498 child->layoutIfNeeded(); |
| 499 ASSERT(!child->needsLayout()); | 499 DCHECK(!child->needsLayout()); |
| 500 child = child->nextSibling(); | 500 child = child->nextSibling(); |
| 501 } | 501 } |
| 502 invalidateBackgroundObscurationStatus(); | 502 invalidateBackgroundObscurationStatus(); |
| 503 clearNeedsLayout(); | 503 clearNeedsLayout(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 // More IE extensions. clientWidth and clientHeight represent the interior of | 506 // More IE extensions. clientWidth and clientHeight represent the interior of |
| 507 // an object excluding border and scrollbar. | 507 // an object excluding border and scrollbar. |
| 508 DISABLE_CFI_PERF | 508 DISABLE_CFI_PERF |
| 509 LayoutUnit LayoutBox::clientWidth() const { | 509 LayoutUnit LayoutBox::clientWidth() const { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 return false; | 643 return false; |
| 644 } | 644 } |
| 645 | 645 |
| 646 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, | 646 void LayoutBox::scrollRectToVisible(const LayoutRect& rect, |
| 647 const ScrollAlignment& alignX, | 647 const ScrollAlignment& alignX, |
| 648 const ScrollAlignment& alignY, | 648 const ScrollAlignment& alignY, |
| 649 ScrollType scrollType, | 649 ScrollType scrollType, |
| 650 bool makeVisibleInVisualViewport) { | 650 bool makeVisibleInVisualViewport) { |
| 651 ASSERT(scrollType == ProgrammaticScroll || scrollType == UserScroll); | 651 DCHECK(scrollType == ProgrammaticScroll || scrollType == UserScroll); |
| 652 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 652 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
| 653 DisableCompositingQueryAsserts disabler; | 653 DisableCompositingQueryAsserts disabler; |
| 654 | 654 |
| 655 LayoutRect rectToScroll = rect; | 655 LayoutRect rectToScroll = rect; |
| 656 if (rectToScroll.width() <= 0) | 656 if (rectToScroll.width() <= 0) |
| 657 rectToScroll.setWidth(LayoutUnit(1)); | 657 rectToScroll.setWidth(LayoutUnit(1)); |
| 658 if (rectToScroll.height() <= 0) | 658 if (rectToScroll.height() <= 0) |
| 659 rectToScroll.setHeight(LayoutUnit(1)); | 659 rectToScroll.setHeight(LayoutUnit(1)); |
| 660 | 660 |
| 661 LayoutBox* parentBox = nullptr; | 661 LayoutBox* parentBox = nullptr; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 void LayoutBox::scrollByRecursively(const ScrollOffset& delta) { | 1082 void LayoutBox::scrollByRecursively(const ScrollOffset& delta) { |
| 1083 if (delta.isZero()) | 1083 if (delta.isZero()) |
| 1084 return; | 1084 return; |
| 1085 | 1085 |
| 1086 bool restrictedByLineClamp = false; | 1086 bool restrictedByLineClamp = false; |
| 1087 if (parent()) | 1087 if (parent()) |
| 1088 restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); | 1088 restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); |
| 1089 | 1089 |
| 1090 if (hasOverflowClip() && !restrictedByLineClamp) { | 1090 if (hasOverflowClip() && !restrictedByLineClamp) { |
| 1091 PaintLayerScrollableArea* scrollableArea = this->getScrollableArea(); | 1091 PaintLayerScrollableArea* scrollableArea = this->getScrollableArea(); |
| 1092 ASSERT(scrollableArea); | 1092 DCHECK(scrollableArea); |
| 1093 | 1093 |
| 1094 ScrollOffset newScrollOffset = scrollableArea->getScrollOffset() + delta; | 1094 ScrollOffset newScrollOffset = scrollableArea->getScrollOffset() + delta; |
| 1095 scrollableArea->setScrollOffset(newScrollOffset, ProgrammaticScroll); | 1095 scrollableArea->setScrollOffset(newScrollOffset, ProgrammaticScroll); |
| 1096 | 1096 |
| 1097 // If this layer can't do the scroll we ask the next layer up that can | 1097 // If this layer can't do the scroll we ask the next layer up that can |
| 1098 // scroll to try. | 1098 // scroll to try. |
| 1099 ScrollOffset remainingScrollOffset = | 1099 ScrollOffset remainingScrollOffset = |
| 1100 newScrollOffset - scrollableArea->getScrollOffset(); | 1100 newScrollOffset - scrollableArea->getScrollOffset(); |
| 1101 if (!remainingScrollOffset.isZero() && parent()) { | 1101 if (!remainingScrollOffset.isZero() && parent()) { |
| 1102 if (LayoutBox* scrollableBox = enclosingScrollableBox()) | 1102 if (LayoutBox* scrollableBox = enclosingScrollableBox()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1129 int adjustmentWidth = verticalScrollbarWidth(); | 1129 int adjustmentWidth = verticalScrollbarWidth(); |
| 1130 if (hasFlippedBlocksWritingMode() || | 1130 if (hasFlippedBlocksWritingMode() || |
| 1131 (isHorizontalWritingMode() && | 1131 (isHorizontalWritingMode() && |
| 1132 shouldPlaceBlockDirectionScrollbarOnLogicalLeft())) { | 1132 shouldPlaceBlockDirectionScrollbarOnLogicalLeft())) { |
| 1133 size.expand(adjustmentWidth, 0); | 1133 size.expand(adjustmentWidth, 0); |
| 1134 } | 1134 } |
| 1135 return size; | 1135 return size; |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 IntSize LayoutBox::scrolledContentOffset() const { | 1138 IntSize LayoutBox::scrolledContentOffset() const { |
| 1139 ASSERT(hasOverflowClip()); | 1139 DCHECK(hasOverflowClip()); |
| 1140 ASSERT(hasLayer()); | 1140 DCHECK(hasLayer()); |
| 1141 // FIXME: Return DoubleSize here. crbug.com/414283. | 1141 // FIXME: Return DoubleSize here. crbug.com/414283. |
| 1142 PaintLayerScrollableArea* scrollableArea = getScrollableArea(); | 1142 PaintLayerScrollableArea* scrollableArea = getScrollableArea(); |
| 1143 IntSize result = | 1143 IntSize result = |
| 1144 scrollableArea->scrollOffsetInt() + originAdjustmentForScrollbars(); | 1144 scrollableArea->scrollOffsetInt() + originAdjustmentForScrollbars(); |
| 1145 if (isHorizontalWritingMode() && | 1145 if (isHorizontalWritingMode() && |
| 1146 shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1146 shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 1147 result.expand(-verticalScrollbarWidth(), 0); | 1147 result.expand(-verticalScrollbarWidth(), 0); |
| 1148 return result; | 1148 return result; |
| 1149 } | 1149 } |
| 1150 | 1150 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(); | 1197 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(); |
| 1198 } | 1198 } |
| 1199 | 1199 |
| 1200 LayoutUnit LayoutBox::minPreferredLogicalWidth() const { | 1200 LayoutUnit LayoutBox::minPreferredLogicalWidth() const { |
| 1201 if (preferredLogicalWidthsDirty()) { | 1201 if (preferredLogicalWidthsDirty()) { |
| 1202 #if DCHECK_IS_ON() | 1202 #if DCHECK_IS_ON() |
| 1203 SetLayoutNeededForbiddenScope layoutForbiddenScope( | 1203 SetLayoutNeededForbiddenScope layoutForbiddenScope( |
| 1204 const_cast<LayoutBox&>(*this)); | 1204 const_cast<LayoutBox&>(*this)); |
| 1205 #endif | 1205 #endif |
| 1206 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); | 1206 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); |
| 1207 ASSERT(!preferredLogicalWidthsDirty()); | 1207 DCHECK(!preferredLogicalWidthsDirty()); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 return m_minPreferredLogicalWidth; | 1210 return m_minPreferredLogicalWidth; |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 DISABLE_CFI_PERF | 1213 DISABLE_CFI_PERF |
| 1214 LayoutUnit LayoutBox::maxPreferredLogicalWidth() const { | 1214 LayoutUnit LayoutBox::maxPreferredLogicalWidth() const { |
| 1215 if (preferredLogicalWidthsDirty()) { | 1215 if (preferredLogicalWidthsDirty()) { |
| 1216 #if DCHECK_IS_ON() | 1216 #if DCHECK_IS_ON() |
| 1217 SetLayoutNeededForbiddenScope layoutForbiddenScope( | 1217 SetLayoutNeededForbiddenScope layoutForbiddenScope( |
| 1218 const_cast<LayoutBox&>(*this)); | 1218 const_cast<LayoutBox&>(*this)); |
| 1219 #endif | 1219 #endif |
| 1220 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); | 1220 const_cast<LayoutBox*>(this)->computePreferredLogicalWidths(); |
| 1221 ASSERT(!preferredLogicalWidthsDirty()); | 1221 DCHECK(!preferredLogicalWidthsDirty()); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 return m_maxPreferredLogicalWidth; | 1224 return m_maxPreferredLogicalWidth; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 bool LayoutBox::hasOverrideLogicalContentHeight() const { | 1227 bool LayoutBox::hasOverrideLogicalContentHeight() const { |
| 1228 return m_rareData && m_rareData->m_overrideLogicalContentHeight != -1; | 1228 return m_rareData && m_rareData->m_overrideLogicalContentHeight != -1; |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 bool LayoutBox::hasOverrideLogicalContentWidth() const { | 1231 bool LayoutBox::hasOverrideLogicalContentWidth() const { |
| 1232 return m_rareData && m_rareData->m_overrideLogicalContentWidth != -1; | 1232 return m_rareData && m_rareData->m_overrideLogicalContentWidth != -1; |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 void LayoutBox::setOverrideLogicalContentHeight(LayoutUnit height) { | 1235 void LayoutBox::setOverrideLogicalContentHeight(LayoutUnit height) { |
| 1236 ASSERT(height >= 0); | 1236 DCHECK_GE(height, 0); |
| 1237 ensureRareData().m_overrideLogicalContentHeight = height; | 1237 ensureRareData().m_overrideLogicalContentHeight = height; |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 void LayoutBox::setOverrideLogicalContentWidth(LayoutUnit width) { | 1240 void LayoutBox::setOverrideLogicalContentWidth(LayoutUnit width) { |
| 1241 ASSERT(width >= 0); | 1241 DCHECK_GE(width, 0); |
| 1242 ensureRareData().m_overrideLogicalContentWidth = width; | 1242 ensureRareData().m_overrideLogicalContentWidth = width; |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 void LayoutBox::clearOverrideLogicalContentHeight() { | 1245 void LayoutBox::clearOverrideLogicalContentHeight() { |
| 1246 if (m_rareData) | 1246 if (m_rareData) |
| 1247 m_rareData->m_overrideLogicalContentHeight = LayoutUnit(-1); | 1247 m_rareData->m_overrideLogicalContentHeight = LayoutUnit(-1); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 void LayoutBox::clearOverrideLogicalContentWidth() { | 1250 void LayoutBox::clearOverrideLogicalContentWidth() { |
| 1251 if (m_rareData) | 1251 if (m_rareData) |
| 1252 m_rareData->m_overrideLogicalContentWidth = LayoutUnit(-1); | 1252 m_rareData->m_overrideLogicalContentWidth = LayoutUnit(-1); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 void LayoutBox::clearOverrideSize() { | 1255 void LayoutBox::clearOverrideSize() { |
| 1256 clearOverrideLogicalContentHeight(); | 1256 clearOverrideLogicalContentHeight(); |
| 1257 clearOverrideLogicalContentWidth(); | 1257 clearOverrideLogicalContentWidth(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 LayoutUnit LayoutBox::overrideLogicalContentWidth() const { | 1260 LayoutUnit LayoutBox::overrideLogicalContentWidth() const { |
| 1261 ASSERT(hasOverrideLogicalContentWidth()); | 1261 DCHECK(hasOverrideLogicalContentWidth()); |
| 1262 return m_rareData->m_overrideLogicalContentWidth; | 1262 return m_rareData->m_overrideLogicalContentWidth; |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 LayoutUnit LayoutBox::overrideLogicalContentHeight() const { | 1265 LayoutUnit LayoutBox::overrideLogicalContentHeight() const { |
| 1266 ASSERT(hasOverrideLogicalContentHeight()); | 1266 DCHECK(hasOverrideLogicalContentHeight()); |
| 1267 return m_rareData->m_overrideLogicalContentHeight; | 1267 return m_rareData->m_overrideLogicalContentHeight; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 // TODO (lajava) Now that we have implemented these functions based on physical | 1270 // TODO (lajava) Now that we have implemented these functions based on physical |
| 1271 // direction, we'd rather remove the logical ones. | 1271 // direction, we'd rather remove the logical ones. |
| 1272 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalWidth() const { | 1272 LayoutUnit LayoutBox::overrideContainingBlockContentLogicalWidth() const { |
| 1273 DCHECK(hasOverrideContainingBlockLogicalWidth()); | 1273 DCHECK(hasOverrideContainingBlockLogicalWidth()); |
| 1274 return m_rareData->m_overrideContainingBlockContentLogicalWidth; | 1274 return m_rareData->m_overrideContainingBlockContentLogicalWidth; |
| 1275 } | 1275 } |
| 1276 | 1276 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 // propagate 'fixed' up only if this box is fixed position. | 2006 // propagate 'fixed' up only if this box is fixed position. |
| 2007 if (canContainFixedPositionObjects() && !isFixedPos) | 2007 if (canContainFixedPositionObjects() && !isFixedPos) |
| 2008 mode &= ~IsFixed; | 2008 mode &= ~IsFixed; |
| 2009 else if (isFixedPos) | 2009 else if (isFixedPos) |
| 2010 mode |= IsFixed; | 2010 mode |= IsFixed; |
| 2011 | 2011 |
| 2012 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); | 2012 LayoutBoxModelObject::mapAncestorToLocal(ancestor, transformState, mode); |
| 2013 } | 2013 } |
| 2014 | 2014 |
| 2015 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const { | 2015 LayoutSize LayoutBox::offsetFromContainer(const LayoutObject* o) const { |
| 2016 ASSERT(o == container()); | 2016 DCHECK_EQ(o, container()); |
| 2017 | 2017 |
| 2018 LayoutSize offset; | 2018 LayoutSize offset; |
| 2019 if (isInFlowPositioned()) | 2019 if (isInFlowPositioned()) |
| 2020 offset += offsetForInFlowPosition(); | 2020 offset += offsetForInFlowPosition(); |
| 2021 | 2021 |
| 2022 offset += physicalLocationOffset(); | 2022 offset += physicalLocationOffset(); |
| 2023 | 2023 |
| 2024 if (o->hasOverflowClip()) | 2024 if (o->hasOverflowClip()) |
| 2025 offset -= toLayoutBox(o)->scrolledContentOffset(); | 2025 offset -= toLayoutBox(o)->scrolledContentOffset(); |
| 2026 | 2026 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 // Nuke the box. | 2071 // Nuke the box. |
| 2072 box->remove(DontMarkLineBoxes); | 2072 box->remove(DontMarkLineBoxes); |
| 2073 box->destroy(); | 2073 box->destroy(); |
| 2074 } else if (isAtomicInlineLevel()) { | 2074 } else if (isAtomicInlineLevel()) { |
| 2075 setLocationAndUpdateOverflowControlsIfNeeded(box->location()); | 2075 setLocationAndUpdateOverflowControlsIfNeeded(box->location()); |
| 2076 setInlineBoxWrapper(box); | 2076 setInlineBoxWrapper(box); |
| 2077 } | 2077 } |
| 2078 } | 2078 } |
| 2079 | 2079 |
| 2080 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) { | 2080 void LayoutBox::moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal) { |
| 2081 ASSERT(isOutOfFlowPositioned() && container()->isLayoutInline() && | 2081 DCHECK(isOutOfFlowPositioned()); |
| 2082 container()->isInFlowPositioned()); | 2082 DCHECK(container()->isLayoutInline()); |
| 2083 DCHECK(container()->isInFlowPositioned()); |
| 2083 // If this object is inside a relative positioned inline and its inline | 2084 // If this object is inside a relative positioned inline and its inline |
| 2084 // position is an explicit offset from the edge of its container then it will | 2085 // position is an explicit offset from the edge of its container then it will |
| 2085 // need to move if its inline container has changed width. We do not track if | 2086 // need to move if its inline container has changed width. We do not track if |
| 2086 // the width has changed but if we are here then we are laying out lines | 2087 // the width has changed but if we are here then we are laying out lines |
| 2087 // inside it, so it probably has - mark our object for layout so that it can | 2088 // inside it, so it probably has - mark our object for layout so that it can |
| 2088 // move to the new offset created by the new width. | 2089 // move to the new offset created by the new width. |
| 2089 if (!normalChildNeedsLayout() && | 2090 if (!normalChildNeedsLayout() && |
| 2090 !style()->hasStaticInlinePosition(isHorizontal)) | 2091 !style()->hasStaticInlinePosition(isHorizontal)) |
| 2091 setChildNeedsLayout(MarkOnlyThis); | 2092 setChildNeedsLayout(MarkOnlyThis); |
| 2092 } | 2093 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 EBreakBetween secondValue) { | 2257 EBreakBetween secondValue) { |
| 2257 if (fragmentainerBreakPrecedence(secondValue) >= | 2258 if (fragmentainerBreakPrecedence(secondValue) >= |
| 2258 fragmentainerBreakPrecedence(firstValue)) | 2259 fragmentainerBreakPrecedence(firstValue)) |
| 2259 return secondValue; | 2260 return secondValue; |
| 2260 return firstValue; | 2261 return firstValue; |
| 2261 } | 2262 } |
| 2262 | 2263 |
| 2263 EBreakBetween LayoutBox::classABreakPointValue( | 2264 EBreakBetween LayoutBox::classABreakPointValue( |
| 2264 EBreakBetween previousBreakAfterValue) const { | 2265 EBreakBetween previousBreakAfterValue) const { |
| 2265 // First assert that we're at a class A break point. | 2266 // First assert that we're at a class A break point. |
| 2266 ASSERT(isBreakBetweenControllable(previousBreakAfterValue)); | 2267 DCHECK(isBreakBetweenControllable(previousBreakAfterValue)); |
| 2267 | 2268 |
| 2268 return joinFragmentainerBreakValues(previousBreakAfterValue, breakBefore()); | 2269 return joinFragmentainerBreakValues(previousBreakAfterValue, breakBefore()); |
| 2269 } | 2270 } |
| 2270 | 2271 |
| 2271 bool LayoutBox::needsForcedBreakBefore( | 2272 bool LayoutBox::needsForcedBreakBefore( |
| 2272 EBreakBetween previousBreakAfterValue) const { | 2273 EBreakBetween previousBreakAfterValue) const { |
| 2273 // Forced break values are only honored when specified on in-flow objects, but | 2274 // Forced break values are only honored when specified on in-flow objects, but |
| 2274 // floats and out-of-flow positioned objects may be affected by a break-after | 2275 // floats and out-of-flow positioned objects may be affected by a break-after |
| 2275 // value of the previous in-flow object, even though we're not at a class A | 2276 // value of the previous in-flow object, even though we're not at a class A |
| 2276 // break point. | 2277 // break point. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 | 2354 |
| 2354 if (ancestor == this) | 2355 if (ancestor == this) |
| 2355 return true; | 2356 return true; |
| 2356 | 2357 |
| 2357 AncestorSkipInfo skipInfo(ancestor, true); | 2358 AncestorSkipInfo skipInfo(ancestor, true); |
| 2358 LayoutObject* container = this->container(&skipInfo); | 2359 LayoutObject* container = this->container(&skipInfo); |
| 2359 LayoutBox* tableRowContainer = nullptr; | 2360 LayoutBox* tableRowContainer = nullptr; |
| 2360 // Skip table row because cells and rows are in the same coordinate space (see | 2361 // Skip table row because cells and rows are in the same coordinate space (see |
| 2361 // below, however for more comments about when |ancestor| is the table row). | 2362 // below, however for more comments about when |ancestor| is the table row). |
| 2362 if (isTableCell()) { | 2363 if (isTableCell()) { |
| 2363 DCHECK(container->isTableRow() && parentBox() == container); | 2364 DCHECK(container->isTableRow()); |
| 2365 DCHECK_EQ(parentBox(), container); |
| 2364 if (container != ancestor) | 2366 if (container != ancestor) |
| 2365 container = container->parent(); | 2367 container = container->parent(); |
| 2366 else | 2368 else |
| 2367 tableRowContainer = toLayoutBox(container); | 2369 tableRowContainer = toLayoutBox(container); |
| 2368 } | 2370 } |
| 2369 if (!container) | 2371 if (!container) |
| 2370 return true; | 2372 return true; |
| 2371 | 2373 |
| 2372 LayoutPoint containerOffset; | 2374 LayoutPoint containerOffset; |
| 2373 if (container->isBox()) { | 2375 if (container->isBox()) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 computeLogicalWidth(computedValues); | 2486 computeLogicalWidth(computedValues); |
| 2485 | 2487 |
| 2486 setLogicalWidth(computedValues.m_extent); | 2488 setLogicalWidth(computedValues.m_extent); |
| 2487 setLogicalLeft(computedValues.m_position); | 2489 setLogicalLeft(computedValues.m_position); |
| 2488 setMarginStart(computedValues.m_margins.m_start); | 2490 setMarginStart(computedValues.m_margins.m_start); |
| 2489 setMarginEnd(computedValues.m_margins.m_end); | 2491 setMarginEnd(computedValues.m_margins.m_end); |
| 2490 } | 2492 } |
| 2491 | 2493 |
| 2492 static float getMaxWidthListMarker(const LayoutBox* layoutObject) { | 2494 static float getMaxWidthListMarker(const LayoutBox* layoutObject) { |
| 2493 #if DCHECK_IS_ON() | 2495 #if DCHECK_IS_ON() |
| 2494 ASSERT(layoutObject); | 2496 DCHECK(layoutObject); |
| 2495 Node* parentNode = layoutObject->generatingNode(); | 2497 Node* parentNode = layoutObject->generatingNode(); |
| 2496 ASSERT(parentNode); | 2498 DCHECK(parentNode); |
| 2497 ASSERT(isHTMLOListElement(parentNode) || isHTMLUListElement(parentNode)); | 2499 DCHECK(isHTMLOListElement(parentNode) || isHTMLUListElement(parentNode)); |
| 2498 ASSERT(layoutObject->style()->textAutosizingMultiplier() != 1); | 2500 DCHECK_NE(layoutObject->style()->textAutosizingMultiplier(), 1); |
| 2499 #endif | 2501 #endif |
| 2500 float maxWidth = 0; | 2502 float maxWidth = 0; |
| 2501 for (LayoutObject* child = layoutObject->slowFirstChild(); child; | 2503 for (LayoutObject* child = layoutObject->slowFirstChild(); child; |
| 2502 child = child->nextSibling()) { | 2504 child = child->nextSibling()) { |
| 2503 if (!child->isListItem()) | 2505 if (!child->isListItem()) |
| 2504 continue; | 2506 continue; |
| 2505 | 2507 |
| 2506 LayoutBox* listItem = toLayoutBox(child); | 2508 LayoutBox* listItem = toLayoutBox(child); |
| 2507 for (LayoutObject* itemChild = listItem->slowFirstChild(); itemChild; | 2509 for (LayoutObject* itemChild = listItem->slowFirstChild(); itemChild; |
| 2508 itemChild = itemChild->nextSibling()) { | 2510 itemChild = itemChild->nextSibling()) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2641 LayoutUnit LayoutBox::fillAvailableMeasure( | 2643 LayoutUnit LayoutBox::fillAvailableMeasure( |
| 2642 LayoutUnit availableLogicalWidth) const { | 2644 LayoutUnit availableLogicalWidth) const { |
| 2643 LayoutUnit marginStart; | 2645 LayoutUnit marginStart; |
| 2644 LayoutUnit marginEnd; | 2646 LayoutUnit marginEnd; |
| 2645 return fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd); | 2647 return fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd); |
| 2646 } | 2648 } |
| 2647 | 2649 |
| 2648 LayoutUnit LayoutBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, | 2650 LayoutUnit LayoutBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, |
| 2649 LayoutUnit& marginStart, | 2651 LayoutUnit& marginStart, |
| 2650 LayoutUnit& marginEnd) const { | 2652 LayoutUnit& marginEnd) const { |
| 2651 ASSERT(availableLogicalWidth >= 0); | 2653 DCHECK_GE(availableLogicalWidth, 0); |
| 2652 marginStart = | 2654 marginStart = |
| 2653 minimumValueForLength(style()->marginStart(), availableLogicalWidth); | 2655 minimumValueForLength(style()->marginStart(), availableLogicalWidth); |
| 2654 marginEnd = | 2656 marginEnd = |
| 2655 minimumValueForLength(style()->marginEnd(), availableLogicalWidth); | 2657 minimumValueForLength(style()->marginEnd(), availableLogicalWidth); |
| 2656 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd; | 2658 LayoutUnit available = availableLogicalWidth - marginStart - marginEnd; |
| 2657 available = std::max(available, LayoutUnit()); | 2659 available = std::max(available, LayoutUnit()); |
| 2658 return available; | 2660 return available; |
| 2659 } | 2661 } |
| 2660 | 2662 |
| 2661 DISABLE_CFI_PERF | 2663 DISABLE_CFI_PERF |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2687 | 2689 |
| 2688 NOTREACHED(); | 2690 NOTREACHED(); |
| 2689 return LayoutUnit(); | 2691 return LayoutUnit(); |
| 2690 } | 2692 } |
| 2691 | 2693 |
| 2692 DISABLE_CFI_PERF | 2694 DISABLE_CFI_PERF |
| 2693 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, | 2695 LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, |
| 2694 const Length& logicalWidth, | 2696 const Length& logicalWidth, |
| 2695 LayoutUnit availableLogicalWidth, | 2697 LayoutUnit availableLogicalWidth, |
| 2696 const LayoutBlock* cb) const { | 2698 const LayoutBlock* cb) const { |
| 2697 ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || | 2699 DCHECK(widthType == MinSize || widthType == MainOrPreferredSize || |
| 2698 !logicalWidth.isAuto()); | 2700 !logicalWidth.isAuto()); |
| 2699 if (widthType == MinSize && logicalWidth.isAuto()) | 2701 if (widthType == MinSize && logicalWidth.isAuto()) |
| 2700 return adjustBorderBoxLogicalWidthForBoxSizing(0); | 2702 return adjustBorderBoxLogicalWidthForBoxSizing(0); |
| 2701 | 2703 |
| 2702 if (!logicalWidth.isIntrinsicOrAuto()) { | 2704 if (!logicalWidth.isIntrinsicOrAuto()) { |
| 2703 // FIXME: If the containing block flow is perpendicular to our direction we | 2705 // FIXME: If the containing block flow is perpendicular to our direction we |
| 2704 // need to use the available logical height instead. | 2706 // need to use the available logical height instead. |
| 2705 return adjustBorderBoxLogicalWidthForBoxSizing( | 2707 return adjustBorderBoxLogicalWidthForBoxSizing( |
| 2706 valueForLength(logicalWidth, availableLogicalWidth)); | 2708 valueForLength(logicalWidth, availableLogicalWidth)); |
| 2707 } | 2709 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 void LayoutBox::computeMarginsForDirection(MarginDirection flowDirection, | 2843 void LayoutBox::computeMarginsForDirection(MarginDirection flowDirection, |
| 2842 const LayoutBlock* containingBlock, | 2844 const LayoutBlock* containingBlock, |
| 2843 LayoutUnit containerWidth, | 2845 LayoutUnit containerWidth, |
| 2844 LayoutUnit childWidth, | 2846 LayoutUnit childWidth, |
| 2845 LayoutUnit& marginStart, | 2847 LayoutUnit& marginStart, |
| 2846 LayoutUnit& marginEnd, | 2848 LayoutUnit& marginEnd, |
| 2847 Length marginStartLength, | 2849 Length marginStartLength, |
| 2848 Length marginEndLength) const { | 2850 Length marginEndLength) const { |
| 2849 // First assert that we're not calling this method on box types that don't | 2851 // First assert that we're not calling this method on box types that don't |
| 2850 // support margins. | 2852 // support margins. |
| 2851 ASSERT(!isTableCell()); | 2853 DCHECK(!isTableCell()); |
| 2852 ASSERT(!isTableRow()); | 2854 DCHECK(!isTableRow()); |
| 2853 ASSERT(!isTableSection()); | 2855 DCHECK(!isTableSection()); |
| 2854 ASSERT(!isLayoutTableCol()); | 2856 DCHECK(!isLayoutTableCol()); |
| 2855 if (flowDirection == BlockDirection || isFloating() || isInline()) { | 2857 if (flowDirection == BlockDirection || isFloating() || isInline()) { |
| 2856 // Margins are calculated with respect to the logical width of | 2858 // Margins are calculated with respect to the logical width of |
| 2857 // the containing block (8.3) | 2859 // the containing block (8.3) |
| 2858 // Inline blocks/tables and floats don't have their margins increased. | 2860 // Inline blocks/tables and floats don't have their margins increased. |
| 2859 marginStart = minimumValueForLength(marginStartLength, containerWidth); | 2861 marginStart = minimumValueForLength(marginStartLength, containerWidth); |
| 2860 marginEnd = minimumValueForLength(marginEndLength, containerWidth); | 2862 marginEnd = minimumValueForLength(marginEndLength, containerWidth); |
| 2861 return; | 2863 return; |
| 2862 } | 2864 } |
| 2863 | 2865 |
| 2864 if (containingBlock->isFlexibleBox()) { | 2866 if (containingBlock->isFlexibleBox()) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3054 computedValues.m_extent - borderAndPaddingLogicalHeight()); | 3056 computedValues.m_extent - borderAndPaddingLogicalHeight()); |
| 3055 if (heightResult == -1) | 3057 if (heightResult == -1) |
| 3056 heightResult = computedValues.m_extent; | 3058 heightResult = computedValues.m_extent; |
| 3057 heightResult = constrainLogicalHeightByMinMax( | 3059 heightResult = constrainLogicalHeightByMinMax( |
| 3058 heightResult, | 3060 heightResult, |
| 3059 computedValues.m_extent - borderAndPaddingLogicalHeight()); | 3061 computedValues.m_extent - borderAndPaddingLogicalHeight()); |
| 3060 } else { | 3062 } else { |
| 3061 // The only times we don't check min/max height are when a fixed length | 3063 // The only times we don't check min/max height are when a fixed length |
| 3062 // has been given as an override. Just use that. The value has already | 3064 // has been given as an override. Just use that. The value has already |
| 3063 // been adjusted for box-sizing. | 3065 // been adjusted for box-sizing. |
| 3064 ASSERT(h.isFixed()); | 3066 DCHECK(h.isFixed()); |
| 3065 heightResult = LayoutUnit(h.value()) + borderAndPaddingLogicalHeight(); | 3067 heightResult = LayoutUnit(h.value()) + borderAndPaddingLogicalHeight(); |
| 3066 } | 3068 } |
| 3067 | 3069 |
| 3068 computedValues.m_extent = heightResult; | 3070 computedValues.m_extent = heightResult; |
| 3069 computeMarginsForDirection( | 3071 computeMarginsForDirection( |
| 3070 flowDirection, cb, containingBlockLogicalWidthForContent(), | 3072 flowDirection, cb, containingBlockLogicalWidthForContent(), |
| 3071 computedValues.m_extent, computedValues.m_margins.m_before, | 3073 computedValues.m_extent, computedValues.m_margins.m_before, |
| 3072 computedValues.m_margins.m_after, style()->marginBefore(), | 3074 computedValues.m_margins.m_after, style()->marginBefore(), |
| 3073 style()->marginAfter()); | 3075 style()->marginAfter()); |
| 3074 } | 3076 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3325 style()->logicalMaxWidth().isMaxSizeNone() | 3327 style()->logicalMaxWidth().isMaxSizeNone() |
| 3326 ? logicalWidth | 3328 ? logicalWidth |
| 3327 : computeReplacedLogicalWidthUsing(MaxSize, | 3329 : computeReplacedLogicalWidthUsing(MaxSize, |
| 3328 style()->logicalMaxWidth()); | 3330 style()->logicalMaxWidth()); |
| 3329 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); | 3331 return std::max(minLogicalWidth, std::min(logicalWidth, maxLogicalWidth)); |
| 3330 } | 3332 } |
| 3331 | 3333 |
| 3332 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing( | 3334 LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing( |
| 3333 SizeType sizeType, | 3335 SizeType sizeType, |
| 3334 const Length& logicalWidth) const { | 3336 const Length& logicalWidth) const { |
| 3335 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || | 3337 DCHECK(sizeType == MinSize || sizeType == MainOrPreferredSize || |
| 3336 !logicalWidth.isAuto()); | 3338 !logicalWidth.isAuto()); |
| 3337 if (sizeType == MinSize && logicalWidth.isAuto()) | 3339 if (sizeType == MinSize && logicalWidth.isAuto()) |
| 3338 return adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit()); | 3340 return adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit()); |
| 3339 | 3341 |
| 3340 switch (logicalWidth.type()) { | 3342 switch (logicalWidth.type()) { |
| 3341 case Fixed: | 3343 case Fixed: |
| 3342 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()); | 3344 return adjustContentBoxLogicalWidthForBoxSizing(logicalWidth.value()); |
| 3343 case MinContent: | 3345 case MinContent: |
| 3344 case MaxContent: { | 3346 case MaxContent: { |
| 3345 // MinContent/MaxContent don't need the availableLogicalWidth argument. | 3347 // MinContent/MaxContent don't need the availableLogicalWidth argument. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 return LayoutUnit(); | 3388 return LayoutUnit(); |
| 3387 } | 3389 } |
| 3388 | 3390 |
| 3389 LayoutUnit LayoutBox::computeReplacedLogicalHeight(LayoutUnit) const { | 3391 LayoutUnit LayoutBox::computeReplacedLogicalHeight(LayoutUnit) const { |
| 3390 return computeReplacedLogicalHeightRespectingMinMaxHeight( | 3392 return computeReplacedLogicalHeightRespectingMinMaxHeight( |
| 3391 computeReplacedLogicalHeightUsing(MainOrPreferredSize, | 3393 computeReplacedLogicalHeightUsing(MainOrPreferredSize, |
| 3392 style()->logicalHeight())); | 3394 style()->logicalHeight())); |
| 3393 } | 3395 } |
| 3394 | 3396 |
| 3395 bool LayoutBox::logicalHeightComputesAsNone(SizeType sizeType) const { | 3397 bool LayoutBox::logicalHeightComputesAsNone(SizeType sizeType) const { |
| 3396 ASSERT(sizeType == MinSize || sizeType == MaxSize); | 3398 DCHECK(sizeType == MinSize || sizeType == MaxSize); |
| 3397 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() | 3399 Length logicalHeight = sizeType == MinSize ? style()->logicalMinHeight() |
| 3398 : style()->logicalMaxHeight(); | 3400 : style()->logicalMaxHeight(); |
| 3399 Length initialLogicalHeight = sizeType == MinSize | 3401 Length initialLogicalHeight = sizeType == MinSize |
| 3400 ? ComputedStyle::initialMinSize() | 3402 ? ComputedStyle::initialMinSize() |
| 3401 : ComputedStyle::initialMaxSize(); | 3403 : ComputedStyle::initialMaxSize(); |
| 3402 | 3404 |
| 3403 if (logicalHeight == initialLogicalHeight) | 3405 if (logicalHeight == initialLogicalHeight) |
| 3404 return true; | 3406 return true; |
| 3405 | 3407 |
| 3406 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeight)) | 3408 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeight)) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3421 LayoutUnit maxLogicalHeight = logicalHeight; | 3423 LayoutUnit maxLogicalHeight = logicalHeight; |
| 3422 if (!logicalHeightComputesAsNone(MaxSize)) | 3424 if (!logicalHeightComputesAsNone(MaxSize)) |
| 3423 maxLogicalHeight = | 3425 maxLogicalHeight = |
| 3424 computeReplacedLogicalHeightUsing(MaxSize, style()->logicalMaxHeight()); | 3426 computeReplacedLogicalHeightUsing(MaxSize, style()->logicalMaxHeight()); |
| 3425 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)); | 3427 return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)); |
| 3426 } | 3428 } |
| 3427 | 3429 |
| 3428 LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing( | 3430 LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing( |
| 3429 SizeType sizeType, | 3431 SizeType sizeType, |
| 3430 const Length& logicalHeight) const { | 3432 const Length& logicalHeight) const { |
| 3431 ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || | 3433 DCHECK(sizeType == MinSize || sizeType == MainOrPreferredSize || |
| 3432 !logicalHeight.isAuto()); | 3434 !logicalHeight.isAuto()); |
| 3433 if (sizeType == MinSize && logicalHeight.isAuto()) | 3435 if (sizeType == MinSize && logicalHeight.isAuto()) |
| 3434 return adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit()); | 3436 return adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit()); |
| 3435 | 3437 |
| 3436 switch (logicalHeight.type()) { | 3438 switch (logicalHeight.type()) { |
| 3437 case Fixed: | 3439 case Fixed: |
| 3438 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value()); | 3440 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value()); |
| 3439 case Percent: | 3441 case Percent: |
| 3440 case Calculated: { | 3442 case Calculated: { |
| 3441 // TODO(rego): Check if we can somehow reuse | 3443 // TODO(rego): Check if we can somehow reuse |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3658 | 3660 |
| 3659 // Ensure we compute our width based on the width of our rel-pos inline | 3661 // Ensure we compute our width based on the width of our rel-pos inline |
| 3660 // container rather than any anonymous block created to manage a block-flow | 3662 // container rather than any anonymous block created to manage a block-flow |
| 3661 // ancestor of ours in the rel-pos inline's inline flow. | 3663 // ancestor of ours in the rel-pos inline's inline flow. |
| 3662 if (containingBlock->isAnonymousBlock() && containingBlock->isRelPositioned()) | 3664 if (containingBlock->isAnonymousBlock() && containingBlock->isRelPositioned()) |
| 3663 containingBlock = toLayoutBox(containingBlock)->continuation(); | 3665 containingBlock = toLayoutBox(containingBlock)->continuation(); |
| 3664 else if (containingBlock->isBox()) | 3666 else if (containingBlock->isBox()) |
| 3665 return std::max(LayoutUnit(), | 3667 return std::max(LayoutUnit(), |
| 3666 toLayoutBox(containingBlock)->clientLogicalWidth()); | 3668 toLayoutBox(containingBlock)->clientLogicalWidth()); |
| 3667 | 3669 |
| 3668 ASSERT(containingBlock->isLayoutInline() && | 3670 DCHECK(containingBlock->isLayoutInline()); |
| 3669 containingBlock->isInFlowPositioned()); | 3671 DCHECK(containingBlock->isInFlowPositioned()); |
| 3670 | 3672 |
| 3671 const LayoutInline* flow = toLayoutInline(containingBlock); | 3673 const LayoutInline* flow = toLayoutInline(containingBlock); |
| 3672 InlineFlowBox* first = flow->firstLineBox(); | 3674 InlineFlowBox* first = flow->firstLineBox(); |
| 3673 InlineFlowBox* last = flow->lastLineBox(); | 3675 InlineFlowBox* last = flow->lastLineBox(); |
| 3674 | 3676 |
| 3675 // If the containing block is empty, return a width of 0. | 3677 // If the containing block is empty, return a width of 0. |
| 3676 if (!first || !last) | 3678 if (!first || !last) |
| 3677 return LayoutUnit(); | 3679 return LayoutUnit(); |
| 3678 | 3680 |
| 3679 LayoutUnit fromLeft; | 3681 LayoutUnit fromLeft; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3716 if (hasOverrideContainingBlockLogicalHeight()) | 3718 if (hasOverrideContainingBlockLogicalHeight()) |
| 3717 return overrideContainingBlockContentLogicalHeight(); | 3719 return overrideContainingBlockContentLogicalHeight(); |
| 3718 | 3720 |
| 3719 if (containingBlock->isBox()) { | 3721 if (containingBlock->isBox()) { |
| 3720 const LayoutBlock* cb = containingBlock->isLayoutBlock() | 3722 const LayoutBlock* cb = containingBlock->isLayoutBlock() |
| 3721 ? toLayoutBlock(containingBlock) | 3723 ? toLayoutBlock(containingBlock) |
| 3722 : containingBlock->containingBlock(); | 3724 : containingBlock->containingBlock(); |
| 3723 return cb->clientLogicalHeight(); | 3725 return cb->clientLogicalHeight(); |
| 3724 } | 3726 } |
| 3725 | 3727 |
| 3726 ASSERT(containingBlock->isLayoutInline() && | 3728 DCHECK(containingBlock->isLayoutInline()); |
| 3727 containingBlock->isInFlowPositioned()); | 3729 DCHECK(containingBlock->isInFlowPositioned()); |
| 3728 | 3730 |
| 3729 const LayoutInline* flow = toLayoutInline(containingBlock); | 3731 const LayoutInline* flow = toLayoutInline(containingBlock); |
| 3730 InlineFlowBox* first = flow->firstLineBox(); | 3732 InlineFlowBox* first = flow->firstLineBox(); |
| 3731 InlineFlowBox* last = flow->lastLineBox(); | 3733 InlineFlowBox* last = flow->lastLineBox(); |
| 3732 | 3734 |
| 3733 // If the containing block is empty, return a height of 0. | 3735 // If the containing block is empty, return a height of 0. |
| 3734 if (!first || !last) | 3736 if (!first || !last) |
| 3735 return LayoutUnit(); | 3737 return LayoutUnit(); |
| 3736 | 3738 |
| 3737 LayoutUnit heightResult; | 3739 LayoutUnit heightResult; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4000 TextDirection containerDirection, | 4002 TextDirection containerDirection, |
| 4001 LayoutUnit containerLogicalWidth, | 4003 LayoutUnit containerLogicalWidth, |
| 4002 LayoutUnit bordersPlusPadding, | 4004 LayoutUnit bordersPlusPadding, |
| 4003 const Length& logicalLeft, | 4005 const Length& logicalLeft, |
| 4004 const Length& logicalRight, | 4006 const Length& logicalRight, |
| 4005 const Length& marginLogicalLeft, | 4007 const Length& marginLogicalLeft, |
| 4006 const Length& marginLogicalRight, | 4008 const Length& marginLogicalRight, |
| 4007 LogicalExtentComputedValues& computedValues) const { | 4009 LogicalExtentComputedValues& computedValues) const { |
| 4008 LayoutUnit logicalWidthValue; | 4010 LayoutUnit logicalWidthValue; |
| 4009 | 4011 |
| 4010 ASSERT(widthSizeType == MinSize || widthSizeType == MainOrPreferredSize || | 4012 DCHECK(widthSizeType == MinSize || widthSizeType == MainOrPreferredSize || |
| 4011 !logicalWidth.isAuto()); | 4013 !logicalWidth.isAuto()); |
| 4012 if (widthSizeType == MinSize && logicalWidth.isAuto()) | 4014 if (widthSizeType == MinSize && logicalWidth.isAuto()) |
| 4013 logicalWidthValue = LayoutUnit(); | 4015 logicalWidthValue = LayoutUnit(); |
| 4014 else if (logicalWidth.isIntrinsic()) | 4016 else if (logicalWidth.isIntrinsic()) |
| 4015 logicalWidthValue = | 4017 logicalWidthValue = |
| 4016 computeIntrinsicLogicalWidthUsing(logicalWidth, containerLogicalWidth, | 4018 computeIntrinsicLogicalWidthUsing(logicalWidth, containerLogicalWidth, |
| 4017 bordersPlusPadding) - | 4019 bordersPlusPadding) - |
| 4018 bordersPlusPadding; | 4020 bordersPlusPadding; |
| 4019 else | 4021 else |
| 4020 logicalWidthValue = adjustContentBoxLogicalWidthForBoxSizing( | 4022 logicalWidthValue = adjustContentBoxLogicalWidthForBoxSizing( |
| 4021 valueForLength(logicalWidth, containerLogicalWidth)); | 4023 valueForLength(logicalWidth, containerLogicalWidth)); |
| 4022 | 4024 |
| 4023 // 'left' and 'right' cannot both be 'auto' because one would of been | 4025 // 'left' and 'right' cannot both be 'auto' because one would of been |
| 4024 // converted to the static position already | 4026 // converted to the static position already |
| 4025 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); | 4027 DCHECK(!(logicalLeft.isAuto() && logicalRight.isAuto())); |
| 4026 | 4028 |
| 4027 // minimumValueForLength will convert 'auto' to 0 so that it doesn't impact | 4029 // minimumValueForLength will convert 'auto' to 0 so that it doesn't impact |
| 4028 // the available space computation below. | 4030 // the available space computation below. |
| 4029 LayoutUnit logicalLeftValue = | 4031 LayoutUnit logicalLeftValue = |
| 4030 minimumValueForLength(logicalLeft, containerLogicalWidth); | 4032 minimumValueForLength(logicalLeft, containerLogicalWidth); |
| 4031 LayoutUnit logicalRightValue = | 4033 LayoutUnit logicalRightValue = |
| 4032 minimumValueForLength(logicalRight, containerLogicalWidth); | 4034 minimumValueForLength(logicalRight, containerLogicalWidth); |
| 4033 | 4035 |
| 4034 const LayoutUnit containerRelativeLogicalWidth = | 4036 const LayoutUnit containerRelativeLogicalWidth = |
| 4035 containingBlockLogicalWidthForPositioned(containerBlock, false); | 4037 containingBlockLogicalWidthForPositioned(containerBlock, false); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4399 Length logicalHeightLength, | 4401 Length logicalHeightLength, |
| 4400 const LayoutBoxModelObject* containerBlock, | 4402 const LayoutBoxModelObject* containerBlock, |
| 4401 LayoutUnit containerLogicalHeight, | 4403 LayoutUnit containerLogicalHeight, |
| 4402 LayoutUnit bordersPlusPadding, | 4404 LayoutUnit bordersPlusPadding, |
| 4403 LayoutUnit logicalHeight, | 4405 LayoutUnit logicalHeight, |
| 4404 const Length& logicalTop, | 4406 const Length& logicalTop, |
| 4405 const Length& logicalBottom, | 4407 const Length& logicalBottom, |
| 4406 const Length& marginBefore, | 4408 const Length& marginBefore, |
| 4407 const Length& marginAfter, | 4409 const Length& marginAfter, |
| 4408 LogicalExtentComputedValues& computedValues) const { | 4410 LogicalExtentComputedValues& computedValues) const { |
| 4409 ASSERT(heightSizeType == MinSize || heightSizeType == MainOrPreferredSize || | 4411 DCHECK(heightSizeType == MinSize || heightSizeType == MainOrPreferredSize || |
| 4410 !logicalHeightLength.isAuto()); | 4412 !logicalHeightLength.isAuto()); |
| 4411 if (heightSizeType == MinSize && logicalHeightLength.isAuto()) | 4413 if (heightSizeType == MinSize && logicalHeightLength.isAuto()) |
| 4412 logicalHeightLength = Length(0, Fixed); | 4414 logicalHeightLength = Length(0, Fixed); |
| 4413 | 4415 |
| 4414 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been | 4416 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been |
| 4415 // converted to the static position in computePositionedLogicalHeight() | 4417 // converted to the static position in computePositionedLogicalHeight() |
| 4416 ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); | 4418 DCHECK(!(logicalTop.isAuto() && logicalBottom.isAuto())); |
| 4417 | 4419 |
| 4418 LayoutUnit logicalHeightValue; | 4420 LayoutUnit logicalHeightValue; |
| 4419 LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; | 4421 LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; |
| 4420 | 4422 |
| 4421 const LayoutUnit containerRelativeLogicalWidth = | 4423 const LayoutUnit containerRelativeLogicalWidth = |
| 4422 containingBlockLogicalWidthForPositioned(containerBlock, false); | 4424 containingBlockLogicalWidthForPositioned(containerBlock, false); |
| 4423 | 4425 |
| 4424 LayoutUnit logicalTopValue; | 4426 LayoutUnit logicalTopValue; |
| 4425 | 4427 |
| 4426 bool logicalHeightIsAuto = logicalHeightLength.isAuto(); | 4428 bool logicalHeightIsAuto = logicalHeightLength.isAuto(); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4835 SubtreeLayoutScope& layoutScope) { | 4837 SubtreeLayoutScope& layoutScope) { |
| 4836 DCHECK(!child.needsLayout()); | 4838 DCHECK(!child.needsLayout()); |
| 4837 LayoutState* layoutState = view()->layoutState(); | 4839 LayoutState* layoutState = view()->layoutState(); |
| 4838 | 4840 |
| 4839 if (layoutState->paginationStateChanged() || | 4841 if (layoutState->paginationStateChanged() || |
| 4840 (layoutState->isPaginated() && childNeedsRelayoutForPagination(child))) | 4842 (layoutState->isPaginated() && childNeedsRelayoutForPagination(child))) |
| 4841 layoutScope.setChildNeedsLayout(&child); | 4843 layoutScope.setChildNeedsLayout(&child); |
| 4842 } | 4844 } |
| 4843 | 4845 |
| 4844 void LayoutBox::markOrthogonalWritingModeRoot() { | 4846 void LayoutBox::markOrthogonalWritingModeRoot() { |
| 4845 ASSERT(frameView()); | 4847 DCHECK(frameView()); |
| 4846 frameView()->addOrthogonalWritingModeRoot(*this); | 4848 frameView()->addOrthogonalWritingModeRoot(*this); |
| 4847 } | 4849 } |
| 4848 | 4850 |
| 4849 void LayoutBox::unmarkOrthogonalWritingModeRoot() { | 4851 void LayoutBox::unmarkOrthogonalWritingModeRoot() { |
| 4850 ASSERT(frameView()); | 4852 DCHECK(frameView()); |
| 4851 frameView()->removeOrthogonalWritingModeRoot(*this); | 4853 frameView()->removeOrthogonalWritingModeRoot(*this); |
| 4852 } | 4854 } |
| 4853 | 4855 |
| 4854 void LayoutBox::addVisualEffectOverflow() { | 4856 void LayoutBox::addVisualEffectOverflow() { |
| 4855 if (!style()->hasVisualOverflowingEffect()) | 4857 if (!style()->hasVisualOverflowingEffect()) |
| 4856 return; | 4858 return; |
| 4857 | 4859 |
| 4858 // Add in the final overflow with shadows, outsets and outline combined. | 4860 // Add in the final overflow with shadows, outsets and outline combined. |
| 4859 LayoutRect visualEffectOverflow = borderBoxRect(); | 4861 LayoutRect visualEffectOverflow = borderBoxRect(); |
| 4860 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets()); | 4862 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets()); |
| 4861 addSelfVisualOverflow(visualEffectOverflow); | 4863 addSelfVisualOverflow(visualEffectOverflow); |
| 4862 } | 4864 } |
| 4863 | 4865 |
| 4864 LayoutRectOutsets LayoutBox::computeVisualEffectOverflowOutsets() { | 4866 LayoutRectOutsets LayoutBox::computeVisualEffectOverflowOutsets() { |
| 4865 ASSERT(style()->hasVisualOverflowingEffect()); | 4867 DCHECK(style()->hasVisualOverflowingEffect()); |
| 4866 | 4868 |
| 4867 LayoutUnit top; | 4869 LayoutUnit top; |
| 4868 LayoutUnit right; | 4870 LayoutUnit right; |
| 4869 LayoutUnit bottom; | 4871 LayoutUnit bottom; |
| 4870 LayoutUnit left; | 4872 LayoutUnit left; |
| 4871 | 4873 |
| 4872 if (const ShadowList* boxShadow = style()->boxShadow()) { | 4874 if (const ShadowList* boxShadow = style()->boxShadow()) { |
| 4873 // FIXME: Use LayoutUnit edge outsets, and then simplify this. | 4875 // FIXME: Use LayoutUnit edge outsets, and then simplify this. |
| 4874 FloatRectOutsets outsets = boxShadow->rectOutsetsIncludingOriginal(); | 4876 FloatRectOutsets outsets = boxShadow->rectOutsetsIncludingOriginal(); |
| 4875 top = LayoutUnit(outsets.top()); | 4877 top = LayoutUnit(outsets.top()); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5098 return direction == HorizontalLine ? marginHeight() + size().height() | 5100 return direction == HorizontalLine ? marginHeight() + size().height() |
| 5099 : marginWidth() + size().width(); | 5101 : marginWidth() + size().width(); |
| 5100 return LayoutUnit(); | 5102 return LayoutUnit(); |
| 5101 } | 5103 } |
| 5102 | 5104 |
| 5103 DISABLE_CFI_PERF | 5105 DISABLE_CFI_PERF |
| 5104 int LayoutBox::baselinePosition(FontBaseline baselineType, | 5106 int LayoutBox::baselinePosition(FontBaseline baselineType, |
| 5105 bool /*firstLine*/, | 5107 bool /*firstLine*/, |
| 5106 LineDirectionMode direction, | 5108 LineDirectionMode direction, |
| 5107 LinePositionMode linePositionMode) const { | 5109 LinePositionMode linePositionMode) const { |
| 5108 ASSERT(linePositionMode == PositionOnContainingLine); | 5110 DCHECK_EQ(linePositionMode, PositionOnContainingLine); |
| 5109 if (isAtomicInlineLevel()) { | 5111 if (isAtomicInlineLevel()) { |
| 5110 int result = direction == HorizontalLine | 5112 int result = direction == HorizontalLine |
| 5111 ? roundToInt(marginHeight() + size().height()) | 5113 ? roundToInt(marginHeight() + size().height()) |
| 5112 : roundToInt(marginWidth() + size().width()); | 5114 : roundToInt(marginWidth() + size().width()); |
| 5113 if (baselineType == AlphabeticBaseline) | 5115 if (baselineType == AlphabeticBaseline) |
| 5114 return result; | 5116 return result; |
| 5115 return result - result / 2; | 5117 return result - result / 2; |
| 5116 } | 5118 } |
| 5117 return 0; | 5119 return 0; |
| 5118 } | 5120 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5290 LayoutObject* container = this->container(); | 5292 LayoutObject* container = this->container(); |
| 5291 while (container && !container->isBox()) | 5293 while (container && !container->isBox()) |
| 5292 container = container->container(); | 5294 container = container->container(); |
| 5293 return toLayoutBox(container); | 5295 return toLayoutBox(container); |
| 5294 } | 5296 } |
| 5295 | 5297 |
| 5296 LayoutPoint LayoutBox::physicalLocation( | 5298 LayoutPoint LayoutBox::physicalLocation( |
| 5297 const LayoutBox* flippedBlocksContainer) const { | 5299 const LayoutBox* flippedBlocksContainer) const { |
| 5298 const LayoutBox* containerBox; | 5300 const LayoutBox* containerBox; |
| 5299 if (flippedBlocksContainer) { | 5301 if (flippedBlocksContainer) { |
| 5300 DCHECK(flippedBlocksContainer == locationContainer()); | 5302 DCHECK_EQ(flippedBlocksContainer, locationContainer()); |
| 5301 containerBox = flippedBlocksContainer; | 5303 containerBox = flippedBlocksContainer; |
| 5302 } else { | 5304 } else { |
| 5303 containerBox = locationContainer(); | 5305 containerBox = locationContainer(); |
| 5304 } | 5306 } |
| 5305 if (!containerBox) | 5307 if (!containerBox) |
| 5306 return location(); | 5308 return location(); |
| 5307 return containerBox->flipForWritingModeForChild(this, location()); | 5309 return containerBox->flipForWritingModeForChild(this, location()); |
| 5308 } | 5310 } |
| 5309 | 5311 |
| 5310 bool LayoutBox::hasRelativeLogicalWidth() const { | 5312 bool LayoutBox::hasRelativeLogicalWidth() const { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5360 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 5362 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
| 5361 // We need to invalidate the |parentBox| before inserting the new node | 5363 // We need to invalidate the |parentBox| before inserting the new node |
| 5362 // so that the table paint invalidation logic knows the structure is | 5364 // so that the table paint invalidation logic knows the structure is |
| 5363 // dirty. See for example LayoutTableCell:localVisualRect(). | 5365 // dirty. See for example LayoutTableCell:localVisualRect(). |
| 5364 markBoxForRelayoutAfterSplit(parentBox); | 5366 markBoxForRelayoutAfterSplit(parentBox); |
| 5365 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, | 5367 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, |
| 5366 boxToSplit->nextSibling()); | 5368 boxToSplit->nextSibling()); |
| 5367 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 5369 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
| 5368 | 5370 |
| 5369 LayoutObject* child = postBox->slowFirstChild(); | 5371 LayoutObject* child = postBox->slowFirstChild(); |
| 5370 ASSERT(child); | 5372 DCHECK(child); |
| 5371 if (child && !child->nextSibling()) | 5373 if (child && !child->nextSibling()) |
| 5372 collapseLoneAnonymousBlockChild(postBox, child); | 5374 collapseLoneAnonymousBlockChild(postBox, child); |
| 5373 child = boxToSplit->slowFirstChild(); | 5375 child = boxToSplit->slowFirstChild(); |
| 5374 ASSERT(child); | 5376 DCHECK(child); |
| 5375 if (child && !child->nextSibling()) | 5377 if (child && !child->nextSibling()) |
| 5376 collapseLoneAnonymousBlockChild(boxToSplit, child); | 5378 collapseLoneAnonymousBlockChild(boxToSplit, child); |
| 5377 | 5379 |
| 5378 markBoxForRelayoutAfterSplit(boxToSplit); | 5380 markBoxForRelayoutAfterSplit(boxToSplit); |
| 5379 markBoxForRelayoutAfterSplit(postBox); | 5381 markBoxForRelayoutAfterSplit(postBox); |
| 5380 boxAtTopOfNewBranch = postBox; | 5382 boxAtTopOfNewBranch = postBox; |
| 5381 | 5383 |
| 5382 beforeChild = postBox; | 5384 beforeChild = postBox; |
| 5383 } else { | 5385 } else { |
| 5384 beforeChild = boxToSplit; | 5386 beforeChild = boxToSplit; |
| 5385 } | 5387 } |
| 5386 } | 5388 } |
| 5387 | 5389 |
| 5388 // Splitting the box means the left side of the container chain will lose any | 5390 // Splitting the box means the left side of the container chain will lose any |
| 5389 // percent height descendants below |boxAtTopOfNewBranch| on the right hand | 5391 // percent height descendants below |boxAtTopOfNewBranch| on the right hand |
| 5390 // side. | 5392 // side. |
| 5391 if (boxAtTopOfNewBranch) { | 5393 if (boxAtTopOfNewBranch) { |
| 5392 boxAtTopOfNewBranch->clearPercentHeightDescendants(); | 5394 boxAtTopOfNewBranch->clearPercentHeightDescendants(); |
| 5393 markBoxForRelayoutAfterSplit(this); | 5395 markBoxForRelayoutAfterSplit(this); |
| 5394 } | 5396 } |
| 5395 | 5397 |
| 5396 ASSERT(beforeChild->parent() == this); | 5398 DCHECK_EQ(beforeChild->parent(), this); |
| 5397 return beforeChild; | 5399 return beforeChild; |
| 5398 } | 5400 } |
| 5399 | 5401 |
| 5400 LayoutUnit LayoutBox::offsetFromLogicalTopOfFirstPage() const { | 5402 LayoutUnit LayoutBox::offsetFromLogicalTopOfFirstPage() const { |
| 5401 LayoutState* layoutState = view()->layoutState(); | 5403 LayoutState* layoutState = view()->layoutState(); |
| 5402 if (!layoutState || !layoutState->isPaginated()) | 5404 if (!layoutState || !layoutState->isPaginated()) |
| 5403 return LayoutUnit(); | 5405 return LayoutUnit(); |
| 5404 | 5406 |
| 5405 if (layoutState->layoutObject() == this) { | 5407 if (layoutState->layoutObject() == this) { |
| 5406 LayoutSize offset = layoutState->paginationOffset(); | 5408 LayoutSize offset = layoutState->paginationOffset(); |
| 5407 return isHorizontalWritingMode() ? offset.height() : offset.width(); | 5409 return isHorizontalWritingMode() ? offset.height() : offset.width(); |
| 5408 } | 5410 } |
| 5409 | 5411 |
| 5410 // A LayoutBlock always establishes a layout state, and this method is only | 5412 // A LayoutBlock always establishes a layout state, and this method is only |
| 5411 // meant to be called on the object currently being laid out. | 5413 // meant to be called on the object currently being laid out. |
| 5412 ASSERT(!isLayoutBlock()); | 5414 DCHECK(!isLayoutBlock()); |
| 5413 | 5415 |
| 5414 // In case this box doesn't establish a layout state, try the containing | 5416 // In case this box doesn't establish a layout state, try the containing |
| 5415 // block. | 5417 // block. |
| 5416 LayoutBlock* containerBlock = containingBlock(); | 5418 LayoutBlock* containerBlock = containingBlock(); |
| 5417 ASSERT(layoutState->layoutObject() == containerBlock); | 5419 DCHECK(layoutState->layoutObject() == containerBlock); |
| 5418 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 5420 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 5419 } | 5421 } |
| 5420 | 5422 |
| 5421 void LayoutBox::setOffsetToNextPage(LayoutUnit offset) { | 5423 void LayoutBox::setOffsetToNextPage(LayoutUnit offset) { |
| 5422 if (!m_rareData && !offset) | 5424 if (!m_rareData && !offset) |
| 5423 return; | 5425 return; |
| 5424 ensureRareData().m_offsetToNextPage = offset; | 5426 ensureRareData().m_offsetToNextPage = offset; |
| 5425 } | 5427 } |
| 5426 | 5428 |
| 5427 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth( | 5429 void LayoutBox::logicalExtentAfterUpdatingLogicalWidth( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5580 : nullptr; | 5582 : nullptr; |
| 5581 } | 5583 } |
| 5582 | 5584 |
| 5583 void LayoutBox::clearPreviousVisualRects() { | 5585 void LayoutBox::clearPreviousVisualRects() { |
| 5584 LayoutBoxModelObject::clearPreviousVisualRects(); | 5586 LayoutBoxModelObject::clearPreviousVisualRects(); |
| 5585 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) | 5587 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) |
| 5586 scrollableArea->clearPreviousVisualRects(); | 5588 scrollableArea->clearPreviousVisualRects(); |
| 5587 } | 5589 } |
| 5588 | 5590 |
| 5589 void LayoutBox::setPercentHeightContainer(LayoutBlock* container) { | 5591 void LayoutBox::setPercentHeightContainer(LayoutBlock* container) { |
| 5590 ASSERT(!container || !percentHeightContainer()); | 5592 DCHECK(!container || !percentHeightContainer()); |
| 5591 if (!container && !m_rareData) | 5593 if (!container && !m_rareData) |
| 5592 return; | 5594 return; |
| 5593 ensureRareData().m_percentHeightContainer = container; | 5595 ensureRareData().m_percentHeightContainer = container; |
| 5594 } | 5596 } |
| 5595 | 5597 |
| 5596 void LayoutBox::removeFromPercentHeightContainer() { | 5598 void LayoutBox::removeFromPercentHeightContainer() { |
| 5597 if (!percentHeightContainer()) | 5599 if (!percentHeightContainer()) |
| 5598 return; | 5600 return; |
| 5599 | 5601 |
| 5600 ASSERT(percentHeightContainer()->hasPercentHeightDescendant(this)); | 5602 DCHECK(percentHeightContainer()->hasPercentHeightDescendant(this)); |
| 5601 percentHeightContainer()->removePercentHeightDescendant(this); | 5603 percentHeightContainer()->removePercentHeightDescendant(this); |
| 5602 // The above call should call this object's | 5604 // The above call should call this object's |
| 5603 // setPercentHeightContainer(nullptr). | 5605 // setPercentHeightContainer(nullptr). |
| 5604 ASSERT(!percentHeightContainer()); | 5606 DCHECK(!percentHeightContainer()); |
| 5605 } | 5607 } |
| 5606 | 5608 |
| 5607 void LayoutBox::clearPercentHeightDescendants() { | 5609 void LayoutBox::clearPercentHeightDescendants() { |
| 5608 for (LayoutObject* curr = slowFirstChild(); curr; | 5610 for (LayoutObject* curr = slowFirstChild(); curr; |
| 5609 curr = curr->nextInPreOrder(this)) { | 5611 curr = curr->nextInPreOrder(this)) { |
| 5610 if (curr->isBox()) | 5612 if (curr->isBox()) |
| 5611 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 5613 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
| 5612 } | 5614 } |
| 5613 } | 5615 } |
| 5614 | 5616 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5656 if (!pageLogicalHeightForOffset(offset)) | 5658 if (!pageLogicalHeightForOffset(offset)) |
| 5657 return false; | 5659 return false; |
| 5658 return pageRemainingLogicalHeightForOffset(offset, AssociateWithLatterPage) < | 5660 return pageRemainingLogicalHeightForOffset(offset, AssociateWithLatterPage) < |
| 5659 logicalHeight; | 5661 logicalHeight; |
| 5660 } | 5662 } |
| 5661 | 5663 |
| 5662 LayoutUnit LayoutBox::calculatePaginationStrutToFitContent( | 5664 LayoutUnit LayoutBox::calculatePaginationStrutToFitContent( |
| 5663 LayoutUnit offset, | 5665 LayoutUnit offset, |
| 5664 LayoutUnit strutToNextPage, | 5666 LayoutUnit strutToNextPage, |
| 5665 LayoutUnit contentLogicalHeight) const { | 5667 LayoutUnit contentLogicalHeight) const { |
| 5666 ASSERT(strutToNextPage == | 5668 DCHECK_EQ(strutToNextPage, pageRemainingLogicalHeightForOffset( |
| 5667 pageRemainingLogicalHeightForOffset(offset, AssociateWithLatterPage)); | 5669 offset, AssociateWithLatterPage)); |
| 5668 // If we're a cell in a row that straddles a page then avoid the repeating | 5670 // If we're a cell in a row that straddles a page then avoid the repeating |
| 5669 // header group if necessary. | 5671 // header group if necessary. |
| 5670 if (isTableCell()) { | 5672 if (isTableCell()) { |
| 5671 const LayoutTableCell* cell = toLayoutTableCell(this); | 5673 const LayoutTableCell* cell = toLayoutTableCell(this); |
| 5672 if (!cell->row()->isFirstRowInSectionAfterHeader()) | 5674 if (!cell->row()->isFirstRowInSectionAfterHeader()) |
| 5673 strutToNextPage += cell->table()->rowOffsetFromRepeatingHeader(); | 5675 strutToNextPage += cell->table()->rowOffsetFromRepeatingHeader(); |
| 5674 } | 5676 } |
| 5675 LayoutUnit nextPageLogicalTop = offset + strutToNextPage; | 5677 LayoutUnit nextPageLogicalTop = offset + strutToNextPage; |
| 5676 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight) | 5678 if (pageLogicalHeightForOffset(nextPageLogicalTop) >= contentLogicalHeight) |
| 5677 return strutToNextPage; // Content fits just fine in the next page or | 5679 return strutToNextPage; // Content fits just fine in the next page or |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5753 | 5755 |
| 5754 void LayoutBox::MutableForPainting:: | 5756 void LayoutBox::MutableForPainting:: |
| 5755 savePreviousContentBoxSizeAndLayoutOverflowRect() { | 5757 savePreviousContentBoxSizeAndLayoutOverflowRect() { |
| 5756 auto& rareData = layoutBox().ensureRareData(); | 5758 auto& rareData = layoutBox().ensureRareData(); |
| 5757 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; | 5759 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; |
| 5758 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); | 5760 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); |
| 5759 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); | 5761 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); |
| 5760 } | 5762 } |
| 5761 | 5763 |
| 5762 } // namespace blink | 5764 } // namespace blink |
| OLD | NEW |