| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (clampedOffset != m_offset) { | 262 if (clampedOffset != m_offset) { |
| 263 m_offset = clampedOffset; | 263 m_offset = clampedOffset; |
| 264 scrollAnimator().setCurrentOffset(m_offset); | 264 scrollAnimator().setCurrentOffset(m_offset); |
| 265 | 265 |
| 266 // SVG runs with accelerated compositing disabled so no | 266 // SVG runs with accelerated compositing disabled so no |
| 267 // ScrollingCoordinator. | 267 // ScrollingCoordinator. |
| 268 if (ScrollingCoordinator* coordinator = | 268 if (ScrollingCoordinator* coordinator = |
| 269 frameHost().page().scrollingCoordinator()) | 269 frameHost().page().scrollingCoordinator()) |
| 270 coordinator->scrollableAreaScrollLayerDidChange(this); | 270 coordinator->scrollableAreaScrollLayerDidChange(this); |
| 271 | 271 |
| 272 if (!frameHost().settings().inertVisualViewport()) { | 272 if (!frameHost().settings().getInertVisualViewport()) { |
| 273 if (Document* document = mainFrame()->document()) | 273 if (Document* document = mainFrame()->document()) |
| 274 document->enqueueScrollEventForNode(document); | 274 document->enqueueScrollEventForNode(document); |
| 275 } | 275 } |
| 276 | 276 |
| 277 enqueueScrollEvent(); | 277 enqueueScrollEvent(); |
| 278 | 278 |
| 279 mainFrame()->view()->didChangeScrollOffset(); | 279 mainFrame()->view()->didChangeScrollOffset(); |
| 280 valuesChanged = true; | 280 valuesChanged = true; |
| 281 } | 281 } |
| 282 | 282 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 ScrollingCoordinator* coordinator = | 370 ScrollingCoordinator* coordinator = |
| 371 frameHost().page().scrollingCoordinator(); | 371 frameHost().page().scrollingCoordinator(); |
| 372 ASSERT(coordinator); | 372 ASSERT(coordinator); |
| 373 coordinator->setLayerIsContainerForFixedPositionLayers( | 373 coordinator->setLayerIsContainerForFixedPositionLayers( |
| 374 m_innerViewportScrollLayer.get(), true); | 374 m_innerViewportScrollLayer.get(), true); |
| 375 | 375 |
| 376 // Set masks to bounds so the compositor doesn't clobber a manually | 376 // Set masks to bounds so the compositor doesn't clobber a manually |
| 377 // set inner viewport container layer size. | 377 // set inner viewport container layer size. |
| 378 m_innerViewportContainerLayer->setMasksToBounds( | 378 m_innerViewportContainerLayer->setMasksToBounds( |
| 379 frameHost().settings().mainFrameClipsContent()); | 379 frameHost().settings().getMainFrameClipsContent()); |
| 380 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); | 380 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); |
| 381 | 381 |
| 382 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( | 382 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( |
| 383 m_innerViewportContainerLayer->platformLayer()); | 383 m_innerViewportContainerLayer->platformLayer()); |
| 384 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true); | 384 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true); |
| 385 if (mainFrame()) { | 385 if (mainFrame()) { |
| 386 if (Document* document = mainFrame()->document()) { | 386 if (Document* document = mainFrame()->document()) { |
| 387 m_innerViewportScrollLayer->setElementId(createCompositorElementId( | 387 m_innerViewportScrollLayer->setElementId(createCompositorElementId( |
| 388 DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport)); | 388 DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport)); |
| 389 } | 389 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 403 m_innerViewportScrollLayer->removeAllChildren(); | 403 m_innerViewportScrollLayer->removeAllChildren(); |
| 404 m_innerViewportScrollLayer->addChild(currentLayerTreeRoot); | 404 m_innerViewportScrollLayer->addChild(currentLayerTreeRoot); |
| 405 } | 405 } |
| 406 | 406 |
| 407 void VisualViewport::initializeScrollbars() { | 407 void VisualViewport::initializeScrollbars() { |
| 408 // Do nothing if not attached to layer tree yet - will initialize upon attach. | 408 // Do nothing if not attached to layer tree yet - will initialize upon attach. |
| 409 if (!m_innerViewportContainerLayer) | 409 if (!m_innerViewportContainerLayer) |
| 410 return; | 410 return; |
| 411 | 411 |
| 412 if (visualViewportSuppliesScrollbars() && | 412 if (visualViewportSuppliesScrollbars() && |
| 413 !frameHost().settings().hideScrollbars()) { | 413 !frameHost().settings().getHideScrollbars()) { |
| 414 if (!m_overlayScrollbarHorizontal->parent()) | 414 if (!m_overlayScrollbarHorizontal->parent()) |
| 415 m_innerViewportContainerLayer->addChild( | 415 m_innerViewportContainerLayer->addChild( |
| 416 m_overlayScrollbarHorizontal.get()); | 416 m_overlayScrollbarHorizontal.get()); |
| 417 if (!m_overlayScrollbarVertical->parent()) | 417 if (!m_overlayScrollbarVertical->parent()) |
| 418 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()); | 418 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()); |
| 419 } else { | 419 } else { |
| 420 m_overlayScrollbarHorizontal->removeFromParent(); | 420 m_overlayScrollbarHorizontal->removeFromParent(); |
| 421 m_overlayScrollbarVertical->removeFromParent(); | 421 m_overlayScrollbarVertical->removeFromParent(); |
| 422 } | 422 } |
| 423 | 423 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const { | 480 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const { |
| 481 // TODO(bokan): This is currently done while registering viewport layers | 481 // TODO(bokan): This is currently done while registering viewport layers |
| 482 // with the compositor but could it actually be done earlier, like in | 482 // with the compositor but could it actually be done earlier, like in |
| 483 // setupScrollbars? Then we wouldn't need this method. | 483 // setupScrollbars? Then we wouldn't need this method. |
| 484 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); | 484 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); |
| 485 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); | 485 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); |
| 486 } | 486 } |
| 487 | 487 |
| 488 bool VisualViewport::visualViewportSuppliesScrollbars() const { | 488 bool VisualViewport::visualViewportSuppliesScrollbars() const { |
| 489 return frameHost().settings().viewportEnabled(); | 489 return frameHost().settings().getViewportEnabled(); |
| 490 } | 490 } |
| 491 | 491 |
| 492 bool VisualViewport::scrollAnimatorEnabled() const { | 492 bool VisualViewport::scrollAnimatorEnabled() const { |
| 493 return frameHost().settings().scrollAnimatorEnabled(); | 493 return frameHost().settings().getScrollAnimatorEnabled(); |
| 494 } | 494 } |
| 495 | 495 |
| 496 HostWindow* VisualViewport::getHostWindow() const { | 496 HostWindow* VisualViewport::getHostWindow() const { |
| 497 return &frameHost().chromeClient(); | 497 return &frameHost().chromeClient(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 bool VisualViewport::shouldUseIntegerScrollOffset() const { | 500 bool VisualViewport::shouldUseIntegerScrollOffset() const { |
| 501 LocalFrame* frame = mainFrame(); | 501 LocalFrame* frame = mainFrame(); |
| 502 if (frame && frame->settings() && | 502 if (frame && frame->settings() && |
| 503 !frame->settings()->preferCompositingToLCDTextEnabled()) | 503 !frame->settings()->getPreferCompositingToLCDTextEnabled()) |
| 504 return true; | 504 return true; |
| 505 | 505 |
| 506 return ScrollableArea::shouldUseIntegerScrollOffset(); | 506 return ScrollableArea::shouldUseIntegerScrollOffset(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void VisualViewport::setScrollOffset(const ScrollOffset& offset, | 509 void VisualViewport::setScrollOffset(const ScrollOffset& offset, |
| 510 ScrollType scrollType, | 510 ScrollType scrollType, |
| 511 ScrollBehavior scrollBehavior) { | 511 ScrollBehavior scrollBehavior) { |
| 512 // We clamp the offset here, because the ScrollAnimator may otherwise be | 512 // We clamp the offset here, because the ScrollAnimator may otherwise be |
| 513 // set to a non-clamped offset by ScrollableArea::setScrollOffset, | 513 // set to a non-clamped offset by ScrollableArea::setScrollOffset, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 773 } |
| 774 | 774 |
| 775 m_maxPageScale = -1; | 775 m_maxPageScale = -1; |
| 776 m_trackPinchZoomStatsForPage = false; | 776 m_trackPinchZoomStatsForPage = false; |
| 777 } | 777 } |
| 778 | 778 |
| 779 bool VisualViewport::shouldDisableDesktopWorkarounds() const { | 779 bool VisualViewport::shouldDisableDesktopWorkarounds() const { |
| 780 if (!mainFrame() || !mainFrame()->view()) | 780 if (!mainFrame() || !mainFrame()->view()) |
| 781 return false; | 781 return false; |
| 782 | 782 |
| 783 if (!mainFrame()->settings()->viewportEnabled()) | 783 if (!mainFrame()->settings()->getViewportEnabled()) |
| 784 return false; | 784 return false; |
| 785 | 785 |
| 786 // A document is considered adapted to small screen UAs if one of these holds: | 786 // A document is considered adapted to small screen UAs if one of these holds: |
| 787 // 1. The author specified viewport has a constrained width that is equal to | 787 // 1. The author specified viewport has a constrained width that is equal to |
| 788 // the initial viewport width. | 788 // the initial viewport width. |
| 789 // 2. The author has disabled viewport zoom. | 789 // 2. The author has disabled viewport zoom. |
| 790 const PageScaleConstraints& constraints = | 790 const PageScaleConstraints& constraints = |
| 791 frameHost().pageScaleConstraintsSet().pageDefinedConstraints(); | 791 frameHost().pageScaleConstraintsSet().pageDefinedConstraints(); |
| 792 | 792 |
| 793 return mainFrame()->view()->layoutSize().width() == m_size.width() || | 793 return mainFrame()->view()->layoutSize().width() == m_size.width() || |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 836 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
| 837 name = "Root Transform Layer"; | 837 name = "Root Transform Layer"; |
| 838 } else { | 838 } else { |
| 839 ASSERT_NOT_REACHED(); | 839 ASSERT_NOT_REACHED(); |
| 840 } | 840 } |
| 841 | 841 |
| 842 return name; | 842 return name; |
| 843 } | 843 } |
| 844 | 844 |
| 845 } // namespace blink | 845 } // namespace blink |
| OLD | NEW |