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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 child_has3d = true; 781 child_has3d = true;
782 782
783 if (child_has3d) { 783 if (child_has3d) {
784 has3d_transformed_descendant_ = true; 784 has3d_transformed_descendant_ = true;
785 break; 785 break;
786 } 786 }
787 } 787 }
788 } 788 }
789 789
790 void PaintLayer::UpdateLayerPosition() { 790 void PaintLayer::UpdateLayerPosition() {
791 // LayoutBoxes will call UpdateSizeAndScrollingAfterLayout() from
792 // LayoutBox::UpdateAfterLayout, but LayoutInlines will still need to update
793 // their size.
794 if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline())
795 UpdateSizeAndScrollingAfterLayout();
791 LayoutPoint local_point; 796 LayoutPoint local_point;
792 797 if (LayoutBox* box = GetLayoutBox()) {
793 bool did_resize = false;
794 if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline()) {
795 LayoutInline& inline_flow = ToLayoutInline(GetLayoutObject());
796 IntRect line_box = EnclosingIntRect(inline_flow.LinesBoundingBox());
797 size_ = line_box.Size();
798 } else if (LayoutBox* box = GetLayoutBox()) {
799 IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location());
800 did_resize = new_size != size_;
801 size_ = new_size;
802 local_point.MoveBy(box->PhysicalLocation()); 798 local_point.MoveBy(box->PhysicalLocation());
803 } 799 }
804 800
805 if (!GetLayoutObject().IsOutOfFlowPositioned() && 801 if (!GetLayoutObject().IsOutOfFlowPositioned() &&
806 !GetLayoutObject().IsColumnSpanAll()) { 802 !GetLayoutObject().IsColumnSpanAll()) {
807 // We must adjust our position by walking up the layout tree looking for the 803 // We must adjust our position by walking up the layout tree looking for the
808 // nearest enclosing object with a layer. 804 // nearest enclosing object with a layer.
809 LayoutObject* curr = GetLayoutObject().Container(); 805 LayoutObject* curr = GetLayoutObject().Container();
810 while (curr && !curr->HasLayer()) { 806 while (curr && !curr->HasLayer()) {
811 if (curr->IsBox() && !curr->IsTableRow()) { 807 if (curr->IsBox() && !curr->IsTableRow()) {
(...skipping 30 matching lines...) Expand all
842 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition(); 838 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition();
843 if (rare_data_ || !new_offset.IsZero()) 839 if (rare_data_ || !new_offset.IsZero())
844 EnsureRareData().offset_for_in_flow_position = new_offset; 840 EnsureRareData().offset_for_in_flow_position = new_offset;
845 local_point.Move(new_offset); 841 local_point.Move(new_offset);
846 } else if (rare_data_) { 842 } else if (rare_data_) {
847 rare_data_->offset_for_in_flow_position = LayoutSize(); 843 rare_data_->offset_for_in_flow_position = LayoutSize();
848 } 844 }
849 845
850 location_ = local_point; 846 location_ = local_point;
851 847
852 if (scrollable_area_ && did_resize)
853 scrollable_area_->VisibleSizeChanged();
854
855 #if DCHECK_IS_ON() 848 #if DCHECK_IS_ON()
856 needs_position_update_ = false; 849 needs_position_update_ = false;
857 #endif 850 #endif
858 } 851 }
859 852
860 void PaintLayer::UpdateScrollingAfterLayout() { 853 bool PaintLayer::UpdateSize() {
861 if (GetLayoutObject().HasOverflowClip()) 854 IntSize old_size = size_;
855 if (IsRootLayer() && RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
856 size_ = GetLayoutObject().GetDocument().View()->Size();
857 } else if (GetLayoutObject().IsInline() &&
858 GetLayoutObject().IsLayoutInline()) {
859 LayoutInline& inline_flow = ToLayoutInline(GetLayoutObject());
860 IntRect line_box = EnclosingIntRect(inline_flow.LinesBoundingBox());
861 size_ = line_box.Size();
862 } else if (LayoutBox* box = GetLayoutBox()) {
863 size_ = PixelSnappedIntSize(box->Size(), box->Location());
864 }
865 return old_size != size_;
866 }
867
868 void PaintLayer::UpdateSizeAndScrollingAfterLayout() {
869 bool did_resize = UpdateSize();
870 if (GetLayoutObject().HasOverflowClip()) {
862 scrollable_area_->UpdateAfterLayout(); 871 scrollable_area_->UpdateAfterLayout();
872 if (did_resize)
873 scrollable_area_->VisibleSizeChanged();
874 }
863 } 875 }
864 876
865 TransformationMatrix PaintLayer::PerspectiveTransform() const { 877 TransformationMatrix PaintLayer::PerspectiveTransform() const {
866 if (!GetLayoutObject().HasTransformRelatedProperty()) 878 if (!GetLayoutObject().HasTransformRelatedProperty())
867 return TransformationMatrix(); 879 return TransformationMatrix();
868 880
869 const ComputedStyle& style = GetLayoutObject().StyleRef(); 881 const ComputedStyle& style = GetLayoutObject().StyleRef();
870 if (!style.HasPerspective()) 882 if (!style.HasPerspective())
871 return TransformationMatrix(); 883 return TransformationMatrix();
872 884
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 } 3340 }
3329 3341
3330 void showLayerTree(const blink::LayoutObject* layoutObject) { 3342 void showLayerTree(const blink::LayoutObject* layoutObject) {
3331 if (!layoutObject) { 3343 if (!layoutObject) {
3332 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3344 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3333 return; 3345 return;
3334 } 3346 }
3335 showLayerTree(layoutObject->EnclosingLayer()); 3347 showLayerTree(layoutObject->EnclosingLayer());
3336 } 3348 }
3337 #endif 3349 #endif
OLDNEW
« 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