Changeset 137119 in webkit
- Timestamp:
- Dec 10, 2012 1:03:06 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r137114 r137119 1 2012-12-10 Hajime Morrita <morrita@google.com> 2 3 [Shadow DOM][Refacdtoring] nextTo() and previousTo() can be part of ContentDistribution 4 https://bugs.webkit.org/show_bug.cgi?id=104514 5 6 Reviewed by Kentaro Hara. 7 8 InsertionPoint::nextTo() and InsertionPoint::previousTo() are an 9 query to distributed nodes, which is what ContentDistribution 10 represents. We can move them to better home. 11 12 No new tests. No behavior change. 13 14 * html/shadow/ContentDistributor.cpp: 15 (WebCore::ContentDistribution::nextTo): Moved from InsertionPoint 16 (WebCore): 17 (WebCore::ContentDistribution::previousTo): Moved from InsertionPoint 18 * html/shadow/ContentDistributor.h: 19 (ContentDistribution): 20 * html/shadow/InsertionPoint.cpp: 21 * html/shadow/InsertionPoint.h: 22 (WebCore::InsertionPoint::nextTo): Delegated to ContentDistribution 23 (WebCore::InsertionPoint::previousTo): Delegated to ContentDistribution 24 1 25 2012-12-10 Joanmarie Diggs <jdiggs@igalia.com> 2 26 -
trunk/Source/WebCore/html/shadow/ContentDistributor.cpp
r136924 r137119 59 59 } 60 60 61 Node* ContentDistribution::nextTo(const Node* node) const 62 { 63 size_t index = find(node); 64 if (index == notFound || index + 1 == size()) 65 return 0; 66 return at(index + 1).get(); 67 } 68 69 Node* ContentDistribution::previousTo(const Node* node) const 70 { 71 size_t index = find(node); 72 if (index == notFound || !index) 73 return 0; 74 return at(index - 1).get(); 75 } 76 77 61 78 ShadowRootContentDistributionData::ShadowRootContentDistributionData() 62 79 : m_insertionPointAssignedTo(0) -
trunk/Source/WebCore/html/shadow/ContentDistributor.h
r136098 r137119 59 59 bool contains(const Node* node) const { return m_indices.contains(node); } 60 60 size_t find(const Node*) const; 61 Node* nextTo(const Node*) const; 62 Node* previousTo(const Node*) const; 61 63 62 64 void swap(ContentDistribution& other); -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r137112 r137119 113 113 } 114 114 115 Node* InsertionPoint::nextTo(const Node* node) const116 {117 size_t index = m_distribution.find(node);118 if (index == notFound || index + 1 == m_distribution.size())119 return 0;120 return m_distribution.at(index + 1).get();121 }122 123 Node* InsertionPoint::previousTo(const Node* node) const124 {125 size_t index = m_distribution.find(node);126 if (index == notFound || !index)127 return 0;128 return m_distribution.at(index - 1).get();129 }130 131 115 void InsertionPoint::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) 132 116 { -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r137112 r137119 72 72 Node* first() const { return m_distribution.isEmpty() ? 0 : m_distribution.first().get(); } 73 73 Node* last() const { return m_distribution.isEmpty() ? 0 : m_distribution.last().get(); } 74 Node* nextTo(const Node* ) const;75 Node* previousTo(const Node* ) const;74 Node* nextTo(const Node* node) const { return m_distribution.nextTo(node); } 75 Node* previousTo(const Node* node) const { return m_distribution.previousTo(node); } 76 76 77 77 protected:
Note: See TracChangeset
for help on using the changeset viewer.