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

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

Issue 2293713002: Made ElementRareData store ComputedStyle on LayoutObject if possible. (Closed)
Patch Set: Added CORE_EXPORT to NodeRareDataBase Created 4 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
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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 } 1549 }
1550 1550
1551 void Element::attachLayoutTree(const AttachContext& context) 1551 void Element::attachLayoutTree(const AttachContext& context)
1552 { 1552 {
1553 DCHECK(document().inStyleRecalc()); 1553 DCHECK(document().inStyleRecalc());
1554 1554
1555 // We've already been through detach when doing an attach, but we might 1555 // We've already been through detach when doing an attach, but we might
1556 // need to clear any state that's been added since then. 1556 // need to clear any state that's been added since then.
1557 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { 1557 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) {
1558 ElementRareData* data = elementRareData(); 1558 ElementRareData* data = elementRareData();
1559 data->clearComputedStyle(); 1559 data->clearComputedStyleIfNoLayoutObject();
1560 } 1560 }
1561 1561
1562 if (!isSlotOrActiveInsertionPoint()) 1562 if (!isSlotOrActiveInsertionPoint())
1563 LayoutTreeBuilderForElement(*this, context.resolvedStyle).createLayoutOb jectIfNeeded(); 1563 LayoutTreeBuilderForElement(*this, context.resolvedStyle).createLayoutOb jectIfNeeded();
1564 1564
1565 addCallbackSelectors(); 1565 addCallbackSelectors();
1566 1566
1567 if (hasRareData() && !layoutObject()) { 1567 if (hasRareData() && !layoutObject()) {
1568 if (ElementAnimations* elementAnimations = elementRareData()->elementAni mations()) { 1568 if (ElementAnimations* elementAnimations = elementRareData()->elementAni mations()) {
1569 elementAnimations->cssAnimations().cancel(); 1569 elementAnimations->cssAnimations().cancel();
(...skipping 25 matching lines...) Expand all
1595 { 1595 {
1596 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 1596 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
1597 cancelFocusAppearanceUpdate(); 1597 cancelFocusAppearanceUpdate();
1598 removeCallbackSelectors(); 1598 removeCallbackSelectors();
1599 if (hasRareData()) { 1599 if (hasRareData()) {
1600 ElementRareData* data = elementRareData(); 1600 ElementRareData* data = elementRareData();
1601 data->clearPseudoElements(); 1601 data->clearPseudoElements();
1602 1602
1603 // attachLayoutTree() will clear the computed style for us when inside r ecalcStyle. 1603 // attachLayoutTree() will clear the computed style for us when inside r ecalcStyle.
1604 if (!document().inStyleRecalc()) 1604 if (!document().inStyleRecalc())
1605 data->clearComputedStyle(); 1605 data->clearComputedStyleIfNoLayoutObject();
1606 1606
1607 if (ElementAnimations* elementAnimations = data->elementAnimations()) { 1607 if (ElementAnimations* elementAnimations = data->elementAnimations()) {
1608 if (context.performingReattach) { 1608 if (context.performingReattach) {
1609 // FIXME: We call detach from within style recalc, so compositin gState is not up to date. 1609 // FIXME: We call detach from within style recalc, so compositin gState is not up to date.
1610 // https://code.google.com/p/chromium/issues/detail?id=339847 1610 // https://code.google.com/p/chromium/issues/detail?id=339847
1611 DisableCompositingQueryAsserts disabler; 1611 DisableCompositingQueryAsserts disabler;
1612 1612
1613 // FIXME: restart compositor animations rather than pull back to the main thread 1613 // FIXME: restart compositor animations rather than pull back to the main thread
1614 elementAnimations->restartAnimationOnCompositor(); 1614 elementAnimations->restartAnimationOnCompositor();
1615 } else { 1615 } else {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 DCHECK(!parentOrShadowHostNode()->needsStyleRecalc()); 1725 DCHECK(!parentOrShadowHostNode()->needsStyleRecalc());
1726 DCHECK(inActiveDocument()); 1726 DCHECK(inActiveDocument());
1727 1727
1728 if (hasCustomStyleCallbacks()) 1728 if (hasCustomStyleCallbacks())
1729 willRecalcStyle(change); 1729 willRecalcStyle(change);
1730 1730
1731 if (change >= IndependentInherit || needsStyleRecalc()) { 1731 if (change >= IndependentInherit || needsStyleRecalc()) {
1732 if (hasRareData()) { 1732 if (hasRareData()) {
1733 ElementRareData* data = elementRareData(); 1733 ElementRareData* data = elementRareData();
1734 if (change != IndependentInherit) 1734 if (change != IndependentInherit)
1735 data->clearComputedStyle(); 1735 data->clearComputedStyleIfNoLayoutObject();
1736 1736
1737 if (change >= IndependentInherit) { 1737 if (change >= IndependentInherit) {
1738 if (ElementAnimations* elementAnimations = data->elementAnimatio ns()) 1738 if (ElementAnimations* elementAnimations = data->elementAnimatio ns())
1739 elementAnimations->setAnimationStyleChange(false); 1739 elementAnimations->setAnimationStyleChange(false);
1740 } 1740 }
1741 } 1741 }
1742 if (parentComputedStyle()) 1742 if (parentComputedStyle())
1743 change = recalcOwnStyle(change); 1743 change = recalcOwnStyle(change);
1744 clearNeedsStyleRecalc(); 1744 clearNeedsStyleRecalc();
1745 } 1745 }
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 3822
3823 DEFINE_TRACE_WRAPPERS(Element) 3823 DEFINE_TRACE_WRAPPERS(Element)
3824 { 3824 {
3825 if (hasRareData()) { 3825 if (hasRareData()) {
3826 visitor->traceWrappers(elementRareData()); 3826 visitor->traceWrappers(elementRareData());
3827 } 3827 }
3828 ContainerNode::traceWrappers(visitor); 3828 ContainerNode::traceWrappers(visitor);
3829 } 3829 }
3830 3830
3831 } // namespace blink 3831 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698