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

Side by Side Diff: Source/bindings/dart/custom/DartElementCustom.cpp

Issue 237513004: Implemented custom support for scrollLeft/scrollTop in Element (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1847
Patch Set: Created 6 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 15 matching lines...) Expand all
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "DartElement.h" 31 #include "DartElement.h"
32 32
33 #include "DartElement.h" 33 #include "DartElement.h"
34 #include "DartHTMLElement.h" 34 #include "DartHTMLElement.h"
35 #include "DartSVGElement.h" 35 #include "DartSVGElement.h"
36 #include "RuntimeEnabledFeatures.h"
36 #include "bindings/dart/DartDOMWrapper.h" 37 #include "bindings/dart/DartDOMWrapper.h"
37 38
38 namespace WebCore { 39 namespace WebCore {
39 40
40 Dart_Handle DartElement::createWrapper(DartDOMData* domData, Element* element) 41 Dart_Handle DartElement::createWrapper(DartDOMData* domData, Element* element)
41 { 42 {
42 if (!element) 43 if (!element)
43 return Dart_Null(); 44 return Dart_Null();
44 45
45 if (element->isHTMLElement()) 46 if (element->isHTMLElement())
46 return DartHTMLElement::createWrapper(domData, static_cast<HTMLElement*> (element)); 47 return DartHTMLElement::createWrapper(domData, static_cast<HTMLElement*> (element));
47 if (element->isSVGElement()) 48 if (element->isSVGElement())
48 return DartSVGElement::createWrapper(domData, static_cast<SVGElement*>(e lement)); 49 return DartSVGElement::createWrapper(domData, static_cast<SVGElement*>(e lement));
49 return DartDOMWrapper::createWrapper<DartElement>(domData, element); 50 return DartDOMWrapper::createWrapper<DartElement>(domData, element);
50 } 51 }
51 52
52 namespace DartElementInternal { 53 namespace DartElementInternal {
53 54
54 void scrollLeftGetter(Dart_NativeArguments args)
55 {
56 {
57 Element* receiver = DartDOMWrapper::receiver< Element >(args);
58
59 DartUtilities::setDartIntegerReturnValue(args, receiver->scrollLeft());
60 return;
61 }
62 }
63
64 void scrollTopGetter(Dart_NativeArguments args)
65 {
66 {
67 Element* receiver = DartDOMWrapper::receiver< Element >(args);
68
69 DartUtilities::setDartIntegerReturnValue(args, receiver->scrollTop());
70 return;
71 }
72 }
73 55
74 void scrollLeftSetter(Dart_NativeArguments args) 56 void scrollLeftSetter(Dart_NativeArguments args)
75 { 57 {
76 // FIXMEDART: implement 58 Dart_Handle exception = 0;
59 {
60 Element* receiver = DartDOMWrapper::receiver<Element>(args);
61
62 // FIXME: The IDL now specifies an option to pass in a dictionary
63 // instead of just an integer.
64 int scrollLeft = DartUtilities::dartToInt(args, 1, exception);
65 if (exception)
66 goto fail;
67
68 receiver->setScrollLeft(scrollLeft);
69 return;
70 }
71
72 fail:
73 Dart_ThrowException(exception);
77 ASSERT_NOT_REACHED(); 74 ASSERT_NOT_REACHED();
78 } 75 }
79 76
80 void scrollTopSetter(Dart_NativeArguments args) 77 void scrollTopSetter(Dart_NativeArguments args)
81 { 78 {
82 // FIXMEDART: implement 79 Dart_Handle exception = 0;
80 {
81 Element* receiver = DartDOMWrapper::receiver<Element>(args);
82
83 // FIXME: The IDL now specifies an option to pass in a dictionary
84 // instead of just an integer.
85 int scrollTop = DartUtilities::dartToInt(args, 1, exception);
86 if (exception)
87 goto fail;
88
89 receiver->setScrollTop(scrollTop);
90 return;
91 }
92
93 fail:
94 Dart_ThrowException(exception);
83 ASSERT_NOT_REACHED(); 95 ASSERT_NOT_REACHED();
84 } 96 }
85 97
86 } 98 }
87 99
88 } 100 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698