| 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 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. | 7 * Copyright (C) 2010, 2012 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/rendering/RenderLayerModelObject.h" | 26 #include "core/rendering/RenderLayerModelObject.h" |
| 27 | 27 |
| 28 #include "core/frame/LocalFrame.h" | 28 #include "core/frame/LocalFrame.h" |
| 29 #include "core/rendering/RenderLayer.h" | 29 #include "core/rendering/RenderLayer.h" |
| 30 #include "core/rendering/RenderView.h" | 30 #include "core/rendering/RenderView.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 bool RenderLayerModelObject::s_wasFloating = false; | |
| 35 | |
| 36 RenderLayerModelObject::RenderLayerModelObject(ContainerNode* node) | 34 RenderLayerModelObject::RenderLayerModelObject(ContainerNode* node) |
| 37 : RenderObject(node) | 35 : RenderObject(node) |
| 38 { | 36 { |
| 39 } | 37 } |
| 40 | 38 |
| 41 RenderLayerModelObject::~RenderLayerModelObject() | 39 RenderLayerModelObject::~RenderLayerModelObject() |
| 42 { | 40 { |
| 43 // Our layer should have been destroyed and cleared by now | 41 // Our layer should have been destroyed and cleared by now |
| 44 ASSERT(!hasLayer()); | 42 ASSERT(!hasLayer()); |
| 45 ASSERT(!m_layer); | 43 ASSERT(!m_layer); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 70 } | 68 } |
| 71 | 69 |
| 72 void RenderLayerModelObject::willBeDestroyed() | 70 void RenderLayerModelObject::willBeDestroyed() |
| 73 { | 71 { |
| 74 RenderObject::willBeDestroyed(); | 72 RenderObject::willBeDestroyed(); |
| 75 destroyLayer(); | 73 destroyLayer(); |
| 76 } | 74 } |
| 77 | 75 |
| 78 void RenderLayerModelObject::styleWillChange(StyleDifference diff, const RenderS
tyle& newStyle) | 76 void RenderLayerModelObject::styleWillChange(StyleDifference diff, const RenderS
tyle& newStyle) |
| 79 { | 77 { |
| 80 s_wasFloating = isFloating(); | |
| 81 | |
| 82 if (RenderStyle* oldStyle = style()) { | 78 if (RenderStyle* oldStyle = style()) { |
| 83 if (parent() && diff.needsPaintInvalidationLayer()) { | 79 if (parent() && diff.needsPaintInvalidationLayer()) { |
| 84 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() | 80 if (oldStyle->hasAutoClip() != newStyle.hasAutoClip() |
| 85 || oldStyle->clip() != newStyle.clip()) | 81 || oldStyle->clip() != newStyle.clip()) |
| 86 layer()->clipper().clearClipRectsIncludingDescendants(); | 82 layer()->clipper().clearClipRectsIncludingDescendants(); |
| 87 } | 83 } |
| 88 } | 84 } |
| 89 | 85 |
| 90 RenderObject::styleWillChange(diff, newStyle); | 86 RenderObject::styleWillChange(diff, newStyle); |
| 91 } | 87 } |
| 92 | 88 |
| 93 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) | 89 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt
yle* oldStyle) |
| 94 { | 90 { |
| 95 bool hadTransform = hasTransform(); | 91 bool hadTransform = hasTransform(); |
| 96 | 92 |
| 97 RenderObject::styleDidChange(diff, oldStyle); | 93 RenderObject::styleDidChange(diff, oldStyle); |
| 98 updateFromStyle(); | 94 updateFromStyle(); |
| 99 | 95 |
| 100 LayerType type = layerTypeRequired(); | 96 LayerType type = layerTypeRequired(); |
| 101 if (type != NoLayer) { | 97 if (type != NoLayer) { |
| 102 if (!layer()) { | 98 if (!layer()) { |
| 103 if (s_wasFloating && isFloating()) | |
| 104 setChildNeedsLayout(); | |
| 105 createLayer(type); | 99 createLayer(type); |
| 106 if (parent() && !needsLayout()) { | 100 if (parent() && !needsLayout()) { |
| 107 // FIXME: This invalidation is overly broad. We should update to | 101 // FIXME: This invalidation is overly broad. We should update to |
| 108 // do the correct invalidation at RenderStyle::diff time. crbug.
com/349061 | 102 // do the correct invalidation at RenderStyle::diff time. crbug.
com/349061 |
| 109 layer()->renderer()->setShouldDoFullPaintInvalidation(true); | 103 layer()->renderer()->setShouldDoFullPaintInvalidation(true); |
| 110 // FIXME: We should call a specialized version of this function. | 104 // FIXME: We should call a specialized version of this function. |
| 111 layer()->updateLayerPositionsAfterLayout(); | 105 layer()->updateLayerPositionsAfterLayout(); |
| 112 } | 106 } |
| 113 } | 107 } |
| 114 } else if (layer() && layer()->parent()) { | 108 } else if (layer() && layer()->parent()) { |
| 115 setHasTransform(false); // Either a transform wasn't specified or the ob
ject doesn't support transforms, so just null out the bit. | 109 setHasTransform(false); // Either a transform wasn't specified or the ob
ject doesn't support transforms, so just null out the bit. |
| 116 layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_l
ayer | 110 layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_l
ayer |
| 117 if (s_wasFloating && isFloating()) | |
| 118 setChildNeedsLayout(); | |
| 119 if (hadTransform) | 111 if (hadTransform) |
| 120 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 112 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 121 } | 113 } |
| 122 | 114 |
| 123 if (layer()) { | 115 if (layer()) { |
| 124 // FIXME: Ideally we shouldn't need this setter but we can't easily infe
r an overflow-only layer | 116 // FIXME: Ideally we shouldn't need this setter but we can't easily infe
r an overflow-only layer |
| 125 // from the style. | 117 // from the style. |
| 126 layer()->setLayerType(type); | 118 layer()->setLayerType(type); |
| 127 layer()->styleChanged(diff, oldStyle); | 119 layer()->styleChanged(diff, oldStyle); |
| 128 } | 120 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 InvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationState,
newPaintInvalidationContainer); | 169 InvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationState,
newPaintInvalidationContainer); |
| 178 | 170 |
| 179 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, new
PaintInvalidationContainer); | 171 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, new
PaintInvalidationContainer); |
| 180 if (reason == InvalidationLocationChange || reason == InvalidationFull) | 172 if (reason == InvalidationLocationChange || reason == InvalidationFull) |
| 181 childTreeWalkState.setForceCheckForPaintInvalidation(); | 173 childTreeWalkState.setForceCheckForPaintInvalidation(); |
| 182 RenderObject::invalidateTreeIfNeeded(childTreeWalkState); | 174 RenderObject::invalidateTreeIfNeeded(childTreeWalkState); |
| 183 } | 175 } |
| 184 | 176 |
| 185 } // namespace blink | 177 } // namespace blink |
| 186 | 178 |
| OLD | NEW |