| 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 return true; | 235 return true; |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const | 238 bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const |
| 239 { | 239 { |
| 240 // If a given text area can be focused at all, then it will always be keyboa
rd focusable. | 240 // If a given text area can be focused at all, then it will always be keyboa
rd focusable. |
| 241 return isFocusable(); | 241 return isFocusable(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool HTMLTextAreaElement::isMouseFocusable() const | 244 bool HTMLTextAreaElement::shouldShowFocusRingOnMouseFocus() const |
| 245 { | 245 { |
| 246 return isFocusable(); | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) | 249 void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) |
| 250 { | 250 { |
| 251 if (!restorePreviousSelection || !hasCachedSelection()) { | 251 if (!restorePreviousSelection || !hasCachedSelection()) { |
| 252 // If this is the first focus, set a caret at the beginning of the text.
| 252 // If this is the first focus, set a caret at the beginning of the text.
|
| 253 // This matches some browsers' behavior; see bug 11746 Comment #15. | 253 // This matches some browsers' behavior; see bug 11746 Comment #15. |
| 254 // http://bugs.webkit.org/show_bug.cgi?id=11746#c15 | 254 // http://bugs.webkit.org/show_bug.cgi?id=11746#c15 |
| 255 setSelectionRange(0, 0); | 255 setSelectionRange(0, 0); |
| 256 } else | 256 } else |
| 257 restoreCachedSelection(); | 257 restoreCachedSelection(); |
| 258 | 258 |
| 259 if (document()->frame()) | 259 if (document()->frame()) |
| 260 document()->frame()->selection()->revealSelection(); | 260 document()->frame()->selection()->revealSelection(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void HTMLTextAreaElement::defaultEventHandler(Event* event) | 263 void HTMLTextAreaElement::defaultEventHandler(Event* event) |
| 264 { | 264 { |
| 265 if (event->type() == eventNames().keydownEvent) |
| 266 willHandleKeyDownEvent(); |
| 265 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h
asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames(
).blurEvent)) | 267 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h
asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames(
).blurEvent)) |
| 266 forwardEvent(event); | 268 forwardEvent(event); |
| 267 else if (renderer() && event->isBeforeTextInsertedEvent()) | 269 else if (renderer() && event->isBeforeTextInsertedEvent()) |
| 268 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even
t)); | 270 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even
t)); |
| 269 | 271 |
| 270 HTMLTextFormControlElement::defaultEventHandler(event); | 272 HTMLTextFormControlElement::defaultEventHandler(event); |
| 271 } | 273 } |
| 272 | 274 |
| 273 void HTMLTextAreaElement::subtreeHasChanged() | 275 void HTMLTextAreaElement::subtreeHasChanged() |
| 274 { | 276 { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); | 551 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); |
| 550 m_placeholder = placeholder.get(); | 552 m_placeholder = placeholder.get(); |
| 551 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi
cString::ConstructFromLiteral)); | 553 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi
cString::ConstructFromLiteral)); |
| 552 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION); | 554 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION); |
| 553 } | 555 } |
| 554 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); | 556 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); |
| 555 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 557 fixPlaceholderRenderer(m_placeholder, innerTextElement()); |
| 556 } | 558 } |
| 557 | 559 |
| 558 } | 560 } |
| OLD | NEW |