Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright 2014 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #include "config.h"
- #include "code/dom/FocusableElement.h"
- namespace blink {
- template <class ElementT>
- FocusableElement::FocusableElement()
- : m_wasFocusedByMouse(false)
- {
- }
- template <class ElementT>
- bool FocusableElement<ElementT>::shouldHaveFocusAppearance() const
- {
- ASSERT(focused());
- return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse;
- }
- template <class ElementT>
- void FocusableElement<ElementT>::dispatchFocusEvent(Element* oldFocusedElement, FocusType type)
- {
- if (type != FocusTypePage)
- m_wasFocusedByMouse = type == FocusTypeMouse;
- ElementT::dispatchFocusEvent(oldFocusedElement, type);
- }
- template <class ElementT>
- void FocusableElement<ElementT>::willCallDefaultEventHandler(const Event&)
- {
- if (!event.isKeyboardEvent() || event.type() != EventTypeNames::keydown)
- return;
- if (!m_wasFocusedByMouse)
- return;
- m_wasFocusedByMouse = false;
- if (renderer())
- renderer()->setShouldDoFullPaintInvalidation(true);
- }
- } // namespace blink
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement