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

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: rebase, common->default, etc. 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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 } 2038 }
2039 2039
2040 // Only change the focus when clicking scrollbars if it can transfered t o a mouse focusable node. 2040 // Only change the focus when clicking scrollbars if it can transfered t o a mouse focusable node.
2041 if ((!node || !node->isMouseFocusable()) && isInsideScrollbar(mouseEvent .position())) 2041 if ((!node || !node->isMouseFocusable()) && isInsideScrollbar(mouseEvent .position()))
2042 return false; 2042 return false;
2043 2043
2044 // If focus shift is blocked, we eat the event. Note we should never cl ear swallowEvent 2044 // If focus shift is blocked, we eat the event. Note we should never cl ear swallowEvent
2045 // if the page already set it (e.g., by canceling default behavior). 2045 // if the page already set it (e.g., by canceling default behavior).
2046 if (Page* page = m_frame->page()) { 2046 if (Page* page = m_frame->page()) {
2047 if (node && node->isMouseFocusable()) { 2047 if (node && node->isMouseFocusable()) {
2048 if (!page->focusController()->setFocusedNode(node, m_frame)) 2048 if (!page->focusController()->setFocusedNode(node, m_frame, Focu sDirectionMouse))
2049 swallowEvent = true; 2049 swallowEvent = true;
2050 } else if (!node || !node->focused()) { 2050 } else if (!node || !node->focused()) {
2051 if (!page->focusController()->setFocusedNode(0, m_frame)) 2051 if (!page->focusController()->setFocusedNode(0, m_frame))
2052 swallowEvent = true; 2052 swallowEvent = true;
2053 } 2053 }
2054 } 2054 }
2055 } 2055 }
2056 2056
2057 return !swallowEvent; 2057 return !swallowEvent;
2058 } 2058 }
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 return; 3039 return;
3040 3040
3041 bool isOptioned = event->getModifierState("Alt"); 3041 bool isOptioned = event->getModifierState("Alt");
3042 bool isCommanded = event->getModifierState("Meta"); 3042 bool isCommanded = event->getModifierState("Meta");
3043 3043
3044 SelectionDirection direction = DirectionForward; 3044 SelectionDirection direction = DirectionForward;
3045 TextGranularity granularity = CharacterGranularity; 3045 TextGranularity granularity = CharacterGranularity;
3046 3046
3047 switch (focusDirectionForKey(event->keyIdentifier())) { 3047 switch (focusDirectionForKey(event->keyIdentifier())) {
3048 case FocusDirectionNone: 3048 case FocusDirectionNone:
3049 case FocusDirectionMouse:
3049 return; 3050 return;
3050 case FocusDirectionForward: 3051 case FocusDirectionForward:
3051 case FocusDirectionBackward: 3052 case FocusDirectionBackward:
3052 ASSERT_NOT_REACHED(); 3053 ASSERT_NOT_REACHED();
3053 return; 3054 return;
3054 case FocusDirectionUp: 3055 case FocusDirectionUp:
3055 direction = DirectionBackward; 3056 direction = DirectionBackward;
3056 granularity = isCommanded ? DocumentBoundary : LineGranularity; 3057 granularity = isCommanded ? DocumentBoundary : LineGranularity;
3057 break; 3058 break;
3058 case FocusDirectionDown: 3059 case FocusDirectionDown:
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
3862 unsigned EventHandler::accessKeyModifiers() 3863 unsigned EventHandler::accessKeyModifiers()
3863 { 3864 {
3864 #if OS(DARWIN) 3865 #if OS(DARWIN)
3865 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3866 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3866 #else 3867 #else
3867 return PlatformEvent::AltKey; 3868 return PlatformEvent::AltKey;
3868 #endif 3869 #endif
3869 } 3870 }
3870 3871
3871 } // namespace WebCore 3872 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698