| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // introduction of satellite objects: PaintLayer*. Those helper objects then | 202 // introduction of satellite objects: PaintLayer*. Those helper objects then |
| 203 // need to be moved to the appropriate LayoutObject class, probably to a rare | 203 // need to be moved to the appropriate LayoutObject class, probably to a rare |
| 204 // data field to avoid growing all the LayoutObjects. | 204 // data field to avoid growing all the LayoutObjects. |
| 205 // | 205 // |
| 206 // A good example of this is PaintLayerScrollableArea, which can only happen | 206 // A good example of this is PaintLayerScrollableArea, which can only happen |
| 207 // be instanciated for LayoutBoxes. With the current design, it's hard to know | 207 // be instanciated for LayoutBoxes. With the current design, it's hard to know |
| 208 // that by reading the code. | 208 // that by reading the code. |
| 209 class CORE_EXPORT PaintLayer : public DisplayItemClient { | 209 class CORE_EXPORT PaintLayer : public DisplayItemClient { |
| 210 WTF_MAKE_NONCOPYABLE(PaintLayer); | 210 WTF_MAKE_NONCOPYABLE(PaintLayer); |
| 211 public: | 211 public: |
| 212 PaintLayer(LayoutBoxModelObject*, PaintLayerType); | 212 PaintLayer(LayoutBoxModelObject*); |
| 213 ~PaintLayer() override; | 213 ~PaintLayer() override; |
| 214 | 214 |
| 215 // DisplayItemClient methods | 215 // DisplayItemClient methods |
| 216 String debugName() const final; | 216 String debugName() const final; |
| 217 LayoutRect visualRect() const final; | 217 LayoutRect visualRect() const final; |
| 218 | 218 |
| 219 LayoutBoxModelObject* layoutObject() const { return m_layoutObject; } | 219 LayoutBoxModelObject* layoutObject() const { return m_layoutObject; } |
| 220 LayoutBox* layoutBox() const { return m_layoutObject && m_layoutObject->isBo
x() ? toLayoutBox(m_layoutObject) : 0; } | 220 LayoutBox* layoutBox() const { return m_layoutObject && m_layoutObject->isBo
x() ? toLayoutBox(m_layoutObject) : 0; } |
| 221 PaintLayer* parent() const { return m_parent; } | 221 PaintLayer* parent() const { return m_parent; } |
| 222 PaintLayer* previousSibling() const { return m_previous; } | 222 PaintLayer* previousSibling() const { return m_previous; } |
| 223 PaintLayer* nextSibling() const { return m_next; } | 223 PaintLayer* nextSibling() const { return m_next; } |
| 224 PaintLayer* firstChild() const { return m_first; } | 224 PaintLayer* firstChild() const { return m_first; } |
| 225 PaintLayer* lastChild() const { return m_last; } | 225 PaintLayer* lastChild() const { return m_last; } |
| 226 | 226 |
| 227 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be g
ood but | 227 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be g
ood but |
| 228 // we can't use it for now because it conflicts with PaintInfo::paintContain
er. | 228 // we can't use it for now because it conflicts with PaintInfo::paintContain
er. |
| 229 PaintLayer* compositingContainer() const; | 229 PaintLayer* compositingContainer() const; |
| 230 | 230 |
| 231 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0); | 231 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0); |
| 232 PaintLayer* removeChild(PaintLayer*); | 232 PaintLayer* removeChild(PaintLayer*); |
| 233 | 233 |
| 234 void removeOnlyThisLayerAfterStyleChange(); | 234 void removeOnlyThisLayerAfterStyleChange(); |
| 235 void insertOnlyThisLayerAfterStyleChange(); | 235 void insertOnlyThisLayerAfterStyleChange(); |
| 236 | 236 |
| 237 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); | 237 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); |
| 238 | 238 |
| 239 // FIXME: Many people call this function while it has out-of-date informatio
n. | 239 // FIXME: Many people call this function while it has out-of-date informatio
n. |
| 240 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } | 240 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } |
| 241 | 241 |
| 242 void setLayerType(PaintLayerType layerType) { m_layerType = layerType; ASSER
T(static_cast<PaintLayerType>(m_layerType) == layerType); } | |
| 243 | |
| 244 bool isTransparent() const { return layoutObject()->isTransparent() || layou
tObject()->style()->hasBlendMode() || layoutObject()->hasMask(); } | 242 bool isTransparent() const { return layoutObject()->isTransparent() || layou
tObject()->style()->hasBlendMode() || layoutObject()->hasMask(); } |
| 245 | 243 |
| 246 bool isReflection() const { return layoutObject()->isReplica(); } | 244 bool isReflection() const { return layoutObject()->isReplica(); } |
| 247 PaintLayerReflectionInfo* reflectionInfo() { return m_rareData ? m_rareData-
>reflectionInfo.get() : nullptr; } | 245 PaintLayerReflectionInfo* reflectionInfo() { return m_rareData ? m_rareData-
>reflectionInfo.get() : nullptr; } |
| 248 const PaintLayerReflectionInfo* reflectionInfo() const { return const_cast<P
aintLayer*>(this)->reflectionInfo(); } | 246 const PaintLayerReflectionInfo* reflectionInfo() const { return const_cast<P
aintLayer*>(this)->reflectionInfo(); } |
| 249 | 247 |
| 250 const PaintLayer* root() const | 248 const PaintLayer* root() const |
| 251 { | 249 { |
| 252 const PaintLayer* curr = this; | 250 const PaintLayer* curr = this; |
| 253 while (curr->parent()) | 251 while (curr->parent()) |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 return *m_rareData; | 777 return *m_rareData; |
| 780 } | 778 } |
| 781 | 779 |
| 782 void mergeNeedsPaintPhaseFlagsFrom(const PaintLayer& layer) | 780 void mergeNeedsPaintPhaseFlagsFrom(const PaintLayer& layer) |
| 783 { | 781 { |
| 784 m_needsPaintPhaseDescendantOutlines |= layer.m_needsPaintPhaseDescendant
Outlines; | 782 m_needsPaintPhaseDescendantOutlines |= layer.m_needsPaintPhaseDescendant
Outlines; |
| 785 m_needsPaintPhaseFloat |= layer.m_needsPaintPhaseFloat; | 783 m_needsPaintPhaseFloat |= layer.m_needsPaintPhaseFloat; |
| 786 m_needsPaintPhaseDescendantBlockBackgrounds |= layer.m_needsPaintPhaseDe
scendantBlockBackgrounds; | 784 m_needsPaintPhaseDescendantBlockBackgrounds |= layer.m_needsPaintPhaseDe
scendantBlockBackgrounds; |
| 787 } | 785 } |
| 788 | 786 |
| 789 unsigned m_layerType : 2; // PaintLayerType | |
| 790 | |
| 791 // Self-painting layer is an optimization where we avoid the heavy Layer pai
nting | 787 // Self-painting layer is an optimization where we avoid the heavy Layer pai
nting |
| 792 // machinery for a Layer allocated only to handle the overflow clip case. | 788 // machinery for a Layer allocated only to handle the overflow clip case. |
| 793 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. | 789 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov
erflow-only concept. |
| 794 unsigned m_isSelfPaintingLayer : 1; | 790 unsigned m_isSelfPaintingLayer : 1; |
| 795 | 791 |
| 796 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to | 792 // If have no self-painting descendants, we don't have to walk our children
during painting. This can lead to |
| 797 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). | 793 // significant savings, especially if the tree has lots of non-self-painting
layers grouped together (e.g. table cells). |
| 798 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; | 794 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; |
| 799 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; | 795 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; |
| 800 | 796 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 888 |
| 893 } // namespace blink | 889 } // namespace blink |
| 894 | 890 |
| 895 #ifndef NDEBUG | 891 #ifndef NDEBUG |
| 896 // Outside the WebCore namespace for ease of invocation from gdb. | 892 // Outside the WebCore namespace for ease of invocation from gdb. |
| 897 void showLayerTree(const blink::PaintLayer*); | 893 void showLayerTree(const blink::PaintLayer*); |
| 898 void showLayerTree(const blink::LayoutObject*); | 894 void showLayerTree(const blink::LayoutObject*); |
| 899 #endif | 895 #endif |
| 900 | 896 |
| 901 #endif // Layer_h | 897 #endif // Layer_h |
| OLD | NEW |