<!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>[164457] 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/164457">164457</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2014-02-20 16:39:35 -0800 (Thu, 20 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add very basic image control rendering
https://bugs.webkit.org/show_bug.cgi?id=129080

Reviewed by Tim Horton.

Source/WebCore:

Test: fast/images/image-controls-basic.html

This patch is groundwork that adds a very basic image control that can render on top of images.

* dom/Node.h:
(WebCore::Node:: isImageControlsRootElement): Returns false, unless you are an ImageControls object.
* html/HTMLAttributeNames.in:

Teach HTMLImageElement how to understand an experimental attribute to install controls,
how to actually build the DOM to attach to the shadow root, how to tear that DOM down,
and how to make sure that Renderers are created for that DOM:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::parseAttribute):
(WebCore::HTMLImageElement::didAttachRenderers):
(WebCore::HTMLImageElement::updateImageControls):
(WebCore::HTMLImageElement::createImageControls):
(WebCore::HTMLImageElement::destroyImageControls):
(WebCore::HTMLImageElement::hasImageControls):
(WebCore::HTMLImageElement::childShouldCreateRenderer):
* html/HTMLImageElement.h:
(WebCore::HTMLImageElement::hasShadowControls): For RenderImage to query when it is constructed.

Add a generic, platform independent ImageControls root element that does nothing:
* html/shadow/ImageControlsRootElement.cpp: Added.
(WebCore::ImageControlsRootElement::maybeCreate):
(WebCore::ImageControlsRootElement::ImageControlsRootElement):
(WebCore::ImageControlsRootElement::~ImageControlsRootElement):
* html/shadow/ImageControlsRootElement.h: Added.

Add a Mac-specific ImageControls root element that renders a 20x20 red box (for now):
* html/shadow/mac/ImageControlsRootElementMac.cpp: Added.
(WebCore::ImageControlsRootElementMac::ImageControlsRootElementMac):
(WebCore::ImageControlsRootElementMac::~ImageControlsRootElementMac):
(WebCore::ImageControlsRootElement::maybeCreate):
(WebCore::ImageControlsRootElementMac::maybeCreate):
* html/shadow/mac/ImageControlsRootElementMac.h: Added.

Since much of the RenderMedia::layout() method is now required for RenderImage as well,
move the logic to RenderImage. The extra work is controlled by a bool flag that will always
be set for RenderMedias but will only be set for certain RenderImages:
* rendering/RenderImage.cpp:
(WebCore::RenderImage::RenderImage):
(WebCore::RenderImage::canHaveChildren):
(WebCore::RenderImage::layout):
(WebCore::RenderImage::layoutShadowControls):
* rendering/RenderImage.h:
(WebCore::RenderImage::setHasShadowControls):
(WebCore::RenderImage::shadowControlsNeedCustomLayoutMetrics):

* rendering/RenderMedia.cpp:
(WebCore::RenderMedia::RenderMedia):
* rendering/RenderMedia.h:
(WebCore::RenderMedia::shadowControlsNeedCustomLayoutMetrics):

* WebCore.xcodeproj/project.pbxproj:

Source/WebKit/mac:

Expose the imageControlsEnabled setting to WebKit1 so DRT can use it.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences imageControlsEnabled]):
(-[WebPreferences setImageControlsEnabled:]):
* WebView/WebPreferencesPrivate.h:

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Expose the
  imageControlsEnabled setting to WKTR.

LayoutTests:

* fast/images/image-controls-basic.html: Added.
* platform/mac/fast/images/image-controls-basic-expected.txt: 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>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttributeNamesin">trunk/Source/WebCore/html/HTMLAttributeNames.in</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementcpp">trunk/Source/WebCore/html/HTMLImageElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementh">trunk/Source/WebCore/html/HTMLImageElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImagecpp">trunk/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImageh">trunk/Source/WebCore/rendering/RenderImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMediacpp">trunk/Source/WebCore/rendering/RenderMedia.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMediah">trunk/Source/WebCore/rendering/RenderMedia.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesimagecontrolsbasichtml">trunk/LayoutTests/fast/images/image-controls-basic.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastimagesimagecontrolsbasicexpectedpng">trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastimagesimagecontrolsbasicexpectedtxt">trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.txt</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowImageControlsRootElementcpp">trunk/Source/WebCore/html/shadow/ImageControlsRootElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowImageControlsRootElementh">trunk/Source/WebCore/html/shadow/ImageControlsRootElement.h</a></li>
<li>trunk/Source/WebCore/html/shadow/mac/</li>
<li><a href="#trunkSourceWebCorehtmlshadowmacImageControlsRootElementMaccpp">trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowmacImageControlsRootElementMach">trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/LayoutTests/ChangeLog        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -1 +1,11 @@
</span><ins>+2014-02-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add very basic image control rendering
+        https://bugs.webkit.org/show_bug.cgi?id=129080
+
+        Reviewed by Tim Horton.
+
+        * fast/images/image-controls-basic.html: Added.
+        * platform/mac/fast/images/image-controls-basic-expected.txt: Added.
+
</ins><span class="cx"> == Rolled over to ChangeLog-2014-02-20 ==
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesimagecontrolsbasichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/image-controls-basic.html (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/image-controls-basic.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/image-controls-basic.html        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;script&gt;
+if (window.testRunner)
+        testRunner.overridePreference('WebKitImageControlsEnabled', 1);
+
+&lt;/script&gt;
+&lt;body&gt;
+&lt;img src=&quot;resources/green-256x256.jpg&quot; x-webkit-imagemenu&gt;
+&lt;/body&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastimagesimagecontrolsbasicexpectedpng"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.png (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.png                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.png        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+\x89PNG
+
+ +IHDR X\x9Av\x82p)tEXtchecksum62f13b98779e570df73fe7c89fb56420\xDE(\xF1-%\xA4IDATx\xEDױ +\xC00 1\xC5\xFB\xF0
+\xBA\x8A\?@\xA8\xB9gf\xDE\xFF{ @\x80X8\xEB  @\x80 p\x88S @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80\x88 @\x80 @  \xB5! @\x80&gt;\xB0q\xAF\xAF~\xCEvIEND\xAEB`\x82
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastimagesimagecontrolsbasicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.txt (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/images/image-controls-basic-expected.txt        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderImage {IMG} at (0,0) size 256x256
+      RenderText {#text} at (0,0) size 0x0
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/ChangeLog        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -1 +1,65 @@
</span><ins>+2014-02-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add very basic image control rendering
+        https://bugs.webkit.org/show_bug.cgi?id=129080
+
+        Reviewed by Tim Horton.
+
+        Test: fast/images/image-controls-basic.html
+
+        This patch is groundwork that adds a very basic image control that can render on top of images.
+
+        * dom/Node.h:
+        (WebCore::Node:: isImageControlsRootElement): Returns false, unless you are an ImageControls object.
+        * html/HTMLAttributeNames.in:
+
+        Teach HTMLImageElement how to understand an experimental attribute to install controls,
+        how to actually build the DOM to attach to the shadow root, how to tear that DOM down,
+        and how to make sure that Renderers are created for that DOM:
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::HTMLImageElement):
+        (WebCore::HTMLImageElement::parseAttribute):
+        (WebCore::HTMLImageElement::didAttachRenderers):
+        (WebCore::HTMLImageElement::updateImageControls):
+        (WebCore::HTMLImageElement::createImageControls):
+        (WebCore::HTMLImageElement::destroyImageControls):
+        (WebCore::HTMLImageElement::hasImageControls):
+        (WebCore::HTMLImageElement::childShouldCreateRenderer):
+        * html/HTMLImageElement.h:
+        (WebCore::HTMLImageElement::hasShadowControls): For RenderImage to query when it is constructed. 
+
+        Add a generic, platform independent ImageControls root element that does nothing:
+        * html/shadow/ImageControlsRootElement.cpp: Added.
+        (WebCore::ImageControlsRootElement::maybeCreate):
+        (WebCore::ImageControlsRootElement::ImageControlsRootElement):
+        (WebCore::ImageControlsRootElement::~ImageControlsRootElement):
+        * html/shadow/ImageControlsRootElement.h: Added.
+
+        Add a Mac-specific ImageControls root element that renders a 20x20 red box (for now):
+        * html/shadow/mac/ImageControlsRootElementMac.cpp: Added.
+        (WebCore::ImageControlsRootElementMac::ImageControlsRootElementMac):
+        (WebCore::ImageControlsRootElementMac::~ImageControlsRootElementMac):
+        (WebCore::ImageControlsRootElement::maybeCreate):
+        (WebCore::ImageControlsRootElementMac::maybeCreate):
+        * html/shadow/mac/ImageControlsRootElementMac.h: Added.
+
+        Since much of the RenderMedia::layout() method is now required for RenderImage as well,
+        move the logic to RenderImage. The extra work is controlled by a bool flag that will always
+        be set for RenderMedias but will only be set for certain RenderImages:
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::RenderImage):
+        (WebCore::RenderImage::canHaveChildren):
+        (WebCore::RenderImage::layout):
+        (WebCore::RenderImage::layoutShadowControls):
+        * rendering/RenderImage.h:
+        (WebCore::RenderImage::setHasShadowControls):
+        (WebCore::RenderImage::shadowControlsNeedCustomLayoutMetrics):
+
+        * rendering/RenderMedia.cpp:
+        (WebCore::RenderMedia::RenderMedia):
+        * rendering/RenderMedia.h:
+        (WebCore::RenderMedia::shadowControlsNeedCustomLayoutMetrics):
+
+        * WebCore.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> == Rolled over to ChangeLog-2014-02-20 ==
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -1725,6 +1725,10 @@
</span><span class="cx">                 50D10D9A1545F5760096D288 /* RenderLayerFilterInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
</span><ins>+                510192D118B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510192CF18B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp */; };
+                510192D218B6B9AB007FC7A1 /* ImageControlsRootElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */; };
+                510192D518B6B9B7007FC7A1 /* ImageControlsRootElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */; };
+                510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */; };
</ins><span class="cx">                 510194401836D20800925523 /* IDBIndexWriterLevelDB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5101943E1836D20800925523 /* IDBIndexWriterLevelDB.cpp */; };
</span><span class="cx">                 510194411836D20800925523 /* IDBIndexWriterLevelDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 5101943F1836D20800925523 /* IDBIndexWriterLevelDB.h */; };
</span><span class="cx">                 510194441836F7E400925523 /* IDBCursorBackendOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510194421836F7E400925523 /* IDBCursorBackendOperations.cpp */; };
</span><span class="lines">@@ -8603,6 +8607,10 @@
</span><span class="cx">                 50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerFilterInfo.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                510192CF18B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsRootElementMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsRootElementMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsRootElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsRootElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5101943E1836D20800925523 /* IDBIndexWriterLevelDB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexWriterLevelDB.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5101943F1836D20800925523 /* IDBIndexWriterLevelDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexWriterLevelDB.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 510194421836F7E400925523 /* IDBCursorBackendOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursorBackendOperations.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15123,10 +15131,13 @@
</span><span class="cx">                 4150F9ED12B6E0990008C860 /* shadow */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                51C4AA5118B28357007BFE9B /* mac */,
</ins><span class="cx">                                 57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */,
</span><span class="cx">                                 57B791A014C6A62900F202D1 /* ContentDistributor.h */,
</span><span class="cx">                                 A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */,
</span><span class="cx">                                 A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */,
</span><ins>+                                510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */,
+                                510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */,
</ins><span class="cx">                                 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */,
</span><span class="cx">                                 57CF497314EE36D700ECFF14 /* InsertionPoint.h */,
</span><span class="cx">                                 417253A81354BBBC00360F2A /* MediaControlElements.cpp */,
</span><span class="lines">@@ -15648,6 +15659,15 @@
</span><span class="cx">                         path = ios;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                51C4AA5118B28357007BFE9B /* mac */ = {
+                        isa = PBXGroup;
+                        children = (
+                                510192CF18B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp */,
+                                510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */,
+                        );
+                        path = mac;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 59B5977111086556007159E8 /* jsc */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -23404,6 +23424,7 @@
</span><span class="cx">                                 07FFDE69181AED420072D409 /* MediaStreamTrackPrivate.h in Headers */,
</span><span class="cx">                                 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
</span><span class="cx">                                 E145349716A9BB6A000F6FD2 /* DOMTransitionEvent.h in Headers */,
</span><ins>+                                510192D218B6B9AB007FC7A1 /* ImageControlsRootElementMac.h in Headers */,
</ins><span class="cx">                                 E145349916A9BB6A000F6FD2 /* DOMTransitionEventInternal.h in Headers */,
</span><span class="cx">                                 A14832BB187F643200DA63A6 /* WAKWindow.h in Headers */,
</span><span class="cx">                                 BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */,
</span><span class="lines">@@ -24475,6 +24496,7 @@
</span><span class="cx">                                 AAA4FAD2175D5CB300743873 /* JSUIRequestEvent.h in Headers */,
</span><span class="cx">                                 15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */,
</span><span class="cx">                                 BE8EF04B171C9014009B48C3 /* JSVideoTrack.h in Headers */,
</span><ins>+                                510192D618B6B9B7007FC7A1 /* ImageControlsRootElement.h in Headers */,
</ins><span class="cx">                                 BE8EF04D171C9014009B48C3 /* JSVideoTrackList.h in Headers */,
</span><span class="cx">                                 FD82D7F813D4C8BD004E4372 /* JSWaveShaperNode.h in Headers */,
</span><span class="cx">                                 A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */,
</span><span class="lines">@@ -26567,6 +26589,7 @@
</span><span class="cx">                                 97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */,
</span><span class="cx">                                 E125F8351822F18A00D84CD9 /* CryptoKeyHMAC.cpp in Sources */,
</span><span class="cx">                                 511EF2C517F0FD3500E4FA16 /* JSIDBIndex.cpp in Sources */,
</span><ins>+                                510192D518B6B9B7007FC7A1 /* ImageControlsRootElement.cpp in Sources */,
</ins><span class="cx">                                 FE16CFD3169D1DED00D3A0C7 /* DatabaseBackend.cpp in Sources */,
</span><span class="cx">                                 97BC69DA1505F076001B74AC /* DatabaseBackendBase.cpp in Sources */,
</span><span class="cx">                                 FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */,
</span><span class="lines">@@ -28722,6 +28745,7 @@
</span><span class="cx">                                 B2A1F2AD0CEF0ABF00442F6A /* SVGGlyphElement.cpp in Sources */,
</span><span class="cx">                                 24D912BD13CA9A9700D21915 /* SVGGlyphRefElement.cpp in Sources */,
</span><span class="cx">                                 B2227A290D00BF220071B782 /* SVGGradientElement.cpp in Sources */,
</span><ins>+                                510192D118B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp in Sources */,
</ins><span class="cx">                                 B2227AB50D00BF220071B782 /* SVGGraphicsElement.cpp in Sources */,
</span><span class="cx">                                 078E090D17D14CEE00420AA1 /* RTCSessionDescriptionRequestImpl.cpp in Sources */,
</span><span class="cx">                                 650FBF2A0D9AF047008FC292 /* SVGHKernElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/dom/Node.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -238,6 +238,9 @@
</span><span class="cx">     virtual bool isFrameOwnerElement() const { return false; }
</span><span class="cx">     virtual bool isPluginElement() const { return false; }
</span><span class="cx">     virtual bool isInsertionPointNode() const { return false; }
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+    virtual bool isImageControlsRootElement() const { return false; }
+#endif
</ins><span class="cx"> 
</span><span class="cx">     bool isDocumentNode() const;
</span><span class="cx">     bool isTreeScope() const;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttributeNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttributeNames.in        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -352,6 +352,7 @@
</span><span class="cx"> data-youtube-id
</span><span class="cx"> onwebkitcurrentplaybacktargetiswirelesschanged
</span><span class="cx"> onwebkitplaybacktargetavailabilitychanged
</span><ins>+x-webkit-imagemenu
</ins><span class="cx"> webkit-playsinline
</span><span class="cx"> x-webkit-airplay
</span><span class="cx"> x-webkit-wirelessvideoplaybackdisabled
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.cpp        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -35,7 +35,13 @@
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RenderImage.h&quot;
</span><ins>+#include &quot;Settings.h&quot;
+#include &quot;ShadowRoot.h&quot;
</ins><span class="cx"> 
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+#include &quot;ImageControlsRootElement.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="lines">@@ -46,6 +52,9 @@
</span><span class="cx">     , m_form(form)
</span><span class="cx">     , m_compositeOperator(CompositeSourceOver)
</span><span class="cx">     , m_imageDevicePixelRatio(1.0f)
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+    , m_experimentalImageMenuEnabled(false)
+#endif
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(hasTagName(imgTag));
</span><span class="cx">     setHasCustomStyleResolveCallbacks();
</span><span class="lines">@@ -151,6 +160,11 @@
</span><span class="cx">         BlendMode blendOp = BlendModeNormal;
</span><span class="cx">         if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp))
</span><span class="cx">             m_compositeOperator = CompositeSourceOver;
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+    } else if (name == webkitimagemenuAttr) {
+        m_experimentalImageMenuEnabled = !value.isNull();
+        updateImageControls();
+#endif
</ins><span class="cx">     } else {
</span><span class="cx">         if (name == nameAttr) {
</span><span class="cx">             bool willHaveName = !value.isNull();
</span><span class="lines">@@ -203,6 +217,11 @@
</span><span class="cx">         return;
</span><span class="cx">     if (m_imageLoader.hasPendingBeforeLoadEvent())
</span><span class="cx">         return;
</span><ins>+
+#if ENABLE(IMAGE_CONTROLS)
+    updateImageControls();
+#endif
+
</ins><span class="cx">     RenderImage* renderImage = toRenderImage(renderer());
</span><span class="cx">     RenderImageResource&amp; renderImageResource = renderImage-&gt;imageResource();
</span><span class="cx">     if (renderImageResource.hasImage())
</span><span class="lines">@@ -412,6 +431,77 @@
</span><span class="cx">     return document().completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)).isEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+void HTMLImageElement::updateImageControls()
+{
+    // If this image element is inside a shadow tree then it is part of an image control.
+    if (isInShadowTree())
+        return;
+
+    Settings* settings = document().settings();
+    if (!settings || !settings-&gt;imageControlsEnabled())
+        return;
+
+    bool hasControls = hasImageControls();
+    if (!m_experimentalImageMenuEnabled &amp;&amp; hasControls)
+        destroyImageControls();
+    else if (m_experimentalImageMenuEnabled &amp;&amp; !hasControls)
+        createImageControls();
+}
+
+void HTMLImageElement::createImageControls()
+{
+    ASSERT(m_experimentalImageMenuEnabled);
+    ASSERT(!hasImageControls());
+
+    RefPtr&lt;ImageControlsRootElement&gt; imageControls = ImageControlsRootElement::maybeCreate(document());
+    if (!imageControls)
+        return;
+
+    ensureUserAgentShadowRoot().appendChild(imageControls);
+
+    RenderObject* renderObject = renderer();
+    if (!renderObject)
+        return;
+
+    toRenderImage(renderObject)-&gt;setHasShadowControls(true);
+}
+
+void HTMLImageElement::destroyImageControls()
+{
+    ShadowRoot* shadowRoot = userAgentShadowRoot();
+    if (!shadowRoot)
+        return;
+
+    if (Node* node = shadowRoot-&gt;firstChild()) {
+        ASSERT_WITH_SECURITY_IMPLICATION(node-&gt;isImageControlsRootElement());
+        shadowRoot-&gt;removeChild(node);
+    }
+
+    RenderObject* renderObject = renderer();
+    if (!renderObject)
+        return;
+
+    toRenderImage(renderObject)-&gt;setHasShadowControls(false);
+}
+
+bool HTMLImageElement::hasImageControls() const
+{
+    if (ShadowRoot* shadowRoot = userAgentShadowRoot()) {
+        Node* node = shadowRoot-&gt;firstChild();
+        ASSERT_WITH_SECURITY_IMPLICATION(!node || node-&gt;isImageControlsRootElement());
+        return node;
+    }
+
+    return false;
+}
+
+bool HTMLImageElement::childShouldCreateRenderer(const Node&amp; child) const
+{
+    return hasShadowRootParent(child) &amp;&amp; HTMLElement::childShouldCreateRenderer(child);
+}
+#endif // ENABLE(IMAGE_CONTROLS)
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // FIXME: This is a workaround for &lt;rdar://problem/7725158&gt;. We should find a better place for the touchCalloutEnabled() logic.
</span><span class="cx"> bool HTMLImageElement::willRespondToMouseClickEvents()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/html/HTMLImageElement.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -85,6 +85,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual const AtomicString&amp; imageSourceURL() const override;
</span><span class="cx"> 
</span><ins>+    bool hasShadowControls() const { return m_experimentalImageMenuEnabled; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     HTMLImageElement(const QualifiedName&amp;, Document&amp;, HTMLFormElement* = 0);
</span><span class="cx"> 
</span><span class="lines">@@ -120,6 +122,15 @@
</span><span class="cx">     AtomicString m_bestFitImageURL;
</span><span class="cx">     AtomicString m_lowercasedUsemap;
</span><span class="cx">     float m_imageDevicePixelRatio;
</span><ins>+    bool m_experimentalImageMenuEnabled;
+
+#if ENABLE(IMAGE_CONTROLS)
+    void updateImageControls();
+    void createImageControls();
+    void destroyImageControls();
+    bool hasImageControls() const;
+    virtual bool childShouldCreateRenderer(const Node&amp;) const override;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> NODE_TYPE_CASTS(HTMLImageElement)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowImageControlsRootElementcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/ImageControlsRootElement.cpp (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/ImageControlsRootElement.cpp                                (rev 0)
+++ trunk/Source/WebCore/html/shadow/ImageControlsRootElement.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ImageControlsRootElement.h&quot;
+
+#if ENABLE(IMAGE_CONTROLS)
+
+namespace WebCore {
+
+#if !PLATFORM(MAC)
+PassRefPtr&lt;ImageControlsRootElement&gt; ImageControlsRootElement::maybeCreate(Document&amp; document)
+{
+    return adoptRef(new ImageControlsRootElement(document));
+}
+#endif
+
+ImageControlsRootElement::ImageControlsRootElement(Document&amp; document)
+    : HTMLDivElement(HTMLNames::divTag, document)
+{
+}
+
+ImageControlsRootElement::~ImageControlsRootElement()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowImageControlsRootElementh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/ImageControlsRootElement.h (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/ImageControlsRootElement.h                                (rev 0)
+++ trunk/Source/WebCore/html/shadow/ImageControlsRootElement.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#ifndef ImageControlsRootElement_h
+#define ImageControlsRootElement_h
+
+#if ENABLE(IMAGE_CONTROLS)
+
+#include &quot;HTMLDivElement.h&quot;
+
+namespace WebCore {
+
+class Document;
+
+class ImageControlsRootElement : public HTMLDivElement {
+public:
+    virtual ~ImageControlsRootElement();
+
+    static PassRefPtr&lt;ImageControlsRootElement&gt; maybeCreate(Document&amp;);
+
+protected:
+    explicit ImageControlsRootElement(Document&amp;);
+
+private:
+    virtual bool isImageControlsRootElement() const override { return true; }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
+#endif // ImageControlsRootElement_h
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsRootElementMaccpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp                                (rev 0)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ImageControlsRootElementMac.h&quot;
+
+#if ENABLE(IMAGE_CONTROLS)
+
+#include &quot;Text.h&quot;
+
+namespace WebCore {
+
+ImageControlsRootElementMac::ImageControlsRootElementMac(Document&amp; document)
+    : ImageControlsRootElement(document)
+{
+}
+
+ImageControlsRootElementMac::~ImageControlsRootElementMac()
+{
+}
+
+PassRefPtr&lt;ImageControlsRootElement&gt; ImageControlsRootElement::maybeCreate(Document&amp; document)
+{
+    return ImageControlsRootElementMac::maybeCreate(document);
+}
+
+PassRefPtr&lt;ImageControlsRootElementMac&gt; ImageControlsRootElementMac::maybeCreate(Document&amp; document)
+{
+    if (!document.page())
+        return nullptr;
+
+    RefPtr&lt;ImageControlsRootElementMac&gt; controls = adoptRef(new ImageControlsRootElementMac(document));
+    controls-&gt;setAttribute(HTMLNames::styleAttr, &quot;position: relative; background-color: red; width: 20px; height: 20px;&quot;);
+
+    ExceptionCode ec;
+    controls-&gt;appendChild(Text::create(document, &quot;&quot;), ec);
+    if (ec)
+        return nullptr;
+
+    return controls.release();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsRootElementMach"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h (0 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h                                (rev 0)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#ifndef ImageControlsRootElementMac_h
+#define ImageControlsRootElementMac_h
+
+#include &quot;ImageControlsRootElement.h&quot;
+
+#if ENABLE(IMAGE_CONTROLS)
+
+namespace WebCore {
+
+class ImageControlsRootElementMac : public ImageControlsRootElement {
+public:
+    ~ImageControlsRootElementMac();
+
+    static PassRefPtr&lt;ImageControlsRootElementMac&gt; maybeCreate(Document&amp;);
+
+private:
+    ImageControlsRootElementMac(Document&amp;);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
+#endif // ImageControlsRootElementMac_h
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.cpp        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &quot;InlineElementBox.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PaintInfo.h&quot;
</span><ins>+#include &quot;RenderFlowThread.h&quot;
</ins><span class="cx"> #include &quot;RenderImageResourceStyleImage.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;SVGImage.h&quot;
</span><span class="lines">@@ -122,10 +123,14 @@
</span><span class="cx">     , m_needsToSetSizeForAltText(false)
</span><span class="cx">     , m_didIncrementVisuallyNonEmptyPixelCount(false)
</span><span class="cx">     , m_isGeneratedContent(false)
</span><ins>+    , m_hasShadowControls(false)
</ins><span class="cx">     , m_imageDevicePixelRatio(imageDevicePixelRatio)
</span><span class="cx"> {
</span><span class="cx">     updateAltText();
</span><span class="cx">     imageResource().initialize(this);
</span><ins>+
+    if (isHTMLImageElement(element))
+        m_hasShadowControls = toHTMLImageElement(element).hasShadowControls();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderImage::RenderImage(Document&amp; document, PassRef&lt;RenderStyle&gt; style, StyleImage* styleImage)
</span><span class="lines">@@ -134,6 +139,7 @@
</span><span class="cx">     , m_needsToSetSizeForAltText(false)
</span><span class="cx">     , m_didIncrementVisuallyNonEmptyPixelCount(false)
</span><span class="cx">     , m_isGeneratedContent(false)
</span><ins>+    , m_hasShadowControls(false)
</ins><span class="cx">     , m_imageDevicePixelRatio(1.0f)
</span><span class="cx"> {
</span><span class="cx">     imageResource().initialize(this);
</span><span class="lines">@@ -655,13 +661,65 @@
</span><span class="cx">         m_altText = toHTMLImageElement(element())-&gt;altText();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RenderImage::canHaveChildren() const
+{
+#if !ENABLE(IMAGE_CONTROLS)
+    return false;
+#else
+    return m_hasShadowControls;
+#endif
+}
+
</ins><span class="cx"> void RenderImage::layout()
</span><span class="cx"> {
</span><span class="cx">     StackStats::LayoutCheckPoint layoutCheckPoint;
</span><ins>+
+    LayoutSize oldSize = contentBoxRect().size();
</ins><span class="cx">     RenderReplaced::layout();
</span><ins>+
</ins><span class="cx">     updateInnerContentRect();
</span><ins>+
+    if (m_hasShadowControls)
+        layoutShadowControls(oldSize);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderImage::layoutShadowControls(const LayoutSize&amp; oldSize)
+{
+    RenderBox* controlsRenderer = toRenderBox(firstChild());
+    if (!controlsRenderer)
+        return;
+    
+    bool controlsNeedLayout = controlsRenderer-&gt;needsLayout();
+    // If the region chain has changed we also need to relayout the controls to update the region box info.
+    // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
+    const RenderFlowThread* flowThread = flowThreadContainingBlock();
+    if (flowThread &amp;&amp; !controlsNeedLayout) {
+        if (flowThread-&gt;pageLogicalSizeChanged())
+            controlsNeedLayout = true;
+    }
+
+    LayoutSize newSize = contentBoxRect().size();
+    if (newSize == oldSize &amp;&amp; !controlsNeedLayout)
+        return;
+
+    // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or 
+    // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
+    // and this method might be called many times per second during video playback, use a LayoutStateMaintainer:
+    LayoutStateMaintainer statePusher(view(), *this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+
+    if (shadowControlsNeedCustomLayoutMetrics()) {
+        controlsRenderer-&gt;setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
+        controlsRenderer-&gt;style().setHeight(Length(newSize.height(), Fixed));
+        controlsRenderer-&gt;style().setWidth(Length(newSize.width(), Fixed));
+    }
+
+    controlsRenderer-&gt;setNeedsLayout(MarkOnlyThis);
+    controlsRenderer-&gt;layout();
+    clearChildNeedsLayout();
+
+    statePusher.pop();
+}
+
</ins><span class="cx"> void RenderImage::computeIntrinsicRatioInformation(FloatSize&amp; intrinsicSize, double&amp; intrinsicRatio, bool&amp; isPercentageIntrinsicSize) const
</span><span class="cx"> {
</span><span class="cx">     RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio, isPercentageIntrinsicSize);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/rendering/RenderImage.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -64,6 +64,8 @@
</span><span class="cx">     inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
</span><span class="cx">     float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
</span><span class="cx"> 
</span><ins>+    void setHasShadowControls(bool hasShadowControls) { m_hasShadowControls = hasShadowControls; }
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual bool needsPreferredWidthsRecalculation() const override final;
</span><span class="cx">     virtual RenderBox* embeddedContentBox() const override final;
</span><span class="lines">@@ -86,6 +88,8 @@
</span><span class="cx"> private:
</span><span class="cx">     virtual const char* renderName() const override { return &quot;RenderImage&quot;; }
</span><span class="cx"> 
</span><ins>+    virtual bool canHaveChildren() const override;
+
</ins><span class="cx">     virtual bool isImage() const override { return true; }
</span><span class="cx">     virtual bool isRenderImage() const override final { return true; }
</span><span class="cx"> 
</span><span class="lines">@@ -100,6 +104,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
</span><span class="cx"> 
</span><ins>+    virtual bool shadowControlsNeedCustomLayoutMetrics() const { return false; }
+
</ins><span class="cx">     IntSize imageSizeForError(CachedImage*) const;
</span><span class="cx">     void imageDimensionsChanged(bool imageSizeChanged, const IntRect* = 0);
</span><span class="cx">     bool updateIntrinsicSizeIfNeeded(const LayoutSize&amp;, bool imageSizeChanged);
</span><span class="lines">@@ -107,6 +113,8 @@
</span><span class="cx">     void updateInnerContentRect();
</span><span class="cx"> 
</span><span class="cx">     void paintAreaElementFocusRing(PaintInfo&amp;);
</span><ins>+    
+    void layoutShadowControls(const LayoutSize&amp; oldSize);
</ins><span class="cx"> 
</span><span class="cx">     // Text to display as long as the image isn't available.
</span><span class="cx">     String m_altText;
</span><span class="lines">@@ -114,6 +122,7 @@
</span><span class="cx">     bool m_needsToSetSizeForAltText;
</span><span class="cx">     bool m_didIncrementVisuallyNonEmptyPixelCount;
</span><span class="cx">     bool m_isGeneratedContent;
</span><ins>+    bool m_hasShadowControls;
</ins><span class="cx">     float m_imageDevicePixelRatio;
</span><span class="cx"> 
</span><span class="cx">     friend class RenderImageScaleObserver;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMedia.cpp (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMedia.cpp        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/rendering/RenderMedia.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -37,57 +37,20 @@
</span><span class="cx"> RenderMedia::RenderMedia(HTMLMediaElement&amp; element, PassRef&lt;RenderStyle&gt; style)
</span><span class="cx">     : RenderImage(element, std::move(style))
</span><span class="cx"> {
</span><ins>+    setHasShadowControls(true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderMedia::RenderMedia(HTMLMediaElement&amp; element, PassRef&lt;RenderStyle&gt; style, const IntSize&amp; intrinsicSize)
</span><span class="cx">     : RenderImage(element, std::move(style))
</span><span class="cx"> {
</span><span class="cx">     setIntrinsicSize(intrinsicSize);
</span><ins>+    setHasShadowControls(true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderMedia::~RenderMedia()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderMedia::layout()
-{
-    StackStats::LayoutCheckPoint layoutCheckPoint;
-    LayoutSize oldSize = contentBoxRect().size();
-
-    RenderImage::layout();
-
-    RenderBox* controlsRenderer = toRenderBox(firstChild());
-    if (!controlsRenderer)
-        return;
-
-    bool controlsNeedLayout = controlsRenderer-&gt;needsLayout();
-    // If the region chain has changed we also need to relayout the controls to update the region box info.
-    // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
-    const RenderFlowThread* flowThread = flowThreadContainingBlock();
-    if (flowThread &amp;&amp; !controlsNeedLayout) {
-        if (flowThread-&gt;pageLogicalSizeChanged())
-            controlsNeedLayout = true;
-    }
-
-    LayoutSize newSize = contentBoxRect().size();
-    if (newSize == oldSize &amp;&amp; !controlsNeedLayout)
-        return;
-
-    // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or 
-    // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
-    // and this method will be called many times per second during playback, use a LayoutStateMaintainer:
-    LayoutStateMaintainer statePusher(view(), *this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
-
-    controlsRenderer-&gt;setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
-    controlsRenderer-&gt;style().setHeight(Length(newSize.height(), Fixed));
-    controlsRenderer-&gt;style().setWidth(Length(newSize.width(), Fixed));
-    controlsRenderer-&gt;setNeedsLayout(MarkOnlyThis);
-    controlsRenderer-&gt;layout();
-    clearChildNeedsLayout();
-
-    statePusher.pop();
-}
-
</del><span class="cx"> void RenderMedia::paintReplaced(PaintInfo&amp;, const LayoutPoint&amp;)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMediah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMedia.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMedia.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebCore/rendering/RenderMedia.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -41,9 +41,6 @@
</span><span class="cx"> 
</span><span class="cx">     HTMLMediaElement&amp; mediaElement() const { return toHTMLMediaElement(nodeForNonAnonymous()); }
</span><span class="cx"> 
</span><del>-protected:
-    virtual void layout();
-
</del><span class="cx"> private:
</span><span class="cx">     void element() const = delete;
</span><span class="cx"> 
</span><span class="lines">@@ -55,6 +52,8 @@
</span><span class="cx">     virtual void paintReplaced(PaintInfo&amp;, const LayoutPoint&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     virtual bool requiresForcedStyleRecalcPropagation() const override final { return true; }
</span><ins>+
+    virtual bool shadowControlsNeedCustomLayoutMetrics() const { return true; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> RENDER_OBJECT_TYPE_CASTS(RenderMedia, isMedia())
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-02-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add very basic image control rendering
+        https://bugs.webkit.org/show_bug.cgi?id=129080
+
+        Reviewed by Tim Horton.
+
+        Expose the imageControlsEnabled setting to WebKit1 so DRT can use it.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences imageControlsEnabled]):
+        (-[WebPreferences setImageControlsEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
</ins><span class="cx"> 2014-02-20  David Kilzer  &lt;ddkilzer@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ASan] WebKit1 sources are not compiled using ASAN macros
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -147,6 +147,7 @@
</span><span class="cx"> #define WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey @&quot;WebKitUseLegacyTextAlignPositionedElementBehavior&quot;
</span><span class="cx"> #define WebKitMediaSourceEnabledPreferenceKey @&quot;WebKitMediaSourceEnabled&quot;
</span><span class="cx"> #define WebKitShouldConvertPositionStyleOnCopyPreferenceKey @&quot;WebKitShouldConvertPositionStyleOnCopy&quot;
</span><ins>+#define WebKitImageControlsEnabledPreferenceKey @&quot;WebKitImageControlsEnabled&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span><span class="cx"> // These are private both because callers should be using the cover methods and because the
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -595,6 +595,9 @@
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="cx">         [NSNumber numberWithBool:NO], WebKitMediaSourceEnabledPreferenceKey,
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+        [NSNumber numberWithBool:NO], WebKitImageControlsEnabledPreferenceKey,
+#endif
</ins><span class="cx">         nil];
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="lines">@@ -2535,6 +2538,16 @@
</span><span class="cx">     [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)imageControlsEnabled
+{
+    return [self _boolValueForKey:WebKitImageControlsEnabledPreferenceKey];
+}
+
+- (void)setImageControlsEnabled:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitImageControlsEnabledPreferenceKey];
+}
+
</ins><span class="cx"> - (BOOL)shouldConvertPositionStyleOnCopy
</span><span class="cx"> {
</span><span class="cx">     return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -435,4 +435,7 @@
</span><span class="cx"> - (void)setShouldConvertPositionStyleOnCopy:(BOOL)flag;
</span><span class="cx"> - (BOOL)shouldConvertPositionStyleOnCopy;
</span><span class="cx"> 
</span><ins>+- (void)setImageControlsEnabled:(BOOL)flag;
+- (BOOL)imageControlsEnabled;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -2383,6 +2383,10 @@
</span><span class="cx">     settings.setMediaSourceEnabled([preferences mediaSourceEnabled]);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+    settings.setImageControlsEnabled([preferences imageControlsEnabled]);
+#endif
+
</ins><span class="cx">     settings.setShouldConvertPositionStyleOnCopy([preferences shouldConvertPositionStyleOnCopy]);
</span><span class="cx"> 
</span><span class="cx">     switch ([preferences storageBlockingPolicy]) {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-02-20  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add very basic image control rendering
+        https://bugs.webkit.org/show_bug.cgi?id=129080
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Expose the 
+          imageControlsEnabled setting to WKTR.
+
</ins><span class="cx"> 2014-02-20  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add magnification and swiping properties to WKWebView
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (164456 => 164457)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-02-21 00:00:12 UTC (rev 164456)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp        2014-02-21 00:39:35 UTC (rev 164457)
</span><span class="lines">@@ -189,6 +189,15 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+    if (preference == &quot;WebKitImageControlsEnabled&quot;) {
+        WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::imageControlsEnabledKey(), enabled);
+        for (HashSet&lt;Page*&gt;::iterator iter = pages.begin(); iter != pages.end(); ++iter)
+            (*iter)-&gt;settings().setImageControlsEnabled(enabled);
+        return;
+    }
+#endif
+
</ins><span class="cx"> #if ENABLE(CSS_REGIONS)
</span><span class="cx">     if (preference == &quot;WebKitCSSRegionsEnabled&quot;)
</span><span class="cx">         RuntimeEnabledFeatures::sharedFeatures().setCSSRegionsEnabled(enabled);
</span></span></pre>
</div>
</div>

</body>
</html>