| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 , m_isAutofilled(false) | 51 , m_isAutofilled(false) |
| 52 , m_isReadOnly(false) | 52 , m_isReadOnly(false) |
| 53 , m_isRequired(false) | 53 , m_isRequired(false) |
| 54 , m_hasValidationMessage(false) | 54 , m_hasValidationMessage(false) |
| 55 , m_ancestorDisabledState(AncestorDisabledStateUnknown) | 55 , m_ancestorDisabledState(AncestorDisabledStateUnknown) |
| 56 , m_dataListAncestorState(Unknown) | 56 , m_dataListAncestorState(Unknown) |
| 57 , m_willValidateInitialized(false) | 57 , m_willValidateInitialized(false) |
| 58 , m_willValidate(true) | 58 , m_willValidate(true) |
| 59 , m_isValid(true) | 59 , m_isValid(true) |
| 60 , m_wasChangedSinceLastFormControlChangeEvent(false) | 60 , m_wasChangedSinceLastFormControlChangeEvent(false) |
| 61 , m_wasFocusedByMouse(false) | |
| 62 { | 61 { |
| 63 setHasCustomStyleCallbacks(); | 62 setHasCustomStyleCallbacks(); |
| 64 associateByParser(form); | 63 associateByParser(form); |
| 65 } | 64 } |
| 66 | 65 |
| 67 HTMLFormControlElement::~HTMLFormControlElement() | 66 HTMLFormControlElement::~HTMLFormControlElement() |
| 68 { | 67 { |
| 69 #if !ENABLE(OILPAN) | 68 #if !ENABLE(OILPAN) |
| 70 setForm(0); | 69 setForm(0); |
| 71 #endif | 70 #endif |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 { | 325 { |
| 327 // Skip tabIndex check in a parent class. | 326 // Skip tabIndex check in a parent class. |
| 328 return isFocusable(); | 327 return isFocusable(); |
| 329 } | 328 } |
| 330 | 329 |
| 331 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const | 330 bool HTMLFormControlElement::shouldShowFocusRingOnMouseFocus() const |
| 332 { | 331 { |
| 333 return false; | 332 return false; |
| 334 } | 333 } |
| 335 | 334 |
| 336 void HTMLFormControlElement::dispatchFocusEvent(Element* oldFocusedElement, Focu
sType type) | |
| 337 { | |
| 338 if (type != FocusTypePage) | |
| 339 m_wasFocusedByMouse = type == FocusTypeMouse; | |
| 340 HTMLElement::dispatchFocusEvent(oldFocusedElement, type); | |
| 341 } | |
| 342 | |
| 343 bool HTMLFormControlElement::shouldHaveFocusAppearance() const | |
| 344 { | |
| 345 ASSERT(focused()); | |
| 346 return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse; | |
| 347 } | |
| 348 | |
| 349 void HTMLFormControlElement::willCallDefaultEventHandler(const Event& event) | |
| 350 { | |
| 351 if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown) | |
| 352 return; | |
| 353 if (!m_wasFocusedByMouse) | |
| 354 return; | |
| 355 m_wasFocusedByMouse = false; | |
| 356 if (renderer()) | |
| 357 renderer()->setShouldDoFullPaintInvalidation(true); | |
| 358 } | |
| 359 | |
| 360 | |
| 361 short HTMLFormControlElement::tabIndex() const | 335 short HTMLFormControlElement::tabIndex() const |
| 362 { | 336 { |
| 363 // Skip the supportsFocus check in HTMLElement. | 337 // Skip the supportsFocus check in HTMLElement. |
| 364 return Element::tabIndex(); | 338 return Element::tabIndex(); |
| 365 } | 339 } |
| 366 | 340 |
| 367 bool HTMLFormControlElement::recalcWillValidate() const | 341 bool HTMLFormControlElement::recalcWillValidate() const |
| 368 { | 342 { |
| 369 if (m_dataListAncestorState == Unknown) { | 343 if (m_dataListAncestorState == Unknown) { |
| 370 if (Traversal<HTMLDataListElement>::firstAncestor(*this)) | 344 if (Traversal<HTMLDataListElement>::firstAncestor(*this)) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 521 |
| 548 void HTMLFormControlElement::setFocus(bool flag) | 522 void HTMLFormControlElement::setFocus(bool flag) |
| 549 { | 523 { |
| 550 LabelableElement::setFocus(flag); | 524 LabelableElement::setFocus(flag); |
| 551 | 525 |
| 552 if (!flag && wasChangedSinceLastFormControlChangeEvent()) | 526 if (!flag && wasChangedSinceLastFormControlChangeEvent()) |
| 553 dispatchFormControlChangeEvent(); | 527 dispatchFormControlChangeEvent(); |
| 554 } | 528 } |
| 555 | 529 |
| 556 } // namespace Webcore | 530 } // namespace Webcore |
| OLD | NEW |