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 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 #if OS(WIN) | 2815 #if OS(WIN) |
2816 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); | 2816 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); |
2817 #else | 2817 #else |
2818 int rightAligned = 0; | 2818 int rightAligned = 0; |
2819 #endif | 2819 #endif |
2820 IntPoint location; | 2820 IntPoint location; |
2821 | 2821 |
2822 Element* focusedElement = doc->focusedElement(); | 2822 Element* focusedElement = doc->focusedElement(); |
2823 FrameSelection& selection = m_frame->selection(); | 2823 FrameSelection& selection = m_frame->selection(); |
2824 Position start = selection.selection().start(); | 2824 Position start = selection.selection().start(); |
| 2825 bool shouldTranslateToRootView = true; |
2825 | 2826 |
2826 if (start.deprecatedNode() && (selection.rootEditableElement() || selection.
isRange())) { | 2827 if (start.deprecatedNode() && (selection.rootEditableElement() || selection.
isRange())) { |
2827 RefPtr<Range> selectionRange = selection.toNormalizedRange(); | 2828 RefPtr<Range> selectionRange = selection.toNormalizedRange(); |
2828 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g
et()); | 2829 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g
et()); |
2829 | 2830 |
2830 int x = rightAligned ? firstRect.maxX() : firstRect.x(); | 2831 int x = rightAligned ? firstRect.maxX() : firstRect.x(); |
2831 // In a multiline edit, firstRect.maxY() would endup on the next line, s
o -1. | 2832 // In a multiline edit, firstRect.maxY() would endup on the next line, s
o -1. |
2832 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; | 2833 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; |
2833 location = IntPoint(x, y); | 2834 location = IntPoint(x, y); |
2834 } else if (focusedElement) { | 2835 } else if (focusedElement) { |
2835 RenderBoxModelObject* box = focusedElement->renderBoxModelObject(); | 2836 RenderBoxModelObject* box = focusedElement->renderBoxModelObject(); |
2836 if (!box) | 2837 if (!box) |
2837 return false; | 2838 return false; |
2838 IntRect clippedRect = box->pixelSnappedAbsoluteClippedOverflowRect(); | 2839 IntRect clippedRect = box->pixelSnappedAbsoluteClippedOverflowRect(); |
2839 location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1); | 2840 location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1); |
2840 } else { | 2841 } else { |
2841 location = IntPoint( | 2842 location = IntPoint( |
2842 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext
MenuMargin, | 2843 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext
MenuMargin, |
2843 kContextMenuMargin); | 2844 kContextMenuMargin); |
| 2845 shouldTranslateToRootView = false; |
2844 } | 2846 } |
2845 | 2847 |
2846 m_frame->view()->setCursor(pointerCursor()); | 2848 m_frame->view()->setCursor(pointerCursor()); |
2847 | 2849 |
2848 IntPoint position = view->contentsToRootView(location); | 2850 IntPoint position = shouldTranslateToRootView ? view->contentsToRootView(loc
ation) : location; |
2849 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(posit
ion, IntSize())).location(); | 2851 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(posit
ion, IntSize())).location(); |
2850 | 2852 |
2851 Node* targetNode = doc->focusedElement(); | 2853 Node* targetNode = doc->focusedElement(); |
2852 if (!targetNode) | 2854 if (!targetNode) |
2853 targetNode = doc; | 2855 targetNode = doc; |
2854 | 2856 |
2855 // Use the focused node as the target for hover and active. | 2857 // Use the focused node as the target for hover and active. |
2856 HitTestResult result(position); | 2858 HitTestResult result(position); |
2857 result.setInnerNode(targetNode); | 2859 result.setInnerNode(targetNode); |
2858 doc->updateHoverActiveState(HitTestRequest::Active | HitTestRequest::Confusi
ngAndOftenMisusedDisallowShadowContent, result.innerElement()); | 2860 doc->updateHoverActiveState(HitTestRequest::Active | HitTestRequest::Confusi
ngAndOftenMisusedDisallowShadowContent, result.innerElement()); |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4009 unsigned EventHandler::accessKeyModifiers() | 4011 unsigned EventHandler::accessKeyModifiers() |
4010 { | 4012 { |
4011 #if OS(MACOSX) | 4013 #if OS(MACOSX) |
4012 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4014 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
4013 #else | 4015 #else |
4014 return PlatformEvent::AltKey; | 4016 return PlatformEvent::AltKey; |
4015 #endif | 4017 #endif |
4016 } | 4018 } |
4017 | 4019 |
4018 } // namespace WebCore | 4020 } // namespace WebCore |
OLD | NEW |