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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 225303014: [Pinch-to-zoom] Moved scale factor into PinchViewport (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 9da3908b3b3ef834a7a4cc13e518b3b3f0dadb23..076abb9bf87d0faf49a54d2f6e25150ee4c9f3aa 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -37,6 +37,7 @@
#include "core/events/OverflowEvent.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/fetch/ResourceLoadPriorityOptimizer.h"
+#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLFrameElement.h"
@@ -2417,7 +2418,10 @@ IntSize FrameView::inputEventsOffsetForEmulation() const
float FrameView::inputEventsScaleFactor() const
{
- return visibleContentScaleFactor() * m_inputEventsScaleFactorForEmulation;
+ float pageScale = m_frame->settings()->pinchVirtualViewportEnabled()
+ ? m_frame->page()->frameHost().pinchViewport().scale()
+ : visibleContentScaleFactor();
+ return pageScale * m_inputEventsScaleFactorForEmulation;
}
bool FrameView::scrollbarsCanBeActive() const
@@ -3195,18 +3199,24 @@ void FrameView::removeChild(Widget* widget)
bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
{
+ bool allowScrolling = userInputScrollable(HorizontalScrollbar) || userInputScrollable(VerticalScrollbar);
+
// Note that to allow for rubber-band over-scroll behavior, even non-scrollable views
// should handle wheel events.
#if !USE(RUBBER_BANDING)
if (!isScrollable())
- return false;
+ allowScrolling = false;
#endif
- // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
- if (!canHaveScrollbars())
- return false;
+ if (allowScrolling && ScrollableArea::handleWheelEvent(wheelEvent))
+ return true;
- return ScrollableArea::handleWheelEvent(wheelEvent);
+ // If the frame didn't handle the event, give the pinch-zoom viewport a chance to
+ // process the scroll event.
+ if (isMainFrame())
+ return page()->frameHost().pinchViewport().handleWheelEvent(wheelEvent);
+
+ return false;
}
bool FrameView::isVerticalDocument() const

Powered by Google App Engine
This is Rietveld 408576698