Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: Source/core/dom/Element.cpp

Issue 23526031: Revert 157422 "Remove lots of code related synchronously attaching" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1327 NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf Needed(); 1331 NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIf Needed();
1328 1332
1329 createPseudoElementIfNeeded(BEFORE); 1333 createPseudoElementIfNeeded(BEFORE);
1330 1334
1331 // When a shadow root exists, it does the work of attaching the children. 1335 // When a shadow root exists, it does the work of attaching the children.
1332 if (ElementShadow* shadow = this->shadow()) { 1336 if (ElementShadow* shadow = this->shadow()) {
1333 parentPusher.push(); 1337 parentPusher.push();
1334 shadow->attach(context); 1338 shadow->attach(context);
1335 } else if (firstChild()) 1339 } else if (firstChild())
1336 parentPusher.push(); 1340 parentPusher.push();
1337 1341
1338 ContainerNode::attach(context); 1342 ContainerNode::attach(context);
1339 1343
1340 createPseudoElementIfNeeded(AFTER); 1344 createPseudoElementIfNeeded(AFTER);
1341 createPseudoElementIfNeeded(BACKDROP); 1345 createPseudoElementIfNeeded(BACKDROP);
1342 1346
1343 if (hasRareData()) { 1347 if (hasRareData()) {
1344 ElementRareData* data = elementRareData(); 1348 ElementRareData* data = elementRareData();
1345 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { 1349 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) {
1346 if (isFocusable() && document().focusedElement() == this) 1350 if (isFocusable() && document().focusedElement() == this)
1347 document().updateFocusAppearanceSoon(false /* don't restore sele ction */); 1351 document().updateFocusAppearanceSoon(false /* don't restore sele ction */);
1348 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); 1352 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false);
1349 } 1353 }
1350 } 1354 }
1351 1355
1352 InspectorInstrumentation::didRecalculateStyleForElement(this); 1356 // FIXME: It doesn't appear safe to call didRecalculateStyleForElement when
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);
1353 } 1361 }
1354 1362
1355 void Element::unregisterNamedFlowContentNode() 1363 void Element::unregisterNamedFlowContentNode()
1356 { 1364 {
1357 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document ().renderView()) 1365 if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document ().renderView())
1358 document().renderView()->flowThreadController()->unregisterNamedFlowCont entNode(this); 1366 document().renderView()->flowThreadController()->unregisterNamedFlowCont entNode(this);
1359 } 1367 }
1360 1368
1361 void Element::detach(const AttachContext& context) 1369 void Element::detach(const AttachContext& context)
1362 { 1370 {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 void Element::removeAllEventListeners() 1759 void Element::removeAllEventListeners()
1752 { 1760 {
1753 ContainerNode::removeAllEventListeners(); 1761 ContainerNode::removeAllEventListeners();
1754 if (ElementShadow* shadow = this->shadow()) 1762 if (ElementShadow* shadow = this->shadow())
1755 shadow->removeAllEventListeners(); 1763 shadow->removeAllEventListeners();
1756 } 1764 }
1757 1765
1758 void Element::beginParsingChildren() 1766 void Element::beginParsingChildren()
1759 { 1767 {
1760 clearIsParsingChildrenFinished(); 1768 clearIsParsingChildrenFinished();
1769 StyleResolver* styleResolver = document().styleResolverIfExists();
1770 if (styleResolver && attached())
1771 styleResolver->pushParentElement(this);
1761 } 1772 }
1762 1773
1763 void Element::finishParsingChildren() 1774 void Element::finishParsingChildren()
1764 { 1775 {
1776 ContainerNode::finishParsingChildren();
1765 setIsParsingChildrenFinished(); 1777 setIsParsingChildrenFinished();
1766 checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0); 1778 checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0);
1779 if (StyleResolver* styleResolver = document().styleResolverIfExists())
1780 styleResolver->popParentElement(this);
1767 if (isCustomElement()) 1781 if (isCustomElement())
1768 CustomElement::didFinishParsingChildren(this); 1782 CustomElement::didFinishParsingChildren(this);
1769 } 1783 }
1770 1784
1771 #ifndef NDEBUG 1785 #ifndef NDEBUG
1772 void Element::formatForDebugger(char* buffer, unsigned length) const 1786 void Element::formatForDebugger(char* buffer, unsigned length) const
1773 { 1787 {
1774 StringBuilder result; 1788 StringBuilder result;
1775 String s; 1789 String s;
1776 1790
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 return 0; 3638 return 0;
3625 } 3639 }
3626 3640
3627 Attribute* UniqueElementData::attributeItem(unsigned index) 3641 Attribute* UniqueElementData::attributeItem(unsigned index)
3628 { 3642 {
3629 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3643 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3630 return &m_attributeVector.at(index); 3644 return &m_attributeVector.at(index);
3631 } 3645 }
3632 3646
3633 } // namespace WebCore 3647 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698