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

Unified Diff: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp

Issue 2561693002: Move sticky position constraints update to the pre-paint tree walk. (Closed)
Patch Set: none Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
index f122464d2b1cb1e038e3cd68bd66596feaefbf86..1b548b8c4bf78a2167536801ab7c2325427869cf 100644
--- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
+++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -10,18 +10,27 @@
#include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
#include "core/layout/LayoutPart.h"
#include "core/layout/LayoutView.h"
+#include "core/paint/PaintLayer.h"
namespace blink {
struct PrePaintTreeWalkContext {
- PrePaintTreeWalkContext() : paintInvalidatorContext(treeBuilderContext) {}
+ PrePaintTreeWalkContext()
+ : paintInvalidatorContext(treeBuilderContext),
+ ancestorOverflowPaintLayer(nullptr) {}
PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parentContext)
: treeBuilderContext(parentContext.treeBuilderContext),
paintInvalidatorContext(treeBuilderContext,
- parentContext.paintInvalidatorContext) {}
+ parentContext.paintInvalidatorContext),
+ ancestorOverflowPaintLayer(parentContext.ancestorOverflowPaintLayer) {}
PaintPropertyTreeBuilderContext treeBuilderContext;
PaintInvalidatorContext paintInvalidatorContext;
+
+ // The ancestor in the PaintLayer tree which has overflow clip, or
pdr. 2016/12/09 00:04:10 The PrePaintTreeWalk is shared by paint invalidati
chrishtr 2016/12/09 01:22:54 Are you suggesting making an AuxiliaryObjectProper
+ // is the root layer. Note that it is tree ancestor, not containing
+ // block or stacking ancestor.
+ PaintLayer* ancestorOverflowPaintLayer;
};
void PrePaintTreeWalk::walk(FrameView& rootFrame) {
@@ -62,6 +71,36 @@ bool PrePaintTreeWalk::walk(FrameView& frameView,
return descendantsFullyUpdated;
}
+static void updateAuxiliaryObjectProperties(
+ const LayoutObject& object,
+ PrePaintTreeWalkContext& localContext) {
+ PaintLayer* paintLayer = nullptr;
+
+ if (object.isBoxModelObject() && object.hasLayer())
+ paintLayer = object.enclosingLayer();
+
+ if (paintLayer) {
+ paintLayer->updateAncestorOverflowLayer(
+ localContext.ancestorOverflowPaintLayer);
+ }
+
+ if (object.styleRef().position() == StickyPosition && paintLayer) {
+ paintLayer->layoutObject()->updateStickyPositionConstraints();
+
+ // Sticky position constraints and ancestor overflow scroller affect
+ // the sticky layer position, so we need to update it again here.
+ // TODO(flackr): This should be refactored in the future to be clearer
+ // (i.e. update layer position and ancestor inputs updates in the
+ // same walk)
+ paintLayer->updateLayerPosition();
+ }
+
+ if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) {
+ DCHECK(paintLayer);
+ localContext.ancestorOverflowPaintLayer = paintLayer;
+ }
+}
+
bool PrePaintTreeWalk::walk(const LayoutObject& object,
const PrePaintTreeWalkContext& context) {
PrePaintTreeWalkContext localContext(context);
@@ -118,6 +157,8 @@ bool PrePaintTreeWalk::walk(const LayoutObject& object,
m_propertyTreeBuilder.updatePropertiesForChildren(
object, localContext.treeBuilderContext);
+ updateAuxiliaryObjectProperties(object, localContext);
+
bool descendantsFullyUpdated = true;
for (const LayoutObject* child = object.slowFirstChild(); child;
child = child->nextSibling()) {
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698