diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 84fe83408fcbf05982d7851c91eceb7cbad389ba..be16ff7946d91d407a1d06efbca72901f3b03d4b 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -597,6 +597,8 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
 				S32 x = message_in.getValueS32("x");
 				S32 y = message_in.getValueS32("y");
 
+				y = mHeight - y;
+
 				// only even send left mouse button events to LLCEFLib
 				// (partially prompted by crash in OS X CEF when sending right button events)
 				// we catch the right click in viewer and display our own context menu anyway
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 9cf32499838f6e05c45edb3d7441323014cd4863..08c927483f950736a3d8f108319bc26df9121de4 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -911,7 +911,7 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
 	}
 	
 	x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]);
-	if ( ! coords_opengl )
+	if (  coords_opengl )
 	{
 		y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]);
 	}