Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| index c9ecc259b470f1743773ff121fe247b566f421e6..3f7c96bcc42ba4a5a161a6ef69834ce95423030d 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
| @@ -38,10 +38,11 @@ PaintPropertyTreeBuilder::setupInitialContext() { |
| } |
| // True if a new property was created, false if an existing one was updated. |
| -bool updatePreTranslation(FrameView& frameView, |
| - PassRefPtr<const TransformPaintPropertyNode> parent, |
| - const TransformationMatrix& matrix, |
| - const FloatPoint3D& origin) { |
| +static inline bool updatePreTranslation( |
| + FrameView& frameView, |
| + PassRefPtr<const TransformPaintPropertyNode> parent, |
| + const TransformationMatrix& matrix, |
| + const FloatPoint3D& origin) { |
| DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| if (auto* existingPreTranslation = frameView.preTranslation()) { |
| existingPreTranslation->update(std::move(parent), matrix, origin); |
| @@ -53,7 +54,7 @@ bool updatePreTranslation(FrameView& frameView, |
| } |
| // True if a new property was created, false if an existing one was updated. |
| -bool updateContentClip( |
| +static inline bool updateContentClip( |
| FrameView& frameView, |
| PassRefPtr<const ClipPaintPropertyNode> parent, |
| PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
| @@ -70,7 +71,7 @@ bool updateContentClip( |
| } |
| // True if a new property was created, false if an existing one was updated. |
| -bool updateScrollTranslation( |
| +static inline bool updateScrollTranslation( |
| FrameView& frameView, |
| PassRefPtr<const TransformPaintPropertyNode> parent, |
| const TransformationMatrix& matrix, |
| @@ -87,14 +88,15 @@ bool updateScrollTranslation( |
| // True if a new property was created or a main thread scrolling reason changed |
| // (which can affect descendants), false if an existing one was updated. |
| -bool updateScroll(FrameView& frameView, |
| - PassRefPtr<const ScrollPaintPropertyNode> parent, |
| - PassRefPtr<const TransformPaintPropertyNode> scrollOffset, |
| - const IntSize& clip, |
| - const IntSize& bounds, |
| - bool userScrollableHorizontal, |
| - bool userScrollableVertical, |
| - MainThreadScrollingReasons mainThreadScrollingReasons) { |
| +static inline bool updateScroll( |
| + FrameView& frameView, |
| + PassRefPtr<const ScrollPaintPropertyNode> parent, |
| + PassRefPtr<const TransformPaintPropertyNode> scrollOffset, |
| + const IntSize& clip, |
| + const IntSize& bounds, |
| + bool userScrollableHorizontal, |
| + bool userScrollableVertical, |
| + MainThreadScrollingReasons mainThreadScrollingReasons) { |
| DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| if (auto* existingScroll = frameView.scroll()) { |
| auto existingReasons = existingScroll->mainThreadScrollingReasons(); |
| @@ -110,7 +112,7 @@ bool updateScroll(FrameView& frameView, |
| return true; |
| } |
| -MainThreadScrollingReasons mainThreadScrollingReasons( |
| +static inline MainThreadScrollingReasons mainThreadScrollingReasons( |
| const FrameView& frameView, |
| MainThreadScrollingReasons ancestorReasons) { |
| auto reasons = ancestorReasons; |
| @@ -219,7 +221,7 @@ void PaintPropertyTreeBuilder::updateProperties( |
| frameView.setTotalPropertyTreeStateForContents(std::move(contentsState)); |
| } |
| -void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( |
| +inline void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| bool usesPaintOffsetTranslation = false; |
| @@ -278,7 +280,7 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation( |
| // SVG does not use the general transform update of |updateTransform|, instead |
| // creating a transform node for SVG-specific transforms without 3D. |
| -void PaintPropertyTreeBuilder::updateTransformForNonRootSVG( |
| +inline void PaintPropertyTreeBuilder::updateTransformForNonRootSVG( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| DCHECK(object.isSVGChild()); |
| @@ -312,7 +314,8 @@ void PaintPropertyTreeBuilder::updateTransformForNonRootSVG( |
| } |
| } |
| -static CompositingReasons compositingReasonsForTransform(const LayoutBox& box) { |
| +static inline CompositingReasons compositingReasonsForTransform( |
| + const LayoutBox& box) { |
| const ComputedStyle& style = box.styleRef(); |
| CompositingReasons compositingReasons = CompositingReasonNone; |
| if (CompositingReasonFinder::requiresCompositingForTransform(box)) |
| @@ -335,7 +338,7 @@ static CompositingReasons compositingReasonsForTransform(const LayoutBox& box) { |
| return compositingReasons; |
| } |
| -static FloatPoint3D transformOrigin(const LayoutBox& box) { |
| +static inline FloatPoint3D transformOrigin(const LayoutBox& box) { |
| const ComputedStyle& style = box.styleRef(); |
| // Transform origin has no effect without a transform or motion path. |
| if (!style.hasTransform()) |
| @@ -347,17 +350,13 @@ static FloatPoint3D transformOrigin(const LayoutBox& box) { |
| style.transformOriginZ()); |
| } |
| -namespace { |
| - |
| -CompositorElementId createDomNodeBasedCompositorElementId( |
| +static inline CompositorElementId createDomNodeBasedCompositorElementId( |
| const LayoutObject& object) { |
| return createCompositorElementId(DOMNodeIds::idForNode(object.node()), |
| CompositorSubElementId::Primary); |
| } |
| -} // namespace |
|
Xianzhu
2017/01/18 18:37:55
Alternately we can enclose all local static functi
|
| - |
| -void PaintPropertyTreeBuilder::updateTransform( |
| +inline void PaintPropertyTreeBuilder::updateTransform( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (object.isSVGChild()) { |
| @@ -430,7 +429,7 @@ void PaintPropertyTreeBuilder::updateTransform( |
| } |
| } |
| -void PaintPropertyTreeBuilder::updateEffect( |
| +inline void PaintPropertyTreeBuilder::updateEffect( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| const ComputedStyle& style = object.styleRef(); |
| @@ -546,7 +545,7 @@ void PaintPropertyTreeBuilder::updateEffect( |
| } |
| } |
| -void PaintPropertyTreeBuilder::updateCssClip( |
| +inline void PaintPropertyTreeBuilder::updateCssClip( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
| @@ -573,7 +572,7 @@ void PaintPropertyTreeBuilder::updateCssClip( |
| context.current.clip = properties->cssClip(); |
| } |
| -void PaintPropertyTreeBuilder::updateLocalBorderBoxContext( |
| +inline void PaintPropertyTreeBuilder::updateLocalBorderBoxContext( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (!object.needsPaintPropertyUpdate() && !context.forceSubtreeUpdate) |
| @@ -593,7 +592,7 @@ void PaintPropertyTreeBuilder::updateLocalBorderBoxContext( |
| } |
| // TODO(trchen): Remove this once we bake the paint offset into frameRect. |
| -void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( |
| +inline void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (!object.needsPaintPropertyUpdate() && !context.forceSubtreeUpdate) |
| @@ -620,7 +619,7 @@ void PaintPropertyTreeBuilder::updateScrollbarPaintOffset( |
| context.forceSubtreeUpdate |= properties->clearScrollbarPaintOffset(); |
| } |
| -void PaintPropertyTreeBuilder::updateOverflowClip( |
| +inline void PaintPropertyTreeBuilder::updateOverflowClip( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (!object.isBox()) |
| @@ -669,7 +668,7 @@ void PaintPropertyTreeBuilder::updateOverflowClip( |
| context.current.clip = properties->overflowClip(); |
| } |
| -static FloatPoint perspectiveOrigin(const LayoutBox& box) { |
| +static inline FloatPoint perspectiveOrigin(const LayoutBox& box) { |
| const ComputedStyle& style = box.styleRef(); |
| // Perspective origin has no effect without perspective. |
| DCHECK(style.hasPerspective()); |
| @@ -679,7 +678,7 @@ static FloatPoint perspectiveOrigin(const LayoutBox& box) { |
| floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height())); |
| } |
| -void PaintPropertyTreeBuilder::updatePerspective( |
| +inline void PaintPropertyTreeBuilder::updatePerspective( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
| @@ -710,7 +709,7 @@ void PaintPropertyTreeBuilder::updatePerspective( |
| } |
| } |
| -void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform( |
| +inline void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (!object.isSVGRoot()) |
| @@ -744,7 +743,7 @@ void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform( |
| context.current.paintOffset = LayoutPoint(); |
| } |
| -MainThreadScrollingReasons mainThreadScrollingReasons( |
| +static inline MainThreadScrollingReasons mainThreadScrollingReasons( |
| const LayoutObject& object, |
| MainThreadScrollingReasons ancestorReasons) { |
| // The current main thread scrolling reasons implementation only changes |
| @@ -756,7 +755,7 @@ MainThreadScrollingReasons mainThreadScrollingReasons( |
| return mainThreadScrollingReasons(*object.frameView(), ancestorReasons); |
| } |
| -void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation( |
| +inline void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
| @@ -819,7 +818,7 @@ void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation( |
| } |
| } |
| -void PaintPropertyTreeBuilder::updateOutOfFlowContext( |
| +inline void PaintPropertyTreeBuilder::updateOutOfFlowContext( |
| const LayoutObject& object, |
| PaintPropertyTreeBuilderContext& context) { |
| if (object.isLayoutBlock()) |