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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1192 return selectionColor(CSSPropertyWebkitTextEmphasisColor); | 1192 return selectionColor(CSSPropertyWebkitTextEmphasisColor); |
| 1193 } | 1193 } |
| 1194 | 1194 |
| 1195 void RenderObject::selectionStartEnd(int& spos, int& epos) const | 1195 void RenderObject::selectionStartEnd(int& spos, int& epos) const |
| 1196 { | 1196 { |
| 1197 view()->selectionStartEnd(spos, epos); | 1197 view()->selectionStartEnd(spos, epos); |
| 1198 } | 1198 } |
| 1199 | 1199 |
| 1200 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const | 1200 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const |
| 1201 { | 1201 { |
| 1202 // If transform changed, and the layer does not paint into its own separate backing, then we need to invalidate paints. | 1202 // If transform, opacity or zIndex changed, then we need to invalidate paint s. |
| 1203 if (diff.transformChanged()) { | 1203 // Text nodes share style with their parents but transform/opacity/z-index d on't apply to them, |
| 1204 // Text nodes share style with their parents but transforms don't apply to them, | 1204 if (!isText() && |
|
ojan
2015/01/15 01:56:42
This is the same as the old code, except I merged
| |
| 1205 // hence the !isText() check. | 1205 (diff.transformChanged() || diff.opacityChanged() || diff.zIndexChanged( ))) { |
| 1206 if (!isText()) | 1206 diff.setNeedsPaintInvalidation(); |
| 1207 diff.setNeedsPaintInvalidationLayer(); | |
| 1208 } | 1207 } |
| 1209 | 1208 |
| 1210 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to invalidate paints (also | 1209 // If filter changed and it paints with filters, then we need to invalidate paints. |
| 1211 // ignoring text nodes) | 1210 if (diff.filterChanged() && hasLayer()) { |
| 1212 if (diff.opacityChanged() || diff.zIndexChanged()) { | 1211 diff.setNeedsPaintInvalidation(); |
| 1213 if (!isText()) | |
| 1214 diff.setNeedsPaintInvalidationLayer(); | |
| 1215 } | 1212 } |
| 1216 | 1213 |
| 1217 // If filter changed, and the layer does not paint into its own separate bac king or it paints with filters, then we need to invalidate paints. | |
| 1218 if (diff.filterChanged() && hasLayer()) { | |
| 1219 diff.setNeedsPaintInvalidationLayer(); | |
| 1220 } | |
| 1221 | |
| 1222 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation() | |
|
ojan
2015/01/15 01:56:42
I believe we don't need this anymore. If text or c
| |
| 1223 && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()) | |
| 1224 diff.setNeedsPaintInvalidationObject(); | |
| 1225 | |
| 1226 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual | 1214 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual |
| 1227 // style changing, since it depends on whether we decide to composite these elements. When the | 1215 // style changing, since it depends on whether we decide to composite these elements. When the |
| 1228 // layer status of one of these elements changes, we need to force a layout. | 1216 // layer status of one of these elements changes, we need to force a layout. |
| 1229 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { | 1217 if (!diff.needsFullLayout() && style() && isLayerModelObject()) { |
| 1230 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; | 1218 bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer; |
| 1231 if (hasLayer() != requiresLayer) | 1219 if (hasLayer() != requiresLayer) |
| 1232 diff.setNeedsFullLayout(); | 1220 diff.setNeedsFullLayout(); |
| 1233 } | 1221 } |
| 1234 | 1222 |
| 1235 // If we have no layer(), just treat a PaintInvalidationLayer hint as a norm al paint invalidation. | |
| 1236 if (diff.needsPaintInvalidationLayer() && !hasLayer()) { | |
| 1237 diff.clearNeedsPaintInvalidation(); | |
| 1238 diff.setNeedsPaintInvalidationObject(); | |
| 1239 } | |
| 1240 | |
| 1241 return diff; | 1223 return diff; |
| 1242 } | 1224 } |
| 1243 | 1225 |
| 1244 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const | 1226 inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependen tOnColor() const |
| 1245 { | 1227 { |
| 1246 if (style()->hasBorder() || style()->hasOutline()) | 1228 if (style()->hasBorder() || style()->hasOutline()) |
| 1247 return true; | 1229 return true; |
| 1248 for (const RenderObject* r = slowFirstChild(); r; r = r->nextSibling()) { | 1230 for (const RenderObject* r = slowFirstChild(); r; r = r->nextSibling()) { |
| 1249 if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace()) | 1231 if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace()) |
| 1250 return true; | 1232 return true; |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2120 { | 2102 { |
| 2121 if (object1) { | 2103 if (object1) { |
| 2122 const blink::RenderObject* root = object1; | 2104 const blink::RenderObject* root = object1; |
| 2123 while (root->parent()) | 2105 while (root->parent()) |
| 2124 root = root->parent(); | 2106 root = root->parent(); |
| 2125 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 2107 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 2126 } | 2108 } |
| 2127 } | 2109 } |
| 2128 | 2110 |
| 2129 #endif | 2111 #endif |
| OLD | NEW |