Bug 1108277 - part 2 - Make Get{Min,Pref}ISize in video and plugin frames aware of vertical writing mode. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Tue, 09 Dec 2014 14:00:51 +0000
changeset 235590 e7d83c24264bcc3019a5258fc479bc7fbd706d62
parent 235589 c3ba63a959994ed60d94dad03cb1653d2c88203e
child 235591 872df69a912c9e1165fabeb69f0886c8805d28be
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs1108277
milestone37.0a1
Bug 1108277 - part 2 - Make Get{Min,Pref}ISize in video and plugin frames aware of vertical writing mode. r=smontagu
layout/generic/nsPluginFrame.cpp
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -414,17 +414,19 @@ nsPluginFrame::PrepForDrawing(nsIWidget 
 /* virtual */ nscoord
 nsPluginFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
 
   if (!IsHidden(false)) {
     nsIAtom *atom = mContent->Tag();
     if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
-      result = nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH);
+      bool vertical = GetWritingMode().IsVertical();
+      result = nsPresContext::CSSPixelsToAppUnits(
+        vertical ? EMBED_DEF_HEIGHT : EMBED_DEF_WIDTH);
     }
   }
 
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -498,24 +498,26 @@ nsVideoFrame::ComputeSize(nsRenderingCon
                                                            aCBSize,
                                                            aMargin,
                                                            aBorder,
                                                            aPadding);
 }
 
 nscoord nsVideoFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
-  nscoord result = GetVideoIntrinsicSize(aRenderingContext).width;
+  nsSize size = GetVideoIntrinsicSize(aRenderingContext);
+  nscoord result = GetWritingMode().IsVertical() ? size.height : size.width;
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 nscoord nsVideoFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
 {
-  nscoord result = GetVideoIntrinsicSize(aRenderingContext).width;
+  nsSize size = GetVideoIntrinsicSize(aRenderingContext);
+  nscoord result = GetWritingMode().IsVertical() ? size.height : size.width;
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
 nsSize nsVideoFrame::GetIntrinsicRatio()
 {
   if (!HasVideoElement()) {
     // Audio elements have no intrinsic ratio.