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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 889803004: Add touchpad pinch zoom support to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporate review feedback 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ; 2133 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount) ;
2134 return true; 2134 return true;
2135 } 2135 }
2136 2136
2137 // FIXME: This should take in the intended frame, not the local frame root. 2137 // FIXME: This should take in the intended frame, not the local frame root.
2138 if (PageWidgetDelegate::handleInputEvent(*this, inputEvent, localFrameRootTe mporary()->frame())) 2138 if (PageWidgetDelegate::handleInputEvent(*this, inputEvent, localFrameRootTe mporary()->frame()))
2139 return true; 2139 return true;
2140 2140
2141 // Unhandled touchpad gesture pinch events synthesize mouse wheel events. 2141 // Unhandled touchpad gesture pinch events synthesize mouse wheel events.
2142 if (inputEvent.type == WebInputEvent::GesturePinchUpdate) { 2142 if (inputEvent.type == WebInputEvent::GesturePinchUpdate) {
2143 if (handleSyntheticWheelFromTouchpadPinchEvent(static_cast<const WebGest ureEvent&>(inputEvent))) 2143 const WebGestureEvent& pinchEvent = static_cast<const WebGestureEvent&>( inputEvent);
2144
2145 // First, synthesize a Windows-like wheel event to send to any handlers that may exist.
2146 if (handleSyntheticWheelFromTouchpadPinchEvent(pinchEvent))
2144 return true; 2147 return true;
2148
2149 if (pinchVirtualViewportEnabled()) {
2150 const float oldPageScale = pageScaleFactor();
2151 const float newPageScale = clampPageScaleFactorToLimits(oldPageScale * pinchEvent.data.pinchUpdate.scale);
2152 if (newPageScale != oldPageScale) {
bokan 2015/02/03 03:05:16 Please fold this "changed" check inside the method
ccameron 2015/02/03 17:03:28 Done.
2153 page()->frameHost().pinchViewport().setScaleAroundAnchor(
2154 newPageScale, FloatPoint(pinchEvent.x, pinchEvent.y));
2155 }
2156 }
2157
2158 // TODO(ccameron): Always return that the event was handled. Once the pi nch-zoom content scale
2159 // handlers have been removed from content, this function may return fal se if the page scale does
2160 // not change.
2161 return true;
2145 } 2162 }
2146 2163
2147 return false; 2164 return false;
2148 } 2165 }
2149 2166
2150 void WebViewImpl::setCursorVisibilityState(bool isVisible) 2167 void WebViewImpl::setCursorVisibilityState(bool isVisible)
2151 { 2168 {
2152 if (m_page) 2169 if (m_page)
2153 m_page->setIsCursorVisible(isVisible); 2170 m_page->setIsCursorVisible(isVisible);
2154 } 2171 }
(...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4623 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4607 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4624 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4608 } 4625 }
4609 4626
4610 void WebViewImpl::forceNextWebGLContextCreationToFail() 4627 void WebViewImpl::forceNextWebGLContextCreationToFail()
4611 { 4628 {
4612 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4629 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4613 } 4630 }
4614 4631
4615 } // namespace blink 4632 } // namespace blink
OLDNEW
« Source/core/frame/PinchViewport.h ('K') | « Source/core/frame/PinchViewport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698