| 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 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 } | 693 } |
| 694 | 694 |
| 695 HTMLTextFormControlElement* enclosingTextFormControl(Node* container) | 695 HTMLTextFormControlElement* enclosingTextFormControl(Node* container) |
| 696 { | 696 { |
| 697 if (!container) | 697 if (!container) |
| 698 return 0; | 698 return 0; |
| 699 Element* ancestor = container->shadowHost(); | 699 Element* ancestor = container->shadowHost(); |
| 700 return ancestor && isHTMLTextFormControlElement(*ancestor) && container->con
tainingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot ? toHTMLTextFormC
ontrolElement(ancestor) : 0; | 700 return ancestor && isHTMLTextFormControlElement(*ancestor) && container->con
tainingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot ? toHTMLTextFormC
ontrolElement(ancestor) : 0; |
| 701 } | 701 } |
| 702 | 702 |
| 703 static const HTMLElement* parentHTMLElement(const Element* element) | |
| 704 { | |
| 705 while (element) { | |
| 706 element = element->parentElement(); | |
| 707 if (element && element->isHTMLElement()) | |
| 708 return toHTMLElement(element); | |
| 709 } | |
| 710 return 0; | |
| 711 } | |
| 712 | |
| 713 String HTMLTextFormControlElement::directionForFormData() const | 703 String HTMLTextFormControlElement::directionForFormData() const |
| 714 { | 704 { |
| 715 for (const HTMLElement* element = this; element; element = parentHTMLElement
(element)) { | 705 for (const HTMLElement* element = this; element; element = Traversal<HTMLEle
ment>::firstAncestor(*element)) { |
| 716 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAtt
r); | 706 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAtt
r); |
| 717 if (dirAttributeValue.isNull()) | 707 if (dirAttributeValue.isNull()) |
| 718 continue; | 708 continue; |
| 719 | 709 |
| 720 if (equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dir
AttributeValue, "ltr")) | 710 if (equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dir
AttributeValue, "ltr")) |
| 721 return dirAttributeValue; | 711 return dirAttributeValue; |
| 722 | 712 |
| 723 if (equalIgnoringCase(dirAttributeValue, "auto")) { | 713 if (equalIgnoringCase(dirAttributeValue, "auto")) { |
| 724 bool isAuto; | 714 bool isAuto; |
| 725 TextDirection textDirection = element->directionalityIfhasDirAutoAtt
ribute(isAuto); | 715 TextDirection textDirection = element->directionalityIfhasDirAutoAtt
ribute(isAuto); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 Text* textNode = toText(node); | 958 Text* textNode = toText(node); |
| 969 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); | 959 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); |
| 970 if (firstLineBreak != kNotFound) | 960 if (firstLineBreak != kNotFound) |
| 971 return Position(textNode, firstLineBreak + 1); | 961 return Position(textNode, firstLineBreak + 1); |
| 972 } | 962 } |
| 973 } | 963 } |
| 974 return endOfInnerText(textFormControl); | 964 return endOfInnerText(textFormControl); |
| 975 } | 965 } |
| 976 | 966 |
| 977 } // namespace Webcore | 967 } // namespace Webcore |
| OLD | NEW |