Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1308273010: Adapt and reland old position sticky implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove redundant invalidation in LayoutBlock::tryLayoutDoingPositionedMovementOnly Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n eedsLayout() && borderOrPaddingLogicalDimensionChanged(*oldStyle, newStyle, Logi calWidth); 358 m_widthAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && n eedsLayout() && borderOrPaddingLogicalDimensionChanged(*oldStyle, newStyle, Logi calWidth);
359 m_heightAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && needsLayout() && borderOrPaddingLogicalDimensionChanged(*oldStyle, newStyle, Log icalHeight); 359 m_heightAvailableToChildrenChanged |= oldStyle && diff.needsFullLayout() && needsLayout() && borderOrPaddingLogicalDimensionChanged(*oldStyle, newStyle, Log icalHeight);
360 } 360 }
361 361
362 void LayoutBlock::updateFromStyle() 362 void LayoutBlock::updateFromStyle()
363 { 363 {
364 LayoutBox::updateFromStyle(); 364 LayoutBox::updateFromStyle();
365 365
366 bool shouldClipOverflow = !styleRef().isOverflowVisible() && allowsOverflowC lip(); 366 bool shouldClipOverflow = !styleRef().isOverflowVisible() && allowsOverflowC lip();
367 if (shouldClipOverflow != hasOverflowClip()) { 367 if (shouldClipOverflow != hasOverflowClip()) {
368 if (!shouldClipOverflow)
369 getScrollableArea()->invalidateAllStickyConstraints();
370
368 // FIXME: This shouldn't be required if we tracked the visual overflow 371 // FIXME: This shouldn't be required if we tracked the visual overflow
369 // generated by positioned children or self painting layers. crbug.com/3 45403 372 // generated by positioned children or self painting layers. crbug.com/3 45403
370 for (LayoutObject* child = firstChild(); child; child = child->nextSibli ng()) 373 for (LayoutObject* child = firstChild(); child; child = child->nextSibli ng())
371 child->setMayNeedPaintInvalidation(); 374 child->setMayNeedPaintInvalidation();
372 } 375 }
373 setHasOverflowClip(shouldClipOverflow); 376 setHasOverflowClip(shouldClipOverflow);
374 } 377 }
375 378
376 bool LayoutBlock::allowsOverflowClip() const 379 bool LayoutBlock::allowsOverflowClip() const
377 { 380 {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 876
874 for (auto* block : *infoSet) { 877 for (auto* block : *infoSet) {
875 if (block->hasOverflowClip()) { 878 if (block->hasOverflowClip()) {
876 childrenMarkedForRelayout |= block->layer()->getScrollableArea() ->updateAfterLayout(layoutScope); 879 childrenMarkedForRelayout |= block->layer()->getScrollableArea() ->updateAfterLayout(layoutScope);
877 } 880 }
878 } 881 }
879 } 882 }
880 return childrenMarkedForRelayout; 883 return childrenMarkedForRelayout;
881 } 884 }
882 885
883 void LayoutBlock::updateScrollInfoAfterLayout() 886 void LayoutBlock::updateAfterLayout()
884 { 887 {
888 invalidateStickyConstraints();
889
885 if (hasOverflowClip()) { 890 if (hasOverflowClip()) {
886 if (style()->isFlippedBlocksWritingMode()) { 891 if (style()->isFlippedBlocksWritingMode()) {
887 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937 892 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937
888 // Workaround for now. We cannot delay the scroll info for overflow 893 // Workaround for now. We cannot delay the scroll info for overflow
889 // for items with opposite writing directions, as the contents needs 894 // for items with opposite writing directions, as the contents needs
890 // to overflow in that direction 895 // to overflow in that direction
891 layer()->getScrollableArea()->updateAfterLayout(); 896 layer()->getScrollableArea()->updateAfterLayout();
892 return; 897 return;
893 } 898 }
894 899
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and 1123 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and
1119 // lowestPosition on every relayout so it's not a regression. 1124 // lowestPosition on every relayout so it's not a regression.
1120 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during 1125 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during
1121 // simplifiedLayout, we cache the value in m_overflow. 1126 // simplifiedLayout, we cache the value in m_overflow.
1122 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutC lientAfterEdge() : clientLogicalBottom(); 1127 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutC lientAfterEdge() : clientLogicalBottom();
1123 computeOverflow(oldClientAfterEdge, true); 1128 computeOverflow(oldClientAfterEdge, true);
1124 } 1129 }
1125 1130
1126 updateLayerTransformAfterLayout(); 1131 updateLayerTransformAfterLayout();
1127 1132
1128 updateScrollInfoAfterLayout(); 1133 updateAfterLayout();
1129 1134
1130 clearNeedsLayout(); 1135 clearNeedsLayout();
1131 1136
1132 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer()) 1137 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer())
1133 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayou t); 1138 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayou t);
1134 1139
1135 return true; 1140 return true;
1136 } 1141 }
1137 1142
1138 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded(LayoutObject* child, SubtreeLayoutScope& layoutScope) 1143 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded(LayoutObject* child, SubtreeLayoutScope& layoutScope)
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2872 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2868 { 2873 {
2869 showLayoutObject(); 2874 showLayoutObject();
2870 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2875 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2871 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2876 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2872 } 2877 }
2873 2878
2874 #endif 2879 #endif
2875 2880
2876 } // namespace blink 2881 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698