Chromium Code Reviews| 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserv ed. |
| 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 node = NodeTraversal::nextSkippingChildren(*node, firstNode); | 642 node = NodeTraversal::nextSkippingChildren(*node, firstNode); |
| 643 continue; | 643 continue; |
| 644 } | 644 } |
| 645 node->setSelfOrAncestorHasDirAutoAttribute(flag); | 645 node->setSelfOrAncestorHasDirAutoAttribute(flag); |
| 646 if (node == lastNode) | 646 if (node == lastNode) |
| 647 return; | 647 return; |
| 648 node = NodeTraversal::next(*node, firstNode); | 648 node = NodeTraversal::next(*node, firstNode); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node * afterChange, int childCountDelta) | 652 void HTMLElement::childrenChanged(const ChildrenChange& change) |
| 653 { | 653 { |
| 654 Element::childrenChanged(changedByParser, beforeChange, afterChange, childCo untDelta); | 654 Element::childrenChanged(change); |
| 655 adjustDirectionalityIfNeededAfterChildrenChanged(beforeChange, childCountDel ta); | 655 adjustDirectionalityIfNeededAfterChildrenChanged(change); |
| 656 } | 656 } |
| 657 | 657 |
| 658 bool HTMLElement::hasDirectionAuto() const | 658 bool HTMLElement::hasDirectionAuto() const |
| 659 { | 659 { |
| 660 const AtomicString& direction = fastGetAttribute(dirAttr); | 660 const AtomicString& direction = fastGetAttribute(dirAttr); |
| 661 return (isHTMLBDIElement(*this) && direction == nullAtom) || equalIgnoringCa se(direction, "auto"); | 661 return (isHTMLBDIElement(*this) && direction == nullAtom) || equalIgnoringCa se(direction, "auto"); |
| 662 } | 662 } |
| 663 | 663 |
| 664 TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con st | 664 TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) con st |
| 665 { | 665 { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 { | 749 { |
| 750 Node* strongDirectionalityTextNode; | 750 Node* strongDirectionalityTextNode; |
| 751 TextDirection textDirection = directionality(&strongDirectionalityTextNode); | 751 TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
| 752 setHasDirAutoFlagRecursively(this, hasDirectionAuto(), strongDirectionalityT extNode); | 752 setHasDirAutoFlagRecursively(this, hasDirectionAuto(), strongDirectionalityT extNode); |
| 753 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) | 753 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) |
| 754 setHasDirAutoFlagRecursively(root, hasDirectionAuto()); | 754 setHasDirAutoFlagRecursively(root, hasDirectionAuto()); |
| 755 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) | 755 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) |
| 756 setNeedsStyleRecalc(SubtreeStyleChange); | 756 setNeedsStyleRecalc(SubtreeStyleChange); |
| 757 } | 757 } |
| 758 | 758 |
| 759 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC hange, int childCountDelta) | 759 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(const Childre nChange& change) |
| 760 { | 760 { |
| 761 if (document().renderView() && childCountDelta < 0) { | |
| 762 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC hange) : 0; | |
| 763 for (int counter = 0; node && counter < childCountDelta; counter++, node = NodeTraversal::nextSkippingChildren(*node)) { | |
|
Inactive
2014/07/01 14:53:01
This was dead code because:
- if childCountDelta <
| |
| 764 if (elementAffectsDirectionality(node)) | |
| 765 continue; | |
| 766 | |
| 767 setHasDirAutoFlagRecursively(node, false); | |
| 768 } | |
| 769 } | |
| 770 | |
| 771 if (!selfOrAncestorHasDirAutoAttribute()) | 761 if (!selfOrAncestorHasDirAutoAttribute()) |
| 772 return; | 762 return; |
| 773 | 763 |
| 774 Node* oldMarkedNode = beforeChange ? NodeTraversal::nextSkippingChildren(*be foreChange) : 0; | 764 Node* oldMarkedNode = change.siblingBeforeChange ? NodeTraversal::nextSkippi ngChildren(*change.siblingBeforeChange) : 0; |
| 775 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) | 765 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) |
| 776 oldMarkedNode = NodeTraversal::nextSkippingChildren(*oldMarkedNode, this ); | 766 oldMarkedNode = NodeTraversal::nextSkippingChildren(*oldMarkedNode, this ); |
| 777 if (oldMarkedNode) | 767 if (oldMarkedNode) |
| 778 setHasDirAutoFlagRecursively(oldMarkedNode, false); | 768 setHasDirAutoFlagRecursively(oldMarkedNode, false); |
| 779 | 769 |
| 780 for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = ele mentToAdjust->parentElement()) { | 770 for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = ele mentToAdjust->parentElement()) { |
| 781 if (elementAffectsDirectionality(elementToAdjust)) { | 771 if (elementAffectsDirectionality(elementToAdjust)) { |
| 782 toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality(); | 772 toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality(); |
| 783 return; | 773 return; |
| 784 } | 774 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 959 #ifndef NDEBUG | 949 #ifndef NDEBUG |
| 960 | 950 |
| 961 // For use in the debugger | 951 // For use in the debugger |
| 962 void dumpInnerHTML(WebCore::HTMLElement*); | 952 void dumpInnerHTML(WebCore::HTMLElement*); |
| 963 | 953 |
| 964 void dumpInnerHTML(WebCore::HTMLElement* element) | 954 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 965 { | 955 { |
| 966 printf("%s\n", element->innerHTML().ascii().data()); | 956 printf("%s\n", element->innerHTML().ascii().data()); |
| 967 } | 957 } |
| 968 #endif | 958 #endif |
| OLD | NEW |