| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "sky/engine/core/rendering/LayerPaintingInfo.h" | 48 #include "sky/engine/core/rendering/LayerPaintingInfo.h" |
| 49 #include "sky/engine/core/rendering/RenderBox.h" | 49 #include "sky/engine/core/rendering/RenderBox.h" |
| 50 #include "sky/engine/core/rendering/RenderLayerClipper.h" | 50 #include "sky/engine/core/rendering/RenderLayerClipper.h" |
| 51 #include "sky/engine/core/rendering/RenderLayerStackingNode.h" | 51 #include "sky/engine/core/rendering/RenderLayerStackingNode.h" |
| 52 #include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" | 52 #include "sky/engine/core/rendering/RenderLayerStackingNodeIterator.h" |
| 53 #include "sky/engine/public/platform/WebBlendMode.h" | 53 #include "sky/engine/public/platform/WebBlendMode.h" |
| 54 #include "sky/engine/wtf/OwnPtr.h" | 54 #include "sky/engine/wtf/OwnPtr.h" |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| 57 | 57 |
| 58 class FilterOperations; | |
| 59 class HitTestRequest; | |
| 60 class HitTestResult; | |
| 61 class HitTestingTransformState; | |
| 62 class RenderStyle; | 58 class RenderStyle; |
| 63 class TransformationMatrix; | |
| 64 | 59 |
| 65 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForB
orderRadius }; | 60 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForB
orderRadius }; |
| 66 enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf }; | 61 enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf }; |
| 67 | 62 |
| 68 class RenderLayer { | 63 class RenderLayer { |
| 69 WTF_MAKE_NONCOPYABLE(RenderLayer); | 64 WTF_MAKE_NONCOPYABLE(RenderLayer); |
| 70 public: | 65 public: |
| 71 RenderLayer(RenderBox*, LayerType); | 66 RenderLayer(RenderBox*, LayerType); |
| 72 ~RenderLayer(); | 67 ~RenderLayer(); |
| 73 | 68 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 return curr; | 91 return curr; |
| 97 } | 92 } |
| 98 | 93 |
| 99 LayoutPoint location() const; | 94 LayoutPoint location() const; |
| 100 IntSize size() const; | 95 IntSize size() const; |
| 101 LayoutRect rect() const { return LayoutRect(location(), size()); } | 96 LayoutRect rect() const { return LayoutRect(location(), size()); } |
| 102 | 97 |
| 103 bool isRootLayer() const { return m_isRootLayer; } | 98 bool isRootLayer() const { return m_isRootLayer; } |
| 104 | 99 |
| 105 void updateLayerPositionsAfterLayout(); | 100 void updateLayerPositionsAfterLayout(); |
| 106 void updateTransformationMatrix(); | |
| 107 | 101 |
| 108 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } | 102 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } |
| 109 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } | 103 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode.
get(); } |
| 110 | 104 |
| 111 // Gets the nearest enclosing positioned ancestor layer (also includes | 105 // Gets the nearest enclosing positioned ancestor layer (also includes |
| 112 // the <html> layer and the root layer). | 106 // the <html> layer and the root layer). |
| 113 RenderLayer* enclosingPositionedAncestor() const; | 107 RenderLayer* enclosingPositionedAncestor() const; |
| 114 | 108 |
| 115 const RenderLayer* compositingContainer() const; | 109 const RenderLayer* compositingContainer() const; |
| 116 | 110 |
| 117 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co
nst; | 111 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co
nst; |
| 118 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con
st; | 112 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con
st; |
| 119 | 113 |
| 120 // Pass offsetFromRoot if known. | 114 // Pass offsetFromRoot if known. |
| 121 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d
amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0)
const; | 115 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d
amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0)
const; |
| 122 | 116 |
| 123 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. | 117 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know
n. |
| 124 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou
tPoint* offsetFromRoot = 0) const; | 118 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou
tPoint* offsetFromRoot = 0) const; |
| 125 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R
enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; | 119 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R
enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; |
| 126 LayoutRect boundingBoxForCompositing(const RenderLayer* ancestorLayer = 0) c
onst; | 120 LayoutRect boundingBoxForCompositing(const RenderLayer* ancestorLayer = 0) c
onst; |
| 127 | 121 |
| 128 // This transform has the transform-origin baked in. | |
| 129 TransformationMatrix* transform() const { return m_transform.get(); } | |
| 130 | |
| 131 bool preserves3D() const { return renderer()->style()->transformStyle3D() ==
TransformStyle3DPreserve3D; } | |
| 132 bool has3DTransform() const { return m_transform && !m_transform->isAffine()
; } | |
| 133 | |
| 134 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } | 122 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan
t; } |
| 135 // Both updates the status, and returns true if descendants of this have 3d. | 123 // Both updates the status, and returns true if descendants of this have 3d. |
| 136 bool update3DTransformedDescendantStatus(); | 124 bool update3DTransformedDescendantStatus(); |
| 137 | 125 |
| 138 // FIXME: reflections should force transform-style to be flat in the style:
https://bugs.webkit.org/show_bug.cgi?id=106959 | |
| 139 bool shouldPreserve3D() const { return renderer()->style()->transformStyle3D
() == TransformStyle3DPreserve3D; } | |
| 140 | |
| 141 void* operator new(size_t); | 126 void* operator new(size_t); |
| 142 // Only safe to call from RenderBox::destroyLayer() | 127 // Only safe to call from RenderBox::destroyLayer() |
| 143 void operator delete(void*); | 128 void operator delete(void*); |
| 144 | 129 |
| 145 RenderLayerClipper& clipper() { return m_clipper; } | 130 RenderLayerClipper& clipper() { return m_clipper; } |
| 146 const RenderLayerClipper& clipper() const { return m_clipper; } | 131 const RenderLayerClipper& clipper() const { return m_clipper; } |
| 147 | 132 |
| 148 inline bool isPositionedContainer() const | 133 inline bool isPositionedContainer() const |
| 149 { | 134 { |
| 150 // FIXME: This is not in sync with containingBlock. | 135 // FIXME: This is not in sync with containingBlock. |
| 151 return isRootLayer() || renderer()->isPositioned() || renderer()->hasTra
nsform(); | 136 return isRootLayer() || renderer()->isPositioned() || renderer()->hasTra
nsform(); |
| 152 } | 137 } |
| 153 | 138 |
| 154 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 139 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&,
BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
| 155 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); | 140 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C
lipRect&); |
| 156 | 141 |
| 157 private: | |
| 158 // Bounding box in the coordinates of this layer. | 142 // Bounding box in the coordinates of this layer. |
| 159 LayoutRect logicalBoundingBox() const; | 143 LayoutRect logicalBoundingBox() const; |
| 160 | 144 |
| 161 void setNextSibling(RenderLayer* next) { m_next = next; } | 145 void setNextSibling(RenderLayer* next) { m_next = next; } |
| 162 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } | 146 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } |
| 163 void setFirstChild(RenderLayer* first) { m_first = first; } | 147 void setFirstChild(RenderLayer* first) { m_first = first; } |
| 164 void setLastChild(RenderLayer* last) { m_last = last; } | 148 void setLastChild(RenderLayer* last) { m_last = last; } |
| 165 | 149 |
| 166 bool shouldBeSelfPaintingLayer() const; | 150 bool shouldBeSelfPaintingLayer() const; |
| 167 | 151 |
| 168 void updateTransform(const RenderStyle* oldStyle, RenderStyle* newStyle); | |
| 169 | |
| 170 void dirty3DTransformedDescendantStatus(); | 152 void dirty3DTransformedDescendantStatus(); |
| 171 | 153 |
| 154 private: |
| 172 LayerType m_layerType; | 155 LayerType m_layerType; |
| 173 | 156 |
| 174 // Self-painting layer is an optimization where we avoid the heavy RenderLay
er painting | 157 // Self-painting layer is an optimization where we avoid the heavy RenderLay
er painting |
| 175 // machinery for a RenderLayer allocated only to handle the overflow clip ca
se. | 158 // machinery for a RenderLayer allocated only to handle the overflow clip ca
se. |
| 176 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. | 159 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. |
| 177 unsigned m_isSelfPaintingLayer : 1; | 160 unsigned m_isSelfPaintingLayer : 1; |
| 178 | 161 |
| 179 const unsigned m_isRootLayer : 1; | 162 const unsigned m_isRootLayer : 1; |
| 180 | 163 |
| 181 unsigned m_3DTransformedDescendantStatusDirty : 1; | 164 unsigned m_3DTransformedDescendantStatusDirty : 1; |
| 182 // Set on a stacking context layer that has 3D descendants anywhere | 165 // Set on a stacking context layer that has 3D descendants anywhere |
| 183 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. | 166 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. |
| 184 unsigned m_has3DTransformedDescendant : 1; | 167 unsigned m_has3DTransformedDescendant : 1; |
| 185 | 168 |
| 186 RenderBox* m_renderer; | 169 RenderBox* m_renderer; |
| 187 | 170 |
| 188 RenderLayer* m_parent; | 171 RenderLayer* m_parent; |
| 189 RenderLayer* m_previous; | 172 RenderLayer* m_previous; |
| 190 RenderLayer* m_next; | 173 RenderLayer* m_next; |
| 191 RenderLayer* m_first; | 174 RenderLayer* m_first; |
| 192 RenderLayer* m_last; | 175 RenderLayer* m_last; |
| 193 | 176 |
| 194 OwnPtr<TransformationMatrix> m_transform; | |
| 195 | |
| 196 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? | 177 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? |
| 197 OwnPtr<RenderLayerStackingNode> m_stackingNode; | 178 OwnPtr<RenderLayerStackingNode> m_stackingNode; |
| 198 }; | 179 }; |
| 199 | 180 |
| 200 } // namespace blink | 181 } // namespace blink |
| 201 | 182 |
| 202 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ | 183 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ |
| OLD | NEW |