Commit bbaee017 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

DCHECK not marking style dirty during layout tree rebuild.

And that we do not re-enter RebuildLayoutTree.

Bug: 868810
Change-Id: Icb70557747c26ccd107775919034ec91b054d070
Reviewed-on: https://chromium-review.googlesource.com/1217743Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590224}
parent c43e58a8
...@@ -1555,9 +1555,12 @@ void StyleEngine::RecalcStyle(StyleRecalcChange change) { ...@@ -1555,9 +1555,12 @@ void StyleEngine::RecalcStyle(StyleRecalcChange change) {
void StyleEngine::RebuildLayoutTree() { void StyleEngine::RebuildLayoutTree() {
DCHECK(GetDocument().documentElement()); DCHECK(GetDocument().documentElement());
DCHECK(GetDocument().ChildNeedsReattachLayoutTree()); DCHECK(GetDocument().ChildNeedsReattachLayoutTree());
DCHECK(!InRebuildLayoutTree());
in_layout_tree_rebuild_ = true;
WhitespaceAttacher whitespace_attacher; WhitespaceAttacher whitespace_attacher;
GetDocument().documentElement()->RebuildLayoutTree(whitespace_attacher); GetDocument().documentElement()->RebuildLayoutTree(whitespace_attacher);
in_layout_tree_rebuild_ = false;
} }
void StyleEngine::Trace(blink::Visitor* visitor) { void StyleEngine::Trace(blink::Visitor* visitor) {
......
...@@ -321,6 +321,7 @@ class CORE_EXPORT StyleEngine final ...@@ -321,6 +321,7 @@ class CORE_EXPORT StyleEngine final
void RecalcStyle(StyleRecalcChange change); void RecalcStyle(StyleRecalcChange change);
void RebuildLayoutTree(); void RebuildLayoutTree();
bool InRebuildLayoutTree() const { return in_layout_tree_rebuild_; }
void Trace(blink::Visitor*) override; void Trace(blink::Visitor*) override;
const char* NameInHeapSnapshot() const override { return "StyleEngine"; } const char* NameInHeapSnapshot() const override { return "StyleEngine"; }
...@@ -448,6 +449,7 @@ class CORE_EXPORT StyleEngine final ...@@ -448,6 +449,7 @@ class CORE_EXPORT StyleEngine final
bool uses_rem_units_ = false; bool uses_rem_units_ = false;
bool ignore_pending_stylesheets_ = false; bool ignore_pending_stylesheets_ = false;
bool in_layout_tree_rebuild_ = false;
Member<StyleResolver> resolver_; Member<StyleResolver> resolver_;
Member<ViewportStyleResolver> viewport_resolver_; Member<ViewportStyleResolver> viewport_resolver_;
......
...@@ -905,6 +905,7 @@ void Node::SetNeedsReattachLayoutTree() { ...@@ -905,6 +905,7 @@ void Node::SetNeedsReattachLayoutTree() {
void Node::SetNeedsStyleRecalc(StyleChangeType change_type, void Node::SetNeedsStyleRecalc(StyleChangeType change_type,
const StyleChangeReasonForTracing& reason) { const StyleChangeReasonForTracing& reason) {
DCHECK(!GetDocument().GetStyleEngine().InRebuildLayoutTree());
DCHECK(change_type != kNoStyleChange); DCHECK(change_type != kNoStyleChange);
if (!InActiveDocument()) if (!InActiveDocument())
return; return;
......
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