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