From 643ca7872b450ea4efacab6188849e5aac2ba161 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 15 Dec 2009 10:12:09 +0000 Subject: Merge webkit.org at r51976 : Initial merge by git. Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43 --- WebCore/editing/htmlediting.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'WebCore/editing/htmlediting.cpp') diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp index d19ef6b..8b1c98d 100644 --- a/WebCore/editing/htmlediting.cpp +++ b/WebCore/editing/htmlediting.cpp @@ -289,7 +289,7 @@ VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& positio while (p.node() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot)) p = isAtomicNode(p.node()) ? positionInParentAfterNode(p.node()) : nextVisuallyDistinctCandidate(p); - if (p.node() && !p.node()->isDescendantOf(highestRoot)) + if (p.node() && p.node() != highestRoot && !p.node()->isDescendantOf(highestRoot)) return VisiblePosition(); return VisiblePosition(p); @@ -310,7 +310,7 @@ VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& positio while (p.node() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot)) p = isAtomicNode(p.node()) ? positionInParentBeforeNode(p.node()) : previousVisuallyDistinctCandidate(p); - if (p.node() && !p.node()->isDescendantOf(highestRoot)) + if (p.node() && p.node() != highestRoot && !p.node()->isDescendantOf(highestRoot)) return VisiblePosition(); return VisiblePosition(p); @@ -494,6 +494,7 @@ bool validBlockTag(const AtomicString& blockTag) static Node* firstInSpecialElement(const Position& pos) { + // FIXME: This begins at pos.node(), which doesn't necessarily contain pos (suppose pos was [img, 0]). See . Node* rootEditableElement = pos.node()->rootEditableElement(); for (Node* n = pos.node(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) if (isSpecialElement(n)) { @@ -509,6 +510,7 @@ static Node* firstInSpecialElement(const Position& pos) static Node* lastInSpecialElement(const Position& pos) { + // FIXME: This begins at pos.node(), which doesn't necessarily contain pos (suppose pos was [img, 0]). See . Node* rootEditableElement = pos.node()->rootEditableElement(); for (Node* n = pos.node(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode()) if (isSpecialElement(n)) { @@ -1077,6 +1079,14 @@ bool isNodeVisiblyContainedWithin(Node* node, const Range* selectedRange) && visiblePositionAfterNode(node) == selectedRange->endPosition(); } +bool isRenderedAsNonInlineTableImageOrHR(const Node* node) +{ + if (!node) + return false; + RenderObject* renderer = node->renderer(); + return renderer && ((renderer->isTable() && !renderer->isInline()) || (renderer->isImage() && !renderer->isInline()) || renderer->isHR()); +} + PassRefPtr avoidIntersectionWithNode(const Range* range, Node* node) { if (!range) -- cgit v1.1