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

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: Make sticky vertical ref tests expectations not dependent on font size. Created 4 years, 8 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
890 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
891 // we overflow or not.
885 if (hasOverflowClip()) { 892 if (hasOverflowClip()) {
886 if (style()->isFlippedBlocksWritingMode()) { 893 if (style()->isFlippedBlocksWritingMode()) {
887 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937 894 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937
888 // Workaround for now. We cannot delay the scroll info for overflow 895 // Workaround for now. We cannot delay the scroll info for overflow
889 // for items with opposite writing directions, as the contents needs 896 // for items with opposite writing directions, as the contents needs
890 // to overflow in that direction 897 // to overflow in that direction
891 layer()->getScrollableArea()->updateAfterLayout(); 898 layer()->getScrollableArea()->updateAfterLayout();
892 return; 899 return;
893 } 900 }
894 901
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and 1124 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and
1118 // lowestPosition on every relayout so it's not a regression. 1125 // lowestPosition on every relayout so it's not a regression.
1119 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during 1126 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during
1120 // simplifiedLayout, we cache the value in m_overflow. 1127 // simplifiedLayout, we cache the value in m_overflow.
1121 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutC lientAfterEdge() : clientLogicalBottom(); 1128 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutC lientAfterEdge() : clientLogicalBottom();
1122 computeOverflow(oldClientAfterEdge, true); 1129 computeOverflow(oldClientAfterEdge, true);
1123 } 1130 }
1124 1131
1125 updateLayerTransformAfterLayout(); 1132 updateLayerTransformAfterLayout();
1126 1133
1127 updateScrollInfoAfterLayout(); 1134 updateAfterLayout();
1128 1135
1129 clearNeedsLayout(); 1136 clearNeedsLayout();
1130 1137
1131 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer()) 1138 if (LayoutAnalyzer* analyzer = frameView()->layoutAnalyzer())
1132 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayou t); 1139 analyzer->increment(LayoutAnalyzer::LayoutObjectsThatNeedSimplifiedLayou t);
1133 1140
1134 return true; 1141 return true;
1135 } 1142 }
1136 1143
1137 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded(LayoutObject* child, SubtreeLayoutScope& layoutScope) 1144 void LayoutBlock::markFixedPositionObjectForLayoutIfNeeded(LayoutObject* child, SubtreeLayoutScope& layoutScope)
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2873 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2867 { 2874 {
2868 showLayoutObject(); 2875 showLayoutObject();
2869 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2876 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2870 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2877 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2871 } 2878 }
2872 2879
2873 #endif 2880 #endif
2874 2881
2875 } // namespace blink 2882 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698