Skip to content

Commit

Permalink
[embedlite] Don't create unnecessary copy of MultiTouchInput event.
Browse files Browse the repository at this point in the history
The copy is not needed since the SendInputDataTouch* methods already
accept a reference type and internally they create a copy of the event
by serializing it.
  • Loading branch information
tworaz committed Jul 15, 2015
1 parent 2af90b7 commit 16d5211
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions embedding/embedlite/embedshared/EmbedLiteViewBaseParent.cpp
Expand Up @@ -460,17 +460,10 @@ EmbedLiteViewBaseParent::ReceiveInputEvent(const mozilla::InputData& aEvent)
mController->ReceiveInputEvent(const_cast<mozilla::InputData&>(aEvent), &guid, &outInputBlockId);
if (aEvent.mInputType == MULTITOUCH_INPUT) {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
MultiTouchInput translatedEvent(multiTouchInput.mType, multiTouchInput.mTime, TimeStamp(), multiTouchInput.modifiers);
for (uint32_t i = 0; i < multiTouchInput.mTouches.Length(); ++i) {
const SingleTouchData& data = multiTouchInput.mTouches[i];
SingleTouchData newData = multiTouchInput.mTouches[i];
newData.mScreenPoint = data.mScreenPoint;
translatedEvent.mTouches.AppendElement(newData);
}
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_MOVE) {
unused << SendInputDataTouchMoveEvent(guid, translatedEvent, outInputBlockId);
unused << SendInputDataTouchMoveEvent(guid, multiTouchInput, outInputBlockId);
} else {
unused << SendInputDataTouchEvent(guid, translatedEvent, outInputBlockId);
unused << SendInputDataTouchEvent(guid, multiTouchInput, outInputBlockId);
}
}
}
Expand Down

0 comments on commit 16d5211

Please sign in to comment.