Commit 86df28cb authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[PE] Speculative fix for crash called from PageOverlay::Update

Don't know why the parent GraphicsLayer is null on Mac only.
The crash spiked since M67, but on M66 the non-SlimmingPaintV175 path
also crashed for the same reason.

Bug: 848442
Change-Id: I34ed17f8aaa193128f295b1cb6139a51164365e8
Reviewed-on: https://chromium-review.googlesource.com/1104697
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568061}
parent 752dbfde
...@@ -72,21 +72,22 @@ void PageOverlay::Update() { ...@@ -72,21 +72,22 @@ void PageOverlay::Update() {
return; return;
if (!layer_) { if (!layer_) {
GraphicsLayer* parent_layer =
frame->IsMainFrame()
? frame->GetPage()->GetVisualViewport().ContainerLayer()
: frame_impl_->LocalRootFrameWidget()->RootGraphicsLayer();
if (!parent_layer)
return;
layer_ = GraphicsLayer::Create(*this); layer_ = GraphicsLayer::Create(*this);
layer_->SetDrawsContent(true); layer_->SetDrawsContent(true);
parent_layer->AddChild(layer_.get());
// This is required for contents of overlay to stay in sync with the page // This is required for contents of overlay to stay in sync with the page
// while scrolling. // while scrolling.
cc::Layer* cc_layer = layer_->CcLayer(); cc::Layer* cc_layer = layer_->CcLayer();
cc_layer->AddMainThreadScrollingReasons( cc_layer->AddMainThreadScrollingReasons(
MainThreadScrollingReason::kPageOverlay); MainThreadScrollingReason::kPageOverlay);
if (frame->IsMainFrame()) {
frame->GetPage()->GetVisualViewport().ContainerLayer()->AddChild(
layer_.get());
} else {
frame_impl_->LocalRootFrameWidget()->RootGraphicsLayer()->AddChild(
layer_.get());
}
if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) { if (RuntimeEnabledFeatures::SlimmingPaintV175Enabled()) {
layer_->SetLayerState(PropertyTreeState(PropertyTreeState::Root()), layer_->SetLayerState(PropertyTreeState(PropertyTreeState::Root()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment