mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987718 - Part 2: Expose GetHintForPosition to nsFrameSelection; r=roc
This commit is contained in:
parent
3aa22d4895
commit
4dfb8172cb
@ -411,22 +411,6 @@ void nsCaret::SetVisibilityDuringSelection(bool aVisibility)
|
||||
mShowDuringSelection = aVisibility;
|
||||
}
|
||||
|
||||
static
|
||||
nsFrameSelection::HINT GetHintForPosition(nsIDOMNode* aNode, int32_t aOffset)
|
||||
{
|
||||
nsFrameSelection::HINT hint = nsFrameSelection::HINTLEFT;
|
||||
nsCOMPtr<nsIContent> node = do_QueryInterface(aNode);
|
||||
if (!node || aOffset < 1) {
|
||||
return hint;
|
||||
}
|
||||
const nsTextFragment* text = node->GetText();
|
||||
if (text && text->CharAt(aOffset - 1) == '\n') {
|
||||
// Attach the caret to the next line if needed
|
||||
hint = nsFrameSelection::HINTRIGHT;
|
||||
}
|
||||
return hint;
|
||||
}
|
||||
|
||||
nsresult nsCaret::DrawAtPosition(nsIDOMNode* aNode, int32_t aOffset)
|
||||
{
|
||||
NS_ENSURE_ARG(aNode);
|
||||
@ -442,8 +426,9 @@ nsresult nsCaret::DrawAtPosition(nsIDOMNode* aNode, int32_t aOffset)
|
||||
// ourselves, our consumer will take care of that.
|
||||
mBlinkRate = 0;
|
||||
|
||||
nsCOMPtr<nsIContent> node = do_QueryInterface(aNode);
|
||||
nsresult rv = DrawAtPositionWithHint(aNode, aOffset,
|
||||
GetHintForPosition(aNode, aOffset),
|
||||
nsFrameSelection::GetHintForPosition(node, aOffset),
|
||||
bidiLevel, true)
|
||||
? NS_OK : NS_ERROR_FAILURE;
|
||||
ToggleDrawnStatus();
|
||||
|
@ -591,6 +591,8 @@ public:
|
||||
|
||||
void DisconnectFromPresShell();
|
||||
nsresult ClearNormalSelection();
|
||||
|
||||
static HINT GetHintForPosition(nsIContent* aContent, int32_t aOffset);
|
||||
private:
|
||||
nsresult TakeFocus(nsIContent *aNewFocus,
|
||||
uint32_t aContentOffset,
|
||||
|
@ -684,6 +684,20 @@ GetCellParent(nsINode *aDomNode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsFrameSelection::HINT
|
||||
nsFrameSelection::GetHintForPosition(nsIContent* aContent, int32_t aOffset)
|
||||
{
|
||||
HINT hint = HINTLEFT;
|
||||
if (!aContent || aOffset < 1) {
|
||||
return hint;
|
||||
}
|
||||
const nsTextFragment* text = aContent->GetText();
|
||||
if (text && text->CharAt(aOffset - 1) == '\n') {
|
||||
// Attach the caret to the next line if needed
|
||||
hint = HINTRIGHT;
|
||||
}
|
||||
return hint;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameSelection::Init(nsIPresShell *aShell, nsIContent *aLimiter)
|
||||
|
Loading…
Reference in New Issue
Block a user