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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 765523002: Specialize InsertionPoint attach/detach. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/shadow/InsertionPoint.h » ('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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (wasInDocument) { 794 if (wasInDocument) {
795 if (isUpgradedCustomElement()) 795 if (isUpgradedCustomElement())
796 CustomElement::didDetach(this, insertionPoint->document()); 796 CustomElement::didDetach(this, insertionPoint->document());
797 } 797 }
798 } 798 }
799 799
800 void Element::attach(const AttachContext& context) 800 void Element::attach(const AttachContext& context)
801 { 801 {
802 ASSERT(document().inStyleRecalc()); 802 ASSERT(document().inStyleRecalc());
803 803
804 if (isInsertionPoint())
805 toInsertionPoint(this)->attachDistribution(context);
806
804 // We've already been through detach when doing an attach, but we might 807 // We've already been through detach when doing an attach, but we might
805 // need to clear any state that's been added since then. 808 // need to clear any state that's been added since then.
806 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) { 809 if (hasRareData() && styleChangeType() == NeedsReattachStyleChange) {
807 ElementRareData* data = elementRareData(); 810 ElementRareData* data = elementRareData();
808 data->clearComputedStyle(); 811 data->clearComputedStyle();
809 } 812 }
810 813
811 RenderTreeBuilder(this, context.resolvedStyle).createRendererForElementIfNee ded(); 814 RenderTreeBuilder(this, context.resolvedStyle).createRendererForElementIfNee ded();
812 815
813 if (hasRareData() && !renderer()) { 816 if (hasRareData() && !renderer()) {
814 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimat ions()) { 817 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimat ions()) {
815 activeAnimations->cssAnimations().cancel(); 818 activeAnimations->cssAnimations().cancel();
816 activeAnimations->setAnimationStyleChange(false); 819 activeAnimations->setAnimationStyleChange(false);
817 } 820 }
818 } 821 }
819 822
820 // When a shadow root exists, it does the work of attaching the children. 823 // When a shadow root exists, it does the work of attaching the children.
821 if (ElementShadow* shadow = this->shadow()) 824 if (ElementShadow* shadow = this->shadow())
822 shadow->attach(context); 825 shadow->attach(context);
823 826
824 ContainerNode::attach(context); 827 ContainerNode::attach(context);
825 } 828 }
826 829
827 void Element::detach(const AttachContext& context) 830 void Element::detach(const AttachContext& context)
828 { 831 {
832 if (isInsertionPoint())
833 toInsertionPoint(this)->detachDistribution(context);
834
829 if (hasRareData()) { 835 if (hasRareData()) {
830 ElementRareData* data = elementRareData(); 836 ElementRareData* data = elementRareData();
831 837
832 // attach() will perform the below steps for us when inside recalcStyle. 838 // attach() will perform the below steps for us when inside recalcStyle.
833 if (!document().inStyleRecalc()) { 839 if (!document().inStyleRecalc()) {
834 data->clearComputedStyle(); 840 data->clearComputedStyle();
835 } 841 }
836 842
837 if (ActiveAnimations* activeAnimations = data->activeAnimations()) { 843 if (ActiveAnimations* activeAnimations = data->activeAnimations()) {
838 if (context.performingReattach) { 844 if (context.performingReattach) {
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 return false; 1798 return false;
1793 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system. 1799 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system.
1794 // See comments in RenderObject::setStyle(). 1800 // See comments in RenderObject::setStyle().
1795 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing? 1801 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing?
1796 if (isHTMLCanvasElement(*this)) 1802 if (isHTMLCanvasElement(*this))
1797 return false; 1803 return false;
1798 return true; 1804 return true;
1799 } 1805 }
1800 1806
1801 } // namespace blink 1807 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/shadow/InsertionPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698