Title: [185682] trunk/Source/WebCore
- Revision
- 185682
- Author
- [email protected]
- Date
- 2015-06-17 17:49:54 -0700 (Wed, 17 Jun 2015)
Log Message
Position::findParent() should take a reference
https://bugs.webkit.org/show_bug.cgi?id=146038
Reviewed by Darin Adler.
* dom/Position.cpp:
(WebCore::Position::containerNode):
(WebCore::Position::parentAnchoredEquivalent):
Pass a reference; there is already a null check.
(WebCore::Position::previous):
Add a missing null check. Code below this expects that node is non-null.
(WebCore::Position::next):
Ditto.
(WebCore::Position::atStartOfTree):
(WebCore::Position::atEndOfTree):
Pass a reference.
(WebCore::Position::findParent):
Changed to take a reference.
* dom/Position.h:
Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185681 => 185682)
--- trunk/Source/WebCore/ChangeLog 2015-06-18 00:32:33 UTC (rev 185681)
+++ trunk/Source/WebCore/ChangeLog 2015-06-18 00:49:54 UTC (rev 185682)
@@ -1,3 +1,27 @@
+2015-06-16 Jon Honeycutt <[email protected]>
+
+ Position::findParent() should take a reference
+ https://bugs.webkit.org/show_bug.cgi?id=146038
+
+ Reviewed by Darin Adler.
+
+ * dom/Position.cpp:
+ (WebCore::Position::containerNode):
+ (WebCore::Position::parentAnchoredEquivalent):
+ Pass a reference; there is already a null check.
+ (WebCore::Position::previous):
+ Add a missing null check. Code below this expects that node is non-null.
+ (WebCore::Position::next):
+ Ditto.
+ (WebCore::Position::atStartOfTree):
+ (WebCore::Position::atEndOfTree):
+ Pass a reference.
+ (WebCore::Position::findParent):
+ Changed to take a reference.
+
+ * dom/Position.h:
+ Ditto.
+
2015-06-17 Brent Fulgham <[email protected]>
Overflow regions with scroll snap points are not reliably rubber banding
Modified: trunk/Source/WebCore/dom/Position.cpp (185681 => 185682)
--- trunk/Source/WebCore/dom/Position.cpp 2015-06-18 00:32:33 UTC (rev 185681)
+++ trunk/Source/WebCore/dom/Position.cpp 2015-06-18 00:49:54 UTC (rev 185682)
@@ -162,7 +162,7 @@
return m_anchorNode.get();
case PositionIsBeforeAnchor:
case PositionIsAfterAnchor:
- return findParent(m_anchorNode.get());
+ return findParent(*m_anchorNode);
}
ASSERT_NOT_REACHED();
return nullptr;
@@ -222,7 +222,7 @@
// FIXME: This should only be necessary for legacy positions, but is also needed for positions before and after Tables
if (m_offset <= 0 && (m_anchorType != PositionIsAfterAnchor && m_anchorType != PositionIsAfterChildren)) {
- if (findParent(m_anchorNode.get()) && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get())))
+ if (findParent(*m_anchorNode) && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get())))
return positionInParentBeforeNode(m_anchorNode.get());
return Position(m_anchorNode.get(), 0, PositionIsOffsetInAnchor);
}
@@ -310,6 +310,9 @@
if (anchorType() == PositionIsBeforeAnchor) {
node = containerNode();
+ if (!node)
+ return *this;
+
offset = computeOffsetInContainerNode();
}
@@ -332,7 +335,7 @@
}
}
- ContainerNode* parent = findParent(node);
+ ContainerNode* parent = findParent(*node);
if (!parent)
return *this;
@@ -360,6 +363,9 @@
if (anchorType() == PositionIsAfterAnchor) {
node = containerNode();
+ if (!node)
+ return *this;
+
offset = computeOffsetInContainerNode();
}
@@ -376,7 +382,7 @@
return createLegacyEditingPosition(node, (moveType == Character) ? uncheckedNextOffset(node, offset) : offset + 1);
}
- ContainerNode* parent = findParent(node);
+ ContainerNode* parent = findParent(*node);
if (!parent)
return *this;
@@ -478,7 +484,7 @@
return true;
Node* container = containerNode();
- if (container && findParent(container))
+ if (container && findParent(*container))
return false;
switch (m_anchorType) {
@@ -503,7 +509,7 @@
return true;
Node* container = containerNode();
- if (container && findParent(container))
+ if (container && findParent(*container))
return false;
switch (m_anchorType) {
@@ -938,9 +944,9 @@
return node && node->renderer() && node->renderer()->style().userSelect() == SELECT_NONE;
}
-ContainerNode* Position::findParent(const Node* node)
+ContainerNode* Position::findParent(const Node& node)
{
- return node->nonShadowBoundaryParentNode();
+ return node.nonShadowBoundaryParentNode();
}
#if ENABLE(USERSELECT_ALL)
Modified: trunk/Source/WebCore/dom/Position.h (185681 => 185682)
--- trunk/Source/WebCore/dom/Position.h 2015-06-18 00:32:33 UTC (rev 185681)
+++ trunk/Source/WebCore/dom/Position.h 2015-06-18 00:49:54 UTC (rev 185682)
@@ -198,7 +198,7 @@
static bool nodeIsUserSelectAll(const Node*) { return false; }
static Node* rootUserSelectAllForNode(Node*) { return 0; }
#endif
- static ContainerNode* findParent(const Node*);
+ static ContainerNode* findParent(const Node&);
void debugPosition(const char* msg = "") const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes