 Chromium Code Reviews
 Chromium Code Reviews Issue 2473743003:
  Call Element::rebuildLayoutTree from Document::updateStyle directly  (Closed)
    
  
    Issue 2473743003:
  Call Element::rebuildLayoutTree from Document::updateStyle directly  (Closed) 
  | Index: third_party/WebKit/Source/core/dom/Node.h | 
| diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h | 
| index bd9263fd3a8d5a93d7b43d20eb8f2443d8824bba..f5e5d8b03127113d9c7d79d1c1ee4956c1593e13 100644 | 
| --- a/third_party/WebKit/Source/core/dom/Node.h | 
| +++ b/third_party/WebKit/Source/core/dom/Node.h | 
| @@ -84,8 +84,7 @@ const int nodeCustomElementShift = 20; | 
| enum StyleChangeType { | 
| NoStyleChange = 0, | 
| LocalStyleChange = 1 << nodeStyleChangeShift, | 
| - SubtreeStyleChange = 2 << nodeStyleChangeShift, | 
| - NeedsReattachStyleChange = 3 << nodeStyleChangeShift, | 
| + SubtreeStyleChange = 2 << nodeStyleChangeShift | 
| 
nainar
2016/11/29 06:13:39
Redundant information this is encapsulated in Need
 | 
| }; | 
| enum class CustomElementState { | 
| @@ -396,9 +395,6 @@ class CORE_EXPORT Node : public EventTarget { | 
| return isUserActionElement() && isUserActionElementFocused(); | 
| } | 
| - bool needsAttach() const { | 
| 
nainar
2016/11/29 06:13:39
Redundant information this is encapsulated in need
 | 
| - return getStyleChangeType() == NeedsReattachStyleChange; | 
| - } | 
| bool needsStyleRecalc() const { | 
| return getStyleChangeType() != NoStyleChange; | 
| } | 
| @@ -430,6 +426,7 @@ class CORE_EXPORT Node : public EventTarget { | 
| } | 
| void setNeedsReattachLayoutTree(); | 
| + void setLocalNeedsReattachLayoutTree() { setFlag(NeedsReattachLayoutTree); } | 
| void setChildNeedsReattachLayoutTree() { | 
| setFlag(ChildNeedsReattachLayoutTree); | 
| } | 
| @@ -832,7 +829,7 @@ class CORE_EXPORT Node : public EventTarget { | 
| NeedsReattachLayoutTree = 1 << 26, | 
| ChildNeedsReattachLayoutTree = 1 << 27, | 
| - DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleChange | 
| + DefaultNodeFlags = IsFinishedParsingChildrenFlag | 
| }; | 
| // 4 bits remaining. | 
| @@ -968,7 +965,7 @@ inline ContainerNode* Node::parentNode() const { | 
| } | 
| inline void Node::lazyReattachIfAttached() { | 
| - if (getStyleChangeType() == NeedsReattachStyleChange) | 
| + if (needsReattachLayoutTree()) | 
| return; | 
| if (!inActiveDocument()) | 
| return; | 
| @@ -977,7 +974,7 @@ inline void Node::lazyReattachIfAttached() { | 
| context.performingReattach = true; | 
| detachLayoutTree(context); | 
| - markAncestorsWithChildNeedsStyleRecalc(); | 
| + markAncestorsWithChildNeedsReattachLayoutTree(); | 
| 
nainar
2016/11/29 06:13:39
Changed to the equivalent reattachLayoutTree funct
 | 
| } | 
| inline bool Node::shouldCallRecalcStyle(StyleRecalcChange change) { |