| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 bool RenderBoxModelObject::s_wasFloating = false; | 43 bool RenderBoxModelObject::s_wasFloating = false; |
| 44 | 44 |
| 45 RenderBoxModelObject::RenderBoxModelObject(Node* node) | 45 RenderBoxModelObject::RenderBoxModelObject(Node* node) |
| 46 : RenderObject(node) | 46 : RenderObject(node) |
| 47 , m_layer(0) | 47 , m_layer(0) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 RenderBoxModelObject::~RenderBoxModelObject() | 51 RenderBoxModelObject::~RenderBoxModelObject() |
| 52 { | 52 { |
| 53 // Our layer should have been destroyed and cleared by now |
| 54 ASSERT(!hasLayer()); |
| 55 ASSERT(!m_layer); |
| 56 } |
| 57 |
| 58 void RenderBoxModelObject::destroyLayer() |
| 59 { |
| 60 ASSERT(hasLayer()); |
| 61 ASSERT(m_layer); |
| 62 m_layer->destroy(renderArena()); |
| 63 m_layer = 0; |
| 64 setHasLayer(false); |
| 53 } | 65 } |
| 54 | 66 |
| 55 void RenderBoxModelObject::destroy() | 67 void RenderBoxModelObject::destroy() |
| 56 { | 68 { |
| 57 // This must be done before we destroy the RenderObject. | 69 // This must be done before we destroy the RenderObject. |
| 58 if (m_layer) | 70 if (m_layer) |
| 59 m_layer->clearClipRects(); | 71 m_layer->clearClipRects(); |
| 72 |
| 73 // RenderObject::destroy calls back to destroyLayer() for layer destruction |
| 60 RenderObject::destroy(); | 74 RenderObject::destroy(); |
| 61 } | 75 } |
| 62 | 76 |
| 63 bool RenderBoxModelObject::hasSelfPaintingLayer() const | 77 bool RenderBoxModelObject::hasSelfPaintingLayer() const |
| 64 { | 78 { |
| 65 return m_layer && m_layer->isSelfPaintingLayer(); | 79 return m_layer && m_layer->isSelfPaintingLayer(); |
| 66 } | 80 } |
| 67 | 81 |
| 68 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty
le* newStyle) | 82 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty
le* newStyle) |
| 69 { | 83 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 93 if (!layer()) { | 107 if (!layer()) { |
| 94 if (s_wasFloating && isFloating()) | 108 if (s_wasFloating && isFloating()) |
| 95 setChildNeedsLayout(true); | 109 setChildNeedsLayout(true); |
| 96 m_layer = new (renderArena()) RenderLayer(this); | 110 m_layer = new (renderArena()) RenderLayer(this); |
| 97 setHasLayer(true); | 111 setHasLayer(true); |
| 98 m_layer->insertOnlyThisLayer(); | 112 m_layer->insertOnlyThisLayer(); |
| 99 if (parent() && !needsLayout() && containingBlock()) | 113 if (parent() && !needsLayout() && containingBlock()) |
| 100 m_layer->updateLayerPositions(); | 114 m_layer->updateLayerPositions(); |
| 101 } | 115 } |
| 102 } else if (layer() && layer()->parent()) { | 116 } else if (layer() && layer()->parent()) { |
| 103 | |
| 104 RenderLayer* layer = m_layer; | |
| 105 m_layer = 0; | |
| 106 setHasLayer(false); | |
| 107 setHasTransform(false); // Either a transform wasn't specified or the ob
ject doesn't support transforms, so just null out the bit. | 117 setHasTransform(false); // Either a transform wasn't specified or the ob
ject doesn't support transforms, so just null out the bit. |
| 108 setHasReflection(false); | 118 setHasReflection(false); |
| 109 layer->removeOnlyThisLayer(); | 119 m_layer->removeOnlyThisLayer(); // calls destroyLayer() which clears m_l
ayer |
| 110 if (s_wasFloating && isFloating()) | 120 if (s_wasFloating && isFloating()) |
| 111 setChildNeedsLayout(true); | 121 setChildNeedsLayout(true); |
| 112 } | 122 } |
| 113 | 123 |
| 114 if (m_layer) | 124 if (m_layer) |
| 115 m_layer->styleChanged(diff, oldStyle); | 125 m_layer->styleChanged(diff, oldStyle); |
| 116 } | 126 } |
| 117 | 127 |
| 118 void RenderBoxModelObject::updateBoxModelInfoFromStyle() | 128 void RenderBoxModelObject::updateBoxModelInfoFromStyle() |
| 119 { | 129 { |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 context->restore(); | 1111 context->restore(); |
| 1102 } | 1112 } |
| 1103 } | 1113 } |
| 1104 | 1114 |
| 1105 int RenderBoxModelObject::containingBlockWidthForContent() const | 1115 int RenderBoxModelObject::containingBlockWidthForContent() const |
| 1106 { | 1116 { |
| 1107 return containingBlock()->availableWidth(); | 1117 return containingBlock()->availableWidth(); |
| 1108 } | 1118 } |
| 1109 | 1119 |
| 1110 } // namespace WebCore | 1120 } // namespace WebCore |
| OLD | NEW |