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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1422493003: Change Widget subclasses to use a CullRect instead of an IntRect for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « third_party/WebKit/Source/web/WebPluginContainerImpl.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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "core/paint/LayoutObjectDrawingRecorder.h" 62 #include "core/paint/LayoutObjectDrawingRecorder.h"
63 #include "core/paint/PaintLayer.h" 63 #include "core/paint/PaintLayer.h"
64 #include "modules/plugins/PluginOcclusionSupport.h" 64 #include "modules/plugins/PluginOcclusionSupport.h"
65 #include "platform/HostWindow.h" 65 #include "platform/HostWindow.h"
66 #include "platform/KeyboardCodes.h" 66 #include "platform/KeyboardCodes.h"
67 #include "platform/PlatformGestureEvent.h" 67 #include "platform/PlatformGestureEvent.h"
68 #include "platform/UserGestureIndicator.h" 68 #include "platform/UserGestureIndicator.h"
69 #include "platform/exported/WrappedResourceResponse.h" 69 #include "platform/exported/WrappedResourceResponse.h"
70 #include "platform/graphics/GraphicsContext.h" 70 #include "platform/graphics/GraphicsContext.h"
71 #include "platform/graphics/GraphicsLayer.h" 71 #include "platform/graphics/GraphicsLayer.h"
72 #include "platform/graphics/paint/CullRect.h"
72 #include "platform/scroll/ScrollAnimator.h" 73 #include "platform/scroll/ScrollAnimator.h"
73 #include "platform/scroll/ScrollbarTheme.h" 74 #include "platform/scroll/ScrollbarTheme.h"
74 #include "public/platform/Platform.h" 75 #include "public/platform/Platform.h"
75 #include "public/platform/WebClipboard.h" 76 #include "public/platform/WebClipboard.h"
76 #include "public/platform/WebCompositorSupport.h" 77 #include "public/platform/WebCompositorSupport.h"
77 #include "public/platform/WebCursorInfo.h" 78 #include "public/platform/WebCursorInfo.h"
78 #include "public/platform/WebDragData.h" 79 #include "public/platform/WebDragData.h"
79 #include "public/platform/WebExternalTextureLayer.h" 80 #include "public/platform/WebExternalTextureLayer.h"
80 #include "public/platform/WebRect.h" 81 #include "public/platform/WebRect.h"
81 #include "public/platform/WebString.h" 82 #include "public/platform/WebString.h"
(...skipping 21 matching lines...) Expand all
103 Widget::setFrameRect(frameRect); 104 Widget::setFrameRect(frameRect);
104 reportGeometry(); 105 reportGeometry();
105 } 106 }
106 107
107 void WebPluginContainerImpl::layoutIfNeeded() 108 void WebPluginContainerImpl::layoutIfNeeded()
108 { 109 {
109 RELEASE_ASSERT(m_webPlugin); 110 RELEASE_ASSERT(m_webPlugin);
110 m_webPlugin->layoutIfNeeded(); 111 m_webPlugin->layoutIfNeeded();
111 } 112 }
112 113
113 void WebPluginContainerImpl::paint(GraphicsContext* context, const IntRect& rect ) const 114 void WebPluginContainerImpl::paint(GraphicsContext* context, const CullRect& cul lRect) const
114 { 115 {
115 if (!parent()) 116 if (!parent())
116 return; 117 return;
117 118
118 // Don't paint anything if the plugin doesn't intersect. 119 // Don't paint anything if the plugin doesn't intersect.
119 if (!frameRect().intersects(rect)) 120 if (!cullRect.intersectsCullRect(frameRect()))
120 return; 121 return;
121 122
122 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele ment->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint())) 123 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele ment->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint()))
123 return; 124 return;
124 125
125 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje ct(), DisplayItem::Type::WebPlugin, rect, LayoutPoint()); 126 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje ct(), DisplayItem::Type::WebPlugin, cullRect.m_rect, LayoutPoint());
126 context->save(); 127 context->save();
127 128
128 ASSERT(parent()->isFrameView()); 129 ASSERT(parent()->isFrameView());
129 FrameView* view = toFrameView(parent()); 130 FrameView* view = toFrameView(parent());
130 131
131 // The plugin is positioned in the root frame's coordinates, so it needs to 132 // The plugin is positioned in the root frame's coordinates, so it needs to
132 // be painted in them too. 133 // be painted in them too.
133 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); 134 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0));
134 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig in.y())); 135 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig in.y()));
135 136
136 WebCanvas* canvas = context->canvas(); 137 WebCanvas* canvas = context->canvas();
137 138
138 IntRect windowRect = view->contentsToRootFrame(rect); 139 IntRect windowRect = view->contentsToRootFrame(cullRect.m_rect);
139 m_webPlugin->paint(canvas, windowRect); 140 m_webPlugin->paint(canvas, windowRect);
140 141
141 context->restore(); 142 context->restore();
142 } 143 }
143 144
144 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) 145 void WebPluginContainerImpl::invalidateRect(const IntRect& rect)
145 { 146 {
146 if (!parent()) 147 if (!parent())
147 return; 148 return;
148 149
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 clipRect.move(-windowRect.x(), -windowRect.y()); 967 clipRect.move(-windowRect.x(), -windowRect.y());
967 unobscuredRect.move(-windowRect.x(), -windowRect.y()); 968 unobscuredRect.move(-windowRect.x(), -windowRect.y());
968 969
969 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 970 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
970 // Convert to the plugin position. 971 // Convert to the plugin position.
971 for (size_t i = 0; i < cutOutRects.size(); i++) 972 for (size_t i = 0; i < cutOutRects.size(); i++)
972 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 973 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
973 } 974 }
974 975
975 } // namespace blink 976 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698