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

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

Issue 2640863003: Inline PrePaintTreeWalk private methods and static functions (Closed)
Patch Set: ALWAYS_INLINE Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/dom/DOMNodeIds.h" 7 #include "core/dom/DOMNodeIds.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 20 matching lines...) Expand all
31 context.currentEffect = EffectPaintPropertyNode::root(); 31 context.currentEffect = EffectPaintPropertyNode::root();
32 context.inputClipOfCurrentEffect = ClipPaintPropertyNode::root(); 32 context.inputClipOfCurrentEffect = ClipPaintPropertyNode::root();
33 context.current.transform = context.absolutePosition.transform = 33 context.current.transform = context.absolutePosition.transform =
34 context.fixedPosition.transform = TransformPaintPropertyNode::root(); 34 context.fixedPosition.transform = TransformPaintPropertyNode::root();
35 context.current.scroll = context.absolutePosition.scroll = 35 context.current.scroll = context.absolutePosition.scroll =
36 context.fixedPosition.scroll = ScrollPaintPropertyNode::root(); 36 context.fixedPosition.scroll = ScrollPaintPropertyNode::root();
37 return context; 37 return context;
38 } 38 }
39 39
40 // True if a new property was created, false if an existing one was updated. 40 // True if a new property was created, false if an existing one was updated.
41 bool updatePreTranslation(FrameView& frameView, 41 static bool updatePreTranslation(
42 PassRefPtr<const TransformPaintPropertyNode> parent, 42 FrameView& frameView,
43 const TransformationMatrix& matrix, 43 PassRefPtr<const TransformPaintPropertyNode> parent,
44 const FloatPoint3D& origin) { 44 const TransformationMatrix& matrix,
45 const FloatPoint3D& origin) {
45 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); 46 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
46 if (auto* existingPreTranslation = frameView.preTranslation()) { 47 if (auto* existingPreTranslation = frameView.preTranslation()) {
47 existingPreTranslation->update(std::move(parent), matrix, origin); 48 existingPreTranslation->update(std::move(parent), matrix, origin);
48 return false; 49 return false;
49 } 50 }
50 frameView.setPreTranslation( 51 frameView.setPreTranslation(
51 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); 52 TransformPaintPropertyNode::create(std::move(parent), matrix, origin));
52 return true; 53 return true;
53 } 54 }
54 55
55 // True if a new property was created, false if an existing one was updated. 56 // True if a new property was created, false if an existing one was updated.
56 bool updateContentClip( 57 static bool updateContentClip(
57 FrameView& frameView, 58 FrameView& frameView,
58 PassRefPtr<const ClipPaintPropertyNode> parent, 59 PassRefPtr<const ClipPaintPropertyNode> parent,
59 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 60 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
60 const FloatRoundedRect& clipRect) { 61 const FloatRoundedRect& clipRect) {
61 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); 62 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
62 if (auto* existingContentClip = frameView.contentClip()) { 63 if (auto* existingContentClip = frameView.contentClip()) {
63 existingContentClip->update(std::move(parent), 64 existingContentClip->update(std::move(parent),
64 std::move(localTransformSpace), clipRect); 65 std::move(localTransformSpace), clipRect);
65 return false; 66 return false;
66 } 67 }
67 frameView.setContentClip(ClipPaintPropertyNode::create( 68 frameView.setContentClip(ClipPaintPropertyNode::create(
68 std::move(parent), std::move(localTransformSpace), clipRect)); 69 std::move(parent), std::move(localTransformSpace), clipRect));
69 return true; 70 return true;
70 } 71 }
71 72
72 // True if a new property was created, false if an existing one was updated. 73 // True if a new property was created, false if an existing one was updated.
73 bool updateScrollTranslation( 74 static bool updateScrollTranslation(
74 FrameView& frameView, 75 FrameView& frameView,
75 PassRefPtr<const TransformPaintPropertyNode> parent, 76 PassRefPtr<const TransformPaintPropertyNode> parent,
76 const TransformationMatrix& matrix, 77 const TransformationMatrix& matrix,
77 const FloatPoint3D& origin) { 78 const FloatPoint3D& origin) {
78 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); 79 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
79 if (auto* existingScrollTranslation = frameView.scrollTranslation()) { 80 if (auto* existingScrollTranslation = frameView.scrollTranslation()) {
80 existingScrollTranslation->update(std::move(parent), matrix, origin); 81 existingScrollTranslation->update(std::move(parent), matrix, origin);
81 return false; 82 return false;
82 } 83 }
83 frameView.setScrollTranslation( 84 frameView.setScrollTranslation(
84 TransformPaintPropertyNode::create(std::move(parent), matrix, origin)); 85 TransformPaintPropertyNode::create(std::move(parent), matrix, origin));
85 return true; 86 return true;
86 } 87 }
87 88
88 // True if a new property was created or a main thread scrolling reason changed 89 // True if a new property was created or a main thread scrolling reason changed
89 // (which can affect descendants), false if an existing one was updated. 90 // (which can affect descendants), false if an existing one was updated.
90 bool updateScroll(FrameView& frameView, 91 static bool updateScroll(
91 PassRefPtr<const ScrollPaintPropertyNode> parent, 92 FrameView& frameView,
92 PassRefPtr<const TransformPaintPropertyNode> scrollOffset, 93 PassRefPtr<const ScrollPaintPropertyNode> parent,
93 const IntSize& clip, 94 PassRefPtr<const TransformPaintPropertyNode> scrollOffset,
94 const IntSize& bounds, 95 const IntSize& clip,
95 bool userScrollableHorizontal, 96 const IntSize& bounds,
96 bool userScrollableVertical, 97 bool userScrollableHorizontal,
97 MainThreadScrollingReasons mainThreadScrollingReasons) { 98 bool userScrollableVertical,
99 MainThreadScrollingReasons mainThreadScrollingReasons) {
98 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); 100 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled());
99 if (auto* existingScroll = frameView.scroll()) { 101 if (auto* existingScroll = frameView.scroll()) {
100 auto existingReasons = existingScroll->mainThreadScrollingReasons(); 102 auto existingReasons = existingScroll->mainThreadScrollingReasons();
101 existingScroll->update(std::move(parent), std::move(scrollOffset), clip, 103 existingScroll->update(std::move(parent), std::move(scrollOffset), clip,
102 bounds, userScrollableHorizontal, 104 bounds, userScrollableHorizontal,
103 userScrollableVertical, mainThreadScrollingReasons); 105 userScrollableVertical, mainThreadScrollingReasons);
104 return existingReasons != mainThreadScrollingReasons; 106 return existingReasons != mainThreadScrollingReasons;
105 } 107 }
106 frameView.setScroll(ScrollPaintPropertyNode::create( 108 frameView.setScroll(ScrollPaintPropertyNode::create(
107 std::move(parent), std::move(scrollOffset), clip, bounds, 109 std::move(parent), std::move(scrollOffset), clip, bounds,
108 userScrollableHorizontal, userScrollableVertical, 110 userScrollableHorizontal, userScrollableVertical,
109 mainThreadScrollingReasons)); 111 mainThreadScrollingReasons));
110 return true; 112 return true;
111 } 113 }
112 114
113 MainThreadScrollingReasons mainThreadScrollingReasons( 115 static MainThreadScrollingReasons mainThreadScrollingReasons(
114 const FrameView& frameView, 116 const FrameView& frameView,
115 MainThreadScrollingReasons ancestorReasons) { 117 MainThreadScrollingReasons ancestorReasons) {
116 auto reasons = ancestorReasons; 118 auto reasons = ancestorReasons;
117 if (!frameView.frame().settings()->getThreadedScrollingEnabled()) 119 if (!frameView.frame().settings()->getThreadedScrollingEnabled())
118 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled; 120 reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
119 if (frameView.hasBackgroundAttachmentFixedObjects()) 121 if (frameView.hasBackgroundAttachmentFixedObjects())
120 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects; 122 reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
121 return reasons; 123 return reasons;
122 } 124 }
123 125
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // Transform origin has no effect without a transform or motion path. 342 // Transform origin has no effect without a transform or motion path.
341 if (!style.hasTransform()) 343 if (!style.hasTransform())
342 return FloatPoint3D(); 344 return FloatPoint3D();
343 FloatSize borderBoxSize(box.size()); 345 FloatSize borderBoxSize(box.size());
344 return FloatPoint3D( 346 return FloatPoint3D(
345 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), 347 floatValueForLength(style.transformOriginX(), borderBoxSize.width()),
346 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), 348 floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
347 style.transformOriginZ()); 349 style.transformOriginZ());
348 } 350 }
349 351
350 namespace { 352 static CompositorElementId createDomNodeBasedCompositorElementId(
351
352 CompositorElementId createDomNodeBasedCompositorElementId(
353 const LayoutObject& object) { 353 const LayoutObject& object) {
354 return createCompositorElementId(DOMNodeIds::idForNode(object.node()), 354 return createCompositorElementId(DOMNodeIds::idForNode(object.node()),
355 CompositorSubElementId::Primary); 355 CompositorSubElementId::Primary);
356 } 356 }
357 357
358 } // namespace
359
360 void PaintPropertyTreeBuilder::updateTransform( 358 void PaintPropertyTreeBuilder::updateTransform(
361 const LayoutObject& object, 359 const LayoutObject& object,
362 PaintPropertyTreeBuilderContext& context) { 360 PaintPropertyTreeBuilderContext& context) {
363 if (object.isSVGChild()) { 361 if (object.isSVGChild()) {
364 updateTransformForNonRootSVG(object, context); 362 updateTransformForNonRootSVG(object, context);
365 return; 363 return;
366 } 364 }
367 365
368 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { 366 if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
369 const ComputedStyle& style = object.styleRef(); 367 const ComputedStyle& style = object.styleRef();
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 if (properties && properties->svgLocalToBorderBoxTransform()) { 735 if (properties && properties->svgLocalToBorderBoxTransform()) {
738 context.current.transform = properties->svgLocalToBorderBoxTransform(); 736 context.current.transform = properties->svgLocalToBorderBoxTransform();
739 context.current.shouldFlattenInheritedTransform = false; 737 context.current.shouldFlattenInheritedTransform = false;
740 context.current.renderingContextId = 0; 738 context.current.renderingContextId = 0;
741 } 739 }
742 // The paint offset is included in |transformToBorderBox| so SVG does not need 740 // The paint offset is included in |transformToBorderBox| so SVG does not need
743 // to handle paint offset internally. 741 // to handle paint offset internally.
744 context.current.paintOffset = LayoutPoint(); 742 context.current.paintOffset = LayoutPoint();
745 } 743 }
746 744
747 MainThreadScrollingReasons mainThreadScrollingReasons( 745 static MainThreadScrollingReasons mainThreadScrollingReasons(
748 const LayoutObject& object, 746 const LayoutObject& object,
749 MainThreadScrollingReasons ancestorReasons) { 747 MainThreadScrollingReasons ancestorReasons) {
750 // The current main thread scrolling reasons implementation only changes 748 // The current main thread scrolling reasons implementation only changes
751 // reasons at frame boundaries, so we can early-out when not at a LayoutView. 749 // reasons at frame boundaries, so we can early-out when not at a LayoutView.
752 // TODO(pdr): Need to find a solution to the style-related main thread 750 // TODO(pdr): Need to find a solution to the style-related main thread
753 // scrolling reasons such as opacity and transform which violate this. 751 // scrolling reasons such as opacity and transform which violate this.
754 if (!object.isLayoutView()) 752 if (!object.isLayoutView())
755 return ancestorReasons; 753 return ancestorReasons;
756 return mainThreadScrollingReasons(*object.frameView(), ancestorReasons); 754 return mainThreadScrollingReasons(*object.frameView(), ancestorReasons);
757 } 755 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 updateOverflowClip(object, context); 989 updateOverflowClip(object, context);
992 updatePerspective(object, context); 990 updatePerspective(object, context);
993 updateSvgLocalToBorderBoxTransform(object, context); 991 updateSvgLocalToBorderBoxTransform(object, context);
994 updateScrollAndScrollTranslation(object, context); 992 updateScrollAndScrollTranslation(object, context);
995 updateOutOfFlowContext(object, context); 993 updateOutOfFlowContext(object, context);
996 994
997 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate(); 995 context.forceSubtreeUpdate |= object.subtreeNeedsPaintPropertyUpdate();
998 } 996 }
999 997
1000 } // namespace blink 998 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698