Bug 1258308 - Lookup the frame (continuation) associated with aParentNode/aOffset instead of assuming it's always the primary frame (follow-up from bug 1237236). r=ehsan

This commit is contained in:
Mats Palmgren 2016-03-22 22:49:57 +01:00
parent 100dda0d7d
commit c42a275582

View File

@ -4939,6 +4939,11 @@ Selection::Collapse(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
// Hack to display the caret on the right line (bug 1237236).
if (aParentNode.IsContent()) {
nsTextFrame* f = do_QueryFrame(aParentNode.AsContent()->GetPrimaryFrame());
if (f) {
int32_t frameOffset;
f = do_QueryFrame(nsCaret::GetFrameAndOffset(this, &aParentNode,
aOffset, &frameOffset));
}
if (f && f->IsAtEndOfLine() && f->HasSignificantTerminalNewline()) {
if (f->GetContentEnd() == int32_t(aOffset)) {
mFrameSelection->SetHint(CARET_ASSOCIATE_AFTER);