| 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 30 matching lines...) Expand all Loading... |
| 41 * version of this file under any of the LGPL, the MPL or the GPL. | 41 * version of this file under any of the LGPL, the MPL or the GPL. |
| 42 */ | 42 */ |
| 43 | 43 |
| 44 #include "core/paint/PaintLayerStackingNode.h" | 44 #include "core/paint/PaintLayerStackingNode.h" |
| 45 | 45 |
| 46 #include "core/layout/LayoutMultiColumnFlowThread.h" | 46 #include "core/layout/LayoutMultiColumnFlowThread.h" |
| 47 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
| 48 #include "core/layout/compositing/PaintLayerCompositor.h" | 48 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 49 #include "core/paint/PaintLayer.h" | 49 #include "core/paint/PaintLayer.h" |
| 50 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
| 51 #include "wtf/PtrUtil.h" |
| 51 #include <algorithm> | 52 #include <algorithm> |
| 53 #include <memory> |
| 52 | 54 |
| 53 namespace blink { | 55 namespace blink { |
| 54 | 56 |
| 55 // FIXME: This should not require PaintLayer. There is currently a cycle where | 57 // FIXME: This should not require PaintLayer. There is currently a cycle where |
| 56 // in order to determine if we isStacked() we have to ask the paint | 58 // in order to determine if we isStacked() we have to ask the paint |
| 57 // layer about some of its state. | 59 // layer about some of its state. |
| 58 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer) | 60 PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer) |
| 59 : m_layer(layer) | 61 : m_layer(layer) |
| 60 #if ENABLE(ASSERT) | 62 #if ENABLE(ASSERT) |
| 61 , m_layerListMutationAllowed(true) | 63 , m_layerListMutationAllowed(true) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // If the viewport is paginated, everything (including "top-layer" eleme
nts) gets | 143 // If the viewport is paginated, everything (including "top-layer" eleme
nts) gets |
| 142 // redirected to the flow thread. So that's where we have to look, in th
at case. | 144 // redirected to the flow thread. So that's where we have to look, in th
at case. |
| 143 if (LayoutBlockFlow* multiColumnFlowThread = rootBlock->multiColumnFlowT
hread()) | 145 if (LayoutBlockFlow* multiColumnFlowThread = rootBlock->multiColumnFlowT
hread()) |
| 144 rootBlock = multiColumnFlowThread; | 146 rootBlock = multiColumnFlowThread; |
| 145 for (LayoutObject* child = rootBlock->firstChild(); child; child = child
->nextSibling()) { | 147 for (LayoutObject* child = rootBlock->firstChild(); child; child = child
->nextSibling()) { |
| 146 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; | 148 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; |
| 147 if (childElement && childElement->isInTopLayer()) { | 149 if (childElement && childElement->isInTopLayer()) { |
| 148 PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); | 150 PaintLayer* layer = toLayoutBoxModelObject(child)->layer(); |
| 149 // Create the buffer if it doesn't exist yet. | 151 // Create the buffer if it doesn't exist yet. |
| 150 if (!m_posZOrderList) | 152 if (!m_posZOrderList) |
| 151 m_posZOrderList = adoptPtr(new Vector<PaintLayerStackingNode
*>); | 153 m_posZOrderList = wrapUnique(new Vector<PaintLayerStackingNo
de*>); |
| 152 m_posZOrderList->append(layer->stackingNode()); | 154 m_posZOrderList->append(layer->stackingNode()); |
| 153 } | 155 } |
| 154 } | 156 } |
| 155 } | 157 } |
| 156 | 158 |
| 157 #if ENABLE(ASSERT) | 159 #if ENABLE(ASSERT) |
| 158 updateStackingParentForZOrderLists(this); | 160 updateStackingParentForZOrderLists(this); |
| 159 #endif | 161 #endif |
| 160 | 162 |
| 161 m_zOrderListsDirty = false; | 163 m_zOrderListsDirty = false; |
| 162 } | 164 } |
| 163 | 165 |
| 164 void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode*
>>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer) | 166 void PaintLayerStackingNode::collectLayers(std::unique_ptr<Vector<PaintLayerStac
kingNode*>>& posBuffer, std::unique_ptr<Vector<PaintLayerStackingNode*>>& negBuf
fer) |
| 165 { | 167 { |
| 166 if (layer()->isInTopLayer()) | 168 if (layer()->isInTopLayer()) |
| 167 return; | 169 return; |
| 168 | 170 |
| 169 if (isStacked()) { | 171 if (isStacked()) { |
| 170 OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posB
uffer : negBuffer; | 172 std::unique_ptr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >=
0) ? posBuffer : negBuffer; |
| 171 if (!buffer) | 173 if (!buffer) |
| 172 buffer = adoptPtr(new Vector<PaintLayerStackingNode*>); | 174 buffer = wrapUnique(new Vector<PaintLayerStackingNode*>); |
| 173 buffer->append(this); | 175 buffer->append(this); |
| 174 } | 176 } |
| 175 | 177 |
| 176 if (!isStackingContext()) { | 178 if (!isStackingContext()) { |
| 177 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne
xtSibling()) { | 179 for (PaintLayer* child = layer()->firstChild(); child; child = child->ne
xtSibling()) { |
| 178 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) | 180 if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflect
ionLayer() != child) |
| 179 child->stackingNode()->collectLayers(posBuffer, negBuffer); | 181 child->stackingNode()->collectLayers(posBuffer, negBuffer); |
| 180 } | 182 } |
| 181 } | 183 } |
| 182 } | 184 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 257 } |
| 256 return 0; | 258 return 0; |
| 257 } | 259 } |
| 258 | 260 |
| 259 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const | 261 LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const |
| 260 { | 262 { |
| 261 return m_layer->layoutObject(); | 263 return m_layer->layoutObject(); |
| 262 } | 264 } |
| 263 | 265 |
| 264 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |