Commit 617ae6ff authored by nainar's avatar nainar Committed by Commit bot

Reorganize Layout Tree Construction code to be its own function

This patch trivially encapsulates Layout Tree Construction
code in its own function -> Element::buildOwnLayout().

No behaviour change is expected from this patch since it is
merely moving code around.

With lots of help from @bugsnash

Design doc: http://bit.ly/29MBWvf

BUG=595137

Review-Url: https://codereview.chromium.org/2118393002
Cr-Commit-Position: refs/heads/master@{#404584}
parent 26ecc31b
......@@ -1771,13 +1771,10 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change)
}
if (localChange == Reattach) {
AttachContext reattachContext;
reattachContext.resolvedStyle = newStyle.get();
bool layoutObjectWillChange = needsAttach() || layoutObject();
reattach(reattachContext);
if (layoutObjectWillChange || layoutObject())
return Reattach;
return ReattachNoLayoutObject;
// TODO(nainar): Remove the style parameter being passed into buildOwnLayout().
// ComputedStyle will now be stored on Node and accessed in buildOwnLayout()
// using mutableComputedStyle().
return buildOwnLayout(*newStyle);
}
DCHECK(oldStyle);
......@@ -1816,6 +1813,17 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change)
return localChange;
}
StyleRecalcChange Element::buildOwnLayout(ComputedStyle& newStyle)
{
AttachContext reattachContext;
reattachContext.resolvedStyle = &newStyle;
bool layoutObjectWillChange = needsAttach() || layoutObject();
reattach(reattachContext);
if (layoutObjectWillChange || layoutObject())
return Reattach;
return ReattachNoLayoutObject;
}
void Element::updateCallbackSelectors(const ComputedStyle* oldStyle, const ComputedStyle* newStyle)
{
Vector<String> emptyVector;
......
......@@ -650,6 +650,8 @@ private:
void setInlineStyleFromString(const AtomicString&);
StyleRecalcChange recalcOwnStyle(StyleRecalcChange);
// TODO(nainar): Make this const ComputedStyle&.
StyleRecalcChange buildOwnLayout(ComputedStyle&);
inline void checkForEmptyStyleChange();
......
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