| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintPropertyTreeBuilder.h" | 5 #include "core/paint/PaintPropertyTreeBuilder.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 roundedPaintOffset.y()), | 219 roundedPaintOffset.y()), |
| 220 FloatPoint3D(), context.current.shouldFlattenInheritedTransform, | 220 FloatPoint3D(), context.current.shouldFlattenInheritedTransform, |
| 221 context.current.renderingContextID); | 221 context.current.renderingContextID); |
| 222 } else { | 222 } else { |
| 223 if (auto* properties = object.getMutableForPainting().paintProperties()) | 223 if (auto* properties = object.getMutableForPainting().paintProperties()) |
| 224 properties->clearPaintOffsetTranslation(); | 224 properties->clearPaintOffsetTranslation(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 const auto* properties = object.paintProperties(); | 227 const auto* properties = object.paintProperties(); |
| 228 if (properties && properties->paintOffsetTranslation()) { | 228 if (properties && properties->paintOffsetTranslation()) { |
| 229 LOG(ERROR) << object.debugName() << " created paintOffsetTranslation"; |
| 229 context.current.transform = properties->paintOffsetTranslation(); | 230 context.current.transform = properties->paintOffsetTranslation(); |
| 230 context.current.paintOffset = fractionalPaintOffset; | 231 context.current.paintOffset = fractionalPaintOffset; |
| 231 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && | 232 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() && |
| 232 object.isLayoutView()) { | 233 object.isLayoutView()) { |
| 233 context.absolutePosition.transform = properties->paintOffsetTranslation(); | 234 context.absolutePosition.transform = properties->paintOffsetTranslation(); |
| 234 context.fixedPosition.transform = properties->paintOffsetTranslation(); | 235 context.fixedPosition.transform = properties->paintOffsetTranslation(); |
| 235 context.absolutePosition.paintOffset = LayoutPoint(); | 236 context.absolutePosition.paintOffset = LayoutPoint(); |
| 236 context.fixedPosition.paintOffset = LayoutPoint(); | 237 context.fixedPosition.paintOffset = LayoutPoint(); |
| 237 } | 238 } |
| 238 } | 239 } |
| 240 |
| 241 LOG(ERROR) << object.debugName() |
| 242 << " paintOffset:" << context.current.paintOffset.toString(); |
| 239 } | 243 } |
| 240 | 244 |
| 241 static FloatPoint3D transformOrigin(const LayoutBox& box) { | 245 static FloatPoint3D transformOrigin(const LayoutBox& box) { |
| 242 const ComputedStyle& style = box.styleRef(); | 246 const ComputedStyle& style = box.styleRef(); |
| 243 FloatSize borderBoxSize(box.size()); | 247 FloatSize borderBoxSize(box.size()); |
| 244 return FloatPoint3D( | 248 return FloatPoint3D( |
| 245 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), | 249 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), |
| 246 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), | 250 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), |
| 247 style.transformOriginZ()); | 251 style.transformOriginZ()); |
| 248 } | 252 } |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 context.current.shouldFlattenInheritedTransform = false; | 663 context.current.shouldFlattenInheritedTransform = false; |
| 660 } | 664 } |
| 661 } | 665 } |
| 662 | 666 |
| 663 void PaintPropertyTreeBuilder::updateOutOfFlowContext( | 667 void PaintPropertyTreeBuilder::updateOutOfFlowContext( |
| 664 const LayoutObject& object, | 668 const LayoutObject& object, |
| 665 PaintPropertyTreeBuilderContext& context) { | 669 PaintPropertyTreeBuilderContext& context) { |
| 666 if (object.canContainAbsolutePositionObjects()) { | 670 if (object.canContainAbsolutePositionObjects()) { |
| 667 context.absolutePosition = context.current; | 671 context.absolutePosition = context.current; |
| 668 context.containerForAbsolutePosition = &object; | 672 context.containerForAbsolutePosition = &object; |
| 673 LOG(ERROR) << object.debugName() << " canContainAbsolute: paintOffset=" |
| 674 << context.absolutePosition.paintOffset.toString(); |
| 669 } | 675 } |
| 670 | 676 |
| 671 if (object.isLayoutView()) { | 677 if (object.isLayoutView()) { |
| 672 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 678 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 673 const auto* initialFixedTransform = context.fixedPosition.transform; | 679 const auto* initialFixedTransform = context.fixedPosition.transform; |
| 674 auto* initialFixedScroll = context.fixedPosition.scroll; | 680 auto* initialFixedScroll = context.fixedPosition.scroll; |
| 675 | 681 |
| 676 context.fixedPosition = context.current; | 682 context.fixedPosition = context.current; |
| 677 | 683 |
| 678 // Fixed position transform and scroll nodes should not be affected. | 684 // Fixed position transform and scroll nodes should not be affected. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // SVGForeignObject needs paint offset because its viewport offset is baked | 820 // SVGForeignObject needs paint offset because its viewport offset is baked |
| 815 // into its location(), while its localSVGTransform() doesn't contain the | 821 // into its location(), while its localSVGTransform() doesn't contain the |
| 816 // offset. | 822 // offset. |
| 817 if (boxModelObject.isBox() && | 823 if (boxModelObject.isBox() && |
| 818 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() || | 824 (!boxModelObject.isSVG() || boxModelObject.isSVGRoot() || |
| 819 boxModelObject.isSVGForeignObject())) { | 825 boxModelObject.isSVGForeignObject())) { |
| 820 // TODO(pdr): Several calls in this function walk back up the tree to | 826 // TODO(pdr): Several calls in this function walk back up the tree to |
| 821 // calculate containers (e.g., topLeftLocation, offsetForInFlowPosition*). | 827 // calculate containers (e.g., topLeftLocation, offsetForInFlowPosition*). |
| 822 // The containing block and other containers can be stored on | 828 // The containing block and other containers can be stored on |
| 823 // PaintPropertyTreeBuilderContext instead of recomputing them. | 829 // PaintPropertyTreeBuilderContext instead of recomputing them. |
| 830 LOG(ERROR) << object.debugName() << " before offset paintOffset=" |
| 831 << context.current.paintOffset.toString(); |
| 824 context.current.paintOffset.moveBy( | 832 context.current.paintOffset.moveBy( |
| 825 toLayoutBox(boxModelObject).topLeftLocation()); | 833 toLayoutBox(boxModelObject).topLeftLocation()); |
| 834 LOG(ERROR) << object.debugName() << " add offset paintOffset=" |
| 835 << context.current.paintOffset.toString(); |
| 826 // This is a weird quirk that table cells paint as children of table rows, | 836 // This is a weird quirk that table cells paint as children of table rows, |
| 827 // but their location have the row's location baked-in. | 837 // but their location have the row's location baked-in. |
| 828 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). | 838 // Similar adjustment is done in LayoutTableCell::offsetFromContainer(). |
| 829 if (boxModelObject.isTableCell()) { | 839 if (boxModelObject.isTableCell()) { |
| 830 LayoutObject* parentRow = boxModelObject.parent(); | 840 LayoutObject* parentRow = boxModelObject.parent(); |
| 831 DCHECK(parentRow && parentRow->isTableRow()); | 841 DCHECK(parentRow && parentRow->isTableRow()); |
| 832 context.current.paintOffset.moveBy( | 842 context.current.paintOffset.moveBy( |
| 833 -toLayoutBox(parentRow)->topLeftLocation()); | 843 -toLayoutBox(parentRow)->topLeftLocation()); |
| 834 } | 844 } |
| 835 } | 845 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 859 return; | 869 return; |
| 860 | 870 |
| 861 updateOverflowClip(object, context); | 871 updateOverflowClip(object, context); |
| 862 updatePerspective(object, context); | 872 updatePerspective(object, context); |
| 863 updateSvgLocalToBorderBoxTransform(object, context); | 873 updateSvgLocalToBorderBoxTransform(object, context); |
| 864 updateScrollAndScrollTranslation(object, context); | 874 updateScrollAndScrollTranslation(object, context); |
| 865 updateOutOfFlowContext(object, context); | 875 updateOutOfFlowContext(object, context); |
| 866 } | 876 } |
| 867 | 877 |
| 868 } // namespace blink | 878 } // namespace blink |
| OLD | NEW |