Index: Source/core/editing/VisibleUnits.cpp |
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp |
index 189501332491e8a20e2715e3a5c55225afe84e64..c15d10618cc5baf6f9562d6a24fe0ee5a9182d89 100644 |
--- a/Source/core/editing/VisibleUnits.cpp |
+++ b/Source/core/editing/VisibleUnits.cpp |
@@ -484,7 +484,7 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch |
SimplifiedBackwardsTextIterator it(searchRange.get()); |
unsigned next = 0; |
- bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE; |
+ bool inTextSecurityMode = start.deprecatedNode() && start.renderer() && start.renderer()->style()->textSecurity() != TSNONE; |
bool needMoreContext = false; |
while (!it.atEnd()) { |
// iterate to get chunks until the searchFunction returns a non-zero value. |
@@ -558,7 +558,7 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc |
searchRange->setStart(start.deprecatedNode(), start.deprecatedEditingOffset(), IGNORE_EXCEPTION); |
TextIterator it(searchRange.get(), TextIteratorEmitsCharactersBetweenAllVisiblePositions); |
unsigned next = 0; |
- bool inTextSecurityMode = start.deprecatedNode() && start.deprecatedNode()->renderer() && start.deprecatedNode()->renderer()->style()->textSecurity() != TSNONE; |
+ bool inTextSecurityMode = start.deprecatedNode() && start.renderer() && start.renderer()->style()->textSecurity() != TSNONE; |
bool needMoreContext = false; |
while (!it.atEnd()) { |
// Keep asking the iterator for chunks until the search function |
@@ -718,7 +718,7 @@ static VisiblePosition startPositionForLine(const VisiblePosition& c, LineEndpoi |
// There are VisiblePositions at offset 0 in blocks without |
// RootInlineBoxes, like empty editable blocks and bordered blocks. |
Position p = c.deepEquivalent(); |
- if (p.deprecatedNode()->renderer() && p.deprecatedNode()->renderer()->isRenderBlock() && !p.deprecatedEditingOffset()) |
+ if (p.renderer() && p.renderer()->isRenderBlock() && !p.deprecatedEditingOffset()) |
return c; |
return VisiblePosition(); |
@@ -791,7 +791,7 @@ static VisiblePosition endPositionForLine(const VisiblePosition& c, LineEndpoint |
// There are VisiblePositions at offset 0 in blocks without |
// RootInlineBoxes, like empty editable blocks and bordered blocks. |
Position p = c.deepEquivalent(); |
- if (p.deprecatedNode()->renderer() && p.deprecatedNode()->renderer()->isRenderBlock() && !p.deprecatedEditingOffset()) |
+ if (p.renderer() && p.renderer()->isRenderBlock() && !p.deprecatedEditingOffset()) |
return c; |
return VisiblePosition(); |
} |
@@ -1135,16 +1135,16 @@ VisiblePosition startOfParagraph(const VisiblePosition& c, EditingBoundaryCrossi |
if (r->isText() && toRenderText(r)->renderedTextLength()) { |
ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode()); |
+ RenderText* text = toRenderText(r); |
type = Position::PositionIsOffsetInAnchor; |
if (style->preserveNewline()) { |
- RenderText* text = toRenderText(r); |
int i = text->textLength(); |
int o = offset; |
if (n == startNode && o < i) |
i = max(0, o); |
while (--i >= 0) { |
if ((*text)[i] == '\n') |
- return VisiblePosition(Position(toText(n), i + 1), DOWNSTREAM); |
+ return VisiblePosition(Position(toText(n), i + text->textStartOffset() + 1), DOWNSTREAM); |
} |
} |
node = n; |
@@ -1217,18 +1217,18 @@ VisiblePosition endOfParagraph(const VisiblePosition &c, EditingBoundaryCrossing |
// FIXME: We avoid returning a position where the renderer can't accept the caret. |
if (r->isText() && toRenderText(r)->renderedTextLength()) { |
ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode()); |
- int length = toRenderText(r)->textLength(); |
+ RenderText* text = toRenderText(r); |
+ int length = text->textLength(); |
type = Position::PositionIsOffsetInAnchor; |
if (style->preserveNewline()) { |
- RenderText* text = toRenderText(r); |
int o = n == startNode ? offset : 0; |
for (int i = o; i < length; ++i) { |
if ((*text)[i] == '\n') |
- return VisiblePosition(Position(toText(n), i), DOWNSTREAM); |
+ return VisiblePosition(Position(toText(n), i + text->textStartOffset()), DOWNSTREAM); |
} |
} |
node = n; |
- offset = r->caretMaxOffset(); |
+ offset = r->caretMaxOffset() + text->textStartOffset(); |
n = NodeTraversal::next(n, stayInsideBlock); |
} else if (editingIgnoresContent(n) || isTableElement(n)) { |
node = n; |