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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 // HTMLElement::isFocusable handles visibility and calls suportsFocus which | 315 // HTMLElement::isFocusable handles visibility and calls suportsFocus which |
315 // will cover the disabled case. | 316 // will cover the disabled case. |
316 return HTMLElement::isFocusable(); | 317 return HTMLElement::isFocusable(); |
317 } | 318 } |
318 | 319 |
319 bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent*) const | 320 bool HTMLFormControlElement::isKeyboardFocusable(KeyboardEvent*) const |
320 { | 321 { |
321 return isFocusable() && document()->frame(); | 322 return isFocusable() && document()->frame(); |
322 } | 323 } |
323 | 324 |
324 bool HTMLFormControlElement::isMouseFocusable() const | 325 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const |
325 { | 326 { |
326 return false; | 327 return false; |
327 } | 328 } |
328 | 329 |
330 void HTMLFormControlElement::dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode, FocusDirection direction) | |
331 { | |
332 m_wasFocusedByMouse = direction == FocusDirectionMouse; | |
333 HTMLElement::dispatchFocusEvent(oldFocusedNode, direction); | |
334 } | |
335 | |
336 bool HTMLFormControlElement::shouldHaveFocusAppearance() const | |
337 { | |
338 return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse; | |
339 } | |
340 | |
341 void HTMLFormControlElement::willHandleKeyDownEvent() | |
ojan
2013/05/31 22:48:16
Could this instead be HTMLFormControlElement::defa
tkent
2013/06/02 23:52:14
It's hard because there are many "if (event->defau
| |
342 { | |
343 if (!m_wasFocusedByMouse) | |
344 return; | |
345 m_wasFocusedByMouse = false; | |
ojan
2013/05/31 22:48:16
Do you also need to handle blur and clear this boo
tkent
2013/06/02 23:52:14
It's unnecessary. The flag should be referred only
| |
346 if (renderer()) | |
347 renderer()->repaint(); | |
348 } | |
349 | |
350 | |
329 short HTMLFormControlElement::tabIndex() const | 351 short HTMLFormControlElement::tabIndex() const |
330 { | 352 { |
331 // Skip the supportsFocus check in HTMLElement. | 353 // Skip the supportsFocus check in HTMLElement. |
332 return Element::tabIndex(); | 354 return Element::tabIndex(); |
333 } | 355 } |
334 | 356 |
335 bool HTMLFormControlElement::recalcWillValidate() const | 357 bool HTMLFormControlElement::recalcWillValidate() const |
336 { | 358 { |
337 if (m_dataListAncestorState == Unknown) { | 359 if (m_dataListAncestorState == Unknown) { |
338 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest or->parentNode()) { | 360 for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancest or->parentNode()) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 } | 495 } |
474 | 496 |
475 void HTMLFormControlElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf o) const | 497 void HTMLFormControlElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf o) const |
476 { | 498 { |
477 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); | 499 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); |
478 LabelableElement::reportMemoryUsage(memoryObjectInfo); | 500 LabelableElement::reportMemoryUsage(memoryObjectInfo); |
479 info.addMember(m_validationMessage, "validationMessage"); | 501 info.addMember(m_validationMessage, "validationMessage"); |
480 } | 502 } |
481 | 503 |
482 } // namespace Webcore | 504 } // namespace Webcore |
OLD | NEW |