| Index: Source/core/dom/Element.cpp
|
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
|
| index aff399f4b84719b13b22ab2811853fd989851923..6883aba3d2298e475d6bccda005ea1038b61900e 100644
|
| --- a/Source/core/dom/Element.cpp
|
| +++ b/Source/core/dom/Element.cpp
|
| @@ -30,6 +30,7 @@
|
| #include "RuntimeEnabledFeatures.h"
|
| #include "SVGNames.h"
|
| #include "XMLNames.h"
|
| +#include "bindings/v8/Dictionary.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| #include "core/accessibility/AXObjectCache.h"
|
| #include "core/animation/DocumentTimeline.h"
|
| @@ -95,6 +96,7 @@
|
| #include "core/rendering/RenderWidget.h"
|
| #include "core/svg/SVGDocumentExtensions.h"
|
| #include "core/svg/SVGElement.h"
|
| +#include "platform/scroll/ScrollableArea.h"
|
| #include "wtf/BitVector.h"
|
| #include "wtf/HashFunctions.h"
|
| #include "wtf/text/CString.h"
|
| @@ -744,6 +746,27 @@ void Element::setScrollLeft(int newLeft)
|
| }
|
| }
|
|
|
| +void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, ExceptionState& exceptionState)
|
| +{
|
| + String scrollBehaviorString;
|
| + ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
|
| + if (scrollOptionsHorizontal.get("behavior", scrollBehaviorString)) {
|
| + if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBehavior)) {
|
| + exceptionState.throwTypeError("The ScrollBehavior provided is invalid.");
|
| + return;
|
| + }
|
| + }
|
| +
|
| + int position;
|
| + if (!scrollOptionsHorizontal.get("x", position)) {
|
| + exceptionState.throwTypeError("ScrollOptionsHorizontal must include an 'x' member.");
|
| + return;
|
| + }
|
| +
|
| + // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly.
|
| + setScrollLeft(position);
|
| +}
|
| +
|
| void Element::setScrollTop(int newTop)
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
| @@ -769,6 +792,27 @@ void Element::setScrollTop(int newTop)
|
| }
|
| }
|
|
|
| +void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionState& exceptionState)
|
| +{
|
| + String scrollBehaviorString;
|
| + ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
|
| + if (scrollOptionsVertical.get("behavior", scrollBehaviorString)) {
|
| + if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBehavior)) {
|
| + exceptionState.throwTypeError("The ScrollBehavior provided is invalid.");
|
| + return;
|
| + }
|
| + }
|
| +
|
| + int position;
|
| + if (!scrollOptionsVertical.get("y", position)) {
|
| + exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y' member.");
|
| + return;
|
| + }
|
| +
|
| + // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly.
|
| + setScrollTop(position);
|
| +}
|
| +
|
| int Element::scrollWidth()
|
| {
|
| document().updateLayoutIgnorePendingStylesheets();
|
|
|