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

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

Issue 24130008: Rename ENABLE(RUBBER_BANDING) to USE(RUBBER_BANDING). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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
« 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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 1197
1198 void RenderLayerCompositor::frameViewDidChangeSize() 1198 void RenderLayerCompositor::frameViewDidChangeSize()
1199 { 1199 {
1200 if (m_containerLayer) { 1200 if (m_containerLayer) {
1201 FrameView* frameView = m_renderView->frameView(); 1201 FrameView* frameView = m_renderView->frameView();
1202 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); 1202 m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
1203 1203
1204 frameViewDidScroll(); 1204 frameViewDidScroll();
1205 updateOverflowControlsLayers(); 1205 updateOverflowControlsLayers();
1206 1206
1207 #if ENABLE(RUBBER_BANDING) 1207 #if USE(RUBBER_BANDING)
1208 if (m_layerForOverhangAreas) 1208 if (m_layerForOverhangAreas)
1209 m_layerForOverhangAreas->setSize(frameView->frameRect().size()); 1209 m_layerForOverhangAreas->setSize(frameView->frameRect().size());
1210 #endif 1210 #endif
1211 } 1211 }
1212 } 1212 }
1213 1213
1214 enum AcceleratedFixedRootBackgroundHistogramBuckets { 1214 enum AcceleratedFixedRootBackgroundHistogramBuckets {
1215 ScrolledMainFrameBucket = 0, 1215 ScrolledMainFrameBucket = 0,
1216 ScrolledMainFrameWithAcceleratedFixedRootBackground = 1, 1216 ScrolledMainFrameWithAcceleratedFixedRootBackground = 1,
1217 ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2, 1217 ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 { 1569 {
1570 clearBackingForLayerIncludingDescendants(m_renderView->layer()); 1570 clearBackingForLayerIncludingDescendants(m_renderView->layer());
1571 } 1571 }
1572 1572
1573 void RenderLayerCompositor::updateRootLayerPosition() 1573 void RenderLayerCompositor::updateRootLayerPosition()
1574 { 1574 {
1575 if (m_rootContentLayer) { 1575 if (m_rootContentLayer) {
1576 const IntRect& documentRect = m_renderView->documentRect(); 1576 const IntRect& documentRect = m_renderView->documentRect();
1577 m_rootContentLayer->setSize(documentRect.size()); 1577 m_rootContentLayer->setSize(documentRect.size());
1578 m_rootContentLayer->setPosition(documentRect.location()); 1578 m_rootContentLayer->setPosition(documentRect.location());
1579 #if ENABLE(RUBBER_BANDING) 1579 #if USE(RUBBER_BANDING)
1580 if (m_layerForOverhangShadow) 1580 if (m_layerForOverhangShadow)
1581 ScrollbarTheme::theme()->updateOverhangShadowLayer(m_layerForOverhan gShadow.get(), m_rootContentLayer.get()); 1581 ScrollbarTheme::theme()->updateOverhangShadowLayer(m_layerForOverhan gShadow.get(), m_rootContentLayer.get());
1582 #endif 1582 #endif
1583 } 1583 }
1584 if (m_containerLayer) { 1584 if (m_containerLayer) {
1585 FrameView* frameView = m_renderView->frameView(); 1585 FrameView* frameView = m_renderView->frameView();
1586 m_containerLayer->setSize(frameView->unscaledVisibleContentSize()); 1586 m_containerLayer->setSize(frameView->unscaledVisibleContentSize());
1587 } 1587 }
1588 } 1588 }
1589 1589
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 else if (graphicsLayer == layerForVerticalScrollbar()) 2166 else if (graphicsLayer == layerForVerticalScrollbar())
2167 paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context, clip); 2167 paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context, clip);
2168 else if (graphicsLayer == layerForScrollCorner()) { 2168 else if (graphicsLayer == layerForScrollCorner()) {
2169 const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRec t(); 2169 const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRec t();
2170 context.save(); 2170 context.save();
2171 context.translate(-scrollCorner.x(), -scrollCorner.y()); 2171 context.translate(-scrollCorner.x(), -scrollCorner.y());
2172 IntRect transformedClip = clip; 2172 IntRect transformedClip = clip;
2173 transformedClip.moveBy(scrollCorner.location()); 2173 transformedClip.moveBy(scrollCorner.location());
2174 m_renderView->frameView()->paintScrollCorner(&context, transformedClip); 2174 m_renderView->frameView()->paintScrollCorner(&context, transformedClip);
2175 context.restore(); 2175 context.restore();
2176 #if ENABLE(RUBBER_BANDING) 2176 #if USE(RUBBER_BANDING)
2177 } else if (graphicsLayer == layerForOverhangAreas()) { 2177 } else if (graphicsLayer == layerForOverhangAreas()) {
2178 ScrollView* view = m_renderView->frameView(); 2178 ScrollView* view = m_renderView->frameView();
2179 view->calculateAndPaintOverhangBackground(&context, clip); 2179 view->calculateAndPaintOverhangBackground(&context, clip);
2180 #endif 2180 #endif
2181 } 2181 }
2182 } 2182 }
2183 2183
2184 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const 2184 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
2185 { 2185 {
2186 if (Settings* settings = m_renderView->document().settings()) { 2186 if (Settings* settings = m_renderView->document().settings()) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 FrameView* view = m_renderView->frameView(); 2271 FrameView* view = m_renderView->frameView();
2272 return shouldCompositeOverflowControls(view) && view->verticalScrollbar(); 2272 return shouldCompositeOverflowControls(view) && view->verticalScrollbar();
2273 } 2273 }
2274 2274
2275 bool RenderLayerCompositor::requiresScrollCornerLayer() const 2275 bool RenderLayerCompositor::requiresScrollCornerLayer() const
2276 { 2276 {
2277 FrameView* view = m_renderView->frameView(); 2277 FrameView* view = m_renderView->frameView();
2278 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible( ); 2278 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible( );
2279 } 2279 }
2280 2280
2281 #if ENABLE(RUBBER_BANDING) 2281 #if USE(RUBBER_BANDING)
2282 bool RenderLayerCompositor::requiresOverhangLayers() const 2282 bool RenderLayerCompositor::requiresOverhangLayers() const
2283 { 2283 {
2284 // We don't want a layer if this is a subframe. 2284 // We don't want a layer if this is a subframe.
2285 if (!isMainFrame()) 2285 if (!isMainFrame())
2286 return false; 2286 return false;
2287 2287
2288 // We do want a layer if we have a scrolling coordinator and can scroll. 2288 // We do want a layer if we have a scrolling coordinator and can scroll.
2289 if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground ()) 2289 if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground ())
2290 return true; 2290 return true;
2291 2291
2292 // Chromium always wants a layer. 2292 // Chromium always wants a layer.
2293 return true; 2293 return true;
2294 } 2294 }
2295 #endif 2295 #endif
2296 2296
2297 void RenderLayerCompositor::updateOverflowControlsLayers() 2297 void RenderLayerCompositor::updateOverflowControlsLayers()
2298 { 2298 {
2299 #if ENABLE(RUBBER_BANDING) 2299 #if USE(RUBBER_BANDING)
2300 if (requiresOverhangLayers()) { 2300 if (requiresOverhangLayers()) {
2301 if (!m_layerForOverhangAreas) { 2301 if (!m_layerForOverhangAreas) {
2302 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory (), this); 2302 m_layerForOverhangAreas = GraphicsLayer::create(graphicsLayerFactory (), this);
2303 m_layerForOverhangAreas->setDrawsContent(false); 2303 m_layerForOverhangAreas->setDrawsContent(false);
2304 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec t().size()); 2304 m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRec t().size());
2305 2305
2306 // We want the overhang areas layer to be positioned below the frame contents, 2306 // We want the overhang areas layer to be positioned below the frame contents,
2307 // so insert it below the clip layer. 2307 // so insert it below the clip layer.
2308 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g et(), m_containerLayer.get()); 2308 m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.g et(), m_containerLayer.get());
2309 } 2309 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2418 attachRootLayer(expectedAttachment); 2418 attachRootLayer(expectedAttachment);
2419 } 2419 }
2420 2420
2421 void RenderLayerCompositor::destroyRootLayer() 2421 void RenderLayerCompositor::destroyRootLayer()
2422 { 2422 {
2423 if (!m_rootContentLayer) 2423 if (!m_rootContentLayer)
2424 return; 2424 return;
2425 2425
2426 detachRootLayer(); 2426 detachRootLayer();
2427 2427
2428 #if ENABLE(RUBBER_BANDING) 2428 #if USE(RUBBER_BANDING)
2429 if (m_layerForOverhangAreas) { 2429 if (m_layerForOverhangAreas) {
2430 m_layerForOverhangAreas->removeFromParent(); 2430 m_layerForOverhangAreas->removeFromParent();
2431 m_layerForOverhangAreas = nullptr; 2431 m_layerForOverhangAreas = nullptr;
2432 } 2432 }
2433 if (m_layerForOverhangShadow) { 2433 if (m_layerForOverhangShadow) {
2434 m_layerForOverhangShadow->removeFromParent(); 2434 m_layerForOverhangShadow->removeFromParent();
2435 m_layerForOverhangShadow = nullptr; 2435 m_layerForOverhangShadow = nullptr;
2436 } 2436 }
2437 #endif 2437 #endif
2438 2438
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 Page* RenderLayerCompositor::page() const 2720 Page* RenderLayerCompositor::page() const
2721 { 2721 {
2722 return m_renderView->frameView()->frame().page(); 2722 return m_renderView->frameView()->frame().page();
2723 } 2723 }
2724 2724
2725 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) 2725 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer)
2726 { 2726 {
2727 String name; 2727 String name;
2728 if (graphicsLayer == m_rootContentLayer.get()) { 2728 if (graphicsLayer == m_rootContentLayer.get()) {
2729 name = "Content Root Layer"; 2729 name = "Content Root Layer";
2730 #if ENABLE(RUBBER_BANDING) 2730 #if USE(RUBBER_BANDING)
2731 } else if (graphicsLayer == m_layerForOverhangAreas.get()) { 2731 } else if (graphicsLayer == m_layerForOverhangAreas.get()) {
2732 name = "Overhang Areas Layer"; 2732 name = "Overhang Areas Layer";
2733 } else if (graphicsLayer == m_layerForOverhangAreas.get()) { 2733 } else if (graphicsLayer == m_layerForOverhangAreas.get()) {
2734 name = "Overhang Areas Shadow"; 2734 name = "Overhang Areas Shadow";
2735 #endif 2735 #endif
2736 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) { 2736 } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
2737 name = "Overflow Controls Host Layer"; 2737 name = "Overflow Controls Host Layer";
2738 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) { 2738 } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
2739 name = "Horizontal Scrollbar Layer"; 2739 name = "Horizontal Scrollbar Layer";
2740 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) { 2740 } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
2741 name = "Vertical Scrollbar Layer"; 2741 name = "Vertical Scrollbar Layer";
2742 } else if (graphicsLayer == m_layerForScrollCorner.get()) { 2742 } else if (graphicsLayer == m_layerForScrollCorner.get()) {
2743 name = "Scroll Corner Layer"; 2743 name = "Scroll Corner Layer";
2744 } else if (graphicsLayer == m_containerLayer.get()) { 2744 } else if (graphicsLayer == m_containerLayer.get()) {
2745 name = "Frame Clipping Layer"; 2745 name = "Frame Clipping Layer";
2746 } else if (graphicsLayer == m_scrollLayer.get()) { 2746 } else if (graphicsLayer == m_scrollLayer.get()) {
2747 name = "Frame Scrolling Layer"; 2747 name = "Frame Scrolling Layer";
2748 } else { 2748 } else {
2749 ASSERT_NOT_REACHED(); 2749 ASSERT_NOT_REACHED();
2750 } 2750 }
2751 2751
2752 return name; 2752 return name;
2753 } 2753 }
2754 2754
2755 } // namespace WebCore 2755 } // 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