| 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. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * (C) 2007 Eric Seidel (eric@webkit.org) | 9 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 10 * | 10 * |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 return parent->locateNamespacePrefix(namespaceToLocate); | 1520 return parent->locateNamespacePrefix(namespaceToLocate); |
| 1521 | 1521 |
| 1522 return nullAtom; | 1522 return nullAtom; |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 const AtomicString Element::imageSourceURL() const { | 1525 const AtomicString Element::imageSourceURL() const { |
| 1526 return getAttribute(srcAttr); | 1526 return getAttribute(srcAttr); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 bool Element::layoutObjectIsNeeded(const ComputedStyle& style) { | 1529 bool Element::layoutObjectIsNeeded(const ComputedStyle& style) { |
| 1530 return style.display() != EDisplay::None; | 1530 return style.display() != EDisplay::None && |
| 1531 style.display() != EDisplay::Contents; |
| 1531 } | 1532 } |
| 1532 | 1533 |
| 1533 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) { | 1534 LayoutObject* Element::createLayoutObject(const ComputedStyle& style) { |
| 1534 return LayoutObject::createObject(this, style); | 1535 return LayoutObject::createObject(this, style); |
| 1535 } | 1536 } |
| 1536 | 1537 |
| 1537 Node::InsertionNotificationRequest Element::insertedInto( | 1538 Node::InsertionNotificationRequest Element::insertedInto( |
| 1538 ContainerNode* insertionPoint) { | 1539 ContainerNode* insertionPoint) { |
| 1539 // need to do superclass processing first so isConnected() is true | 1540 // need to do superclass processing first so isConnected() is true |
| 1540 // by the time we reach updateId | 1541 // by the time we reach updateId |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 void Element::attachLayoutTree(const AttachContext& context) { | 1659 void Element::attachLayoutTree(const AttachContext& context) { |
| 1659 DCHECK(document().inStyleRecalc()); | 1660 DCHECK(document().inStyleRecalc()); |
| 1660 | 1661 |
| 1661 // We've already been through detach when doing an attach, but we might | 1662 // We've already been through detach when doing an attach, but we might |
| 1662 // need to clear any state that's been added since then. | 1663 // need to clear any state that's been added since then. |
| 1663 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { | 1664 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { |
| 1664 ElementRareData* data = elementRareData(); | 1665 ElementRareData* data = elementRareData(); |
| 1665 data->clearComputedStyle(); | 1666 data->clearComputedStyle(); |
| 1666 } | 1667 } |
| 1667 | 1668 |
| 1668 if (!isSlotOrActiveInsertionPoint()) | 1669 if (!isSlotOrActiveInsertionPoint()) { |
| 1669 LayoutTreeBuilderForElement(*this, context.resolvedStyle) | 1670 LayoutTreeBuilderForElement builder(*this, context.resolvedStyle); |
| 1670 .createLayoutObjectIfNeeded(); | 1671 builder.createLayoutObjectIfNeeded(); |
| 1672 |
| 1673 // Persist the resolved style if we got to the point we needed to compute |
| 1674 // the style, and it was a display: contents style, since we need it for our |
| 1675 // children. |
| 1676 if (ComputedStyle* style = builder.resolvedStyle()) { |
| 1677 if (style->display() == EDisplay::Contents) { |
| 1678 DCHECK(!layoutObject()); |
| 1679 storeDisplayContentsStyle(*style); |
| 1680 } |
| 1681 } |
| 1682 } |
| 1671 | 1683 |
| 1672 addCallbackSelectors(); | 1684 addCallbackSelectors(); |
| 1673 | 1685 |
| 1674 if (hasRareData() && !layoutObject()) { | 1686 if (hasRareData() && !layoutObject()) { |
| 1675 if (ElementAnimations* elementAnimations = | 1687 if (ElementAnimations* elementAnimations = |
| 1676 elementRareData()->elementAnimations()) { | 1688 elementRareData()->elementAnimations()) { |
| 1677 elementAnimations->cssAnimations().cancel(); | 1689 elementAnimations->cssAnimations().cancel(); |
| 1678 elementAnimations->setAnimationStyleChange(false); | 1690 elementAnimations->setAnimationStyleChange(false); |
| 1679 } | 1691 } |
| 1680 } | 1692 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 // flag - so needsReattachLayoutTree() should always be true. | 2008 // flag - so needsReattachLayoutTree() should always be true. |
| 1997 DCHECK(parentNode()); | 2009 DCHECK(parentNode()); |
| 1998 DCHECK(parentNode()->childNeedsReattachLayoutTree()); | 2010 DCHECK(parentNode()->childNeedsReattachLayoutTree()); |
| 1999 DCHECK(needsReattachLayoutTree()); | 2011 DCHECK(needsReattachLayoutTree()); |
| 2000 reattachLayoutTree(reattachContext); | 2012 reattachLayoutTree(reattachContext); |
| 2001 // Since needsReattachLayoutTree() is always true we go into | 2013 // Since needsReattachLayoutTree() is always true we go into |
| 2002 // reattachLayoutTree() which reattaches all the descendant | 2014 // reattachLayoutTree() which reattaches all the descendant |
| 2003 // sub-trees. At this point no child should need reattaching. | 2015 // sub-trees. At this point no child should need reattaching. |
| 2004 DCHECK(!childNeedsReattachLayoutTree()); | 2016 DCHECK(!childNeedsReattachLayoutTree()); |
| 2005 | 2017 |
| 2006 if (layoutObjectWillChange || layoutObject()) { | 2018 if (layoutObjectWillChange || layoutObject() || displayContentsStyle()) { |
| 2007 // nextTextSibling is passed on to recalcStyle from recalcDescendantStyles | 2019 // nextTextSibling is passed on to recalcStyle from recalcDescendantStyles |
| 2008 // we can either traverse the current subtree from this node onwards | 2020 // we can either traverse the current subtree from this node onwards |
| 2009 // or store it. | 2021 // or store it. |
| 2010 // The choice is between increased time and increased memory complexity. | 2022 // The choice is between increased time and increased memory complexity. |
| 2011 reattachWhitespaceSiblingsIfNeeded(nextTextSibling()); | 2023 reattachWhitespaceSiblingsIfNeeded(nextTextSibling()); |
| 2012 return Reattach; | 2024 return Reattach; |
| 2013 } | 2025 } |
| 2014 return ReattachNoLayoutObject; | 2026 return ReattachNoLayoutObject; |
| 2015 } | 2027 } |
| 2016 | 2028 |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3126 | 3138 |
| 3127 RefPtr<ComputedStyle> result = | 3139 RefPtr<ComputedStyle> result = |
| 3128 document().ensureStyleResolver().pseudoStyleForElement( | 3140 document().ensureStyleResolver().pseudoStyleForElement( |
| 3129 this, PseudoStyleRequest(pseudoElementSpecifier, | 3141 this, PseudoStyleRequest(pseudoElementSpecifier, |
| 3130 PseudoStyleRequest::ForComputedStyle), | 3142 PseudoStyleRequest::ForComputedStyle), |
| 3131 elementStyle); | 3143 elementStyle); |
| 3132 DCHECK(result); | 3144 DCHECK(result); |
| 3133 return elementStyle->addCachedPseudoStyle(result.release()); | 3145 return elementStyle->addCachedPseudoStyle(result.release()); |
| 3134 } | 3146 } |
| 3135 | 3147 |
| 3148 const ComputedStyle* Element::displayContentsStyle() const { |
| 3149 if (layoutObject() || !hasRareData()) |
| 3150 return nullptr; |
| 3151 |
| 3152 ComputedStyle* style = elementRareData()->computedStyle(); |
| 3153 if (!style || style->display() != EDisplay::Contents) |
| 3154 return nullptr; |
| 3155 |
| 3156 return style; |
| 3157 } |
| 3158 |
| 3159 void Element::storeDisplayContentsStyle(ComputedStyle& style) { |
| 3160 DCHECK_EQ(style.display(), EDisplay::Contents); |
| 3161 ensureElementRareData().setComputedStyle(&style); |
| 3162 } |
| 3163 |
| 3136 AtomicString Element::computeInheritedLanguage() const { | 3164 AtomicString Element::computeInheritedLanguage() const { |
| 3137 const Node* n = this; | 3165 const Node* n = this; |
| 3138 AtomicString value; | 3166 AtomicString value; |
| 3139 // The language property is inherited, so we iterate over the parents to find | 3167 // The language property is inherited, so we iterate over the parents to find |
| 3140 // the first language. | 3168 // the first language. |
| 3141 do { | 3169 do { |
| 3142 if (n->isElementNode()) { | 3170 if (n->isElementNode()) { |
| 3143 if (const ElementData* elementData = toElement(n)->elementData()) { | 3171 if (const ElementData* elementData = toElement(n)->elementData()) { |
| 3144 AttributeCollection attributes = elementData->attributes(); | 3172 AttributeCollection attributes = elementData->attributes(); |
| 3145 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7 | 3173 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7 |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4094 } | 4122 } |
| 4095 | 4123 |
| 4096 DEFINE_TRACE_WRAPPERS(Element) { | 4124 DEFINE_TRACE_WRAPPERS(Element) { |
| 4097 if (hasRareData()) { | 4125 if (hasRareData()) { |
| 4098 visitor->traceWrappers(elementRareData()); | 4126 visitor->traceWrappers(elementRareData()); |
| 4099 } | 4127 } |
| 4100 ContainerNode::traceWrappers(visitor); | 4128 ContainerNode::traceWrappers(visitor); |
| 4101 } | 4129 } |
| 4102 | 4130 |
| 4103 } // namespace blink | 4131 } // namespace blink |
| OLD | NEW |