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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // the middle of recomputing the style so we can't rely on any of its | 98 // the middle of recomputing the style so we can't rely on any of its |
99 // information), which is why it's easier to just update it for every layout. | 99 // information), which is why it's easier to just update it for every layout. |
100 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; | 100 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; |
101 static TrackedContainerMap* gPositionedContainerMap = nullptr; | 101 static TrackedContainerMap* gPositionedContainerMap = nullptr; |
102 | 102 |
103 // This map keeps track of the descendants whose 'height' is percentage associat
ed | 103 // This map keeps track of the descendants whose 'height' is percentage associat
ed |
104 // with a containing block. Like |gPositionedDescendantsMap|, it is also recompu
ted | 104 // with a containing block. Like |gPositionedDescendantsMap|, it is also recompu
ted |
105 // for every layout (see the comment above about why). | 105 // for every layout (see the comment above about why). |
106 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; | 106 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; |
107 | 107 |
108 typedef WTF::HashSet<LayoutBlock*> DelayedUpdateScrollInfoSet; | |
109 static int gDelayUpdateScrollInfo = 0; | |
110 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = nullptr; | |
111 | |
112 LayoutBlock::LayoutBlock(ContainerNode* node) | 108 LayoutBlock::LayoutBlock(ContainerNode* node) |
113 : LayoutBox(node) | 109 : LayoutBox(node) |
114 , m_hasMarginBeforeQuirk(false) | 110 , m_hasMarginBeforeQuirk(false) |
115 , m_hasMarginAfterQuirk(false) | 111 , m_hasMarginAfterQuirk(false) |
116 , m_beingDestroyed(false) | 112 , m_beingDestroyed(false) |
117 , m_hasMarkupTruncation(false) | 113 , m_hasMarkupTruncation(false) |
118 , m_widthAvailableToChildrenChanged(false) | 114 , m_widthAvailableToChildrenChanged(false) |
119 , m_heightAvailableToChildrenChanged(false) | 115 , m_heightAvailableToChildrenChanged(false) |
120 , m_hasOnlySelfCollapsingChildren(false) | 116 , m_hasOnlySelfCollapsingChildren(false) |
121 , m_descendantsWithFloatsMarkedForLayout(false) | 117 , m_descendantsWithFloatsMarkedForLayout(false) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 childBox->remove(); | 183 childBox->remove(); |
188 } | 184 } |
189 } | 185 } |
190 } else if (parent()) { | 186 } else if (parent()) { |
191 parent()->dirtyLinesFromChangedChild(this); | 187 parent()->dirtyLinesFromChangedChild(this); |
192 } | 188 } |
193 } | 189 } |
194 | 190 |
195 m_lineBoxes.deleteLineBoxes(); | 191 m_lineBoxes.deleteLineBoxes(); |
196 | 192 |
197 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) | |
198 gDelayedUpdateScrollInfoSet->remove(this); | |
199 | |
200 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 193 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
201 textAutosizer->destroy(this); | 194 textAutosizer->destroy(this); |
202 | 195 |
203 LayoutBox::willBeDestroyed(); | 196 LayoutBox::willBeDestroyed(); |
204 } | 197 } |
205 | 198 |
206 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) | 199 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) |
207 { | 200 { |
208 const ComputedStyle* oldStyle = style(); | 201 const ComputedStyle* oldStyle = style(); |
209 | 202 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 if (child->isFloatingOrOutOfFlowPositioned()) | 795 if (child->isFloatingOrOutOfFlowPositioned()) |
803 continue; | 796 continue; |
804 if (!child->isSelfCollapsingBlock()) | 797 if (!child->isSelfCollapsingBlock()) |
805 return false; | 798 return false; |
806 } | 799 } |
807 return true; | 800 return true; |
808 } | 801 } |
809 return false; | 802 return false; |
810 } | 803 } |
811 | 804 |
812 void LayoutBlock::startDelayUpdateScrollInfo() | |
813 { | |
814 if (gDelayUpdateScrollInfo == 0) { | |
815 ASSERT(!gDelayedUpdateScrollInfoSet); | |
816 gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet; | |
817 } | |
818 ASSERT(gDelayedUpdateScrollInfoSet); | |
819 ++gDelayUpdateScrollInfo; | |
820 } | |
821 | |
822 bool LayoutBlock::finishDelayUpdateScrollInfo(SubtreeLayoutScope* layoutScope, S
crollPositionMap* scrollMap) | |
823 { | |
824 bool childrenMarkedForRelayout = false; | |
825 | |
826 --gDelayUpdateScrollInfo; | |
827 ASSERT(gDelayUpdateScrollInfo >= 0); | |
828 if (gDelayUpdateScrollInfo == 0) { | |
829 ASSERT(gDelayedUpdateScrollInfoSet); | |
830 | |
831 OwnPtr<DelayedUpdateScrollInfoSet> infoSet(adoptPtr(gDelayedUpdateScroll
InfoSet)); | |
832 gDelayedUpdateScrollInfoSet = nullptr; | |
833 | |
834 for (auto* block : *infoSet) { | |
835 if (block->hasOverflowClip()) { | |
836 PaintLayerScrollableArea* scrollableArea = block->layer()->getSc
rollableArea(); | |
837 if (scrollMap) | |
838 scrollMap->add(scrollableArea, scrollableArea->scrollPositio
nDouble()); | |
839 childrenMarkedForRelayout |= scrollableArea->updateAfterLayout(l
ayoutScope); | |
840 } | |
841 } | |
842 } | |
843 return childrenMarkedForRelayout; | |
844 } | |
845 | |
846 void LayoutBlock::updateAfterLayout() | 805 void LayoutBlock::updateAfterLayout() |
847 { | 806 { |
848 invalidateStickyConstraints(); | 807 invalidateStickyConstraints(); |
849 | 808 |
850 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 809 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
851 // we overflow or not. | 810 // we overflow or not. |
852 if (hasOverflowClip()) { | 811 if (hasOverflowClip()) |
853 if (style()->isFlippedBlocksWritingMode()) { | 812 layer()->getScrollableArea()->updateAfterLayout(); |
854 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937 | |
855 // Workaround for now. We cannot delay the scroll info for overflow | |
856 // for items with opposite writing directions, as the contents needs | |
857 // to overflow in that direction | |
858 layer()->getScrollableArea()->updateAfterLayout(); | |
859 return; | |
860 } | |
861 | |
862 if (gDelayUpdateScrollInfo) | |
863 gDelayedUpdateScrollInfoSet->add(this); | |
864 else | |
865 layer()->getScrollableArea()->updateAfterLayout(); | |
866 } | |
867 } | 813 } |
868 | 814 |
869 void LayoutBlock::layout() | 815 void LayoutBlock::layout() |
870 { | 816 { |
871 LayoutAnalyzer::Scope analyzer(*this); | 817 LayoutAnalyzer::Scope analyzer(*this); |
872 | 818 |
873 bool needsScrollAnchoring = RuntimeEnabledFeatures::scrollAnchoringEnabled()
&& hasOverflowClip(); | 819 bool needsScrollAnchoring = RuntimeEnabledFeatures::scrollAnchoringEnabled()
&& hasOverflowClip(); |
874 if (needsScrollAnchoring) | 820 if (needsScrollAnchoring) |
875 getScrollableArea()->scrollAnchor().save(); | 821 getScrollableArea()->scrollAnchor().save(); |
876 | 822 |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2778 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2833 { | 2779 { |
2834 showLayoutObject(); | 2780 showLayoutObject(); |
2835 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2781 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2836 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2782 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2837 } | 2783 } |
2838 | 2784 |
2839 #endif | 2785 #endif |
2840 | 2786 |
2841 } // namespace blink | 2787 } // namespace blink |
OLD | NEW |