зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1237236 - When collapsing the selection to the end of textframe that ends in a significant newline then set mHint to CARET_ASSOCIATE_AFTER so that the caret is rendered at the start of the next line if any. r=ehsan
This commit is contained in:
Родитель
3128937295
Коммит
1ef2b15815
|
@ -4936,6 +4936,16 @@ Selection::Collapse(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
|
|||
// Turn off signal for table selection
|
||||
mFrameSelection->ClearTableCellSelection();
|
||||
|
||||
// Hack to display the caret on the right line (bug 1237236).
|
||||
if (aParentNode.IsContent()) {
|
||||
nsTextFrame* f = do_QueryFrame(aParentNode.AsContent()->GetPrimaryFrame());
|
||||
if (f && f->IsAtEndOfLine() && f->HasSignificantTerminalNewline()) {
|
||||
if (f->GetContentEnd() == int32_t(aOffset)) {
|
||||
mFrameSelection->SetHint(CARET_ASSOCIATE_AFTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsRange> range = new nsRange(&aParentNode);
|
||||
result = range->SetEnd(&aParentNode, aOffset);
|
||||
if (NS_FAILED(result)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче