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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: tweaks and docs Created 4 years, 2 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
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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 1734 int x = rightAligned ? firstRect.maxX() : firstRect.x();
1735 // In a multiline edit, firstRect.maxY() would endup on the next line, so -1 . 1735 // In a multiline edit, firstRect.maxY() would endup on the next line, so -1 .
1736 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 1736 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
1737 locationInRootFrame = view->contentsToRootFrame(IntPoint(x, y)); 1737 locationInRootFrame = view->contentsToRootFrame(IntPoint(x, y));
1738 } else if (focusedElement) { 1738 } else if (focusedElement) {
1739 IntRect clippedRect = focusedElement->boundsInViewport(); 1739 IntRect clippedRect = focusedElement->boundsInViewport();
1740 locationInRootFrame = 1740 locationInRootFrame =
1741 visualViewport.viewportToRootFrame(clippedRect.center()); 1741 visualViewport.viewportToRootFrame(clippedRect.center());
1742 } else { 1742 } else {
1743 locationInRootFrame = IntPoint( 1743 locationInRootFrame = IntPoint(
1744 rightAligned ? visualViewport.visibleRect().maxX() - kContextMenuMargin 1744 rightAligned
1745 : visualViewport.location().x() + kContextMenuMargin, 1745 ? visualViewport.visibleRect().maxX() - kContextMenuMargin
1746 visualViewport.location().y() + kContextMenuMargin); 1746 : visualViewport.scrollOffset().width() + kContextMenuMargin,
1747 visualViewport.scrollOffset().height() + kContextMenuMargin);
1747 } 1748 }
1748 1749
1749 m_frame->view()->setCursor(pointerCursor()); 1750 m_frame->view()->setCursor(pointerCursor());
1750 IntPoint locationInViewport = 1751 IntPoint locationInViewport =
1751 visualViewport.rootFrameToViewport(locationInRootFrame); 1752 visualViewport.rootFrameToViewport(locationInRootFrame);
1752 IntPoint globalPosition = 1753 IntPoint globalPosition =
1753 view->getHostWindow() 1754 view->getHostWindow()
1754 ->viewportToScreen(IntRect(locationInViewport, IntSize()), 1755 ->viewportToScreen(IntRect(locationInViewport, IntSize()),
1755 m_frame->view()) 1756 m_frame->view())
1756 .location(); 1757 .location();
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 1993
1993 1994
1994 FrameHost* EventHandler::frameHost() const { 1995 FrameHost* EventHandler::frameHost() const {
1995 if (!m_frame->page()) 1996 if (!m_frame->page())
1996 return nullptr; 1997 return nullptr;
1997 1998
1998 return &m_frame->page()->frameHost(); 1999 return &m_frame->page()->frameHost();
1999 } 2000 }
2000 2001
2001 } // namespace blink 2002 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698