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

Unified Diff: Source/bindings/v8/custom/V8HTMLPictureElementConstructor.cpp

Issue 14449003: Picture element initial implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@picture_after_rebase
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLPictureElementConstructor.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8HTMLPictureElementConstructor.cpp
diff --git a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/Source/bindings/v8/custom/V8HTMLPictureElementConstructor.cpp
similarity index 72%
copy from Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
copy to Source/bindings/v8/custom/V8HTMLPictureElementConstructor.cpp
index 9e78abf5d58ab581bcfcc3e75911e89eba58db04..2d48f53cc7e3e538c2913d0b022c2bd7ff2c5aeb 100644
--- a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/Source/bindings/v8/custom/V8HTMLPictureElementConstructor.cpp
@@ -29,23 +29,24 @@
*/
#include "config.h"
-#include "V8HTMLImageElementConstructor.h"
+#if ENABLE(PICTURE)
+#include "V8HTMLPictureElementConstructor.h"
#include "BindingState.h"
#include "Document.h"
#include "Frame.h"
-#include "HTMLImageElement.h"
#include "HTMLNames.h"
+#include "HTMLPictureElement.h"
#include "V8Binding.h"
#include "V8Document.h"
-#include "V8HTMLImageElement.h"
+#include "V8HTMLPictureElement.h"
#include <wtf/RefPtr.h>
namespace WebCore {
-WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, V8HTMLImageElement::toEventTarget, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
+WrapperTypeInfo V8HTMLPictureElementConstructor::info = { V8HTMLPictureElementConstructor::GetTemplate, V8HTMLPictureElement::derefObject, 0, V8HTMLPictureElement::toEventTarget, 0, V8HTMLPictureElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
-static v8::Handle<v8::Value> v8HTMLImageElementConstructorMethodCustom(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLPictureElementConstructorMethodCustom(const v8::Arguments& args)
{
if (!args.IsConstructCall())
return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
@@ -55,9 +56,9 @@ static v8::Handle<v8::Value> v8HTMLImageElementConstructorMethodCustom(const v8:
Document* document = currentDocument(BindingState::instance());
- // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
+ // Make sure the document is added to the DOM Node map. Otherwise, the HTMLPictureElement instance
// may end up being the only node in the map and get garbage-collected prematurely.
- // FIXME: The correct way to do this would be to make HTMLImageElement derive from
+ // FIXME: The correct way to do this would be to make HTMLPictureElement derive from
// ActiveDOMObject and use its interface to keep its wrapper alive. Then we would
// remove this code and the special case in isObservableThroughDOM.
toV8(document, args.Holder(), args.GetIsolate());
@@ -75,28 +76,29 @@ static v8::Handle<v8::Value> v8HTMLImageElementConstructorMethodCustom(const v8:
optionalHeight = &height;
}
- RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight);
+ RefPtr<HTMLPictureElement> image = HTMLPictureElement::createForJSConstructor(document, optionalWidth, optionalHeight);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(image.release(), &V8HTMLImageElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper(image.release(), &V8HTMLPictureElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
return wrapper;
}
-v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(v8::Isolate* isolate, WrapperWorldType worldType)
+v8::Persistent<v8::FunctionTemplate> V8HTMLPictureElementConstructor::GetTemplate(v8::Isolate* isolate, WrapperWorldType worldType)
{
static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
if (!cachedTemplate.IsEmpty())
return cachedTemplate;
v8::HandleScope scope;
- v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorMethodCustom);
+ v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLPictureElementConstructorMethodCustom);
v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
- instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
- result->SetClassName(v8::String::NewSymbol("HTMLImageElement"));
- result->Inherit(V8HTMLImageElement::GetTemplate(isolate, worldType));
+ instance->SetInternalFieldCount(V8HTMLPictureElement::internalFieldCount);
+ result->SetClassName(v8::String::New("HTMLPictureElement"));
+ result->Inherit(V8HTMLPictureElement::GetTemplate(isolate, worldType));
cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(isolate, result);
return cachedTemplate;
}
} // namespace WebCore
+#endif
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLPictureElementConstructor.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698