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

Side by Side Diff: Source/bindings/core/v8/Dictionary.cpp

Issue 354333002: Add path option(path2d) for hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nit and rebase Created 6 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 17 matching lines...) Expand all
28 28
29 #include "bindings/core/v8/ArrayValue.h" 29 #include "bindings/core/v8/ArrayValue.h"
30 #include "bindings/core/v8/ExceptionMessages.h" 30 #include "bindings/core/v8/ExceptionMessages.h"
31 #include "bindings/core/v8/ExceptionState.h" 31 #include "bindings/core/v8/ExceptionState.h"
32 #include "bindings/core/v8/V8Binding.h" 32 #include "bindings/core/v8/V8Binding.h"
33 #include "bindings/core/v8/V8DOMError.h" 33 #include "bindings/core/v8/V8DOMError.h"
34 #include "bindings/core/v8/V8Element.h" 34 #include "bindings/core/v8/V8Element.h"
35 #include "bindings/core/v8/V8EventTarget.h" 35 #include "bindings/core/v8/V8EventTarget.h"
36 #include "bindings/core/v8/V8MediaKeyError.h" 36 #include "bindings/core/v8/V8MediaKeyError.h"
37 #include "bindings/core/v8/V8MessagePort.h" 37 #include "bindings/core/v8/V8MessagePort.h"
38 #include "bindings/core/v8/V8Path2D.h"
38 #include "bindings/core/v8/V8Storage.h" 39 #include "bindings/core/v8/V8Storage.h"
39 #include "bindings/core/v8/V8TextTrack.h" 40 #include "bindings/core/v8/V8TextTrack.h"
40 #include "bindings/core/v8/V8VoidCallback.h" 41 #include "bindings/core/v8/V8VoidCallback.h"
41 #include "bindings/core/v8/V8Window.h" 42 #include "bindings/core/v8/V8Window.h"
42 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" 43 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h"
43 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" 44 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
44 #include "bindings/modules/v8/V8Gamepad.h" 45 #include "bindings/modules/v8/V8Gamepad.h"
45 #include "bindings/modules/v8/V8HeaderMap.h" 46 #include "bindings/modules/v8/V8HeaderMap.h"
46 #include "bindings/modules/v8/V8Headers.h" 47 #include "bindings/modules/v8/V8Headers.h"
47 #include "bindings/modules/v8/V8IDBKeyRange.h" 48 #include "bindings/modules/v8/V8IDBKeyRange.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool Dictionary::getWithUndefinedOrNullCheck(const String& key, RefPtrWillBeMemb er<Element>& value) const 423 bool Dictionary::getWithUndefinedOrNullCheck(const String& key, RefPtrWillBeMemb er<Element>& value) const
423 { 424 {
424 v8::Local<v8::Value> v8Value; 425 v8::Local<v8::Value> v8Value;
425 if (!getKey(key, v8Value) || WebCore::isUndefinedOrNull(v8Value)) 426 if (!getKey(key, v8Value) || WebCore::isUndefinedOrNull(v8Value))
426 return false; 427 return false;
427 428
428 value = V8Element::toNativeWithTypeCheck(m_isolate, v8Value); 429 value = V8Element::toNativeWithTypeCheck(m_isolate, v8Value);
429 return true; 430 return true;
430 } 431 }
431 432
433 bool Dictionary::getWithUndefinedOrNullCheck(const String& key, RefPtr<Path2D>& value) const
434 {
435 v8::Local<v8::Value> v8Value;
436 if (!getKey(key, v8Value) || WebCore::isUndefinedOrNull(v8Value))
437 return false;
438
439 value = V8Path2D::toNativeWithTypeCheck(m_isolate, v8Value);
440 return true;
441 }
442
432 bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const 443 bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const
433 { 444 {
434 v8::Local<v8::Value> v8Value; 445 v8::Local<v8::Value> v8Value;
435 if (!getKey(key, v8Value)) 446 if (!getKey(key, v8Value))
436 return false; 447 return false;
437 448
438 value = V8Uint8Array::toNativeWithTypeCheck(m_isolate, v8Value); 449 value = V8Uint8Array::toNativeWithTypeCheck(m_isolate, v8Value);
439 return true; 450 return true;
440 } 451 }
441 452
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 768
758 return *this; 769 return *this;
759 } 770 }
760 771
761 void Dictionary::ConversionContext::throwTypeError(const String& detail) 772 void Dictionary::ConversionContext::throwTypeError(const String& detail)
762 { 773 {
763 exceptionState().throwTypeError(detail); 774 exceptionState().throwTypeError(detail);
764 } 775 }
765 776
766 } // namespace WebCore 777 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/Dictionary.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698