| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 Position startPosition = positionForIndex(innerEditor, start); | 368 Position startPosition = positionForIndex(innerEditor, start); |
| 369 Position endPosition = start == end ? startPosition : positionForIndex(inner
Editor, end); | 369 Position endPosition = start == end ? startPosition : positionForIndex(inner
Editor, end); |
| 370 | 370 |
| 371 DCHECK_EQ(start, indexForPosition(innerEditor, startPosition)); | 371 DCHECK_EQ(start, indexForPosition(innerEditor, startPosition)); |
| 372 DCHECK_EQ(end, indexForPosition(innerEditor, endPosition)); | 372 DCHECK_EQ(end, indexForPosition(innerEditor, endPosition)); |
| 373 | 373 |
| 374 #if DCHECK_IS_ON() | 374 #if DCHECK_IS_ON() |
| 375 // startPosition and endPosition can be null position for example when | 375 // startPosition and endPosition can be null position for example when |
| 376 // "-webkit-user-select: none" style attribute is specified. | 376 // "-webkit-user-select: none" style attribute is specified. |
| 377 if (startPosition.isNotNull() && endPosition.isNotNull()) { | 377 if (startPosition.isNotNull() && endPosition.isNotNull()) { |
| 378 DCHECK_EQ(startPosition.anchorNode()->shadowHost(), this); | 378 DCHECK_EQ(startPosition.anchorNode()->ownerShadowHost(), this); |
| 379 DCHECK_EQ(endPosition.anchorNode()->shadowHost(), this); | 379 DCHECK_EQ(endPosition.anchorNode()->ownerShadowHost(), this); |
| 380 } | 380 } |
| 381 #endif // DCHECK_IS_ON() | 381 #endif // DCHECK_IS_ON() |
| 382 VisibleSelection newSelection; | 382 VisibleSelection newSelection; |
| 383 if (direction == SelectionHasBackwardDirection) | 383 if (direction == SelectionHasBackwardDirection) |
| 384 newSelection.setWithoutValidation(endPosition, startPosition); | 384 newSelection.setWithoutValidation(endPosition, startPosition); |
| 385 else | 385 else |
| 386 newSelection.setWithoutValidation(startPosition, endPosition); | 386 newSelection.setWithoutValidation(startPosition, endPosition); |
| 387 newSelection.setIsDirectional(direction != SelectionHasNoDirection); | 387 newSelection.setIsDirectional(direction != SelectionHasNoDirection); |
| 388 | 388 |
| 389 frame->selection().setSelection(newSelection, FrameSelection::DoNotAdjustInF
latTree | FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | Frame
Selection::DoNotSetFocus); | 389 frame->selection().setSelection(newSelection, FrameSelection::DoNotAdjustInF
latTree | FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | Frame
Selection::DoNotSetFocus); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 } | 744 } |
| 745 while (breakNode == node) | 745 while (breakNode == node) |
| 746 getNextSoftBreak(line, breakNode, breakOffset); | 746 getNextSoftBreak(line, breakNode, breakOffset); |
| 747 } | 747 } |
| 748 return result.toString(); | 748 return result.toString(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 HTMLTextFormControlElement* enclosingTextFormControl(const Position& position) | 751 HTMLTextFormControlElement* enclosingTextFormControl(const Position& position) |
| 752 { | 752 { |
| 753 DCHECK(position.isNull() || position.isOffsetInAnchor() | 753 DCHECK(position.isNull() || position.isOffsetInAnchor() |
| 754 || position.computeContainerNode() || !position.anchorNode()->shadowHost
() | 754 || position.computeContainerNode() || !position.anchorNode()->ownerShado
wHost() |
| 755 || (position.anchorNode()->parentNode() && position.anchorNode()->parent
Node()->isShadowRoot())); | 755 || (position.anchorNode()->parentNode() && position.anchorNode()->parent
Node()->isShadowRoot())); |
| 756 return enclosingTextFormControl(position.computeContainerNode()); | 756 return enclosingTextFormControl(position.computeContainerNode()); |
| 757 } | 757 } |
| 758 | 758 |
| 759 HTMLTextFormControlElement* enclosingTextFormControl(Node* container) | 759 HTMLTextFormControlElement* enclosingTextFormControl(Node* container) |
| 760 { | 760 { |
| 761 if (!container) | 761 if (!container) |
| 762 return nullptr; | 762 return nullptr; |
| 763 Element* ancestor = container->shadowHost(); | 763 Element* ancestor = container->ownerShadowHost(); |
| 764 return ancestor && isHTMLTextFormControlElement(*ancestor) && container->con
tainingShadowRoot()->type() == ShadowRootType::UserAgent ? toHTMLTextFormControl
Element(ancestor) : 0; | 764 return ancestor && isHTMLTextFormControlElement(*ancestor) && container->con
tainingShadowRoot()->type() == ShadowRootType::UserAgent ? toHTMLTextFormControl
Element(ancestor) : 0; |
| 765 } | 765 } |
| 766 | 766 |
| 767 String HTMLTextFormControlElement::directionForFormData() const | 767 String HTMLTextFormControlElement::directionForFormData() const |
| 768 { | 768 { |
| 769 for (const HTMLElement* element = this; element; element = Traversal<HTMLEle
ment>::firstAncestor(*element)) { | 769 for (const HTMLElement* element = this; element; element = Traversal<HTMLEle
ment>::firstAncestor(*element)) { |
| 770 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAtt
r); | 770 const AtomicString& dirAttributeValue = element->fastGetAttribute(dirAtt
r); |
| 771 if (dirAttributeValue.isNull()) | 771 if (dirAttributeValue.isNull()) |
| 772 continue; | 772 continue; |
| 773 | 773 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) | 1026 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) |
| 1027 { | 1027 { |
| 1028 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); | 1028 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); |
| 1029 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1029 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1030 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1030 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 } // namespace blink | 1033 } // namespace blink |
| OLD | NEW |