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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
960 return localChange; | 960 return localChange; |
961 } | 961 } |
962 | 962 |
963 void Element::recalcChildStyle(StyleRecalcChange change) | 963 void Element::recalcChildStyle(StyleRecalcChange change) |
964 { | 964 { |
965 ASSERT(document().inStyleRecalc()); | 965 ASSERT(document().inStyleRecalc()); |
966 ASSERT(change >= Inherit || childNeedsStyleRecalc()); | 966 ASSERT(change >= Inherit || childNeedsStyleRecalc()); |
967 ASSERT(!needsStyleRecalc()); | 967 ASSERT(!needsStyleRecalc()); |
968 | 968 |
969 if (change > Inherit || childNeedsStyleRecalc()) { | 969 if (change > Inherit || childNeedsStyleRecalc()) { |
970 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderSh adowRoot()) { | 970 if (ShadowRoot* root = shadowRoot()) { |
971 if (root->shouldCallRecalcStyle(change)) | 971 if (root->shouldCallRecalcStyle(change)) |
972 root->recalcStyle(change); | 972 root->recalcStyle(change); |
973 } | 973 } |
974 | 974 |
975 // This loop is deliberately backwards because we use insertBefore in th e rendering tree, and want to avoid | 975 // This loop is deliberately backwards because we use insertBefore in th e rendering tree, and want to avoid |
976 // a potentially n^2 loop to find the insertion point while resolving st yle. Having us start from the last | 976 // a potentially n^2 loop to find the insertion point while resolving st yle. Having us start from the last |
977 // child and work our way back means in the common case, we'll find the insertion point in O(1) time. | 977 // child and work our way back means in the common case, we'll find the insertion point in O(1) time. |
978 // See crbug.com/288225 | 978 // See crbug.com/288225 |
979 StyleResolver& styleResolver = document().ensureStyleResolver(); | 979 StyleResolver& styleResolver = document().ensureStyleResolver(); |
980 Text* lastTextNode = 0; | 980 Text* lastTextNode = 0; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1042 ensureElementRareData().setCustomElementDefinition(definition); | 1042 ensureElementRareData().setCustomElementDefinition(definition); |
1043 } | 1043 } |
1044 | 1044 |
1045 CustomElementDefinition* Element::customElementDefinition() const | 1045 CustomElementDefinition* Element::customElementDefinition() const |
1046 { | 1046 { |
1047 if (hasRareData()) | 1047 if (hasRareData()) |
1048 return elementRareData()->customElementDefinition(); | 1048 return elementRareData()->customElementDefinition(); |
1049 return 0; | 1049 return 0; |
1050 } | 1050 } |
1051 | 1051 |
1052 PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exceptionState) | 1052 PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exceptionState) |
ojan
2014/11/26 18:43:17
s/createShadowRoot/ensureShadowRoot ?
esprehn
2014/11/26 18:54:23
done.
| |
1053 { | 1053 { |
1054 if (ShadowRoot* root = shadowRoot()) | |
1055 return root; | |
1054 return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this)); | 1056 return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this)); |
1055 } | 1057 } |
1056 | 1058 |
1057 ShadowRoot* Element::shadowRoot() const | 1059 ShadowRoot* Element::shadowRoot() const |
1058 { | 1060 { |
1059 ElementShadow* elementShadow = shadow(); | 1061 ElementShadow* elementShadow = shadow(); |
1060 if (!elementShadow) | 1062 if (!elementShadow) |
1061 return 0; | 1063 return 0; |
1062 return elementShadow->youngestShadowRoot(); | 1064 return elementShadow->shadowRoot(); |
1063 } | 1065 } |
1064 | 1066 |
1065 void Element::childrenChanged(const ChildrenChange& change) | 1067 void Element::childrenChanged(const ChildrenChange& change) |
1066 { | 1068 { |
1067 ContainerNode::childrenChanged(change); | 1069 ContainerNode::childrenChanged(change); |
1068 | 1070 |
1069 if (ElementShadow* shadow = this->shadow()) | 1071 if (ElementShadow* shadow = this->shadow()) |
1070 shadow->setNeedsDistributionRecalc(); | 1072 shadow->setNeedsDistributionRecalc(); |
1071 } | 1073 } |
1072 | 1074 |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1788 return false; | 1790 return false; |
1789 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system. | 1791 // Turn off style sharing for elements that can gain layers for reasons outs ide of the style system. |
1790 // See comments in RenderObject::setStyle(). | 1792 // See comments in RenderObject::setStyle(). |
1791 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing? | 1793 // FIXME: Why does gaining a layer from outside the style system require dis abling sharing? |
1792 if (isHTMLCanvasElement(*this)) | 1794 if (isHTMLCanvasElement(*this)) |
1793 return false; | 1795 return false; |
1794 return true; | 1796 return true; |
1795 } | 1797 } |
1796 | 1798 |
1797 } // namespace blink | 1799 } // namespace blink |
OLD | NEW |