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, 2008, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 { | 234 { |
235 // If a given text area can be focused at all, then it will always be keyboa
rd focusable. | 235 // If a given text area can be focused at all, then it will always be keyboa
rd focusable. |
236 return isFocusable(); | 236 return isFocusable(); |
237 } | 237 } |
238 | 238 |
239 bool HTMLTextAreaElement::shouldShowFocusRingOnMouseFocus() const | 239 bool HTMLTextAreaElement::shouldShowFocusRingOnMouseFocus() const |
240 { | 240 { |
241 return true; | 241 return true; |
242 } | 242 } |
243 | 243 |
244 void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) | 244 void HTMLTextAreaElement::updateFocusAppearance(SelectionBehaviorOnFocus selecti
onBehavior) |
245 { | 245 { |
246 if (!restorePreviousSelection) | 246 switch (selectionBehavior) { |
| 247 case SelectionBehaviorOnFocus::Reset: |
247 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent)
; | 248 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent)
; |
248 else | 249 break; |
| 250 case SelectionBehaviorOnFocus::Restore: |
249 restoreCachedSelection(); | 251 restoreCachedSelection(); |
250 | 252 break; |
| 253 } |
251 if (document().frame()) | 254 if (document().frame()) |
252 document().frame()->selection().revealSelection(); | 255 document().frame()->selection().revealSelection(); |
253 } | 256 } |
254 | 257 |
255 void HTMLTextAreaElement::defaultEventHandler(Event* event) | 258 void HTMLTextAreaElement::defaultEventHandler(Event* event) |
256 { | 259 { |
257 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || even
t->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur
)) | 260 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || even
t->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur
)) |
258 forwardEvent(event); | 261 forwardEvent(event); |
259 else if (layoutObject() && event->isBeforeTextInsertedEvent()) | 262 else if (layoutObject() && event->isBeforeTextInsertedEvent()) |
260 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even
t)); | 263 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even
t)); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 649 |
647 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s
ource) | 650 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s
ource) |
648 { | 651 { |
649 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle
ment&>(source); | 652 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle
ment&>(source); |
650 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 653 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
651 m_isDirty = sourceElement.m_isDirty; | 654 m_isDirty = sourceElement.m_isDirty; |
652 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); | 655 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); |
653 } | 656 } |
654 | 657 |
655 } // namespace blink | 658 } // namespace blink |
OLD | NEW |