Bug 1465866, remove unused Scrollbox methods draft
authorEmma Malysz <emalysz@mozilla.com>
Thu, 31 May 2018 10:22:56 -0700
changeset 802319 3ff25bd8b3e1df55b3771b12c044a693dafaf9ed
parent 800874 f01bb6245db1ea2a87e5360104a4110571265137
push id111863
push userbmo:emalysz@mozilla.com
push dateThu, 31 May 2018 18:08:54 +0000
bugs1465866
milestone62.0a1
Bug 1465866, remove unused Scrollbox methods MozReview-Commit-ID: DyY9CWra2f5
layout/xul/ScrollBoxObject.cpp
--- a/layout/xul/ScrollBoxObject.cpp
+++ b/layout/xul/ScrollBoxObject.cpp
@@ -54,28 +54,16 @@ void ScrollBoxObject::ScrollBy(int32_t d
 
   if (aRv.Failed()) {
     return;
   }
 
   ScrollTo(pt.x + dx, pt.y + dy, aRv);
 }
 
-void ScrollBoxObject::ScrollByLine(int32_t dlines, ErrorResult& aRv)
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (!sf) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  sf->ScrollBy(nsIntPoint(0, dlines), nsIScrollableFrame::LINES,
-               nsIScrollableFrame::SMOOTH);
-}
-
 // XUL <scrollbox> elements have a single box child element.
 // Get a pointer to that box.
 // Note that now that the <scrollbox> is just a regular box
 // with 'overflow:hidden', the boxobject's frame is an nsXULScrollFrame,
 // the <scrollbox>'s box frame is the scrollframe's "scrolled frame", and
 // the <scrollbox>'s child box is a child of that.
 static nsIFrame* GetScrolledBox(BoxObject* aScrollBox) {
   nsIFrame* frame = aScrollBox->GetFrame(false);
@@ -207,29 +195,16 @@ void ScrollBoxObject::ScrollByIndex(int3
        sf->ScrollTo(pt, nsIScrollableFrame::INSTANT, &range);
    } else {
        // Use a destination range that ensures the top edge will be visible.
        nsRect range(cp.x, rect.y - csspixel, 0, csspixel);
        sf->ScrollTo(nsPoint(cp.x, rect.y), nsIScrollableFrame::INSTANT, &range);
    }
 }
 
-void ScrollBoxObject::ScrollToLine(int32_t line, ErrorResult& aRv)
-{
-  nsIScrollableFrame* sf = GetScrollFrame();
-  if (!sf) {
-    aRv.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  nscoord y = sf->GetLineScrollAmount().height * line;
-  nsRect range(0, y - nsPresContext::CSSPixelsToAppUnits(1),
-               0, nsPresContext::CSSPixelsToAppUnits(1));
-  sf->ScrollTo(nsPoint(0, y), nsIScrollableFrame::INSTANT, &range);
-}
 
 void ScrollBoxObject::ScrollToElement(Element& child, ErrorResult& aRv)
 {
   nsCOMPtr<nsIPresShell> shell = GetPresShell(false);
   if (!shell) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
@@ -240,21 +215,16 @@ void ScrollBoxObject::ScrollToElement(El
                                  nsIPresShell::SCROLL_ALWAYS),
                                nsIPresShell::ScrollAxis(
                                  nsIPresShell::SCROLL_LEFT,
                                  nsIPresShell::SCROLL_ALWAYS),
                                nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
                                nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
 }
 
-void ScrollBoxObject::ScrollToIndex(int32_t index, ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
 int32_t ScrollBoxObject::GetPositionX(ErrorResult& aRv)
 {
   CSSIntPoint pt;
   GetPosition(pt, aRv);
   return pt.x;
 }
 
 int32_t ScrollBoxObject::GetPositionY(ErrorResult& aRv)
@@ -299,86 +269,22 @@ void ScrollBoxObject::GetScrolledSize(ns
       return;
     }
 
     aRect = scrolledBox->GetRect();
     aRect.width  = nsPresContext::AppUnitsToIntCSSPixels(aRect.width);
     aRect.height = nsPresContext::AppUnitsToIntCSSPixels(aRect.height);
 }
 
-void ScrollBoxObject::GetPosition(JSContext* cx,
-                                  JS::Handle<JSObject*> x,
-                                  JS::Handle<JSObject*> y,
-                                  ErrorResult& aRv)
-{
-  CSSIntPoint pt;
-  GetPosition(pt, aRv);
-  JS::Rooted<JS::Value> v(cx);
-  if (!ToJSValue(cx, pt.x, &v) ||
-      !JS_SetProperty(cx, x, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  if (!ToJSValue(cx, pt.y, &v) ||
-      !JS_SetProperty(cx, y, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-}
-
-void ScrollBoxObject::GetScrolledSize(JSContext* cx,
-                                      JS::Handle<JSObject*> width,
-                                      JS::Handle<JSObject*> height,
-                                      ErrorResult& aRv)
-{
-  nsRect rect;
-  GetScrolledSize(rect, aRv);
-  JS::Rooted<JS::Value> v(cx);
-  if (!ToJSValue(cx, rect.width, &v) ||
-      !JS_SetProperty(cx, width, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-  if (!ToJSValue(cx, rect.height, &v) ||
-      !JS_SetProperty(cx, height, "value", v)) {
-    aRv.Throw(NS_ERROR_XPC_CANT_SET_OUT_VAL);
-    return;
-  }
-}
-
 void ScrollBoxObject::EnsureElementIsVisible(Element& child, ErrorResult& aRv)
 {
     nsCOMPtr<nsIPresShell> shell = GetPresShell(false);
     if (!shell) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
       return;
     }
 
     shell->ScrollContentIntoView(&child,
                                  nsIPresShell::ScrollAxis(),
                                  nsIPresShell::ScrollAxis(),
                                  nsIPresShell::SCROLL_FIRST_ANCESTOR_ONLY |
                                  nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
 }
-
-void ScrollBoxObject::EnsureIndexIsVisible(int32_t index, ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
-void ScrollBoxObject::EnsureLineIsVisible(int32_t line, ErrorResult& aRv)
-{
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-}
-
-} // namespace dom
-} // namespace mozilla
-
-// Creation Routine ///////////////////////////////////////////////////////////////////////
-
-using namespace mozilla::dom;
-
-nsresult
-NS_NewScrollBoxObject(nsIBoxObject** aResult)
-{
-  NS_ADDREF(*aResult = new ScrollBoxObject());
-  return NS_OK;
-}