Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2728253002: Remove indirection: setup scrollbar scroll layers in the scrollbar constructor (Closed)
Patch Set: Really fix reivewer comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 int thumbThickness = theme.thumbThickness(); 446 int thumbThickness = theme.thumbThickness();
447 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar); 447 int scrollbarThickness = theme.scrollbarThickness(RegularScrollbar);
448 int scrollbarMargin = theme.scrollbarMargin(); 448 int scrollbarMargin = theme.scrollbarMargin();
449 449
450 if (!webScrollbarLayer) { 450 if (!webScrollbarLayer) {
451 ScrollingCoordinator* coordinator = 451 ScrollingCoordinator* coordinator =
452 frameHost().page().scrollingCoordinator(); 452 frameHost().page().scrollingCoordinator();
453 ASSERT(coordinator); 453 ASSERT(coordinator);
454 ScrollbarOrientation webcoreOrientation = 454 ScrollbarOrientation webcoreOrientation =
455 isHorizontal ? HorizontalScrollbar : VerticalScrollbar; 455 isHorizontal ? HorizontalScrollbar : VerticalScrollbar;
456 WebLayer* scrollLayer = layerForScrolling()->platformLayer();
456 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer( 457 webScrollbarLayer = coordinator->createSolidColorScrollbarLayer(
457 webcoreOrientation, thumbThickness, scrollbarMargin, false); 458 webcoreOrientation, thumbThickness, scrollbarMargin, false,
459 scrollLayer);
458 460
459 // The compositor will control the scrollbar's visibility. Set to invisible 461 // The compositor will control the scrollbar's visibility. Set to invisible
460 // by default so scrollbars don't show up in layout tests. 462 // by default so scrollbars don't show up in layout tests.
461 webScrollbarLayer->layer()->setOpacity(0); 463 webScrollbarLayer->layer()->setOpacity(0);
462 scrollbarGraphicsLayer->setContentsToPlatformLayer( 464 scrollbarGraphicsLayer->setContentsToPlatformLayer(
463 webScrollbarLayer->layer()); 465 webScrollbarLayer->layer());
464 scrollbarGraphicsLayer->setDrawsContent(false); 466 scrollbarGraphicsLayer->setDrawsContent(false);
465 } 467 }
466 468
467 int xPosition = isHorizontal ? 0 469 int xPosition = isHorizontal ? 0
(...skipping 10 matching lines...) Expand all
478 int height = isHorizontal ? scrollbarThickness 480 int height = isHorizontal ? scrollbarThickness
479 : m_innerViewportContainerLayer->size().height() - 481 : m_innerViewportContainerLayer->size().height() -
480 scrollbarThickness; 482 scrollbarThickness;
481 483
482 // Use the GraphicsLayer to position the scrollbars. 484 // Use the GraphicsLayer to position the scrollbars.
483 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition)); 485 scrollbarGraphicsLayer->setPosition(IntPoint(xPosition, yPosition));
484 scrollbarGraphicsLayer->setSize(FloatSize(width, height)); 486 scrollbarGraphicsLayer->setSize(FloatSize(width, height));
485 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height)); 487 scrollbarGraphicsLayer->setContentsRect(IntRect(0, 0, width, height));
486 } 488 }
487 489
488 void VisualViewport::setScrollLayerOnScrollbars(WebLayer* scrollLayer) const {
489 // TODO(bokan): This is currently done while registering viewport layers
490 // with the compositor but could it actually be done earlier, like in
491 // setupScrollbars? Then we wouldn't need this method.
492 m_webOverlayScrollbarHorizontal->setScrollLayer(scrollLayer);
493 m_webOverlayScrollbarVertical->setScrollLayer(scrollLayer);
494 }
495
496 bool VisualViewport::visualViewportSuppliesScrollbars() const { 490 bool VisualViewport::visualViewportSuppliesScrollbars() const {
497 return frameHost().page().settings().getViewportEnabled(); 491 return frameHost().page().settings().getViewportEnabled();
498 } 492 }
499 493
500 bool VisualViewport::scrollAnimatorEnabled() const { 494 bool VisualViewport::scrollAnimatorEnabled() const {
501 return frameHost().page().settings().getScrollAnimatorEnabled(); 495 return frameHost().page().settings().getScrollAnimatorEnabled();
502 } 496 }
503 497
504 HostWindow* VisualViewport::getHostWindow() const { 498 HostWindow* VisualViewport::getHostWindow() const {
505 return &frameHost().page().chromeClient(); 499 return &frameHost().page().chromeClient();
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 } else if (graphicsLayer == m_rootTransformLayer.get()) { 849 } else if (graphicsLayer == m_rootTransformLayer.get()) {
856 name = "Root Transform Layer"; 850 name = "Root Transform Layer";
857 } else { 851 } else {
858 ASSERT_NOT_REACHED(); 852 ASSERT_NOT_REACHED();
859 } 853 }
860 854
861 return name; 855 return name;
862 } 856 }
863 857
864 } // namespace blink 858 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698