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

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

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No longer FAIL: imported/wpt/shadow-dom/HTMLSlotElement-interface.html Created 4 years, 6 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. (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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); } 288 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); }
289 289
290 bool isDocumentNode() const; 290 bool isDocumentNode() const;
291 bool isTreeScope() const; 291 bool isTreeScope() const;
292 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } 292 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
293 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } 293 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }
294 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } 294 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); }
295 295
296 bool canParticipateInFlatTree() const; 296 bool canParticipateInFlatTree() const;
297 bool isSlotOrActiveInsertionPoint() const; 297 bool isSlotOrActiveInsertionPoint() const;
298 bool slottable() const { return isElementNode() || isTextNode(); } 298 // A re-distribution across v0 and v1 shadow trees is not supported.
299 bool isSlotable() const { return isTextNode() || (isElementNode() && !isInse rtionPoint()); }
299 AtomicString slotName() const; 300 AtomicString slotName() const;
300 301
301 static AtomicString normalizeSlotName(const AtomicString&);
302
303 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); } 302 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback sFlag); }
304 303
305 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret urns nullptr. 304 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret urns nullptr.
306 // TODO(kochi): crbug.com/507413 shadowHost() can return nullptr even when i t is in a 305 // TODO(kochi): crbug.com/507413 shadowHost() can return nullptr even when i t is in a
307 // shadow tree but its root is detached from its host. This can happen when handling 306 // shadow tree but its root is detached from its host. This can happen when handling
308 // queued events (e.g. during execCommand()). 307 // queued events (e.g. during execCommand()).
309 Element* shadowHost() const; 308 Element* shadowHost() const;
310 // crbug.com/569532: containingShadowRoot() can return nullptr even if isInS hadowTree() returns true. 309 // crbug.com/569532: containingShadowRoot() can return nullptr even if isInS hadowTree() returns true.
311 // This can happen when handling queued events (e.g. during execCommand()) 310 // This can happen when handling queued events (e.g. during execCommand())
312 ShadowRoot* containingShadowRoot() const; 311 ShadowRoot* containingShadowRoot() const;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 bool isLink() const { return getFlag(IsLinkFlag); } 368 bool isLink() const { return getFlag(IsLinkFlag); }
370 bool isEditingText() const { DCHECK(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); } 369 bool isEditingText() const { DCHECK(isTextNode()); return getFlag(HasNameOrI sEditingTextFlag); }
371 370
372 void setHasName(bool f) { DCHECK(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); } 371 void setHasName(bool f) { DCHECK(!isTextNode()); setFlag(f, HasNameOrIsEditi ngTextFlag); }
373 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); } 372 void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
374 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); } 373 void clearChildNeedsStyleRecalc() { clearFlag(ChildNeedsStyleRecalcFlag); }
375 374
376 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& ); 375 void setNeedsStyleRecalc(StyleChangeType, const StyleChangeReasonForTracing& );
377 void clearNeedsStyleRecalc(); 376 void clearNeedsStyleRecalc();
378 377
379 #if DCHECK_IS_ON()
380 bool needsDistributionRecalc() const; 378 bool needsDistributionRecalc() const;
381 #endif
382 379
383 bool childNeedsDistributionRecalc() const { return getFlag(ChildNeedsDistrib utionRecalcFlag); } 380 bool childNeedsDistributionRecalc() const { return getFlag(ChildNeedsDistrib utionRecalcFlag); }
384 void setChildNeedsDistributionRecalc() { setFlag(ChildNeedsDistributionReca lcFlag); } 381 void setChildNeedsDistributionRecalc() { setFlag(ChildNeedsDistributionReca lcFlag); }
385 void clearChildNeedsDistributionRecalc() { clearFlag(ChildNeedsDistribution RecalcFlag); } 382 void clearChildNeedsDistributionRecalc() { clearFlag(ChildNeedsDistribution RecalcFlag); }
386 void markAncestorsWithChildNeedsDistributionRecalc(); 383 void markAncestorsWithChildNeedsDistributionRecalc();
387 384
388 bool childNeedsStyleInvalidation() const { return getFlag(ChildNeedsStyleInv alidationFlag); } 385 bool childNeedsStyleInvalidation() const { return getFlag(ChildNeedsStyleInv alidationFlag); }
389 void setChildNeedsStyleInvalidation() { setFlag(ChildNeedsStyleInvalidation Flag); } 386 void setChildNeedsStyleInvalidation() { setFlag(ChildNeedsStyleInvalidation Flag); }
390 void clearChildNeedsStyleInvalidation() { clearFlag(ChildNeedsStyleInvalida tionFlag); } 387 void clearChildNeedsStyleInvalidation() { clearFlag(ChildNeedsStyleInvalida tionFlag); }
391 void markAncestorsWithChildNeedsStyleInvalidation(); 388 void markAncestorsWithChildNeedsStyleInvalidation();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return getFlag(InDocumentFlag); 480 return getFlag(InDocumentFlag);
484 } 481 }
485 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } 482 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); }
486 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } 483 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); }
487 484
488 ElementShadow* parentElementShadow() const; 485 ElementShadow* parentElementShadow() const;
489 bool isInV1ShadowTree() const; 486 bool isInV1ShadowTree() const;
490 bool isInV0ShadowTree() const; 487 bool isInV0ShadowTree() const;
491 bool isChildOfV1ShadowHost() const; 488 bool isChildOfV1ShadowHost() const;
492 bool isChildOfV0ShadowHost() const; 489 bool isChildOfV0ShadowHost() const;
493 bool isSlotAssignable() const { return isTextNode() || isElementNode(); } 490 ShadowRoot* v1ShadowRootOfParent() const;
494 491
495 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; } 492 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; }
496 virtual bool childTypeAllowed(NodeType) const { return false; } 493 virtual bool childTypeAllowed(NodeType) const { return false; }
497 unsigned countChildren() const; 494 unsigned countChildren() const;
498 495
499 bool isDescendantOf(const Node*) const; 496 bool isDescendantOf(const Node*) const;
500 bool contains(const Node*) const; 497 bool contains(const Node*) const;
501 bool isShadowIncludingInclusiveAncestorOf(const Node*) const; 498 bool isShadowIncludingInclusiveAncestorOf(const Node*) const;
502 bool containsIncludingHostElements(const Node&) const; 499 bool containsIncludingHostElements(const Node&) const;
503 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st; 500 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 666
670 StaticNodeList* getDestinationInsertionPoints(); 667 StaticNodeList* getDestinationInsertionPoints();
671 HTMLSlotElement* assignedSlot() const; 668 HTMLSlotElement* assignedSlot() const;
672 HTMLSlotElement* assignedSlotForBinding(); 669 HTMLSlotElement* assignedSlotForBinding();
673 670
674 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); } 671 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); }
675 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } 672 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); }
676 673
677 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); } 674 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); }
678 675
679 void updateAssignmentForInsertedInto(ContainerNode*); 676 void checkSlotChangeAfterInserted() { checkSlotChange(); }
677 void checkSlotChangeBeforeRemoved() { checkSlotChange(); }
680 678
681 DECLARE_VIRTUAL_TRACE(); 679 DECLARE_VIRTUAL_TRACE();
682 680
683 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 681 DECLARE_VIRTUAL_TRACE_WRAPPERS();
684 682
685 unsigned lengthOfContents() const; 683 unsigned lengthOfContents() const;
686 684
687 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) override; 685 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) override;
688 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; 686 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN;
689 687
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); } 788 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); }
791 789
792 private: 790 private:
793 // Gets nodeName without caching AtomicStrings. Used by 791 // Gets nodeName without caching AtomicStrings. Used by
794 // debugName. Compositor may call debugName from the "impl" thread 792 // debugName. Compositor may call debugName from the "impl" thread
795 // during "commit". The main thread is stopped at that time, but 793 // during "commit". The main thread is stopped at that time, but
796 // it is not safe to cache AtomicStrings because those are 794 // it is not safe to cache AtomicStrings because those are
797 // per-thread. 795 // per-thread.
798 virtual String debugNodeName() const; 796 virtual String debugNodeName() const;
799 797
798 void checkSlotChange();
799
800 enum EditableLevel { Editable, RichlyEditable }; 800 enum EditableLevel { Editable, RichlyEditable };
801 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const; 801 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const;
802 bool isEditableToAccessibility(EditableLevel) const; 802 bool isEditableToAccessibility(EditableLevel) const;
803 803
804 bool isUserActionElementActive() const; 804 bool isUserActionElementActive() const;
805 bool isUserActionElementInActiveChain() const; 805 bool isUserActionElementInActiveChain() const;
806 bool isUserActionElementHovered() const; 806 bool isUserActionElementHovered() const;
807 bool isUserActionElementFocused() const; 807 bool isUserActionElementFocused() const;
808 808
809 void recalcDistribution(); 809 void recalcDistribution();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } // namespace blink 914 } // namespace blink
915 915
916 #ifndef NDEBUG 916 #ifndef NDEBUG
917 // Outside the WebCore namespace for ease of invocation from gdb. 917 // Outside the WebCore namespace for ease of invocation from gdb.
918 void showNode(const blink::Node*); 918 void showNode(const blink::Node*);
919 void showTree(const blink::Node*); 919 void showTree(const blink::Node*);
920 void showNodePath(const blink::Node*); 920 void showNodePath(const blink::Node*);
921 #endif 921 #endif
922 922
923 #endif // Node_h 923 #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