mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 792928 - Don't select entire text when event offsets are out of bounds; r=masayuki
This commit is contained in:
parent
8d914286b7
commit
726441b618
@ -375,7 +375,7 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
|
||||
|
||||
uint32_t nativeOffset = 0;
|
||||
uint32_t nativeEndOffset = aNativeOffset + aNativeLength;
|
||||
nsCOMPtr<nsIContent> content;
|
||||
bool startSet = false;
|
||||
for (; !iter->IsDone(); iter->Next()) {
|
||||
nsINode* node = iter->GetCurrentNode();
|
||||
if (!node)
|
||||
@ -405,6 +405,7 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
|
||||
|
||||
rv = aRange->SetStart(domNode, int32_t(xpOffset));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
startSet = true;
|
||||
if (aNativeLength == 0) {
|
||||
// Ensure that the end offset and the start offset are same.
|
||||
rv = aRange->SetEnd(domNode, int32_t(xpOffset));
|
||||
@ -446,8 +447,9 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(mRootContent));
|
||||
NS_ASSERTION(domNode, "lastContent doesn't have nsIDOMNode!");
|
||||
if (!content) {
|
||||
rv = aRange->SetStart(domNode, 0);
|
||||
if (!startSet) {
|
||||
MOZ_ASSERT(!mRootContent->IsNodeOfType(nsINode::eTEXT));
|
||||
rv = aRange->SetStart(domNode, int32_t(mRootContent->GetChildCount()));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = aRange->SetEnd(domNode, int32_t(mRootContent->GetChildCount()));
|
||||
|
@ -1956,6 +1956,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
ae->Offset() + ae->Count());
|
||||
selEvent.mLength = uint32_t(NS_ABS(ae->Count()));
|
||||
selEvent.mReversed = ae->Count() >= 0 ? false : true;
|
||||
selEvent.mExpandToClusterBoundary = false;
|
||||
|
||||
DispatchEvent(&selEvent);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user