| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (clampedOffset != m_offset) { | 263 if (clampedOffset != m_offset) { |
| 264 m_offset = clampedOffset; | 264 m_offset = clampedOffset; |
| 265 scrollAnimator().setCurrentOffset(m_offset); | 265 scrollAnimator().setCurrentOffset(m_offset); |
| 266 | 266 |
| 267 // SVG runs with accelerated compositing disabled so no | 267 // SVG runs with accelerated compositing disabled so no |
| 268 // ScrollingCoordinator. | 268 // ScrollingCoordinator. |
| 269 if (ScrollingCoordinator* coordinator = | 269 if (ScrollingCoordinator* coordinator = |
| 270 frameHost().page().scrollingCoordinator()) | 270 frameHost().page().scrollingCoordinator()) |
| 271 coordinator->scrollableAreaScrollLayerDidChange(this); | 271 coordinator->scrollableAreaScrollLayerDidChange(this); |
| 272 | 272 |
| 273 if (!frameHost().settings().getInertVisualViewport()) { | 273 if (!frameHost().page().settings().getInertVisualViewport()) { |
| 274 if (Document* document = mainFrame()->document()) | 274 if (Document* document = mainFrame()->document()) |
| 275 document->enqueueScrollEventForNode(document); | 275 document->enqueueScrollEventForNode(document); |
| 276 } | 276 } |
| 277 | 277 |
| 278 enqueueScrollEvent(); | 278 enqueueScrollEvent(); |
| 279 | 279 |
| 280 mainFrame()->view()->didChangeScrollOffset(); | 280 mainFrame()->view()->didChangeScrollOffset(); |
| 281 valuesChanged = true; | 281 valuesChanged = true; |
| 282 } | 282 } |
| 283 | 283 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 370 |
| 371 ScrollingCoordinator* coordinator = | 371 ScrollingCoordinator* coordinator = |
| 372 frameHost().page().scrollingCoordinator(); | 372 frameHost().page().scrollingCoordinator(); |
| 373 ASSERT(coordinator); | 373 ASSERT(coordinator); |
| 374 coordinator->setLayerIsContainerForFixedPositionLayers( | 374 coordinator->setLayerIsContainerForFixedPositionLayers( |
| 375 m_innerViewportScrollLayer.get(), true); | 375 m_innerViewportScrollLayer.get(), true); |
| 376 | 376 |
| 377 // Set masks to bounds so the compositor doesn't clobber a manually | 377 // Set masks to bounds so the compositor doesn't clobber a manually |
| 378 // set inner viewport container layer size. | 378 // set inner viewport container layer size. |
| 379 m_innerViewportContainerLayer->setMasksToBounds( | 379 m_innerViewportContainerLayer->setMasksToBounds( |
| 380 frameHost().settings().getMainFrameClipsContent()); | 380 frameHost().page().settings().getMainFrameClipsContent()); |
| 381 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); | 381 m_innerViewportContainerLayer->setSize(FloatSize(m_size)); |
| 382 | 382 |
| 383 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( | 383 m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer( |
| 384 m_innerViewportContainerLayer->platformLayer()); | 384 m_innerViewportContainerLayer->platformLayer()); |
| 385 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true); | 385 m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true); |
| 386 if (mainFrame()) { | 386 if (mainFrame()) { |
| 387 if (Document* document = mainFrame()->document()) { | 387 if (Document* document = mainFrame()->document()) { |
| 388 m_innerViewportScrollLayer->setElementId(createCompositorElementId( | 388 m_innerViewportScrollLayer->setElementId(createCompositorElementId( |
| 389 DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport)); | 389 DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport)); |
| 390 } | 390 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 404 m_innerViewportScrollLayer->removeAllChildren(); | 404 m_innerViewportScrollLayer->removeAllChildren(); |
| 405 m_innerViewportScrollLayer->addChild(currentLayerTreeRoot); | 405 m_innerViewportScrollLayer->addChild(currentLayerTreeRoot); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void VisualViewport::initializeScrollbars() { | 408 void VisualViewport::initializeScrollbars() { |
| 409 // Do nothing if not attached to layer tree yet - will initialize upon attach. | 409 // Do nothing if not attached to layer tree yet - will initialize upon attach. |
| 410 if (!m_innerViewportContainerLayer) | 410 if (!m_innerViewportContainerLayer) |
| 411 return; | 411 return; |
| 412 | 412 |
| 413 if (visualViewportSuppliesScrollbars() && | 413 if (visualViewportSuppliesScrollbars() && |
| 414 !frameHost().settings().getHideScrollbars()) { | 414 !frameHost().page().settings().getHideScrollbars()) { |
| 415 if (!m_overlayScrollbarHorizontal->parent()) | 415 if (!m_overlayScrollbarHorizontal->parent()) |
| 416 m_innerViewportContainerLayer->addChild( | 416 m_innerViewportContainerLayer->addChild( |
| 417 m_overlayScrollbarHorizontal.get()); | 417 m_overlayScrollbarHorizontal.get()); |
| 418 if (!m_overlayScrollbarVertical->parent()) | 418 if (!m_overlayScrollbarVertical->parent()) |
| 419 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()); | 419 m_innerViewportContainerLayer->addChild(m_overlayScrollbarVertical.get()); |
| 420 } else { | 420 } else { |
| 421 m_overlayScrollbarHorizontal->removeFromParent(); | 421 m_overlayScrollbarHorizontal->removeFromParent(); |
| 422 m_overlayScrollbarVertical->removeFromParent(); | 422 m_overlayScrollbarVertical->removeFromParent(); |
| 423 } | 423 } |
| 424 | 424 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const { | 488 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const { |
| 489 // TODO(bokan): This is currently done while registering viewport layers | 489 // TODO(bokan): This is currently done while registering viewport layers |
| 490 // with the compositor but could it actually be done earlier, like in | 490 // with the compositor but could it actually be done earlier, like in |
| 491 // setupScrollbars? Then we wouldn't need this method. | 491 // setupScrollbars? Then we wouldn't need this method. |
| 492 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); | 492 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer); |
| 493 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); | 493 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer); |
| 494 } | 494 } |
| 495 | 495 |
| 496 bool VisualViewport::visualViewportSuppliesScrollbars() const { | 496 bool VisualViewport::visualViewportSuppliesScrollbars() const { |
| 497 return frameHost().settings().getViewportEnabled(); | 497 return frameHost().page().settings().getViewportEnabled(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 bool VisualViewport::scrollAnimatorEnabled() const { | 500 bool VisualViewport::scrollAnimatorEnabled() const { |
| 501 return frameHost().settings().getScrollAnimatorEnabled(); | 501 return frameHost().page().settings().getScrollAnimatorEnabled(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 HostWindow* VisualViewport::getHostWindow() const { | 504 HostWindow* VisualViewport::getHostWindow() const { |
| 505 return &frameHost().chromeClient(); | 505 return &frameHost().chromeClient(); |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool VisualViewport::shouldUseIntegerScrollOffset() const { | 508 bool VisualViewport::shouldUseIntegerScrollOffset() const { |
| 509 LocalFrame* frame = mainFrame(); | 509 LocalFrame* frame = mainFrame(); |
| 510 if (frame && frame->settings() && | 510 if (frame && frame->settings() && |
| 511 !frame->settings()->getPreferCompositingToLCDTextEnabled()) | 511 !frame->settings()->getPreferCompositingToLCDTextEnabled()) |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 } else if (graphicsLayer == m_rootTransformLayer.get()) { | 855 } else if (graphicsLayer == m_rootTransformLayer.get()) { |
| 856 name = "Root Transform Layer"; | 856 name = "Root Transform Layer"; |
| 857 } else { | 857 } else { |
| 858 ASSERT_NOT_REACHED(); | 858 ASSERT_NOT_REACHED(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 return name; | 861 return name; |
| 862 } | 862 } |
| 863 | 863 |
| 864 } // namespace blink | 864 } // namespace blink |
| OLD | NEW |