Title: [137119] trunk/Source/WebCore
- Revision
- 137119
- Author
- morr...@google.com
- Date
- 2012-12-10 01:03:06 -0800 (Mon, 10 Dec 2012)
Log Message
[Shadow DOM][Refacdtoring] nextTo() and previousTo() can be part of ContentDistribution
https://bugs.webkit.org/show_bug.cgi?id=104514
Reviewed by Kentaro Hara.
InsertionPoint::nextTo() and InsertionPoint::previousTo() are an
query to distributed nodes, which is what ContentDistribution
represents. We can move them to better home.
No new tests. No behavior change.
* html/shadow/ContentDistributor.cpp:
(WebCore::ContentDistribution::nextTo): Moved from InsertionPoint
(WebCore):
(WebCore::ContentDistribution::previousTo): Moved from InsertionPoint
* html/shadow/ContentDistributor.h:
(ContentDistribution):
* html/shadow/InsertionPoint.cpp:
* html/shadow/InsertionPoint.h:
(WebCore::InsertionPoint::nextTo): Delegated to ContentDistribution
(WebCore::InsertionPoint::previousTo): Delegated to ContentDistribution
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (137118 => 137119)
--- trunk/Source/WebCore/ChangeLog 2012-12-10 08:42:40 UTC (rev 137118)
+++ trunk/Source/WebCore/ChangeLog 2012-12-10 09:03:06 UTC (rev 137119)
@@ -1,3 +1,27 @@
+2012-12-10 Hajime Morrita <morr...@google.com>
+
+ [Shadow DOM][Refacdtoring] nextTo() and previousTo() can be part of ContentDistribution
+ https://bugs.webkit.org/show_bug.cgi?id=104514
+
+ Reviewed by Kentaro Hara.
+
+ InsertionPoint::nextTo() and InsertionPoint::previousTo() are an
+ query to distributed nodes, which is what ContentDistribution
+ represents. We can move them to better home.
+
+ No new tests. No behavior change.
+
+ * html/shadow/ContentDistributor.cpp:
+ (WebCore::ContentDistribution::nextTo): Moved from InsertionPoint
+ (WebCore):
+ (WebCore::ContentDistribution::previousTo): Moved from InsertionPoint
+ * html/shadow/ContentDistributor.h:
+ (ContentDistribution):
+ * html/shadow/InsertionPoint.cpp:
+ * html/shadow/InsertionPoint.h:
+ (WebCore::InsertionPoint::nextTo): Delegated to ContentDistribution
+ (WebCore::InsertionPoint::previousTo): Delegated to ContentDistribution
+
2012-12-10 Joanmarie Diggs <jdi...@igalia.com>
[GTK] accessibility/language-attribute.html is failing
Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.cpp (137118 => 137119)
--- trunk/Source/WebCore/html/shadow/ContentDistributor.cpp 2012-12-10 08:42:40 UTC (rev 137118)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.cpp 2012-12-10 09:03:06 UTC (rev 137119)
@@ -58,6 +58,23 @@
return it.get()->value;
}
+Node* ContentDistribution::nextTo(const Node* node) const
+{
+ size_t index = find(node);
+ if (index == notFound || index + 1 == size())
+ return 0;
+ return at(index + 1).get();
+}
+
+Node* ContentDistribution::previousTo(const Node* node) const
+{
+ size_t index = find(node);
+ if (index == notFound || !index)
+ return 0;
+ return at(index - 1).get();
+}
+
+
ShadowRootContentDistributionData::ShadowRootContentDistributionData()
: m_insertionPointAssignedTo(0)
, m_numberOfShadowElementChildren(0)
Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.h (137118 => 137119)
--- trunk/Source/WebCore/html/shadow/ContentDistributor.h 2012-12-10 08:42:40 UTC (rev 137118)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.h 2012-12-10 09:03:06 UTC (rev 137119)
@@ -58,6 +58,8 @@
bool contains(const Node* node) const { return m_indices.contains(node); }
size_t find(const Node*) const;
+ Node* nextTo(const Node*) const;
+ Node* previousTo(const Node*) const;
void swap(ContentDistribution& other);
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (137118 => 137119)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-12-10 08:42:40 UTC (rev 137118)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-12-10 09:03:06 UTC (rev 137119)
@@ -112,22 +112,6 @@
return !isShadowBoundary() && HTMLElement::rendererIsNeeded(context);
}
-Node* InsertionPoint::nextTo(const Node* node) const
-{
- size_t index = m_distribution.find(node);
- if (index == notFound || index + 1 == m_distribution.size())
- return 0;
- return m_distribution.at(index + 1).get();
-}
-
-Node* InsertionPoint::previousTo(const Node* node) const
-{
- size_t index = m_distribution.find(node);
- if (index == notFound || !index)
- return 0;
- return m_distribution.at(index - 1).get();
-}
-
void InsertionPoint::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (137118 => 137119)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-12-10 08:42:40 UTC (rev 137118)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-12-10 09:03:06 UTC (rev 137119)
@@ -71,8 +71,8 @@
Node* at(size_t index) const { return m_distribution.at(index).get(); }
Node* first() const { return m_distribution.isEmpty() ? 0 : m_distribution.first().get(); }
Node* last() const { return m_distribution.isEmpty() ? 0 : m_distribution.last().get(); }
- Node* nextTo(const Node*) const;
- Node* previousTo(const Node*) const;
+ Node* nextTo(const Node* node) const { return m_distribution.nextTo(node); }
+ Node* previousTo(const Node* node) const { return m_distribution.previousTo(node); }
protected:
InsertionPoint(const QualifiedName&, Document*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes