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

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

Issue 16194013: Mouse press should focus on any types of form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 } 2060 }
2061 2061
2062 // Only change the focus when clicking scrollbars if it can transfered t o a mouse focusable node. 2062 // Only change the focus when clicking scrollbars if it can transfered t o a mouse focusable node.
2063 if ((!node || !node->isMouseFocusable()) && isInsideScrollbar(mouseEvent .position())) 2063 if ((!node || !node->isMouseFocusable()) && isInsideScrollbar(mouseEvent .position()))
2064 return false; 2064 return false;
2065 2065
2066 // If focus shift is blocked, we eat the event. Note we should never cl ear swallowEvent 2066 // If focus shift is blocked, we eat the event. Note we should never cl ear swallowEvent
2067 // if the page already set it (e.g., by canceling default behavior). 2067 // if the page already set it (e.g., by canceling default behavior).
2068 if (Page* page = m_frame->page()) { 2068 if (Page* page = m_frame->page()) {
2069 if (node && node->isMouseFocusable()) { 2069 if (node && node->isMouseFocusable()) {
2070 if (!page->focusController()->setFocusedNode(node, m_frame)) 2070 if (!page->focusController()->setFocusedNode(node, m_frame, Focu sDirectionMouse))
2071 swallowEvent = true; 2071 swallowEvent = true;
2072 } else if (!node || !node->focused()) { 2072 } else if (!node || !node->focused()) {
2073 if (!page->focusController()->setFocusedNode(0, m_frame)) 2073 if (!page->focusController()->setFocusedNode(0, m_frame))
2074 swallowEvent = true; 2074 swallowEvent = true;
2075 } 2075 }
2076 } 2076 }
2077 } 2077 }
2078 2078
2079 return !swallowEvent; 2079 return !swallowEvent;
2080 } 2080 }
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 return; 3061 return;
3062 3062
3063 bool isOptioned = event->getModifierState("Alt"); 3063 bool isOptioned = event->getModifierState("Alt");
3064 bool isCommanded = event->getModifierState("Meta"); 3064 bool isCommanded = event->getModifierState("Meta");
3065 3065
3066 SelectionDirection direction = DirectionForward; 3066 SelectionDirection direction = DirectionForward;
3067 TextGranularity granularity = CharacterGranularity; 3067 TextGranularity granularity = CharacterGranularity;
3068 3068
3069 switch (focusDirectionForKey(event->keyIdentifier())) { 3069 switch (focusDirectionForKey(event->keyIdentifier())) {
3070 case FocusDirectionNone: 3070 case FocusDirectionNone:
3071 case FocusDirectionMouse:
3071 return; 3072 return;
3072 case FocusDirectionForward: 3073 case FocusDirectionForward:
3073 case FocusDirectionBackward: 3074 case FocusDirectionBackward:
3074 ASSERT_NOT_REACHED(); 3075 ASSERT_NOT_REACHED();
3075 return; 3076 return;
3076 case FocusDirectionUp: 3077 case FocusDirectionUp:
3077 direction = DirectionBackward; 3078 direction = DirectionBackward;
3078 granularity = isCommanded ? DocumentBoundary : LineGranularity; 3079 granularity = isCommanded ? DocumentBoundary : LineGranularity;
3079 break; 3080 break;
3080 case FocusDirectionDown: 3081 case FocusDirectionDown:
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 unsigned EventHandler::accessKeyModifiers() 3885 unsigned EventHandler::accessKeyModifiers()
3885 { 3886 {
3886 #if OS(DARWIN) 3887 #if OS(DARWIN)
3887 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3888 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3888 #else 3889 #else
3889 return PlatformEvent::AltKey; 3890 return PlatformEvent::AltKey;
3890 #endif 3891 #endif
3891 } 3892 }
3892 3893
3893 } // namespace WebCore 3894 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698