OLD | NEW |
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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 child_has3d = true; | 779 child_has3d = true; |
780 | 780 |
781 if (child_has3d) { | 781 if (child_has3d) { |
782 has3d_transformed_descendant_ = true; | 782 has3d_transformed_descendant_ = true; |
783 break; | 783 break; |
784 } | 784 } |
785 } | 785 } |
786 } | 786 } |
787 | 787 |
788 void PaintLayer::UpdateLayerPosition() { | 788 void PaintLayer::UpdateLayerPosition() { |
| 789 // LayoutBoxes will call UpdateSizeAndScrollingAfterLayout() from |
| 790 // LayoutBox::UpdateAfterLayout, but LayoutInlines will still need to update |
| 791 // their size. |
| 792 if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline()) |
| 793 UpdateSizeAndScrollingAfterLayout(); |
789 LayoutPoint local_point; | 794 LayoutPoint local_point; |
790 | 795 if (LayoutBox* box = GetLayoutBox()) { |
791 bool did_resize = false; | |
792 if (GetLayoutObject().IsInline() && GetLayoutObject().IsLayoutInline()) { | |
793 LayoutInline& inline_flow = ToLayoutInline(GetLayoutObject()); | |
794 IntRect line_box = EnclosingIntRect(inline_flow.LinesBoundingBox()); | |
795 size_ = line_box.Size(); | |
796 } else if (LayoutBox* box = GetLayoutBox()) { | |
797 IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location()); | |
798 did_resize = new_size != size_; | |
799 size_ = new_size; | |
800 local_point.MoveBy(box->PhysicalLocation()); | 796 local_point.MoveBy(box->PhysicalLocation()); |
801 } | 797 } |
802 | 798 |
803 if (!GetLayoutObject().IsOutOfFlowPositioned() && | 799 if (!GetLayoutObject().IsOutOfFlowPositioned() && |
804 !GetLayoutObject().IsColumnSpanAll()) { | 800 !GetLayoutObject().IsColumnSpanAll()) { |
805 // We must adjust our position by walking up the layout tree looking for the | 801 // We must adjust our position by walking up the layout tree looking for the |
806 // nearest enclosing object with a layer. | 802 // nearest enclosing object with a layer. |
807 LayoutObject* curr = GetLayoutObject().Container(); | 803 LayoutObject* curr = GetLayoutObject().Container(); |
808 while (curr && !curr->HasLayer()) { | 804 while (curr && !curr->HasLayer()) { |
809 if (curr->IsBox() && !curr->IsTableRow()) { | 805 if (curr->IsBox() && !curr->IsTableRow()) { |
(...skipping 30 matching lines...) Expand all Loading... |
840 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition(); | 836 LayoutSize new_offset = GetLayoutObject().OffsetForInFlowPosition(); |
841 if (rare_data_ || !new_offset.IsZero()) | 837 if (rare_data_ || !new_offset.IsZero()) |
842 EnsureRareData().offset_for_in_flow_position = new_offset; | 838 EnsureRareData().offset_for_in_flow_position = new_offset; |
843 local_point.Move(new_offset); | 839 local_point.Move(new_offset); |
844 } else if (rare_data_) { | 840 } else if (rare_data_) { |
845 rare_data_->offset_for_in_flow_position = LayoutSize(); | 841 rare_data_->offset_for_in_flow_position = LayoutSize(); |
846 } | 842 } |
847 | 843 |
848 location_ = local_point; | 844 location_ = local_point; |
849 | 845 |
850 if (scrollable_area_ && did_resize) | |
851 scrollable_area_->VisibleSizeChanged(); | |
852 | |
853 #if DCHECK_IS_ON() | 846 #if DCHECK_IS_ON() |
854 needs_position_update_ = false; | 847 needs_position_update_ = false; |
855 #endif | 848 #endif |
856 } | 849 } |
857 | 850 |
| 851 void PaintLayer::UpdateSizeAndScrollingAfterLayout() { |
| 852 bool did_resize = false; |
| 853 if (IsRootLayer() && RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 854 const IntSize new_size = GetLayoutObject().GetDocument().View()->Size(); |
| 855 did_resize = new_size != size_; |
| 856 size_ = new_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 IntSize new_size = PixelSnappedIntSize(box->Size(), box->Location()); |
| 864 did_resize = new_size != size_; |
| 865 size_ = new_size; |
| 866 } |
| 867 if (GetLayoutObject().HasOverflowClip()) { |
| 868 scrollable_area_->UpdateAfterLayout(); |
| 869 if (did_resize) |
| 870 scrollable_area_->VisibleSizeChanged(); |
| 871 } |
| 872 } |
| 873 |
858 TransformationMatrix PaintLayer::PerspectiveTransform() const { | 874 TransformationMatrix PaintLayer::PerspectiveTransform() const { |
859 if (!GetLayoutObject().HasTransformRelatedProperty()) | 875 if (!GetLayoutObject().HasTransformRelatedProperty()) |
860 return TransformationMatrix(); | 876 return TransformationMatrix(); |
861 | 877 |
862 const ComputedStyle& style = GetLayoutObject().StyleRef(); | 878 const ComputedStyle& style = GetLayoutObject().StyleRef(); |
863 if (!style.HasPerspective()) | 879 if (!style.HasPerspective()) |
864 return TransformationMatrix(); | 880 return TransformationMatrix(); |
865 | 881 |
866 TransformationMatrix t; | 882 TransformationMatrix t; |
867 t.ApplyPerspective(style.Perspective()); | 883 t.ApplyPerspective(style.Perspective()); |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 } | 3332 } |
3317 | 3333 |
3318 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3334 void showLayerTree(const blink::LayoutObject* layoutObject) { |
3319 if (!layoutObject) { | 3335 if (!layoutObject) { |
3320 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3336 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
3321 return; | 3337 return; |
3322 } | 3338 } |
3323 showLayerTree(layoutObject->EnclosingLayer()); | 3339 showLayerTree(layoutObject->EnclosingLayer()); |
3324 } | 3340 } |
3325 #endif | 3341 #endif |
OLD | NEW |