Chromium Code Reviews| 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 <memory> | 7 #include <memory> |
| 8 #include "core/dom/DOMNodeIds.h" | 8 #include "core/dom/DOMNodeIds.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
| 12 #include "core/layout/LayoutInline.h" | 12 #include "core/layout/LayoutInline.h" |
| 13 #include "core/layout/LayoutView.h" | 13 #include "core/layout/LayoutView.h" |
| 14 #include "core/layout/compositing/CompositingReasonFinder.h" | 14 #include "core/layout/compositing/CompositingReasonFinder.h" |
| 15 #include "core/layout/svg/LayoutSVGResourceMasker.h" | 15 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
| 16 #include "core/layout/svg/LayoutSVGRoot.h" | 16 #include "core/layout/svg/LayoutSVGRoot.h" |
| 17 #include "core/layout/svg/SVGLayoutSupport.h" | 17 #include "core/layout/svg/SVGLayoutSupport.h" |
| 18 #include "core/layout/svg/SVGResources.h" | 18 #include "core/layout/svg/SVGResources.h" |
| 19 #include "core/layout/svg/SVGResourcesCache.h" | 19 #include "core/layout/svg/SVGResourcesCache.h" |
| 20 #include "core/paint/FindPropertiesNeedingUpdate.h" | 20 #include "core/paint/FindPropertiesNeedingUpdate.h" |
| 21 #include "core/paint/ObjectPaintProperties.h" | 21 #include "core/paint/ObjectPaintProperties.h" |
| 22 #include "core/paint/PaintLayer.h" | 22 #include "core/paint/PaintLayer.h" |
| 23 #include "core/paint/SVGRootPainter.h" | 23 #include "core/paint/SVGRootPainter.h" |
| 24 #include "platform/transforms/TransformationMatrix.h" | 24 #include "platform/transforms/TransformationMatrix.h" |
| 25 #include "wtf/PtrUtil.h" | 25 #include "wtf/PtrUtil.h" |
| 26 | 26 |
| 27 namespace blink { | 27 namespace blink { |
| 28 | 28 |
| 29 void PaintPropertyTreeBuilder::setupInitialContext( | 29 void PaintPropertyTreeBuilder::resetToRootContext( |
| 30 PaintPropertyTreeBuilderContext& context) { | 30 PaintPropertyTreeBuilderContext& context) { |
| 31 context.current.clip = context.absolutePosition.clip = | 31 context.current.clip = context.absolutePosition.clip = |
| 32 context.fixedPosition.clip = ClipPaintPropertyNode::root(); | 32 context.fixedPosition.clip = ClipPaintPropertyNode::root(); |
| 33 context.currentEffect = EffectPaintPropertyNode::root(); | 33 context.currentEffect = EffectPaintPropertyNode::root(); |
| 34 context.inputClipOfCurrentEffect = ClipPaintPropertyNode::root(); | 34 context.inputClipOfCurrentEffect = ClipPaintPropertyNode::root(); |
| 35 context.current.transform = context.absolutePosition.transform = | 35 context.current.transform = context.absolutePosition.transform = |
| 36 context.fixedPosition.transform = TransformPaintPropertyNode::root(); | 36 context.fixedPosition.transform = TransformPaintPropertyNode::root(); |
| 37 context.current.scroll = context.absolutePosition.scroll = | 37 context.current.scroll = context.absolutePosition.scroll = |
| 38 context.fixedPosition.scroll = ScrollPaintPropertyNode::root(); | 38 context.fixedPosition.scroll = ScrollPaintPropertyNode::root(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void PaintPropertyTreeBuilder::setupInitialContext( | |
| 42 PaintPropertyTreeBuilderContext& context) { | |
| 43 resetToRootContext(context); | |
| 44 } | |
| 45 | |
| 41 // True if a new property was created, false if an existing one was updated. | 46 // True if a new property was created, false if an existing one was updated. |
| 42 static bool updatePreTranslation( | 47 static bool updatePreTranslation( |
| 43 FrameView& frameView, | 48 FrameView& frameView, |
| 44 PassRefPtr<const TransformPaintPropertyNode> parent, | 49 PassRefPtr<const TransformPaintPropertyNode> parent, |
| 45 const TransformationMatrix& matrix, | 50 const TransformationMatrix& matrix, |
| 46 const FloatPoint3D& origin) { | 51 const FloatPoint3D& origin) { |
| 47 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 52 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 48 if (auto* existingPreTranslation = frameView.preTranslation()) { | 53 if (auto* existingPreTranslation = frameView.preTranslation()) { |
| 49 existingPreTranslation->update(std::move(parent), matrix, origin); | 54 existingPreTranslation->update(std::move(parent), matrix, origin); |
| 50 return false; | 55 return false; |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 // frame rect, so force a property update if it changes. TODO(pdr): We | 1088 // frame rect, so force a property update if it changes. TODO(pdr): We |
| 1084 // only need to update properties if there are relative lengths. | 1089 // only need to update properties if there are relative lengths. |
| 1085 box.styleRef().hasTransform() || box.styleRef().hasPerspective() || | 1090 box.styleRef().hasTransform() || box.styleRef().hasPerspective() || |
| 1086 boxGeneratesPropertyNodesForMaskAndClipPath) | 1091 boxGeneratesPropertyNodesForMaskAndClipPath) |
| 1087 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); | 1092 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); |
| 1088 } | 1093 } |
| 1089 | 1094 |
| 1090 void PaintPropertyTreeBuilder::updatePropertiesForSelf( | 1095 void PaintPropertyTreeBuilder::updatePropertiesForSelf( |
| 1091 const LayoutObject& object, | 1096 const LayoutObject& object, |
| 1092 PaintPropertyTreeBuilderContext& context) { | 1097 PaintPropertyTreeBuilderContext& context) { |
| 1098 if (object.isSVGResourceContainer()) { | |
| 1099 // SVG resources are painted within one or more other locations in the | |
| 1100 // SVG during paint, and hence have their own independent paint property | |
| 1101 // trees. | |
| 1102 resetToRootContext(context); | |
|
pdr.
2017/03/21 22:26:22
This re-use of setupInitialContext is clever. I th
chrishtr
2017/03/21 23:29:57
Changed to reuse the constructor, which will get t
| |
| 1103 } | |
| 1104 | |
| 1093 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset | 1105 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset |
| 1094 // can change without needsPaintPropertyUpdate. | 1106 // can change without needsPaintPropertyUpdate. |
| 1095 updateForObjectLocationAndSize(object, context); | 1107 updateForObjectLocationAndSize(object, context); |
| 1096 | 1108 |
| 1097 #if DCHECK_IS_ON() | 1109 #if DCHECK_IS_ON() |
| 1098 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); | 1110 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); |
| 1099 #endif | 1111 #endif |
| 1100 | 1112 |
| 1101 if (object.isBoxModelObject() || object.isSVG()) { | 1113 if (object.isBoxModelObject() || object.isSVG()) { |
| 1102 updateTransform(object, context); | 1114 updateTransform(object, context); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1124 updateOverflowClip(object, context); | 1136 updateOverflowClip(object, context); |
| 1125 updatePerspective(object, context); | 1137 updatePerspective(object, context); |
| 1126 updateSvgLocalToBorderBoxTransform(object, context); | 1138 updateSvgLocalToBorderBoxTransform(object, context); |
| 1127 updateScrollAndScrollTranslation(object, context); | 1139 updateScrollAndScrollTranslation(object, context); |
| 1128 updateOutOfFlowContext(object, context); | 1140 updateOutOfFlowContext(object, context); |
| 1129 | 1141 |
| 1130 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 1142 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
| 1131 } | 1143 } |
| 1132 | 1144 |
| 1133 } // namespace blink | 1145 } // namespace blink |
| OLD | NEW |