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