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

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

Issue 548413002: Revert of Fix to keep the selection of the text field in input element after setSelectionRange... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | no next file » | 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 if (singleClick) 612 if (singleClick)
613 focusDocumentView(); 613 focusDocumentView();
614 614
615 Node* innerNode = event.targetNode(); 615 Node* innerNode = event.targetNode();
616 616
617 m_mousePressNode = innerNode; 617 m_mousePressNode = innerNode;
618 m_dragStartPos = event.event().position(); 618 m_dragStartPos = event.event().position();
619 619
620 bool swallowEvent = false; 620 bool swallowEvent = false;
621 m_mousePressed = true; 621 m_mousePressed = true;
622 m_selectionInitiationState = HaveNotStartedSelection;
622 623
623 if (event.event().clickCount() == 2) 624 if (event.event().clickCount() == 2)
624 swallowEvent = handleMousePressEventDoubleClick(event); 625 swallowEvent = handleMousePressEventDoubleClick(event);
625 else if (event.event().clickCount() >= 3) 626 else if (event.event().clickCount() >= 3)
626 swallowEvent = handleMousePressEventTripleClick(event); 627 swallowEvent = handleMousePressEventTripleClick(event);
627 else 628 else
628 swallowEvent = handleMousePressEventSingleClick(event); 629 swallowEvent = handleMousePressEventSingleClick(event);
629 630
630 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect 631 m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect
631 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled()); 632 || (m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNod e->renderBox()->canBeProgramaticallyScrolled());
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 m_resizeScrollableArea->setInResizeMode(true); 1278 m_resizeScrollableArea->setInResizeMode(true);
1278 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC orner(p); 1279 m_offsetFromResizeCorner = m_resizeScrollableArea->offsetFromResizeC orner(p);
1279 invalidateClick(); 1280 invalidateClick();
1280 return true; 1281 return true;
1281 } 1282 }
1282 } 1283 }
1283 1284
1284 m_frame->selection().setCaretBlinkingSuspended(true); 1285 m_frame->selection().setCaretBlinkingSuspended(true);
1285 1286
1286 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe tNode(), m_clickCount, mouseEvent, true); 1287 bool swallowEvent = !dispatchMouseEvent(EventTypeNames::mousedown, mev.targe tNode(), m_clickCount, mouseEvent, true);
1287 // m_selectionInitiationState is initialized after dispatching mousedown eve nt in order not to keep the selection by DOM APIs
1288 // Because we can't give the user the chance to handle the selection by user action like dragging if we keep the selection in case of mousedown.
1289 // FireFox also has the same behavior and it's more compatible with other br owsers.
1290 m_selectionInitiationState = HaveNotStartedSelection;
1291 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent); 1288 swallowEvent = swallowEvent || handleMouseFocus(mouseEvent);
1292 m_capturesDragging = !swallowEvent || mev.scrollbar(); 1289 m_capturesDragging = !swallowEvent || mev.scrollbar();
1293 1290
1294 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults 1291 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults
1295 // in case the scrollbar widget was destroyed when the mouse event was handl ed. 1292 // in case the scrollbar widget was destroyed when the mouse event was handl ed.
1296 if (mev.scrollbar()) { 1293 if (mev.scrollbar()) {
1297 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get(); 1294 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get();
1298 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active ); 1295 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active );
1299 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou seEvent); 1296 mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mou seEvent);
1300 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get ()) 1297 if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get ())
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 } 2944 }
2948 2945
2949 void EventHandler::notifyElementActivated() 2946 void EventHandler::notifyElementActivated()
2950 { 2947 {
2951 // Since another element has been set to active, stop current timer and clea r reference. 2948 // Since another element has been set to active, stop current timer and clea r reference.
2952 if (m_activeIntervalTimer.isActive()) 2949 if (m_activeIntervalTimer.isActive())
2953 m_activeIntervalTimer.stop(); 2950 m_activeIntervalTimer.stop();
2954 m_lastDeferredTapElement = nullptr; 2951 m_lastDeferredTapElement = nullptr;
2955 } 2952 }
2956 2953
2957 void EventHandler::notifySelectionChanged()
2958 {
2959 m_selectionInitiationState = ExtendedSelection;
2960 }
2961
2962 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt) 2954 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt)
2963 { 2955 {
2964 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. 2956 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do.
2965 // IE matches lower and upper case access keys regardless of Shift key state - but if both upper and 2957 // IE matches lower and upper case access keys regardless of Shift key state - but if both upper and
2966 // lower case variants are present in a document, the correct element is mat ched based on Shift key state. 2958 // lower case variants are present in a document, the correct element is mat ched based on Shift key state.
2967 // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively. 2959 // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively.
2968 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); 2960 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey));
2969 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) 2961 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers())
2970 return false; 2962 return false;
2971 String key = evt.unmodifiedText(); 2963 String key = evt.unmodifiedText();
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
3889 unsigned EventHandler::accessKeyModifiers() 3881 unsigned EventHandler::accessKeyModifiers()
3890 { 3882 {
3891 #if OS(MACOSX) 3883 #if OS(MACOSX)
3892 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3884 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3893 #else 3885 #else
3894 return PlatformEvent::AltKey; 3886 return PlatformEvent::AltKey;
3895 #endif 3887 #endif
3896 } 3888 }
3897 3889
3898 } // namespace blink 3890 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698