| 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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 if (isUpgradedCustomElement()) | 1303 if (isUpgradedCustomElement()) |
| 1304 CustomElement::didLeaveDocument(this, insertionPoint->document()); | 1304 CustomElement::didLeaveDocument(this, insertionPoint->document()); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 if (hasRareData()) | 1307 if (hasRareData()) |
| 1308 elementRareData()->setIsInCanvasSubtree(false); | 1308 elementRareData()->setIsInCanvasSubtree(false); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 void Element::attach(const AttachContext& context) | 1311 void Element::attach(const AttachContext& context) |
| 1312 { | 1312 { |
| 1313 ASSERT(document().inStyleRecalc()); |
| 1314 |
| 1313 PostAttachCallbackDisabler callbackDisabler(this); | 1315 PostAttachCallbackDisabler callbackDisabler(this); |
| 1314 StyleResolverParentPusher parentPusher(this); | 1316 StyleResolverParentPusher parentPusher(this); |
| 1315 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 1317 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; |
| 1316 | 1318 |
| 1317 // We've already been through detach when doing a lazyAttach, but we might | 1319 // We've already been through detach when doing a lazyAttach, but we might |
| 1318 // need to clear any state that's been added since then. | 1320 // need to clear any state that's been added since then. |
| 1319 if (hasRareData() && styleChangeType() == LazyAttachStyleChange) { | 1321 if (hasRareData() && styleChangeType() == LazyAttachStyleChange) { |
| 1320 ElementRareData* data = elementRareData(); | 1322 ElementRareData* data = elementRareData(); |
| 1321 data->clearComputedStyle(); | 1323 data->clearComputedStyle(); |
| 1322 data->resetDynamicRestyleObservations(); | 1324 data->resetDynamicRestyleObservations(); |
| 1323 if (!context.resolvedStyle) | 1325 if (!context.resolvedStyle) |
| 1324 data->resetStyleState(); | 1326 data->resetStyleState(); |
| 1325 } | 1327 } |
| 1326 | 1328 |
| 1327 // FIXME: Remove this once we lazyAttach everywhere. | |
| 1328 if (!document().inStyleRecalc() && (this == document().documentElement() ||
this == document().body())) | |
| 1329 document().setNeedsStyleRecalc(LocalStyleChange); | |
| 1330 | |
| 1331 NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf
Needed(); | 1329 NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf
Needed(); |
| 1332 | 1330 |
| 1333 createPseudoElementIfNeeded(BEFORE); | 1331 createPseudoElementIfNeeded(BEFORE); |
| 1334 | 1332 |
| 1335 // When a shadow root exists, it does the work of attaching the children. | 1333 // When a shadow root exists, it does the work of attaching the children. |
| 1336 if (ElementShadow* shadow = this->shadow()) { | 1334 if (ElementShadow* shadow = this->shadow()) { |
| 1337 parentPusher.push(); | 1335 parentPusher.push(); |
| 1338 shadow->attach(context); | 1336 shadow->attach(context); |
| 1339 } else if (firstChild()) | 1337 } else if (firstChild()) |
| 1340 parentPusher.push(); | 1338 parentPusher.push(); |
| 1341 | 1339 |
| 1342 ContainerNode::attach(context); | 1340 ContainerNode::attach(context); |
| 1343 | 1341 |
| 1344 createPseudoElementIfNeeded(AFTER); | 1342 createPseudoElementIfNeeded(AFTER); |
| 1345 createPseudoElementIfNeeded(BACKDROP); | 1343 createPseudoElementIfNeeded(BACKDROP); |
| 1346 | 1344 |
| 1347 if (hasRareData()) { | 1345 if (hasRareData()) { |
| 1348 ElementRareData* data = elementRareData(); | 1346 ElementRareData* data = elementRareData(); |
| 1349 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { | 1347 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { |
| 1350 if (isFocusable() && document().focusedElement() == this) | 1348 if (isFocusable() && document().focusedElement() == this) |
| 1351 document().updateFocusAppearanceSoon(false /* don't restore sele
ction */); | 1349 document().updateFocusAppearanceSoon(false /* don't restore sele
ction */); |
| 1352 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); | 1350 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); |
| 1353 } | 1351 } |
| 1354 } | 1352 } |
| 1355 | 1353 |
| 1356 // FIXME: It doesn't appear safe to call didRecalculateStyleForElement when | 1354 InspectorInstrumentation::didRecalculateStyleForElement(this); |
| 1357 // not in a Document::recalcStyle. Since we're hopefully going to always | |
| 1358 // lazyAttach in the future that problem should go away. | |
| 1359 if (document().inStyleRecalc()) | |
| 1360 InspectorInstrumentation::didRecalculateStyleForElement(this); | |
| 1361 } | 1355 } |
| 1362 | 1356 |
| 1363 void Element::unregisterNamedFlowContentNode() | 1357 void Element::unregisterNamedFlowContentNode() |
| 1364 { | 1358 { |
| 1365 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
().renderView()) | 1359 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document
().renderView()) |
| 1366 document().renderView()->flowThreadController()->unregisterNamedFlowCont
entNode(this); | 1360 document().renderView()->flowThreadController()->unregisterNamedFlowCont
entNode(this); |
| 1367 } | 1361 } |
| 1368 | 1362 |
| 1369 void Element::detach(const AttachContext& context) | 1363 void Element::detach(const AttachContext& context) |
| 1370 { | 1364 { |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1759 void Element::removeAllEventListeners() | 1753 void Element::removeAllEventListeners() |
| 1760 { | 1754 { |
| 1761 ContainerNode::removeAllEventListeners(); | 1755 ContainerNode::removeAllEventListeners(); |
| 1762 if (ElementShadow* shadow = this->shadow()) | 1756 if (ElementShadow* shadow = this->shadow()) |
| 1763 shadow->removeAllEventListeners(); | 1757 shadow->removeAllEventListeners(); |
| 1764 } | 1758 } |
| 1765 | 1759 |
| 1766 void Element::beginParsingChildren() | 1760 void Element::beginParsingChildren() |
| 1767 { | 1761 { |
| 1768 clearIsParsingChildrenFinished(); | 1762 clearIsParsingChildrenFinished(); |
| 1769 StyleResolver* styleResolver = document().styleResolverIfExists(); | |
| 1770 if (styleResolver && attached()) | |
| 1771 styleResolver->pushParentElement(this); | |
| 1772 } | 1763 } |
| 1773 | 1764 |
| 1774 void Element::finishParsingChildren() | 1765 void Element::finishParsingChildren() |
| 1775 { | 1766 { |
| 1776 ContainerNode::finishParsingChildren(); | |
| 1777 setIsParsingChildrenFinished(); | 1767 setIsParsingChildrenFinished(); |
| 1778 checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0); | 1768 checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0); |
| 1779 if (StyleResolver* styleResolver = document().styleResolverIfExists()) | |
| 1780 styleResolver->popParentElement(this); | |
| 1781 if (isCustomElement()) | 1769 if (isCustomElement()) |
| 1782 CustomElement::didFinishParsingChildren(this); | 1770 CustomElement::didFinishParsingChildren(this); |
| 1783 } | 1771 } |
| 1784 | 1772 |
| 1785 #ifndef NDEBUG | 1773 #ifndef NDEBUG |
| 1786 void Element::formatForDebugger(char* buffer, unsigned length) const | 1774 void Element::formatForDebugger(char* buffer, unsigned length) const |
| 1787 { | 1775 { |
| 1788 StringBuilder result; | 1776 StringBuilder result; |
| 1789 String s; | 1777 String s; |
| 1790 | 1778 |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3638 return 0; | 3626 return 0; |
| 3639 } | 3627 } |
| 3640 | 3628 |
| 3641 Attribute* UniqueElementData::attributeItem(unsigned index) | 3629 Attribute* UniqueElementData::attributeItem(unsigned index) |
| 3642 { | 3630 { |
| 3643 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3631 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
| 3644 return &m_attributeVector.at(index); | 3632 return &m_attributeVector.at(index); |
| 3645 } | 3633 } |
| 3646 | 3634 |
| 3647 } // namespace WebCore | 3635 } // namespace WebCore |
| OLD | NEW |