Changeset 189594 in webkit
- Timestamp:
- Sep 10, 2015 3:15:46 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r189579 r189594 1 2015-09-10 David Hyatt <hyatt@apple.com> 2 3 [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks 4 https://bugs.webkit.org/show_bug.cgi?id=149042 5 6 Reviewed by Dean Jackson. 7 8 * fast/block/inside-inlines/new-model/self-collapsing-test-expected.html: Added. 9 * fast/block/inside-inlines/new-model/self-collapsing-test.html: Added. 10 * fast/block/inside-inlines/self-collapsing-test-expected.html: Added. 11 * fast/block/inside-inlines/self-collapsing-test.html: Added. 12 1 13 2015-09-10 Dewei Zhu <dewei_zhu@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r189581 r189594 1 2015-09-10 David Hyatt <hyatt@apple.com> 2 3 [New Block-Inside-Inline Model] Self-collapsing block check needs to account for anonymous inline blocks 4 https://bugs.webkit.org/show_bug.cgi?id=149042 5 6 Reviewed by Dean Jackson. 7 8 Added new tests in fast/block/inside-inlines/ 9 10 * rendering/InlineFlowBox.cpp: 11 * rendering/InlineFlowBox.h: 12 (WebCore::InlineFlowBox::anonymousInlineBlock): 13 Add a new accessor to get the anonymousInlineBlock() for lines that wrap them. 14 15 * rendering/RenderBlock.cpp: 16 (WebCore::RenderBlock::childrenPreventSelfCollapsing): 17 (WebCore::RenderBlock::isSelfCollapsingBlock): 18 isSelfCollapsingBlock() now calls a virtual method that checks lines/children called childrenPreventSelfCollapsing. 19 This lets us farm out the lines check to the derived RenderBlockFlow class. 20 21 * rendering/RenderBlock.h: 22 (WebCore::RenderBlock::childrenPreventSelfCollapsing): 23 Added new virtual method for checking children. 24 25 * rendering/RenderBlockFlow.cpp: 26 * rendering/RenderBlockFlow.h: 27 (WebCore::RenderBlockFlow::childrenPreventSelfCollapsing): 28 Overridden to ensure that blocks can still be self-collapsing if they only contain anonymous inline-block lines that 29 are also self-collapsing. 30 1 31 2015-09-10 Jinyoung Hur <hur.ims@navercorp.com> 2 32 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r189144 r189594 69 69 70 70 #endif 71 72 RenderBlockFlow* InlineFlowBox::anonymousInlineBlock() const 73 { 74 return m_hasAnonymousInlineBlock ? &downcast<RenderBlockFlow>(firstChild()->renderer()) : nullptr; 75 } 71 76 72 77 LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth() -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r182279 r189594 215 215 bool hasAnonymousInlineBlock() const { return m_hasAnonymousInlineBlock; } 216 216 void setHasAnonymousInlineBlock(bool b) { m_hasAnonymousInlineBlock = b; } 217 217 RenderBlockFlow* anonymousInlineBlock() const; 218 218 219 void checkConsistency() const; 219 220 void setHasBadChildList(); -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r189144 r189594 796 796 } 797 797 798 bool RenderBlock::childrenPreventSelfCollapsing() const 799 { 800 // Whether or not we collapse is dependent on whether all our normal flow children 801 // are also self-collapsing. 802 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 803 if (child->isFloatingOrOutOfFlowPositioned()) 804 continue; 805 if (!child->isSelfCollapsingBlock()) 806 return true; 807 } 808 return false; 809 } 810 798 811 bool RenderBlock::isSelfCollapsingBlock() const 799 812 { … … 822 835 // If the height is 0 or auto, then whether or not we are a self-collapsing block depends 823 836 // on whether we have content that is all self-collapsing or not. 824 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero())) { 825 // If the block has inline children, see if we generated any line boxes. If we have any 826 // line boxes, then we can't be self-collapsing, since we have content. 827 if (childrenInline()) 828 return !hasLines(); 829 830 // Whether or not we collapse is dependent on whether all our normal flow children 831 // are also self-collapsing. 832 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 833 if (child->isFloatingOrOutOfFlowPositioned()) 834 continue; 835 if (!child->isSelfCollapsingBlock()) 836 return false; 837 } 838 return true; 839 } 837 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.isPercentOrCalculated()) && logicalHeightLength.isZero())) 838 return !childrenPreventSelfCollapsing(); 839 840 840 return false; 841 841 } -
trunk/Source/WebCore/rendering/RenderBlock.h
r187502 r189594 414 414 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) override; 415 415 416 virtual bool isSelfCollapsingBlock() const override final; 416 virtual bool isSelfCollapsingBlock() const override; 417 virtual bool childrenPreventSelfCollapsing() const; 418 417 419 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow 418 420 virtual bool hasLines() const { return false; } -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r189144 r189594 943 943 944 944 return MarginValues(childBeforePositive, childBeforeNegative, childAfterPositive, childAfterNegative); 945 } 946 947 bool RenderBlockFlow::childrenPreventSelfCollapsing() const 948 { 949 if (!childrenInline()) 950 return RenderBlock::childrenPreventSelfCollapsing(); 951 952 // If the block has inline children, see if we generated any line boxes. If we have any 953 // line boxes, then we can only be self-collapsing if we have nothing but anonymous inline blocks 954 // that are also self-collapsing inside us. 955 if (!hasLines()) 956 return false; 957 958 if (simpleLineLayout()) 959 return true; // We have simple line layout lines, so we can't be self-collapsing. 960 961 for (auto* child = firstRootBox(); child; child = child->nextRootBox()) { 962 if (!child->hasAnonymousInlineBlock() || !child->anonymousInlineBlock()->isSelfCollapsingBlock()) 963 return true; 964 } 965 return false; // We have no line boxes, so we must be self-collapsing. 945 966 } 946 967 -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r186686 r189594 255 255 void handleAfterSideOfBlock(LayoutUnit top, LayoutUnit bottom, MarginInfo&); 256 256 void setCollapsedBottomMargin(const MarginInfo&); 257 258 virtual bool childrenPreventSelfCollapsing() const override final; 257 259 258 260 bool shouldBreakAtLineToAvoidWidow() const { return hasRareBlockFlowData() && rareBlockFlowData()->m_lineBreakToAvoidWidow >= 0; }
Note: See TracChangeset
for help on using the changeset viewer.