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 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 20 matching lines...) Expand all Loading... | |
| 31 #include "XMLNames.h" | 31 #include "XMLNames.h" |
| 32 #include "bindings/v8/ExceptionState.h" | 32 #include "bindings/v8/ExceptionState.h" |
| 33 #include "bindings/v8/ScriptEventListener.h" | 33 #include "bindings/v8/ScriptEventListener.h" |
| 34 #include "core/css/CSSMarkup.h" | 34 #include "core/css/CSSMarkup.h" |
| 35 #include "core/css/CSSValuePool.h" | 35 #include "core/css/CSSValuePool.h" |
| 36 #include "core/css/StylePropertySet.h" | 36 #include "core/css/StylePropertySet.h" |
| 37 #include "core/dom/DocumentFragment.h" | 37 #include "core/dom/DocumentFragment.h" |
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 39 #include "core/dom/NodeTraversal.h" | 39 #include "core/dom/NodeTraversal.h" |
| 40 #include "core/dom/Text.h" | 40 #include "core/dom/Text.h" |
| 41 #include "core/dom/shadow/ShadowRoot.h" | |
| 41 #include "core/editing/markup.h" | 42 #include "core/editing/markup.h" |
| 42 #include "core/events/EventListener.h" | 43 #include "core/events/EventListener.h" |
| 43 #include "core/events/KeyboardEvent.h" | 44 #include "core/events/KeyboardEvent.h" |
| 44 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
| 45 #include "core/html/HTMLBRElement.h" | 46 #include "core/html/HTMLBRElement.h" |
| 46 #include "core/html/HTMLFormElement.h" | 47 #include "core/html/HTMLFormElement.h" |
| 47 #include "core/html/HTMLInputElement.h" | 48 #include "core/html/HTMLInputElement.h" |
| 48 #include "core/html/HTMLTemplateElement.h" | 49 #include "core/html/HTMLTemplateElement.h" |
| 49 #include "core/html/HTMLTextFormControlElement.h" | 50 #include "core/html/HTMLTextFormControlElement.h" |
| 50 #include "core/html/parser/HTMLParserIdioms.h" | 51 #include "core/html/parser/HTMLParserIdioms.h" |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no de)->hasAttribute(dirAttr)); | 631 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no de)->hasAttribute(dirAttr)); |
| 631 } | 632 } |
| 632 | 633 |
| 633 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN ode = 0) | 634 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN ode = 0) |
| 634 { | 635 { |
| 635 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); | 636 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); |
| 636 | 637 |
| 637 Node* node = firstNode->firstChild(); | 638 Node* node = firstNode->firstChild(); |
| 638 | 639 |
| 639 while (node) { | 640 while (node) { |
| 640 if (node->selfOrAncestorHasDirAutoAttribute() == flag) | |
| 641 return; | |
| 642 | |
| 643 if (elementAffectsDirectionality(node)) { | 641 if (elementAffectsDirectionality(node)) { |
| 644 if (node == lastNode) | 642 if (node == lastNode) |
| 645 return; | 643 return; |
| 646 node = NodeTraversal::nextSkippingChildren(*node, firstNode); | 644 node = NodeTraversal::nextSkippingChildren(*node, firstNode); |
| 647 continue; | 645 continue; |
| 648 } | 646 } |
| 649 node->setSelfOrAncestorHasDirAutoAttribute(flag); | 647 node->setSelfOrAncestorHasDirAutoAttribute(flag); |
| 650 if (node == lastNode) | 648 if (node == lastNode) |
| 651 return; | 649 return; |
| 652 node = NodeTraversal::next(*node, firstNode); | 650 node = NodeTraversal::next(*node, firstNode); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 return; | 744 return; |
| 747 } | 745 } |
| 748 } | 746 } |
| 749 } | 747 } |
| 750 } | 748 } |
| 751 | 749 |
| 752 void HTMLElement::calculateAndAdjustDirectionality() | 750 void HTMLElement::calculateAndAdjustDirectionality() |
| 753 { | 751 { |
| 754 Node* strongDirectionalityTextNode; | 752 Node* strongDirectionalityTextNode; |
| 755 TextDirection textDirection = directionality(&strongDirectionalityTextNode); | 753 TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
| 756 setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); | 754 if (hasDirectionAuto()) { |
| 755 setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); | |
| 756 if (userAgentShadowRoot()) | |
| 757 setHasDirAutoFlagRecursively(userAgentShadowRoot(), true); | |
|
esprehn
2014/06/11 17:38:07
This should be doing:
for(ShadowRoot* root = youn
Habib Virji
2014/06/11 17:48:11
Done.
| |
| 758 } else { | |
| 759 setHasDirAutoFlagRecursively(this, false, strongDirectionalityTextNode); | |
| 760 if (userAgentShadowRoot()) | |
| 761 setHasDirAutoFlagRecursively(userAgentShadowRoot(), false); | |
| 762 } | |
| 757 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) | 763 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) |
| 758 setNeedsStyleRecalc(SubtreeStyleChange); | 764 setNeedsStyleRecalc(SubtreeStyleChange); |
| 759 } | 765 } |
| 760 | 766 |
| 761 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC hange, int childCountDelta) | 767 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC hange, int childCountDelta) |
| 762 { | 768 { |
| 763 if (document().renderView() && childCountDelta < 0) { | 769 if (document().renderView() && childCountDelta < 0) { |
| 764 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC hange) : 0; | 770 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC hange) : 0; |
| 765 for (int counter = 0; node && counter < childCountDelta; counter++, node = NodeTraversal::nextSkippingChildren(*node)) { | 771 for (int counter = 0; node && counter < childCountDelta; counter++, node = NodeTraversal::nextSkippingChildren(*node)) { |
| 766 if (elementAffectsDirectionality(node)) | 772 if (elementAffectsDirectionality(node)) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 955 #ifndef NDEBUG | 961 #ifndef NDEBUG |
| 956 | 962 |
| 957 // For use in the debugger | 963 // For use in the debugger |
| 958 void dumpInnerHTML(WebCore::HTMLElement*); | 964 void dumpInnerHTML(WebCore::HTMLElement*); |
| 959 | 965 |
| 960 void dumpInnerHTML(WebCore::HTMLElement* element) | 966 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 961 { | 967 { |
| 962 printf("%s\n", element->innerHTML().ascii().data()); | 968 printf("%s\n", element->innerHTML().ascii().data()); |
| 963 } | 969 } |
| 964 #endif | 970 #endif |
| OLD | NEW |