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

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

Issue 1305163006: Oilpan: Decrease sizeof(Node) by 8 byte Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 const int nodeStyleChangeShift = 19; 95 const int nodeStyleChangeShift = 19;
96 96
97 enum StyleChangeType { 97 enum StyleChangeType {
98 NoStyleChange = 0, 98 NoStyleChange = 0,
99 LocalStyleChange = 1 << nodeStyleChangeShift, 99 LocalStyleChange = 1 << nodeStyleChangeShift,
100 SubtreeStyleChange = 2 << nodeStyleChangeShift, 100 SubtreeStyleChange = 2 << nodeStyleChangeShift,
101 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, 101 NeedsReattachStyleChange = 3 << nodeStyleChangeShift,
102 }; 102 };
103 103
104 #if ENABLE(OILPAN) && USE_4BYTE_HEADER_PADDING
105 #define NODE_FLAGS reinterpret_cast<HeapObjectHeader*>(reinterpret_cast<uint8_t* >(static_cast<EventTarget*>(const_cast<Node*>(this))) - sizeof(HeapObjectHeader) )->m_padding
106 #else
107 #define NODE_FLAGS m_nodeFlags
108 #endif
109
104 class NodeRareDataBase { 110 class NodeRareDataBase {
105 public: 111 public:
106 LayoutObject* layoutObject() const { return m_layoutObject; } 112 LayoutObject* layoutObject() const { return m_layoutObject; }
107 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; } 113 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; }
108 114
109 protected: 115 protected:
110 NodeRareDataBase(LayoutObject* layoutObject) 116 NodeRareDataBase(LayoutObject* layoutObject)
111 : m_layoutObject(layoutObject) 117 : m_layoutObject(layoutObject)
112 { } 118 { }
113 119
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); } 353 bool inActiveChain() const { return isUserActionElement() && isUserActionEle mentInActiveChain(); }
348 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); } 354 bool hovered() const { return isUserActionElement() && isUserActionElementHo vered(); }
349 // Note: As a shadow host whose root with delegatesFocus=false may become fo cused state when 355 // Note: As a shadow host whose root with delegatesFocus=false may become fo cused state when
350 // an inner element gets focused, in that case more than one elements in a d ocument can return 356 // an inner element gets focused, in that case more than one elements in a d ocument can return
351 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum ent::focusedElement() 357 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum ent::focusedElement()
352 // to check which element is exactly focused. 358 // to check which element is exactly focused.
353 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); } 359 bool focused() const { return isUserActionElement() && isUserActionElementFo cused(); }
354 360
355 bool needsAttach() const { return styleChangeType() == NeedsReattachStyleCha nge; } 361 bool needsAttach() const { return styleChangeType() == NeedsReattachStyleCha nge; }
356 bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; } 362 bool needsStyleRecalc() const { return styleChangeType() != NoStyleChange; }
357 StyleChangeType styleChangeType() const { return static_cast<StyleChangeType >(m_nodeFlags & StyleChangeMask); } 363 StyleChangeType styleChangeType() const { return static_cast<StyleChangeType >(NODE_FLAGS & StyleChangeMask); }
358 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); } 364 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla g); }
359 bool isLink() const { return getFlag(IsLinkFlag); } 365 bool isLink() const { return getFlag(IsLinkFlag); }
360 bool isEditingText() const { ASSERT(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); } 366 bool isEditingText() const { ASSERT(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); }
361 367
362 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); } 368 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); }
363 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } 369 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
364 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } 370 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
365 371
366 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& ); 372 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& );
367 void clearNeedsStyleRecalc(); 373 void clearNeedsStyleRecalc();
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 HasWeakReferencesFlag = 1 << 24, 724 HasWeakReferencesFlag = 1 << 24,
719 V8CollectableDuringMinorGCFlag = 1 << 25, 725 V8CollectableDuringMinorGCFlag = 1 << 25,
720 HasEventTargetDataFlag = 1 << 26, 726 HasEventTargetDataFlag = 1 << 26,
721 AlreadySpellCheckedFlag = 1 << 27, 727 AlreadySpellCheckedFlag = 1 << 27,
722 728
723 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha nge 729 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha nge
724 }; 730 };
725 731
726 // 3 bits remaining. 732 // 3 bits remaining.
727 733
728 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } 734 bool getFlag(NodeFlags mask) const { return NODE_FLAGS & mask; }
729 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } 735 void setFlag(bool f, NodeFlags mask) { NODE_FLAGS = (NODE_FLAGS & ~mask) | ( -(int32_t)f & mask); }
730 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } 736 void setFlag(NodeFlags mask) { NODE_FLAGS |= mask; }
731 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } 737 void clearFlag(NodeFlags mask) { NODE_FLAGS &= ~mask; }
732 738
733 protected: 739 protected:
734 enum ConstructionType { 740 enum ConstructionType {
735 CreateOther = DefaultNodeFlags, 741 CreateOther = DefaultNodeFlags,
736 CreateText = DefaultNodeFlags | IsTextFlag, 742 CreateText = DefaultNodeFlags | IsTextFlag,
737 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsConta inerFlag, 743 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsConta inerFlag,
738 CreateElement = CreateContainer | IsElementFlag, 744 CreateElement = CreateContainer | IsElementFlag,
739 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, 745 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag,
740 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, 746 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag,
741 CreateHTMLElement = CreateElement | IsHTMLFlag, 747 CreateHTMLElement = CreateElement | IsHTMLFlag,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 809
804 virtual ComputedStyle* nonLayoutObjectComputedStyle() const { return nullptr ; } 810 virtual ComputedStyle* nonLayoutObjectComputedStyle() const { return nullptr ; }
805 811
806 virtual const ComputedStyle* virtualEnsureComputedStyle(PseudoId = NOPSEUDO) ; 812 virtual const ComputedStyle* virtualEnsureComputedStyle(PseudoId = NOPSEUDO) ;
807 813
808 void trackForDebugging(); 814 void trackForDebugging();
809 815
810 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration>>* mutation ObserverRegistry(); 816 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration>>* mutation ObserverRegistry();
811 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>>* transie ntMutationObserverRegistry(); 817 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>>* transie ntMutationObserverRegistry();
812 818
819 #if !(ENABLE(OILPAN) && USE_4BYTE_HEADER_PADDING)
813 uint32_t m_nodeFlags; 820 uint32_t m_nodeFlags;
821 #endif
814 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode; 822 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode;
815 RawPtrWillBeMember<TreeScope> m_treeScope; 823 RawPtrWillBeMember<TreeScope> m_treeScope;
816 RawPtrWillBeMember<Node> m_previous; 824 RawPtrWillBeMember<Node> m_previous;
817 RawPtrWillBeMember<Node> m_next; 825 RawPtrWillBeMember<Node> m_next;
818 // When a node has rare data we move the layoutObject into the rare data. 826 // When a node has rare data we move the layoutObject into the rare data.
819 union DataUnion { 827 union DataUnion {
820 DataUnion() : m_layoutObject(nullptr) { } 828 DataUnion() : m_layoutObject(nullptr) { }
821 LayoutObject* m_layoutObject; 829 LayoutObject* m_layoutObject;
822 NodeRareDataBase* m_rareData; 830 NodeRareDataBase* m_rareData;
823 } m_data; 831 } m_data;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 } // namespace blink 913 } // namespace blink
906 914
907 #ifndef NDEBUG 915 #ifndef NDEBUG
908 // Outside the WebCore namespace for ease of invocation from gdb. 916 // Outside the WebCore namespace for ease of invocation from gdb.
909 void showNode(const blink::Node*); 917 void showNode(const blink::Node*);
910 void showTree(const blink::Node*); 918 void showTree(const blink::Node*);
911 void showNodePath(const blink::Node*); 919 void showNodePath(const blink::Node*);
912 #endif 920 #endif
913 921
914 #endif // Node_h 922 #endif // Node_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698