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

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

Issue 2854213004: Update layer size from LayoutBox::UpdateAfterLayout (Closed)
Patch Set: rebase 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
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 fd7f93f30278fd19d38fb821af9dc56f14507c48..58deaeb2424f8cdfd172d1263c8c46e8d753839e 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
bokan 2017/05/12 15:58:18 This may be a naive question as I'm a layout-outsi
szager1 2017/05/12 19:12:13 LayoutInline's don't run their own layout; instead
+ // 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,37 @@ 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() {
+ 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();
skobes 2017/05/16 22:22:22 Why is did_resize not set in this branch?
szager 2017/05/16 23:55:46 This preserves the existing logic. did_resize is
+ } else if (LayoutBox* box = GetLayoutBox()) {
+ IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location());
+ did_resize = new_size != size_;
+ size_ = new_size;
+ }
+ return did_resize;
+}
+
+void PaintLayer::UpdateSizeAndScrollingAfterLayout() {
+ bool did_resize = UpdateSize();
+ if (GetLayoutObject().HasOverflowClip()) {
scrollable_area_->UpdateAfterLayout();
+ if (did_resize)
+ scrollable_area_->VisibleSizeChanged();
bokan 2017/05/12 15:58:18 Any reason not to put this in UpdateSize().
szager1 2017/05/12 19:12:13 UpdateSize is also called from LayoutBoxModelObjec
+ }
}
TransformationMatrix PaintLayer::PerspectiveTransform() const {

Powered by Google App Engine
This is Rietveld 408576698