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

No need to reattach legacy/ng layout after style recalc.

We no longer (re-)attach the layout tree from style recalc.

Change-Id: Ia944649b6e12345c23ecbd7e6ea91d8d6aaba94c
Reviewed-on: https://chromium-review.googlesource.com/1190205Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586366}
parent 9106ccd3
...@@ -2304,10 +2304,7 @@ void Document::UpdateStyle() { ...@@ -2304,10 +2304,7 @@ void Document::UpdateStyle() {
TRACE_EVENT0("blink,blink_style", "Document::recalcStyle"); TRACE_EVENT0("blink,blink_style", "Document::recalcStyle");
SCOPED_BLINK_UMA_HISTOGRAM_TIMER_HIGHRES("Style.RecalcTime"); SCOPED_BLINK_UMA_HISTOGRAM_TIMER_HIGHRES("Style.RecalcTime");
Element* viewport_defining = ViewportDefiningElement(); Element* viewport_defining = ViewportDefiningElement();
ReattachLegacyLayoutObjectList legacy_layout_objects(*this);
legacy_layout_objects.WillRecalcStyle();
document_element->RecalcStyle(change); document_element->RecalcStyle(change);
legacy_layout_objects.DidRecalcStyle();
if (viewport_defining != ViewportDefiningElement()) if (viewport_defining != ViewportDefiningElement())
ViewportDefiningElementDidChange(); ViewportDefiningElementDidChange();
} }
......
...@@ -284,7 +284,7 @@ void ReattachLegacyLayoutObjectList::AddForceLegacyAtBFCAncestor( ...@@ -284,7 +284,7 @@ void ReattachLegacyLayoutObjectList::AddForceLegacyAtBFCAncestor(
} }
bool ReattachLegacyLayoutObjectList::IsCollecting() const { bool ReattachLegacyLayoutObjectList::IsCollecting() const {
return state_ == State::kCollecting || state_ == State::kRecalcStyle; return state_ == State::kCollecting;
} }
void ReattachLegacyLayoutObjectList::ForceLegacyLayoutIfNeeded() { void ReattachLegacyLayoutObjectList::ForceLegacyLayoutIfNeeded() {
...@@ -305,26 +305,6 @@ void ReattachLegacyLayoutObjectList::ForceLegacyLayoutIfNeeded() { ...@@ -305,26 +305,6 @@ void ReattachLegacyLayoutObjectList::ForceLegacyLayoutIfNeeded() {
state_ = State::kClosed; state_ = State::kClosed;
} }
void ReattachLegacyLayoutObjectList::DidRecalcStyle() {
const State state = state_;
state_ = State::kClosed;
if (state == State::kBuildingLegacyLayoutTree)
return;
DCHECK_EQ(state, State::kRecalcStyle);
for (const LayoutObject* block : blocks_)
ToElement(*block->GetNode()).LazyReattachIfAttached();
}
void ReattachLegacyLayoutObjectList::WillRecalcStyle() {
// TODO(layout-dev): Once make |RecalcStyle()| not to create layout object,
// we don't need to have |WillRecalcStyle()| and |DidRecalcStyle()|.
// Note: "first-letter-removed-added.html" creates layout object during
// style recalc. See http://crbug.com/847218
if (state_ == State::kBuildingLegacyLayoutTree)
return;
state_ = State::kRecalcStyle;
}
void ReattachLegacyLayoutObjectList::Trace(blink::Visitor* visitor) { void ReattachLegacyLayoutObjectList::Trace(blink::Visitor* visitor) {
visitor->Trace(document_); visitor->Trace(document_);
} }
......
...@@ -158,9 +158,6 @@ class CORE_EXPORT ReattachLegacyLayoutObjectList final { ...@@ -158,9 +158,6 @@ class CORE_EXPORT ReattachLegacyLayoutObjectList final {
} }
void ForceLegacyLayoutIfNeeded(); void ForceLegacyLayoutIfNeeded();
void DidRecalcStyle();
void WillRecalcStyle();
void Trace(blink::Visitor*); void Trace(blink::Visitor*);
private: private:
...@@ -180,8 +177,6 @@ class CORE_EXPORT ReattachLegacyLayoutObjectList final { ...@@ -180,8 +177,6 @@ class CORE_EXPORT ReattachLegacyLayoutObjectList final {
kCollecting, kCollecting,
// Replaces LayoutNG objects to legacy layout objects. // Replaces LayoutNG objects to legacy layout objects.
kForcingLegacyLayout, kForcingLegacyLayout,
// Doing style re-calculation.
kRecalcStyle,
} state_ = State::kInvalid; } state_ = State::kInvalid;
DISALLOW_COPY_AND_ASSIGN(ReattachLegacyLayoutObjectList); DISALLOW_COPY_AND_ASSIGN(ReattachLegacyLayoutObjectList);
......
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