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-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // and createContextualFragment on these tags. We have no tests to | 141 // and createContextualFragment on these tags. We have no tests to |
142 // verify this however, so this list could be totally wrong. | 142 // verify this however, so this list could be totally wrong. |
143 // This list was moved from the previous endTagRequirement() implementation. | 143 // This list was moved from the previous endTagRequirement() implementation. |
144 // This is also called from editing and assumed to be the list of tags | 144 // This is also called from editing and assumed to be the list of tags |
145 // for which no end tag should be serialized. It's unclear if the list for | 145 // for which no end tag should be serialized. It's unclear if the list for |
146 // IE compat and the list for serialization sanity are the same. | 146 // IE compat and the list for serialization sanity are the same. |
147 if (hasTagName(areaTag) || hasTagName(baseTag) || hasTagName(basefontTag) || | 147 if (hasTagName(areaTag) || hasTagName(baseTag) || hasTagName(basefontTag) || |
148 hasTagName(brTag) || hasTagName(colTag) || hasTagName(embedTag) || | 148 hasTagName(brTag) || hasTagName(colTag) || hasTagName(embedTag) || |
149 hasTagName(frameTag) || hasTagName(hrTag) || hasTagName(imageTag) || | 149 hasTagName(frameTag) || hasTagName(hrTag) || hasTagName(imageTag) || |
150 hasTagName(imgTag) || hasTagName(inputTag) || hasTagName(keygenTag) || | 150 hasTagName(imgTag) || hasTagName(inputTag) || hasTagName(keygenTag) || |
151 hasTagName(linkTag) || (RuntimeEnabledFeatures::contextMenuEnabled() && | 151 hasTagName(linkTag) || |
152 hasTagName(menuitemTag)) || | 152 (RuntimeEnabledFeatures::contextMenuEnabled() && |
| 153 hasTagName(menuitemTag)) || |
153 hasTagName(metaTag) || hasTagName(paramTag) || hasTagName(sourceTag) || | 154 hasTagName(metaTag) || hasTagName(paramTag) || hasTagName(sourceTag) || |
154 hasTagName(trackTag) || hasTagName(wbrTag)) | 155 hasTagName(trackTag) || hasTagName(wbrTag)) |
155 return true; | 156 return true; |
156 return false; | 157 return false; |
157 } | 158 } |
158 | 159 |
159 static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement* element) { | 160 static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement* element) { |
160 if (element->hasTagName(preTag) || element->hasTagName(textareaTag)) | 161 if (element->hasTagName(preTag) || element->hasTagName(textareaTag)) |
161 return CSSValueWebkitPlaintext; | 162 return CSSValueWebkitPlaintext; |
162 // FIXME: For bdo element, dir="auto" should result in "bidi-override isolate" | 163 // FIXME: For bdo element, dir="auto" should result in "bidi-override isolate" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 788 |
788 void HTMLElement::setDir(const AtomicString& value) { | 789 void HTMLElement::setDir(const AtomicString& value) { |
789 setAttribute(dirAttr, value); | 790 setAttribute(dirAttr, value); |
790 } | 791 } |
791 | 792 |
792 HTMLFormElement* HTMLElement::findFormAncestor() const { | 793 HTMLFormElement* HTMLElement::findFormAncestor() const { |
793 return Traversal<HTMLFormElement>::firstAncestor(*this); | 794 return Traversal<HTMLFormElement>::firstAncestor(*this); |
794 } | 795 } |
795 | 796 |
796 static inline bool elementAffectsDirectionality(const Node* node) { | 797 static inline bool elementAffectsDirectionality(const Node* node) { |
797 return node->isHTMLElement() && (isHTMLBDIElement(toHTMLElement(*node)) || | 798 return node->isHTMLElement() && |
798 toHTMLElement(*node).hasAttribute(dirAttr)); | 799 (isHTMLBDIElement(toHTMLElement(*node)) || |
| 800 toHTMLElement(*node).hasAttribute(dirAttr)); |
799 } | 801 } |
800 | 802 |
801 void HTMLElement::childrenChanged(const ChildrenChange& change) { | 803 void HTMLElement::childrenChanged(const ChildrenChange& change) { |
802 Element::childrenChanged(change); | 804 Element::childrenChanged(change); |
803 adjustDirectionalityIfNeededAfterChildrenChanged(change); | 805 adjustDirectionalityIfNeededAfterChildrenChanged(change); |
804 } | 806 } |
805 | 807 |
806 bool HTMLElement::hasDirectionAuto() const { | 808 bool HTMLElement::hasDirectionAuto() const { |
807 // <bdi> defaults to dir="auto" | 809 // <bdi> defaults to dir="auto" |
808 // https://html.spec.whatwg.org/multipage/semantics.html#the-bdi-element | 810 // https://html.spec.whatwg.org/multipage/semantics.html#the-bdi-element |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 Element* child) { | 899 Element* child) { |
898 DCHECK(selfOrAncestorHasDirAutoAttribute()); | 900 DCHECK(selfOrAncestorHasDirAutoAttribute()); |
899 TextDirection textDirection = directionality(); | 901 TextDirection textDirection = directionality(); |
900 if (layoutObject() && layoutObject()->style() && | 902 if (layoutObject() && layoutObject()->style() && |
901 layoutObject()->style()->direction() != textDirection) { | 903 layoutObject()->style()->direction() != textDirection) { |
902 Element* elementToAdjust = this; | 904 Element* elementToAdjust = this; |
903 for (; elementToAdjust; | 905 for (; elementToAdjust; |
904 elementToAdjust = FlatTreeTraversal::parentElement(*elementToAdjust)) { | 906 elementToAdjust = FlatTreeTraversal::parentElement(*elementToAdjust)) { |
905 if (elementAffectsDirectionality(elementToAdjust)) { | 907 if (elementAffectsDirectionality(elementToAdjust)) { |
906 elementToAdjust->setNeedsStyleRecalc( | 908 elementToAdjust->setNeedsStyleRecalc( |
907 LocalStyleChange, StyleChangeReasonForTracing::create( | 909 LocalStyleChange, |
908 StyleChangeReason::WritingModeChange)); | 910 StyleChangeReasonForTracing::create( |
| 911 StyleChangeReason::WritingModeChange)); |
909 return; | 912 return; |
910 } | 913 } |
911 } | 914 } |
912 } | 915 } |
913 } | 916 } |
914 | 917 |
915 void HTMLElement::calculateAndAdjustDirectionality() { | 918 void HTMLElement::calculateAndAdjustDirectionality() { |
916 TextDirection textDirection = directionality(); | 919 TextDirection textDirection = directionality(); |
917 if (layoutObject() && layoutObject()->style() && | 920 if (layoutObject() && layoutObject()->style() && |
918 layoutObject()->style()->direction() != textDirection) | 921 layoutObject()->style()->direction() != textDirection) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 | 1223 |
1221 #ifndef NDEBUG | 1224 #ifndef NDEBUG |
1222 | 1225 |
1223 // For use in the debugger | 1226 // For use in the debugger |
1224 void dumpInnerHTML(blink::HTMLElement*); | 1227 void dumpInnerHTML(blink::HTMLElement*); |
1225 | 1228 |
1226 void dumpInnerHTML(blink::HTMLElement* element) { | 1229 void dumpInnerHTML(blink::HTMLElement* element) { |
1227 printf("%s\n", element->innerHTML().ascii().data()); | 1230 printf("%s\n", element->innerHTML().ascii().data()); |
1228 } | 1231 } |
1229 #endif | 1232 #endif |
OLD | NEW |