Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 void RenderLayerModelObject::styleWillChange(StyleDifference diff, const RenderS tyle& newStyle) | 91 void RenderLayerModelObject::styleWillChange(StyleDifference diff, const RenderS tyle& newStyle) |
| 92 { | 92 { |
| 93 s_wasFloating = isFloating(); | 93 s_wasFloating = isFloating(); |
| 94 | 94 |
| 95 // If our z-index changes value or our visibility changes, | 95 // If our z-index changes value or our visibility changes, |
| 96 // we need to dirty our stacking context's z-order list. | 96 // we need to dirty our stacking context's z-order list. |
| 97 RenderStyle* oldStyle = style(); | 97 RenderStyle* oldStyle = style(); |
| 98 if (oldStyle) { | 98 if (oldStyle) { |
| 99 // Do a repaint with the old style first through RenderLayerRepainter. | 99 // Do a repaint with the old style first through RenderLayerRepainter. |
| 100 // RenderObject::styleWillChange takes care of repainting objects withou t RenderLayers. | 100 // RenderObject::styleWillChange takes care of repainting objects withou t RenderLayers. |
| 101 if (parent() && diff == StyleDifferenceRepaintLayer) { | 101 if (parent() && diff.needsRepaintLayer()) { |
| 102 layer()->repainter().repaintIncludingNonCompositingDescendants(conta inerForRepaint()); | 102 layer()->repainter().repaintIncludingNonCompositingDescendants(conta inerForRepaint()); |
| 103 if (oldStyle->hasClip() != newStyle.hasClip() | 103 if (oldStyle->hasClip() != newStyle.hasClip() |
| 104 || oldStyle->clip() != newStyle.clip()) | 104 || oldStyle->clip() != newStyle.clip()) |
| 105 layer()->clipper().clearClipRectsIncludingDescendants(); | 105 layer()->clipper().clearClipRectsIncludingDescendants(); |
| 106 } | 106 } else if (!hasLayer() && diff.needsLayout() |
| 107 | 107 && (newStyle.hasTransform() || newStyle.opacity() < 1 || newStyle.ha sFilter())) { |
| 108 if (diff == StyleDifferenceLayout || diff == StyleDifferenceSimplifiedLa yout) { | 108 // If we don't have a layer yet, but we are going to get one because of transform or opacity, |
|
eseidel
2014/04/17 20:03:34
Presumably this is the behavior change, correct?
| |
| 109 // When a layout hint happens, we go ahead and do a repaint of the l ayer, since the layer could | 109 // then we need to repaint the old position of the object. |
| 110 // end up being destroyed. | 110 repaint(); |
| 111 if (hasLayer()) { | |
| 112 if (oldStyle->hasClip() != newStyle.hasClip() | |
| 113 || oldStyle->clip() != newStyle.clip()) { | |
| 114 // Composited layers don't need to be repainted when a paren t's clip changes. | |
| 115 layer()->repainter().repaintIncludingNonCompositingDescendan ts(containerForRepaint()); | |
| 116 } else if (!layer()->hasCompositedLayerMapping()) { | |
| 117 if (oldStyle->position() != newStyle.position() | |
| 118 || oldStyle->zIndex() != newStyle.zIndex() | |
| 119 || oldStyle->hasAutoZIndex() != newStyle.hasAutoZIndex() | |
| 120 || oldStyle->opacity() != newStyle.opacity() | |
| 121 || oldStyle->transform() != newStyle.transform() | |
| 122 || oldStyle->filter() != newStyle.filter()) | |
| 123 layer()->repainter().repaintIncludingNonCompositingDesce ndants(containerForRepaint()); | |
| 124 } | |
| 125 } else if (newStyle.hasTransform() || newStyle.opacity() < 1 || newS tyle.hasFilter()) { | |
| 126 // If we don't have a layer yet, but we are going to get one bec ause of transform or opacity, | |
| 127 // then we need to repaint the old position of the object. | |
| 128 repaint(); | |
| 129 } | |
| 130 } | 111 } |
| 131 } | 112 } |
| 132 | 113 |
| 133 RenderObject::styleWillChange(diff, newStyle); | 114 RenderObject::styleWillChange(diff, newStyle); |
| 134 } | 115 } |
| 135 | 116 |
| 136 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt yle* oldStyle) | 117 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderSt yle* oldStyle) |
| 137 { | 118 { |
| 138 bool hadTransform = hasTransform(); | 119 bool hadTransform = hasTransform(); |
| 139 bool hadLayer = hasLayer(); | 120 bool hadLayer = hasLayer(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 return m_layer ? m_layer->hasCompositedLayerMapping() : false; | 203 return m_layer ? m_layer->hasCompositedLayerMapping() : false; |
| 223 } | 204 } |
| 224 | 205 |
| 225 CompositedLayerMapping* RenderLayerModelObject::groupedMapping() const | 206 CompositedLayerMapping* RenderLayerModelObject::groupedMapping() const |
| 226 { | 207 { |
| 227 return m_layer ? m_layer->groupedMapping() : 0; | 208 return m_layer ? m_layer->groupedMapping() : 0; |
| 228 } | 209 } |
| 229 | 210 |
| 230 } // namespace WebCore | 211 } // namespace WebCore |
| 231 | 212 |
| OLD | NEW |