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 Apple Inc. All rights reserved. |
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 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 | 764 |
765 Node* node = firstNode->firstChild(); | 765 Node* node = firstNode->firstChild(); |
766 | 766 |
767 while (node) { | 767 while (node) { |
768 if (node->selfOrAncestorHasDirAutoAttribute() == flag) | 768 if (node->selfOrAncestorHasDirAutoAttribute() == flag) |
769 return; | 769 return; |
770 | 770 |
771 if (elementAffectsDirectionality(node)) { | 771 if (elementAffectsDirectionality(node)) { |
772 if (node == lastNode) | 772 if (node == lastNode) |
773 return; | 773 return; |
774 node = NodeTraversal::nextSkippingChildren(node, firstNode); | 774 node = NodeTraversal::nextSkippingChildren(*node, firstNode); |
775 continue; | 775 continue; |
776 } | 776 } |
777 node->setSelfOrAncestorHasDirAutoAttribute(flag); | 777 node->setSelfOrAncestorHasDirAutoAttribute(flag); |
778 if (node == lastNode) | 778 if (node == lastNode) |
779 return; | 779 return; |
780 node = NodeTraversal::next(*node, firstNode); | 780 node = NodeTraversal::next(*node, firstNode); |
781 } | 781 } |
782 } | 782 } |
783 | 783 |
784 void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node
* afterChange, int childCountDelta) | 784 void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node
* afterChange, int childCountDelta) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 if (strongDirectionalityTextNode) | 822 if (strongDirectionalityTextNode) |
823 *strongDirectionalityTextNode = hasStrongDirectionality ? inputEleme
nt : 0; | 823 *strongDirectionalityTextNode = hasStrongDirectionality ? inputEleme
nt : 0; |
824 return textDirection; | 824 return textDirection; |
825 } | 825 } |
826 | 826 |
827 Node* node = firstChild(); | 827 Node* node = firstChild(); |
828 while (node) { | 828 while (node) { |
829 // Skip bdi, script, style and text form controls. | 829 // Skip bdi, script, style and text form controls. |
830 if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scrip
tTag) || node->hasTagName(styleTag) | 830 if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scrip
tTag) || node->hasTagName(styleTag) |
831 || (node->isElementNode() && toElement(node)->isTextFormControl()))
{ | 831 || (node->isElementNode() && toElement(node)->isTextFormControl()))
{ |
832 node = NodeTraversal::nextSkippingChildren(node, this); | 832 node = NodeTraversal::nextSkippingChildren(*node, this); |
833 continue; | 833 continue; |
834 } | 834 } |
835 | 835 |
836 // Skip elements with valid dir attribute | 836 // Skip elements with valid dir attribute |
837 if (node->isElementNode()) { | 837 if (node->isElementNode()) { |
838 AtomicString dirAttributeValue = toElement(node)->fastGetAttribute(d
irAttr); | 838 AtomicString dirAttributeValue = toElement(node)->fastGetAttribute(d
irAttr); |
839 if (isValidDirAttribute(dirAttributeValue)) { | 839 if (isValidDirAttribute(dirAttributeValue)) { |
840 node = NodeTraversal::nextSkippingChildren(node, this); | 840 node = NodeTraversal::nextSkippingChildren(*node, this); |
841 continue; | 841 continue; |
842 } | 842 } |
843 } | 843 } |
844 | 844 |
845 if (node->isTextNode()) { | 845 if (node->isTextNode()) { |
846 bool hasStrongDirectionality; | 846 bool hasStrongDirectionality; |
847 TextDirection textDirection = determineDirectionality(node->textCont
ent(true), hasStrongDirectionality); | 847 TextDirection textDirection = determineDirectionality(node->textCont
ent(true), hasStrongDirectionality); |
848 if (hasStrongDirectionality) { | 848 if (hasStrongDirectionality) { |
849 if (strongDirectionalityTextNode) | 849 if (strongDirectionalityTextNode) |
850 *strongDirectionalityTextNode = node; | 850 *strongDirectionalityTextNode = node; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 Node* strongDirectionalityTextNode; | 891 Node* strongDirectionalityTextNode; |
892 TextDirection textDirection = directionality(&strongDirectionalityTextNode); | 892 TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
893 setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); | 893 setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); |
894 if (renderer() && renderer()->style() && renderer()->style()->direction() !=
textDirection) | 894 if (renderer() && renderer()->style() && renderer()->style()->direction() !=
textDirection) |
895 setNeedsStyleRecalc(); | 895 setNeedsStyleRecalc(); |
896 } | 896 } |
897 | 897 |
898 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC
hange, int childCountDelta) | 898 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC
hange, int childCountDelta) |
899 { | 899 { |
900 if (document().renderer() && childCountDelta < 0) { | 900 if (document().renderer() && childCountDelta < 0) { |
901 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(beforeCh
ange) : 0; | 901 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC
hange) : 0; |
902 for (int counter = 0; node && counter < childCountDelta; counter++, node
= NodeTraversal::nextSkippingChildren(node)) { | 902 for (int counter = 0; node && counter < childCountDelta; counter++, node
= NodeTraversal::nextSkippingChildren(*node)) { |
903 if (elementAffectsDirectionality(node)) | 903 if (elementAffectsDirectionality(node)) |
904 continue; | 904 continue; |
905 | 905 |
906 setHasDirAutoFlagRecursively(node, false); | 906 setHasDirAutoFlagRecursively(node, false); |
907 } | 907 } |
908 } | 908 } |
909 | 909 |
910 if (!selfOrAncestorHasDirAutoAttribute()) | 910 if (!selfOrAncestorHasDirAutoAttribute()) |
911 return; | 911 return; |
912 | 912 |
913 Node* oldMarkedNode = beforeChange ? NodeTraversal::nextSkippingChildren(bef
oreChange) : 0; | 913 Node* oldMarkedNode = beforeChange ? NodeTraversal::nextSkippingChildren(*be
foreChange) : 0; |
914 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) | 914 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) |
915 oldMarkedNode = NodeTraversal::nextSkippingChildren(oldMarkedNode, this)
; | 915 oldMarkedNode = NodeTraversal::nextSkippingChildren(*oldMarkedNode, this
); |
916 if (oldMarkedNode) | 916 if (oldMarkedNode) |
917 setHasDirAutoFlagRecursively(oldMarkedNode, false); | 917 setHasDirAutoFlagRecursively(oldMarkedNode, false); |
918 | 918 |
919 for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = ele
mentToAdjust->parentElement()) { | 919 for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = ele
mentToAdjust->parentElement()) { |
920 if (elementAffectsDirectionality(elementToAdjust)) { | 920 if (elementAffectsDirectionality(elementToAdjust)) { |
921 toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality(); | 921 toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality(); |
922 return; | 922 return; |
923 } | 923 } |
924 } | 924 } |
925 } | 925 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 #ifndef NDEBUG | 1072 #ifndef NDEBUG |
1073 | 1073 |
1074 // For use in the debugger | 1074 // For use in the debugger |
1075 void dumpInnerHTML(WebCore::HTMLElement*); | 1075 void dumpInnerHTML(WebCore::HTMLElement*); |
1076 | 1076 |
1077 void dumpInnerHTML(WebCore::HTMLElement* element) | 1077 void dumpInnerHTML(WebCore::HTMLElement* element) |
1078 { | 1078 { |
1079 printf("%s\n", element->innerHTML().ascii().data()); | 1079 printf("%s\n", element->innerHTML().ascii().data()); |
1080 } | 1080 } |
1081 #endif | 1081 #endif |
OLD | NEW |