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

Side by Side Diff: third_party/WebKit/Source/core/paint/PartPainter.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/PartPainter.h" 6 #include "core/paint/PartPainter.h"
7 7
8 #include "core/layout/LayoutPart.h" 8 #include "core/layout/LayoutPart.h"
9 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Paint a partially transparent wash over selected widgets. 85 // Paint a partially transparent wash over selected widgets.
86 if (isSelected() && !paintInfo.isPrinting() && !LayoutObjectDrawingRecorder: :useCachedDrawingIfPossible(*paintInfo.context, m_layoutPart, paintInfo.phase, a djustedPaintOffset)) { 86 if (isSelected() && !paintInfo.isPrinting() && !LayoutObjectDrawingRecorder: :useCachedDrawingIfPossible(*paintInfo.context, m_layoutPart, paintInfo.phase, a djustedPaintOffset)) {
87 LayoutRect rect = m_layoutPart.localSelectionRect(); 87 LayoutRect rect = m_layoutPart.localSelectionRect();
88 rect.moveBy(adjustedPaintOffset); 88 rect.moveBy(adjustedPaintOffset);
89 IntRect selectionRect = pixelSnappedIntRect(rect); 89 IntRect selectionRect = pixelSnappedIntRect(rect);
90 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Part, paintInfo.phase, selectionRect, adjustedPaintOffset); 90 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Part, paintInfo.phase, selectionRect, adjustedPaintOffset);
91 paintInfo.context->fillRect(selectionRect, m_layoutPart.selectionBackgro undColor()); 91 paintInfo.context->fillRect(selectionRect, m_layoutPart.selectionBackgro undColor());
92 } 92 }
93 93
94 if (m_layoutPart.canResize()) 94 if (m_layoutPart.canResize())
95 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.cullRect( )); 95 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi zer(*paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.cullRect ());
96 } 96 }
97 97
98 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) 98 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset)
99 { 99 {
100 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); 100 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location();
101 101
102 Widget* widget = m_layoutPart.widget(); 102 Widget* widget = m_layoutPart.widget();
103 RELEASE_ASSERT(widget); 103 RELEASE_ASSERT(widget);
104 104
105 // Tell the widget to paint now. This is the only time the widget is allowed 105 // Tell the widget to paint now. This is the only time the widget is allowed
106 // to paint itself. That way it will composite properly with z-indexed layer s. 106 // to paint itself. That way it will composite properly with z-indexed layer s.
107 IntPoint widgetLocation = widget->frameRect().location(); 107 IntPoint widgetLocation = widget->frameRect().location();
108 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + m_layoutPart.bor derLeft() + m_layoutPart.paddingLeft()), 108 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + m_layoutPart.bor derLeft() + m_layoutPart.paddingLeft()),
109 roundToInt(adjustedPaintOffset.y() + m_layoutPart.borderTop() + m_layout Part.paddingTop())); 109 roundToInt(adjustedPaintOffset.y() + m_layoutPart.borderTop() + m_layout Part.paddingTop()));
110 110
111 IntSize widgetPaintOffset = paintLocation - widgetLocation; 111 IntSize widgetPaintOffset = paintLocation - widgetLocation;
112 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, 112 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
113 // not the root. In this case, shift the CTM and adjust the CullRect to be r oot-relative to fix plugin drawing. 113 // not the root. In this case, shift the CTM and adjust the CullRect to be r oot-relative to fix plugin drawing.
114 TransformRecorder transform(*paintInfo.context, m_layoutPart, 114 TransformRecorder transform(*paintInfo.context, m_layoutPart,
115 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse t.height())); 115 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse t.height()));
116 116
117 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); 117 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset);
118 widget->paint(paintInfo.context, adjustedCullRect); 118 widget->paint(*paintInfo.context, adjustedCullRect);
119 } 119 }
120 120
121 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698