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

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

Issue 2854213004: Update layer size from LayoutBox::UpdateAfterLayout (Closed)
Patch Set: Fix placement of inline comment Created 3 years, 7 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 | « third_party/WebKit/Source/core/paint/PaintLayer.h ('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/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index d32a33b2099e1afdf3d1bd22c7f86039d7e7428b..334ab82ab3910a692d6d4a4ae3aabc1124a526c2 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -788,17 +788,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());
}
@@ -849,17 +845,33 @@ 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())
+bool PaintLayer::UpdateSize() {
+ IntSize old_size = size_;
+ if (IsRootLayer() && RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ size_ = GetLayoutObject().GetDocument().View()->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()) {
+ size_ = PixelSnappedIntSize(box->Size(), box->Location());
+ }
+ return old_size != size_;
+}
+
+void PaintLayer::UpdateSizeAndScrollingAfterLayout() {
+ bool did_resize = UpdateSize();
+ 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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698