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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 , m_disabled(false) | 48 , m_disabled(false) |
49 , m_isReadOnly(false) | 49 , m_isReadOnly(false) |
50 , m_isRequired(false) | 50 , m_isRequired(false) |
51 , m_valueMatchesRenderer(false) | 51 , m_valueMatchesRenderer(false) |
52 , m_ancestorDisabledState(AncestorDisabledStateUnknown) | 52 , m_ancestorDisabledState(AncestorDisabledStateUnknown) |
53 , m_dataListAncestorState(Unknown) | 53 , m_dataListAncestorState(Unknown) |
54 , m_willValidateInitialized(false) | 54 , m_willValidateInitialized(false) |
55 , m_willValidate(true) | 55 , m_willValidate(true) |
56 , m_isValid(true) | 56 , m_isValid(true) |
57 , m_wasChangedSinceLastFormControlChangeEvent(false) | 57 , m_wasChangedSinceLastFormControlChangeEvent(false) |
| 58 , m_wasFocusedByMouse(false) |
58 , m_hasAutofocused(false) | 59 , m_hasAutofocused(false) |
59 { | 60 { |
60 setForm(form ? form : findFormAncestor()); | 61 setForm(form ? form : findFormAncestor()); |
61 setHasCustomStyleCallbacks(); | 62 setHasCustomStyleCallbacks(); |
62 } | 63 } |
63 | 64 |
64 HTMLFormControlElement::~HTMLFormControlElement() | 65 HTMLFormControlElement::~HTMLFormControlElement() |
65 { | 66 { |
66 } | 67 } |
67 | 68 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 if (renderer() && (!renderer()->isBox() || toRenderBox(renderer())->size().i
sEmpty())) | 313 if (renderer() && (!renderer()->isBox() || toRenderBox(renderer())->size().i
sEmpty())) |
313 return false; | 314 return false; |
314 return HTMLElement::rendererIsFocusable(); | 315 return HTMLElement::rendererIsFocusable(); |
315 } | 316 } |
316 | 317 |
317 bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent*) const | 318 bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent*) const |
318 { | 319 { |
319 return isFocusable() && document()->frame(); | 320 return isFocusable() && document()->frame(); |
320 } | 321 } |
321 | 322 |
322 bool HTMLFormControlElement::isMouseFocusable() const | 323 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const |
323 { | 324 { |
324 return false; | 325 return false; |
325 } | 326 } |
326 | 327 |
| 328 void HTMLFormControlElement::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode,
FocusDirection direction) |
| 329 { |
| 330 m_wasFocusedByMouse = direction == FocusDirectionMouse; |
| 331 HTMLElement::dispatchFocusEvent(oldFocusedNode, direction); |
| 332 } |
| 333 |
| 334 bool HTMLFormControlElement::shouldHaveFocusAppearance() const |
| 335 { |
| 336 ASSERT(focused()); |
| 337 return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse; |
| 338 } |
| 339 |
| 340 void HTMLFormControlElement::willCallDefaultEventHandler(const Event& event) |
| 341 { |
| 342 if (!event.isKeyboardEvent() || event.type() != eventNames().keydownEvent) |
| 343 return; |
| 344 if (!m_wasFocusedByMouse) |
| 345 return; |
| 346 m_wasFocusedByMouse = false; |
| 347 if (renderer()) |
| 348 renderer()->repaint(); |
| 349 } |
| 350 |
| 351 |
327 short HTMLFormControlElement::tabIndex() const | 352 short HTMLFormControlElement::tabIndex() const |
328 { | 353 { |
329 // Skip the supportsFocus check in HTMLElement. | 354 // Skip the supportsFocus check in HTMLElement. |
330 return Element::tabIndex(); | 355 return Element::tabIndex(); |
331 } | 356 } |
332 | 357 |
333 bool HTMLFormControlElement::recalcWillValidate() const | 358 bool HTMLFormControlElement::recalcWillValidate() const |
334 { | 359 { |
335 if (m_dataListAncestorState == Unknown) { | 360 if (m_dataListAncestorState == Unknown) { |
336 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest
or->parentNode()) { | 361 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest
or->parentNode()) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 493 } |
469 | 494 |
470 void HTMLFormControlElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const | 495 void HTMLFormControlElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const |
471 { | 496 { |
472 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 497 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
473 LabelableElement::reportMemoryUsage(memoryObjectInfo); | 498 LabelableElement::reportMemoryUsage(memoryObjectInfo); |
474 info.addMember(m_validationMessage, "validationMessage"); | 499 info.addMember(m_validationMessage, "validationMessage"); |
475 } | 500 } |
476 | 501 |
477 } // namespace Webcore | 502 } // namespace Webcore |
OLD | NEW |