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

Side by Side Diff: sky/engine/core/rendering/compositing/RenderLayerCompositor.cpp

Issue 721473002: Removed ScrollingCoordinator and a bunch of composited scrolling' (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr comments Created 6 years, 1 month 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) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include "core/rendering/compositing/RenderLayerCompositor.h" 28 #include "core/rendering/compositing/RenderLayerCompositor.h"
29 29
30 #include "core/animation/DocumentAnimations.h" 30 #include "core/animation/DocumentAnimations.h"
31 #include "core/frame/FrameView.h" 31 #include "core/frame/FrameView.h"
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/Settings.h" 33 #include "core/frame/Settings.h"
34 #include "core/inspector/InspectorNodeIds.h" 34 #include "core/inspector/InspectorNodeIds.h"
35 #include "core/page/Chrome.h" 35 #include "core/page/Chrome.h"
36 #include "core/page/ChromeClient.h" 36 #include "core/page/ChromeClient.h"
37 #include "core/page/Page.h" 37 #include "core/page/Page.h"
38 #include "core/page/scrolling/ScrollingCoordinator.h"
39 #include "core/rendering/RenderLayerStackingNode.h" 38 #include "core/rendering/RenderLayerStackingNode.h"
40 #include "core/rendering/RenderLayerStackingNodeIterator.h" 39 #include "core/rendering/RenderLayerStackingNodeIterator.h"
41 #include "core/rendering/RenderView.h" 40 #include "core/rendering/RenderView.h"
42 #include "core/rendering/compositing/CompositedLayerMapping.h" 41 #include "core/rendering/compositing/CompositedLayerMapping.h"
43 #include "core/rendering/compositing/CompositingInputsUpdater.h" 42 #include "core/rendering/compositing/CompositingInputsUpdater.h"
44 #include "core/rendering/compositing/CompositingLayerAssigner.h" 43 #include "core/rendering/compositing/CompositingLayerAssigner.h"
45 #include "core/rendering/compositing/CompositingRequirementsUpdater.h" 44 #include "core/rendering/compositing/CompositingRequirementsUpdater.h"
46 #include "core/rendering/compositing/GraphicsLayerTreeBuilder.h" 45 #include "core/rendering/compositing/GraphicsLayerTreeBuilder.h"
47 #include "core/rendering/compositing/GraphicsLayerUpdater.h" 46 #include "core/rendering/compositing/GraphicsLayerUpdater.h"
48 #include "platform/RuntimeEnabledFeatures.h" 47 #include "platform/RuntimeEnabledFeatures.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 { 357 {
359 if (m_overflowControlsHostLayer) 358 if (m_overflowControlsHostLayer)
360 m_overflowControlsHostLayer->setPosition(contentsOffset); 359 m_overflowControlsHostLayer->setPosition(contentsOffset);
361 } 360 }
362 361
363 void RenderLayerCompositor::frameViewDidChangeSize() 362 void RenderLayerCompositor::frameViewDidChangeSize()
364 { 363 {
365 if (m_containerLayer) { 364 if (m_containerLayer) {
366 FrameView* frameView = m_renderView.frameView(); 365 FrameView* frameView = m_renderView.frameView();
367 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); 366 m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
368 updateOverflowControlsLayers();
369 } 367 }
370 } 368 }
371 369
372 void RenderLayerCompositor::rootFixedBackgroundsChanged() 370 void RenderLayerCompositor::rootFixedBackgroundsChanged()
373 { 371 {
374 if (!supportsFixedRootBackgroundCompositing()) 372 if (!supportsFixedRootBackgroundCompositing())
375 return; 373 return;
376 374
377 // To avoid having to make the fixed root background layer fixed positioned to 375 // To avoid having to make the fixed root background layer fixed positioned to
378 // stay put, we position it in the layer tree as follows: 376 // stay put, we position it in the layer tree as follows:
379 // 377 //
380 // + Overflow controls host 378 // + Overflow controls host
381 // + LocalFrame clip 379 // + LocalFrame clip
382 // + (Fixed root background) <-- Here. 380 // + (Fixed root background) <-- Here.
383 // + LocalFrame scroll 381 // + LocalFrame scroll
384 // + Root content layer 382 // + Root content layer
385 // + Scrollbars 383 // + Scrollbars
386 // 384 //
387 // That is, it needs to be the first child of the frame clip, the sibling of 385 // That is, it needs to be the first child of the frame clip, the sibling of
388 // the frame scroll layer. The compositor does not own the background layer, it 386 // the frame scroll layer. The compositor does not own the background layer, it
389 // just positions it (like the foreground layer). 387 // just positions it (like the foreground layer).
390 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) 388 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
391 m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get()); 389 m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
392 } 390 }
393 391
394 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
395 {
396 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( ))
397 return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s crollableArea());
398 return false;
399 }
400
401 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) 392 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
402 { 393 {
403 ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean); 394 ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean);
404 395
405 if (!m_rootContentLayer) 396 if (!m_rootContentLayer)
406 return String(); 397 return String();
407 398
408 // We skip dumping the scroll and clip layers to keep layerTreeAsText output 399 // We skip dumping the scroll and clip layers to keep layerTreeAsText output
409 // similar between platforms (unless we explicitly request dumping from the 400 // similar between platforms (unless we explicitly request dumping from the
410 // root. 401 // root.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 455 }
465 456
466 GraphicsLayer* RenderLayerCompositor::ensureRootTransformLayer() 457 GraphicsLayer* RenderLayerCompositor::ensureRootTransformLayer()
467 { 458 {
468 ASSERT(rootGraphicsLayer()); 459 ASSERT(rootGraphicsLayer());
469 460
470 if (!m_rootTransformLayer.get()) { 461 if (!m_rootTransformLayer.get()) {
471 m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory(), thi s); 462 m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory(), thi s);
472 m_overflowControlsHostLayer->addChild(m_rootTransformLayer.get()); 463 m_overflowControlsHostLayer->addChild(m_rootTransformLayer.get());
473 m_rootTransformLayer->addChild(m_containerLayer.get()); 464 m_rootTransformLayer->addChild(m_containerLayer.get());
474 updateOverflowControlsLayers();
475 } 465 }
476 466
477 return m_rootTransformLayer.get(); 467 return m_rootTransformLayer.get();
478 } 468 }
479 469
480 void RenderLayerCompositor::setIsInWindow(bool isInWindow) 470 void RenderLayerCompositor::setIsInWindow(bool isInWindow)
481 { 471 {
482 if (!staleInCompositingMode()) 472 if (!staleInCompositingMode())
483 return; 473 return;
484 474
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 { 600 {
611 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 601 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
612 m_isTrackingPaintInvalidations = tracksPaintInvalidations; 602 m_isTrackingPaintInvalidations = tracksPaintInvalidations;
613 } 603 }
614 604
615 bool RenderLayerCompositor::isTrackingPaintInvalidations() const 605 bool RenderLayerCompositor::isTrackingPaintInvalidations() const
616 { 606 {
617 return m_isTrackingPaintInvalidations; 607 return m_isTrackingPaintInvalidations;
618 } 608 }
619 609
620 bool RenderLayerCompositor::requiresHorizontalScrollbarLayer() const
621 {
622 // FIXME(sky): Remove
623 return false;
624 }
625
626 bool RenderLayerCompositor::requiresVerticalScrollbarLayer() const
627 {
628 // FIXME(sky): Remove
629 return false;
630 }
631
632 void RenderLayerCompositor::updateOverflowControlsLayers()
633 {
634 GraphicsLayer* controlsParent = m_rootTransformLayer.get() ? m_rootTransform Layer.get() : m_overflowControlsHostLayer.get();
635
636 if (requiresHorizontalScrollbarLayer()) {
637 if (!m_layerForHorizontalScrollbar) {
638 m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerF actory(), this);
639 }
640
641 if (m_layerForHorizontalScrollbar->parent() != controlsParent) {
642 controlsParent->addChild(m_layerForHorizontalScrollbar.get());
643 }
644 } else if (m_layerForHorizontalScrollbar) {
645 m_layerForHorizontalScrollbar->removeFromParent();
646 m_layerForHorizontalScrollbar = nullptr;
647 }
648
649 if (requiresVerticalScrollbarLayer()) {
650 if (!m_layerForVerticalScrollbar) {
651 m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFac tory(), this);
652 }
653
654 if (m_layerForVerticalScrollbar->parent() != controlsParent) {
655 controlsParent->addChild(m_layerForVerticalScrollbar.get());
656 }
657 } else if (m_layerForVerticalScrollbar) {
658 m_layerForVerticalScrollbar->removeFromParent();
659 m_layerForVerticalScrollbar = nullptr;
660 }
661 }
662
663 void RenderLayerCompositor::ensureRootLayer() 610 void RenderLayerCompositor::ensureRootLayer()
664 { 611 {
665 RootLayerAttachment expectedAttachment = RootLayerAttachedViaChromeClient; 612 RootLayerAttachment expectedAttachment = RootLayerAttachedViaChromeClient;
666 if (expectedAttachment == m_rootLayerAttachment) 613 if (expectedAttachment == m_rootLayerAttachment)
667 return; 614 return;
668 615
669 if (!m_rootContentLayer) { 616 if (!m_rootContentLayer) {
670 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this) ; 617 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this) ;
671 IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect(); 618 IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect();
672 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect. maxY())); 619 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect. maxY()));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 attachRootLayer(expectedAttachment); 657 attachRootLayer(expectedAttachment);
711 } 658 }
712 659
713 void RenderLayerCompositor::destroyRootLayer() 660 void RenderLayerCompositor::destroyRootLayer()
714 { 661 {
715 if (!m_rootContentLayer) 662 if (!m_rootContentLayer)
716 return; 663 return;
717 664
718 detachRootLayer(); 665 detachRootLayer();
719 666
720 if (m_layerForHorizontalScrollbar) {
721 m_layerForHorizontalScrollbar->removeFromParent();
722 m_layerForHorizontalScrollbar = nullptr;
723 }
724
725 if (m_layerForVerticalScrollbar) {
726 m_layerForVerticalScrollbar->removeFromParent();
727 m_layerForVerticalScrollbar = nullptr;
728 }
729
730 if (m_overflowControlsHostLayer) { 667 if (m_overflowControlsHostLayer) {
731 m_overflowControlsHostLayer = nullptr; 668 m_overflowControlsHostLayer = nullptr;
732 m_containerLayer = nullptr; 669 m_containerLayer = nullptr;
733 m_scrollLayer = nullptr; 670 m_scrollLayer = nullptr;
734 } 671 }
735 ASSERT(!m_scrollLayer); 672 ASSERT(!m_scrollLayer);
736 m_rootContentLayer = nullptr; 673 m_rootContentLayer = nullptr;
737 m_rootTransformLayer = nullptr; 674 m_rootTransformLayer = nullptr;
738 } 675 }
739 676
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 721 }
785 722
786 m_rootLayerAttachment = RootLayerUnattached; 723 m_rootLayerAttachment = RootLayerUnattached;
787 } 724 }
788 725
789 void RenderLayerCompositor::updateRootLayerAttachment() 726 void RenderLayerCompositor::updateRootLayerAttachment()
790 { 727 {
791 ensureRootLayer(); 728 ensureRootLayer();
792 } 729 }
793 730
794 ScrollingCoordinator* RenderLayerCompositor::scrollingCoordinator() const
795 {
796 if (Page* page = this->page())
797 return page->scrollingCoordinator();
798
799 return 0;
800 }
801
802 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const 731 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const
803 { 732 {
804 if (Page* page = this->page()) 733 if (Page* page = this->page())
805 return page->chrome().client().graphicsLayerFactory(); 734 return page->chrome().client().graphicsLayerFactory();
806 return 0; 735 return 0;
807 } 736 }
808 737
809 Page* RenderLayerCompositor::page() const 738 Page* RenderLayerCompositor::page() const
810 { 739 {
811 return m_renderView.frameView()->frame().page(); 740 return m_renderView.frameView()->frame().page();
812 } 741 }
813 742
814 DocumentLifecycle& RenderLayerCompositor::lifecycle() const 743 DocumentLifecycle& RenderLayerCompositor::lifecycle() const
815 { 744 {
816 return m_renderView.document().lifecycle(); 745 return m_renderView.document().lifecycle();
817 } 746 }
818 747
819 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) 748 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer)
820 { 749 {
821 String name; 750 String name;
822 if (graphicsLayer == m_rootContentLayer.get()) { 751 if (graphicsLayer == m_rootContentLayer.get()) {
823 name = "Content Root Layer"; 752 name = "Content Root Layer";
824 } else if (graphicsLayer == m_rootTransformLayer.get()) { 753 } else if (graphicsLayer == m_rootTransformLayer.get()) {
825 name = "Root Transform Layer"; 754 name = "Root Transform Layer";
826 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { 755 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
827 name = "Overflow Controls Host Layer"; 756 name = "Overflow Controls Host Layer";
828 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
829 name = "Horizontal Scrollbar Layer";
830 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
831 name = "Vertical Scrollbar Layer";
832 } else if (graphicsLayer == m_containerLayer.get()) { 757 } else if (graphicsLayer == m_containerLayer.get()) {
833 name = "LocalFrame Clipping Layer"; 758 name = "LocalFrame Clipping Layer";
834 } else if (graphicsLayer == m_scrollLayer.get()) { 759 } else if (graphicsLayer == m_scrollLayer.get()) {
835 name = "LocalFrame Scrolling Layer"; 760 name = "LocalFrame Scrolling Layer";
836 } else { 761 } else {
837 ASSERT_NOT_REACHED(); 762 ASSERT_NOT_REACHED();
838 } 763 }
839 764
840 return name; 765 return name;
841 } 766 }
842 767
843 } // namespace blink 768 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/compositing/RenderLayerCompositor.h ('k') | sky/engine/platform/graphics/CompositingReasons.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698