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

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

Issue 2816873002: Update PaintLayer size during layout, not after.
Patch Set: s/UpdateICBAndViewportSize/ResizeFrameView/ Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index de41d0c41ab71484546034640bccb6b362461183..b01234185f8299e4612b0955d5253e096afce680 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -786,17 +786,13 @@ void PaintLayer::Update3DTransformedDescendantStatus() {
}
void PaintLayer::UpdateLayerPosition() {
+ // LayoutBoxes will call UpdateSizeAndScrollingAfterLayout() from
+ // LayoutBox::UpdateAfterLayout, but LayoutInlines will still need to update
+ // their size.
+ if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline())
+ UpdateSizeAndScrollingAfterLayout();
LayoutPoint local_point;
-
- bool did_resize = false;
- if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline()) {
- LayoutInline& inline_flow = ToLayoutInline(GetLayoutObject());
- IntRect line_box = EnclosingIntRect(inline_flow.LinesBoundingBox());
- size_ = line_box.Size();
- } else if (LayoutBox* box = GetLayoutBox()) {
- IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location());
- did_resize = new_size != size_;
- size_ = new_size;
+ if (LayoutBox* box = GetLayoutBox()) {
local_point.MoveBy(box->PhysicalLocation());
}
@@ -847,17 +843,32 @@ void PaintLayer::UpdateLayerPosition() {
location_ = local_point;
- if (scrollable_area_ && did_resize)
- scrollable_area_->VisibleSizeChanged();
-
#if DCHECK_IS_ON()
needs_position_update_ = false;
#endif
}
-void PaintLayer::UpdateScrollingAfterLayout() {
- if (GetLayoutObject().HasOverflowClip())
+void PaintLayer::UpdateSizeAndScrollingAfterLayout() {
+ bool did_resize = false;
+ if (IsRootLayer() && RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ const IntSize new_size = GetLayoutObject().GetDocument().View()->Size();
+ did_resize = new_size != size_;
+ size_ = new_size;
+ } else if (GetLayoutObject().IsInline() &&
+ GetLayoutObject().IsLayoutInline()) {
+ LayoutInline& inline_flow = ToLayoutInline(GetLayoutObject());
+ IntRect line_box = EnclosingIntRect(inline_flow.LinesBoundingBox());
+ size_ = line_box.Size();
+ } else if (LayoutBox* box = GetLayoutBox()) {
+ IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location());
+ did_resize = new_size != size_;
+ size_ = new_size;
+ }
+ if (GetLayoutObject().HasOverflowClip()) {
scrollable_area_->UpdateAfterLayout();
+ if (did_resize)
+ scrollable_area_->VisibleSizeChanged();
+ }
}
TransformationMatrix PaintLayer::PerspectiveTransform() const {
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698