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

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

Issue 2425183003: Refactor FrameView property updates to work like LayouObject updates (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 0562e435d4508f7484a7187c7de6c0e47041ef81..83e457bc618e2a53ad54fdb2489505264147494c 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -70,7 +70,7 @@ PaintPropertyTreeBuilder::setupInitialContext() {
return context;
}
-void createOrUpdateFrameViewPreTranslation(
+const TransformPaintPropertyNode* createOrUpdateFrameViewPreTranslation(
FrameView& frameView,
PassRefPtr<const TransformPaintPropertyNode> parent,
const TransformationMatrix& matrix,
@@ -82,9 +82,10 @@ void createOrUpdateFrameViewPreTranslation(
else
frameView.setPreTranslation(
TransformPaintPropertyNode::create(std::move(parent), matrix, origin));
+ return frameView.preTranslation();
}
-void createOrUpdateFrameViewContentClip(
+const ClipPaintPropertyNode* createOrUpdateFrameViewContentClip(
FrameView& frameView,
PassRefPtr<const ClipPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
@@ -96,9 +97,10 @@ void createOrUpdateFrameViewContentClip(
else
frameView.setContentClip(ClipPaintPropertyNode::create(
std::move(parent), std::move(localTransformSpace), clipRect));
+ return frameView.contentClip();
}
-void createOrUpdateFrameViewScrollTranslation(
+const TransformPaintPropertyNode* createOrUpdateFrameViewScrollTranslation(
FrameView& frameView,
PassRefPtr<const TransformPaintPropertyNode> parent,
const TransformationMatrix& matrix,
@@ -110,9 +112,10 @@ void createOrUpdateFrameViewScrollTranslation(
else
frameView.setScrollTranslation(
TransformPaintPropertyNode::create(std::move(parent), matrix, origin));
+ return frameView.scrollTranslation();
}
-void createOrUpdateFrameViewScroll(
+ScrollPaintPropertyNode* createOrUpdateFrameViewScroll(
FrameView& frameView,
PassRefPtr<ScrollPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> scrollOffset,
@@ -129,6 +132,7 @@ void createOrUpdateFrameViewScroll(
frameView.setScroll(ScrollPaintPropertyNode::create(
std::move(parent), std::move(scrollOffset), clip, bounds,
userScrollableHorizontal, userScrollableVertical));
+ return frameView.scroll();
}
void PaintPropertyTreeBuilder::buildTreeNodes(
@@ -162,19 +166,23 @@ void PaintPropertyTreeBuilder::buildTreeNodes(
TransformationMatrix frameTranslate;
frameTranslate.translate(frameView.x() + context.current.paintOffset.x(),
frameView.y() + context.current.paintOffset.y());
- createOrUpdateFrameViewPreTranslation(frameView, context.current.transform,
- frameTranslate, FloatPoint3D());
+ context.current.transform = createOrUpdateFrameViewPreTranslation(
+ frameView, context.current.transform, frameTranslate, FloatPoint3D());
FloatRoundedRect contentClip(
IntRect(IntPoint(), frameView.visibleContentSize()));
- createOrUpdateFrameViewContentClip(frameView, context.current.clip,
- frameView.preTranslation(), contentClip);
+ context.current.clip = createOrUpdateFrameViewContentClip(
+ frameView, context.current.clip, frameView.preTranslation(), contentClip);
+
+ // Record the fixed properties before any scrolling occurs.
+ const auto* fixedTransformNode = context.current.transform;
+ auto* fixedScrollNode = context.current.scroll;
ScrollOffset scrollOffset = frameView.scrollOffset();
if (frameView.isScrollable() || !scrollOffset.isZero()) {
TransformationMatrix frameScroll;
frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
- createOrUpdateFrameViewScrollTranslation(
+ context.current.transform = createOrUpdateFrameViewScrollTranslation(
frameView, frameView.preTranslation(), frameScroll, FloatPoint3D());
IntSize scrollClip = frameView.visibleContentSize();
@@ -183,11 +191,12 @@ void PaintPropertyTreeBuilder::buildTreeNodes(
frameView.userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical =
frameView.userInputScrollable(VerticalScrollbar);
- createOrUpdateFrameViewScroll(frameView, context.current.scroll,
- frameView.scrollTranslation(), scrollClip,
- scrollBounds, userScrollableHorizontal,
- userScrollableVertical);
+ context.current.scroll = createOrUpdateFrameViewScroll(
+ frameView, context.current.scroll, frameView.scrollTranslation(),
+ scrollClip, scrollBounds, userScrollableHorizontal,
+ userScrollableVertical);
} else {
+ // Ensure pre-existing properties are cleared when there is no scrolling.
frameView.setScrollTranslation(nullptr);
frameView.setScroll(nullptr);
}
@@ -195,21 +204,14 @@ void PaintPropertyTreeBuilder::buildTreeNodes(
// Initialize the context for current, absolute and fixed position cases.
// They are the same, except that scroll translation does not apply to
// fixed position descendants.
- ScrollPaintPropertyNode* initialScroll = context.current.scroll;
- context.current.transform = frameView.scrollTranslation()
- ? frameView.scrollTranslation()
- : frameView.preTranslation();
context.current.paintOffset = LayoutPoint();
- context.current.clip = frameView.contentClip();
- context.current.scroll =
- frameView.scroll() ? frameView.scroll() : initialScroll;
context.current.renderingContextID = 0;
context.current.shouldFlattenInheritedTransform = true;
context.absolutePosition = context.current;
context.containerForAbsolutePosition = nullptr;
context.fixedPosition = context.current;
- context.fixedPosition.transform = frameView.preTranslation();
- context.fixedPosition.scroll = initialScroll;
+ context.fixedPosition.transform = fixedTransformNode;
+ context.fixedPosition.scroll = fixedScrollNode;
std::unique_ptr<PropertyTreeState> contentsState(
new PropertyTreeState(context.current.transform, context.current.clip,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698