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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1463723003: Return VisualViewport coords in boundsInViewportSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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
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 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 VisualViewport& visualViewport = m_frame->page()->frameHost().visualViewport (); 2916 VisualViewport& visualViewport = m_frame->page()->frameHost().visualViewport ();
2917 2917
2918 if (!overrideTargetElement && start.anchorNode() && (selection.rootEditableE lement() || selection.isRange())) { 2918 if (!overrideTargetElement && start.anchorNode() && (selection.rootEditableE lement() || selection.isRange())) {
2919 IntRect firstRect = m_frame->editor().firstRectForRange(selection.select ion().toNormalizedEphemeralRange()); 2919 IntRect firstRect = m_frame->editor().firstRectForRange(selection.select ion().toNormalizedEphemeralRange());
2920 2920
2921 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 2921 int x = rightAligned ? firstRect.maxX() : firstRect.x();
2922 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. 2922 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1.
2923 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 2923 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
2924 locationInRootFrame = view->contentsToRootFrame(IntPoint(x, y)); 2924 locationInRootFrame = view->contentsToRootFrame(IntPoint(x, y));
2925 } else if (focusedElement) { 2925 } else if (focusedElement) {
2926 IntRect clippedRect = focusedElement->boundsInViewportSpace(); 2926 IntRect clippedRect = focusedElement->boundsInViewport();
2927 // FIXME: boundsInViewportSpace is actually in the weird scaled but untr anslated coordinate space of 2927 locationInRootFrame = visualViewport.viewportToRootFrame(clippedRect.cen ter());
2928 // the old-style visual viewport. crbug.com/459591.
2929 locationInRootFrame = flooredIntPoint(visualViewport.viewportCSSPixelsTo RootFrame(clippedRect.center()));
2930 } else { 2928 } else {
2931 locationInRootFrame = IntPoint( 2929 locationInRootFrame = IntPoint(
2932 rightAligned 2930 rightAligned
2933 ? visualViewport.visibleRect().maxX() - kContextMenuMargin 2931 ? visualViewport.visibleRect().maxX() - kContextMenuMargin
2934 : visualViewport.location().x() + kContextMenuMargin, 2932 : visualViewport.location().x() + kContextMenuMargin,
2935 visualViewport.location().y() + kContextMenuMargin); 2933 visualViewport.location().y() + kContextMenuMargin);
2936 } 2934 }
2937 2935
2938 m_frame->view()->setCursor(pointerCursor()); 2936 m_frame->view()->setCursor(pointerCursor());
2939 IntPoint locationInViewport = visualViewport.rootFrameToViewport(locationInR ootFrame); 2937 IntPoint locationInViewport = visualViewport.rootFrameToViewport(locationInR ootFrame);
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4086 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4089 { 4087 {
4090 #if OS(MACOSX) 4088 #if OS(MACOSX)
4091 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4089 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4092 #else 4090 #else
4093 return PlatformEvent::AltKey; 4091 return PlatformEvent::AltKey;
4094 #endif 4092 #endif
4095 } 4093 }
4096 4094
4097 } // namespace blink 4095 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698