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 String HTMLTextFormControlElement::directionForFormData() const | |
704 { | |
705 for (const HTMLElement* element = this; element; element = Traversal<HTMLEle
ment>::firstAncestor(*element)) { | |
706 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAtt
r); | |
707 if (dirAttributeValue.isNull()) | |
708 continue; | |
709 | |
710 if (equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dir
AttributeValue, "ltr")) | |
711 return dirAttributeValue; | |
712 | |
713 if (equalIgnoringCase(dirAttributeValue, "auto")) { | |
714 bool isAuto; | |
715 TextDirection textDirection = element->directionalityIfhasDirAutoAtt
ribute(isAuto); | |
716 return textDirection == RTL ? "rtl" : "ltr"; | |
717 } | |
718 } | |
719 | |
720 return "ltr"; | |
721 } | |
722 | |
723 HTMLElement* HTMLTextFormControlElement::innerEditorElement() const | 703 HTMLElement* HTMLTextFormControlElement::innerEditorElement() const |
724 { | 704 { |
725 return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementName
s::innerEditor())); | 705 return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementName
s::innerEditor())); |
726 } | 706 } |
727 | 707 |
728 static Position innerNodePosition(const Position& innerPosition) | 708 static Position innerNodePosition(const Position& innerPosition) |
729 { | 709 { |
730 ASSERT(innerPosition.anchorType() != Position::PositionIsBeforeAnchor); | 710 ASSERT(innerPosition.anchorType() != Position::PositionIsBeforeAnchor); |
731 ASSERT(innerPosition.anchorType() != Position::PositionIsAfterAnchor); | 711 ASSERT(innerPosition.anchorType() != Position::PositionIsAfterAnchor); |
732 HTMLElement* element = toHTMLElement(innerPosition.anchorNode()); | 712 HTMLElement* element = toHTMLElement(innerPosition.anchorNode()); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 Text* textNode = toText(node); | 938 Text* textNode = toText(node); |
959 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); | 939 size_t firstLineBreak = textNode->data().find('\n', isPivotNode ? pi
votPosition.offsetInContainerNode() : 0); |
960 if (firstLineBreak != kNotFound) | 940 if (firstLineBreak != kNotFound) |
961 return Position(textNode, firstLineBreak + 1); | 941 return Position(textNode, firstLineBreak + 1); |
962 } | 942 } |
963 } | 943 } |
964 return endOfInnerText(textFormControl); | 944 return endOfInnerText(textFormControl); |
965 } | 945 } |
966 | 946 |
967 } // namespace Webcore | 947 } // namespace Webcore |
OLD | NEW |