| Index: Source/core/editing/VisibleUnits.cpp
|
| diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
|
| index 92f8be86c7e01c6486f836bde5dd0dff359000a6..6b4e0fabe301218dd0a831a86c15c7f6cc5d9351 100644
|
| --- a/Source/core/editing/VisibleUnits.cpp
|
| +++ b/Source/core/editing/VisibleUnits.cpp
|
| @@ -1134,16 +1134,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;
|
| @@ -1212,18 +1212,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;
|
|
|