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

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: wip Created 4 years, 7 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return getFlag(InDocumentFlag); 482 return getFlag(InDocumentFlag);
484 } 483 }
485 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); } 484 bool isInShadowTree() const { return getFlag(IsInShadowTreeFlag); }
486 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); } 485 bool isInTreeScope() const { return getFlag(static_cast<NodeFlags>(InDocumen tFlag | IsInShadowTreeFlag)); }
487 486
488 ElementShadow* parentElementShadow() const; 487 ElementShadow* parentElementShadow() const;
489 bool isInV1ShadowTree() const; 488 bool isInV1ShadowTree() const;
490 bool isInV0ShadowTree() const; 489 bool isInV0ShadowTree() const;
491 bool isChildOfV1ShadowHost() const; 490 bool isChildOfV1ShadowHost() const;
492 bool isChildOfV0ShadowHost() const; 491 bool isChildOfV0ShadowHost() const;
493 bool isSlotAssignable() const { return isTextNode() || isElementNode(); } 492 ShadowRoot* v1ShadowRootOfParent() const;
494 493
495 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; } 494 bool isDocumentTypeNode() const { return getNodeType() == DOCUMENT_TYPE_NODE ; }
496 virtual bool childTypeAllowed(NodeType) const { return false; } 495 virtual bool childTypeAllowed(NodeType) const { return false; }
497 unsigned countChildren() const; 496 unsigned countChildren() const;
498 497
499 bool isDescendantOf(const Node*) const; 498 bool isDescendantOf(const Node*) const;
500 bool contains(const Node*) const; 499 bool contains(const Node*) const;
501 bool isShadowIncludingInclusiveAncestorOf(const Node*) const; 500 bool isShadowIncludingInclusiveAncestorOf(const Node*) const;
502 bool containsIncludingHostElements(const Node&) const; 501 bool containsIncludingHostElements(const Node&) const;
503 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st; 502 Node* commonAncestor(const Node&, ContainerNode* (*parent)(const Node&)) con st;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 668
670 StaticNodeList* getDestinationInsertionPoints(); 669 StaticNodeList* getDestinationInsertionPoints();
671 HTMLSlotElement* assignedSlot() const; 670 HTMLSlotElement* assignedSlot() const;
672 HTMLSlotElement* assignedSlotForBinding(); 671 HTMLSlotElement* assignedSlotForBinding();
673 672
674 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); } 673 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); }
675 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } 674 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); }
676 675
677 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); } 676 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); }
678 677
679 void updateAssignmentForInsertedInto(ContainerNode*); 678 void checkSlotChangeAfterInserted() { checkSlotChange(); }
679 void checkSlotChangeBeforeRemoved() { checkSlotChange(); }
680 680
681 DECLARE_VIRTUAL_TRACE(); 681 DECLARE_VIRTUAL_TRACE();
682 682
683 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 683 DECLARE_VIRTUAL_TRACE_WRAPPERS();
684 684
685 unsigned lengthOfContents() const; 685 unsigned lengthOfContents() const;
686 686
687 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte xt) override; 687 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; 688 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN;
689 689
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); } 790 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); }
791 791
792 private: 792 private:
793 // Gets nodeName without caching AtomicStrings. Used by 793 // Gets nodeName without caching AtomicStrings. Used by
794 // debugName. Compositor may call debugName from the "impl" thread 794 // debugName. Compositor may call debugName from the "impl" thread
795 // during "commit". The main thread is stopped at that time, but 795 // during "commit". The main thread is stopped at that time, but
796 // it is not safe to cache AtomicStrings because those are 796 // it is not safe to cache AtomicStrings because those are
797 // per-thread. 797 // per-thread.
798 virtual String debugNodeName() const; 798 virtual String debugNodeName() const;
799 799
800 void checkSlotChange();
801
800 enum EditableLevel { Editable, RichlyEditable }; 802 enum EditableLevel { Editable, RichlyEditable };
801 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const; 803 bool hasEditableStyle(EditableLevel, UserSelectAllTreatment = UserSelectAllI sAlwaysNonEditable) const;
802 bool isEditableToAccessibility(EditableLevel) const; 804 bool isEditableToAccessibility(EditableLevel) const;
803 805
804 bool isUserActionElementActive() const; 806 bool isUserActionElementActive() const;
805 bool isUserActionElementInActiveChain() const; 807 bool isUserActionElementInActiveChain() const;
806 bool isUserActionElementHovered() const; 808 bool isUserActionElementHovered() const;
807 bool isUserActionElementFocused() const; 809 bool isUserActionElementFocused() const;
808 810
809 void recalcDistribution(); 811 void recalcDistribution();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } // namespace blink 916 } // namespace blink
915 917
916 #ifndef NDEBUG 918 #ifndef NDEBUG
917 // Outside the WebCore namespace for ease of invocation from gdb. 919 // Outside the WebCore namespace for ease of invocation from gdb.
918 void showNode(const blink::Node*); 920 void showNode(const blink::Node*);
919 void showTree(const blink::Node*); 921 void showTree(const blink::Node*);
920 void showNodePath(const blink::Node*); 922 void showNodePath(const blink::Node*);
921 #endif 923 #endif
922 924
923 #endif // Node_h 925 #endif // Node_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698