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

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

Issue 2163113002: Remove DebugRedFill (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ChunkId
Patch Set: Created 4 years, 5 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include <cmath> 64 #include <cmath>
65 #include <memory> 65 #include <memory>
66 #include <utility> 66 #include <utility>
67 67
68 #ifndef NDEBUG 68 #ifndef NDEBUG
69 #include <stdio.h> 69 #include <stdio.h>
70 #endif 70 #endif
71 71
72 namespace blink { 72 namespace blink {
73 73
74 static bool s_drawDebugRedFill = true;
75
76 struct PaintInvalidationInfo { 74 struct PaintInvalidationInfo {
77 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 75 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
78 // This is for comparison only. Don't dereference because the client may hav e died. 76 // This is for comparison only. Don't dereference because the client may hav e died.
79 const DisplayItemClient* client; 77 const DisplayItemClient* client;
80 String clientDebugName; 78 String clientDebugName;
81 IntRect rect; 79 IntRect rect;
82 PaintInvalidationReason reason; 80 PaintInvalidationReason reason;
83 }; 81 };
84 82
85 #if DCHECK_IS_ON() 83 #if DCHECK_IS_ON()
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 LayoutRect bounds = LayoutRect(FloatPoint(), size()); 183 LayoutRect bounds = LayoutRect(FloatPoint(), size());
186 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation()); 184 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation());
187 return bounds; 185 return bounds;
188 } 186 }
189 187
190 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform) 188 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform)
191 { 189 {
192 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform); 190 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform);
193 } 191 }
194 192
195 void GraphicsLayer::setDrawDebugRedFillForTesting(bool enabled)
196 {
197 s_drawDebugRedFill = enabled;
198 }
199
200 void GraphicsLayer::setParent(GraphicsLayer* layer) 193 void GraphicsLayer::setParent(GraphicsLayer* layer)
201 { 194 {
202 ASSERT(!layer || !layer->hasAncestor(this)); 195 ASSERT(!layer || !layer->hasAncestor(this));
203 m_parent = layer; 196 m_parent = layer;
204 } 197 }
205 198
206 #if ENABLE(ASSERT) 199 #if ENABLE(ASSERT)
207 200
208 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const 201 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const
209 { 202 {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 367
375 if (!getPaintController().subsequenceCachingIsDisabled() 368 if (!getPaintController().subsequenceCachingIsDisabled()
376 && !m_client->needsRepaint(*this) 369 && !m_client->needsRepaint(*this)
377 && !getPaintController().cacheIsEmpty() 370 && !getPaintController().cacheIsEmpty()
378 && m_previousInterestRect == *interestRect) { 371 && m_previousInterestRect == *interestRect) {
379 return false; 372 return false;
380 } 373 }
381 374
382 GraphicsContext context(getPaintController(), disabledMode); 375 GraphicsContext context(getPaintController(), disabledMode);
383 376
384 #ifndef NDEBUG
385 if (contentsOpaque() && s_drawDebugRedFill) {
386 FloatRect rect(FloatPoint(), size());
387 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) {
388 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect);
389 context.fillRect(rect, SK_ColorRED);
390 }
391 }
392 #endif
393
394 m_previousInterestRect = *interestRect; 377 m_previousInterestRect = *interestRect;
395 m_client->paintContents(this, context, m_paintingPhase, *interestRect); 378 m_client->paintContents(this, context, m_paintingPhase, *interestRect);
396 notifyFirstPaintToClient(); 379 notifyFirstPaintToClient();
397 return true; 380 return true;
398 } 381 }
399 382
400 void GraphicsLayer::notifyFirstPaintToClient() 383 void GraphicsLayer::notifyFirstPaintToClient()
401 { 384 {
402 if (!m_painted) { 385 if (!m_painted) {
403 DisplayItemList& itemList = m_paintController->newDisplayItemList(); 386 DisplayItemList& itemList = m_paintController->newDisplayItemList();
404 for (DisplayItem& item : itemList) { 387 for (DisplayItem& item : itemList) {
405 DisplayItem::Type type = item.getType(); 388 DisplayItem::Type type = item.getType();
406 if (DisplayItem::isDrawingType(type) && type != DisplayItem::Documen tBackground && type != DisplayItem::DebugRedFill && static_cast<const DrawingDis playItem&>(item).picture()) { 389 if (DisplayItem::isDrawingType(type) && type != DisplayItem::Documen tBackground && static_cast<const DrawingDisplayItem&>(item).picture()) {
407 m_painted = true; 390 m_painted = true;
408 m_client->notifyFirstPaint(); 391 m_client->notifyFirstPaint();
409 break; 392 break;
410 } 393 }
411 } 394 }
412 } 395 }
413 if (!m_textPainted && m_paintController->textPainted()) { 396 if (!m_textPainted && m_paintController->textPainted()) {
414 m_textPainted = true; 397 m_textPainted = true;
415 m_client->notifyFirstTextPaint(); 398 m_client->notifyFirstTextPaint();
416 } 399 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 if (clampedSize.width() < 0 || clampedSize.height() < 0) 922 if (clampedSize.width() < 0 || clampedSize.height() < 0)
940 clampedSize = FloatSize(); 923 clampedSize = FloatSize();
941 924
942 if (clampedSize == m_size) 925 if (clampedSize == m_size)
943 return; 926 return;
944 927
945 m_size = clampedSize; 928 m_size = clampedSize;
946 929
947 m_layer->layer()->setBounds(flooredIntSize(m_size)); 930 m_layer->layer()->setBounds(flooredIntSize(m_size));
948 // Note that we don't resize m_contentsLayer. It's up the caller to do that. 931 // Note that we don't resize m_contentsLayer. It's up the caller to do that.
949
950 #ifndef NDEBUG
951 // The red debug fill and needs to be invalidated if the layer resizes.
952 setDisplayItemsUncached();
953 #endif
954 } 932 }
955 933
956 void GraphicsLayer::setTransform(const TransformationMatrix& transform) 934 void GraphicsLayer::setTransform(const TransformationMatrix& transform)
957 { 935 {
958 m_transform = transform; 936 m_transform = transform;
959 platformLayer()->setTransform(TransformationMatrix::toSkMatrix44(m_transform )); 937 platformLayer()->setTransform(TransformationMatrix::toSkMatrix44(m_transform ));
960 } 938 }
961 939
962 void GraphicsLayer::setTransformOrigin(const FloatPoint3D& transformOrigin) 940 void GraphicsLayer::setTransformOrigin(const FloatPoint3D& transformOrigin)
963 { 941 {
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 { 1358 {
1381 if (!layer) { 1359 if (!layer) {
1382 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1360 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1383 return; 1361 return;
1384 } 1362 }
1385 1363
1386 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1364 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1387 fprintf(stderr, "%s\n", output.utf8().data()); 1365 fprintf(stderr, "%s\n", output.utf8().data());
1388 } 1366 }
1389 #endif 1367 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698