Commit 0285a747 authored by pilgrim@chromium.org's avatar pilgrim@chromium.org

[Line Layout API] Add textStartOffset to LineLayoutText

This CL updates callers in LayoutText.cpp.

BUG=499321

Review URL: https://codereview.chromium.org/1330433003

git-svn-id: svn://svn.chromium.org/blink/trunk@201988 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6daf0cab
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "core/layout/LayoutBlock.h" #include "core/layout/LayoutBlock.h"
#include "core/layout/LayoutTextCombine.h" #include "core/layout/LayoutTextCombine.h"
#include "core/layout/LayoutView.h" #include "core/layout/LayoutView.h"
#include "core/layout/api/LineLayoutBox.h"
#include "core/layout/line/AbstractInlineTextBox.h" #include "core/layout/line/AbstractInlineTextBox.h"
#include "core/layout/line/EllipsisBox.h" #include "core/layout/line/EllipsisBox.h"
#include "core/layout/line/GlyphOverflow.h" #include "core/layout/line/GlyphOverflow.h"
...@@ -523,7 +524,7 @@ static PositionWithAffinity createPositionWithAffinityForBox(const InlineBox* bo ...@@ -523,7 +524,7 @@ static PositionWithAffinity createPositionWithAffinityForBox(const InlineBox* bo
affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : TextAffinity::Downstream; affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : TextAffinity::Downstream;
break; break;
} }
int textStartOffset = box->layoutObject().isText() ? toLayoutText(box->layoutObject()).textStartOffset() : 0; int textStartOffset = box->lineLayoutItem().isText() ? LineLayoutText(box->lineLayoutItem()).textStartOffset() : 0;
return box->layoutObject().createPositionWithAffinity(offset + textStartOffset, affinity); return box->layoutObject().createPositionWithAffinity(offset + textStartOffset, affinity);
} }
...@@ -541,7 +542,7 @@ static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset ...@@ -541,7 +542,7 @@ static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak();
if ((prevBox && prevBox->bidiLevel() == box->bidiLevel()) if ((prevBox && prevBox->bidiLevel() == box->bidiLevel())
|| box->layoutObject().containingBlock()->style()->direction() == box->direction()) // FIXME: left on 12CBA || box->lineLayoutItem().containingBlock().style()->direction() == box->direction()) // FIXME: left on 12CBA
return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), shouldAffinityBeDownstream); return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), shouldAffinityBeDownstream);
if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) { if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) {
...@@ -571,7 +572,7 @@ static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset ...@@ -571,7 +572,7 @@ static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak();
if ((nextBox && nextBox->bidiLevel() == box->bidiLevel()) if ((nextBox && nextBox->bidiLevel() == box->bidiLevel())
|| box->layoutObject().containingBlock()->style()->direction() == box->direction()) || box->lineLayoutItem().containingBlock().style()->direction() == box->direction())
return createPositionWithAffinityForBox(box, box->caretRightmostOffset(), shouldAffinityBeDownstream); return createPositionWithAffinityForBox(box, box->caretRightmostOffset(), shouldAffinityBeDownstream);
// offset is on the right edge // offset is on the right edge
......
...@@ -122,6 +122,11 @@ public: ...@@ -122,6 +122,11 @@ public:
return toText()->selectionStartEnd(spos, epos); return toText()->selectionStartEnd(spos, epos);
} }
unsigned textStartOffset() const
{
return toText()->textStartOffset();
}
private: private:
LayoutText* toText() { return toLayoutText(layoutObject()); } LayoutText* toText() { return toLayoutText(layoutObject()); }
const LayoutText* toText() const { return toLayoutText(layoutObject()); } const LayoutText* toText() const { return toLayoutText(layoutObject()); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment