| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 , m_compositingReasons(CompositingReasonNone) | 146 , m_compositingReasons(CompositingReasonNone) |
| 147 , m_groupedMapping(0) | 147 , m_groupedMapping(0) |
| 148 , m_repainter(*renderer) | 148 , m_repainter(*renderer) |
| 149 , m_clipper(*renderer) | 149 , m_clipper(*renderer) |
| 150 , m_blendInfo(*renderer) | 150 , m_blendInfo(*renderer) |
| 151 { | 151 { |
| 152 updateStackingNode(); | 152 updateStackingNode(); |
| 153 | 153 |
| 154 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 154 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
| 155 | 155 |
| 156 if (!renderer->firstChild() && renderer->style()) { | 156 if (!renderer->slowFirstChild() && renderer->style()) { |
| 157 m_visibleContentStatusDirty = false; | 157 m_visibleContentStatusDirty = false; |
| 158 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; | 158 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; |
| 159 } | 159 } |
| 160 | 160 |
| 161 updateScrollableArea(); | 161 updateScrollableArea(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 RenderLayer::~RenderLayer() | 164 RenderLayer::~RenderLayer() |
| 165 { | 165 { |
| 166 if (!m_renderer->documentBeingDestroyed()) | 166 if (!m_renderer->documentBeingDestroyed()) |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 ancestor->setHasUnclippedDescendant(true); | 791 ancestor->setHasUnclippedDescendant(true); |
| 792 } | 792 } |
| 793 } | 793 } |
| 794 | 794 |
| 795 // FIXME: this is quite brute-force. We could be more efficient if we were to | 795 // FIXME: this is quite brute-force. We could be more efficient if we were to |
| 796 // track state and update it as appropriate as changes are made in the Render tr
ee. | 796 // track state and update it as appropriate as changes are made in the Render tr
ee. |
| 797 void RenderLayer::updateScrollingStateAfterCompositingChange() | 797 void RenderLayer::updateScrollingStateAfterCompositingChange() |
| 798 { | 798 { |
| 799 TRACE_EVENT0("blink_rendering", "RenderLayer::updateScrollingStateAfterCompo
sitingChange"); | 799 TRACE_EVENT0("blink_rendering", "RenderLayer::updateScrollingStateAfterCompo
sitingChange"); |
| 800 m_hasVisibleNonLayerContent = false; | 800 m_hasVisibleNonLayerContent = false; |
| 801 for (RenderObject* r = renderer()->firstChild(); r; r = r->nextSibling()) { | 801 for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { |
| 802 if (!r->hasLayer()) { | 802 if (!r->hasLayer()) { |
| 803 m_hasVisibleNonLayerContent = true; | 803 m_hasVisibleNonLayerContent = true; |
| 804 break; | 804 break; |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 | 807 |
| 808 m_hasNonCompositedChild = false; | 808 m_hasNonCompositedChild = false; |
| 809 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ | 809 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 810 if (child->compositingState() == NotComposited) { | 810 if (child->compositingState() == NotComposited) { |
| 811 m_hasNonCompositedChild = true; | 811 m_hasNonCompositedChild = true; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 m_blendInfo.setChildLayerHasBlendModeStatusDirty(false); | 863 m_blendInfo.setChildLayerHasBlendModeStatusDirty(false); |
| 864 } | 864 } |
| 865 | 865 |
| 866 if (m_visibleContentStatusDirty) { | 866 if (m_visibleContentStatusDirty) { |
| 867 bool previouslyHasVisibleContent = m_hasVisibleContent; | 867 bool previouslyHasVisibleContent = m_hasVisibleContent; |
| 868 if (renderer()->style()->visibility() == VISIBLE) | 868 if (renderer()->style()->visibility() == VISIBLE) |
| 869 m_hasVisibleContent = true; | 869 m_hasVisibleContent = true; |
| 870 else { | 870 else { |
| 871 // layer may be hidden but still have some visible content, check fo
r this | 871 // layer may be hidden but still have some visible content, check fo
r this |
| 872 m_hasVisibleContent = false; | 872 m_hasVisibleContent = false; |
| 873 RenderObject* r = renderer()->firstChild(); | 873 RenderObject* r = renderer()->slowFirstChild(); |
| 874 while (r) { | 874 while (r) { |
| 875 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 875 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
| 876 m_hasVisibleContent = true; | 876 m_hasVisibleContent = true; |
| 877 break; | 877 break; |
| 878 } | 878 } |
| 879 if (r->firstChild() && !r->hasLayer()) | 879 RenderObject* rendererFirstChild = r->slowFirstChild(); |
| 880 r = r->firstChild(); | 880 if (rendererFirstChild && !r->hasLayer()) |
| 881 r = rendererFirstChild; |
| 881 else if (r->nextSibling()) | 882 else if (r->nextSibling()) |
| 882 r = r->nextSibling(); | 883 r = r->nextSibling(); |
| 883 else { | 884 else { |
| 884 do { | 885 do { |
| 885 r = r->parent(); | 886 r = r->parent(); |
| 886 if (r == renderer()) | 887 if (r == renderer()) |
| 887 r = 0; | 888 r = 0; |
| 888 } while (r && !r->nextSibling()); | 889 } while (r && !r->nextSibling()); |
| 889 if (r) | 890 if (r) |
| 890 r = r->nextSibling(); | 891 r = r->nextSibling(); |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 if (!m_parent && renderer()->parent()) { | 1543 if (!m_parent && renderer()->parent()) { |
| 1543 // We need to connect ourselves when our renderer() has a parent. | 1544 // We need to connect ourselves when our renderer() has a parent. |
| 1544 // Find our enclosingLayer and add ourselves. | 1545 // Find our enclosingLayer and add ourselves. |
| 1545 RenderLayer* parentLayer = renderer()->parent()->enclosingLayer(); | 1546 RenderLayer* parentLayer = renderer()->parent()->enclosingLayer(); |
| 1546 ASSERT(parentLayer); | 1547 ASSERT(parentLayer); |
| 1547 RenderLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer
->reflectionInfo()->reflectionLayer() != this ? renderer()->parent()->findNextLa
yer(parentLayer, renderer()) : 0; | 1548 RenderLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer
->reflectionInfo()->reflectionLayer() != this ? renderer()->parent()->findNextLa
yer(parentLayer, renderer()) : 0; |
| 1548 parentLayer->addChild(this, beforeChild); | 1549 parentLayer->addChild(this, beforeChild); |
| 1549 } | 1550 } |
| 1550 | 1551 |
| 1551 // Remove all descendant layers from the hierarchy and add them to the new p
osition. | 1552 // Remove all descendant layers from the hierarchy and add them to the new p
osition. |
| 1552 for (RenderObject* curr = renderer()->firstChild(); curr; curr = curr->nextS
ibling()) | 1553 for (RenderObject* curr = renderer()->slowFirstChild(); curr; curr = curr->n
extSibling()) |
| 1553 curr->moveLayers(m_parent, this); | 1554 curr->moveLayers(m_parent, this); |
| 1554 | 1555 |
| 1555 // Clear out all the clip rects. | 1556 // Clear out all the clip rects. |
| 1556 m_clipper.clearClipRectsIncludingDescendants(); | 1557 m_clipper.clearClipRectsIncludingDescendants(); |
| 1557 } | 1558 } |
| 1558 | 1559 |
| 1559 // Returns the layer reached on the walk up towards the ancestor. | 1560 // Returns the layer reached on the walk up towards the ancestor. |
| 1560 static inline const RenderLayer* accumulateOffsetTowardsAncestor(const RenderLay
er* layer, const RenderLayer* ancestorLayer, LayoutPoint& location) | 1561 static inline const RenderLayer* accumulateOffsetTowardsAncestor(const RenderLay
er* layer, const RenderLayer* ancestorLayer, LayoutPoint& location) |
| 1561 { | 1562 { |
| 1562 ASSERT(ancestorLayer != layer); | 1563 ASSERT(ancestorLayer != layer); |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3310 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top | 3311 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top |
| 3311 // overflow, we have to create a bounding box that will extend to include th
is overflow. | 3312 // overflow, we have to create a bounding box that will extend to include th
is overflow. |
| 3312 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats | 3313 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats |
| 3313 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those | 3314 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those |
| 3314 // floats. | 3315 // floats. |
| 3315 LayoutRect result; | 3316 LayoutRect result; |
| 3316 if (renderer()->isInline() && renderer()->isRenderInline()) { | 3317 if (renderer()->isInline() && renderer()->isRenderInline()) { |
| 3317 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); | 3318 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); |
| 3318 } else if (renderer()->isTableRow()) { | 3319 } else if (renderer()->isTableRow()) { |
| 3319 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. | 3320 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. |
| 3320 for (RenderObject* child = renderer()->firstChild(); child; child = chil
d->nextSibling()) { | 3321 for (RenderObject* child = renderer()->slowFirstChild(); child; child =
child->nextSibling()) { |
| 3321 if (child->isTableCell()) { | 3322 if (child->isTableCell()) { |
| 3322 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); | 3323 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); |
| 3323 result.unite(bbox); | 3324 result.unite(bbox); |
| 3324 LayoutRect overflowRect = renderBox()->visualOverflowRect(); | 3325 LayoutRect overflowRect = renderBox()->visualOverflowRect(); |
| 3325 if (bbox != overflowRect) | 3326 if (bbox != overflowRect) |
| 3326 result.unite(overflowRect); | 3327 result.unite(overflowRect); |
| 3327 } | 3328 } |
| 3328 } | 3329 } |
| 3329 } else { | 3330 } else { |
| 3330 RenderBox* box = renderBox(); | 3331 RenderBox* box = renderBox(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3644 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 3645 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 3645 } | 3646 } |
| 3646 | 3647 |
| 3647 bool RenderLayer::hasNonEmptyChildRenderers() const | 3648 bool RenderLayer::hasNonEmptyChildRenderers() const |
| 3648 { | 3649 { |
| 3649 // Some HTML can cause whitespace text nodes to have renderers, like: | 3650 // Some HTML can cause whitespace text nodes to have renderers, like: |
| 3650 // <div> | 3651 // <div> |
| 3651 // <img src=...> | 3652 // <img src=...> |
| 3652 // </div> | 3653 // </div> |
| 3653 // so test for 0x0 RenderTexts here | 3654 // so test for 0x0 RenderTexts here |
| 3654 for (RenderObject* child = renderer()->firstChild(); child; child = child->n
extSibling()) { | 3655 for (RenderObject* child = renderer()->slowFirstChild(); child; child = chil
d->nextSibling()) { |
| 3655 if (!child->hasLayer()) { | 3656 if (!child->hasLayer()) { |
| 3656 if (child->isRenderInline() || !child->isBox()) | 3657 if (child->isRenderInline() || !child->isBox()) |
| 3657 return true; | 3658 return true; |
| 3658 | 3659 |
| 3659 if (toRenderBox(child)->width() > 0 || toRenderBox(child)->height()
> 0) | 3660 if (toRenderBox(child)->width() > 0 || toRenderBox(child)->height()
> 0) |
| 3660 return true; | 3661 return true; |
| 3661 } | 3662 } |
| 3662 } | 3663 } |
| 3663 return false; | 3664 return false; |
| 3664 } | 3665 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4020 } | 4021 } |
| 4021 } | 4022 } |
| 4022 | 4023 |
| 4023 void showLayerTree(const WebCore::RenderObject* renderer) | 4024 void showLayerTree(const WebCore::RenderObject* renderer) |
| 4024 { | 4025 { |
| 4025 if (!renderer) | 4026 if (!renderer) |
| 4026 return; | 4027 return; |
| 4027 showLayerTree(renderer->enclosingLayer()); | 4028 showLayerTree(renderer->enclosingLayer()); |
| 4028 } | 4029 } |
| 4029 #endif | 4030 #endif |
| OLD | NEW |