Bug 1444489 - Part V, Remove XUL videocontrols reflow code on Android draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Mon, 12 Mar 2018 21:39:13 +0800
changeset 770604 9e6a5f9fbde7bd3cf590bc3f8e0736fce170361d
parent 770603 51ab81f98e43ac9d8c2b0464a17cddf1ad3af0d9
child 770605 b9b48bccf1128227005cbed42c658e24ee6a71e7
push id103447
push usertimdream@gmail.com
push dateWed, 21 Mar 2018 15:57:15 +0000
bugs1444489
milestone61.0a1
Bug 1444489 - Part V, Remove XUL videocontrols reflow code on Android With all videocontrols UIs implemented in HTML, there is no need to handle XUL content in videocontrols. MozReview-Commit-ID: Jq3SecscssO
layout/generic/nsVideoFrame.cpp
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -343,30 +343,16 @@ nsVideoFrame::Reflow(nsPresContext* aPre
       MOZ_ASSERT(childStatus.IsFullyComplete(),
                  "We gave our child unconstrained available block-size, "
                  "so it should be complete!");
 
       FinishReflowChild(imageFrame, aPresContext,
                         kidDesiredSize, &kidReflowInput,
                         posterRenderRect.x, posterRenderRect.y, 0);
 
-// Android still uses XUL media controls & hence needs this XUL-friendly
-// custom reflow code. This will go away in bug 1310907.
-#ifdef ANDROID
-    } else if (child->GetContent() == mVideoControls) {
-      // Reflow the video controls frame.
-      nsBoxLayoutState boxState(PresContext(), aReflowInput.mRenderingContext);
-      nsBoxFrame::LayoutChildAt(boxState,
-                                child,
-                                nsRect(borderPadding.left,
-                                       borderPadding.top,
-                                       aReflowInput.ComputedWidth(),
-                                       aReflowInput.ComputedHeight()));
-
-#endif // ANDROID
     } else if (child->GetContent() == mCaptionDiv ||
                child->GetContent() == mVideoControls) {
       // Reflow the caption and control bar frames.
       WritingMode wm = child->GetWritingMode();
       LogicalSize availableSize = aReflowInput.ComputedSize(wm);
       availableSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
 
       ReflowInput kidReflowInput(aPresContext,
@@ -616,31 +602,26 @@ nsVideoFrame::ComputeSize(gfxContext *aR
                           WritingMode aWM,
                           const LogicalSize& aCBSize,
                           nscoord aAvailableISize,
                           const LogicalSize& aMargin,
                           const LogicalSize& aBorder,
                           const LogicalSize& aPadding,
                           ComputeSizeFlags aFlags)
 {
-// When in no video scenario, it should fall back to inherited method.
-// We keep old codepath here since Android still uses XUL media controls.
-// This will go away in bug 1310907.
-#ifndef ANDROID
   if (!HasVideoElement()) {
     return nsContainerFrame::ComputeSize(aRenderingContext,
                                          aWM,
                                          aCBSize,
                                          aAvailableISize,
                                          aMargin,
                                          aBorder,
                                          aPadding,
                                          aFlags);
   }
-#endif // ANDROID
 
   nsSize size = GetVideoIntrinsicSize(aRenderingContext);
 
   IntrinsicSize intrinsicSize;
   intrinsicSize.width.SetCoordValue(size.width);
   intrinsicSize.height.SetCoordValue(size.height);
 
   // Only video elements have an intrinsic ratio.
@@ -738,31 +719,16 @@ bool nsVideoFrame::ShouldDisplayPoster()
 }
 
 nsSize
 nsVideoFrame::GetVideoIntrinsicSize(gfxContext *aRenderingContext)
 {
   // Defaulting size to 300x150 if no size given.
   nsIntSize size(300, 150);
 
-// All media controls have been converted to HTML except Android. Hence
-// we keep this codepath for Android until removal in bug 1310907.
-#ifdef ANDROID
-  if (!HasVideoElement()) {
-    if (!mFrames.FirstChild()) {
-      return nsSize(0, 0);
-    }
-
-    // Ask the controls frame what its preferred height is
-    nsBoxLayoutState boxState(PresContext(), aRenderingContext, 0);
-    nscoord prefHeight = mFrames.LastChild()->GetXULPrefSize(boxState).height;
-    return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width), prefHeight);
-  }
-#endif // ANDROID
-
   HTMLVideoElement* element = static_cast<HTMLVideoElement*>(GetContent());
   if (NS_FAILED(element->GetVideoSize(&size)) && ShouldDisplayPoster()) {
     // Use the poster image frame's size.
     nsIFrame *child = mPosterImage->GetPrimaryFrame();
     nsImageFrame* imageFrame = do_QueryFrame(child);
     nsSize imgsize;
     if (NS_SUCCEEDED(imageFrame->GetIntrinsicImageSize(imgsize))) {
       return imgsize;