Changeset 196112 in webkit


Ignore:
Timestamp:
Feb 4, 2016, 12:25:28 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

Do not show context menu when right clicking on a scrollbar
https://bugs.webkit.org/show_bug.cgi?id=153493

Reviewed by Michael Catanzaro.

Source/WebCore:

Scrollbars don't currently handle right clicks, but we are showing
the context menu when they are right clicked. This is not desired
at least in GTK+ and I've checked that it isn't consistent with
other applications in Mac either.

Test: fast/events/contextmenu-on-scrollbars.html

  • page/EventHandler.cpp:

(WebCore::EventHandler::sendContextMenuEvent):

LayoutTests:

Add a test to check that context menu event is not sent when right
clicking on a scrollbar.

  • fast/events/contextmenu-on-scrollbars-expected.txt: Added.
  • fast/events/contextmenu-on-scrollbars.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196105 r196112  
     12016-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Do not show context menu when right clicking on a scrollbar
     4        https://bugs.webkit.org/show_bug.cgi?id=153493
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add a test to check that context menu event is not sent when right
     9        clicking on a scrollbar.
     10
     11        * fast/events/contextmenu-on-scrollbars-expected.txt: Added.
     12        * fast/events/contextmenu-on-scrollbars.html: Added.
     13
    1142016-02-03  Beth Dakin  <bdakin@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r196104 r196112  
     12016-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Do not show context menu when right clicking on a scrollbar
     4        https://bugs.webkit.org/show_bug.cgi?id=153493
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Scrollbars don't currently handle right clicks, but we are showing
     9        the context menu when they are right clicked. This is not desired
     10        at least in GTK+ and I've checked that it isn't consistent with
     11        other applications in Mac either.
     12
     13        Test: fast/events/contextmenu-on-scrollbars.html
     14
     15        * page/EventHandler.cpp:
     16        (WebCore::EventHandler::sendContextMenuEvent):
     17
    1182016-02-03  Andreas Kling  <akling@apple.com>
    219
  • trunk/Source/WebCore/page/EventHandler.cpp

    r196080 r196112  
    26932693{
    26942694    Document* doc = m_frame.document();
    2695     FrameView* v = m_frame.view();
    2696     if (!v)
    2697         return false;
    2698    
     2695    FrameView* view = m_frame.view();
     2696    if (!view)
     2697        return false;
     2698
    26992699    // Clear mouse press state to avoid initiating a drag while context menu is up.
    27002700    m_mousePressed = false;
    27012701    bool swallowEvent;
    2702     LayoutPoint viewportPos = v->windowToContents(event.position());
     2702    LayoutPoint viewportPos = view->windowToContents(event.position());
    27032703    HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    27042704    MouseEventWithHitTestResults mouseEvent = doc->prepareMouseEvent(request, viewportPos, event);
    27052705
     2706    // Do not show context menus when clicking on scrollbars.
     2707    if (mouseEvent.scrollbar() || view->scrollbarAtPoint(event.position()))
     2708        return false;
     2709
    27062710    if (m_frame.editor().behavior().shouldSelectOnContextualMenuClick()
    27072711        && !m_frame.selection().contains(viewportPos)
    2708         && !mouseEvent.scrollbar()
    27092712        // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
    27102713        // If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
Note: See TracChangeset for help on using the changeset viewer.