зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1203871 - Part 5. Use mozilla::Move for rect array. r=masayuki
To optimize copy of text rect array, we should use mozilla::Move. Also, after using it, we should mark is invalid result into SetEventResult MozReview-Commit-ID: HH9H7DhK12 --HG-- extra : rebase_source : 4e02ece73583306c386597bc92e203fa147cfcbc extra : histedit_source : 726621cdaf262b9d173ae19d505575f10563cc36
This commit is contained in:
Родитель
954a8896f5
Коммит
c603b26d13
|
@ -4,9 +4,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -222,7 +223,7 @@ nsQueryContentEventResult::GetCharacterRect(int32_t aOffset,
|
|||
|
||||
void
|
||||
nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
|
||||
const WidgetQueryContentEvent &aEvent)
|
||||
WidgetQueryContentEvent &aEvent)
|
||||
{
|
||||
mEventMessage = aEvent.mMessage;
|
||||
mSucceeded = aEvent.mSucceeded;
|
||||
|
@ -231,7 +232,9 @@ nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
|
|||
mOffset = aEvent.mReply.mOffset;
|
||||
mTentativeCaretOffset = aEvent.mReply.mTentativeCaretOffset;
|
||||
mString = aEvent.mReply.mString;
|
||||
mRectArray = aEvent.mReply.mRectArray;
|
||||
mRectArray = mozilla::Move(aEvent.mReply.mRectArray);
|
||||
// Mark as result that is longer used.
|
||||
aEvent.mSucceeded = false;
|
||||
|
||||
if (!IsRectRelatedPropertyAvailable(mEventMessage) ||
|
||||
!aWidget || !mSucceeded) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
NS_DECL_NSIQUERYCONTENTEVENTRESULT
|
||||
|
||||
void SetEventResult(nsIWidget* aWidget,
|
||||
const mozilla::WidgetQueryContentEvent &aEvent);
|
||||
mozilla::WidgetQueryContentEvent& aEvent);
|
||||
|
||||
protected:
|
||||
~nsQueryContentEventResult();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/TextEvents.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Move.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -314,7 +315,7 @@ ContentCacheInChild::CacheTextRects(nsIWidget* aWidget,
|
|||
textRects.InitForQueryTextRectArray(mTextRectArray.mStart, length);
|
||||
aWidget->DispatchEvent(&textRects, status);
|
||||
|
||||
mTextRectArray.mRects = textRects.mReply.mRectArray;
|
||||
mTextRectArray.mRects = Move(textRects.mReply.mRectArray);
|
||||
}
|
||||
|
||||
if (mTextRectArray.InRange(mSelection.mAnchor)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче