Bug 1153049: Part5. Simplify retrieval of HTMLVideoElement dimensions. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 14 Apr 2015 15:17:55 +1000
changeset 268817 65492fe833627d14e292d63de5b8695011127c6f
parent 268816 8cde37caacefdc38a4929ce5fa5a7d7428477229
child 268818 bf8582b32c795b52f157fdb5e74d2a116aa1f27a
push id4830
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:18:48 +0000
treeherdermozilla-beta@4c2175bb0420 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1153049
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1153049: Part5. Simplify retrieval of HTMLVideoElement dimensions. r=cpearce
dom/html/HTMLVideoElement.cpp
dom/html/HTMLVideoElement.h
--- a/dom/html/HTMLVideoElement.cpp
+++ b/dom/html/HTMLVideoElement.cpp
@@ -47,18 +47,17 @@ HTMLVideoElement::HTMLVideoElement(alrea
 }
 
 HTMLVideoElement::~HTMLVideoElement()
 {
 }
 
 nsresult HTMLVideoElement::GetVideoSize(nsIntSize* size)
 {
-  if (mMediaInfo.mVideo.mDisplay.width == 0 &&
-      mMediaInfo.mVideo.mDisplay.height == 0) {
+  if (!mMediaInfo.HasVideo()) {
     return NS_ERROR_FAILURE;
   }
 
   if (mDisableVideo) {
     return NS_ERROR_FAILURE;
   }
 
   size->height = mMediaInfo.mVideo.mDisplay.height;
--- a/dom/html/HTMLVideoElement.h
+++ b/dom/html/HTMLVideoElement.h
@@ -71,22 +71,22 @@ public:
 
   void SetHeight(uint32_t aValue, ErrorResult& aRv)
   {
     SetHTMLIntAttr(nsGkAtoms::height, aValue, aRv);
   }
 
   uint32_t VideoWidth() const
   {
-    return mMediaInfo.mVideo.mDisplay.width;
+    return mMediaInfo.HasVideo() ? mMediaInfo.mVideo.mDisplay.width : 0;
   }
 
   uint32_t VideoHeight() const
   {
-    return mMediaInfo.mVideo.mDisplay.height;
+    return mMediaInfo.HasVideo() ? mMediaInfo.mVideo.mDisplay.height : 0;
   }
 
   void GetPoster(nsAString& aValue)
   {
     GetURIAttr(nsGkAtoms::poster, nullptr, aValue);
   }
   void SetPoster(const nsAString& aValue, ErrorResult& aRv)
   {