• rniwa@webkit.org's avatar
    Shift clicking on an element with -webkit-user-select: all doesn't extend selection · 9e76e369
    rniwa@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=113270
    
    Reviewed by Enrica Casucci.
    
    Source/WebCore:
    
    The bug was caused by updateSelectionForMouseDownDispatchingSelectStart always replacing selection whenever
    the target node was inside an element with -webkit-suer-select even when we were attemping to extend selection
    in handleMousePressEventSingleClick.
    
    Fixed the bug by extracting this logic as a separate function (expandSelectionToRespectUserSelectAll) and deploying
    it in handleMousePressEventSingleClick to extend selection as needed.
    
    Test: editing/selection/user-select-all-with-shift.html
    
    * page/EventHandler.cpp:
    (WebCore::expandSelectionToRespectUserSelectAll): Extracted from updateSelectionForMouseDownDispatchingSelectStart.
    (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart):
    (WebCore::EventHandler::selectClosestWordFromHitTestResult):
    (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent):
    (WebCore::EventHandler::handleMousePressEventTripleClick):
    (WebCore::EventHandler::handleMousePressEventSingleClick): Adjust "pos" as needed when extending selection.
    Also use shouldConsiderSelectionAsDirectional() instead of manually peeking editingBehaviorType while we're at it.
    
    LayoutTests:
    
    Added a regression test for shift clicking on an element with -webkit-user-select: all.
    Skip it on non-Mac platforms as -webkit-user-select: all hasn't been enabled on them.
    
    * editing/selection/user-select-all-with-shift-expected.txt: Added.
    * editing/selection/user-select-all-with-shift.html: Added.
    * platform/chromium/TestExpectations:
    * platform/efl/TestExpectations:
    * platform/gtk/TestExpectations:
    * platform/qt/TestExpectations:
    * platform/win/TestExpectations:
    * platform/wincairo/TestExpectations:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    9e76e369
ChangeLog 8.06 MB
The source could not be displayed because it is larger than 1 MB. You can load it anyway or download it instead.