| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 HTMLElement* innerEditor = innerEditorElement(); | 370 HTMLElement* innerEditor = innerEditorElement(); |
| 371 if (!frame || !innerEditor) | 371 if (!frame || !innerEditor) |
| 372 return; | 372 return; |
| 373 | 373 |
| 374 Position startPosition = positionForIndex(innerEditor, start); | 374 Position startPosition = positionForIndex(innerEditor, start); |
| 375 Position endPosition = start == end ? startPosition : positionForIndex(inner
Editor, end); | 375 Position endPosition = start == end ? startPosition : positionForIndex(inner
Editor, end); |
| 376 | 376 |
| 377 ASSERT(start == indexForPosition(innerEditor, startPosition)); | 377 ASSERT(start == indexForPosition(innerEditor, startPosition)); |
| 378 ASSERT(end == indexForPosition(innerEditor, endPosition)); | 378 ASSERT(end == indexForPosition(innerEditor, endPosition)); |
| 379 | 379 |
| 380 #if ENABLE(ASSERT) |
| 380 // startPosition and endPosition can be null position for example when | 381 // startPosition and endPosition can be null position for example when |
| 381 // "-webkit-user-select: none" style attribute is specified. | 382 // "-webkit-user-select: none" style attribute is specified. |
| 382 if (startPosition.isNotNull() && endPosition.isNotNull()) { | 383 if (startPosition.isNotNull() && endPosition.isNotNull()) { |
| 383 ASSERT(startPosition.anchorNode()->shadowHost() == this | 384 ASSERT(startPosition.anchorNode()->shadowHost() == this |
| 384 && endPosition.anchorNode()->shadowHost() == this); | 385 && endPosition.anchorNode()->shadowHost() == this); |
| 385 } | 386 } |
| 387 #endif // ENABLE(ASSERT) |
| 386 VisibleSelection newSelection; | 388 VisibleSelection newSelection; |
| 387 if (direction == SelectionHasBackwardDirection) | 389 if (direction == SelectionHasBackwardDirection) |
| 388 newSelection.setWithoutValidation(endPosition, startPosition); | 390 newSelection.setWithoutValidation(endPosition, startPosition); |
| 389 else | 391 else |
| 390 newSelection.setWithoutValidation(startPosition, endPosition); | 392 newSelection.setWithoutValidation(startPosition, endPosition); |
| 391 newSelection.setIsDirectional(direction != SelectionHasNoDirection); | 393 newSelection.setIsDirectional(direction != SelectionHasNoDirection); |
| 392 | 394 |
| 393 frame->selection().setSelection(newSelection, FrameSelection::CloseTyping |
FrameSelection::ClearTypingStyle | (selectionOption == ChangeSelectionAndFocus ?
0 : FrameSelection::DoNotSetFocus)); | 395 frame->selection().setSelectionInTextFormControl(newSelection, FrameSelectio
n::CloseTyping | FrameSelection::ClearTypingStyle | (selectionOption == ChangeSe
lectionAndFocus ? 0 : FrameSelection::DoNotSetFocus)); |
| 394 if (eventBehaviour == DispatchSelectEvent) | 396 if (eventBehaviour == DispatchSelectEvent) |
| 395 scheduleSelectEvent(); | 397 scheduleSelectEvent(); |
| 396 } | 398 } |
| 397 | 399 |
| 398 VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c
onst | 400 VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c
onst |
| 399 { | 401 { |
| 400 if (index <= 0) | 402 if (index <= 0) |
| 401 return createVisiblePosition(firstPositionInNode(innerEditorElement())); | 403 return createVisiblePosition(firstPositionInNode(innerEditorElement())); |
| 402 Position start, end; | 404 Position start, end; |
| 403 bool selected = Range::selectNodeContents(innerEditorElement(), start, end); | 405 bool selected = Range::selectNodeContents(innerEditorElement(), start, end); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 } | 1017 } |
| 1016 | 1018 |
| 1017 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) | 1019 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) |
| 1018 { | 1020 { |
| 1019 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); | 1021 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); |
| 1020 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1022 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1021 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1023 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1022 } | 1024 } |
| 1023 | 1025 |
| 1024 } // namespace blink | 1026 } // namespace blink |
| OLD | NEW |