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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.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 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Widget::setFrameRect(frameRect); 107 Widget::setFrameRect(frameRect);
108 reportGeometry(); 108 reportGeometry();
109 } 109 }
110 110
111 void WebPluginContainerImpl::layoutIfNeeded() 111 void WebPluginContainerImpl::layoutIfNeeded()
112 { 112 {
113 RELEASE_ASSERT(m_webPlugin); 113 RELEASE_ASSERT(m_webPlugin);
114 m_webPlugin->layoutIfNeeded(); 114 m_webPlugin->layoutIfNeeded();
115 } 115 }
116 116
117 void WebPluginContainerImpl::paint(GraphicsContext* context, const CullRect& cul lRect) const 117 void WebPluginContainerImpl::paint(GraphicsContext& context, const CullRect& cul lRect) const
118 { 118 {
119 if (!parent()) 119 if (!parent())
120 return; 120 return;
121 121
122 // Don't paint anything if the plugin doesn't intersect. 122 // Don't paint anything if the plugin doesn't intersect.
123 if (!cullRect.intersectsCullRect(frameRect())) 123 if (!cullRect.intersectsCullRect(frameRect()))
124 return; 124 return;
125 125
126 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele ment->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint())) 126 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, *m_elem ent->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint()))
127 return; 127 return;
128 128
129 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje ct(), DisplayItem::Type::WebPlugin, cullRect.m_rect, LayoutPoint()); 129 LayoutObjectDrawingRecorder drawingRecorder(context, *m_element->layoutObjec t(), DisplayItem::Type::WebPlugin, cullRect.m_rect, LayoutPoint());
130 context->save(); 130 context.save();
131 131
132 ASSERT(parent()->isFrameView()); 132 ASSERT(parent()->isFrameView());
133 FrameView* view = toFrameView(parent()); 133 FrameView* view = toFrameView(parent());
134 134
135 // The plugin is positioned in the root frame's coordinates, so it needs to 135 // The plugin is positioned in the root frame's coordinates, so it needs to
136 // be painted in them too. 136 // be painted in them too.
137 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); 137 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0));
138 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig in.y())); 138 context.translate(static_cast<float>(-origin.x()), static_cast<float>(-origi n.y()));
139 139
140 WebCanvas* canvas = context->canvas(); 140 WebCanvas* canvas = context.canvas();
141 141
142 IntRect windowRect = view->contentsToRootFrame(cullRect.m_rect); 142 IntRect windowRect = view->contentsToRootFrame(cullRect.m_rect);
143 m_webPlugin->paint(canvas, windowRect); 143 m_webPlugin->paint(canvas, windowRect);
144 144
145 context->restore(); 145 context.restore();
146 } 146 }
147 147
148 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) 148 void WebPluginContainerImpl::invalidateRect(const IntRect& rect)
149 { 149 {
150 if (!parent()) 150 if (!parent())
151 return; 151 return;
152 152
153 LayoutBox* layoutObject = toLayoutBox(m_element->layoutObject()); 153 LayoutBox* layoutObject = toLayoutBox(m_element->layoutObject());
154 if (!layoutObject) 154 if (!layoutObject)
155 return; 155 return;
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 // frame view. 974 // frame view.
975 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); 975 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t);
976 } 976 }
977 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 977 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
978 // Convert to the plugin position. 978 // Convert to the plugin position.
979 for (size_t i = 0; i < cutOutRects.size(); i++) 979 for (size_t i = 0; i < cutOutRects.size(); i++)
980 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 980 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
981 } 981 }
982 982
983 } // namespace blinkf 983 } // namespace blinkf
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | third_party/WebKit/Source/web/mac/WebScrollbarTheme.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698