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

Unified Diff: Source/core/dom/Position.cpp

Issue 24278008: [oilpan] Handlify Nodes in htmlediting (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Position.cpp
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
index 4ea2de5eba9fe976180fb9707d6a5165ed701b86..1efff5ed8300a59fdceb3de35b7589e0c7def4f4 100644
--- a/Source/core/dom/Position.cpp
+++ b/Source/core/dom/Position.cpp
@@ -98,7 +98,7 @@ Position::Position(const Handle<Node>& anchorNode, AnchorType anchorType)
ASSERT(anchorType != PositionIsOffsetInAnchor);
ASSERT(!((anchorType == PositionIsBeforeChildren || anchorType == PositionIsAfterChildren)
- && (m_anchorNode->isTextNode() || editingIgnoresContent(m_anchorNode.raw()))));
+ && (m_anchorNode->isTextNode() || editingIgnoresContent(m_anchorNode))));
}
Position::Position(const Handle<Node>& anchorNode, int offset, AnchorType anchorType)
@@ -123,7 +123,7 @@ Position::Position(const Handle<Text>& textNode, unsigned offset)
void Position::moveToPosition(const Handle<Node>& node, int offset)
{
- ASSERT(!editingIgnoresContent(node.raw()));
+ ASSERT(!editingIgnoresContent(node));
ASSERT(anchorType() == PositionIsOffsetInAnchor || m_isLegacyEditingPosition);
m_anchorNode = node;
m_offset = offset;
@@ -198,7 +198,7 @@ int Position::offsetForPositionAfterAnchor() const
{
ASSERT(m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren);
ASSERT(!m_isLegacyEditingPosition);
- return lastOffsetForEditing(m_anchorNode.raw());
+ return lastOffsetForEditing(m_anchorNode);
}
// Neighbor-anchored positions are invalid DOM positions, so they need to be
@@ -210,13 +210,13 @@ Position Position::parentAnchoredEquivalent() const
// 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) && (editingIgnoresContent(m_anchorNode.raw()) || isTableElement(m_anchorNode.raw())))
+ if (findParent(m_anchorNode) && (editingIgnoresContent(m_anchorNode) || isTableElement(m_anchorNode)))
return positionInParentBeforeNode(m_anchorNode);
return Position(m_anchorNode, 0, PositionIsOffsetInAnchor);
}
if (!m_anchorNode->offsetInCharacters()
&& (m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || static_cast<unsigned>(m_offset) == m_anchorNode->childNodeCount())
- && (editingIgnoresContent(m_anchorNode.raw()) || isTableElement(m_anchorNode.raw()))
+ && (editingIgnoresContent(m_anchorNode) || isTableElement(m_anchorNode))
&& containerNode()) {
return positionInParentAfterNode(m_anchorNode);
}
@@ -268,7 +268,7 @@ Result<Node> Position::computeNodeAfterPosition() const
Position::AnchorType Position::anchorTypeForLegacyEditingPosition(const Handle<Node>& anchorNode, int offset)
{
- if (anchorNode && editingIgnoresContent(anchorNode.raw())) {
+ if (anchorNode && editingIgnoresContent(anchorNode)) {
if (offset == 0)
return Position::PositionIsBeforeAnchor;
return Position::PositionIsAfterAnchor;
@@ -308,7 +308,7 @@ Position Position::previous(PositionMoveType moveType) const
if (o > 0) {
Handle<Node> child = n->childNode(o - 1);
if (child)
- return lastPositionInOrAfterNode(child.raw());
+ return lastPositionInOrAfterNode(child);
// There are two reasons child might be 0:
// 1) The node is node like a text node that is not an element, and therefore has no children.
@@ -345,9 +345,9 @@ Position Position::next(PositionMoveType moveType) const
ASSERT(o >= 0);
Handle<Node> child = n->childNode(o);
- if (child || (!n->hasChildNodes() && o < lastOffsetForEditing(n.raw()))) {
+ if (child || (!n->hasChildNodes() && o < lastOffsetForEditing(n))) {
if (child)
- return firstPositionInOrBeforeNode(child.raw());
+ return firstPositionInOrBeforeNode(child);
// There are two reasons child might be 0:
// 1) The node is node like a text node that is not an element, and therefore has no children.
@@ -393,7 +393,7 @@ bool Position::atFirstEditingPositionForNode() const
return true;
case PositionIsAfterChildren:
case PositionIsAfterAnchor:
- return !lastOffsetForEditing(deprecatedNode().handle().raw());
+ return !lastOffsetForEditing(deprecatedNode());
}
ASSERT_NOT_REACHED();
return false;
@@ -405,7 +405,7 @@ bool Position::atLastEditingPositionForNode() const
return true;
// FIXME: Position after anchor shouldn't be considered as at the first editing position for node
// since that position resides outside of the node.
- return m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || m_offset >= lastOffsetForEditing(deprecatedNode().handle().raw());
+ return m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || m_offset >= lastOffsetForEditing(deprecatedNode());
}
// A position is considered at editing boundary if one of the following is true:
@@ -461,7 +461,7 @@ bool Position::atEndOfTree() const
HandleScope scope;
if (isNull())
return true;
- return !findParent(deprecatedNode()) && m_offset >= lastOffsetForEditing(deprecatedNode().handle().raw());
+ return !findParent(deprecatedNode()) && m_offset >= lastOffsetForEditing(deprecatedNode());
}
int Position::renderedOffset() const
@@ -562,7 +562,7 @@ static bool endsOfNodeAreVisuallyDistinctPositions(const Handle<Node>& node)
return false;
// There is a VisiblePosition inside an empty inline-block container.
- return node->renderer()->isReplaced() && canHaveChildrenForEditing(node.raw()) && toRenderBox(node->renderer())->height() != 0 && !node->firstChild();
+ return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && toRenderBox(node->renderer())->height() != 0 && !node->firstChild();
}
static Result<Node> enclosingVisualBoundary(const Handle<Node>& node)
@@ -583,7 +583,7 @@ static bool isStreamer(const PositionIterator& pos)
if (!pos.node())
return true;
- if (isAtomicNode(pos.node().handle().raw()))
+ if (isAtomicNode(pos.node()))
return true;
return pos.atStartOfNode();
@@ -605,7 +605,7 @@ Position Position::upstream(EditingBoundaryCrossingRule rule) const
// iterate backward from there, looking for a qualified position
Handle<Node> boundary = enclosingVisualBoundary(startNode);
// FIXME: PositionIterator should respect Before and After positions.
- PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode, caretMaxOffset(m_anchorNode.raw())) : *this;
+ PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode, caretMaxOffset(m_anchorNode)) : *this;
PositionIterator currentPos = lastVisible;
bool startEditable = startNode->rendererIsEditable();
Handle<Node> lastNode = startNode;
@@ -653,7 +653,7 @@ Position Position::upstream(EditingBoundaryCrossingRule rule) const
return lastVisible;
// Return position after tables and nodes which have content that can be ignored.
- if (editingIgnoresContent(currentNode.raw()) || isTableElement(currentNode.raw())) {
+ if (editingIgnoresContent(currentNode) || isTableElement(currentNode)) {
if (currentPos.atEndOfNode())
return positionAfterNode(currentNode);
continue;
@@ -731,7 +731,7 @@ Position Position::downstream(EditingBoundaryCrossingRule rule) const
// iterate forward from there, looking for a qualified position
Handle<Node> boundary = enclosingVisualBoundary(startNode);
// FIXME: PositionIterator should respect Before and After positions.
- PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode, caretMaxOffset(m_anchorNode.raw())) : *this;
+ PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode, caretMaxOffset(m_anchorNode)) : *this;
PositionIterator currentPos = lastVisible;
bool startEditable = startNode->rendererIsEditable();
Handle<Node> lastNode = startNode;
@@ -784,7 +784,7 @@ Position Position::downstream(EditingBoundaryCrossingRule rule) const
lastVisible = currentPos;
// Return position before tables and nodes which have content that can be ignored.
- if (editingIgnoresContent(currentNode.raw()) || isTableElement(currentNode.raw())) {
+ if (editingIgnoresContent(currentNode) || isTableElement(currentNode)) {
if (currentPos.offsetInLeafNode() <= renderer->caretMinOffset())
return createLegacyEditingPosition(currentNode, renderer->caretMinOffset());
continue;
@@ -919,7 +919,7 @@ bool Position::isCandidate() const
if (renderer->isText())
return !nodeIsUserSelectNone(deprecatedNode()) && inRenderedText();
- if (isTableElement(deprecatedNode().handle().raw()) || editingIgnoresContent(deprecatedNode().handle().raw()))
+ if (isTableElement(deprecatedNode()) || editingIgnoresContent(deprecatedNode()))
return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
if (m_anchorNode->hasTagName(htmlTag))
@@ -1047,8 +1047,8 @@ bool Position::rendersInDifferentPosition(const Position &pos) const
LOG(Editing, "thisRenderedOffset: %d\n", thisRenderedOffset);
LOG(Editing, "posRenderer: %p [%p]\n", posRenderer, b2);
LOG(Editing, "posRenderedOffset: %d\n", posRenderedOffset);
- LOG(Editing, "node min/max: %d:%d\n", caretMinOffset(deprecatedNode().handle().raw()), caretMaxOffset(deprecatedNode().handle().raw()));
- LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(pos.deprecatedNode().handle().raw()), caretMaxOffset(pos.deprecatedNode().handle().raw()));
+ LOG(Editing, "node min/max: %d:%d\n", caretMinOffset(deprecatedNode()), caretMaxOffset(deprecatedNode()));
+ LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(pos.deprecatedNode()), caretMaxOffset(pos.deprecatedNode()));
LOG(Editing, "----------------------------------------------------------------------\n");
if (!b1 || !b2) {
@@ -1060,12 +1060,12 @@ bool Position::rendersInDifferentPosition(const Position &pos) const
}
if (nextRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
- && thisRenderedOffset == caretMaxOffset(deprecatedNode().handle().raw()) && !posRenderedOffset) {
+ && thisRenderedOffset == caretMaxOffset(deprecatedNode()) && !posRenderedOffset) {
return false;
}
if (previousRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
- && !thisRenderedOffset && posRenderedOffset == caretMaxOffset(pos.deprecatedNode().handle().raw())) {
+ && !thisRenderedOffset && posRenderedOffset == caretMaxOffset(pos.deprecatedNode())) {
return false;
}
@@ -1180,7 +1180,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
if (!renderer->isText()) {
inlineBox = 0;
- if (canHaveChildrenForEditing(deprecatedNode().handle().raw()) && renderer->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(renderer)) {
+ if (canHaveChildrenForEditing(deprecatedNode()) && renderer->isBlockFlow() && hasRenderedNonAnonymousDescendantsWithHeight(renderer)) {
// Try a visually equivalent position with possibly opposite editability. This helps in case |this| is in
// an editable block but surrounded by non-editable positions. It acts to negate the logic at the beginning
// of RenderObject::createVisiblePosition().

Powered by Google App Engine
This is Rietveld 408576698