Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h |
| diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h |
| index e71641075c097a7800f059076d39d52e6bba25dc..b6f1df6d42da2ed03f3d152006ada8d2084e596b 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h |
| +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.h |
| @@ -5,37 +5,94 @@ |
| #ifndef PaintPropertyTreeBuilder_h |
| #define PaintPropertyTreeBuilder_h |
| +#include "platform/geometry/LayoutPoint.h" |
| +#include "wtf/RefPtr.h" |
| + |
| namespace blink { |
| +class ClipPaintPropertyNode; |
| +class EffectPaintPropertyNode; |
| class FrameView; |
| class LayoutObject; |
| -struct PaintPropertyTreeBuilderContext; |
| +class TransformPaintPropertyNode; |
| + |
| +// The context for PaintPropertyTreeBuilder. |
| +// It's responsible for bookkeeping tree state in other order, for example, the most recent |
| +// position container seen. |
| +struct PaintPropertyTreeBuilderContext { |
| + PaintPropertyTreeBuilderContext() |
| + : currentTransform(nullptr) |
| + , currentClip(nullptr) |
| + , transformForAbsolutePosition(nullptr) |
| + , containerForAbsolutePosition(nullptr) |
| + , clipForAbsolutePosition(nullptr) |
| + , transformForFixedPosition(nullptr) |
| + , clipForFixedPosition(nullptr) |
| + , currentEffect(nullptr) { } |
| + |
| + // The combination of a transform and paint offset describes a linear space. |
| + // When a layout object recur to its children, the main context is expected to refer |
| + // the object's border box, then the callee will derive its own border box by translating |
| + // the space with its own layout location. |
| + TransformPaintPropertyNode* currentTransform; |
| + LayoutPoint paintOffset; |
| + // The clip node describes the accumulated raster clip for the current subtree. |
| + // Note that the computed raster region in canvas space for a clip node is independent from |
| + // the transform and paint offset above. Also the actual raster region may be affected |
| + // by layerization and occlusion tracking. |
| + ClipPaintPropertyNode* currentClip; |
| + |
| + // Separate context for out-of-flow positioned and fixed positioned elements are needed |
| + // because they don't use DOM parent as their containing block. |
| + // These additional contexts normally pass through untouched, and are only copied from |
| + // the main context when the current element serves as the containing block of corresponding |
| + // positioned descendants. |
| + // Overflow clips are also inherited by containing block tree instead of DOM tree, thus they |
| + // are included in the additional context too. |
| + TransformPaintPropertyNode* transformForAbsolutePosition; |
| + LayoutPoint paintOffsetForAbsolutePosition; |
| + const LayoutObject* containerForAbsolutePosition; |
| + ClipPaintPropertyNode* clipForAbsolutePosition; |
| + |
| + TransformPaintPropertyNode* transformForFixedPosition; |
| + LayoutPoint paintOffsetForFixedPosition; |
| + ClipPaintPropertyNode* clipForFixedPosition; |
| + |
| + // The effect hierarchy is applied by the stacking context tree. It is guaranteed that every |
| + // DOM descendant is also a stacking context descendant. Therefore, we don't need extra |
| + // bookkeeping for effect nodes and can generate the effect tree from a DOM-order traversal. |
| + EffectPaintPropertyNode* currentEffect; |
| +}; |
| + |
| +// Holds references to root property nodes to keep them alive during tree walk. |
| +struct PaintPropertyTreeBuilderRootContext : public PaintPropertyTreeBuilderContext { |
| + RefPtr<TransformPaintPropertyNode> transformRoot; |
| + RefPtr<ClipPaintPropertyNode> clipRoot; |
| + RefPtr<EffectPaintPropertyNode> effectRoot; |
| +}; |
| -// This class walks the whole layout tree, beginning from the root FrameView, across |
| -// frame boundaries. The walk will collect special things in the layout tree and create |
| -// paint property nodes for them. Special things include but not limit to: overflow clip, |
| -// transform, fixed-pos, animation, mask, filter, ... etc. |
| -// It expects to be invoked after layout clean, i.e. during InPaintPropertyUpdate phase. |
| +// Creates paint property tree nodes for special things in the layout tree. |
| +// Special things include but not limit to: overflow cllip, transform, fixed-pos, animation, |
|
pdr.
2016/05/31 23:17:39
Nittt: clip
Xianzhu
2016/05/31 23:41:40
Donne.
|
| +// mask, filter, ... etc. |
| +// It expects to be invoked for each layout tree node in DOM order during InPrePaint phase. |
| class PaintPropertyTreeBuilder { |
| public: |
| - void buildPropertyTrees(FrameView& rootFrame); |
| + void buildTreeRootNodes(FrameView&, PaintPropertyTreeBuilderRootContext&); |
| + void buildTreeNodes(FrameView&, PaintPropertyTreeBuilderContext&); |
| + void buildTreeNodes(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| private: |
| - void walk(FrameView&, const PaintPropertyTreeBuilderContext&); |
| - |
| - static void updatePaintOffsetTranslation(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateTransform(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateEffect(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateCssClip(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateLocalBorderBoxContext(LayoutObject&, const PaintPropertyTreeBuilderContext&); |
| - static void updateScrollbarPaintOffset(LayoutObject&, const PaintPropertyTreeBuilderContext&); |
| - static void updateOverflowClip(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updatePerspective(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateSvgLocalTransform(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateScrollTranslation(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - static void updateOutOfFlowContext(LayoutObject&, PaintPropertyTreeBuilderContext&); |
| - |
| - void walk(LayoutObject&, const PaintPropertyTreeBuilderContext&); |
| + static void updatePaintOffsetTranslation(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateTransform(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateEffect(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateCssClip(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateLocalBorderBoxContext(const LayoutObject&, const PaintPropertyTreeBuilderContext&); |
| + static void updateScrollbarPaintOffset(const LayoutObject&, const PaintPropertyTreeBuilderContext&); |
| + static void updateOverflowClip(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updatePerspective(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateSvgLocalTransform(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateScrollTranslation(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| + static void updateOutOfFlowContext(const LayoutObject&, PaintPropertyTreeBuilderContext&); |
| }; |
| } // namespace blink |