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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

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

Powered by Google App Engine
This is Rietveld 408576698