summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc')
-rw-r--r--chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc59
1 files changed, 22 insertions, 37 deletions
diff --git a/chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc
index 29c9b6fb384..db2f311652d 100644
--- a/chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc
+++ b/chromium/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -67,7 +67,6 @@ namespace blink {
GraphicsLayer::GraphicsLayer(GraphicsLayerClient& client)
: client_(client),
- prevent_contents_opaque_changes_(false),
draws_content_(false),
paints_hit_test_(false),
contents_visible_(true),
@@ -264,10 +263,6 @@ void GraphicsLayer::SetOffsetFromLayoutObject(const IntSize& offset) {
Invalidate(PaintInvalidationReason::kFullLayer); // As DisplayItemClient.
}
-IntRect GraphicsLayer::InterestRect() {
- return previous_interest_rect_;
-}
-
void GraphicsLayer::ClearPaintStateRecursively() {
ForAllGraphicsLayers(
*this,
@@ -348,10 +343,12 @@ void GraphicsLayer::Paint(Vector<PreCompositedLayerInfo>& pre_composited_layers,
#endif
DCHECK(layer_state_) << "No layer state for GraphicsLayer: " << DebugName();
- IntRect new_interest_rect =
- interest_rect
- ? *interest_rect
- : client_.ComputeInterestRect(this, previous_interest_rect_);
+ IntRect new_interest_rect;
+ if (!RuntimeEnabledFeatures::CullRectUpdateEnabled()) {
+ new_interest_rect = interest_rect ? *interest_rect
+ : client_.ComputeInterestRect(
+ this, previous_interest_rect_);
+ }
auto& paint_controller = GetPaintController();
PaintController::ScopedBenchmarkMode scoped_benchmark_mode(paint_controller,
@@ -367,6 +364,10 @@ void GraphicsLayer::Paint(Vector<PreCompositedLayerInfo>& pre_composited_layers,
DCHECK(layer_state_) << "No layer state for GraphicsLayer: " << DebugName();
paint_controller.UpdateCurrentPaintChunkProperties(
nullptr, layer_state_->state.GetPropertyTreeState());
+ // If this uses pre-CAP compositing, contents_opaque will be calculated by
+ // CompositedLayerMapping; otherwise, it is calculated by PaintChunker.
+ paint_controller.SetShouldComputeContentsOpaque(
+ ShouldCreateLayersAfterPaint());
previous_interest_rect_ = new_interest_rect;
client_.PaintContents(this, context, painting_phase_, new_interest_rect);
paint_controller.CommitNewDisplayItems();
@@ -374,7 +375,7 @@ void GraphicsLayer::Paint(Vector<PreCompositedLayerInfo>& pre_composited_layers,
// when unifying PaintController.
Validate();
DVLOG(2) << "Painted GraphicsLayer: " << DebugName()
- << " interest_rect=" << InterestRect().ToString();
+ << " paintable region: " << PaintableRegion().ToString();
}
PaintChunkSubset chunks(paint_controller.GetPaintArtifactShared());
@@ -399,8 +400,8 @@ void GraphicsLayer::Paint(Vector<PreCompositedLayerInfo>& pre_composited_layers,
if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() &&
PaintsContentOrHitTest()) {
raster_under_invalidation_params.emplace(
- EnsureRasterInvalidator().EnsureTracking(), InterestRect(),
- DebugName());
+ EnsureRasterInvalidator().EnsureTracking(),
+ IntRect(PaintableRegion()), DebugName());
}
// If nothing changed in the layer, keep the original display item list.
@@ -463,14 +464,12 @@ void GraphicsLayer::UpdateContentsLayerBounds() {
}
void GraphicsLayer::SetContentsToCcLayer(
- scoped_refptr<cc::Layer> contents_layer,
- bool prevent_contents_opaque_changes) {
+ scoped_refptr<cc::Layer> contents_layer) {
DCHECK_NE(contents_layer, layer_);
- SetContentsTo(std::move(contents_layer), prevent_contents_opaque_changes);
+ SetContentsTo(std::move(contents_layer));
}
-void GraphicsLayer::SetContentsTo(scoped_refptr<cc::Layer> layer,
- bool prevent_contents_opaque_changes) {
+void GraphicsLayer::SetContentsTo(scoped_refptr<cc::Layer> layer) {
if (layer) {
if (contents_layer_ != layer) {
contents_layer_ = std::move(layer);
@@ -482,7 +481,6 @@ void GraphicsLayer::SetContentsTo(scoped_refptr<cc::Layer> layer,
NotifyChildListChange();
}
UpdateContentsLayerBounds();
- prevent_contents_opaque_changes_ = prevent_contents_opaque_changes;
} else if (contents_layer_) {
contents_layer_ = nullptr;
NotifyChildListChange();
@@ -595,25 +593,6 @@ void GraphicsLayer::SetContentsVisible(bool contents_visible) {
UpdateLayerIsDrawable();
}
-void GraphicsLayer::SetContentsLayerBackgroundColor(Color color) {
- if (contents_layer_)
- contents_layer_->SetBackgroundColor(color.Rgb());
-}
-
-bool GraphicsLayer::ContentsOpaque() const {
- return CcLayer().contents_opaque();
-}
-
-void GraphicsLayer::SetContentsOpaque(bool opaque) {
- CcLayer().SetContentsOpaque(opaque);
- if (contents_layer_ && !prevent_contents_opaque_changes_)
- contents_layer_->SetContentsOpaque(opaque);
-}
-
-void GraphicsLayer::SetContentsOpaqueForText(bool opaque) {
- CcLayer().SetContentsOpaqueForText(opaque);
-}
-
void GraphicsLayer::SetPaintsHitTest(bool paints_hit_test) {
if (paints_hit_test_ == paints_hit_test)
return;
@@ -711,6 +690,12 @@ void GraphicsLayer::SetContentsLayerState(
client_.GraphicsLayersDidChange();
}
+gfx::Rect GraphicsLayer::PaintableRegion() const {
+ return RuntimeEnabledFeatures::CullRectUpdateEnabled()
+ ? client_.PaintableRegion(this)
+ : previous_interest_rect_;
+}
+
scoped_refptr<cc::DisplayItemList> GraphicsLayer::PaintContentsToDisplayList() {
DCHECK(!ShouldCreateLayersAfterPaint());
return cc_display_item_list_;