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

Side by Side Diff: Source/core/rendering/RenderLayerCompositor.cpp

Issue 16136004: Add graphics layers for pinch virtual viewport. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset) 1112 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsO ffset)
1113 { 1113 {
1114 if (m_overflowControlsHostLayer) 1114 if (m_overflowControlsHostLayer)
1115 m_overflowControlsHostLayer->setPosition(contentsOffset); 1115 m_overflowControlsHostLayer->setPosition(contentsOffset);
1116 } 1116 }
1117 1117
1118 void RenderLayerCompositor::frameViewDidChangeSize() 1118 void RenderLayerCompositor::frameViewDidChangeSize()
1119 { 1119 {
1120 if (m_clipLayer) { 1120 if (m_clipLayer) {
1121 FrameView* frameView = m_renderView->frameView(); 1121 FrameView* frameView = m_renderView->frameView();
1122 m_clipLayer->setSize(frameView->unscaledVisibleContentSize()); 1122 FloatSize visibleContentSize = frameView->unscaledVisibleContentSize();
trchen 2013/05/29 21:32:56 FloatSize unscaledVisibleContentSize = ...
wjmaclean 2013/05/30 14:19:09 Done.
1123 m_clipLayer->setSize(visibleContentSize);
1124 if (m_pinchVirtualViewportClipLayer) {
trchen 2013/05/29 21:32:56 FloatSize visibleContentSize = unscaledVisibleCont
wjmaclean 2013/05/30 14:19:09 Done.
1125 visibleContentSize.scale(frameView->visibleContentScaleFactor());
1126 m_pinchVirtualViewportClipLayer->setSize(visibleContentSize);
1127 }
1123 1128
1124 frameViewDidScroll(); 1129 frameViewDidScroll();
1125 updateOverflowControlsLayers(); 1130 updateOverflowControlsLayers();
1126 1131
1127 #if ENABLE(RUBBER_BANDING) 1132 #if ENABLE(RUBBER_BANDING)
1128 if (m_layerForOverhangAreas) 1133 if (m_layerForOverhangAreas)
1129 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); 1134 m_layerForOverhangAreas->setSize(frameView->frameRect().size());
1130 #endif 1135 #endif
1131 } 1136 }
1132 } 1137 }
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 m_clipLayer->setName("frame clipping"); 2391 m_clipLayer->setName("frame clipping");
2387 #endif 2392 #endif
2388 m_clipLayer->setMasksToBounds(true); 2393 m_clipLayer->setMasksToBounds(true);
2389 2394
2390 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); 2395 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
2391 #ifndef NDEBUG 2396 #ifndef NDEBUG
2392 m_scrollLayer->setName("frame scrolling"); 2397 m_scrollLayer->setName("frame scrolling");
2393 #endif 2398 #endif
2394 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 2399 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
2395 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc rollLayer.get(), true); 2400 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc rollLayer.get(), true);
2396
2397 // Hook them up 2401 // Hook them up
2398 m_overflowControlsHostLayer->addChild(m_clipLayer.get()); 2402 m_overflowControlsHostLayer->addChild(m_clipLayer.get());
2399 m_clipLayer->addChild(m_scrollLayer.get()); 2403 m_clipLayer->addChild(m_scrollLayer.get());
2400 m_scrollLayer->addChild(m_rootContentLayer.get()); 2404 if (isMainFrame() && m_renderView->document()->settings()->pinchVirtualV iewportEnabled()) {
enne (OOO) 2013/05/29 19:57:10 Can you add a outline diagram in a comment here of
wjmaclean 2013/05/29 21:00:30 Will do.
2405 m_pinchVirtualViewportClipLayer = GraphicsLayer::create(graphicsLaye rFactory(), this);
2406 #ifndef NDEBUG
2407 m_pinchVirtualViewportClipLayer->setName("pinch virtual viewport cli p");
2408 #endif
2409 m_pinchVirtualViewportClipLayer->setMasksToBounds(true);
2410
2411 m_pinchVirtualViewportScrollLayer = GraphicsLayer::create(graphicsLa yerFactory(), this);
2412 #ifndef NDEBUG
2413 m_pinchVirtualViewportScrollLayer->setName("pinch virtual viewport s croll");
2414 #endif
2415
2416 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor dinator())
2417 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers( m_pinchVirtualViewportScrollLayer.get(), true);
2418
2419 m_scrollLayer->addChild(m_pinchVirtualViewportClipLayer.get());
2420 m_pinchVirtualViewportClipLayer->addChild(m_pinchVirtualViewportScro llLayer.get());
2421 m_pinchVirtualViewportScrollLayer->addChild(m_rootContentLayer.get() );
trchen 2013/05/29 21:32:56 This doesn't look right. According to enne's desig
wjmaclean 2013/05/30 14:19:09 The layer named m_pinchVirtualViewportScrollLayer
2422 } else
enne (OOO) 2013/05/29 19:57:10 Can you add braces for this else to be in line wit
wjmaclean 2013/05/29 21:00:30 Will do.
2423 m_scrollLayer->addChild(m_rootContentLayer.get());
2401 2424
2402 frameViewDidChangeSize(); 2425 frameViewDidChangeSize();
2403 frameViewDidScroll(); 2426 frameViewDidScroll();
2404 } 2427 }
2405 2428
2406 // Check to see if we have to change the attachment 2429 // Check to see if we have to change the attachment
2407 if (m_rootLayerAttachment != RootLayerUnattached) 2430 if (m_rootLayerAttachment != RootLayerUnattached)
2408 detachRootLayer(); 2431 detachRootLayer();
2409 2432
2410 attachRootLayer(expectedAttachment); 2433 attachRootLayer(expectedAttachment);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 2467
2445 if (m_layerForScrollCorner) { 2468 if (m_layerForScrollCorner) {
2446 m_layerForScrollCorner = nullptr; 2469 m_layerForScrollCorner = nullptr;
2447 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie w()->scrollCornerRect()); 2470 m_renderView->frameView()->invalidateScrollCorner(m_renderView->frameVie w()->scrollCornerRect());
2448 } 2471 }
2449 2472
2450 if (m_overflowControlsHostLayer) { 2473 if (m_overflowControlsHostLayer) {
2451 m_overflowControlsHostLayer = nullptr; 2474 m_overflowControlsHostLayer = nullptr;
2452 m_clipLayer = nullptr; 2475 m_clipLayer = nullptr;
2453 m_scrollLayer = nullptr; 2476 m_scrollLayer = nullptr;
2477 m_pinchVirtualViewportClipLayer = nullptr;
2478 m_pinchVirtualViewportScrollLayer = nullptr;
2454 } 2479 }
2455 ASSERT(!m_scrollLayer); 2480 ASSERT(!m_scrollLayer);
2456 m_rootContentLayer = nullptr; 2481 m_rootContentLayer = nullptr;
2457 } 2482 }
2458 2483
2459 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) 2484 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment)
2460 { 2485 {
2461 if (!m_rootContentLayer) 2486 if (!m_rootContentLayer)
2462 return; 2487 return;
2463 2488
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 return 0; 2752 return 0;
2728 } 2753 }
2729 2754
2730 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo ) const 2755 void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo ) const
2731 { 2756 {
2732 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ; 2757 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering) ;
2733 info.addWeakPointer(m_renderView); 2758 info.addWeakPointer(m_renderView);
2734 info.addMember(m_rootContentLayer, "rootContentLayer"); 2759 info.addMember(m_rootContentLayer, "rootContentLayer");
2735 info.addMember(m_clipLayer, "clipLayer"); 2760 info.addMember(m_clipLayer, "clipLayer");
2736 info.addMember(m_scrollLayer, "scrollLayer"); 2761 info.addMember(m_scrollLayer, "scrollLayer");
2762 info.addMember(m_pinchVirtualViewportClipLayer, "pinch virtual viewport clip layer");
enne (OOO) 2013/05/29 19:57:10 For consistency, maybe this should be pinchVirtual
wjmaclean 2013/05/29 21:00:30 I'll rename everything to be inner/out as in the d
2763 info.addMember(m_pinchVirtualViewportScrollLayer, "pinch virtual viewport sc roll layer");
2737 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers"); 2764 info.addMember(m_viewportConstrainedLayers, "viewportConstrainedLayers");
2738 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer"); 2765 info.addMember(m_overflowControlsHostLayer, "overflowControlsHostLayer");
2739 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; 2766 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ;
2740 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); 2767 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar");
2741 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 2768 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
2742 #if ENABLE(RUBBER_BANDING) 2769 #if ENABLE(RUBBER_BANDING)
2743 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas"); 2770 info.addMember(m_layerForOverhangAreas, "layerForOverhangAreas");
2744 info.addMember(m_contentShadowLayer, "contentShadowLayer"); 2771 info.addMember(m_contentShadowLayer, "contentShadowLayer");
2745 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea"); 2772 info.addMember(m_layerForTopOverhangArea, "layerForTopOverhangArea");
2746 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea"); 2773 info.addMember(m_layerForBottomOverhangArea, "layerForBottomOverhangArea");
2747 #endif 2774 #endif
2748 } 2775 }
2749 2776
2750 } // namespace WebCore 2777 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerCompositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698