Implement viewport functions for window #1718

This commit is contained in:
farodin91 2015-09-01 22:14:10 +02:00
parent 9f85370885
commit f0987380dd
14 changed files with 466 additions and 63 deletions

View file

@ -105,36 +105,53 @@ partial interface Window {
CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt);
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
enum ScrollBehavior { "auto", "instant", "smooth" };
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
dictionary ScrollOptions {
ScrollBehavior behavior = "auto";
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
dictionary ScrollToOptions : ScrollOptions {
unrestricted double left;
unrestricted double top;
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface
partial interface Window {
//MediaQueryList matchMedia(DOMString query);
[SameObject] readonly attribute Screen screen;
// browsing context
//void moveTo(double x, double y);
//void moveBy(double x, double y);
//void resizeTo(double x, double y);
//void resizeBy(double x, double y);
void moveTo(long x, long y);
void moveBy(long x, long y);
void resizeTo(long x, long y);
void resizeBy(long x, long y);
// viewport
//readonly attribute double innerWidth;
//readonly attribute double innerHeight;
readonly attribute long innerWidth;
readonly attribute long innerHeight;
// viewport scrolling
//readonly attribute double scrollX;
//readonly attribute double pageXOffset;
//readonly attribute double scrollY;
//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);
readonly attribute long scrollX;
readonly attribute long pageXOffset;
readonly attribute long scrollY;
readonly attribute long pageYOffset;
void scroll(optional ScrollToOptions options);
void scroll(unrestricted double x, unrestricted double y);
void scrollTo(optional ScrollToOptions options);
void scrollTo(unrestricted double x, unrestricted double y);
void scrollBy(optional ScrollToOptions options);
void scrollBy(unrestricted double x, unrestricted double y);
// client
//readonly attribute double screenX;
//readonly attribute double screenY;
//readonly attribute double outerWidth;
//readonly attribute double outerHeight;
//readonly attribute double devicePixelRatio;
readonly attribute long screenX;
readonly attribute long screenY;
readonly attribute long outerWidth;
readonly attribute long outerHeight;
readonly attribute double devicePixelRatio;
};
// Proprietary extensions.