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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return true; 204 return true;
205 } 205 }
206 206
207 void GraphicsLayer::addChildInternal(GraphicsLayer* childLayer) { 207 void GraphicsLayer::addChildInternal(GraphicsLayer* childLayer) {
208 DCHECK_NE(childLayer, this); 208 DCHECK_NE(childLayer, this);
209 209
210 if (childLayer->parent()) 210 if (childLayer->parent())
211 childLayer->removeFromParent(); 211 childLayer->removeFromParent();
212 212
213 childLayer->setParent(this); 213 childLayer->setParent(this);
214 m_children.append(childLayer); 214 m_children.push_back(childLayer);
215 215
216 // Don't call updateChildList here, this function is used in cases where it 216 // Don't call updateChildList here, this function is used in cases where it
217 // should not be called until all children are processed. 217 // should not be called until all children are processed.
218 } 218 }
219 219
220 void GraphicsLayer::addChild(GraphicsLayer* childLayer) { 220 void GraphicsLayer::addChild(GraphicsLayer* childLayer) {
221 addChildInternal(childLayer); 221 addChildInternal(childLayer);
222 updateChildList(); 222 updateChildList();
223 } 223 }
224 224
225 void GraphicsLayer::addChildBelow(GraphicsLayer* childLayer, 225 void GraphicsLayer::addChildBelow(GraphicsLayer* childLayer,
226 GraphicsLayer* sibling) { 226 GraphicsLayer* sibling) {
227 DCHECK_NE(childLayer, this); 227 DCHECK_NE(childLayer, this);
228 childLayer->removeFromParent(); 228 childLayer->removeFromParent();
229 229
230 bool found = false; 230 bool found = false;
231 for (unsigned i = 0; i < m_children.size(); i++) { 231 for (unsigned i = 0; i < m_children.size(); i++) {
232 if (sibling == m_children[i]) { 232 if (sibling == m_children[i]) {
233 m_children.insert(i, childLayer); 233 m_children.insert(i, childLayer);
234 found = true; 234 found = true;
235 break; 235 break;
236 } 236 }
237 } 237 }
238 238
239 childLayer->setParent(this); 239 childLayer->setParent(this);
240 240
241 if (!found) 241 if (!found)
242 m_children.append(childLayer); 242 m_children.push_back(childLayer);
243 243
244 updateChildList(); 244 updateChildList();
245 } 245 }
246 246
247 void GraphicsLayer::removeAllChildren() { 247 void GraphicsLayer::removeAllChildren() {
248 while (!m_children.isEmpty()) { 248 while (!m_children.isEmpty()) {
249 GraphicsLayer* curLayer = m_children.back(); 249 GraphicsLayer* curLayer = m_children.back();
250 DCHECK(curLayer->parent()); 250 DCHECK(curLayer->parent());
251 curLayer->removeFromParent(); 251 curLayer->removeFromParent();
252 } 252 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 RasterInvalidationTracking& tracking = 547 RasterInvalidationTracking& tracking =
548 rasterInvalidationTrackingMap().add(this); 548 rasterInvalidationTrackingMap().add(this);
549 549
550 if (m_isTrackingRasterInvalidations) { 550 if (m_isTrackingRasterInvalidations) {
551 RasterInvalidationInfo info; 551 RasterInvalidationInfo info;
552 info.client = &client; 552 info.client = &client;
553 info.clientDebugName = client.debugName(); 553 info.clientDebugName = client.debugName();
554 info.rect = rect; 554 info.rect = rect;
555 info.reason = reason; 555 info.reason = reason;
556 tracking.trackedRasterInvalidations.append(info); 556 tracking.trackedRasterInvalidations.push_back(info);
557 } 557 }
558 558
559 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { 559 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) {
560 // TODO(crbug.com/496260): Some antialiasing effects overflow the paint 560 // TODO(crbug.com/496260): Some antialiasing effects overflow the paint
561 // invalidation rect. 561 // invalidation rect.
562 IntRect r = rect; 562 IntRect r = rect;
563 r.inflate(1); 563 r.inflate(1);
564 tracking.rasterInvalidationRegionSinceLastPaint.unite(r); 564 tracking.rasterInvalidationRegionSinceLastPaint.unite(r);
565 } 565 }
566 } 566 }
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1149
1150 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) { 1150 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) {
1151 if (m_paintingPhase == phase) 1151 if (m_paintingPhase == phase)
1152 return; 1152 return;
1153 m_paintingPhase = phase; 1153 m_paintingPhase = phase;
1154 setNeedsDisplay(); 1154 setNeedsDisplay();
1155 } 1155 }
1156 1156
1157 void GraphicsLayer::addLinkHighlight(LinkHighlight* linkHighlight) { 1157 void GraphicsLayer::addLinkHighlight(LinkHighlight* linkHighlight) {
1158 DCHECK(linkHighlight && !m_linkHighlights.contains(linkHighlight)); 1158 DCHECK(linkHighlight && !m_linkHighlights.contains(linkHighlight));
1159 m_linkHighlights.append(linkHighlight); 1159 m_linkHighlights.push_back(linkHighlight);
1160 linkHighlight->layer()->setLayerClient(this); 1160 linkHighlight->layer()->setLayerClient(this);
1161 updateChildList(); 1161 updateChildList();
1162 } 1162 }
1163 1163
1164 void GraphicsLayer::removeLinkHighlight(LinkHighlight* linkHighlight) { 1164 void GraphicsLayer::removeLinkHighlight(LinkHighlight* linkHighlight) {
1165 m_linkHighlights.remove(m_linkHighlights.find(linkHighlight)); 1165 m_linkHighlights.remove(m_linkHighlights.find(linkHighlight));
1166 updateChildList(); 1166 updateChildList();
1167 } 1167 }
1168 1168
1169 void GraphicsLayer::setScrollableArea(ScrollableArea* scrollableArea, 1169 void GraphicsLayer::setScrollableArea(ScrollableArea* scrollableArea,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 for (int bitmapX = 0; bitmapX < rect.width(); ++bitmapX) { 1312 for (int bitmapX = 0; bitmapX < rect.width(); ++bitmapX) {
1313 int layerX = bitmapX + rect.x(); 1313 int layerX = bitmapX + rect.x();
1314 SkColor oldPixel = oldBitmap.getColor(bitmapX, bitmapY); 1314 SkColor oldPixel = oldBitmap.getColor(bitmapX, bitmapY);
1315 SkColor newPixel = newBitmap.getColor(bitmapX, bitmapY); 1315 SkColor newPixel = newBitmap.getColor(bitmapX, bitmapY);
1316 if (pixelsDiffer(oldPixel, newPixel) && 1316 if (pixelsDiffer(oldPixel, newPixel) &&
1317 !tracking->rasterInvalidationRegionSinceLastPaint.contains( 1317 !tracking->rasterInvalidationRegionSinceLastPaint.contains(
1318 IntPoint(layerX, layerY))) { 1318 IntPoint(layerX, layerY))) {
1319 if (mismatchingPixels < maxMismatchesToReport) { 1319 if (mismatchingPixels < maxMismatchesToReport) {
1320 UnderPaintInvalidation underPaintInvalidation = {layerX, layerY, 1320 UnderPaintInvalidation underPaintInvalidation = {layerX, layerY,
1321 oldPixel, newPixel}; 1321 oldPixel, newPixel};
1322 tracking->underPaintInvalidations.append(underPaintInvalidation); 1322 tracking->underPaintInvalidations.push_back(underPaintInvalidation);
1323 LOG(ERROR) << debugName() 1323 LOG(ERROR) << debugName()
1324 << " Uninvalidated old/new pixels mismatch at " << layerX 1324 << " Uninvalidated old/new pixels mismatch at " << layerX
1325 << "," << layerY << " old:" << std::hex << oldPixel 1325 << "," << layerY << " old:" << std::hex << oldPixel
1326 << " new:" << newPixel; 1326 << " new:" << newPixel;
1327 } else if (mismatchingPixels == maxMismatchesToReport) { 1327 } else if (mismatchingPixels == maxMismatchesToReport) {
1328 LOG(ERROR) << "and more..."; 1328 LOG(ERROR) << "and more...";
1329 } 1329 }
1330 ++mismatchingPixels; 1330 ++mismatchingPixels;
1331 *newBitmap.getAddr32(bitmapX, bitmapY) = 1331 *newBitmap.getAddr32(bitmapX, bitmapY) =
1332 SkColorSetARGB(0xFF, 0xA0, 0, 0); // Dark red. 1332 SkColorSetARGB(0xFF, 0xA0, 0, 0); // Dark red.
(...skipping 22 matching lines...) Expand all
1355 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1355 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1356 if (!layer) { 1356 if (!layer) {
1357 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; 1357 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil).";
1358 return; 1358 return;
1359 } 1359 }
1360 1360
1361 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1361 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1362 LOG(INFO) << output.utf8().data(); 1362 LOG(INFO) << output.utf8().data();
1363 } 1363 }
1364 #endif 1364 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698