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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.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: yet another mac fix 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 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 797
798 // Frame scrollbars are painted in the space of the containing frame, not th e local space of the scrollbar. 798 // Frame scrollbars are painted in the space of the containing frame, not th e local space of the scrollbar.
799 const IntPoint& paintOffset = scrollbar->frameRect().location(); 799 const IntPoint& paintOffset = scrollbar->frameRect().location();
800 IntRect transformedClip = clip; 800 IntRect transformedClip = clip;
801 transformedClip.moveBy(paintOffset); 801 transformedClip.moveBy(paintOffset);
802 802
803 AffineTransform translation; 803 AffineTransform translation;
804 translation.translate(-paintOffset.x(), -paintOffset.y()); 804 translation.translate(-paintOffset.x(), -paintOffset.y());
805 TransformRecorder transformRecorder(context, *scrollbar, translation); 805 TransformRecorder transformRecorder(context, *scrollbar, translation);
806 806
807 scrollbar->paint(&context, CullRect(transformedClip)); 807 scrollbar->paint(context, CullRect(transformedClip));
808 } 808 }
809 809
810 IntRect PaintLayerCompositor::computeInterestRect(const GraphicsLayer* graphicsL ayer, const IntRect&) const 810 IntRect PaintLayerCompositor::computeInterestRect(const GraphicsLayer* graphicsL ayer, const IntRect&) const
811 { 811 {
812 return enclosingIntRect(FloatRect(FloatPoint(), graphicsLayer->size())); 812 return enclosingIntRect(FloatRect(FloatPoint(), graphicsLayer->size()));
813 } 813 }
814 814
815 void PaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gra phicsContext& context, GraphicsLayerPaintingPhase, const IntRect& interestRect) const 815 void PaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gra phicsContext& context, GraphicsLayerPaintingPhase, const IntRect& interestRect) const
816 { 816 {
817 if (graphicsLayer == layerForHorizontalScrollbar()) 817 if (graphicsLayer == layerForHorizontalScrollbar())
818 paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, interestRect); 818 paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, interestRect);
819 else if (graphicsLayer == layerForVerticalScrollbar()) 819 else if (graphicsLayer == layerForVerticalScrollbar())
820 paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, i nterestRect); 820 paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, i nterestRect);
821 else if (graphicsLayer == layerForScrollCorner()) 821 else if (graphicsLayer == layerForScrollCorner())
822 FramePainter(*m_layoutView.frameView()).paintScrollCorner(&context, inte restRect); 822 FramePainter(*m_layoutView.frameView()).paintScrollCorner(context, inter estRect);
823 } 823 }
824 824
825 bool PaintLayerCompositor::supportsFixedRootBackgroundCompositing() const 825 bool PaintLayerCompositor::supportsFixedRootBackgroundCompositing() const
826 { 826 {
827 if (Settings* settings = m_layoutView.document().settings()) 827 if (Settings* settings = m_layoutView.document().settings())
828 return settings->preferCompositingToLCDTextEnabled(); 828 return settings->preferCompositingToLCDTextEnabled();
829 return false; 829 return false;
830 } 830 }
831 831
832 bool PaintLayerCompositor::needsFixedRootBackgroundLayer(const PaintLayer* layer ) const 832 bool PaintLayerCompositor::needsFixedRootBackgroundLayer(const PaintLayer* layer ) const
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 if (!m_rootContentLayer) 1037 if (!m_rootContentLayer)
1038 return; 1038 return;
1039 1039
1040 detachRootLayer(); 1040 detachRootLayer();
1041 1041
1042 if (m_layerForHorizontalScrollbar) { 1042 if (m_layerForHorizontalScrollbar) {
1043 m_layerForHorizontalScrollbar->removeFromParent(); 1043 m_layerForHorizontalScrollbar->removeFromParent();
1044 m_layerForHorizontalScrollbar = nullptr; 1044 m_layerForHorizontalScrollbar = nullptr;
1045 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 1045 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1046 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layout View.frameView(), HorizontalScrollbar); 1046 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layout View.frameView(), HorizontalScrollbar);
1047 if (Scrollbar* horizontalScrollbar = m_layoutView.frameView()->horizonta lScrollbar()) 1047 m_layoutView.frameView()->setScrollbarNeedsPaintInvalidation(HorizontalS crollbar);
1048 m_layoutView.frameView()->setScrollbarNeedsPaintInvalidation(horizon talScrollbar);
1049 } 1048 }
1050 1049
1051 if (m_layerForVerticalScrollbar) { 1050 if (m_layerForVerticalScrollbar) {
1052 m_layerForVerticalScrollbar->removeFromParent(); 1051 m_layerForVerticalScrollbar->removeFromParent();
1053 m_layerForVerticalScrollbar = nullptr; 1052 m_layerForVerticalScrollbar = nullptr;
1054 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor()) 1053 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina tor())
1055 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layout View.frameView(), VerticalScrollbar); 1054 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layout View.frameView(), VerticalScrollbar);
1056 if (Scrollbar* verticalScrollbar = m_layoutView.frameView()->verticalScr ollbar()) 1055 m_layoutView.frameView()->setScrollbarNeedsPaintInvalidation(VerticalScr ollbar);
1057 m_layoutView.frameView()->setScrollbarNeedsPaintInvalidation(vertica lScrollbar);
1058 } 1056 }
1059 1057
1060 if (m_layerForScrollCorner) { 1058 if (m_layerForScrollCorner) {
1061 m_layerForScrollCorner = nullptr; 1059 m_layerForScrollCorner = nullptr;
1062 m_layoutView.frameView()->setScrollCornerNeedsPaintInvalidation(); 1060 m_layoutView.frameView()->setScrollCornerNeedsPaintInvalidation();
1063 } 1061 }
1064 1062
1065 if (m_overflowControlsHostLayer) { 1063 if (m_overflowControlsHostLayer) {
1066 m_overflowControlsHostLayer = nullptr; 1064 m_overflowControlsHostLayer = nullptr;
1067 m_containerLayer = nullptr; 1065 m_containerLayer = nullptr;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } else if (graphicsLayer == m_scrollLayer.get()) { 1204 } else if (graphicsLayer == m_scrollLayer.get()) {
1207 name = "Frame Scrolling Layer"; 1205 name = "Frame Scrolling Layer";
1208 } else { 1206 } else {
1209 ASSERT_NOT_REACHED(); 1207 ASSERT_NOT_REACHED();
1210 } 1208 }
1211 1209
1212 return name; 1210 return name;
1213 } 1211 }
1214 1212
1215 } // namespace blink 1213 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698