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

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

Issue 764313004: Fix the problem to keep the selection when clicking the substring out of range (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 else 553 else
554 newSelection = VisibleSelection(start, pos); 554 newSelection = VisibleSelection(start, pos);
555 } 555 }
556 } else 556 } else
557 newSelection.setExtent(pos); 557 newSelection.setExtent(pos);
558 558
559 if (m_frame->selection().granularity() != CharacterGranularity) { 559 if (m_frame->selection().granularity() != CharacterGranularity) {
560 granularity = m_frame->selection().granularity(); 560 granularity = m_frame->selection().granularity();
561 newSelection.expandUsingGranularity(m_frame->selection().granularity ()); 561 newSelection.expandUsingGranularity(m_frame->selection().granularity ());
562 } 562 }
563 } else { 563 } else {
Rick Byers 2014/12/02 14:49:39 style nit: combine into one line 'else if {'
Miyoung Shin(g) 2014/12/03 03:39:10 Ok. I will change
564 newSelection = expandSelectionToRespectUserSelectAll(innerNode, VisibleS election(visiblePos)); 564 if (m_selectionInitiationState != ExtendedSelection)
yosin_UTC9 2014/12/03 01:07:00 It seems condition is opposite or should we set |m
Miyoung Shin(g) 2014/12/03 03:39:10 This condition is to check if there is to update t
565 newSelection = expandSelectionToRespectUserSelectAll(innerNode, Visi bleSelection(visiblePos));
565 } 566 }
566 567
567 // Updating the selection is considered side-effect of the event and so it d oesn't impact the handled state. 568 // Updating the selection is considered side-effect of the event and so it d oesn't impact the handled state.
568 updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, g ranularity); 569 updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, g ranularity);
569 return false; 570 return false;
570 } 571 }
571 572
572 static inline bool canMouseDownStartSelect(Node* node) 573 static inline bool canMouseDownStartSelect(Node* node)
573 { 574 {
574 if (!node || !node->renderer()) 575 if (!node || !node->renderer())
(...skipping 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 void EventHandler::notifyElementActivated() 2980 void EventHandler::notifyElementActivated()
2980 { 2981 {
2981 // Since another element has been set to active, stop current timer and clea r reference. 2982 // Since another element has been set to active, stop current timer and clea r reference.
2982 if (m_activeIntervalTimer.isActive()) 2983 if (m_activeIntervalTimer.isActive())
2983 m_activeIntervalTimer.stop(); 2984 m_activeIntervalTimer.stop();
2984 m_lastDeferredTapElement = nullptr; 2985 m_lastDeferredTapElement = nullptr;
2985 } 2986 }
2986 2987
2987 void EventHandler::notifySelectionChanged() 2988 void EventHandler::notifySelectionChanged()
2988 { 2989 {
2989 m_selectionInitiationState = ExtendedSelection; 2990 if (m_frame->selection().isRange())
2991 m_selectionInitiationState = ExtendedSelection;
2990 } 2992 }
2991 2993
2992 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt) 2994 bool EventHandler::handleAccessKey(const PlatformKeyboardEvent& evt)
2993 { 2995 {
2994 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do. 2996 // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do.
2995 // IE matches lower and upper case access keys regardless of Shift key state - but if both upper and 2997 // IE matches lower and upper case access keys regardless of Shift key state - but if both upper and
2996 // lower case variants are present in a document, the correct element is mat ched based on Shift key state. 2998 // lower case variants are present in a document, the correct element is mat ched based on Shift key state.
2997 // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively. 2999 // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively.
2998 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey)); 3000 ASSERT(!(accessKeyModifiers() & PlatformEvent::ShiftKey));
2999 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers()) 3001 if ((evt.modifiers() & ~PlatformEvent::ShiftKey) != accessKeyModifiers())
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3863 unsigned EventHandler::accessKeyModifiers() 3865 unsigned EventHandler::accessKeyModifiers()
3864 { 3866 {
3865 #if OS(MACOSX) 3867 #if OS(MACOSX)
3866 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3868 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3867 #else 3869 #else
3868 return PlatformEvent::AltKey; 3870 return PlatformEvent::AltKey;
3869 #endif 3871 #endif
3870 } 3872 }
3871 3873
3872 } // namespace blink 3874 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698