| 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 // TODO(esprehn): Implement the sky spec where shadow roots are a custom |
| 1053 // element registration feature. |
| 1054 PassRefPtr<ShadowRoot> Element::ensureShadowRoot(ExceptionState& exceptionState) |
| 1053 { | 1055 { |
| 1056 if (ShadowRoot* root = shadowRoot()) |
| 1057 return root; |
| 1054 return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this)); | 1058 return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this)); |
| 1055 } | 1059 } |
| 1056 | 1060 |
| 1057 ShadowRoot* Element::shadowRoot() const | 1061 ShadowRoot* Element::shadowRoot() const |
| 1058 { | 1062 { |
| 1059 ElementShadow* elementShadow = shadow(); | 1063 ElementShadow* elementShadow = shadow(); |
| 1060 if (!elementShadow) | 1064 if (!elementShadow) |
| 1061 return 0; | 1065 return 0; |
| 1062 return elementShadow->youngestShadowRoot(); | 1066 return elementShadow->shadowRoot(); |
| 1063 } | 1067 } |
| 1064 | 1068 |
| 1065 void Element::childrenChanged(const ChildrenChange& change) | 1069 void Element::childrenChanged(const ChildrenChange& change) |
| 1066 { | 1070 { |
| 1067 ContainerNode::childrenChanged(change); | 1071 ContainerNode::childrenChanged(change); |
| 1068 | 1072 |
| 1069 if (ElementShadow* shadow = this->shadow()) | 1073 if (ElementShadow* shadow = this->shadow()) |
| 1070 shadow->setNeedsDistributionRecalc(); | 1074 shadow->setNeedsDistributionRecalc(); |
| 1071 } | 1075 } |
| 1072 | 1076 |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 return false; | 1792 return false; |
| 1789 // Turn off style sharing for elements that can gain layers for reasons outs
ide of the style system. | 1793 // Turn off style sharing for elements that can gain layers for reasons outs
ide of the style system. |
| 1790 // See comments in RenderObject::setStyle(). | 1794 // See comments in RenderObject::setStyle(). |
| 1791 // FIXME: Why does gaining a layer from outside the style system require dis
abling sharing? | 1795 // FIXME: Why does gaining a layer from outside the style system require dis
abling sharing? |
| 1792 if (isHTMLCanvasElement(*this)) | 1796 if (isHTMLCanvasElement(*this)) |
| 1793 return false; | 1797 return false; |
| 1794 return true; | 1798 return true; |
| 1795 } | 1799 } |
| 1796 | 1800 |
| 1797 } // namespace blink | 1801 } // namespace blink |
| OLD | NEW |