| 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. |
| 7 * (http://www.torchmobile.com/) |
| 7 * | 8 * |
| 8 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 12 * | 13 * |
| 13 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 kAttributeNode = 2, | 144 kAttributeNode = 2, |
| 144 kTextNode = 3, | 145 kTextNode = 3, |
| 145 kCdataSectionNode = 4, | 146 kCdataSectionNode = 4, |
| 146 kProcessingInstructionNode = 7, | 147 kProcessingInstructionNode = 7, |
| 147 kCommentNode = 8, | 148 kCommentNode = 8, |
| 148 kDocumentNode = 9, | 149 kDocumentNode = 9, |
| 149 kDocumentTypeNode = 10, | 150 kDocumentTypeNode = 10, |
| 150 kDocumentFragmentNode = 11, | 151 kDocumentFragmentNode = 11, |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 // Entity, EntityReference, and Notation nodes are impossible to create in Bli
nk. | 154 // Entity, EntityReference, and Notation nodes are impossible to create in |
| 154 // But for compatibility reasons we want these enum values exist in JS, and th
is enum makes the bindings | 155 // Blink. But for compatibility reasons we want these enum values exist in |
| 155 // generation not complain about kEntityReferenceNode being missing from the i
mplementation | 156 // JS, and this enum makes the bindings generation not complain about |
| 156 // while not requiring all switch(NodeType) blocks to include this deprecated
constant. | 157 // kEntityReferenceNode being missing from the implementation while not |
| 158 // requiring all switch(NodeType) blocks to include this deprecated constant. |
| 157 enum DeprecatedNodeType { | 159 enum DeprecatedNodeType { |
| 158 kEntityReferenceNode = 5, | 160 kEntityReferenceNode = 5, |
| 159 kEntityNode = 6, | 161 kEntityNode = 6, |
| 160 kNotationNode = 12, | 162 kNotationNode = 12, |
| 161 }; | 163 }; |
| 162 | 164 |
| 163 enum DocumentPosition { | 165 enum DocumentPosition { |
| 164 kDocumentPositionEquivalent = 0x00, | 166 kDocumentPositionEquivalent = 0x00, |
| 165 kDocumentPositionDisconnected = 0x01, | 167 kDocumentPositionDisconnected = 0x01, |
| 166 kDocumentPositionPreceding = 0x02, | 168 kDocumentPositionPreceding = 0x02, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 ContainerNode* parentElementOrShadowRoot() const; | 203 ContainerNode* parentElementOrShadowRoot() const; |
| 202 ContainerNode* parentElementOrDocumentFragment() const; | 204 ContainerNode* parentElementOrDocumentFragment() const; |
| 203 Node* previousSibling() const { return m_previous; } | 205 Node* previousSibling() const { return m_previous; } |
| 204 Node* nextSibling() const { return m_next; } | 206 Node* nextSibling() const { return m_next; } |
| 205 NodeList* childNodes(); | 207 NodeList* childNodes(); |
| 206 Node* firstChild() const; | 208 Node* firstChild() const; |
| 207 Node* lastChild() const; | 209 Node* lastChild() const; |
| 208 Node* getRootNode(const GetRootNodeOptions&) const; | 210 Node* getRootNode(const GetRootNodeOptions&) const; |
| 209 Node& treeRoot() const; | 211 Node& treeRoot() const; |
| 210 Node& shadowIncludingRoot() const; | 212 Node& shadowIncludingRoot() const; |
| 211 // closed-shadow-hidden is defined at https://dom.spec.whatwg.org/#concept-clo
sed-shadow-hidden | 213 // closed-shadow-hidden is defined at |
| 214 // https://dom.spec.whatwg.org/#concept-closed-shadow-hidden |
| 212 bool isClosedShadowHiddenFrom(const Node&) const; | 215 bool isClosedShadowHiddenFrom(const Node&) const; |
| 213 | 216 |
| 214 void prepend(const HeapVector<NodeOrString>&, ExceptionState&); | 217 void prepend(const HeapVector<NodeOrString>&, ExceptionState&); |
| 215 void append(const HeapVector<NodeOrString>&, ExceptionState&); | 218 void append(const HeapVector<NodeOrString>&, ExceptionState&); |
| 216 void before(const HeapVector<NodeOrString>&, ExceptionState&); | 219 void before(const HeapVector<NodeOrString>&, ExceptionState&); |
| 217 void after(const HeapVector<NodeOrString>&, ExceptionState&); | 220 void after(const HeapVector<NodeOrString>&, ExceptionState&); |
| 218 void replaceWith(const HeapVector<NodeOrString>&, ExceptionState&); | 221 void replaceWith(const HeapVector<NodeOrString>&, ExceptionState&); |
| 219 void remove(ExceptionState& = ASSERT_NO_EXCEPTION); | 222 void remove(ExceptionState& = ASSERT_NO_EXCEPTION); |
| 220 | 223 |
| 221 Node* pseudoAwareNextSibling() const; | 224 Node* pseudoAwareNextSibling() const; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // A re-distribution across v0 and v1 shadow trees is not supported. | 314 // A re-distribution across v0 and v1 shadow trees is not supported. |
| 312 bool isSlotable() const { | 315 bool isSlotable() const { |
| 313 return isTextNode() || (isElementNode() && !isInsertionPoint()); | 316 return isTextNode() || (isElementNode() && !isInsertionPoint()); |
| 314 } | 317 } |
| 315 AtomicString slotName() const; | 318 AtomicString slotName() const; |
| 316 | 319 |
| 317 bool hasCustomStyleCallbacks() const { | 320 bool hasCustomStyleCallbacks() const { |
| 318 return getFlag(HasCustomStyleCallbacksFlag); | 321 return getFlag(HasCustomStyleCallbacksFlag); |
| 319 } | 322 } |
| 320 | 323 |
| 321 // If this node is in a shadow tree, returns its shadow host. Otherwise, retur
ns nullptr. | 324 // If this node is in a shadow tree, returns its shadow host. Otherwise, |
| 322 // TODO(kochi): crbug.com/507413 ownerShadowHost() can return nullptr even whe
n it is in a | 325 // returns nullptr. |
| 323 // shadow tree but its root is detached from its host. This can happen when ha
ndling | 326 // TODO(kochi): crbug.com/507413 ownerShadowHost() can return nullptr even |
| 324 // queued events (e.g. during execCommand()). | 327 // when it is in a shadow tree but its root is detached from its host. This |
| 328 // can happen when handling queued events (e.g. during execCommand()). |
| 325 Element* ownerShadowHost() const; | 329 Element* ownerShadowHost() const; |
| 326 // crbug.com/569532: containingShadowRoot() can return nullptr even if isInSha
dowTree() returns true. | 330 // crbug.com/569532: containingShadowRoot() can return nullptr even if |
| 331 // isInShadowTree() returns true. |
| 327 // This can happen when handling queued events (e.g. during execCommand()) | 332 // This can happen when handling queued events (e.g. during execCommand()) |
| 328 ShadowRoot* containingShadowRoot() const; | 333 ShadowRoot* containingShadowRoot() const; |
| 329 ShadowRoot* youngestShadowRoot() const; | 334 ShadowRoot* youngestShadowRoot() const; |
| 330 | 335 |
| 331 // Returns nullptr, a child of ShadowRoot, or a legacy shadow root. | 336 // Returns nullptr, a child of ShadowRoot, or a legacy shadow root. |
| 332 Node* nonBoundaryShadowTreeRootNode(); | 337 Node* nonBoundaryShadowTreeRootNode(); |
| 333 | 338 |
| 334 // Node's parent, shadow tree host. | 339 // Node's parent, shadow tree host. |
| 335 ContainerNode* parentOrShadowHostNode() const; | 340 ContainerNode* parentOrShadowHostNode() const; |
| 336 Element* parentOrShadowHostElement() const; | 341 Element* parentOrShadowHostElement() const; |
| 337 void setParentOrShadowHostNode(ContainerNode*); | 342 void setParentOrShadowHostNode(ContainerNode*); |
| 338 | 343 |
| 339 // Knows about all kinds of hosts. | 344 // Knows about all kinds of hosts. |
| 340 ContainerNode* parentOrShadowHostOrTemplateHostNode() const; | 345 ContainerNode* parentOrShadowHostOrTemplateHostNode() const; |
| 341 | 346 |
| 342 // Returns the parent node, but nullptr if the parent node is a ShadowRoot. | 347 // Returns the parent node, but nullptr if the parent node is a ShadowRoot. |
| 343 ContainerNode* nonShadowBoundaryParentNode() const; | 348 ContainerNode* nonShadowBoundaryParentNode() const; |
| 344 | 349 |
| 345 // Returns the enclosing event parent Element (or self) that, when clicked, wo
uld trigger a navigation. | 350 // Returns the enclosing event parent Element (or self) that, when clicked, |
| 351 // would trigger a navigation. |
| 346 Element* enclosingLinkEventParentOrSelf() const; | 352 Element* enclosingLinkEventParentOrSelf() const; |
| 347 | 353 |
| 348 // These low-level calls give the caller responsibility for maintaining the in
tegrity of the tree. | 354 // These low-level calls give the caller responsibility for maintaining the |
| 355 // integrity of the tree. |
| 349 void setPreviousSibling(Node* previous) { m_previous = previous; } | 356 void setPreviousSibling(Node* previous) { m_previous = previous; } |
| 350 void setNextSibling(Node* next) { m_next = next; } | 357 void setNextSibling(Node* next) { m_next = next; } |
| 351 | 358 |
| 352 virtual bool canContainRangeEndPoint() const { return false; } | 359 virtual bool canContainRangeEndPoint() const { return false; } |
| 353 | 360 |
| 354 // For <link> and <style> elements. | 361 // For <link> and <style> elements. |
| 355 virtual bool sheetLoaded() { return true; } | 362 virtual bool sheetLoaded() { return true; } |
| 356 enum LoadedSheetErrorStatus { | 363 enum LoadedSheetErrorStatus { |
| 357 NoErrorLoadingSubresource, | 364 NoErrorLoadingSubresource, |
| 358 ErrorOccurredLoadingSubresource | 365 ErrorOccurredLoadingSubresource |
| 359 }; | 366 }; |
| 360 virtual void notifyLoadedSheetAndAllCriticalSubresources( | 367 virtual void notifyLoadedSheetAndAllCriticalSubresources( |
| 361 LoadedSheetErrorStatus) {} | 368 LoadedSheetErrorStatus) {} |
| 362 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } | 369 virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); } |
| 363 | 370 |
| 364 bool hasName() const { | 371 bool hasName() const { |
| 365 DCHECK(!isTextNode()); | 372 DCHECK(!isTextNode()); |
| 366 return getFlag(HasNameOrIsEditingTextFlag); | 373 return getFlag(HasNameOrIsEditingTextFlag); |
| 367 } | 374 } |
| 368 | 375 |
| 369 bool isUserActionElement() const { return getFlag(IsUserActionElementFlag); } | 376 bool isUserActionElement() const { return getFlag(IsUserActionElementFlag); } |
| 370 void setUserActionElement(bool flag) { | 377 void setUserActionElement(bool flag) { |
| 371 setFlag(flag, IsUserActionElementFlag); | 378 setFlag(flag, IsUserActionElementFlag); |
| 372 } | 379 } |
| 373 | 380 |
| 374 // TODO(yosin): We should rename |active()| to |isActive()| as |UserActionElem
entSet|. | 381 // TODO(yosin): We should rename |active()| to |isActive()| as |
| 382 // |UserActionElementSet|. |
| 375 bool active() const { | 383 bool active() const { |
| 376 return isUserActionElement() && isUserActionElementActive(); | 384 return isUserActionElement() && isUserActionElementActive(); |
| 377 } | 385 } |
| 378 bool inActiveChain() const { | 386 bool inActiveChain() const { |
| 379 return isUserActionElement() && isUserActionElementInActiveChain(); | 387 return isUserActionElement() && isUserActionElementInActiveChain(); |
| 380 } | 388 } |
| 381 bool isDragged() const { | 389 bool isDragged() const { |
| 382 return isUserActionElement() && isUserActionElementDragged(); | 390 return isUserActionElement() && isUserActionElementDragged(); |
| 383 } | 391 } |
| 384 // TODO(yosin): We should rename |hovered()| to |isHovered()| as |UserActionEl
ementSet|. | 392 // TODO(yosin): We should rename |hovered()| to |isHovered()| as |
| 393 // |UserActionElementSet|. |
| 385 bool hovered() const { | 394 bool hovered() const { |
| 386 return isUserActionElement() && isUserActionElementHovered(); | 395 return isUserActionElement() && isUserActionElementHovered(); |
| 387 } | 396 } |
| 388 // Note: As a shadow host whose root with delegatesFocus=false may become focu
sed state when | 397 // Note: As a shadow host whose root with delegatesFocus=false may become |
| 389 // an inner element gets focused, in that case more than one elements in a doc
ument can return | 398 // focused state when an inner element gets focused, in that case more than |
| 390 // true for |focused()|. Use Element::isFocusedElementInDocument() or Documen
t::focusedElement() | 399 // one elements in a document can return true for |focused()|. Use |
| 391 // to check which element is exactly focused. | 400 // Element::isFocusedElementInDocument() or Document::focusedElement() to |
| 401 // check which element is exactly focused. |
| 392 bool focused() const { | 402 bool focused() const { |
| 393 return isUserActionElement() && isUserActionElementFocused(); | 403 return isUserActionElement() && isUserActionElementFocused(); |
| 394 } | 404 } |
| 395 | 405 |
| 396 bool needsAttach() const { | 406 bool needsAttach() const { |
| 397 return getStyleChangeType() == NeedsReattachStyleChange; | 407 return getStyleChangeType() == NeedsReattachStyleChange; |
| 398 } | 408 } |
| 399 bool needsStyleRecalc() const { | 409 bool needsStyleRecalc() const { |
| 400 return getStyleChangeType() != NoStyleChange; | 410 return getStyleChangeType() != NoStyleChange; |
| 401 } | 411 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // must be recognized as inert to prevent text selection. | 504 // must be recognized as inert to prevent text selection. |
| 495 bool isInert() const; | 505 bool isInert() const; |
| 496 | 506 |
| 497 virtual LayoutRect boundingBox() const; | 507 virtual LayoutRect boundingBox() const; |
| 498 IntRect pixelSnappedBoundingBox() const { | 508 IntRect pixelSnappedBoundingBox() const { |
| 499 return pixelSnappedIntRect(boundingBox()); | 509 return pixelSnappedIntRect(boundingBox()); |
| 500 } | 510 } |
| 501 | 511 |
| 502 unsigned nodeIndex() const; | 512 unsigned nodeIndex() const; |
| 503 | 513 |
| 504 // Returns the DOM ownerDocument attribute. This method never returns null, ex
cept in the case | 514 // Returns the DOM ownerDocument attribute. This method never returns null, |
| 505 // of a Document node. | 515 // except in the case of a Document node. |
| 506 Document* ownerDocument() const; | 516 Document* ownerDocument() const; |
| 507 | 517 |
| 508 // Returns the document associated with this node. A Document node returns its
elf. | 518 // Returns the document associated with this node. A Document node returns |
| 519 // itself. |
| 509 Document& document() const { return treeScope().document(); } | 520 Document& document() const { return treeScope().document(); } |
| 510 | 521 |
| 511 TreeScope& treeScope() const { | 522 TreeScope& treeScope() const { |
| 512 DCHECK(m_treeScope); | 523 DCHECK(m_treeScope); |
| 513 return *m_treeScope; | 524 return *m_treeScope; |
| 514 } | 525 } |
| 515 | 526 |
| 516 TreeScope& containingTreeScope() const { | 527 TreeScope& containingTreeScope() const { |
| 517 DCHECK(isInTreeScope()); | 528 DCHECK(isInTreeScope()); |
| 518 return *m_treeScope; | 529 return *m_treeScope; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 542 virtual bool childTypeAllowed(NodeType) const { return false; } | 553 virtual bool childTypeAllowed(NodeType) const { return false; } |
| 543 unsigned countChildren() const; | 554 unsigned countChildren() const; |
| 544 | 555 |
| 545 bool isDescendantOf(const Node*) const; | 556 bool isDescendantOf(const Node*) const; |
| 546 bool contains(const Node*) const; | 557 bool contains(const Node*) const; |
| 547 bool isShadowIncludingInclusiveAncestorOf(const Node*) const; | 558 bool isShadowIncludingInclusiveAncestorOf(const Node*) const; |
| 548 bool containsIncludingHostElements(const Node&) const; | 559 bool containsIncludingHostElements(const Node&) const; |
| 549 Node* commonAncestor(const Node&, | 560 Node* commonAncestor(const Node&, |
| 550 ContainerNode* (*parent)(const Node&)) const; | 561 ContainerNode* (*parent)(const Node&)) const; |
| 551 | 562 |
| 552 // Number of DOM 16-bit units contained in node. Note that laid out text lengt
h can be different - e.g. because of | 563 // Number of DOM 16-bit units contained in node. Note that laid out text |
| 553 // css-transform:capitalize breaking up precomposed characters and ligatures. | 564 // length can be different - e.g. because of css-transform:capitalize breaking |
| 565 // up precomposed characters and ligatures. |
| 554 virtual int maxCharacterOffset() const; | 566 virtual int maxCharacterOffset() const; |
| 555 | 567 |
| 556 // Whether or not a selection can be started in this object | 568 // Whether or not a selection can be started in this object |
| 557 virtual bool canStartSelection() const; | 569 virtual bool canStartSelection() const; |
| 558 | 570 |
| 559 // ---------------------------------------------------------------------------
-- | 571 // ---------------------------------------------------------------------------
-- |
| 560 // Integration with layout tree | 572 // Integration with layout tree |
| 561 | 573 |
| 562 // As layoutObject() includes a branch you should avoid calling it repeatedly
in hot code paths. | 574 // As layoutObject() includes a branch you should avoid calling it repeatedly |
| 563 // Note that if a Node has a layoutObject, it's parentNode is guaranteed to ha
ve one as well. | 575 // in hot code paths. |
| 576 // Note that if a Node has a layoutObject, it's parentNode is guaranteed to |
| 577 // have one as well. |
| 564 LayoutObject* layoutObject() const { | 578 LayoutObject* layoutObject() const { |
| 565 return hasRareData() ? m_data.m_rareData->layoutObject() | 579 return hasRareData() ? m_data.m_rareData->layoutObject() |
| 566 : m_data.m_layoutObject; | 580 : m_data.m_layoutObject; |
| 567 } | 581 } |
| 568 void setLayoutObject(LayoutObject* layoutObject) { | 582 void setLayoutObject(LayoutObject* layoutObject) { |
| 569 if (hasRareData()) | 583 if (hasRareData()) |
| 570 m_data.m_rareData->setLayoutObject(layoutObject); | 584 m_data.m_rareData->setLayoutObject(layoutObject); |
| 571 else | 585 else |
| 572 m_data.m_layoutObject = layoutObject; | 586 m_data.m_layoutObject = layoutObject; |
| 573 } | 587 } |
| 574 | 588 |
| 575 // Use these two methods with caution. | 589 // Use these two methods with caution. |
| 576 LayoutBox* layoutBox() const; | 590 LayoutBox* layoutBox() const; |
| 577 LayoutBoxModelObject* layoutBoxModelObject() const; | 591 LayoutBoxModelObject* layoutBoxModelObject() const; |
| 578 | 592 |
| 579 struct AttachContext { | 593 struct AttachContext { |
| 580 STACK_ALLOCATED(); | 594 STACK_ALLOCATED(); |
| 581 ComputedStyle* resolvedStyle = nullptr; | 595 ComputedStyle* resolvedStyle = nullptr; |
| 582 bool performingReattach = false; | 596 bool performingReattach = false; |
| 583 bool clearInvalidation = false; | 597 bool clearInvalidation = false; |
| 584 | 598 |
| 585 AttachContext() {} | 599 AttachContext() {} |
| 586 }; | 600 }; |
| 587 | 601 |
| 588 // Attaches this node to the layout tree. This calculates the style to be appl
ied to the node and creates an | 602 // Attaches this node to the layout tree. This calculates the style to be |
| 589 // appropriate LayoutObject which will be inserted into the tree (except when
the style has display: none). This | 603 // applied to the node and creates an appropriate LayoutObject which will be |
| 604 // inserted into the tree (except when the style has display: none). This |
| 590 // makes the node visible in the FrameView. | 605 // makes the node visible in the FrameView. |
| 591 virtual void attachLayoutTree(const AttachContext& = AttachContext()); | 606 virtual void attachLayoutTree(const AttachContext& = AttachContext()); |
| 592 | 607 |
| 593 // Detaches the node from the layout tree, making it invisible in the rendered
view. This method will remove | 608 // Detaches the node from the layout tree, making it invisible in the rendered |
| 594 // the node's layout object from the layout tree and delete it. | 609 // view. This method will remove the node's layout object from the layout tree |
| 610 // and delete it. |
| 595 virtual void detachLayoutTree(const AttachContext& = AttachContext()); | 611 virtual void detachLayoutTree(const AttachContext& = AttachContext()); |
| 596 | 612 |
| 597 void reattachLayoutTree(const AttachContext& = AttachContext()); | 613 void reattachLayoutTree(const AttachContext& = AttachContext()); |
| 598 void lazyReattachIfAttached(); | 614 void lazyReattachIfAttached(); |
| 599 | 615 |
| 600 // Returns true if recalcStyle should be called on the object, if there is suc
h a method (on Document and Element). | 616 // Returns true if recalcStyle should be called on the object, if there is |
| 617 // such a method (on Document and Element). |
| 601 bool shouldCallRecalcStyle(StyleRecalcChange); | 618 bool shouldCallRecalcStyle(StyleRecalcChange); |
| 602 | 619 |
| 603 // Wrapper for nodes that don't have a layoutObject, but still cache the style
(like HTMLOptionElement). | 620 // Wrapper for nodes that don't have a layoutObject, but still cache the style |
| 621 // (like HTMLOptionElement). |
| 604 ComputedStyle* mutableComputedStyle() const; | 622 ComputedStyle* mutableComputedStyle() const; |
| 605 const ComputedStyle* computedStyle() const; | 623 const ComputedStyle* computedStyle() const; |
| 606 const ComputedStyle* parentComputedStyle() const; | 624 const ComputedStyle* parentComputedStyle() const; |
| 607 | 625 |
| 608 const ComputedStyle& computedStyleRef() const; | 626 const ComputedStyle& computedStyleRef() const; |
| 609 | 627 |
| 610 const ComputedStyle* ensureComputedStyle( | 628 const ComputedStyle* ensureComputedStyle( |
| 611 PseudoId pseudoElementSpecifier = PseudoIdNone) { | 629 PseudoId pseudoElementSpecifier = PseudoIdNone) { |
| 612 return virtualEnsureComputedStyle(pseudoElementSpecifier); | 630 return virtualEnsureComputedStyle(pseudoElementSpecifier); |
| 613 } | 631 } |
| 614 | 632 |
| 615 // ---------------------------------------------------------------------------
-- | 633 // ---------------------------------------------------------------------------
-- |
| 616 // Notification of document structure changes (see ContainerNode.h for more no
tification methods) | 634 // Notification of document structure changes (see ContainerNode.h for more |
| 635 // notification methods) |
| 617 // | 636 // |
| 618 // At first, WebKit notifies the node that it has been inserted into the docum
ent. This is called during document parsing, and also | 637 // At first, Blinkt notifies the node that it has been inserted into the |
| 619 // when a node is added through the DOM methods insertBefore(), appendChild()
or replaceChild(). The call happens _after_ the node has been added to the tree. | 638 // document. This is called during document parsing, and also when a node is |
| 620 // This is similar to the DOMNodeInsertedIntoDocument DOM event, but does not
require the overhead of event | 639 // added through the DOM methods insertBefore(), appendChild() or |
| 621 // dispatching. | 640 // replaceChild(). The call happens _after_ the node has been added to the |
| 641 // tree. This is similar to the DOMNodeInsertedIntoDocument DOM event, but |
| 642 // does not require the overhead of event dispatching. |
| 622 // | 643 // |
| 623 // WebKit notifies this callback regardless if the subtree of the node is a do
cument tree or a floating subtree. | 644 // Blink notifies this callback regardless if the subtree of the node is a |
| 624 // Implementation can determine the type of subtree by seeing insertionPoint->
isConnected(). | 645 // document tree or a floating subtree. Implementation can determine the type |
| 625 // For a performance reason, notifications are delivered only to ContainerNode
subclasses if the insertionPoint is out of document. | 646 // of subtree by seeing insertionPoint->isConnected(). For a performance |
| 647 // reason, notifications are delivered only to ContainerNode subclasses if the |
| 648 // insertionPoint is out of document. |
| 626 // | 649 // |
| 627 // There are another callback named didNotifySubtreeInsertionsToDocument(), wh
ich is called after all the descendant is notified, | 650 // There are another callback named didNotifySubtreeInsertionsToDocument(), |
| 628 // if this node was inserted into the document tree. Only a few subclasses act
ually need this. To utilize this, the node should | 651 // which is called after all the descendant is notified, if this node was |
| 629 // return InsertionShouldCallDidNotifySubtreeInsertions from insertedInto(). | 652 // inserted into the document tree. Only a few subclasses actually need |
| 653 // this. To utilize this, the node should return |
| 654 // InsertionShouldCallDidNotifySubtreeInsertions from insertedInto(). |
| 630 // | 655 // |
| 631 enum InsertionNotificationRequest { | 656 enum InsertionNotificationRequest { |
| 632 InsertionDone, | 657 InsertionDone, |
| 633 InsertionShouldCallDidNotifySubtreeInsertions | 658 InsertionShouldCallDidNotifySubtreeInsertions |
| 634 }; | 659 }; |
| 635 | 660 |
| 636 virtual InsertionNotificationRequest insertedInto( | 661 virtual InsertionNotificationRequest insertedInto( |
| 637 ContainerNode* insertionPoint); | 662 ContainerNode* insertionPoint); |
| 638 virtual void didNotifySubtreeInsertionsToDocument() {} | 663 virtual void didNotifySubtreeInsertionsToDocument() {} |
| 639 | 664 |
| 640 // Notifies the node that it is no longer part of the tree. | 665 // Notifies the node that it is no longer part of the tree. |
| 641 // | 666 // |
| 642 // This is a dual of insertedInto(), and is similar to the DOMNodeRemovedFromD
ocument DOM event, but does not require the overhead of event | 667 // This is a dual of insertedInto(), and is similar to the |
| 643 // dispatching, and is called _after_ the node is removed from the tree. | 668 // DOMNodeRemovedFromDocument DOM event, but does not require the overhead of |
| 669 // event dispatching, and is called _after_ the node is removed from the tree. |
| 644 // | 670 // |
| 645 virtual void removedFrom(ContainerNode* insertionPoint); | 671 virtual void removedFrom(ContainerNode* insertionPoint); |
| 646 | 672 |
| 647 // FIXME(dominicc): This method is not debug-only--it is used by | 673 // FIXME(dominicc): This method is not debug-only--it is used by |
| 648 // Tracing--rename it to something indicative. | 674 // Tracing--rename it to something indicative. |
| 649 String debugName() const; | 675 String debugName() const; |
| 650 | 676 |
| 651 #ifndef NDEBUG | 677 #ifndef NDEBUG |
| 652 String toString() const; | 678 String toString() const; |
| 653 String toTreeStringForThis() const; | 679 String toTreeStringForThis() const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 681 ShadowTreesTreatment = TreatShadowTreesAsDisconnected) const; | 707 ShadowTreesTreatment = TreatShadowTreesAsDisconnected) const; |
| 682 | 708 |
| 683 Node* toNode() final; | 709 Node* toNode() final; |
| 684 | 710 |
| 685 const AtomicString& interfaceName() const override; | 711 const AtomicString& interfaceName() const override; |
| 686 ExecutionContext* getExecutionContext() const final; | 712 ExecutionContext* getExecutionContext() const final; |
| 687 | 713 |
| 688 void removeAllEventListeners() override; | 714 void removeAllEventListeners() override; |
| 689 void removeAllEventListenersRecursively(); | 715 void removeAllEventListenersRecursively(); |
| 690 | 716 |
| 691 // Handlers to do/undo actions on the target node before an event is dispatche
d to it and after the event | 717 // Handlers to do/undo actions on the target node before an event is |
| 692 // has been dispatched. The data pointer is handed back by the preDispatch an
d passed to postDispatch. | 718 // dispatched to it and after the event has been dispatched. The data pointer |
| 719 // is handed back by the preDispatch and passed to postDispatch. |
| 693 virtual EventDispatchHandlingState* preDispatchEventHandler(Event*) { | 720 virtual EventDispatchHandlingState* preDispatchEventHandler(Event*) { |
| 694 return nullptr; | 721 return nullptr; |
| 695 } | 722 } |
| 696 virtual void postDispatchEventHandler(Event*, EventDispatchHandlingState*) {} | 723 virtual void postDispatchEventHandler(Event*, EventDispatchHandlingState*) {} |
| 697 | 724 |
| 698 void dispatchScopedEvent(Event*); | 725 void dispatchScopedEvent(Event*); |
| 699 | 726 |
| 700 virtual void handleLocalEvents(Event&); | 727 virtual void handleLocalEvents(Event&); |
| 701 | 728 |
| 702 void dispatchSubtreeModifiedEvent(); | 729 void dispatchSubtreeModifiedEvent(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 NodeRareData* rareData() const; | 893 NodeRareData* rareData() const; |
| 867 NodeRareData& ensureRareData(); | 894 NodeRareData& ensureRareData(); |
| 868 | 895 |
| 869 void setHasCustomStyleCallbacks() { | 896 void setHasCustomStyleCallbacks() { |
| 870 setFlag(true, HasCustomStyleCallbacksFlag); | 897 setFlag(true, HasCustomStyleCallbacksFlag); |
| 871 } | 898 } |
| 872 | 899 |
| 873 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } | 900 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } |
| 874 | 901 |
| 875 // isTreeScopeInitialized() can be false | 902 // isTreeScopeInitialized() can be false |
| 876 // - in the destruction of Document or ShadowRoot where m_treeScope is set to
null or | 903 // - in the destruction of Document or ShadowRoot where m_treeScope is set to |
| 877 // - in the Node constructor called by these two classes where m_treeScope is
set by TreeScope ctor. | 904 // null or |
| 905 // - in the Node constructor called by these two classes where m_treeScope is |
| 906 // set by TreeScope ctor. |
| 878 bool isTreeScopeInitialized() const { return m_treeScope; } | 907 bool isTreeScopeInitialized() const { return m_treeScope; } |
| 879 | 908 |
| 880 void markAncestorsWithChildNeedsStyleRecalc(); | 909 void markAncestorsWithChildNeedsStyleRecalc(); |
| 881 | 910 |
| 882 void setIsFinishedParsingChildren(bool value) { | 911 void setIsFinishedParsingChildren(bool value) { |
| 883 setFlag(value, IsFinishedParsingChildrenFlag); | 912 setFlag(value, IsFinishedParsingChildrenFlag); |
| 884 } | 913 } |
| 885 | 914 |
| 886 private: | 915 private: |
| 887 // Gets nodeName without caching AtomicStrings. Used by | 916 // Gets nodeName without caching AtomicStrings. Used by |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 } // namespace blink | 1025 } // namespace blink |
| 997 | 1026 |
| 998 #ifndef NDEBUG | 1027 #ifndef NDEBUG |
| 999 // Outside the WebCore namespace for ease of invocation from gdb. | 1028 // Outside the WebCore namespace for ease of invocation from gdb. |
| 1000 void showNode(const blink::Node*); | 1029 void showNode(const blink::Node*); |
| 1001 void showTree(const blink::Node*); | 1030 void showTree(const blink::Node*); |
| 1002 void showNodePath(const blink::Node*); | 1031 void showNodePath(const blink::Node*); |
| 1003 #endif | 1032 #endif |
| 1004 | 1033 |
| 1005 #endif // Node_h | 1034 #endif // Node_h |
| OLD | NEW |