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

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

Issue 1749383002: Eliminate uncalled will___LiveResize and inLiveResize from RenderViewImpl through WebWidget down to… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 { 124 {
125 m_objectLayerSizeMap.remove(&object); 125 m_objectLayerSizeMap.remove(&object);
126 if (m_objectLayerSizeMap.isEmpty()) { 126 if (m_objectLayerSizeMap.isEmpty()) {
127 m_timer->stop(); 127 m_timer->stop();
128 } 128 }
129 } 129 }
130 130
131 void ImageQualityController::highQualityRepaintTimerFired(Timer<ImageQualityCont roller>*) 131 void ImageQualityController::highQualityRepaintTimerFired(Timer<ImageQualityCont roller>*)
132 { 132 {
133 for (auto* layoutObject : m_objectLayerSizeMap.keys()) { 133 for (auto* layoutObject : m_objectLayerSizeMap.keys()) {
134 if (LocalFrame* frame = layoutObject->document().frame()) {
135 // If this layoutObject's containing FrameView is in live resize, pu nt the timer and hold back for now.
136 if (frame->view() && frame->view()->inLiveResize()) {
137 restartTimer();
138 return;
139 }
140 }
141 ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(layoutObject) ; 134 ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(layoutObject) ;
142 if (i != m_objectLayerSizeMap.end()) { 135 if (i != m_objectLayerSizeMap.end()) {
143 // Only invalidate the object if it is animating. 136 // Only invalidate the object if it is animating.
144 if (i->value.isResizing) { 137 if (i->value.isResizing) {
145 // TODO(wangxianzhu): Use LayoutObject::getMutableForPainting(). 138 // TODO(wangxianzhu): Use LayoutObject::getMutableForPainting().
146 const_cast<LayoutObject*>(layoutObject)->setShouldDoFullPaintInv alidation(); 139 const_cast<LayoutObject*>(layoutObject)->setShouldDoFullPaintInv alidation();
147 } 140 }
148 i->value.isResizing = false; 141 i->value.isResizing = false;
149 } 142 }
150 } 143 }
(...skipping 30 matching lines...) Expand all
181 LayoutSize oldSize; 174 LayoutSize oldSize;
182 bool isFirstResize = true; 175 bool isFirstResize = true;
183 if (innerMap) { 176 if (innerMap) {
184 LayerSizeMap::iterator j = innerMap->find(layer); 177 LayerSizeMap::iterator j = innerMap->find(layer);
185 if (j != innerMap->end()) { 178 if (j != innerMap->end()) {
186 isFirstResize = false; 179 isFirstResize = false;
187 oldSize = j->value; 180 oldSize = j->value;
188 } 181 }
189 } 182 }
190 183
191 // If the containing FrameView is being resized, paint at low quality until resizing is finished.
192 if (LocalFrame* frame = object.document().frame()) {
193 bool frameViewIsCurrentlyInLiveResize = frame->view() && frame->view()-> inLiveResize();
194 if (frameViewIsCurrentlyInLiveResize) {
195 set(object, innerMap, layer, layoutSize, true);
196 restartTimer();
Fady Samuel 2016/03/02 00:47:18 What's this timer? Can we get rid of it?
Mark Dittmer 2016/03/02 12:54:55 The timer is used to toggle between lo-fi and hi-f
197 m_liveResizeOptimizationIsActive = true;
Fady Samuel 2016/03/02 00:47:18 You can probably remove this.
Mark Dittmer 2016/03/02 12:54:55 Done.
198 return true;
199 }
200 if (m_liveResizeOptimizationIsActive) {
201 // Live resize has ended, paint in HQ and remove this object from th e list.
202 removeLayer(object, innerMap, layer);
203 return false;
204 }
205 }
206
207 if (layoutSize == image->size()) { 184 if (layoutSize == image->size()) {
208 // There is no scale in effect. If we had a scale in effect before, we c an just remove this object from the list. 185 // There is no scale in effect. If we had a scale in effect before, we c an just remove this object from the list.
209 removeLayer(object, innerMap, layer); 186 removeLayer(object, innerMap, layer);
210 return false; 187 return false;
211 } 188 }
212 189
213 // If an animated resize is active for this object, paint in low quality and kick the timer ahead. 190 // If an animated resize is active for this object, paint in low quality and kick the timer ahead.
214 if (objectIsResizing) { 191 if (objectIsResizing) {
215 bool sizesChanged = oldSize != layoutSize; 192 bool sizesChanged = oldSize != layoutSize;
216 set(object, innerMap, layer, layoutSize, sizesChanged); 193 set(object, innerMap, layer, layoutSize, sizesChanged);
(...skipping 17 matching lines...) Expand all
234 } 211 }
235 // This object has been resized to two different sizes while the timer 212 // This object has been resized to two different sizes while the timer
236 // is active, so draw at low quality, set the flag for animated resizes and 213 // is active, so draw at low quality, set the flag for animated resizes and
237 // the object to the list for high quality redraw. 214 // the object to the list for high quality redraw.
238 set(object, innerMap, layer, layoutSize, true); 215 set(object, innerMap, layer, layoutSize, true);
239 restartTimer(); 216 restartTimer();
240 return true; 217 return true;
241 } 218 }
242 219
243 } // namespace blink 220 } // namespace blink
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698