Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.h

Issue 2729453002: Revert of Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved. 5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
7 * (http://www.torchmobile.com/) 7 * (http://www.torchmobile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // Note: As a shadow host whose root with delegatesFocus=false may become 387 // Note: As a shadow host whose root with delegatesFocus=false may become
388 // focused state when an inner element gets focused, in that case more than 388 // focused state when an inner element gets focused, in that case more than
389 // one elements in a document can return true for |isFocused()|. Use 389 // one elements in a document can return true for |isFocused()|. Use
390 // Element::isFocusedElementInDocument() or Document::focusedElement() to 390 // Element::isFocusedElementInDocument() or Document::focusedElement() to
391 // check which element is exactly focused. 391 // check which element is exactly focused.
392 bool isFocused() const { 392 bool isFocused() const {
393 return isUserActionElement() && isUserActionElementFocused(); 393 return isUserActionElement() && isUserActionElementFocused();
394 } 394 }
395 395
396 bool needsAttach() const { 396 bool needsAttach() const {
397 return getStyleChangeType() == NeedsReattachStyleChange || 397 return getStyleChangeType() == NeedsReattachStyleChange;
398 getFlag(NeedsReattachLayoutTree);
399 } 398 }
400 bool needsStyleRecalc() const { 399 bool needsStyleRecalc() const {
401 return getStyleChangeType() != NoStyleChange; 400 return getStyleChangeType() != NoStyleChange;
402 } 401 }
403 StyleChangeType getStyleChangeType() const { 402 StyleChangeType getStyleChangeType() const {
404 return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); 403 return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask);
405 } 404 }
406 bool childNeedsStyleRecalc() const { 405 bool childNeedsStyleRecalc() const {
407 return getFlag(ChildNeedsStyleRecalcFlag); 406 return getFlag(ChildNeedsStyleRecalcFlag);
408 } 407 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 823
825 HasNameOrIsEditingTextFlag = 1 << 22, 824 HasNameOrIsEditingTextFlag = 1 << 22,
826 HasEventTargetDataFlag = 1 << 23, 825 HasEventTargetDataFlag = 1 << 23,
827 826
828 V0CustomElementFlag = 1 << 24, 827 V0CustomElementFlag = 1 << 24,
829 V0CustomElementUpgradedFlag = 1 << 25, 828 V0CustomElementUpgradedFlag = 1 << 25,
830 829
831 NeedsReattachLayoutTree = 1 << 26, 830 NeedsReattachLayoutTree = 1 << 26,
832 ChildNeedsReattachLayoutTree = 1 << 27, 831 ChildNeedsReattachLayoutTree = 1 << 27,
833 832
834 DefaultNodeFlags = IsFinishedParsingChildrenFlag | 833 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleChange
835 NeedsReattachStyleChange |
836 NeedsReattachLayoutTree
837 }; 834 };
838 835
839 // 4 bits remaining. 836 // 4 bits remaining.
840 837
841 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } 838 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
842 void setFlag(bool f, NodeFlags mask) { 839 void setFlag(bool f, NodeFlags mask) {
843 m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); 840 m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask);
844 } 841 }
845 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } 842 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; }
846 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } 843 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; }
847 844
848 // TODO(mustaq): This is a hack to fix sites with flash objects. We should 845 // TODO(mustaq): This is a hack to fix sites with flash objects. We should
849 // instead route all WebMouseEvents through EventHandler. See 846 // instead route all WebMouseEvents through EventHandler. See
850 // crbug.com/665924. 847 // crbug.com/665924.
851 void createAndDispatchPointerEvent(const AtomicString& mouseEventName, 848 void createAndDispatchPointerEvent(const AtomicString& mouseEventName,
852 const WebMouseEvent&, 849 const WebMouseEvent&,
853 LocalDOMWindow* view); 850 LocalDOMWindow* view);
854 851
855 protected: 852 protected:
856 enum ConstructionType { 853 enum ConstructionType {
857 CreateOther = DefaultNodeFlags, 854 CreateOther = DefaultNodeFlags,
858 CreateText = DefaultNodeFlags | IsTextFlag, 855 CreateText = DefaultNodeFlags | IsTextFlag,
859 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | 856 CreateContainer =
860 ChildNeedsReattachLayoutTree | 857 DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsContainerFlag,
861 IsContainerFlag,
862 CreateElement = CreateContainer | IsElementFlag, 858 CreateElement = CreateContainer | IsElementFlag,
863 CreateShadowRoot = 859 CreateShadowRoot =
864 CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag, 860 CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag,
865 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, 861 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,
866 CreateHTMLElement = CreateElement | IsHTMLFlag, 862 CreateHTMLElement = CreateElement | IsHTMLFlag,
867 CreateSVGElement = CreateElement | IsSVGFlag, 863 CreateSVGElement = CreateElement | IsSVGFlag,
868 CreateDocument = CreateContainer | IsConnectedFlag, 864 CreateDocument = CreateContainer | IsConnectedFlag,
869 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, 865 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag,
870 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, 866 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag,
871 }; 867 };
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 if (needsAttach()) 971 if (needsAttach())
976 return; 972 return;
977 if (!inActiveDocument()) 973 if (!inActiveDocument())
978 return; 974 return;
979 975
980 AttachContext context; 976 AttachContext context;
981 context.performingReattach = true; 977 context.performingReattach = true;
982 978
983 detachLayoutTree(context); 979 detachLayoutTree(context);
984 markAncestorsWithChildNeedsStyleRecalc(); 980 markAncestorsWithChildNeedsStyleRecalc();
985 markAncestorsWithChildNeedsReattachLayoutTree();
986 } 981 }
987 982
988 inline bool Node::shouldCallRecalcStyle(StyleRecalcChange change) { 983 inline bool Node::shouldCallRecalcStyle(StyleRecalcChange change) {
989 return change >= IndependentInherit || needsStyleRecalc() || 984 return change >= IndependentInherit || needsStyleRecalc() ||
990 childNeedsStyleRecalc(); 985 childNeedsStyleRecalc();
991 } 986 }
992 987
993 inline bool isTreeScopeRoot(const Node* node) { 988 inline bool isTreeScopeRoot(const Node* node) {
994 return !node || node->isDocumentNode() || node->isShadowRoot(); 989 return !node || node->isDocumentNode() || node->isShadowRoot();
995 } 990 }
(...skipping 29 matching lines...) Expand all
1025 } // namespace blink 1020 } // namespace blink
1026 1021
1027 #ifndef NDEBUG 1022 #ifndef NDEBUG
1028 // Outside the WebCore namespace for ease of invocation from gdb. 1023 // Outside the WebCore namespace for ease of invocation from gdb.
1029 void showNode(const blink::Node*); 1024 void showNode(const blink::Node*);
1030 void showTree(const blink::Node*); 1025 void showTree(const blink::Node*);
1031 void showNodePath(const blink::Node*); 1026 void showNodePath(const blink::Node*);
1032 #endif 1027 #endif
1033 1028
1034 #endif // Node_h 1029 #endif // Node_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698