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

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

Issue 26023003: Get rid of custom code for clipboard.clearData() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-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 24 matching lines...) Expand all
35 #include "V8Node.h" 35 #include "V8Node.h"
36 #include "bindings/v8/V8Binding.h" 36 #include "bindings/v8/V8Binding.h"
37 #include "core/dom/Clipboard.h" 37 #include "core/dom/Clipboard.h"
38 #include "core/dom/Element.h" 38 #include "core/dom/Element.h"
39 #include "core/dom/Node.h" 39 #include "core/dom/Node.h"
40 #include "core/html/HTMLImageElement.h" 40 #include "core/html/HTMLImageElement.h"
41 #include "platform/geometry/IntPoint.h" 41 #include "platform/geometry/IntPoint.h"
42 42
43 namespace WebCore { 43 namespace WebCore {
44 44
45 void V8Clipboard::clearDataMethodCustom(const v8::FunctionCallbackInfo<v8::Value >& args)
46 {
47 Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
48
49 if (!args.Length()) {
50 clipboard->clearAllData();
51 return;
52 }
53
54 if (args.Length() != 1) {
55 throwError(v8SyntaxError, "clearData: Invalid number of arguments", args .GetIsolate());
56 return;
57 }
58
59 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]);
60 clipboard->clearData(type);
61 }
62
63 void V8Clipboard::setDragImageMethodCustom(const v8::FunctionCallbackInfo<v8::Va lue>& args) 45 void V8Clipboard::setDragImageMethodCustom(const v8::FunctionCallbackInfo<v8::Va lue>& args)
64 { 46 {
65 Clipboard* clipboard = V8Clipboard::toNative(args.Holder()); 47 Clipboard* clipboard = V8Clipboard::toNative(args.Holder());
66 48
67 if (!clipboard->isForDragAndDrop()) 49 if (!clipboard->isForDragAndDrop())
68 return; 50 return;
69 51
70 if (args.Length() != 3) { 52 if (args.Length() != 3) {
71 throwError(v8SyntaxError, "setDragImage: Invalid number of arguments", a rgs.GetIsolate()); 53 throwError(v8SyntaxError, "setDragImage: Invalid number of arguments", a rgs.GetIsolate());
72 return; 54 return;
(...skipping 11 matching lines...) Expand all
84 return; 66 return;
85 } 67 }
86 68
87 if (toElement(node)->hasTagName(HTMLNames::imgTag) && !node->inDocument()) 69 if (toElement(node)->hasTagName(HTMLNames::imgTag) && !node->inDocument())
88 clipboard->setDragImage(toHTMLImageElement(node)->cachedImage(), IntPoin t(x, y)); 70 clipboard->setDragImage(toHTMLImageElement(node)->cachedImage(), IntPoin t(x, y));
89 else 71 else
90 clipboard->setDragImageElement(node, IntPoint(x, y)); 72 clipboard->setDragImageElement(node, IntPoint(x, y));
91 } 73 }
92 74
93 } // namespace WebCore 75 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698