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

Side by Side Diff: third_party/WebKit/WebCore/bindings/js/JSNodeCustom.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 #include "EntityReference.h" 36 #include "EntityReference.h"
37 #include "HTMLElement.h" 37 #include "HTMLElement.h"
38 #include "JSAttr.h" 38 #include "JSAttr.h"
39 #include "JSCDATASection.h" 39 #include "JSCDATASection.h"
40 #include "JSComment.h" 40 #include "JSComment.h"
41 #include "JSDocument.h" 41 #include "JSDocument.h"
42 #include "JSDocumentFragment.h" 42 #include "JSDocumentFragment.h"
43 #include "JSDocumentType.h" 43 #include "JSDocumentType.h"
44 #include "JSEntity.h" 44 #include "JSEntity.h"
45 #include "JSEntityReference.h" 45 #include "JSEntityReference.h"
46 #include "JSEventListener.h"
47 #include "JSHTMLElement.h" 46 #include "JSHTMLElement.h"
48 #include "JSHTMLElementWrapperFactory.h" 47 #include "JSHTMLElementWrapperFactory.h"
49 #include "JSNotation.h" 48 #include "JSNotation.h"
50 #include "JSProcessingInstruction.h" 49 #include "JSProcessingInstruction.h"
51 #include "JSText.h" 50 #include "JSText.h"
52 #include "Node.h" 51 #include "Node.h"
53 #include "Notation.h" 52 #include "Notation.h"
54 #include "ProcessingInstruction.h" 53 #include "ProcessingInstruction.h"
55 #include "Text.h" 54 #include "Text.h"
56 #include <wtf/PassRefPtr.h> 55 #include <wtf/PassRefPtr.h>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 JSValuePtr JSNode::appendChild(ExecState* exec, const ArgList& args) 99 JSValuePtr JSNode::appendChild(ExecState* exec, const ArgList& args)
101 { 100 {
102 ExceptionCode ec = 0; 101 ExceptionCode ec = 0;
103 bool ok = impl()->appendChild(toNode(args.at(exec, 0)), ec, true); 102 bool ok = impl()->appendChild(toNode(args.at(exec, 0)), ec, true);
104 setDOMException(exec, ec); 103 setDOMException(exec, ec);
105 if (ok) 104 if (ok)
106 return args.at(exec, 0); 105 return args.at(exec, 0);
107 return jsNull(); 106 return jsNull();
108 } 107 }
109 108
110 JSValuePtr JSNode::addEventListener(ExecState* exec, const ArgList& args)
111 {
112 JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutio nContext());
113 if (!globalObject)
114 return jsUndefined();
115
116 if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventList ener(exec, args.at(exec, 1)))
117 impl()->addEventListener(args.at(exec, 0).toString(exec), listener.relea se(), args.at(exec, 2).toBoolean(exec));
118
119 return jsUndefined();
120 }
121
122 JSValuePtr JSNode::removeEventListener(ExecState* exec, const ArgList& args)
123 {
124 JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutio nContext());
125 if (!globalObject)
126 return jsUndefined();
127
128 if (JSEventListener* listener = globalObject->findJSEventListener(args.at(ex ec, 1)))
129 impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, a rgs.at(exec, 2).toBoolean(exec));
130
131 return jsUndefined();
132 }
133
134 void JSNode::pushEventHandlerScope(ExecState*, ScopeChain&) const
135 {
136 }
137
138 void JSNode::mark() 109 void JSNode::mark()
139 { 110 {
140 ASSERT(!marked()); 111 ASSERT(!marked());
141 112
142 Node* node = m_impl.get(); 113 Node* node = m_impl.get();
143 114
144 // Nodes in the document are kept alive by JSDocument::mark, 115 // Nodes in the document are kept alive by JSDocument::mark,
145 // so we have no special responsibilities and can just call the base class h ere. 116 // so we have no special responsibilities and can just call the base class h ere.
146 if (node->inDocument()) { 117 if (node->inDocument()) {
147 // But if the document isn't marked we have to mark it to ensure that 118 // But if the document isn't marked we have to mark it to ensure that
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 233
263 JSNode* wrapper = getCachedDOMNodeWrapper(node->document(), node); 234 JSNode* wrapper = getCachedDOMNodeWrapper(node->document(), node);
264 if (wrapper) 235 if (wrapper)
265 return wrapper; 236 return wrapper;
266 237
267 return createWrapper(exec, node); 238 return createWrapper(exec, node);
268 } 239 }
269 240
270 } // namespace WebCore 241 } // namespace WebCore
271 242
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698