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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "platform/Histogram.h" | 103 #include "platform/Histogram.h" |
104 #include "platform/KeyboardCodes.h" | 104 #include "platform/KeyboardCodes.h" |
105 #include "platform/PlatformGestureEvent.h" | 105 #include "platform/PlatformGestureEvent.h" |
106 #include "platform/PlatformKeyboardEvent.h" | 106 #include "platform/PlatformKeyboardEvent.h" |
107 #include "platform/PlatformMouseEvent.h" | 107 #include "platform/PlatformMouseEvent.h" |
108 #include "platform/RuntimeEnabledFeatures.h" | 108 #include "platform/RuntimeEnabledFeatures.h" |
109 #include "platform/TraceEvent.h" | 109 #include "platform/TraceEvent.h" |
110 #include "platform/UserGestureIndicator.h" | 110 #include "platform/UserGestureIndicator.h" |
111 #include "platform/exported/WebActiveGestureAnimation.h" | 111 #include "platform/exported/WebActiveGestureAnimation.h" |
112 #include "platform/fonts/FontCache.h" | 112 #include "platform/fonts/FontCache.h" |
| 113 #include "platform/geometry/FloatRect.h" |
113 #include "platform/graphics/Color.h" | 114 #include "platform/graphics/Color.h" |
114 #include "platform/graphics/CompositorMutatorClient.h" | 115 #include "platform/graphics/CompositorMutatorClient.h" |
115 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 116 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
116 #include "platform/graphics/GraphicsContext.h" | 117 #include "platform/graphics/GraphicsContext.h" |
117 #include "platform/graphics/Image.h" | 118 #include "platform/graphics/Image.h" |
118 #include "platform/graphics/ImageBuffer.h" | 119 #include "platform/graphics/ImageBuffer.h" |
119 #include "platform/graphics/gpu/DrawingBuffer.h" | 120 #include "platform/graphics/gpu/DrawingBuffer.h" |
120 #include "platform/graphics/paint/DrawingRecorder.h" | 121 #include "platform/graphics/paint/DrawingRecorder.h" |
121 #include "platform/image-decoders/ImageDecoder.h" | 122 #include "platform/image-decoders/ImageDecoder.h" |
122 #include "platform/scroll/ScrollbarTheme.h" | 123 #include "platform/scroll/ScrollbarTheme.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 , m_zoomFactorForDeviceScaleFactor(0.f) | 414 , m_zoomFactorForDeviceScaleFactor(0.f) |
414 , m_maximumLegibleScale(1) | 415 , m_maximumLegibleScale(1) |
415 , m_doubleTapZoomPageScaleFactor(0) | 416 , m_doubleTapZoomPageScaleFactor(0) |
416 , m_doubleTapZoomPending(false) | 417 , m_doubleTapZoomPending(false) |
417 , m_enableFakePageScaleAnimationForTesting(false) | 418 , m_enableFakePageScaleAnimationForTesting(false) |
418 , m_fakePageScaleAnimationPageScaleFactor(0) | 419 , m_fakePageScaleAnimationPageScaleFactor(0) |
419 , m_fakePageScaleAnimationUseAnchor(false) | 420 , m_fakePageScaleAnimationUseAnchor(false) |
420 , m_doingDragAndDrop(false) | 421 , m_doingDragAndDrop(false) |
421 , m_ignoreInputEvents(false) | 422 , m_ignoreInputEvents(false) |
422 , m_compositorDeviceScaleFactorOverride(0) | 423 , m_compositorDeviceScaleFactorOverride(0) |
423 , m_rootLayerScale(1) | |
424 , m_suppressNextKeypressEvent(false) | 424 , m_suppressNextKeypressEvent(false) |
425 , m_imeAcceptEvents(true) | 425 , m_imeAcceptEvents(true) |
426 , m_operationsAllowed(WebDragOperationNone) | 426 , m_operationsAllowed(WebDragOperationNone) |
427 , m_dragOperation(WebDragOperationNone) | 427 , m_dragOperation(WebDragOperationNone) |
428 , m_devToolsEmulator(nullptr) | 428 , m_devToolsEmulator(nullptr) |
429 , m_isTransparent(false) | 429 , m_isTransparent(false) |
430 , m_tabsToLinks(false) | 430 , m_tabsToLinks(false) |
431 , m_layerTreeView(nullptr) | 431 , m_layerTreeView(nullptr) |
432 , m_rootLayer(nullptr) | 432 , m_rootLayer(nullptr) |
433 , m_rootGraphicsLayer(nullptr) | 433 , m_rootGraphicsLayer(nullptr) |
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3837 return; | 3837 return; |
3838 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; | 3838 m_compositorDeviceScaleFactorOverride = deviceScaleFactor; |
3839 if (m_zoomFactorForDeviceScaleFactor) { | 3839 if (m_zoomFactorForDeviceScaleFactor) { |
3840 setZoomLevel(zoomLevel()); | 3840 setZoomLevel(zoomLevel()); |
3841 return; | 3841 return; |
3842 } | 3842 } |
3843 if (page() && m_layerTreeView) | 3843 if (page() && m_layerTreeView) |
3844 updateLayerTreeDeviceScaleFactor(); | 3844 updateLayerTreeDeviceScaleFactor(); |
3845 } | 3845 } |
3846 | 3846 |
3847 void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float ro
otLayerScale) | 3847 void WebViewImpl::setRootLayerTransform(const TransformationMatrix& transform) |
3848 { | 3848 { |
3849 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs
et) | 3849 if (transform == m_rootLayerTransform) |
3850 return; | 3850 return; |
3851 m_rootLayerScale = rootLayerScale; | 3851 m_rootLayerTransform = transform; |
3852 m_rootLayerOffset = rootLayerOffset; | |
3853 if (mainFrameImpl()) | |
3854 mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset,
m_rootLayerScale); | |
3855 updateRootLayerTransform(); | 3852 updateRootLayerTransform(); |
3856 } | 3853 } |
3857 | 3854 |
| 3855 TransformationMatrix WebViewImpl::getRootLayerTransformForTesting() const |
| 3856 { |
| 3857 return m_rootLayerTransform; |
| 3858 } |
| 3859 |
3858 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params) | 3860 void WebViewImpl::enableDeviceEmulation(const WebDeviceEmulationParams& params) |
3859 { | 3861 { |
3860 m_devToolsEmulator->enableDeviceEmulation(params); | 3862 m_devToolsEmulator->enableDeviceEmulation(params); |
3861 } | 3863 } |
3862 | 3864 |
3863 void WebViewImpl::disableDeviceEmulation() | 3865 void WebViewImpl::disableDeviceEmulation() |
3864 { | 3866 { |
3865 m_devToolsEmulator->disableDeviceEmulation(); | 3867 m_devToolsEmulator->disableDeviceEmulation(); |
3866 } | 3868 } |
3867 | 3869 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4083 void WebViewImpl::didChangeContentsSize() | 4085 void WebViewImpl::didChangeContentsSize() |
4084 { | 4086 { |
4085 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); | 4087 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); |
4086 } | 4088 } |
4087 | 4089 |
4088 void WebViewImpl::pageScaleFactorChanged() | 4090 void WebViewImpl::pageScaleFactorChanged() |
4089 { | 4091 { |
4090 pageScaleConstraintsSet().setNeedsReset(false); | 4092 pageScaleConstraintsSet().setNeedsReset(false); |
4091 updateLayerTreeViewport(); | 4093 updateLayerTreeViewport(); |
4092 m_client->pageScaleFactorChanged(); | 4094 m_client->pageScaleFactorChanged(); |
| 4095 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); |
| 4096 } |
| 4097 |
| 4098 void WebViewImpl::mainFrameScrollOffsetChanged() |
| 4099 { |
| 4100 m_devToolsEmulator->mainFrameScrollOrScaleChanged(); |
4093 } | 4101 } |
4094 | 4102 |
4095 bool WebViewImpl::useExternalPopupMenus() | 4103 bool WebViewImpl::useExternalPopupMenus() |
4096 { | 4104 { |
4097 return shouldUseExternalPopupMenus; | 4105 return shouldUseExternalPopupMenus; |
4098 } | 4106 } |
4099 | 4107 |
4100 void WebViewImpl::startDragging(LocalFrame* frame, | 4108 void WebViewImpl::startDragging(LocalFrame* frame, |
4101 const WebDragData& dragData, | 4109 const WebDragData& dragData, |
4102 WebDragOperationsMask mask, | 4110 WebDragOperationsMask mask, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4415 { | 4423 { |
4416 DCHECK(page()); | 4424 DCHECK(page()); |
4417 DCHECK(m_layerTreeView); | 4425 DCHECK(m_layerTreeView); |
4418 | 4426 |
4419 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); | 4427 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit
orDeviceScaleFactorOverride : page()->deviceScaleFactor(); |
4420 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); | 4428 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); |
4421 } | 4429 } |
4422 | 4430 |
4423 void WebViewImpl::updateRootLayerTransform() | 4431 void WebViewImpl::updateRootLayerTransform() |
4424 { | 4432 { |
4425 if (m_visualViewportContainerLayer) { | 4433 if (m_visualViewportContainerLayer) |
4426 TransformationMatrix transform; | 4434 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); |
4427 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); | |
4428 transform = transform.scale(m_rootLayerScale); | |
4429 m_visualViewportContainerLayer->setTransform(transform); | |
4430 } | |
4431 } | 4435 } |
4432 | 4436 |
4433 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) | 4437 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar
getedEvent) |
4434 { | 4438 { |
4435 if (!m_page->mainFrame()->isLocalFrame()) | 4439 if (!m_page->mainFrame()->isLocalFrame()) |
4436 return false; | 4440 return false; |
4437 | 4441 |
4438 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. | 4442 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo
ot() will modify it. |
4439 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4443 HitTestResult touchHit = targetedEvent.hitTestResult(); |
4440 touchHit.setToShadowHostIfInUserAgentShadowRoot(); | 4444 touchHit.setToShadowHostIfInUserAgentShadowRoot(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4585 float WebViewImpl::deviceScaleFactor() const | 4589 float WebViewImpl::deviceScaleFactor() const |
4586 { | 4590 { |
4587 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4591 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4588 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4592 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4589 if (!page()) | 4593 if (!page()) |
4590 return 1; | 4594 return 1; |
4591 | 4595 |
4592 return page()->deviceScaleFactor(); | 4596 return page()->deviceScaleFactor(); |
4593 } | 4597 } |
4594 | 4598 |
| 4599 float WebViewImpl::compositorDeviceScaleFactor() const |
| 4600 { |
| 4601 if (m_compositorDeviceScaleFactorOverride) |
| 4602 return m_compositorDeviceScaleFactorOverride; |
| 4603 return deviceScaleFactor(); |
| 4604 } |
| 4605 |
4595 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const | 4606 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const |
4596 { | 4607 { |
4597 if (!mainFrameImpl()) | 4608 if (!mainFrameImpl()) |
4598 return nullptr; | 4609 return nullptr; |
4599 | 4610 |
4600 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); | 4611 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); |
4601 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4612 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4602 return nullptr; | 4613 return nullptr; |
4603 return focusedFrame; | 4614 return focusedFrame; |
4604 } | 4615 } |
4605 | 4616 |
4606 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4617 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
4607 { | 4618 { |
4608 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4619 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4609 } | 4620 } |
4610 | 4621 |
4611 } // namespace blink | 4622 } // namespace blink |
OLD | NEW |