ScrollBoxObject.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_ScrollBoxObject_h
  6. #define mozilla_dom_ScrollBoxObject_h
  7. #include "mozilla/dom/BoxObject.h"
  8. #include "Units.h"
  9. class nsIScrollableFrame;
  10. struct nsRect;
  11. namespace mozilla {
  12. namespace dom {
  13. class ScrollBoxObject final : public BoxObject
  14. {
  15. public:
  16. ScrollBoxObject();
  17. virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  18. virtual nsIScrollableFrame* GetScrollFrame();
  19. void ScrollTo(int32_t x, int32_t y, ErrorResult& aRv);
  20. void ScrollBy(int32_t dx, int32_t dy, ErrorResult& aRv);
  21. void ScrollByLine(int32_t dlines, ErrorResult& aRv);
  22. void ScrollByIndex(int32_t dindexes, ErrorResult& aRv);
  23. void ScrollToLine(int32_t line, ErrorResult& aRv);
  24. void ScrollToElement(Element& child, ErrorResult& aRv);
  25. void ScrollToIndex(int32_t index, ErrorResult& aRv);
  26. int32_t GetPositionX(ErrorResult& aRv);
  27. int32_t GetPositionY(ErrorResult& aRv);
  28. int32_t GetScrolledWidth(ErrorResult& aRv);
  29. int32_t GetScrolledHeight(ErrorResult& aRv);
  30. void EnsureElementIsVisible(Element& child, ErrorResult& aRv);
  31. void EnsureIndexIsVisible(int32_t index, ErrorResult& aRv);
  32. void EnsureLineIsVisible(int32_t line, ErrorResult& aRv);
  33. // Deprecated APIs from old IDL
  34. void GetPosition(JSContext* cx,
  35. JS::Handle<JSObject*> x,
  36. JS::Handle<JSObject*> y,
  37. ErrorResult& aRv);
  38. void GetScrolledSize(JSContext* cx,
  39. JS::Handle<JSObject*> width,
  40. JS::Handle<JSObject*> height,
  41. ErrorResult& aRv);
  42. protected:
  43. void GetScrolledSize(nsRect& aRect, ErrorResult& aRv);
  44. void GetPosition(CSSIntPoint& aPos, ErrorResult& aRv);
  45. private:
  46. ~ScrollBoxObject();
  47. };
  48. } // namespace dom
  49. } // namespace mozilla
  50. #endif // mozilla_dom_ScrollBoxObject_h