Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 the event remains unhandled, use it pinch the viewport. | |
| 2150 const float magnifyDelta = pinchEvent.data.pinchUpdate.scale; | |
| 2151 const float oldPageScale = pageScaleFactor(); | |
| 2152 const float newPageScale = clampPageScaleFactorToLimits(magnifyDelta * o ldPageScale); | |
| 2153 | |
| 2154 // Keep the center-of-pinch anchor specified by (x, y) in a stable | |
| 2155 // position over the course of the magnify. | |
| 2156 const FloatPoint anchor(pinchEvent.x, pinchEvent.y); | |
|
bokan
2015/02/03 00:45:12
Drive-by: Could you please put this logic inside P
ccameron
2015/02/03 02:29:08
I don't see where the scale factor limits are avai
aelias_OOO_until_Jul13
2015/02/03 02:37:14
You can plumb in the information from WebViewImpl
bokan
2015/02/03 03:05:16
Right, sorry, forgot about that. You can take Alex
ccameron
2015/02/03 17:03:28
Done (yeah, I prefer this too -- thanks for pointi
| |
| 2157 FloatPoint anchorAtOldScale = anchor.scaledBy(1.f / oldPageScale); | |
| 2158 FloatPoint anchorAtNewScale = anchor.scaledBy(1.f / newPageScale); | |
| 2159 FloatPoint newLocation(pinchViewportOffset() + anchorAtOldScale - anchor AtNewScale); | |
| 2160 setPageScaleFactorAndLocation(newPageScale, newLocation); | |
|
aelias_OOO_until_Jul13
2015/02/03 00:16:58
Sorry, I noticed another issue. Please scroll the
bokan
2015/02/03 00:45:12
Though almost dead, please be aware of the old pin
ccameron
2015/02/03 02:29:08
Done (in the PinchVirtualViewport version).
| |
| 2161 | |
| 2162 // TODO(ccameron): Always return that the event was handled. Once the pi nch-zoom content scale | |
| 2163 // handlers have been removed from content, this function may return fal se if the page scale does | |
| 2164 // not change. | |
| 2165 return true; | |
| 2145 } | 2166 } |
| 2146 | 2167 |
| 2147 return false; | 2168 return false; |
| 2148 } | 2169 } |
| 2149 | 2170 |
| 2150 void WebViewImpl::setCursorVisibilityState(bool isVisible) | 2171 void WebViewImpl::setCursorVisibilityState(bool isVisible) |
| 2151 { | 2172 { |
| 2152 if (m_page) | 2173 if (m_page) |
| 2153 m_page->setIsCursorVisible(isVisible); | 2174 m_page->setIsCursorVisible(isVisible); |
| 2154 } | 2175 } |
| (...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4606 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4627 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4607 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4628 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4608 } | 4629 } |
| 4609 | 4630 |
| 4610 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4631 void WebViewImpl::forceNextWebGLContextCreationToFail() |
| 4611 { | 4632 { |
| 4612 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4633 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
| 4613 } | 4634 } |
| 4614 | 4635 |
| 4615 } // namespace blink | 4636 } // namespace blink |
| OLD | NEW |