| OLD | NEW |
| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 | 308 |
| 309 IntRect GraphicsLayer::interestRect() | 309 IntRect GraphicsLayer::interestRect() |
| 310 { | 310 { |
| 311 return m_previousInterestRect; | 311 return m_previousInterestRect; |
| 312 } | 312 } |
| 313 | 313 |
| 314 void GraphicsLayer::paint(const IntRect* interestRect, GraphicsContext::Disabled
Mode disabledMode) | 314 void GraphicsLayer::paint(const IntRect* interestRect, GraphicsContext::Disabled
Mode disabledMode) |
| 315 { | 315 { |
| 316 if (paintWithoutCommit(interestRect, disabledMode)) | 316 if (paintWithoutCommit(interestRect, disabledMode)) |
| 317 paintController().commitNewDisplayItems(offsetFromLayoutObjectWithSubpix
elAccumulation()); | 317 getPaintController().commitNewDisplayItems(offsetFromLayoutObjectWithSub
pixelAccumulation()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 bool GraphicsLayer::paintWithoutCommit(const IntRect* interestRect, GraphicsCont
ext::DisabledMode disabledMode) | 320 bool GraphicsLayer::paintWithoutCommit(const IntRect* interestRect, GraphicsCont
ext::DisabledMode disabledMode) |
| 321 { | 321 { |
| 322 ASSERT(drawsContent()); | 322 ASSERT(drawsContent()); |
| 323 | 323 |
| 324 if (!m_client) | 324 if (!m_client) |
| 325 return false; | 325 return false; |
| 326 if (firstPaintInvalidationTrackingEnabled()) | 326 if (firstPaintInvalidationTrackingEnabled()) |
| 327 m_debugInfo.clearAnnotatedInvalidateRects(); | 327 m_debugInfo.clearAnnotatedInvalidateRects(); |
| 328 incrementPaintCount(); | 328 incrementPaintCount(); |
| 329 | 329 |
| 330 IntRect newInterestRect; | 330 IntRect newInterestRect; |
| 331 if (!interestRect) { | 331 if (!interestRect) { |
| 332 newInterestRect = m_client->computeInterestRect(this, m_previousInterest
Rect); | 332 newInterestRect = m_client->computeInterestRect(this, m_previousInterest
Rect); |
| 333 interestRect = &newInterestRect; | 333 interestRect = &newInterestRect; |
| 334 } | 334 } |
| 335 | 335 |
| 336 if (!paintController().subsequenceCachingIsDisabled() | 336 if (!getPaintController().subsequenceCachingIsDisabled() |
| 337 && !m_client->needsRepaint() | 337 && !m_client->needsRepaint() |
| 338 && !paintController().cacheIsEmpty() | 338 && !getPaintController().cacheIsEmpty() |
| 339 && m_previousInterestRect == *interestRect) { | 339 && m_previousInterestRect == *interestRect) { |
| 340 ASSERT(!paintController().hasInvalidations()); | 340 ASSERT(!getPaintController().hasInvalidations()); |
| 341 return false; | 341 return false; |
| 342 } | 342 } |
| 343 | 343 |
| 344 GraphicsContext context(paintController(), disabledMode); | 344 GraphicsContext context(getPaintController(), disabledMode); |
| 345 | 345 |
| 346 #ifndef NDEBUG | 346 #ifndef NDEBUG |
| 347 if (contentsOpaque() && s_drawDebugRedFill) { | 347 if (contentsOpaque() && s_drawDebugRedFill) { |
| 348 FloatRect rect(FloatPoint(), size()); | 348 FloatRect rect(FloatPoint(), size()); |
| 349 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display
Item::DebugRedFill)) { | 349 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display
Item::DebugRedFill)) { |
| 350 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill,
rect); | 350 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill,
rect); |
| 351 context.fillRect(rect, SK_ColorRED); | 351 context.fillRect(rect, SK_ColorRED); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 #endif | 354 #endif |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 if (!drawsContent()) | 1047 if (!drawsContent()) |
| 1048 return; | 1048 return; |
| 1049 | 1049 |
| 1050 // TODO(chrishtr): stop invalidating the rects once FrameView::paintRecursiv
ely does so. | 1050 // TODO(chrishtr): stop invalidating the rects once FrameView::paintRecursiv
ely does so. |
| 1051 m_layer->layer()->invalidate(); | 1051 m_layer->layer()->invalidate(); |
| 1052 if (isTrackingPaintInvalidations()) | 1052 if (isTrackingPaintInvalidations()) |
| 1053 trackPaintInvalidationRect(FloatRect(FloatPoint(), m_size)); | 1053 trackPaintInvalidationRect(FloatRect(FloatPoint(), m_size)); |
| 1054 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1054 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1055 m_linkHighlights[i]->invalidate(); | 1055 m_linkHighlights[i]->invalidate(); |
| 1056 | 1056 |
| 1057 paintController().invalidateAll(); | 1057 getPaintController().invalidateAll(); |
| 1058 if (isTrackingPaintInvalidations()) | 1058 if (isTrackingPaintInvalidations()) |
| 1059 trackPaintInvalidationObject("##ALL##"); | 1059 trackPaintInvalidationObject("##ALL##"); |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 void GraphicsLayer::setNeedsDisplayInRect(const IntRect& rect, PaintInvalidation
Reason invalidationReason) | 1062 void GraphicsLayer::setNeedsDisplayInRect(const IntRect& rect, PaintInvalidation
Reason invalidationReason) |
| 1063 { | 1063 { |
| 1064 if (!drawsContent()) | 1064 if (!drawsContent()) |
| 1065 return; | 1065 return; |
| 1066 | 1066 |
| 1067 m_layer->layer()->invalidateRect(rect); | 1067 m_layer->layer()->invalidateRect(rect); |
| 1068 if (firstPaintInvalidationTrackingEnabled()) | 1068 if (firstPaintInvalidationTrackingEnabled()) |
| 1069 m_debugInfo.appendAnnotatedInvalidateRect(rect, invalidationReason); | 1069 m_debugInfo.appendAnnotatedInvalidateRect(rect, invalidationReason); |
| 1070 if (isTrackingPaintInvalidations()) | 1070 if (isTrackingPaintInvalidations()) |
| 1071 trackPaintInvalidationRect(rect); | 1071 trackPaintInvalidationRect(rect); |
| 1072 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1072 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 1073 m_linkHighlights[i]->invalidate(); | 1073 m_linkHighlights[i]->invalidate(); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 void GraphicsLayer::invalidateDisplayItemClient(const DisplayItemClient& display
ItemClient, PaintInvalidationReason) | 1076 void GraphicsLayer::invalidateDisplayItemClient(const DisplayItemClient& display
ItemClient, PaintInvalidationReason) |
| 1077 { | 1077 { |
| 1078 if (!drawsContent()) | 1078 if (!drawsContent()) |
| 1079 return; | 1079 return; |
| 1080 | 1080 |
| 1081 paintController().invalidate(displayItemClient); | 1081 getPaintController().invalidate(displayItemClient); |
| 1082 if (isTrackingPaintInvalidations()) | 1082 if (isTrackingPaintInvalidations()) |
| 1083 trackPaintInvalidationObject(displayItemClient.debugName()); | 1083 trackPaintInvalidationObject(displayItemClient.debugName()); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 void GraphicsLayer::setContentsRect(const IntRect& rect) | 1086 void GraphicsLayer::setContentsRect(const IntRect& rect) |
| 1087 { | 1087 { |
| 1088 if (rect == m_contentsRect) | 1088 if (rect == m_contentsRect) |
| 1089 return; | 1089 return; |
| 1090 | 1090 |
| 1091 m_contentsRect = rect; | 1091 m_contentsRect = rect; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 } | 1196 } |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 scoped_ptr<base::trace_event::ConvertableToTraceFormat> GraphicsLayer::TakeDebug
Info(cc::Layer* layer) | 1199 scoped_ptr<base::trace_event::ConvertableToTraceFormat> GraphicsLayer::TakeDebug
Info(cc::Layer* layer) |
| 1200 { | 1200 { |
| 1201 scoped_ptr<base::trace_event::TracedValue> tracedValue(m_debugInfo.asTracedV
alue()); | 1201 scoped_ptr<base::trace_event::TracedValue> tracedValue(m_debugInfo.asTracedV
alue()); |
| 1202 tracedValue->SetString("layer_name", WTF::StringUTF8Adaptor(debugName(layer)
).asStringPiece()); | 1202 tracedValue->SetString("layer_name", WTF::StringUTF8Adaptor(debugName(layer)
).asStringPiece()); |
| 1203 return std::move(tracedValue); | 1203 return std::move(tracedValue); |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 PaintController& GraphicsLayer::paintController() | 1206 PaintController& GraphicsLayer::getPaintController() |
| 1207 { | 1207 { |
| 1208 RELEASE_ASSERT(drawsContent()); | 1208 RELEASE_ASSERT(drawsContent()); |
| 1209 if (!m_paintController) | 1209 if (!m_paintController) |
| 1210 m_paintController = PaintController::create(); | 1210 m_paintController = PaintController::create(); |
| 1211 return *m_paintController; | 1211 return *m_paintController; |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 void GraphicsLayer::setElementId(uint64_t id) | 1214 void GraphicsLayer::setElementId(uint64_t id) |
| 1215 { | 1215 { |
| 1216 if (WebLayer* layer = platformLayer()) | 1216 if (WebLayer* layer = platformLayer()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1230 { | 1230 { |
| 1231 if (!layer) { | 1231 if (!layer) { |
| 1232 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1232 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1233 return; | 1233 return; |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1236 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1237 fprintf(stderr, "%s\n", output.utf8().data()); | 1237 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1238 } | 1238 } |
| 1239 #endif | 1239 #endif |
| OLD | NEW |