Commit 6cc2805b authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Compute style to avoid crashes for layout tree building.

We don't have a repro for this, but there are crashes in the wild where
we haven't got a ComputedStyle when attaching the layout tree for a UA
shadow DOM element inside an HTML input element.

Add a NOTREACHED to try to catch it, but fall back to compute the style
to avoid crashes when it happens.

Bug: 875796
Change-Id: I24ef78183df6faa6bfea88a7e5f8ad0d7f2bf14c
Reviewed-on: https://chromium-review.googlesource.com/1182806
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584690}
parent a1cdb7ae
...@@ -131,7 +131,13 @@ bool LayoutTreeBuilderForElement::ShouldCreateLayoutObject() const { ...@@ -131,7 +131,13 @@ bool LayoutTreeBuilderForElement::ShouldCreateLayoutObject() const {
} }
ComputedStyle& LayoutTreeBuilderForElement::Style() const { ComputedStyle& LayoutTreeBuilderForElement::Style() const {
DCHECK(style_); if (!style_) {
// TODO(futhark@chromium.org): this should never happen, but we currently
// have crashes in the wild because of this (https://crbug.com/875796).
// Please report if you ever end up here.
NOTREACHED();
style_ = node_->StyleForLayoutObject();
}
return *style_; return *style_;
} }
......
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