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

Side by Side Diff: Source/bindings/v8/custom/V8HTMLInputElementCustom.cpp

Issue 25403004: [oilpan] Figure out lifetime of remaining Node raw pointers (Part 2) (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 22 matching lines...) Expand all
33 33
34 #include "core/html/HTMLInputElement.h" 34 #include "core/html/HTMLInputElement.h"
35 35
36 #include "bindings/v8/V8Binding.h" 36 #include "bindings/v8/V8Binding.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 v8::Handle<v8::Value> V8HTMLInputElement::selectionStartAttrGetterCustom(v8::Loc al<v8::String> name, const v8::AccessorInfo& info) 40 v8::Handle<v8::Value> V8HTMLInputElement::selectionStartAttrGetterCustom(v8::Loc al<v8::String> name, const v8::AccessorInfo& info)
41 { 41 {
42 v8::Handle<v8::Object> holder = info.Holder(); 42 v8::Handle<v8::Object> holder = info.Holder();
43 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 43 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
44 44
45 if (!imp->canHaveSelection()) 45 if (!imp->canHaveSelection())
46 return throwTypeError("Accessing selectionStart on an input element that cannot have a selection.", info.GetIsolate()); 46 return throwTypeError("Accessing selectionStart on an input element that cannot have a selection.", info.GetIsolate());
47 47
48 int v = imp->selectionStart(); 48 int v = imp->selectionStart();
49 return v8Integer(v, info.GetIsolate()); 49 return v8Integer(v, info.GetIsolate());
50 } 50 }
51 51
52 void V8HTMLInputElement::selectionStartAttrSetterCustom(v8::Local<v8::String> na me, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 52 void V8HTMLInputElement::selectionStartAttrSetterCustom(v8::Local<v8::String> na me, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
53 { 53 {
54 v8::Handle<v8::Object> holder = info.Holder(); 54 v8::Handle<v8::Object> holder = info.Holder();
55 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 55 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
56 56
57 if (!imp->canHaveSelection()) { 57 if (!imp->canHaveSelection()) {
58 throwTypeError("Accessing selectionStart on an input element that cannot have a selection.", info.GetIsolate()); 58 throwTypeError("Accessing selectionStart on an input element that cannot have a selection.", info.GetIsolate());
59 return; 59 return;
60 } 60 }
61 imp->setSelectionStart(value->Int32Value()); 61 imp->setSelectionStart(value->Int32Value());
62 } 62 }
63 63
64 v8::Handle<v8::Value> V8HTMLInputElement::selectionEndAttrGetterCustom(v8::Local <v8::String> name, const v8::AccessorInfo& info) 64 v8::Handle<v8::Value> V8HTMLInputElement::selectionEndAttrGetterCustom(v8::Local <v8::String> name, const v8::AccessorInfo& info)
65 { 65 {
66 v8::Handle<v8::Object> holder = info.Holder(); 66 v8::Handle<v8::Object> holder = info.Holder();
67 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 67 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
68 68
69 if (!imp->canHaveSelection()) 69 if (!imp->canHaveSelection())
70 return throwTypeError("Accessing selectionEnd on an input element that c annot have a selection.", info.GetIsolate()); 70 return throwTypeError("Accessing selectionEnd on an input element that c annot have a selection.", info.GetIsolate());
71 71
72 int v = imp->selectionEnd(); 72 int v = imp->selectionEnd();
73 return v8Integer(v, info.GetIsolate()); 73 return v8Integer(v, info.GetIsolate());
74 } 74 }
75 75
76 void V8HTMLInputElement::selectionEndAttrSetterCustom(v8::Local<v8::String> name , v8::Local<v8::Value> value, const v8::AccessorInfo& info) 76 void V8HTMLInputElement::selectionEndAttrSetterCustom(v8::Local<v8::String> name , v8::Local<v8::Value> value, const v8::AccessorInfo& info)
77 { 77 {
78 v8::Handle<v8::Object> holder = info.Holder(); 78 v8::Handle<v8::Object> holder = info.Holder();
79 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 79 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
80 80
81 if (!imp->canHaveSelection()) { 81 if (!imp->canHaveSelection()) {
82 throwTypeError("Accessing selectionEnd on an input element that cannot h ave a selection.", info.GetIsolate()); 82 throwTypeError("Accessing selectionEnd on an input element that cannot h ave a selection.", info.GetIsolate());
83 return; 83 return;
84 } 84 }
85 85
86 imp->setSelectionEnd(value->Int32Value()); 86 imp->setSelectionEnd(value->Int32Value());
87 } 87 }
88 88
89 v8::Handle<v8::Value> V8HTMLInputElement::selectionDirectionAttrGetterCustom(v8: :Local<v8::String> name, const v8::AccessorInfo& info) 89 v8::Handle<v8::Value> V8HTMLInputElement::selectionDirectionAttrGetterCustom(v8: :Local<v8::String> name, const v8::AccessorInfo& info)
90 { 90 {
91 v8::Handle<v8::Object> holder = info.Holder(); 91 v8::Handle<v8::Object> holder = info.Holder();
92 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 92 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
93 93
94 if (!imp->canHaveSelection()) 94 if (!imp->canHaveSelection())
95 return throwTypeError("Accessing selectionDirection on an input element that cannot have a selection.", info.GetIsolate()); 95 return throwTypeError("Accessing selectionDirection on an input element that cannot have a selection.", info.GetIsolate());
96 96
97 return v8String(imp->selectionDirection(), info.GetIsolate()); 97 return v8String(imp->selectionDirection(), info.GetIsolate());
98 } 98 }
99 99
100 void V8HTMLInputElement::selectionDirectionAttrSetterCustom(v8::Local<v8::String > name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 100 void V8HTMLInputElement::selectionDirectionAttrSetterCustom(v8::Local<v8::String > name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
101 { 101 {
102 v8::Handle<v8::Object> holder = info.Holder(); 102 v8::Handle<v8::Object> holder = info.Holder();
103 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 103 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
104 104
105 if (!imp->canHaveSelection()) { 105 if (!imp->canHaveSelection()) {
106 throwTypeError("Accessing selectionDirection on an input element that ca nnot have a selection.", info.GetIsolate()); 106 throwTypeError("Accessing selectionDirection on an input element that ca nnot have a selection.", info.GetIsolate());
107 return; 107 return;
108 } 108 }
109 109
110 imp->setSelectionDirection(toWebCoreString(value)); 110 imp->setSelectionDirection(toWebCoreString(value));
111 } 111 }
112 112
113 v8::Handle<v8::Value> V8HTMLInputElement::setSelectionRangeMethodCustom(const v8 ::Arguments& args) 113 v8::Handle<v8::Value> V8HTMLInputElement::setSelectionRangeMethodCustom(const v8 ::Arguments& args)
114 { 114 {
115 v8::Handle<v8::Object> holder = args.Holder(); 115 v8::Handle<v8::Object> holder = args.Holder();
116 HTMLInputElement* imp = V8HTMLInputElement::toNative(holder); 116 Handle<HTMLInputElement> imp = adoptRawResult(V8HTMLInputElement::toNative(h older));
117 117
118 if (!imp->canHaveSelection()) 118 if (!imp->canHaveSelection())
119 return throwTypeError("Calling setSelectionRange on an input element tha t cannot have a selection.", args.GetIsolate()); 119 return throwTypeError("Calling setSelectionRange on an input element tha t cannot have a selection.", args.GetIsolate());
120 120
121 int start = args[0]->Int32Value(); 121 int start = args[0]->Int32Value();
122 int end = args[1]->Int32Value(); 122 int end = args[1]->Int32Value();
123 String direction = toWebCoreString(args[2]); 123 String direction = toWebCoreString(args[2]);
124 124
125 imp->setSelectionRange(start, end, direction); 125 imp->setSelectionRange(start, end, direction);
126 return v8::Undefined(); 126 return v8::Undefined();
127 } 127 }
128 128
129 } // namespace WebCore 129 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698