diff options
Diffstat (limited to 'WebCore/editing/htmlediting.cpp')
-rw-r--r-- | WebCore/editing/htmlediting.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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 <rdar://problem/5027702>. 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 <rdar://problem/5027702>. 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<Range> avoidIntersectionWithNode(const Range* range, Node* node) { if (!range) |