Bug 678016 - Fix c++0x initializer list error found by clang; r=josh
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 10 Aug 2011 15:45:44 -0400
changeset 74292 ff8535faf76ee7118056619755ff8726240777a6
parent 74291 36fdf4f63d8ed10f97568c140cbd9cfb3e091cd7
child 74293 6a9dabc3f3d144002acfe07bb8243d0318d08bdf
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjosh
bugs678016
milestone8.0a1
Bug 678016 - Fix c++0x initializer list error found by clang; r=josh Add explict casts to short. ::Point is a OS provided data type, so we cannot change it. I could try adding a nsShortPoint type and have WidgetToScreenOffset to return it, but that is a virtual method used in other OSs, so doing the cast looked like the best solution.
dom/plugins/base/nsPluginInstanceOwner.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1937,17 +1937,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
   nsPoint pt =
   nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
   mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
   nsPresContext* presContext = mObjectFrame->PresContext();
   nsIntPoint ptPx(presContext->AppUnitsToDevPixels(pt.x),
                   presContext->AppUnitsToDevPixels(pt.y));
 #ifndef NP_NO_CARBON
   nsIntPoint geckoScreenCoords = mWidget->WidgetToScreenOffset();
-  ::Point carbonPt = { ptPx.y + geckoScreenCoords.y, ptPx.x + geckoScreenCoords.x };
+  ::Point carbonPt = { static_cast<short>(ptPx.y + geckoScreenCoords.y),
+                       static_cast<short>(ptPx.x + geckoScreenCoords.x) };
   if (eventModel == NPEventModelCarbon) {
     if (event && anEvent.eventStructType == NS_MOUSE_EVENT) {
       static_cast<EventRecord*>(event)->where = carbonPt;
     }
   }
 #endif
   if (!event) {
 #ifndef NP_NO_CARBON