| 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. (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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 // For <link> and <style> elements. | 342 // For <link> and <style> elements. |
| 343 virtual bool sheetLoaded() { return true; } | 343 virtual bool sheetLoaded() { return true; } |
| 344 enum LoadedSheetErrorStatus { | 344 enum LoadedSheetErrorStatus { |
| 345 NoErrorLoadingSubresource, | 345 NoErrorLoadingSubresource, |
| 346 ErrorOccurredLoadingSubresource | 346 ErrorOccurredLoadingSubresource |
| 347 }; | 347 }; |
| 348 virtual void notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetErrorSta
tus) { } | 348 virtual void notifyLoadedSheetAndAllCriticalSubresources(LoadedSheetErrorSta
tus) { } |
| 349 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } | 349 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } |
| 350 | 350 |
| 351 bool hasName() const { ASSERT(!isTextNode()); return getFlag(HasNameOrIsEdit
ingTextFlag); } | 351 bool hasName() const { DCHECK(!isTextNode()); return getFlag(HasNameOrIsEdit
ingTextFlag); } |
| 352 | 352 |
| 353 bool isUserActionElement() const { return getFlag(IsUserActionElementFlag);
} | 353 bool isUserActionElement() const { return getFlag(IsUserActionElementFlag);
} |
| 354 void setUserActionElement(bool flag) { setFlag(flag, IsUserActionElementFlag
); } | 354 void setUserActionElement(bool flag) { setFlag(flag, IsUserActionElementFlag
); } |
| 355 | 355 |
| 356 bool active() const { return isUserActionElement() && isUserActionElementAct
ive(); } | 356 bool active() const { return isUserActionElement() && isUserActionElementAct
ive(); } |
| 357 bool inActiveChain() const { return isUserActionElement() && isUserActionEle
mentInActiveChain(); } | 357 bool inActiveChain() const { return isUserActionElement() && isUserActionEle
mentInActiveChain(); } |
| 358 bool hovered() const { return isUserActionElement() && isUserActionElementHo
vered(); } | 358 bool hovered() const { return isUserActionElement() && isUserActionElementHo
vered(); } |
| 359 // Note: As a shadow host whose root with delegatesFocus=false may become fo
cused state when | 359 // Note: As a shadow host whose root with delegatesFocus=false may become fo
cused state when |
| 360 // an inner element gets focused, in that case more than one elements in a d
ocument can return | 360 // an inner element gets focused, in that case more than one elements in a d
ocument can return |
| 361 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum
ent::focusedElement() | 361 // true for |focused()|. Use Element::isFocusedElementInDocument() or Docum
ent::focusedElement() |
| 362 // to check which element is exactly focused. | 362 // to check which element is exactly focused. |
| 363 bool focused() const { return isUserActionElement() && isUserActionElementFo
cused(); } | 363 bool focused() const { return isUserActionElement() && isUserActionElementFo
cused(); } |
| 364 | 364 |
| 365 bool needsAttach() const { return getStyleChangeType() == NeedsReattachStyle
Change; } | 365 bool needsAttach() const { return getStyleChangeType() == NeedsReattachStyle
Change; } |
| 366 bool needsStyleRecalc() const { return getStyleChangeType() != NoStyleChange
; } | 366 bool needsStyleRecalc() const { return getStyleChangeType() != NoStyleChange
; } |
| 367 StyleChangeType getStyleChangeType() const { return static_cast<StyleChangeT
ype>(m_nodeFlags & StyleChangeMask); } | 367 StyleChangeType getStyleChangeType() const { return static_cast<StyleChangeT
ype>(m_nodeFlags & StyleChangeMask); } |
| 368 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla
g); } | 368 bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFla
g); } |
| 369 bool isLink() const { return getFlag(IsLinkFlag); } | 369 bool isLink() const { return getFlag(IsLinkFlag); } |
| 370 bool isEditingText() const { ASSERT(isTextNode()); return getFlag(HasNameOrI
sEditingTextFlag); } | 370 bool isEditingText() const { DCHECK(isTextNode()); return getFlag(HasNameOrI
sEditingTextFlag); } |
| 371 | 371 |
| 372 void setHasName(bool f) { ASSERT(!isTextNode()); setFlag(f, HasNameOrIsEditi
ngTextFlag); } | 372 void setHasName(bool f) { DCHECK(!isTextNode()); setFlag(f, HasNameOrIsEditi
ngTextFlag); } |
| 373 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } | 373 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } |
| 374 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } | 374 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } |
| 375 | 375 |
| 376 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing&
); | 376 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing&
); |
| 377 void clearNeedsStyleRecalc(); | 377 void clearNeedsStyleRecalc(); |
| 378 | 378 |
| 379 #if ENABLE(ASSERT) | 379 #if DCHECK_IS_ON() |
| 380 bool needsDistributionRecalc() const; | 380 bool needsDistributionRecalc() const; |
| 381 #endif | 381 #endif |
| 382 | 382 |
| 383 bool childNeedsDistributionRecalc() const { return getFlag(ChildNeedsDistrib
utionRecalcFlag); } | 383 bool childNeedsDistributionRecalc() const { return getFlag(ChildNeedsDistrib
utionRecalcFlag); } |
| 384 void setChildNeedsDistributionRecalc() { setFlag(ChildNeedsDistributionReca
lcFlag); } | 384 void setChildNeedsDistributionRecalc() { setFlag(ChildNeedsDistributionReca
lcFlag); } |
| 385 void clearChildNeedsDistributionRecalc() { clearFlag(ChildNeedsDistribution
RecalcFlag); } | 385 void clearChildNeedsDistributionRecalc() { clearFlag(ChildNeedsDistribution
RecalcFlag); } |
| 386 void markAncestorsWithChildNeedsDistributionRecalc(); | 386 void markAncestorsWithChildNeedsDistributionRecalc(); |
| 387 | 387 |
| 388 bool childNeedsStyleInvalidation() const { return getFlag(ChildNeedsStyleInv
alidationFlag); } | 388 bool childNeedsStyleInvalidation() const { return getFlag(ChildNeedsStyleInv
alidationFlag); } |
| 389 void setChildNeedsStyleInvalidation() { setFlag(ChildNeedsStyleInvalidation
Flag); } | 389 void setChildNeedsStyleInvalidation() { setFlag(ChildNeedsStyleInvalidation
Flag); } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 Document* ownerDocument() const; | 463 Document* ownerDocument() const; |
| 464 | 464 |
| 465 // Returns the document associated with this node. A Document node returns i
tself. | 465 // Returns the document associated with this node. A Document node returns i
tself. |
| 466 Document& document() const | 466 Document& document() const |
| 467 { | 467 { |
| 468 return treeScope().document(); | 468 return treeScope().document(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 TreeScope& treeScope() const | 471 TreeScope& treeScope() const |
| 472 { | 472 { |
| 473 ASSERT(m_treeScope); | 473 DCHECK(m_treeScope); |
| 474 return *m_treeScope; | 474 return *m_treeScope; |
| 475 } | 475 } |
| 476 | 476 |
| 477 bool inActiveDocument() const; | 477 bool inActiveDocument() const; |
| 478 | 478 |
| 479 // Returns true if this node is associated with a shadow-including document
and is in its associated document's | 479 // Returns true if this node is associated with a shadow-including document
and is in its associated document's |
| 480 // node tree, false otherwise. | 480 // node tree, false otherwise. |
| 481 bool inShadowIncludingDocument() const | 481 bool inShadowIncludingDocument() const |
| 482 { | 482 { |
| 483 return getFlag(InDocumentFlag); | 483 return getFlag(InDocumentFlag); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 DataUnion() : m_layoutObject(nullptr) { } | 840 DataUnion() : m_layoutObject(nullptr) { } |
| 841 // LayoutObjects are fully owned by their DOM node. See LayoutObject's | 841 // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| 842 // LIFETIME documentation section. | 842 // LIFETIME documentation section. |
| 843 LayoutObject* m_layoutObject; | 843 LayoutObject* m_layoutObject; |
| 844 NodeRareDataBase* m_rareData; | 844 NodeRareDataBase* m_rareData; |
| 845 } m_data; | 845 } m_data; |
| 846 }; | 846 }; |
| 847 | 847 |
| 848 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) | 848 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) |
| 849 { | 849 { |
| 850 ASSERT(isMainThread()); | 850 DCHECK(isMainThread()); |
| 851 m_parentOrShadowHostNode = parent; | 851 m_parentOrShadowHostNode = parent; |
| 852 } | 852 } |
| 853 | 853 |
| 854 inline ContainerNode* Node::parentOrShadowHostNode() const | 854 inline ContainerNode* Node::parentOrShadowHostNode() const |
| 855 { | 855 { |
| 856 ASSERT(isMainThread()); | 856 DCHECK(isMainThread()); |
| 857 return m_parentOrShadowHostNode; | 857 return m_parentOrShadowHostNode; |
| 858 } | 858 } |
| 859 | 859 |
| 860 inline ContainerNode* Node::parentNode() const | 860 inline ContainerNode* Node::parentNode() const |
| 861 { | 861 { |
| 862 return isShadowRoot() ? nullptr : parentOrShadowHostNode(); | 862 return isShadowRoot() ? nullptr : parentOrShadowHostNode(); |
| 863 } | 863 } |
| 864 | 864 |
| 865 inline void Node::lazyReattachIfAttached() | 865 inline void Node::lazyReattachIfAttached() |
| 866 { | 866 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 } // namespace blink | 925 } // namespace blink |
| 926 | 926 |
| 927 #ifndef NDEBUG | 927 #ifndef NDEBUG |
| 928 // Outside the WebCore namespace for ease of invocation from gdb. | 928 // Outside the WebCore namespace for ease of invocation from gdb. |
| 929 void showNode(const blink::Node*); | 929 void showNode(const blink::Node*); |
| 930 void showTree(const blink::Node*); | 930 void showTree(const blink::Node*); |
| 931 void showNodePath(const blink::Node*); | 931 void showNodePath(const blink::Node*); |
| 932 #endif | 932 #endif |
| 933 | 933 |
| 934 #endif // Node_h | 934 #endif // Node_h |
| OLD | NEW |