Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: Source/core/input/EventHandler.cpp

Issue 1144953007: Remove tabStop feature (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/input/EventHandler.h ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 // Only change the focus when clicking scrollbars if it can transfered to a 2062 // Only change the focus when clicking scrollbars if it can transfered to a
2063 // mouse focusable node. 2063 // mouse focusable node.
2064 if (!element && targetedEvent.hitTestResult().scrollbar()) 2064 if (!element && targetedEvent.hitTestResult().scrollbar())
2065 return true; 2065 return true;
2066 2066
2067 if (Page* page = m_frame->page()) { 2067 if (Page* page = m_frame->page()) {
2068 // If focus shift is blocked, we eat the event. Note we should never 2068 // If focus shift is blocked, we eat the event. Note we should never
2069 // clear swallowEvent if the page already set it (e.g., by canceling 2069 // clear swallowEvent if the page already set it (e.g., by canceling
2070 // default behavior). 2070 // default behavior).
2071 if (element) { 2071 if (element) {
2072 if (slideFocusOnShadowHostIfNecessary(*element))
2073 return true;
2074 if (!page->focusController().setFocusedElement(element, m_frame, Web FocusTypeMouse)) 2072 if (!page->focusController().setFocusedElement(element, m_frame, Web FocusTypeMouse))
2075 return true; 2073 return true;
2076 } else { 2074 } else {
2077 // We call setFocusedElement even with !element in order to blur 2075 // We call setFocusedElement even with !element in order to blur
2078 // current focus element when a link is clicked; this is expected by 2076 // current focus element when a link is clicked; this is expected by
2079 // some sites that rely on onChange handlers running from form 2077 // some sites that rely on onChange handlers running from form
2080 // fields before the button click is processed. 2078 // fields before the button click is processed.
2081 if (!page->focusController().setFocusedElement(0, m_frame)) 2079 if (!page->focusController().setFocusedElement(0, m_frame))
2082 return true; 2080 return true;
2083 } 2081 }
2084 } 2082 }
2085 2083
2086 return false; 2084 return false;
2087 } 2085 }
2088 2086
2089 bool EventHandler::slideFocusOnShadowHostIfNecessary(const Element& element)
2090 {
2091 if (element.shadowRoot() && !element.tabStop()) {
2092 Document* doc = m_frame->document();
2093 if (element.containsIncludingShadowDOM(doc->focusedElement())) {
2094 // If the inner element is already focused, do nothing.
2095 return true;
2096 }
2097
2098 // If the host has a focusable inner element, focus it. Otherwise, the h ost takes focus.
2099 Page* page = m_frame->page();
2100 ASSERT(page);
2101 Node* next = page->focusController().findFocusableNode(WebFocusTypeForwa rd, *element.shadowRoot());
2102 if (next && next->isElementNode() && element.containsIncludingShadowDOM( next)) {
2103 // Use WebFocusTypeForward instead of WebFocusTypeMouse here to mean the focus has slided.
2104 toElement(next)->focus(false, WebFocusTypeForward);
2105 return true;
2106 }
2107 }
2108 return false;
2109 }
2110
2111 bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event) 2087 bool EventHandler::handleWheelEvent(const PlatformWheelEvent& event)
2112 { 2088 {
2113 #define RETURN_WHEEL_EVENT_HANDLED() \ 2089 #define RETURN_WHEEL_EVENT_HANDLED() \
2114 { \ 2090 { \
2115 setFrameWasScrolledByUser(); \ 2091 setFrameWasScrolledByUser(); \
2116 return true; \ 2092 return true; \
2117 } 2093 }
2118 2094
2119 Document* doc = m_frame->document(); 2095 Document* doc = m_frame->document();
2120 2096
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 unsigned EventHandler::accessKeyModifiers() 4146 unsigned EventHandler::accessKeyModifiers()
4171 { 4147 {
4172 #if OS(MACOSX) 4148 #if OS(MACOSX)
4173 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4149 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4174 #else 4150 #else
4175 return PlatformEvent::AltKey; 4151 return PlatformEvent::AltKey;
4176 #endif 4152 #endif
4177 } 4153 }
4178 4154
4179 } // namespace blink 4155 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/input/EventHandler.h ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698