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 PaintPropertyTreeBuilderContext::PaintPropertyTreeBuilderContext() |
| 30 PaintPropertyTreeBuilderContext& context) { | 30 : containerForAbsolutePosition(nullptr), |
| 31 context.current.clip = context.absolutePosition.clip = | 31 currentEffect(nullptr), |
|
pdr.
2017/03/21 23:31:12
Can you write this as currentEffect(EffectPaintPro
chrishtr
2017/03/21 23:39:17
Done.
| |
| 32 context.fixedPosition.clip = ClipPaintPropertyNode::root(); | 32 inputClipOfCurrentEffect(nullptr), |
| 33 context.currentEffect = EffectPaintPropertyNode::root(); | 33 forceSubtreeUpdate(false) { |
| 34 context.inputClipOfCurrentEffect = ClipPaintPropertyNode::root(); | 34 current.clip = absolutePosition.clip = fixedPosition.clip = |
| 35 context.current.transform = context.absolutePosition.transform = | 35 ClipPaintPropertyNode::root(); |
| 36 context.fixedPosition.transform = TransformPaintPropertyNode::root(); | 36 currentEffect = EffectPaintPropertyNode::root(); |
| 37 context.current.scroll = context.absolutePosition.scroll = | 37 inputClipOfCurrentEffect = ClipPaintPropertyNode::root(); |
| 38 context.fixedPosition.scroll = ScrollPaintPropertyNode::root(); | 38 current.transform = absolutePosition.transform = fixedPosition.transform = |
| 39 TransformPaintPropertyNode::root(); | |
| 40 current.scroll = absolutePosition.scroll = fixedPosition.scroll = | |
| 41 ScrollPaintPropertyNode::root(); | |
| 39 } | 42 } |
| 40 | 43 |
| 41 // True if a new property was created, false if an existing one was updated. | 44 // True if a new property was created, false if an existing one was updated. |
| 42 static bool updatePreTranslation( | 45 static bool updatePreTranslation( |
| 43 FrameView& frameView, | 46 FrameView& frameView, |
| 44 PassRefPtr<const TransformPaintPropertyNode> parent, | 47 PassRefPtr<const TransformPaintPropertyNode> parent, |
| 45 const TransformationMatrix& matrix, | 48 const TransformationMatrix& matrix, |
| 46 const FloatPoint3D& origin) { | 49 const FloatPoint3D& origin) { |
| 47 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 50 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 48 if (auto* existingPreTranslation = frameView.preTranslation()) { | 51 if (auto* existingPreTranslation = frameView.preTranslation()) { |
| (...skipping 1034 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 | 1086 // frame rect, so force a property update if it changes. TODO(pdr): We |
| 1084 // only need to update properties if there are relative lengths. | 1087 // only need to update properties if there are relative lengths. |
| 1085 box.styleRef().hasTransform() || box.styleRef().hasPerspective() || | 1088 box.styleRef().hasTransform() || box.styleRef().hasPerspective() || |
| 1086 boxGeneratesPropertyNodesForMaskAndClipPath) | 1089 boxGeneratesPropertyNodesForMaskAndClipPath) |
| 1087 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); | 1090 box.getMutableForPainting().setNeedsPaintPropertyUpdate(); |
| 1088 } | 1091 } |
| 1089 | 1092 |
| 1090 void PaintPropertyTreeBuilder::updatePropertiesForSelf( | 1093 void PaintPropertyTreeBuilder::updatePropertiesForSelf( |
| 1091 const LayoutObject& object, | 1094 const LayoutObject& object, |
| 1092 PaintPropertyTreeBuilderContext& context) { | 1095 PaintPropertyTreeBuilderContext& context) { |
| 1096 if (object.isSVGResourceContainer()) { | |
| 1097 // SVG resources are painted within one or more other locations in the | |
| 1098 // SVG during paint, and hence have their own independent paint property | |
| 1099 // trees, paint offset, etc. | |
| 1100 context = PaintPropertyTreeBuilderContext(); | |
| 1101 } | |
| 1102 | |
| 1093 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset | 1103 // This is not in FindObjectPropertiesNeedingUpdateScope because paint offset |
| 1094 // can change without needsPaintPropertyUpdate. | 1104 // can change without needsPaintPropertyUpdate. |
| 1095 updateForObjectLocationAndSize(object, context); | 1105 updateForObjectLocationAndSize(object, context); |
| 1096 | 1106 |
| 1097 #if DCHECK_IS_ON() | 1107 #if DCHECK_IS_ON() |
| 1098 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); | 1108 FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context); |
| 1099 #endif | 1109 #endif |
| 1100 | 1110 |
| 1101 if (object.isBoxModelObject() || object.isSVG()) { | 1111 if (object.isBoxModelObject() || object.isSVG()) { |
| 1102 updateTransform(object, context); | 1112 updateTransform(object, context); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1124 updateOverflowClip(object, context); | 1134 updateOverflowClip(object, context); |
| 1125 updatePerspective(object, context); | 1135 updatePerspective(object, context); |
| 1126 updateSvgLocalToBorderBoxTransform(object, context); | 1136 updateSvgLocalToBorderBoxTransform(object, context); |
| 1127 updateScrollAndScrollTranslation(object, context); | 1137 updateScrollAndScrollTranslation(object, context); |
| 1128 updateOutOfFlowContext(object, context); | 1138 updateOutOfFlowContext(object, context); |
| 1129 | 1139 |
| 1130 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); | 1140 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); |
| 1131 } | 1141 } |
| 1132 | 1142 |
| 1133 } // namespace blink | 1143 } // namespace blink |
| OLD | NEW |