<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206745] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206745">206745</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-03 13:31:06 -0700 (Mon, 03 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Modern Media Controls] LayoutItem and Button classes
https://bugs.webkit.org/show_bug.cgi?id=162868
&lt;rdar://problem/28590166&gt;

Patch by Antoine Quint &lt;graouts@apple.com&gt; on 2016-10-03
Reviewed by Dean Jackson.

Source/WebCore:

We introduce the new Button class and its parent class LayoutItem. We will subclass Button
a lot in coming patches, as it provides a way to create a button and provide a delegate to
respond to UI events via the `uiDelegate` property. A Button extends a LayoutItem, another
class that we'll subclass heavily in coming patches, which is simply a LayoutNode with a
`layoutDelegate` which allows to set the node's `layoutTraits`, a bit-mask allowing to
specify layout attributes such as the platform and playback styles.

Tests: media/modern-media-controls/button/button.html
       media/modern-media-controls/layout-item/layout-item.html

* Modules/modern-media-controls/controls/button.css: Added.
(button):
* Modules/modern-media-controls/controls/button.js: Added.
(Button):
(Button.prototype.get enabled):
(Button.prototype.set enabled):
(Button.prototype.handleEvent):
(Button.prototype._handleUIEvent):
* Modules/modern-media-controls/controls/layout-item.js: Added.
(LayoutItem.prototype.get layoutTraits):
(LayoutItem):

LayoutTests:

Testing all public properties and methods of the LayoutItem and Button classes.

* media/modern-media-controls/button/button-expected.txt: Added.
* media/modern-media-controls/button/button.html: Added.
* media/modern-media-controls/layout-item/layout-item-expected.txt: Added.
* media/modern-media-controls/layout-item/layout-item.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/media/modern-media-controls/button/</li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsbuttonbuttonexpectedtxt">trunk/LayoutTests/media/modern-media-controls/button/button-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolsbuttonbuttonhtml">trunk/LayoutTests/media/modern-media-controls/button/button.html</a></li>
<li>trunk/LayoutTests/media/modern-media-controls/layout-item/</li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolslayoutitemlayoutitemexpectedtxt">trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamodernmediacontrolslayoutitemlayoutitemhtml">trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item.html</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolsbuttoncss">trunk/Source/WebCore/Modules/modern-media-controls/controls/button.css</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolsbuttonjs">trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js</a></li>
<li><a href="#trunkSourceWebCoreModulesmodernmediacontrolscontrolslayoutitemjs">trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-item.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206744 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-03 20:27:33 UTC (rev 206744)
+++ trunk/LayoutTests/ChangeLog        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-10-03  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] LayoutItem and Button classes
+        https://bugs.webkit.org/show_bug.cgi?id=162868
+        &lt;rdar://problem/28590166&gt;
+
+        Reviewed by Dean Jackson.
+
+        Testing all public properties and methods of the LayoutItem and Button classes.
+
+        * media/modern-media-controls/button/button-expected.txt: Added.
+        * media/modern-media-controls/button/button.html: Added.
+        * media/modern-media-controls/layout-item/layout-item-expected.txt: Added.
+        * media/modern-media-controls/layout-item/layout-item.html: Added.
+
</ins><span class="cx"> 2016-10-03  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: url.containsOnlyASCII() in WebCore::checkEncodedString() when parsing an invalid CSS cursor URL
</span></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsbuttonbuttonexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/button/button-expected.txt (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/button/button-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/button/button-expected.txt        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Testing the Button class.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Default values
+PASS button.enabled is true
+PASS button.uiDelegate is undefined.
+PASS button.element.localName is &quot;button&quot;
+
+Responds to click events
+PASS clickedButton === button is true
+
+Doesn't respond to click events when disabled
+
+Has all the appropriate styles
+PASS style.position is &quot;absolute&quot;
+PASS style.borderWidth is &quot;0px&quot;
+PASS style.webkitAppearance is &quot;none&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolsbuttonbuttonhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/button/button.html (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/button/button.html                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/button/button.html        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+&lt;link rel=&quot;stylesheet&quot; href=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/button.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-item.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/button.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;body&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+description(&quot;Testing the &lt;code&gt;Button&lt;/code&gt; class.&quot;);
+
+debug(&quot;Default values&quot;);
+const button = new Button;
+shouldBeTrue(&quot;button.enabled&quot;);
+shouldBeUndefined(&quot;button.uiDelegate&quot;);
+shouldBeEqualToString(&quot;button.element.localName&quot;, &quot;button&quot;);
+
+let clickedButton;
+
+debug(&quot;&quot;);
+debug(&quot;Responds to click events&quot;);
+button.uiDelegate = {
+
+    buttonWasClicked: function(aButton)
+    {
+        clickedButton = aButton;
+        shouldBeTrue(&quot;clickedButton === button&quot;);
+    }
+
+}
+button.element.dispatchEvent(new MouseEvent(&quot;click&quot;));
+
+debug(&quot;&quot;);
+debug(&quot;Doesn't respond to click events when disabled&quot;);
+button.enabled = false;
+button.element.dispatchEvent(new MouseEvent(&quot;click&quot;));
+
+debug(&quot;&quot;);
+debug(&quot;Has all the appropriate styles&quot;)
+document.body.appendChild(button.element);
+const style = window.getComputedStyle(button.element);
+shouldBeEqualToString(&quot;style.position&quot;, &quot;absolute&quot;);
+shouldBeEqualToString(&quot;style.borderWidth&quot;, &quot;0px&quot;);
+shouldBeEqualToString(&quot;style.webkitAppearance&quot;, &quot;none&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolslayoutitemlayoutitemexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item-expected.txt (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item-expected.txt        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+Testing the LayoutItem class.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Creating a LayoutItem and setting a layout delegate after construction.
+PASS itemWithNoParameter.layoutTraits === LayoutTraits.Unknown is true
+PASS !!(itemWithNoParameter.layoutTraits | LayoutTraits.Mac) is true
+PASS !!(itemWithNoParameter.layoutTraits | LayoutTraits.Fullscreen) is true
+
+Creating a LayoutItem with a layout delegate set at construction.
+PASS !!(itemWithLayoutDelegate.layoutTraits | LayoutTraits.Mac) is true
+PASS !!(itemWithLayoutDelegate.layoutTraits | LayoutTraits.Fullscreen) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediamodernmediacontrolslayoutitemlayoutitemhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item.html (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item.html                                (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-item/layout-item.html        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/scheduler.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-node.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../../../Source/WebCore/Modules/modern-media-controls/controls/layout-item.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+description(&quot;Testing the &lt;code&gt;LayoutItem&lt;/code&gt; class.&quot;);
+
+const layoutDelegate = new class
+{
+    get layoutTraits()
+    {
+        return LayoutTraits.Mac | LayoutTraits.Fullscreen;
+    }
+};
+
+debug(&quot;Creating a LayoutItem and setting a layout delegate after construction.&quot;);
+const itemWithNoParameter = new LayoutItem;
+shouldBeTrue(&quot;itemWithNoParameter.layoutTraits === LayoutTraits.Unknown&quot;);
+
+itemWithNoParameter.layoutDelegate = layoutDelegate;
+shouldBeTrue(&quot;!!(itemWithNoParameter.layoutTraits | LayoutTraits.Mac)&quot;);
+shouldBeTrue(&quot;!!(itemWithNoParameter.layoutTraits | LayoutTraits.Fullscreen)&quot;);
+
+debug(&quot;&quot;);
+debug(&quot;Creating a LayoutItem with a layout delegate set at construction.&quot;);
+const itemWithLayoutDelegate = new LayoutItem({ layoutDelegate });
+shouldBeTrue(&quot;!!(itemWithLayoutDelegate.layoutTraits | LayoutTraits.Mac)&quot;);
+shouldBeTrue(&quot;!!(itemWithLayoutDelegate.layoutTraits | LayoutTraits.Fullscreen)&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206744 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-03 20:27:33 UTC (rev 206744)
+++ trunk/Source/WebCore/ChangeLog        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2016-10-03  Antoine Quint  &lt;graouts@apple.com&gt;
+
+        [Modern Media Controls] LayoutItem and Button classes
+        https://bugs.webkit.org/show_bug.cgi?id=162868
+        &lt;rdar://problem/28590166&gt;
+
+        Reviewed by Dean Jackson.
+
+        We introduce the new Button class and its parent class LayoutItem. We will subclass Button
+        a lot in coming patches, as it provides a way to create a button and provide a delegate to
+        respond to UI events via the `uiDelegate` property. A Button extends a LayoutItem, another
+        class that we'll subclass heavily in coming patches, which is simply a LayoutNode with a
+        `layoutDelegate` which allows to set the node's `layoutTraits`, a bit-mask allowing to
+        specify layout attributes such as the platform and playback styles. 
+
+        Tests: media/modern-media-controls/button/button.html
+               media/modern-media-controls/layout-item/layout-item.html
+
+        * Modules/modern-media-controls/controls/button.css: Added.
+        (button):
+        * Modules/modern-media-controls/controls/button.js: Added.
+        (Button):
+        (Button.prototype.get enabled):
+        (Button.prototype.set enabled):
+        (Button.prototype.handleEvent):
+        (Button.prototype._handleUIEvent):
+        * Modules/modern-media-controls/controls/layout-item.js: Added.
+        (LayoutItem.prototype.get layoutTraits):
+        (LayoutItem):
+
</ins><span class="cx"> 2016-10-03  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: url.containsOnlyASCII() in WebCore::checkEncodedString() when parsing an invalid CSS cursor URL
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolsbuttoncss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/modern-media-controls/controls/button.css (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/controls/button.css                                (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/button.css        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+button {
+    position: absolute;
+    border: 0;
+    -webkit-appearance: none;
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolsbuttonjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js                                (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/button.js        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class Button extends LayoutItem
+{
+
+    constructor(layoutDelegate)
+    {
+        super({
+            element: &quot;&lt;button&gt;&quot;,
+            layoutDelegate
+        });
+
+        this._enabled = true;
+
+        this.element.addEventListener(&quot;click&quot;, this);
+    }
+
+    // Public
+
+    get enabled()
+    {
+        return this._enabled;
+    }
+
+    set enabled(flag)
+    {
+        this._enabled = flag;
+        if (flag &amp;&amp; this.layoutDelegate &amp;&amp; typeof this.layoutDelegate.layout === &quot;function&quot;)
+            this.layoutDelegate.layout();
+    }
+
+    // Protected
+
+    handleEvent(event)
+    {
+        if (event.currentTarget === this.element)
+            this._handleUIEvent(event);
+    }
+
+    // Private
+
+    _handleUIEvent(event)
+    {
+        if (this._enabled &amp;&amp; event.type === &quot;click&quot; &amp;&amp; this.uiDelegate &amp;&amp; typeof this.uiDelegate.buttonWasClicked === &quot;function&quot;)
+            this.uiDelegate.buttonWasClicked(this);
+    }
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmodernmediacontrolscontrolslayoutitemjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-item.js (0 => 206745)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-item.js                                (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-item.js        2016-10-03 20:31:06 UTC (rev 206745)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+const LayoutTraits = {
+    Unknown     : 0,
+    Mac         : 1 &lt;&lt; 0,
+    iOS         : 1 &lt;&lt; 1,
+    Fullscreen  : 1 &lt;&lt; 2
+};
+
+class LayoutItem extends LayoutNode
+{
+
+    constructor({ element = null, layoutDelegate = null } = {})
+    {
+        super(element);
+
+        this.layoutDelegate = layoutDelegate;
+    }
+
+    // Public
+
+    get layoutTraits()
+    {
+        return (this.layoutDelegate &amp;&amp; this.layoutDelegate.layoutTraits) || LayoutTraits.Unknown;
+    }
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>