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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1511003003: Use refs for non-null GraphicsContext, Scrollbar, etc. in scrollbar related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarRemove
Patch Set: Created 5 years 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, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 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 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 2241
2242 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) 2242 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
2243 { 2243 {
2244 if (!scrollbar) 2244 if (!scrollbar)
2245 return; 2245 return;
2246 2246
2247 const IntRect& scrollbarRect = scrollbar->frameRect(); 2247 const IntRect& scrollbarRect = scrollbar->frameRect();
2248 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr anslation(-scrollbarRect.x(), -scrollbarRect.y())); 2248 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr anslation(-scrollbarRect.x(), -scrollbarRect.y()));
2249 IntRect transformedClip = clip; 2249 IntRect transformedClip = clip;
2250 transformedClip.moveBy(scrollbarRect.location()); 2250 transformedClip.moveBy(scrollbarRect.location());
2251 scrollbar->paint(&context, CullRect(transformedClip)); 2251 scrollbar->paint(context, CullRect(transformedClip));
2252 } 2252 }
2253 2253
2254 // The following should be kept in sync with the code computing potential_new_re corded_viewport in 2254 // The following should be kept in sync with the code computing potential_new_re corded_viewport in
2255 // cc::DisplayListRecordingSource::UpdateAndExpandInvalidation() before we keep only one copy of the algorithm. 2255 // cc::DisplayListRecordingSource::UpdateAndExpandInvalidation() before we keep only one copy of the algorithm.
2256 static const int kPixelDistanceToRecord = 4000; 2256 static const int kPixelDistanceToRecord = 4000;
2257 2257
2258 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph icsLayer) const 2258 IntRect CompositedLayerMapping::recomputeInterestRect(const GraphicsLayer* graph icsLayer) const
2259 { 2259 {
2260 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size()); 2260 FloatRect graphicsLayerBounds(FloatPoint(), graphicsLayer->size());
2261 2261
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 } else if (graphicsLayer == m_squashingLayer.get()) { 2406 } else if (graphicsLayer == m_squashingLayer.get()) {
2407 for (size_t i = 0; i < m_squashedLayers.size(); ++i) 2407 for (size_t i = 0; i < m_squashedLayers.size(); ++i)
2408 doPaintTask(m_squashedLayers[i], *graphicsLayer, paintLayerFlags, &c ontext, interestRect); 2408 doPaintTask(m_squashedLayers[i], *graphicsLayer, paintLayerFlags, &c ontext, interestRect);
2409 } else if (graphicsLayer == layerForHorizontalScrollbar()) { 2409 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
2410 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co ntext, interestRect); 2410 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co ntext, interestRect);
2411 } else if (graphicsLayer == layerForVerticalScrollbar()) { 2411 } else if (graphicsLayer == layerForVerticalScrollbar()) {
2412 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont ext, interestRect); 2412 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont ext, interestRect);
2413 } else if (graphicsLayer == layerForScrollCorner()) { 2413 } else if (graphicsLayer == layerForScrollCorner()) {
2414 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea() ->scrollCornerAndResizerRect().location(); 2414 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea() ->scrollCornerAndResizerRect().location();
2415 CullRect cullRect(enclosingIntRect(interestRect)); 2415 CullRect cullRect(enclosingIntRect(interestRect));
2416 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner (&context, -scrollCornerAndResizerLocation, cullRect); 2416 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner (context, -scrollCornerAndResizerLocation, cullRect);
2417 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con text, -scrollCornerAndResizerLocation, cullRect); 2417 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(cont ext, -scrollCornerAndResizerLocation, cullRect);
2418 } 2418 }
2419 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay er, &context, LayoutRect(interestRect)); 2419 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay er, &context, LayoutRect(interestRect));
2420 #if ENABLE(ASSERT) 2420 #if ENABLE(ASSERT)
2421 if (Page* page = layoutObject()->frame()->page()) 2421 if (Page* page = layoutObject()->frame()->page())
2422 page->setIsPainting(false); 2422 page->setIsPainting(false);
2423 #endif 2423 #endif
2424 } 2424 }
2425 2425
2426 bool CompositedLayerMapping::isTrackingPaintInvalidations() const 2426 bool CompositedLayerMapping::isTrackingPaintInvalidations() const
2427 { 2427 {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2601 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2602 name = "Scrolling Block Selection Layer"; 2602 name = "Scrolling Block Selection Layer";
2603 } else { 2603 } else {
2604 ASSERT_NOT_REACHED(); 2604 ASSERT_NOT_REACHED();
2605 } 2605 }
2606 2606
2607 return name; 2607 return name;
2608 } 2608 }
2609 2609
2610 } // namespace blink 2610 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698