Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: Source/bindings/core/v8/custom/V8ElementCustom.cpp

Issue 782793002: Update Element API for CSSOM smooth scrolling to match the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "bindings/core/v8/V8Binding.h" 38 #include "bindings/core/v8/V8Binding.h"
39 #include "bindings/core/v8/V8BindingMacros.h" 39 #include "bindings/core/v8/V8BindingMacros.h"
40 #include "core/animation/ElementAnimation.h" 40 #include "core/animation/ElementAnimation.h"
41 #include "core/dom/Element.h" 41 #include "core/dom/Element.h"
42 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
43 #include "platform/RuntimeEnabledFeatures.h" 43 #include "platform/RuntimeEnabledFeatures.h"
44 #include "wtf/GetPtr.h" 44 #include "wtf/GetPtr.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 void V8Element::scrollLeftAttributeSetterCustom(v8::Local<v8::Value> value, cons t v8::PropertyCallbackInfo<void>& info)
49 {
50 ExceptionState exceptionState(ExceptionState::SetterContext, "scrollLeft", " Element", info.Holder(), info.GetIsolate());
51 Element* impl = V8Element::toImpl(info.Holder());
52
53 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && value->IsObject()) {
54 TONATIVE_VOID(Dictionary, scrollOptionsHorizontal, Dictionary(value, inf o.GetIsolate(), exceptionState));
55 impl->setScrollLeft(scrollOptionsHorizontal, exceptionState);
56 exceptionState.throwIfNeeded();
57 return;
58 }
59
60 TONATIVE_VOID_EXCEPTIONSTATE(float, position, toFloat(value, exceptionState) , exceptionState);
61 impl->setScrollLeft(position);
62 }
63
64 void V8Element::scrollTopAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
65 {
66 ExceptionState exceptionState(ExceptionState::SetterContext, "scrollTop", "E lement", info.Holder(), info.GetIsolate());
67 Element* impl = V8Element::toImpl(info.Holder());
68
69 if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && value->IsObject()) {
70 TONATIVE_VOID(Dictionary, scrollOptionsVertical, Dictionary(value, info. GetIsolate(), exceptionState));
71 impl->setScrollTop(scrollOptionsVertical, exceptionState);
72 exceptionState.throwIfNeeded();
73 return;
74 }
75
76 TONATIVE_VOID_EXCEPTIONSTATE(float, position, toFloat(value, exceptionState) , exceptionState);
77 impl->setScrollTop(position);
78 }
79
80 //////////////////////////////////////////////////////////////////////////////// 48 ////////////////////////////////////////////////////////////////////////////////
81 // Overload resolution for animate() 49 // Overload resolution for animate()
82 // FIXME: needs support for union types http://crbug.com/240176 50 // FIXME: needs support for union types http://crbug.com/240176
83 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
84 52
85 // AnimationPlayer animate(AnimationEffect? effect); 53 // AnimationPlayer animate(AnimationEffect? effect);
86 void animate1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 54 void animate1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
87 { 55 {
88 Element* impl = V8Element::toImpl(info.Holder()); 56 Element* impl = V8Element::toImpl(info.Holder());
89 TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toImplWithTypeChe ck(info.GetIsolate(), info[0])); 57 TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toImplWithTypeChe ck(info.GetIsolate(), info[0]));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 setArityTypeError(exceptionState, "[1]", info.Length()); 197 setArityTypeError(exceptionState, "[1]", info.Length());
230 exceptionState.throwIfNeeded(); 198 exceptionState.throwIfNeeded();
231 return; 199 return;
232 break; 200 break;
233 } 201 }
234 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 202 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
235 exceptionState.throwIfNeeded(); 203 exceptionState.throwIfNeeded();
236 } 204 }
237 205
238 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698