Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2770 #if OS(WIN) | 2770 #if OS(WIN) |
| 2771 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); | 2771 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); |
| 2772 #else | 2772 #else |
| 2773 int rightAligned = 0; | 2773 int rightAligned = 0; |
| 2774 #endif | 2774 #endif |
| 2775 IntPoint location; | 2775 IntPoint location; |
| 2776 | 2776 |
| 2777 Element* focusedElement = doc->focusedElement(); | 2777 Element* focusedElement = doc->focusedElement(); |
| 2778 FrameSelection& selection = m_frame->selection(); | 2778 FrameSelection& selection = m_frame->selection(); |
| 2779 Position start = selection.selection().start(); | 2779 Position start = selection.selection().start(); |
| 2780 bool shouldTranslateToRootView = true; | 2780 bool shouldTranslateToRootView = false; |
| 2781 | 2781 |
| 2782 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) { | 2782 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) { |
| 2783 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ; | 2783 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ; |
| 2784 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et()); | 2784 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et()); |
| 2785 | 2785 |
| 2786 int x = rightAligned ? firstRect.maxX() : firstRect.x(); | 2786 int x = rightAligned ? firstRect.maxX() : firstRect.x(); |
| 2787 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. | 2787 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. |
| 2788 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; | 2788 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; |
| 2789 location = IntPoint(x, y); | 2789 location = IntPoint(x, y); |
| 2790 shouldTranslateToRootView = true; | |
|
Rick Byers
2014/12/10 03:09:25
by the way, you don't need this variable at all an
Deepak
2014/12/10 06:40:27
Done.
| |
| 2790 } else if (focusedElement) { | 2791 } else if (focusedElement) { |
| 2791 IntRect clippedRect = focusedElement->boundsInRootViewSpace(); | 2792 IntRect clippedRect = focusedElement->boundsInRootViewSpace(); |
| 2792 location = IntPoint(clippedRect.center()); | 2793 location = IntPoint(clippedRect.center()); |
| 2793 } else { | 2794 } else { |
| 2794 location = IntPoint( | 2795 location = IntPoint( |
| 2795 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin, | 2796 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin, |
| 2796 kContextMenuMargin); | 2797 kContextMenuMargin); |
| 2797 shouldTranslateToRootView = false; | |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 m_frame->view()->setCursor(pointerCursor()); | 2800 m_frame->view()->setCursor(pointerCursor()); |
| 2801 | 2801 |
| 2802 IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(loc ation) : location; | 2802 IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(loc ation) : location; |
| 2803 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(posit ion, IntSize())).location(); | 2803 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(posit ion, IntSize())).location(); |
| 2804 | 2804 |
| 2805 Node* targetNode = doc->focusedElement(); | 2805 Node* targetNode = doc->focusedElement(); |
| 2806 if (!targetNode) | 2806 if (!targetNode) |
| 2807 targetNode = doc; | 2807 targetNode = doc; |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3868 unsigned EventHandler::accessKeyModifiers() | 3868 unsigned EventHandler::accessKeyModifiers() |
| 3869 { | 3869 { |
| 3870 #if OS(MACOSX) | 3870 #if OS(MACOSX) |
| 3871 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3871 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3872 #else | 3872 #else |
| 3873 return PlatformEvent::AltKey; | 3873 return PlatformEvent::AltKey; |
| 3874 #endif | 3874 #endif |
| 3875 } | 3875 } |
| 3876 | 3876 |
| 3877 } // namespace blink | 3877 } // namespace blink |
| OLD | NEW |