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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.h

Issue 1760153002: Check slot's distribution state more strictly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 9 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) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n ullptr : m_distributedNodes.first().get(); } 50 Node* firstDistributedNode() const { return m_distributedNodes.isEmpty() ? n ullptr : m_distributedNodes.first().get(); }
51 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu llptr : m_distributedNodes.last().get(); } 51 Node* lastDistributedNode() const { return m_distributedNodes.isEmpty() ? nu llptr : m_distributedNodes.last().get(); }
52 52
53 Node* distributedNodeNextTo(const Node&) const; 53 Node* distributedNodeNextTo(const Node&) const;
54 Node* distributedNodePreviousTo(const Node&) const; 54 Node* distributedNodePreviousTo(const Node&) const;
55 55
56 void appendAssignedNode(Node&); 56 void appendAssignedNode(Node&);
57 void appendDistributedNode(Node&); 57 void appendDistributedNode(Node&);
58 void appendDistributedNodesFrom(const HTMLSlotElement& other); 58 void appendDistributedNodesFrom(const HTMLSlotElement& other);
59 void clearDistribution(); 59 void willUpdateDistribution();
kochi 2016/03/04 03:49:07 nit: Looking at usages, I'd think renaming willUpd
60 60
61 bool hasSlotChangeEventListener(); 61 bool hasSlotChangeEventListener();
62 62
63 void updateDistributedNodesWithFallback(); 63 void updateDistributedNodesWithFallback();
64 void didUpdateDistribution(); 64 void didUpdateDistribution();
65 65
66 void attach(const AttachContext& = AttachContext()) final; 66 void attach(const AttachContext& = AttachContext()) final;
67 void detach(const AttachContext& = AttachContext()) final; 67 void detach(const AttachContext& = AttachContext()) final;
68 68
69 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina l; 69 void attributeChanged(const QualifiedName&, const AtomicString& oldValue, co nst AtomicString& newValue, AttributeModificationReason = ModifiedDirectly) fina l;
70 70
71 DECLARE_VIRTUAL_TRACE(); 71 DECLARE_VIRTUAL_TRACE();
72 72
73 private: 73 private:
74 HTMLSlotElement(Document&); 74 HTMLSlotElement(Document&);
75 75
76 enum DistributionState { 76 enum DistributionState {
77 DistributionReset, 77 DistributionOnGoing,
78 DistributionDone,
78 DistributionChanged, 79 DistributionChanged,
79 DistributionUnchanged 80 DistributionUnchanged
80 }; 81 };
81 82
83 void clearDistribution();
82 void childrenChanged(const ChildrenChange&) final; 84 void childrenChanged(const ChildrenChange&) final;
83 InsertionNotificationRequest insertedInto(ContainerNode*) final; 85 InsertionNotificationRequest insertedInto(ContainerNode*) final;
84 void removedFrom(ContainerNode*) final; 86 void removedFrom(ContainerNode*) final;
85 void willRecalcStyle(StyleRecalcChange) final; 87 void willRecalcStyle(StyleRecalcChange) final;
86 88
87 void dispatchSlotChangeEvent(); 89 void dispatchSlotChangeEvent();
88 bool distributionChanged(); 90 bool distributionChanged();
89 91
90 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes; 92 WillBeHeapVector<RefPtrWillBeMember<Node>> m_assignedNodes;
91 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes; 93 WillBeHeapVector<RefPtrWillBeMember<Node>> m_distributedNodes;
92 WillBeHeapHashMap<RawPtrWillBeMember<const Node>, size_t> m_distributedIndic es; 94 WillBeHeapHashMap<RawPtrWillBeMember<const Node>, size_t> m_distributedIndic es;
93 // TODO(hayato): Remove m_oldDistibutedNodes and make SlotAssignment check t he diffirence between old and new distributed nodes for each slot to save the me mories. 95 // TODO(hayato): Remove m_oldDistibutedNodes and make SlotAssignment check t he diffirence between old and new distributed nodes for each slot to save the me mories.
94 WillBeHeapVector<RefPtrWillBeMember<Node>> m_oldDistributedNodes; 96 WillBeHeapVector<RefPtrWillBeMember<Node>> m_oldDistributedNodes;
95 DistributionState m_distributionState; 97 DistributionState m_distributionState;
96 }; 98 };
97 99
98 } // namespace blink 100 } // namespace blink
99 101
100 #endif // HTMLSlotElement_h 102 #endif // HTMLSlotElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698