| 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) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 if (treeScope->shouldCacheLabelsByForAttribute()) | 1251 if (treeScope->shouldCacheLabelsByForAttribute()) |
| 1252 updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom); | 1252 updateLabel(treeScope, fastGetAttribute(forAttr), nullAtom); |
| 1253 } | 1253 } |
| 1254 } | 1254 } |
| 1255 | 1255 |
| 1256 ContainerNode::removedFrom(insertionPoint); | 1256 ContainerNode::removedFrom(insertionPoint); |
| 1257 if (wasInDocument && hasPendingResources()) | 1257 if (wasInDocument && hasPendingResources()) |
| 1258 document()->accessSVGExtensions()->removeElementFromPendingResources(thi
s); | 1258 document()->accessSVGExtensions()->removeElementFromPendingResources(thi
s); |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 void Element::createRendererIfNeeded() | 1261 void Element::createRendererIfNeeded(const AttachContext& context) |
| 1262 { | 1262 { |
| 1263 NodeRenderingContext(this).createRendererForElementIfNeeded(); | 1263 NodeRenderingContext(this, context).createRendererForElementIfNeeded(); |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 void Element::attach() | 1266 void Element::attach(const AttachContext& context) |
| 1267 { | 1267 { |
| 1268 PostAttachCallbackDisabler callbackDisabler(this); | 1268 PostAttachCallbackDisabler callbackDisabler(this); |
| 1269 StyleResolverParentPusher parentPusher(this); | 1269 StyleResolverParentPusher parentPusher(this); |
| 1270 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 1270 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; |
| 1271 | 1271 |
| 1272 createRendererIfNeeded(); | 1272 createRendererIfNeeded(context); |
| 1273 | 1273 |
| 1274 if (parentElement() && parentElement()->isInCanvasSubtree()) | 1274 if (parentElement() && parentElement()->isInCanvasSubtree()) |
| 1275 setIsInCanvasSubtree(true); | 1275 setIsInCanvasSubtree(true); |
| 1276 | 1276 |
| 1277 createPseudoElementIfNeeded(BEFORE); | 1277 createPseudoElementIfNeeded(BEFORE); |
| 1278 | 1278 |
| 1279 // When a shadow root exists, it does the work of attaching the children. | 1279 // When a shadow root exists, it does the work of attaching the children. |
| 1280 if (ElementShadow* shadow = this->shadow()) { | 1280 if (ElementShadow* shadow = this->shadow()) { |
| 1281 parentPusher.push(); | 1281 parentPusher.push(); |
| 1282 shadow->attach(); | 1282 shadow->attach(); |
| 1283 } else if (firstChild()) | 1283 } else if (firstChild()) |
| 1284 parentPusher.push(); | 1284 parentPusher.push(); |
| 1285 | 1285 |
| 1286 ContainerNode::attach(); | 1286 ContainerNode::attach(context); |
| 1287 | 1287 |
| 1288 createPseudoElementIfNeeded(AFTER); | 1288 createPseudoElementIfNeeded(AFTER); |
| 1289 | 1289 |
| 1290 if (hasRareData()) { | 1290 if (hasRareData()) { |
| 1291 ElementRareData* data = elementRareData(); | 1291 ElementRareData* data = elementRareData(); |
| 1292 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { | 1292 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { |
| 1293 if (isFocusable() && document()->focusedNode() == this) | 1293 if (isFocusable() && document()->focusedNode() == this) |
| 1294 document()->updateFocusAppearanceSoon(false /* don't restore sel
ection */); | 1294 document()->updateFocusAppearanceSoon(false /* don't restore sel
ection */); |
| 1295 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); | 1295 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); |
| 1296 } | 1296 } |
| 1297 } | 1297 } |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 void Element::unregisterNamedFlowContentNode() | 1300 void Element::unregisterNamedFlowContentNode() |
| 1301 { | 1301 { |
| 1302 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
()->renderView()) | 1302 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
()->renderView()) |
| 1303 document()->renderView()->flowThreadController()->unregisterNamedFlowCon
tentNode(this); | 1303 document()->renderView()->flowThreadController()->unregisterNamedFlowCon
tentNode(this); |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 void Element::detach() | 1306 void Element::detach(const AttachContext& context) |
| 1307 { | 1307 { |
| 1308 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 1308 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; |
| 1309 unregisterNamedFlowContentNode(); | 1309 unregisterNamedFlowContentNode(); |
| 1310 cancelFocusAppearanceUpdate(); | 1310 cancelFocusAppearanceUpdate(); |
| 1311 if (hasRareData()) { | 1311 if (hasRareData()) { |
| 1312 ElementRareData* data = elementRareData(); | 1312 ElementRareData* data = elementRareData(); |
| 1313 data->setPseudoElement(BEFORE, 0); | 1313 data->setPseudoElement(BEFORE, 0); |
| 1314 data->setPseudoElement(AFTER, 0); | 1314 data->setPseudoElement(AFTER, 0); |
| 1315 data->setIsInCanvasSubtree(false); | 1315 data->setIsInCanvasSubtree(false); |
| 1316 data->resetComputedStyle(); | 1316 data->resetComputedStyle(); |
| 1317 data->resetDynamicRestyleObservations(); | 1317 data->resetDynamicRestyleObservations(); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 if (ElementShadow* shadow = this->shadow()) { | 1320 if (ElementShadow* shadow = this->shadow()) { |
| 1321 detachChildrenIfNeeded(); | 1321 detachChildrenIfNeeded(); |
| 1322 shadow->detach(); | 1322 shadow->detach(); |
| 1323 } | 1323 } |
| 1324 ContainerNode::detach(); | 1324 ContainerNode::detach(context); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
tyle* newStyle) | 1327 bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderS
tyle* newStyle) |
| 1328 { | 1328 { |
| 1329 ASSERT(currentStyle == renderStyle()); | 1329 ASSERT(currentStyle == renderStyle()); |
| 1330 ASSERT(renderer()); | 1330 ASSERT(renderer()); |
| 1331 | 1331 |
| 1332 if (!currentStyle) | 1332 if (!currentStyle) |
| 1333 return false; | 1333 return false; |
| 1334 | 1334 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 StyleChange localChange = Detach; | 1398 StyleChange localChange = Detach; |
| 1399 RefPtr<RenderStyle> newStyle; | 1399 RefPtr<RenderStyle> newStyle; |
| 1400 if (currentStyle) { | 1400 if (currentStyle) { |
| 1401 // FIXME: This still recalcs style twice when changing display types
, but saves | 1401 // FIXME: This still recalcs style twice when changing display types
, but saves |
| 1402 // us from recalcing twice when going from none -> anything else whi
ch is more | 1402 // us from recalcing twice when going from none -> anything else whi
ch is more |
| 1403 // common, especially during lazy attach. | 1403 // common, especially during lazy attach. |
| 1404 newStyle = styleForRenderer(childIndex); | 1404 newStyle = styleForRenderer(childIndex); |
| 1405 localChange = Node::diff(currentStyle.get(), newStyle.get(), documen
t()); | 1405 localChange = Node::diff(currentStyle.get(), newStyle.get(), documen
t()); |
| 1406 } | 1406 } |
| 1407 if (localChange == Detach) { | 1407 if (localChange == Detach) { |
| 1408 // FIXME: The style gets computed twice by calling attach. We could
do better if we passed the style along. | 1408 AttachContext reattachContext; |
| 1409 reattach(); | 1409 reattachContext.resolvedStyle = newStyle.get(); |
| 1410 reattach(reattachContext); |
| 1411 |
| 1410 // attach recalculates the style for all children. No need to do it
twice. | 1412 // attach recalculates the style for all children. No need to do it
twice. |
| 1411 clearNeedsStyleRecalc(); | 1413 clearNeedsStyleRecalc(); |
| 1412 clearChildNeedsStyleRecalc(); | 1414 clearChildNeedsStyleRecalc(); |
| 1413 | 1415 |
| 1414 if (hasCustomStyleCallbacks()) | 1416 if (hasCustomStyleCallbacks()) |
| 1415 didRecalcStyle(change); | 1417 didRecalcStyle(change); |
| 1416 return; | 1418 return; |
| 1417 } | 1419 } |
| 1418 | 1420 |
| 1419 if (RenderObject* renderer = this->renderer()) { | 1421 if (RenderObject* renderer = this->renderer()) { |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3128 return 0; | 3130 return 0; |
| 3129 } | 3131 } |
| 3130 | 3132 |
| 3131 Attribute* UniqueElementData::attributeItem(unsigned index) | 3133 Attribute* UniqueElementData::attributeItem(unsigned index) |
| 3132 { | 3134 { |
| 3133 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3135 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
| 3134 return &m_attributeVector.at(index); | 3136 return &m_attributeVector.at(index); |
| 3135 } | 3137 } |
| 3136 | 3138 |
| 3137 } // namespace WebCore | 3139 } // namespace WebCore |
| OLD | NEW |