Chromium Code Reviews| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 const { | 268 const { |
| 269 return LayoutSize(OffsetFromLayoutObject()) + | 269 return LayoutSize(OffsetFromLayoutObject()) + |
| 270 Client()->SubpixelAccumulation(); | 270 Client()->SubpixelAccumulation(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 IntRect GraphicsLayer::InterestRect() { | 273 IntRect GraphicsLayer::InterestRect() { |
| 274 return previous_interest_rect_; | 274 return previous_interest_rect_; |
| 275 } | 275 } |
| 276 | 276 |
| 277 void GraphicsLayer::Paint(const IntRect* interest_rect, | 277 void GraphicsLayer::Paint(const IntRect* interest_rect, |
| 278 HighContrastSettings* high_contrast, | |
|
chrishtr
2017/06/01 04:10:51
high_contrast_settings
dmazzoni
2017/06/01 21:44:02
Moot since I'm not passing anything to GraphicsLay
| |
| 278 GraphicsContext::DisabledMode disabled_mode) { | 279 GraphicsContext::DisabledMode disabled_mode) { |
| 279 if (PaintWithoutCommit(interest_rect, disabled_mode)) { | 280 if (PaintWithoutCommit(interest_rect, high_contrast, disabled_mode)) { |
| 280 GetPaintController().CommitNewDisplayItems( | 281 GetPaintController().CommitNewDisplayItems( |
| 281 OffsetFromLayoutObjectWithSubpixelAccumulation()); | 282 OffsetFromLayoutObjectWithSubpixelAccumulation()); |
| 282 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { | 283 if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
| 283 sk_sp<PaintRecord> record = CaptureRecord(); | 284 sk_sp<PaintRecord> record = CaptureRecord(); |
| 284 CheckPaintUnderInvalidations(record); | 285 CheckPaintUnderInvalidations(record); |
| 285 RasterInvalidationTracking& tracking = | 286 RasterInvalidationTracking& tracking = |
| 286 GetRasterInvalidationTrackingMap().Add(this); | 287 GetRasterInvalidationTrackingMap().Add(this); |
| 287 tracking.last_painted_record = std::move(record); | 288 tracking.last_painted_record = std::move(record); |
| 288 tracking.last_interest_rect = previous_interest_rect_; | 289 tracking.last_interest_rect = previous_interest_rect_; |
| 289 tracking.raster_invalidation_region_since_last_paint = Region(); | 290 tracking.raster_invalidation_region_since_last_paint = Region(); |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 | 294 |
| 294 bool GraphicsLayer::PaintWithoutCommit( | 295 bool GraphicsLayer::PaintWithoutCommit( |
| 295 const IntRect* interest_rect, | 296 const IntRect* interest_rect, |
| 297 HighContrastSettings* high_contrast, | |
| 296 GraphicsContext::DisabledMode disabled_mode) { | 298 GraphicsContext::DisabledMode disabled_mode) { |
| 297 DCHECK(DrawsContent()); | 299 DCHECK(DrawsContent()); |
| 298 | 300 |
| 299 if (!client_) | 301 if (!client_) |
| 300 return false; | 302 return false; |
| 301 if (FirstPaintInvalidationTracking::IsEnabled()) | 303 if (FirstPaintInvalidationTracking::IsEnabled()) |
| 302 debug_info_.ClearAnnotatedInvalidateRects(); | 304 debug_info_.ClearAnnotatedInvalidateRects(); |
| 303 IncrementPaintCount(); | 305 IncrementPaintCount(); |
| 304 | 306 |
| 305 IntRect new_interest_rect; | 307 IntRect new_interest_rect; |
| 306 if (!interest_rect) { | 308 if (!interest_rect) { |
| 307 new_interest_rect = | 309 new_interest_rect = |
| 308 client_->ComputeInterestRect(this, previous_interest_rect_); | 310 client_->ComputeInterestRect(this, previous_interest_rect_); |
| 309 interest_rect = &new_interest_rect; | 311 interest_rect = &new_interest_rect; |
| 310 } | 312 } |
| 311 | 313 |
| 312 if (!GetPaintController().SubsequenceCachingIsDisabled() && | 314 if (!GetPaintController().SubsequenceCachingIsDisabled() && |
| 313 !client_->NeedsRepaint(*this) && !GetPaintController().CacheIsEmpty() && | 315 !client_->NeedsRepaint(*this) && !GetPaintController().CacheIsEmpty() && |
| 314 previous_interest_rect_ == *interest_rect) { | 316 previous_interest_rect_ == *interest_rect) { |
| 315 return false; | 317 return false; |
| 316 } | 318 } |
| 317 | 319 |
| 318 GraphicsContext context(GetPaintController(), disabled_mode, nullptr); | 320 GraphicsContext context(GetPaintController(), disabled_mode, nullptr); |
| 321 if (high_contrast) | |
| 322 context.SetHighContrast(*high_contrast); | |
| 319 | 323 |
| 320 previous_interest_rect_ = *interest_rect; | 324 previous_interest_rect_ = *interest_rect; |
| 321 client_->PaintContents(this, context, painting_phase_, *interest_rect); | 325 client_->PaintContents(this, context, painting_phase_, *interest_rect); |
|
chrishtr
2017/06/01 04:10:51
Instead of passing the high_contrast object throug
dmazzoni
2017/06/01 21:44:01
Sure, done. That seems to work just as well.
Conc
chrishtr
2017/06/02 21:12:30
Good point. For this reason, please move the appli
| |
| 322 return true; | 326 return true; |
| 323 } | 327 } |
| 324 | 328 |
| 325 void GraphicsLayer::UpdateChildList() { | 329 void GraphicsLayer::UpdateChildList() { |
| 326 WebLayer* child_host = layer_->Layer(); | 330 WebLayer* child_host = layer_->Layer(); |
| 327 child_host->RemoveAllChildren(); | 331 child_host->RemoveAllChildren(); |
| 328 | 332 |
| 329 ClearContentsLayerIfUnregistered(); | 333 ClearContentsLayerIfUnregistered(); |
| 330 | 334 |
| 331 if (contents_layer_) { | 335 if (contents_layer_) { |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1306 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1310 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
| 1307 if (!layer) { | 1311 if (!layer) { |
| 1308 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; | 1312 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; |
| 1309 return; | 1313 return; |
| 1310 } | 1314 } |
| 1311 | 1315 |
| 1312 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); | 1316 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); |
| 1313 LOG(INFO) << output.Utf8().data(); | 1317 LOG(INFO) << output.Utf8().data(); |
| 1314 } | 1318 } |
| 1315 #endif | 1319 #endif |
| OLD | NEW |