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

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

Issue 247023002: Correcting menu button event trigger location (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Layout test changes as per review comments Created 6 years, 8 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 | « LayoutTests/fast/events/menu-key-context-menu-expected.txt ('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 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 2704
2705 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) { 2705 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) {
2706 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ; 2706 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ;
2707 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et()); 2707 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et());
2708 2708
2709 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 2709 int x = rightAligned ? firstRect.maxX() : firstRect.x();
2710 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. 2710 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1.
2711 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 2711 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
2712 location = IntPoint(x, y); 2712 location = IntPoint(x, y);
2713 } else if (focusedElement) { 2713 } else if (focusedElement) {
2714 RenderBoxModelObject* box = focusedElement->renderBoxModelObject(); 2714 IntRect clippedRect = focusedElement->boundsInRootViewSpace();
2715 if (!box) 2715 location = IntPoint(clippedRect.center());
2716 return false;
2717 IntRect clippedRect = box->pixelSnappedAbsoluteClippedOverflowRect();
2718 location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1);
2719 } else { 2716 } else {
2720 location = IntPoint( 2717 location = IntPoint(
2721 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin, 2718 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin,
2722 kContextMenuMargin); 2719 kContextMenuMargin);
2723 shouldTranslateToRootView = false; 2720 shouldTranslateToRootView = false;
2724 } 2721 }
2725 2722
2726 m_frame->view()->setCursor(pointerCursor()); 2723 m_frame->view()->setCursor(pointerCursor());
2727 2724
2728 IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(loc ation) : location; 2725 IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(loc ation) : location;
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 unsigned EventHandler::accessKeyModifiers() 3784 unsigned EventHandler::accessKeyModifiers()
3788 { 3785 {
3789 #if OS(MACOSX) 3786 #if OS(MACOSX)
3790 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3787 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3791 #else 3788 #else
3792 return PlatformEvent::AltKey; 3789 return PlatformEvent::AltKey;
3793 #endif 3790 #endif
3794 } 3791 }
3795 3792
3796 } // namespace WebCore 3793 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/menu-key-context-menu-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698