зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1257446 part.2 ContentEventHandler::OnQueryTextRectArray() shouldn't set empty rect to the result r=m_kato
Returning empty rects for eQueryTextRectArray causes each dispatcher needing to check every rect. It doesn't make sense especially compared with eQueryTextRect. So, it should ensure that empty rect won't be returned to dispatchers. MozReview-Commit-ID: CpMqqihzSDf --HG-- extra : rebase_source : 0343e2eecf5e25043d260157cf4d8b0874e0ceb6
This commit is contained in:
Родитель
598dee428f
Коммит
8a489e63dd
|
@ -1427,7 +1427,6 @@ ContentEventHandler::OnQueryTextRectArray(WidgetQueryContentEvent* aEvent)
|
|||
uint32_t offset = aEvent->mInput.mOffset;
|
||||
|
||||
LayoutDeviceIntRect rect;
|
||||
WritingMode writingMode;
|
||||
while (aEvent->mInput.mLength > aEvent->mReply.mRectArray.Length()) {
|
||||
rv = SetRangeFromFlatTextOffset(range, offset, 1, lineBreakType, true,
|
||||
nullptr);
|
||||
|
@ -1466,6 +1465,10 @@ ContentEventHandler::OnQueryTextRectArray(WidgetQueryContentEvent* aEvent)
|
|||
rect = LayoutDeviceIntRect::FromUnknownRect(
|
||||
charRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
|
||||
|
||||
// Ensure at least 1px width and height for avoiding empty rect.
|
||||
rect.height = std::max(1, rect.height);
|
||||
rect.width = std::max(1, rect.width);
|
||||
|
||||
aEvent->mReply.mRectArray.AppendElement(rect);
|
||||
}
|
||||
offset += charRects.Length();
|
||||
|
|
Загрузка…
Ссылка в новой задаче