mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1022818 - Part 1: Update webidl interfaces. r=bz
- Extended the Element and Window webidl interfaces as described in the CSSOM-View smooth-scrolling specification. - The Element.scrollTop and Element.scrollLeft changes have been omitted until either WebIDL is extended to allow properties to have union datatypes that contain dictionaries or the CSSOM-View smooth-scroll specification is upddated. This will not prevent the other interface changes from being useful. - Implemented wrapper functions for the nsGlobalWindow to connect to the new WebIDL bindings. The ScrollOptions parameters are ignored in this patch, and used in Part 3 of this patch series.
This commit is contained in:
parent
7c0f8cfac6
commit
8afdeb1efa
@ -35,6 +35,7 @@
|
||||
#include "nsAttrValue.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsIDOMEventListener;
|
||||
@ -715,11 +716,8 @@ public:
|
||||
already_AddRefed<ShadowRoot> CreateShadowRoot(ErrorResult& aError);
|
||||
already_AddRefed<DestinationInsertionPointList> GetDestinationInsertionPoints();
|
||||
|
||||
void ScrollIntoView()
|
||||
{
|
||||
ScrollIntoView(true);
|
||||
}
|
||||
void ScrollIntoView(bool aTop);
|
||||
void ScrollIntoView();
|
||||
void ScrollIntoView(bool aTop, const ScrollOptions &aOptions);
|
||||
int32_t ScrollTop()
|
||||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
|
@ -585,7 +585,13 @@ Element::GetScrollFrame(nsIFrame **aStyledFrame, bool aFlushLayout)
|
||||
}
|
||||
|
||||
void
|
||||
Element::ScrollIntoView(bool aTop)
|
||||
Element::ScrollIntoView()
|
||||
{
|
||||
ScrollIntoView(true, ScrollOptions());
|
||||
}
|
||||
|
||||
void
|
||||
Element::ScrollIntoView(bool aTop, const ScrollOptions &aOptions)
|
||||
{
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
if (!document) {
|
||||
|
@ -469,7 +469,7 @@ public:
|
||||
if (!_argc) {
|
||||
top = true;
|
||||
}
|
||||
mozilla::dom::Element::ScrollIntoView(top);
|
||||
mozilla::dom::Element::ScrollIntoView(top, mozilla::dom::ScrollOptions());
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) MOZ_FINAL {
|
||||
|
@ -7200,6 +7200,20 @@ nsGlobalWindow::GetTopWindowRoot()
|
||||
return window.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::Scroll(int32_t aXScroll, int32_t aYScroll,
|
||||
const ScrollOptions& aOptions)
|
||||
{
|
||||
ScrollTo(CSSIntPoint(aXScroll, aYScroll));
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ScrollTo(int32_t aXScroll, int32_t aYScroll,
|
||||
const ScrollOptions& aOptions)
|
||||
{
|
||||
ScrollTo(CSSIntPoint(aXScroll, aYScroll));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::Scroll(int32_t aXScroll, int32_t aYScroll)
|
||||
{
|
||||
@ -7256,6 +7270,27 @@ nsGlobalWindow::MozRequestOverfill(OverfillCallback& aCallback,
|
||||
aError.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ScrollBy(int32_t aXScrollDif, int32_t aYScrollDif,
|
||||
const ScrollOptions& aOptions)
|
||||
{
|
||||
ScrollBy(aXScrollDif, aYScrollDif);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ScrollByLines(int32_t numLines,
|
||||
const ScrollOptions& aOptions)
|
||||
{
|
||||
ScrollByLines(numLines);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::ScrollByPages(int32_t numPages,
|
||||
const ScrollOptions& aOptions)
|
||||
{
|
||||
ScrollByPages(numPages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::ScrollBy(int32_t aXScrollDif, int32_t aYScrollDif)
|
||||
{
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/WindowBinding.h"
|
||||
#include "Units.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
@ -934,6 +935,16 @@ public:
|
||||
mozilla::ErrorResult& aError);
|
||||
void ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
|
||||
mozilla::ErrorResult& aError);
|
||||
void Scroll(int32_t aXScroll, int32_t aYScroll,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
void ScrollTo(int32_t aXScroll, int32_t aYScroll,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
void ScrollBy(int32_t aXScrollDif, int32_t aYScrollDif,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
void ScrollByLines(int32_t numLines,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
void ScrollByPages(int32_t numPages,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
int32_t GetInnerWidth(mozilla::ErrorResult& aError);
|
||||
void SetInnerWidth(int32_t aInnerWidth, mozilla::ErrorResult& aError);
|
||||
int32_t GetInnerHeight(mozilla::ErrorResult& aError);
|
||||
|
@ -153,7 +153,7 @@ partial interface Element {
|
||||
|
||||
// scrolling
|
||||
void scrollIntoView();
|
||||
void scrollIntoView(boolean top);
|
||||
void scrollIntoView(boolean top, optional ScrollOptions options);
|
||||
// None of the CSSOM attributes are [Pure], because they flush
|
||||
attribute long scrollTop; // scroll on setting
|
||||
attribute long scrollLeft; // scroll on setting
|
||||
|
@ -179,16 +179,13 @@ partial interface Window {
|
||||
//[Throws] readonly attribute double pageXOffset;
|
||||
//[Throws] readonly attribute double scrollY;
|
||||
//[Throws] readonly attribute double pageYOffset;
|
||||
//void scroll(double x, double y, optional ScrollOptions options);
|
||||
//void scrollTo(double x, double y, optional ScrollOptions options);
|
||||
//void scrollBy(double x, double y, optional ScrollOptions options);
|
||||
void scroll(double x, double y, optional ScrollOptions options);
|
||||
void scrollTo(double x, double y, optional ScrollOptions options);
|
||||
void scrollBy(double x, double y, optional ScrollOptions options);
|
||||
[Replaceable, Throws] readonly attribute long scrollX;
|
||||
[Throws] readonly attribute long pageXOffset;
|
||||
[Replaceable, Throws] readonly attribute long scrollY;
|
||||
[Throws] readonly attribute long pageYOffset;
|
||||
void scroll(long x, long y);
|
||||
void scrollTo(long x, long y);
|
||||
void scrollBy(long x, long y);
|
||||
|
||||
// client
|
||||
//[Throws] readonly attribute double screenX;
|
||||
@ -271,12 +268,12 @@ partial interface Window {
|
||||
/**
|
||||
* Method for scrolling this window by a number of lines.
|
||||
*/
|
||||
void scrollByLines(long numLines);
|
||||
void scrollByLines(long numLines, optional ScrollOptions options);
|
||||
|
||||
/**
|
||||
* Method for scrolling this window by a number of pages.
|
||||
*/
|
||||
void scrollByPages(long numPages);
|
||||
void scrollByPages(long numPages, optional ScrollOptions options);
|
||||
|
||||
/**
|
||||
* Method for sizing this window to the content in the window.
|
||||
|
Loading…
Reference in New Issue
Block a user