| 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/ElementShadow.h" |
| 42 #include "core/dom/shadow/ShadowRoot.h" |
| 41 #include "core/editing/markup.h" | 43 #include "core/editing/markup.h" |
| 42 #include "core/events/EventListener.h" | 44 #include "core/events/EventListener.h" |
| 43 #include "core/events/KeyboardEvent.h" | 45 #include "core/events/KeyboardEvent.h" |
| 44 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
| 45 #include "core/html/HTMLBRElement.h" | 47 #include "core/html/HTMLBRElement.h" |
| 46 #include "core/html/HTMLFormElement.h" | 48 #include "core/html/HTMLFormElement.h" |
| 47 #include "core/html/HTMLInputElement.h" | 49 #include "core/html/HTMLInputElement.h" |
| 48 #include "core/html/HTMLTemplateElement.h" | 50 #include "core/html/HTMLTemplateElement.h" |
| 49 #include "core/html/HTMLTextFormControlElement.h" | 51 #include "core/html/HTMLTextFormControlElement.h" |
| 50 #include "core/html/parser/HTMLParserIdioms.h" | 52 #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)); | 632 return node->isHTMLElement() && (isHTMLBDIElement(*node) || toHTMLElement(no
de)->hasAttribute(dirAttr)); |
| 631 } | 633 } |
| 632 | 634 |
| 633 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN
ode = 0) | 635 static void setHasDirAutoFlagRecursively(Node* firstNode, bool flag, Node* lastN
ode = 0) |
| 634 { | 636 { |
| 635 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); | 637 firstNode->setSelfOrAncestorHasDirAutoAttribute(flag); |
| 636 | 638 |
| 637 Node* node = firstNode->firstChild(); | 639 Node* node = firstNode->firstChild(); |
| 638 | 640 |
| 639 while (node) { | 641 while (node) { |
| 640 if (node->selfOrAncestorHasDirAutoAttribute() == flag) | |
| 641 return; | |
| 642 | |
| 643 if (elementAffectsDirectionality(node)) { | 642 if (elementAffectsDirectionality(node)) { |
| 644 if (node == lastNode) | 643 if (node == lastNode) |
| 645 return; | 644 return; |
| 646 node = NodeTraversal::nextSkippingChildren(*node, firstNode); | 645 node = NodeTraversal::nextSkippingChildren(*node, firstNode); |
| 647 continue; | 646 continue; |
| 648 } | 647 } |
| 649 node->setSelfOrAncestorHasDirAutoAttribute(flag); | 648 node->setSelfOrAncestorHasDirAutoAttribute(flag); |
| 650 if (node == lastNode) | 649 if (node == lastNode) |
| 651 return; | 650 return; |
| 652 node = NodeTraversal::next(*node, firstNode); | 651 node = NodeTraversal::next(*node, firstNode); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 return; | 745 return; |
| 747 } | 746 } |
| 748 } | 747 } |
| 749 } | 748 } |
| 750 } | 749 } |
| 751 | 750 |
| 752 void HTMLElement::calculateAndAdjustDirectionality() | 751 void HTMLElement::calculateAndAdjustDirectionality() |
| 753 { | 752 { |
| 754 Node* strongDirectionalityTextNode; | 753 Node* strongDirectionalityTextNode; |
| 755 TextDirection textDirection = directionality(&strongDirectionalityTextNode); | 754 TextDirection textDirection = directionality(&strongDirectionalityTextNode); |
| 756 setHasDirAutoFlagRecursively(this, true, strongDirectionalityTextNode); | 755 setHasDirAutoFlagRecursively(this, hasDirectionAuto(), strongDirectionalityT
extNode); |
| 756 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
| 757 setHasDirAutoFlagRecursively(root, hasDirectionAuto()); |
| 757 if (renderer() && renderer()->style() && renderer()->style()->direction() !=
textDirection) | 758 if (renderer() && renderer()->style() && renderer()->style()->direction() !=
textDirection) |
| 758 setNeedsStyleRecalc(SubtreeStyleChange); | 759 setNeedsStyleRecalc(SubtreeStyleChange); |
| 759 } | 760 } |
| 760 | 761 |
| 761 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC
hange, int childCountDelta) | 762 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeC
hange, int childCountDelta) |
| 762 { | 763 { |
| 763 if (document().renderView() && childCountDelta < 0) { | 764 if (document().renderView() && childCountDelta < 0) { |
| 764 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC
hange) : 0; | 765 Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(*beforeC
hange) : 0; |
| 765 for (int counter = 0; node && counter < childCountDelta; counter++, node
= NodeTraversal::nextSkippingChildren(*node)) { | 766 for (int counter = 0; node && counter < childCountDelta; counter++, node
= NodeTraversal::nextSkippingChildren(*node)) { |
| 766 if (elementAffectsDirectionality(node)) | 767 if (elementAffectsDirectionality(node)) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 #ifndef NDEBUG | 956 #ifndef NDEBUG |
| 956 | 957 |
| 957 // For use in the debugger | 958 // For use in the debugger |
| 958 void dumpInnerHTML(WebCore::HTMLElement*); | 959 void dumpInnerHTML(WebCore::HTMLElement*); |
| 959 | 960 |
| 960 void dumpInnerHTML(WebCore::HTMLElement* element) | 961 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 961 { | 962 { |
| 962 printf("%s\n", element->innerHTML().ascii().data()); | 963 printf("%s\n", element->innerHTML().ascii().data()); |
| 963 } | 964 } |
| 964 #endif | 965 #endif |
| OLD | NEW |