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

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

Issue 919423002: Audited and renamed uses of methods and variables named RootView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again Created 5 years, 10 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 | « Source/core/page/DragController.cpp ('k') | Source/core/rendering/RenderMenuList.h » ('j') | 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint"); 865 TRACE_EVENT0("blink", "EventHandler::hitTestResultAtPoint");
866 866
867 // We always send hitTestResultAtPoint to the main frame if we have one, 867 // We always send hitTestResultAtPoint to the main frame if we have one,
868 // otherwise we might hit areas that are obscured by higher frames. 868 // otherwise we might hit areas that are obscured by higher frames.
869 if (m_frame->page()) { 869 if (m_frame->page()) {
870 LocalFrame* mainFrame = m_frame->localFrameRoot(); 870 LocalFrame* mainFrame = m_frame->localFrameRoot();
871 if (mainFrame && m_frame != mainFrame) { 871 if (mainFrame && m_frame != mainFrame) {
872 FrameView* frameView = m_frame->view(); 872 FrameView* frameView = m_frame->view();
873 FrameView* mainView = mainFrame->view(); 873 FrameView* mainView = mainFrame->view();
874 if (frameView && mainView) { 874 if (frameView && mainView) {
875 IntPoint mainFramePoint = mainView->rootViewToContents(frameView ->contentsToRootView(roundedIntPoint(point))); 875 IntPoint mainFramePoint = mainView->rootFrameToContents(frameVie w->contentsToRootFrame(roundedIntPoint(point)));
876 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP oint, hitType, padding); 876 return mainFrame->eventHandler().hitTestResultAtPoint(mainFrameP oint, hitType, padding);
877 } 877 }
878 } 878 }
879 } 879 }
880 880
881 HitTestResult result(point, padding.height(), padding.width(), padding.heigh t(), padding.width()); 881 HitTestResult result(point, padding.height(), padding.width(), padding.heigh t(), padding.width());
882 882
883 // RenderView::hitTest causes a layout, and we don't want to hit that until the first 883 // RenderView::hitTest causes a layout, and we don't want to hit that until the first
884 // layout because until then, there is nothing shown on the screen - the use r can't 884 // layout because until then, there is nothing shown on the screen - the use r can't
885 // have intentionally clicked on something belonging to this page. Furthermo re, 885 // have intentionally clicked on something belonging to this page. Furthermo re,
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2816 // Clear mouse press state to avoid initiating a drag while context menu is up. 2816 // Clear mouse press state to avoid initiating a drag while context menu is up.
2817 m_mousePressed = false; 2817 m_mousePressed = false;
2818 2818
2819 static const int kContextMenuMargin = 1; 2819 static const int kContextMenuMargin = 1;
2820 2820
2821 #if OS(WIN) 2821 #if OS(WIN)
2822 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT); 2822 int rightAligned = ::GetSystemMetrics(SM_MENUDROPALIGNMENT);
2823 #else 2823 #else
2824 int rightAligned = 0; 2824 int rightAligned = 0;
2825 #endif 2825 #endif
2826 IntPoint rootViewLocation; 2826 IntPoint locationInViewport;
2827 Element* focusedElement = doc->focusedElement(); 2827 Element* focusedElement = doc->focusedElement();
2828 FrameSelection& selection = m_frame->selection(); 2828 FrameSelection& selection = m_frame->selection();
2829 Position start = selection.selection().start(); 2829 Position start = selection.selection().start();
2830 2830
2831 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) { 2831 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) {
2832 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ; 2832 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ;
2833 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et()); 2833 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et());
2834 2834
2835 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 2835 int x = rightAligned ? firstRect.maxX() : firstRect.x();
2836 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. 2836 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1.
2837 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 2837 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
2838 rootViewLocation = view->contentsToRootView(IntPoint(x, y)); 2838 locationInViewport = view->contentsToWindow(IntPoint(x, y));
2839 } else if (focusedElement) { 2839 } else if (focusedElement) {
2840 IntRect clippedRect = focusedElement->boundsInRootViewSpace(); 2840 IntRect clippedRect = focusedElement->boundsInViewportSpace();
2841 rootViewLocation = IntPoint(clippedRect.center()); 2841 locationInViewport = IntPoint(clippedRect.center());
2842 } else { 2842 } else {
2843 rootViewLocation = IntPoint( 2843 // FIXME - Almost certainly wrong, this is not in viewport space. crbug. com/458682.
2844 locationInViewport = IntPoint(
2844 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin, 2845 rightAligned ? view->contentsWidth() - kContextMenuMargin : kContext MenuMargin,
2845 kContextMenuMargin); 2846 kContextMenuMargin);
2846 } 2847 }
2847 2848
2848 m_frame->view()->setCursor(pointerCursor()); 2849 m_frame->view()->setCursor(pointerCursor());
2849 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(rootV iewLocation, IntSize())).location(); 2850 IntPoint globalPosition = view->hostWindow()->viewportToScreen(IntRect(locat ionInViewport, IntSize())).location();
2850 2851
2851 Node* targetNode = doc->focusedElement(); 2852 Node* targetNode = doc->focusedElement();
2852 if (!targetNode) 2853 if (!targetNode)
2853 targetNode = doc; 2854 targetNode = doc;
2854 2855
2855 // Use the focused node as the target for hover and active. 2856 // Use the focused node as the target for hover and active.
2856 HitTestResult result(rootViewLocation); 2857 HitTestResult result(locationInViewport);
2857 result.setInnerNode(targetNode); 2858 result.setInnerNode(targetNode);
2858 doc->updateHoverActiveState(HitTestRequest::Active, result.innerElement()); 2859 doc->updateHoverActiveState(HitTestRequest::Active, result.innerElement());
2859 2860
2860 // The contextmenu event is a mouse event even when invoked using the keyboa rd. 2861 // The contextmenu event is a mouse event even when invoked using the keyboa rd.
2861 // This is required for web compatibility. 2862 // This is required for web compatibility.
2862 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2863 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2863 if (m_frame->settings()->showContextMenuOnMouseUp()) 2864 if (m_frame->settings()->showContextMenuOnMouseUp())
2864 eventType = PlatformEvent::MouseReleased; 2865 eventType = PlatformEvent::MouseReleased;
2865 2866
2866 PlatformMouseEvent mouseEvent(rootViewLocation, globalPosition, RightButton, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndistingui shable, WTF::currentTime()); 2867 PlatformMouseEvent mouseEvent(locationInViewport, globalPosition, RightButto n, eventType, 1, false, false, false, false, PlatformMouseEvent::RealOrIndisting uishable, WTF::currentTime());
2867 2868
2868 handleMousePressEvent(mouseEvent); 2869 handleMousePressEvent(mouseEvent);
2869 return sendContextMenuEvent(mouseEvent); 2870 return sendContextMenuEvent(mouseEvent);
2870 } 2871 }
2871 2872
2872 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent) 2873 bool EventHandler::sendContextMenuEventForGesture(const GestureEventWithHitTestR esults& targetedEvent)
2873 { 2874 {
2874 unsigned modifiers = targetedEvent.event().modifiers(); 2875 unsigned modifiers = targetedEvent.event().modifiers();
2875 PlatformEvent::Type eventType = PlatformEvent::MousePressed; 2876 PlatformEvent::Type eventType = PlatformEvent::MousePressed;
2876 2877
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 3928
3928 // If it's in the direction to hide the top controls, only consume when the frame can also scroll. 3929 // If it's in the direction to hide the top controls, only consume when the frame can also scroll.
3929 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y()) 3930 if (m_frame->view()->scrollPosition().y() < m_frame->view()->maximumScrollPo sition().y())
3930 return true; 3931 return true;
3931 3932
3932 return false; 3933 return false;
3933 } 3934 }
3934 3935
3935 3936
3936 } // namespace blink 3937 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/core/rendering/RenderMenuList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698