| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // the middle of recomputing the style so we can't rely on any of its | 96 // the middle of recomputing the style so we can't rely on any of its |
| 97 // information), which is why it's easier to just update it for every layout. | 97 // information), which is why it's easier to just update it for every layout. |
| 98 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; | 98 static TrackedDescendantsMap* gPositionedDescendantsMap = nullptr; |
| 99 static TrackedContainerMap* gPositionedContainerMap = nullptr; | 99 static TrackedContainerMap* gPositionedContainerMap = nullptr; |
| 100 | 100 |
| 101 // This map keeps track of the descendants whose 'height' is percentage associat
ed | 101 // This map keeps track of the descendants whose 'height' is percentage associat
ed |
| 102 // with a containing block. Like |gPositionedDescendantsMap|, it is also recompu
ted | 102 // with a containing block. Like |gPositionedDescendantsMap|, it is also recompu
ted |
| 103 // for every layout (see the comment above about why). | 103 // for every layout (see the comment above about why). |
| 104 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; | 104 static TrackedDescendantsMap* gPercentHeightDescendantsMap = nullptr; |
| 105 | 105 |
| 106 typedef WTF::HashSet<LayoutBlock*> DelayedUpdateScrollInfoSet; | |
| 107 static int gDelayUpdateScrollInfo = 0; | |
| 108 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = nullptr; | |
| 109 | |
| 110 LayoutBlock::LayoutBlock(ContainerNode* node) | 106 LayoutBlock::LayoutBlock(ContainerNode* node) |
| 111 : LayoutBox(node) | 107 : LayoutBox(node) |
| 112 , m_hasMarginBeforeQuirk(false) | 108 , m_hasMarginBeforeQuirk(false) |
| 113 , m_hasMarginAfterQuirk(false) | 109 , m_hasMarginAfterQuirk(false) |
| 114 , m_beingDestroyed(false) | 110 , m_beingDestroyed(false) |
| 115 , m_hasMarkupTruncation(false) | 111 , m_hasMarkupTruncation(false) |
| 116 , m_widthAvailableToChildrenChanged(false) | 112 , m_widthAvailableToChildrenChanged(false) |
| 117 , m_heightAvailableToChildrenChanged(false) | 113 , m_heightAvailableToChildrenChanged(false) |
| 118 , m_isSelfCollapsing(false) | 114 , m_isSelfCollapsing(false) |
| 119 , m_descendantsWithFloatsMarkedForLayout(false) | 115 , m_descendantsWithFloatsMarkedForLayout(false) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 childBox->remove(); | 181 childBox->remove(); |
| 186 } | 182 } |
| 187 } | 183 } |
| 188 } else if (parent()) { | 184 } else if (parent()) { |
| 189 parent()->dirtyLinesFromChangedChild(this); | 185 parent()->dirtyLinesFromChangedChild(this); |
| 190 } | 186 } |
| 191 } | 187 } |
| 192 | 188 |
| 193 m_lineBoxes.deleteLineBoxes(); | 189 m_lineBoxes.deleteLineBoxes(); |
| 194 | 190 |
| 195 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) | |
| 196 gDelayedUpdateScrollInfoSet->remove(this); | |
| 197 | |
| 198 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 191 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
| 199 textAutosizer->destroy(this); | 192 textAutosizer->destroy(this); |
| 200 | 193 |
| 201 LayoutBox::willBeDestroyed(); | 194 LayoutBox::willBeDestroyed(); |
| 202 } | 195 } |
| 203 | 196 |
| 204 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) | 197 void LayoutBlock::styleWillChange(StyleDifference diff, const ComputedStyle& new
Style) |
| 205 { | 198 { |
| 206 const ComputedStyle* oldStyle = style(); | 199 const ComputedStyle* oldStyle = style(); |
| 207 | 200 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 return; | 608 return; |
| 616 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva
lidationReason::ChildAnonymousBlockChanged); | 609 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva
lidationReason::ChildAnonymousBlockChanged); |
| 617 | 610 |
| 618 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer()); | 611 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer()); |
| 619 parent->setChildrenInline(child->childrenInline()); | 612 parent->setChildrenInline(child->childrenInline()); |
| 620 | 613 |
| 621 parent->children()->removeChildNode(parent, child, child->hasLayer()); | 614 parent->children()->removeChildNode(parent, child, child->hasLayer()); |
| 622 child->destroy(); | 615 child->destroy(); |
| 623 } | 616 } |
| 624 | 617 |
| 625 void LayoutBlock::startDelayUpdateScrollInfo() | |
| 626 { | |
| 627 if (gDelayUpdateScrollInfo == 0) { | |
| 628 ASSERT(!gDelayedUpdateScrollInfoSet); | |
| 629 gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet; | |
| 630 } | |
| 631 ASSERT(gDelayedUpdateScrollInfoSet); | |
| 632 ++gDelayUpdateScrollInfo; | |
| 633 } | |
| 634 | |
| 635 bool LayoutBlock::finishDelayUpdateScrollInfo(SubtreeLayoutScope* layoutScope, S
crollPositionMap* scrollMap) | |
| 636 { | |
| 637 bool childrenMarkedForRelayout = false; | |
| 638 | |
| 639 --gDelayUpdateScrollInfo; | |
| 640 ASSERT(gDelayUpdateScrollInfo >= 0); | |
| 641 if (gDelayUpdateScrollInfo == 0) { | |
| 642 ASSERT(gDelayedUpdateScrollInfoSet); | |
| 643 | |
| 644 OwnPtr<DelayedUpdateScrollInfoSet> infoSet(adoptPtr(gDelayedUpdateScroll
InfoSet)); | |
| 645 gDelayedUpdateScrollInfoSet = nullptr; | |
| 646 | |
| 647 for (auto* block : *infoSet) { | |
| 648 if (block->hasOverflowClip()) { | |
| 649 PaintLayerScrollableArea* scrollableArea = block->layer()->getSc
rollableArea(); | |
| 650 if (scrollMap) | |
| 651 scrollMap->add(scrollableArea, scrollableArea->scrollPositio
nDouble()); | |
| 652 childrenMarkedForRelayout |= scrollableArea->updateAfterLayout(l
ayoutScope); | |
| 653 } | |
| 654 } | |
| 655 } | |
| 656 return childrenMarkedForRelayout; | |
| 657 } | |
| 658 | |
| 659 void LayoutBlock::updateAfterLayout() | 618 void LayoutBlock::updateAfterLayout() |
| 660 { | 619 { |
| 661 invalidateStickyConstraints(); | 620 invalidateStickyConstraints(); |
| 662 | 621 |
| 663 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 622 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| 664 // we overflow or not. | 623 // we overflow or not. |
| 665 if (hasOverflowClip()) { | 624 if (hasOverflowClip()) |
| 666 if (style()->isFlippedBlocksWritingMode()) { | 625 layer()->getScrollableArea()->updateAfterLayout(); |
| 667 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937 | |
| 668 // Workaround for now. We cannot delay the scroll info for overflow | |
| 669 // for items with opposite writing directions, as the contents needs | |
| 670 // to overflow in that direction | |
| 671 layer()->getScrollableArea()->updateAfterLayout(); | |
| 672 return; | |
| 673 } | |
| 674 | |
| 675 if (gDelayUpdateScrollInfo) | |
| 676 gDelayedUpdateScrollInfoSet->add(this); | |
| 677 else | |
| 678 layer()->getScrollableArea()->updateAfterLayout(); | |
| 679 } | |
| 680 } | 626 } |
| 681 | 627 |
| 682 void LayoutBlock::layout() | 628 void LayoutBlock::layout() |
| 683 { | 629 { |
| 684 LayoutAnalyzer::Scope analyzer(*this); | 630 LayoutAnalyzer::Scope analyzer(*this); |
| 685 | 631 |
| 686 bool needsScrollAnchoring = RuntimeEnabledFeatures::scrollAnchoringEnabled()
&& hasOverflowClip(); | 632 bool needsScrollAnchoring = RuntimeEnabledFeatures::scrollAnchoringEnabled()
&& hasOverflowClip(); |
| 687 if (needsScrollAnchoring) | 633 if (needsScrollAnchoring) |
| 688 getScrollableArea()->scrollAnchor().save(); | 634 getScrollableArea()->scrollAnchor().save(); |
| 689 | 635 |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 2134 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
| 2189 LayoutBox* currBox = *it; | 2135 LayoutBox* currBox = *it; |
| 2190 ASSERT(!currBox->needsLayout()); | 2136 ASSERT(!currBox->needsLayout()); |
| 2191 } | 2137 } |
| 2192 } | 2138 } |
| 2193 } | 2139 } |
| 2194 | 2140 |
| 2195 #endif | 2141 #endif |
| 2196 | 2142 |
| 2197 } // namespace blink | 2143 } // namespace blink |
| OLD | NEW |