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

Unified Diff: Source/core/html/HTMLMarqueeElement.js

Issue 386353002: Implement reflected attributes of HTMLMarqueeElement in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMarqueeElement.js
diff --git a/Source/core/html/HTMLMarqueeElement.js b/Source/core/html/HTMLMarqueeElement.js
index 110b05434330eda129b541fd5a380e0bd1d3403c..ac7b3600d38a5f6deeebfc204839ae67f0ed9907 100644
--- a/Source/core/html/HTMLMarqueeElement.js
+++ b/Source/core/html/HTMLMarqueeElement.js
@@ -4,7 +4,7 @@
'use strict';
-(function(global) {
+installClass('HTMLMarqueeElement', function(global) {
var kDefaultScrollAmount = 6;
var kDefaultScrollDelayMS = 85;
@@ -32,8 +32,7 @@
var pixelLengthRegexp = /^\s*([\d.]+)\s*$/;
var percentageLengthRegexp = /^\s*([\d.]+)\s*%\s*$/;
- function convertHTMLLengthToCSSLength(value)
- {
+ function convertHTMLLengthToCSSLength(value) {
var pixelMatch = value.match(pixelLengthRegexp);
if (pixelMatch)
return pixelMatch[1] + 'px';
@@ -43,8 +42,8 @@
return null;
}
- function reflectAttribute(prototype, attributeName, propertyName)
- {
+ // FIXME: Consider moving these utility functions to PrivateScriptUtils.js.
+ function reflectAttribute(prototype, attributeName, propertyName) {
Object.defineProperty(prototype, propertyName, {
get: function() {
return this.getAttribute(attributeName) || '';
@@ -52,23 +51,26 @@
set: function(value) {
this.setAttribute(attributeName, value);
},
+ configurable: true,
+ enumerable: true,
});
}
- function reflectBooleanAttribute(prototype, attributeName, propertyName)
- {
+ function reflectBooleanAttribute(prototype, attributeName, propertyName) {
Object.defineProperty(prototype, propertyName, {
get: function() {
return this.hasAttribute(attributeName);
},
set: function(value) {
- this.setAttribute(attributeName, value ? '' : null);
+ if (Boolean(value) === false)
abarth-chromium 2014/07/14 06:04:35 Does this call valueOf? Are we supposed to call v
abarth-chromium 2014/07/14 06:04:35 Does this call valueOf? Are we supposed to call v
haraken 2014/07/14 09:59:12 Done.
+ this.removeAttribute(attributeName);
+ else
+ this.setAttribute(attributeName, value ? '' : null);
},
});
}
- function defineInlineEventHandler(prototype, eventName)
- {
+ function defineInlineEventHandler(prototype, eventName) {
var propertyName = 'on' + eventName;
// FIXME: We should use symbols here instead.
var functionPropertyName = propertyName + 'Function_';
@@ -397,8 +399,11 @@
}
};
- global.document.registerElement('i-marquee', {
- prototype: HTMLMarqueeElementPrototype,
- });
+ // FIXME: We have to inject this HTMLMarqueeElement as a custom element in order to make
+ // createdCallback, attachedCallback, detachedCallback and attributeChangedCallback workable.
+ // global.document.registerElement('i-marquee', {
+ // prototype: HTMLMarqueeElementPrototype,
+ // });
-})(this);
+ return HTMLMarqueeElementPrototype;
+});

Powered by Google App Engine
This is Rietveld 408576698