OLD | NEW |
---|---|
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 Loading... | |
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; |
nainar
2017/03/02 01:21:22
Retaining this as the function should only test fo
| |
398 } | 398 } |
399 bool needsStyleRecalc() const { | 399 bool needsStyleRecalc() const { |
400 return getStyleChangeType() != NoStyleChange; | 400 return getStyleChangeType() != NoStyleChange; |
401 } | 401 } |
402 StyleChangeType getStyleChangeType() const { | 402 StyleChangeType getStyleChangeType() const { |
403 return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); | 403 return static_cast<StyleChangeType>(m_nodeFlags & StyleChangeMask); |
404 } | 404 } |
405 bool childNeedsStyleRecalc() const { | 405 bool childNeedsStyleRecalc() const { |
406 return getFlag(ChildNeedsStyleRecalcFlag); | 406 return getFlag(ChildNeedsStyleRecalcFlag); |
407 } | 407 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 | 823 |
824 HasNameOrIsEditingTextFlag = 1 << 22, | 824 HasNameOrIsEditingTextFlag = 1 << 22, |
825 HasEventTargetDataFlag = 1 << 23, | 825 HasEventTargetDataFlag = 1 << 23, |
826 | 826 |
827 V0CustomElementFlag = 1 << 24, | 827 V0CustomElementFlag = 1 << 24, |
828 V0CustomElementUpgradedFlag = 1 << 25, | 828 V0CustomElementUpgradedFlag = 1 << 25, |
829 | 829 |
830 NeedsReattachLayoutTree = 1 << 26, | 830 NeedsReattachLayoutTree = 1 << 26, |
831 ChildNeedsReattachLayoutTree = 1 << 27, | 831 ChildNeedsReattachLayoutTree = 1 << 27, |
832 | 832 |
833 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleChange | 833 DefaultNodeFlags = IsFinishedParsingChildrenFlag | |
834 NeedsReattachStyleChange | | |
835 NeedsReattachLayoutTree | |
834 }; | 836 }; |
835 | 837 |
836 // 4 bits remaining. | 838 // 4 bits remaining. |
837 | 839 |
838 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 840 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } |
839 void setFlag(bool f, NodeFlags mask) { | 841 void setFlag(bool f, NodeFlags mask) { |
840 m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); | 842 m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); |
841 } | 843 } |
842 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } | 844 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } |
843 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } | 845 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } |
844 | 846 |
845 // TODO(mustaq): This is a hack to fix sites with flash objects. We should | 847 // TODO(mustaq): This is a hack to fix sites with flash objects. We should |
846 // instead route all WebMouseEvents through EventHandler. See | 848 // instead route all WebMouseEvents through EventHandler. See |
847 // crbug.com/665924. | 849 // crbug.com/665924. |
848 void createAndDispatchPointerEvent(const AtomicString& mouseEventName, | 850 void createAndDispatchPointerEvent(const AtomicString& mouseEventName, |
849 const WebMouseEvent&, | 851 const WebMouseEvent&, |
850 LocalDOMWindow* view); | 852 LocalDOMWindow* view); |
851 | 853 |
852 protected: | 854 protected: |
853 enum ConstructionType { | 855 enum ConstructionType { |
854 CreateOther = DefaultNodeFlags, | 856 CreateOther = DefaultNodeFlags, |
855 CreateText = DefaultNodeFlags | IsTextFlag, | 857 CreateText = DefaultNodeFlags | IsTextFlag, |
856 CreateContainer = | 858 CreateContainer = DefaultNodeFlags | ChildNeedsStyleRecalcFlag | |
857 DefaultNodeFlags | ChildNeedsStyleRecalcFlag | IsContainerFlag, | 859 ChildNeedsReattachLayoutTree | |
860 IsContainerFlag, | |
858 CreateElement = CreateContainer | IsElementFlag, | 861 CreateElement = CreateContainer | IsElementFlag, |
859 CreateShadowRoot = | 862 CreateShadowRoot = |
860 CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag, | 863 CreateContainer | IsDocumentFragmentFlag | IsInShadowTreeFlag, |
861 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, | 864 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, |
862 CreateHTMLElement = CreateElement | IsHTMLFlag, | 865 CreateHTMLElement = CreateElement | IsHTMLFlag, |
863 CreateSVGElement = CreateElement | IsSVGFlag, | 866 CreateSVGElement = CreateElement | IsSVGFlag, |
864 CreateDocument = CreateContainer | IsConnectedFlag, | 867 CreateDocument = CreateContainer | IsConnectedFlag, |
865 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, | 868 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, |
866 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, | 869 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, |
867 }; | 870 }; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
967 if (needsAttach()) | 970 if (needsAttach()) |
968 return; | 971 return; |
969 if (!inActiveDocument()) | 972 if (!inActiveDocument()) |
970 return; | 973 return; |
971 | 974 |
972 AttachContext context; | 975 AttachContext context; |
973 context.performingReattach = true; | 976 context.performingReattach = true; |
974 | 977 |
975 detachLayoutTree(context); | 978 detachLayoutTree(context); |
976 markAncestorsWithChildNeedsStyleRecalc(); | 979 markAncestorsWithChildNeedsStyleRecalc(); |
980 markAncestorsWithChildNeedsReattachLayoutTree(); | |
977 } | 981 } |
978 | 982 |
979 inline bool Node::shouldCallRecalcStyle(StyleRecalcChange change) { | 983 inline bool Node::shouldCallRecalcStyle(StyleRecalcChange change) { |
980 return change >= IndependentInherit || needsStyleRecalc() || | 984 return change >= IndependentInherit || needsStyleRecalc() || |
981 childNeedsStyleRecalc(); | 985 childNeedsStyleRecalc(); |
982 } | 986 } |
983 | 987 |
984 inline bool isTreeScopeRoot(const Node* node) { | 988 inline bool isTreeScopeRoot(const Node* node) { |
985 return !node || node->isDocumentNode() || node->isShadowRoot(); | 989 return !node || node->isDocumentNode() || node->isShadowRoot(); |
986 } | 990 } |
(...skipping 29 matching lines...) Expand all Loading... | |
1016 } // namespace blink | 1020 } // namespace blink |
1017 | 1021 |
1018 #ifndef NDEBUG | 1022 #ifndef NDEBUG |
1019 // Outside the WebCore namespace for ease of invocation from gdb. | 1023 // Outside the WebCore namespace for ease of invocation from gdb. |
1020 void showNode(const blink::Node*); | 1024 void showNode(const blink::Node*); |
1021 void showTree(const blink::Node*); | 1025 void showTree(const blink::Node*); |
1022 void showNodePath(const blink::Node*); | 1026 void showNodePath(const blink::Node*); |
1023 #endif | 1027 #endif |
1024 | 1028 |
1025 #endif // Node_h | 1029 #endif // Node_h |
OLD | NEW |