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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 UpdatePlaceholderVisibility(); | 92 UpdatePlaceholderVisibility(); |
93 HandleBlurEvent(); | 93 HandleBlurEvent(); |
94 HTMLFormControlElementWithState::DispatchBlurEvent(new_focused_element, type, | 94 HTMLFormControlElementWithState::DispatchBlurEvent(new_focused_element, type, |
95 source_capabilities); | 95 source_capabilities); |
96 } | 96 } |
97 | 97 |
98 void TextControlElement::DefaultEventHandler(Event* event) { | 98 void TextControlElement::DefaultEventHandler(Event* event) { |
99 if (event->type() == EventTypeNames::webkitEditableContentChanged && | 99 if (event->type() == EventTypeNames::webkitEditableContentChanged && |
100 GetLayoutObject() && GetLayoutObject()->IsTextControl()) { | 100 GetLayoutObject() && GetLayoutObject()->IsTextControl()) { |
101 last_change_was_user_edit_ = !GetDocument().IsRunningExecCommand(); | 101 last_change_was_user_edit_ = !GetDocument().IsRunningExecCommand(); |
| 102 |
| 103 if (IsFocused()) { |
| 104 // Updating the cache in SelectionChanged() isn't enough because |
| 105 // SelectionChanged() is not called if: |
| 106 // - Text nodes in the inner-editor is split to multiple, and |
| 107 // - The caret is on the beginning of a Text node, and its previous node |
| 108 // is updated, or |
| 109 // - The caret is on the end of a text node, and its next node is updated. |
| 110 CacheSelection(ComputeSelectionStart(), ComputeSelectionEnd(), |
| 111 ComputeSelectionDirection()); |
| 112 } |
| 113 |
102 SubtreeHasChanged(); | 114 SubtreeHasChanged(); |
103 return; | 115 return; |
104 } | 116 } |
105 | 117 |
106 HTMLFormControlElementWithState::DefaultEventHandler(event); | 118 HTMLFormControlElementWithState::DefaultEventHandler(event); |
107 } | 119 } |
108 | 120 |
109 void TextControlElement::ForwardEvent(Event* event) { | 121 void TextControlElement::ForwardEvent(Event* event) { |
110 if (event->type() == EventTypeNames::blur || | 122 if (event->type() == EventTypeNames::blur || |
111 event->type() == EventTypeNames::focus) | 123 event->type() == EventTypeNames::focus) |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 | 971 |
960 void TextControlElement::CopyNonAttributePropertiesFromElement( | 972 void TextControlElement::CopyNonAttributePropertiesFromElement( |
961 const Element& source) { | 973 const Element& source) { |
962 const TextControlElement& source_element = | 974 const TextControlElement& source_element = |
963 static_cast<const TextControlElement&>(source); | 975 static_cast<const TextControlElement&>(source); |
964 last_change_was_user_edit_ = source_element.last_change_was_user_edit_; | 976 last_change_was_user_edit_ = source_element.last_change_was_user_edit_; |
965 HTMLFormControlElement::CopyNonAttributePropertiesFromElement(source); | 977 HTMLFormControlElement::CopyNonAttributePropertiesFromElement(source); |
966 } | 978 } |
967 | 979 |
968 } // namespace blink | 980 } // namespace blink |
OLD | NEW |