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/editing/markup.h" | 74 #include "core/editing/markup.h" |
76 #include "core/events/EventDispatcher.h" | 75 #include "core/events/EventDispatcher.h" |
77 #include "core/events/FocusEvent.h" | 76 #include "core/events/FocusEvent.h" |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 | 1616 |
1618 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (ch
ildRulesChanged && hasIndirectAdjacentRules); | 1617 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (ch
ildRulesChanged && hasIndirectAdjacentRules); |
1619 } | 1618 } |
1620 } | 1619 } |
1621 // This loop is deliberately backwards because we use insertBefore in the re
ndering tree, and want to avoid | 1620 // This loop is deliberately backwards because we use insertBefore in the re
ndering tree, and want to avoid |
1622 // a potentially n^2 loop to find the insertion point while resolving style.
Having us start from the last | 1621 // a potentially n^2 loop to find the insertion point while resolving style.
Having us start from the last |
1623 // child and work our way back means in the common case, we'll find the inse
rtion point in O(1) time. | 1622 // child and work our way back means in the common case, we'll find the inse
rtion point in O(1) time. |
1624 // Reversing this loop can lead to non-deterministic results in our code to
optimize out empty whitespace | 1623 // Reversing this loop can lead to non-deterministic results in our code to
optimize out empty whitespace |
1625 // RenderTexts. We try to put off recalcing their style until the end to avo
id this issue. | 1624 // RenderTexts. We try to put off recalcing their style until the end to avo
id this issue. |
1626 // See crbug.com/288225 | 1625 // See crbug.com/288225 |
1627 WhitespaceChildList whitespaceChildList(change); | |
1628 for (Node* child = lastChild(); child; child = child->previousSibling()) { | 1626 for (Node* child = lastChild(); child; child = child->previousSibling()) { |
| 1627 bool didReattach = false; |
1629 if (child->isTextNode()) { | 1628 if (child->isTextNode()) { |
1630 Text* textChild = toText(child); | 1629 didReattach = toText(child)->recalcTextStyle(change); |
1631 // FIXME: This check is expensive and may negate the performance gai
ned by the optimization of | |
1632 // avoiding whitespace renderers. | |
1633 if (textChild->containsOnlyWhitespace()) | |
1634 whitespaceChildList.append(textChild); | |
1635 else | |
1636 textChild->recalcTextStyle(change); | |
1637 } else if (child->isElementNode()) { | 1630 } else if (child->isElementNode()) { |
1638 Element* element = toElement(child); | 1631 Element* element = toElement(child); |
1639 if (shouldRecalcStyle(change, element)) { | 1632 if (shouldRecalcStyle(change, element)) { |
1640 parentPusher.push(); | 1633 parentPusher.push(); |
1641 element->recalcStyle(change); | 1634 didReattach = element->recalcStyle(change); |
1642 } else if (element->supportsStyleSharing()) { | 1635 } else if (element->supportsStyleSharing()) { |
1643 document().styleResolver()->addToStyleSharingList(*element); | 1636 document().styleResolver()->addToStyleSharingList(*element); |
1644 } | 1637 } |
1645 } | 1638 } |
| 1639 if (didReattach) |
| 1640 child->reattachWhitespaceSiblings(); |
1646 } | 1641 } |
1647 | 1642 |
1648 whitespaceChildList.recalcStyle(); | |
1649 | |
1650 if (shouldRecalcStyle(change, this)) { | 1643 if (shouldRecalcStyle(change, this)) { |
1651 updatePseudoElement(AFTER, change); | 1644 updatePseudoElement(AFTER, change); |
1652 updatePseudoElement(BACKDROP, change); | 1645 updatePseudoElement(BACKDROP, change); |
1653 } | 1646 } |
1654 } | 1647 } |
1655 | 1648 |
1656 ElementShadow* Element::shadow() const | 1649 ElementShadow* Element::shadow() const |
1657 { | 1650 { |
1658 return hasRareData() ? elementRareData()->shadow() : 0; | 1651 return hasRareData() ? elementRareData()->shadow() : 0; |
1659 } | 1652 } |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3470 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3463 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
3471 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3464 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
3472 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3465 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3473 return false; | 3466 return false; |
3474 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3467 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3475 return false; | 3468 return false; |
3476 return true; | 3469 return true; |
3477 } | 3470 } |
3478 | 3471 |
3479 } // namespace WebCore | 3472 } // namespace WebCore |
OLD | NEW |