| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "core/dom/MutationRecord.h" | 57 #include "core/dom/MutationRecord.h" |
| 58 #include "core/dom/NamedNodeMap.h" | 58 #include "core/dom/NamedNodeMap.h" |
| 59 #include "core/dom/NodeRenderStyle.h" | 59 #include "core/dom/NodeRenderStyle.h" |
| 60 #include "core/dom/NodeRenderingContext.h" | 60 #include "core/dom/NodeRenderingContext.h" |
| 61 #include "core/dom/PostAttachCallbacks.h" | 61 #include "core/dom/PostAttachCallbacks.h" |
| 62 #include "core/dom/PresentationAttributeStyle.h" | 62 #include "core/dom/PresentationAttributeStyle.h" |
| 63 #include "core/dom/PseudoElement.h" | 63 #include "core/dom/PseudoElement.h" |
| 64 #include "core/dom/ScriptableDocumentParser.h" | 64 #include "core/dom/ScriptableDocumentParser.h" |
| 65 #include "core/dom/SelectorQuery.h" | 65 #include "core/dom/SelectorQuery.h" |
| 66 #include "core/dom/Text.h" | 66 #include "core/dom/Text.h" |
| 67 #include "core/dom/WhitespaceChildList.h" | |
| 68 #include "core/dom/custom/CustomElement.h" | 67 #include "core/dom/custom/CustomElement.h" |
| 69 #include "core/dom/custom/CustomElementRegistrationContext.h" | 68 #include "core/dom/custom/CustomElementRegistrationContext.h" |
| 70 #include "core/dom/shadow/InsertionPoint.h" | 69 #include "core/dom/shadow/InsertionPoint.h" |
| 71 #include "core/dom/shadow/ShadowRoot.h" | 70 #include "core/dom/shadow/ShadowRoot.h" |
| 72 #include "core/editing/FrameSelection.h" | 71 #include "core/editing/FrameSelection.h" |
| 73 #include "core/editing/TextIterator.h" | 72 #include "core/editing/TextIterator.h" |
| 74 #include "core/editing/htmlediting.h" | 73 #include "core/editing/htmlediting.h" |
| 75 #include "core/events/EventDispatcher.h" | 74 #include "core/events/EventDispatcher.h" |
| 76 #include "core/events/FocusEvent.h" | 75 #include "core/events/FocusEvent.h" |
| 77 #include "core/frame/ContentSecurityPolicy.h" | 76 #include "core/frame/ContentSecurityPolicy.h" |
| (...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 | 1628 |
| 1630 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (ch
ildRulesChanged && hasIndirectAdjacentRules); | 1629 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (ch
ildRulesChanged && hasIndirectAdjacentRules); |
| 1631 } | 1630 } |
| 1632 } | 1631 } |
| 1633 // This loop is deliberately backwards because we use insertBefore in the re
ndering tree, and want to avoid | 1632 // This loop is deliberately backwards because we use insertBefore in the re
ndering tree, and want to avoid |
| 1634 // a potentially n^2 loop to find the insertion point while resolving style.
Having us start from the last | 1633 // a potentially n^2 loop to find the insertion point while resolving style.
Having us start from the last |
| 1635 // child and work our way back means in the common case, we'll find the inse
rtion point in O(1) time. | 1634 // child and work our way back means in the common case, we'll find the inse
rtion point in O(1) time. |
| 1636 // Reversing this loop can lead to non-deterministic results in our code to
optimize out empty whitespace | 1635 // Reversing this loop can lead to non-deterministic results in our code to
optimize out empty whitespace |
| 1637 // RenderTexts. We try to put off recalcing their style until the end to avo
id this issue. | 1636 // RenderTexts. We try to put off recalcing their style until the end to avo
id this issue. |
| 1638 // See crbug.com/288225 | 1637 // See crbug.com/288225 |
| 1639 WhitespaceChildList whitespaceChildList(change); | |
| 1640 for (Node* child = lastChild(); child; child = child->previousSibling()) { | 1638 for (Node* child = lastChild(); child; child = child->previousSibling()) { |
| 1639 bool didReattach = false; |
| 1641 if (child->isTextNode()) { | 1640 if (child->isTextNode()) { |
| 1642 Text* textChild = toText(child); | 1641 didReattach = toText(child)->recalcTextStyle(change); |
| 1643 // FIXME: This check is expensive and may negate the performance gai
ned by the optimization of | |
| 1644 // avoiding whitespace renderers. | |
| 1645 if (textChild->containsOnlyWhitespace()) | |
| 1646 whitespaceChildList.append(textChild); | |
| 1647 else | |
| 1648 textChild->recalcTextStyle(change); | |
| 1649 } else if (child->isElementNode()) { | 1642 } else if (child->isElementNode()) { |
| 1650 Element* element = toElement(child); | 1643 Element* element = toElement(child); |
| 1651 if (shouldRecalcStyle(change, element)) { | 1644 if (shouldRecalcStyle(change, element)) { |
| 1652 parentPusher.push(); | 1645 parentPusher.push(); |
| 1653 element->recalcStyle(change); | 1646 didReattach = element->recalcStyle(change); |
| 1654 } else if (element->supportsStyleSharing()) { | 1647 } else if (element->supportsStyleSharing()) { |
| 1655 document().styleResolver()->addToStyleSharingList(element); | 1648 document().styleResolver()->addToStyleSharingList(element); |
| 1656 } | 1649 } |
| 1657 } | 1650 } |
| 1651 if (didReattach) |
| 1652 child->reattachWhitespaceSiblings(); |
| 1658 } | 1653 } |
| 1659 | 1654 |
| 1660 whitespaceChildList.recalcStyle(); | |
| 1661 | |
| 1662 if (shouldRecalcStyle(change, this)) { | 1655 if (shouldRecalcStyle(change, this)) { |
| 1663 updatePseudoElement(AFTER, change); | 1656 updatePseudoElement(AFTER, change); |
| 1664 updatePseudoElement(BACKDROP, change); | 1657 updatePseudoElement(BACKDROP, change); |
| 1665 } | 1658 } |
| 1666 } | 1659 } |
| 1667 | 1660 |
| 1668 ElementShadow* Element::shadow() const | 1661 ElementShadow* Element::shadow() const |
| 1669 { | 1662 { |
| 1670 return hasRareData() ? elementRareData()->shadow() : 0; | 1663 return hasRareData() ? elementRareData()->shadow() : 0; |
| 1671 } | 1664 } |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3425 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3418 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
| 3426 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3419 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
| 3427 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3420 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
| 3428 return false; | 3421 return false; |
| 3429 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3422 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
| 3430 return false; | 3423 return false; |
| 3431 return true; | 3424 return true; |
| 3432 } | 3425 } |
| 3433 | 3426 |
| 3434 } // namespace WebCore | 3427 } // namespace WebCore |
| OLD | NEW |