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

Side by Side Diff: Source/core/html/HTMLMarqueeElement.js

Issue 419683003: Inject a prototype object of a private script into the prototype chain of a holder object (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 installClass('HTMLMarqueeElement', function(global) { 7 installClass('HTMLMarqueeElement', function(global, HTMLMarqueeElementPrototype) {
8 8
9 var kDefaultScrollAmount = 6; 9 var kDefaultScrollAmount = 6;
10 var kDefaultScrollDelayMS = 85; 10 var kDefaultScrollDelayMS = 85;
11 var kMinimumScrollDelayMS = 60; 11 var kMinimumScrollDelayMS = 60;
12 12
13 var kDefaultLoopLimit = -1; 13 var kDefaultLoopLimit = -1;
14 14
15 var kBehaviorScroll = 'scroll'; 15 var kBehaviorScroll = 'scroll';
16 var kBehaviorSlide = 'slide'; 16 var kBehaviorSlide = 'slide';
17 var kBehaviorAlternate = 'alternate'; 17 var kBehaviorAlternate = 'alternate';
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // inline event handler. 100 // inline event handler.
101 var newEventHandler = value ? function() { value.apply(this, arg uments) } : null; 101 var newEventHandler = value ? function() { value.apply(this, arg uments) } : null;
102 if (newEventHandler) 102 if (newEventHandler)
103 this.addEventListener(eventName, newEventHandler); 103 this.addEventListener(eventName, newEventHandler);
104 this[functionPropertyName] = value; 104 this[functionPropertyName] = value;
105 this[eventHandlerPropertyName] = newEventHandler; 105 this[eventHandlerPropertyName] = newEventHandler;
106 }, 106 },
107 }); 107 });
108 } 108 }
109 109
110 var HTMLMarqueeElementPrototype = Object.create(HTMLElement.prototype);
111
112 reflectAttribute(HTMLMarqueeElementPrototype, 'behavior', 'behavior'); 110 reflectAttribute(HTMLMarqueeElementPrototype, 'behavior', 'behavior');
113 reflectAttribute(HTMLMarqueeElementPrototype, 'bgcolor', 'bgColor'); 111 reflectAttribute(HTMLMarqueeElementPrototype, 'bgcolor', 'bgColor');
114 reflectAttribute(HTMLMarqueeElementPrototype, 'direction', 'direction'); 112 reflectAttribute(HTMLMarqueeElementPrototype, 'direction', 'direction');
115 reflectAttribute(HTMLMarqueeElementPrototype, 'height', 'height'); 113 reflectAttribute(HTMLMarqueeElementPrototype, 'height', 'height');
116 reflectAttribute(HTMLMarqueeElementPrototype, 'hspace', 'hspace'); 114 reflectAttribute(HTMLMarqueeElementPrototype, 'hspace', 'hspace');
117 reflectAttribute(HTMLMarqueeElementPrototype, 'vspace', 'vspace'); 115 reflectAttribute(HTMLMarqueeElementPrototype, 'vspace', 'vspace');
118 reflectAttribute(HTMLMarqueeElementPrototype, 'width', 'width'); 116 reflectAttribute(HTMLMarqueeElementPrototype, 'width', 'width');
119 reflectBooleanAttribute(HTMLMarqueeElementPrototype, 'truespeed', 'trueSpeed '); 117 reflectBooleanAttribute(HTMLMarqueeElementPrototype, 'truespeed', 'trueSpeed ');
120 118
121 defineInlineEventHandler(HTMLMarqueeElementPrototype, 'start'); 119 defineInlineEventHandler(HTMLMarqueeElementPrototype, 'start');
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 this.player_ = null; 416 this.player_ = null;
419 player.cancel(); 417 player.cancel();
420 } 418 }
421 }; 419 };
422 420
423 // FIXME: We have to inject this HTMLMarqueeElement as a custom element in o rder to make 421 // FIXME: We have to inject this HTMLMarqueeElement as a custom element in o rder to make
424 // createdCallback, attachedCallback, detachedCallback and attributeChangedC allback workable. 422 // createdCallback, attachedCallback, detachedCallback and attributeChangedC allback workable.
425 // global.document.registerElement('i-marquee', { 423 // global.document.registerElement('i-marquee', {
426 // prototype: HTMLMarqueeElementPrototype, 424 // prototype: HTMLMarqueeElementPrototype,
427 // }); 425 // });
428
429 return HTMLMarqueeElementPrototype;
430 }); 426 });
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/PrivateScriptRunner.js ('k') | Source/core/testing/PrivateScriptTest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698