| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 !position.anchorNode()->ownerShadowHost() || | 863 !position.anchorNode()->ownerShadowHost() || |
| 864 (position.anchorNode()->parentNode() && | 864 (position.anchorNode()->parentNode() && |
| 865 position.anchorNode()->parentNode()->isShadowRoot())); | 865 position.anchorNode()->parentNode()->isShadowRoot())); |
| 866 return enclosingTextControl(position.computeContainerNode()); | 866 return enclosingTextControl(position.computeContainerNode()); |
| 867 } | 867 } |
| 868 | 868 |
| 869 TextControlElement* enclosingTextControl(Node* container) { | 869 TextControlElement* enclosingTextControl(Node* container) { |
| 870 if (!container) | 870 if (!container) |
| 871 return nullptr; | 871 return nullptr; |
| 872 Element* ancestor = container->ownerShadowHost(); | 872 Element* ancestor = container->ownerShadowHost(); |
| 873 return ancestor && isTextControlElement(*ancestor) && | 873 |
| 874 container->containingShadowRoot()->type() == | 874 if (!ancestor || !isTextControlElement(*ancestor)) |
| 875 ShadowRootType::UserAgent | 875 return nullptr; |
| 876 ? toTextControlElement(ancestor) | 876 |
| 877 : 0; | 877 // textarea.shadowRoot is considered not enclosed. |
| 878 if (container->isShadowRoot() && |
| 879 toShadowRoot(container)->type() == ShadowRootType::UserAgent && |
| 880 &toShadowRoot(container)->host() == ancestor) |
| 881 return nullptr; |
| 882 |
| 883 if (container->containingShadowRoot()->type() != ShadowRootType::UserAgent) |
| 884 return nullptr; |
| 885 |
| 886 return toTextControlElement(ancestor); |
| 878 } | 887 } |
| 879 | 888 |
| 880 String TextControlElement::directionForFormData() const { | 889 String TextControlElement::directionForFormData() const { |
| 881 for (const HTMLElement* element = this; element; | 890 for (const HTMLElement* element = this; element; |
| 882 element = Traversal<HTMLElement>::firstAncestor(*element)) { | 891 element = Traversal<HTMLElement>::firstAncestor(*element)) { |
| 883 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAttr); | 892 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAttr); |
| 884 if (dirAttributeValue.isNull()) | 893 if (dirAttributeValue.isNull()) |
| 885 continue; | 894 continue; |
| 886 | 895 |
| 887 if (equalIgnoringCase(dirAttributeValue, "rtl") || | 896 if (equalIgnoringCase(dirAttributeValue, "rtl") || |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 | 1174 |
| 1166 void TextControlElement::copyNonAttributePropertiesFromElement( | 1175 void TextControlElement::copyNonAttributePropertiesFromElement( |
| 1167 const Element& source) { | 1176 const Element& source) { |
| 1168 const TextControlElement& sourceElement = | 1177 const TextControlElement& sourceElement = |
| 1169 static_cast<const TextControlElement&>(source); | 1178 static_cast<const TextControlElement&>(source); |
| 1170 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1179 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1171 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1180 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1172 } | 1181 } |
| 1173 | 1182 |
| 1174 } // namespace blink | 1183 } // namespace blink |
| OLD | NEW |