<!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>[180720] 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/180720">180720</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-02-26 18:07:22 -0800 (Thu, 26 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement &lt;attachment&gt; element appearance on Mac
https://bugs.webkit.org/show_bug.cgi?id=142023

Reviewed by Dean Jackson.

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* css/CSSValueKeywords.in:
* css/html.css:
(attachment):
* platform/ThemeTypes.h:
Add a new -webkit-appearance value, attachment.

* WebCore.xcodeproj/project.pbxproj:
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::setFile):
Let the renderer know when the file changes (so it can relayout and repaint).

(WebCore::HTMLAttachmentElement::filePath):
(WebCore::HTMLAttachmentElement::fileName):
* html/HTMLAttachmentElement.h:
Handy acccessors for the full path and the name of the file.

* platform/spi/mac/IconServicesSPI.h: Added.
* platform/spi/mac/LaunchServicesSPI.h: Added.
Add some IconServices and LaunchServices SPI headers.

* rendering/RenderAttachment.cpp:
(WebCore::RenderAttachment::RenderAttachment):
Don't have a default intrinsic size; we'll adjust in layout().

(WebCore::RenderAttachment::isSelected):
(WebCore::RenderAttachment::isFocused):
(WebCore::RenderAttachment::isSelectedOrFocused):
Factor out from paintReplaced().

(WebCore::RenderAttachment::layout):
Use RenderTheme to compute the intrinsic size of this attachment.

(WebCore::RenderAttachment::paintReplaced):
Use RenderTheme to paint the attachment.

(WebCore::RenderAttachment::representedFileChanged):
When the represented file changes, we need to recompute the intrinsic size and repaint.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::adjustAttachmentStyle):
(WebCore::RenderTheme::paintAttachment):
Plumb through the attachment appearance.

* rendering/RenderAttachment.h:
* rendering/RenderTheme.h:
(WebCore::RenderTheme::paintAttachment):
(WebCore::RenderTheme::attachmentIntrinsicSize):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::attachmentIconBackgroundColor):
(WebCore::attachmentIconBorderColor):
(WebCore::AttachmentLayout):
AttachmentLayout lays out the innards of the RenderThemeMac attachment
presentation: an icon with an optional bordered background, with a label
underneath it with an optional background.

(WebCore::RenderThemeMac::attachmentIntrinsicSize):
(WebCore::paintAttachmentIconBackground):
(WebCore::paintAttachmentIcon):
(WebCore::RenderThemeMac::paintAttachmentLabelBackground):
(WebCore::RenderThemeMac::paintAttachmentLabel):
(WebCore::RenderThemeMac::paintAttachment):
Paint the attachment element. Paint the optional backgrounds (and swap
out the text color) if the element is selected/focused.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastattachmentattachmentdisabledrenderingexpectedtxt">trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastattachmentattachmentrenderingexpectedtxt">trunk/LayoutTests/fast/attachment/attachment-rendering-expected.txt</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="#trunkSourceWebCorecssCSSPrimitiveValueMappingsh">trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueKeywordsin">trunk/Source/WebCore/css/CSSValueKeywords.in</a></li>
<li><a href="#trunkSourceWebCorecsshtmlcss">trunk/Source/WebCore/css/html.css</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttachmentElementcpp">trunk/Source/WebCore/html/HTMLAttachmentElement.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformThemeTypesh">trunk/Source/WebCore/platform/ThemeTypes.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderAttachmentcpp">trunk/Source/WebCore/rendering/RenderAttachment.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderAttachmenth">trunk/Source/WebCore/rendering/RenderAttachment.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemecpp">trunk/Source/WebCore/rendering/RenderTheme.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeh">trunk/Source/WebCore/rendering/RenderTheme.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMach">trunk/Source/WebCore/rendering/RenderThemeMac.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMacmm">trunk/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/platform/mac/fast/attachment/</li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentdisabledrenderingexpectedpng">trunk/LayoutTests/platform/mac/fast/attachment/attachment-disabled-rendering-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentrenderingexpectedpng">trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastattachmentattachmentrenderingexpectedtxt">trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacIconServicesSPIh">trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacLaunchServicesSPIh">trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-02-26  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Implement &lt;attachment&gt; element appearance on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=142023
+
+        Reviewed by Dean Jackson.
+
+        * fast/attachment/attachment-rendering-expected.txt:
+        * platform/mac/fast/attachment/attachment-disabled-rendering-expected.png: Added.
+        * platform/mac/fast/attachment/attachment-rendering-expected.png: Added.
+        * platform/mac/fast/attachment/attachment-rendering-expected.txt: Added.
+        Add Mac overrides for &lt;attachment&gt; tests (and pixel results).
+
</ins><span class="cx"> 2015-02-26  Doug Russell  &lt;d_russell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Expose caret browsing preference to accessibility API
</span></span></pre></div>
<a id="trunkLayoutTestsfastattachmentattachmentdisabledrenderingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/LayoutTests/fast/attachment/attachment-disabled-rendering-expected.txt        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -2,10 +2,10 @@
</span><span class="cx">   RenderView at (0,0) size 800x600
</span><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderBlock {HTML} at (0,0) size 800x600
</span><del>-    RenderBody {BODY} at (8,8) size 784x576
</del><ins>+    RenderBody {BODY} at (8,8) size 784x584
</ins><span class="cx">       RenderBlock {P} at (0,0) size 784x18
</span><span class="cx">         RenderText {#text} at (0,0) size 766x18
</span><span class="cx">           text run at (0,0) width 766: &quot;This tests that attachments don't have a custom renderer when they are disabled. This test must be run in the test runner.&quot;
</span><span class="cx">       RenderBlock (anonymous) at (0,34) size 784x0
</span><del>-        RenderInline {ATTACHMENT} at (0,0) size 0x0
</del><ins>+        RenderBlock {ATTACHMENT} at (0,0) size 0x0
</ins><span class="cx">         RenderText {#text} at (0,0) size 0x0
</span></span></pre></div>
<a id="trunkLayoutTestsfastattachmentattachmentrenderingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/attachment/attachment-rendering-expected.txt (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/attachment/attachment-rendering-expected.txt        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/LayoutTests/fast/attachment/attachment-rendering-expected.txt        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -6,6 +6,6 @@
</span><span class="cx">       RenderBlock {P} at (0,0) size 784x18
</span><span class="cx">         RenderText {#text} at (0,0) size 326x18
</span><span class="cx">           text run at (0,0) width 326: &quot;This tests that attachments have a custom renderer.&quot;
</span><del>-      RenderBlock (anonymous) at (0,34) size 784x200
-        RenderAttachment {ATTACHMENT} at (0,0) size 200x200
</del><ins>+      RenderBlock (anonymous) at (0,34) size 784x0
+        RenderAttachment {ATTACHMENT} at (0,0) size 0x0
</ins><span class="cx">         RenderText {#text} at (0,0) size 0x0
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentdisabledrenderingexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-disabled-rendering-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/attachment/attachment-disabled-rendering-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentrenderingexpectedpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastattachmentattachmentrenderingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.txt (0 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/attachment/attachment-rendering-expected.txt        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -0,0 +1,11 @@
</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
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 326x18
+          text run at (0,0) width 326: &quot;This tests that attachments have a custom renderer.&quot;
+      RenderBlock (anonymous) at (0,34) size 784x77
+        RenderAttachment {ATTACHMENT} at (0,0) size 60x77
+        RenderText {#text} at (0,0) size 0x0
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -1,3 +1,81 @@
</span><ins>+2015-02-26  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Implement &lt;attachment&gt; element appearance on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=142023
+
+        Reviewed by Dean Jackson.
+
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        * css/CSSValueKeywords.in:
+        * css/html.css:
+        (attachment):
+        * platform/ThemeTypes.h:
+        Add a new -webkit-appearance value, attachment.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLAttachmentElement.cpp:
+        (WebCore::HTMLAttachmentElement::setFile):
+        Let the renderer know when the file changes (so it can relayout and repaint).
+
+        (WebCore::HTMLAttachmentElement::filePath):
+        (WebCore::HTMLAttachmentElement::fileName):
+        * html/HTMLAttachmentElement.h:
+        Handy acccessors for the full path and the name of the file.
+
+        * platform/spi/mac/IconServicesSPI.h: Added.
+        * platform/spi/mac/LaunchServicesSPI.h: Added.
+        Add some IconServices and LaunchServices SPI headers.
+
+        * rendering/RenderAttachment.cpp:
+        (WebCore::RenderAttachment::RenderAttachment):
+        Don't have a default intrinsic size; we'll adjust in layout().
+
+        (WebCore::RenderAttachment::isSelected):
+        (WebCore::RenderAttachment::isFocused):
+        (WebCore::RenderAttachment::isSelectedOrFocused):
+        Factor out from paintReplaced().
+
+        (WebCore::RenderAttachment::layout):
+        Use RenderTheme to compute the intrinsic size of this attachment.
+
+        (WebCore::RenderAttachment::paintReplaced):
+        Use RenderTheme to paint the attachment.
+
+        (WebCore::RenderAttachment::representedFileChanged):
+        When the represented file changes, we need to recompute the intrinsic size and repaint.
+
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::adjustStyle):
+        (WebCore::RenderTheme::paint):
+        (WebCore::RenderTheme::adjustAttachmentStyle):
+        (WebCore::RenderTheme::paintAttachment):
+        Plumb through the attachment appearance.
+
+        * rendering/RenderAttachment.h:
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::paintAttachment):
+        (WebCore::RenderTheme::attachmentIntrinsicSize):
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::attachmentIconBackgroundColor):
+        (WebCore::attachmentIconBorderColor):
+        (WebCore::AttachmentLayout):
+        AttachmentLayout lays out the innards of the RenderThemeMac attachment
+        presentation: an icon with an optional bordered background, with a label
+        underneath it with an optional background.
+
+        (WebCore::RenderThemeMac::attachmentIntrinsicSize):
+        (WebCore::paintAttachmentIconBackground):
+        (WebCore::paintAttachmentIcon):
+        (WebCore::RenderThemeMac::paintAttachmentLabelBackground):
+        (WebCore::RenderThemeMac::paintAttachmentLabel):
+        (WebCore::RenderThemeMac::paintAttachment):
+        Paint the attachment element. Paint the optional backgrounds (and swap
+        out the text color) if the element is selected/focused.
+
</ins><span class="cx"> 2015-02-26  Doug Russell  &lt;d_russell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Expose caret browsing preference to accessibility API
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -1127,6 +1127,8 @@
</span><span class="cx">                 2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */; };
</span><span class="cx">                 2D70BA1318074DDF0001908A /* PlatformCALayerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D70BA1218074DDF0001908A /* PlatformCALayerMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D70BA1518074F860001908A /* PlatformCALayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D70BA1418074F850001908A /* PlatformCALayer.cpp */; };
</span><ins>+                2D74E99C1A9D3F3200DFB3D4 /* IconServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */; };
+                2D74E99E1A9D402900DFB3D4 /* LaunchServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */; };
</ins><span class="cx">                 2D76BB821945632400CFD29A /* RunLoopObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D76BB801945632400CFD29A /* RunLoopObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D76BB8419456F8100CFD29A /* RunLoopObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */; };
</span><span class="cx">                 2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */; };
</span><span class="lines">@@ -8179,6 +8181,8 @@
</span><span class="cx">                 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFDocumentImageMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D70BA1218074DDF0001908A /* PlatformCALayerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformCALayerMac.h; path = ca/mac/PlatformCALayerMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D70BA1418074F850001908A /* PlatformCALayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformCALayer.cpp; path = ca/PlatformCALayer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconServicesSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LaunchServicesSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D76BB801945632400CFD29A /* RunLoopObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoopObserver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoopObserver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestLocation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17668,6 +17672,8 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
</span><ins>+                                2D74E99B1A9D3F3200DFB3D4 /* IconServicesSPI.h */,
+                                2D74E99D1A9D402900DFB3D4 /* LaunchServicesSPI.h */,
</ins><span class="cx">                                 2D413F601A187A3F0041A521 /* LookupSPI.h */,
</span><span class="cx">                                 1C6466271A12C3F90094603C /* NSFontSPI.h */,
</span><span class="cx">                                 9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
</span><span class="lines">@@ -24268,6 +24274,7 @@
</span><span class="cx">                                 2E37DFDB12DBAFB800A6B233 /* DOMURL.h in Headers */,
</span><span class="cx">                                 CD9DE18217AAD6A400EA386D /* DOMURLMediaSource.h in Headers */,
</span><span class="cx">                                 15C770A6100D41CD005BA267 /* DOMValidityState.h in Headers */,
</span><ins>+                                2D74E99C1A9D3F3200DFB3D4 /* IconServicesSPI.h in Headers */,
</ins><span class="cx">                                 BC1A37C0097C715F0019F3D8 /* DOMViews.h in Headers */,
</span><span class="cx">                                 31C0FF490E4CEFDD007D6FE5 /* DOMWebKitAnimationEvent.h in Headers */,
</span><span class="cx">                                 31C0FF4B0E4CEFDD007D6FE5 /* DOMWebKitAnimationEventInternal.h in Headers */,
</span><span class="lines">@@ -26464,6 +26471,7 @@
</span><span class="cx">                                 B2227A880D00BF220071B782 /* SVGPatternElement.h in Headers */,
</span><span class="cx">                                 B2227A8C0D00BF220071B782 /* SVGPointList.h in Headers */,
</span><span class="cx">                                 B2227A8F0D00BF220071B782 /* SVGPolyElement.h in Headers */,
</span><ins>+                                2D74E99E1A9D402900DFB3D4 /* LaunchServicesSPI.h in Headers */,
</ins><span class="cx">                                 2D58D8551A15F65F00A5F726 /* DataDetection.h in Headers */,
</span><span class="cx">                                 B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
</span><span class="cx">                                 B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValueMappingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -602,6 +602,11 @@
</span><span class="cx">     case CapsLockIndicatorPart:
</span><span class="cx">         m_value.valueID = CSSValueCapsLockIndicator;
</span><span class="cx">         break;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    case AttachmentPart:
+        m_value.valueID = CSSValueAttachment;
+        break;
+#endif
</ins><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     case ImageControlsButtonPart:
</span><span class="cx">         m_value.valueID = CSSValueImageControlsButton;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueKeywordsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueKeywords.in        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -745,6 +745,9 @@
</span><span class="cx"> image-controls-button
</span><span class="cx"> #endif
</span><span class="cx"> textarea
</span><ins>+#if defined(ENABLE_ATTACHMENT_ELEMENT) &amp;&amp; ENABLE_ATTACHMENT_ELEMENT
+attachment
+#endif
</ins><span class="cx"> caps-lock-indicator
</span><span class="cx"> 
</span><span class="cx"> //
</span></span></pre></div>
<a id="trunkSourceWebCorecsshtmlcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/html.css (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/html.css        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/css/html.css        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -1193,6 +1193,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if defined(ENABLE_ATTACHMENT_ELEMENT) &amp;&amp; ENABLE_ATTACHMENT_ELEMENT
</span><ins>+attachment {
+    -webkit-appearance: attachment;
+}
+
</ins><span class="cx"> attachment:focus {
</span><span class="cx">     outline: none;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttachmentElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.cpp (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttachmentElement.cpp        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.cpp        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -64,6 +64,12 @@
</span><span class="cx"> void HTMLAttachmentElement::setFile(File* file)
</span><span class="cx"> {
</span><span class="cx">     m_file = file;
</span><ins>+
+    auto* renderer = this-&gt;renderer();
+    if (!is&lt;RenderAttachment&gt;(renderer))
+        return;
+
+    downcast&lt;RenderAttachment&gt;(*renderer).representedFileChanged();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLAttachmentElement::setFocus(bool shouldBeFocused)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThemeTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThemeTypes.h (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThemeTypes.h        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/platform/ThemeTypes.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -45,7 +45,11 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     ImageControlsButtonPart,
</span><span class="cx"> #endif
</span><del>-    TextAreaPart, CapsLockIndicatorPart
</del><ins>+    TextAreaPart,
+#if ENABLE(ATTACHMENT_ELEMENT)
+    AttachmentPart,
+#endif
+    CapsLockIndicatorPart
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum SelectionPart {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacIconServicesSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h (0 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h                                (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/IconServicesSPI.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import &quot;LaunchServicesSPI.h&quot;
+#import &quot;SoftLinking.h&quot;
+#import &lt;objc/runtime.h&gt;
+
+SOFT_LINK_PRIVATE_FRAMEWORK(IconServices)
+
+typedef UInt32 ISScale;
+
+SOFT_LINK(IconServices, _ISCreateCGImageFromBindingWithSizeScaleAndOptions, CGImageRef, (LSBindingRef binding, CGSize size, ISScale scale, CFDictionaryRef options), (binding, size, scale, options))
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacLaunchServicesSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h (0 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h                                (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/LaunchServicesSPI.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include &lt;LaunchServices/LaunchServicesPriv.h&gt;
+
+#else
+
+WTF_EXTERN_C_BEGIN
+typedef struct _LSBinding* LSBindingRef;
+LSBindingRef _LSBindingCreateWithURL(CFAllocatorRef, CFURLRef);
+WTF_EXTERN_C_END
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderAttachmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderAttachment.cpp (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderAttachment.cpp        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderAttachment.cpp        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -29,16 +29,20 @@
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FloatRect.h&quot;
</span><ins>+#include &quot;FloatRoundedRect.h&quot;
</ins><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><span class="cx"> #include &quot;HTMLAttachmentElement.h&quot;
</span><ins>+#include &quot;Page.h&quot;
</ins><span class="cx"> #include &quot;PaintInfo.h&quot;
</span><ins>+#include &quot;RenderTheme.h&quot;
+#include &quot;URL.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><span class="cx"> RenderAttachment::RenderAttachment(HTMLAttachmentElement&amp; element, Ref&lt;RenderStyle&gt;&amp;&amp; style)
</span><del>-    : RenderReplaced(element, WTF::move(style), LayoutSize(200, 200))
</del><ins>+    : RenderReplaced(element, WTF::move(style), LayoutSize())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -47,24 +51,35 @@
</span><span class="cx">     return downcast&lt;HTMLAttachmentElement&gt;(nodeForNonAnonymous());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderAttachment::paintReplaced(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset)
</del><ins>+bool RenderAttachment::isSelected() const
</ins><span class="cx"> {
</span><del>-    // FIXME: Implement
-
</del><span class="cx">     RefPtr&lt;Range&gt; selectionRange = frame().selection().selection().firstRange();
</span><del>-    bool selected = selectionRange &amp;&amp; selectionRange-&gt;intersectsNode(&amp;nodeForNonAnonymous(), ASSERT_NO_EXCEPTION);
-    bool focused = frame().selection().isFocusedAndActive() &amp;&amp; document().focusedElement() == &amp;attachmentElement();
</del><ins>+    return selectionRange &amp;&amp; selectionRange-&gt;intersectsNode(&amp;nodeForNonAnonymous(), ASSERT_NO_EXCEPTION);
+}
</ins><span class="cx"> 
</span><del>-    paintInfo.context-&gt;save();
-    paintInfo.context-&gt;fillRect(FloatRect(paintOffset.x(), paintOffset.y(), 200, 200), selected || focused ? Color::cyan : Color::lightGray, ColorSpaceSRGB);
-    paintInfo.context-&gt;restore();
</del><ins>+bool RenderAttachment::isFocused() const
+{
+    return frame().selection().isFocusedAndActive() &amp;&amp; document().focusedElement() == &amp;attachmentElement();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderAttachment::layout()
+{
+    setIntrinsicSize(document().page()-&gt;theme().attachmentIntrinsicSize(*this));
+
+    RenderReplaced::layout();
+}
+
</ins><span class="cx"> void RenderAttachment::focusChanged()
</span><span class="cx"> {
</span><span class="cx">     repaint();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderAttachment::representedFileChanged()
+{
+    setNeedsLayout();
+    repaint();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderAttachmenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderAttachment.h (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderAttachment.h        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderAttachment.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -41,14 +41,21 @@
</span><span class="cx">     HTMLAttachmentElement&amp; attachmentElement() const;
</span><span class="cx"> 
</span><span class="cx">     void focusChanged();
</span><ins>+    void representedFileChanged();
</ins><span class="cx"> 
</span><ins>+    bool isSelectedOrFocused() const { return isSelected() || isFocused(); }
+
</ins><span class="cx"> private:
</span><span class="cx">     void element() const = delete;
</span><span class="cx">     virtual bool isAttachment() const override { return true; }
</span><span class="cx">     virtual const char* renderName() const override { return &quot;RenderAttachment&quot;; }
</span><del>-    virtual void paintReplaced(PaintInfo&amp;, const LayoutPoint&amp;) override;
</del><span class="cx"> 
</span><span class="cx">     virtual bool shouldDrawSelectionTint() const override { return false; }
</span><ins>+
+    virtual void layout() override;
+
+    bool isSelected() const;
+    bool isFocused() const;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -252,6 +252,10 @@
</span><span class="cx"> #endif
</span><span class="cx">     case CapsLockIndicatorPart:
</span><span class="cx">         return adjustCapsLockIndicatorStyle(styleResolver, style, e);
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    case AttachmentPart:
+        return adjustAttachmentStyle(styleResolver, style, e);
+#endif
</ins><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -390,6 +394,10 @@
</span><span class="cx"> #endif
</span><span class="cx">     case CapsLockIndicatorPart:
</span><span class="cx">         return paintCapsLockIndicator(o, paintInfo, integralSnappedRect);
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    case AttachmentPart:
+        return paintAttachment(o, paintInfo, integralSnappedRect);
+#endif
</ins><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -975,6 +983,17 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+void RenderTheme::adjustAttachmentStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const
+{
+}
+
+bool RenderTheme::paintAttachment(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;)
+{
+    return false;
+}
+#endif
+
</ins><span class="cx"> #if ENABLE(DATALIST_ELEMENT)
</span><span class="cx"> LayoutUnit RenderTheme::sliderTickSnappingThreshold() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.h (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.h        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderTheme.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> class HTMLInputElement;
</span><span class="cx"> class Icon;
</span><span class="cx"> class PopupMenu;
</span><ins>+class RenderAttachment;
</ins><span class="cx"> class RenderMenuList;
</span><span class="cx"> #if ENABLE(METER_ELEMENT)
</span><span class="cx"> class RenderMeter;
</span><span class="lines">@@ -249,6 +250,10 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool defaultButtonHasAnimation() const { return false; }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual LayoutSize attachmentIntrinsicSize(const RenderAttachment&amp;) const { return LayoutSize(); }
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual FontDescription&amp; cachedSystemFontDescription(CSSValueID systemFontID) const;
</span><span class="cx">     virtual void updateCachedSystemFontDescription(CSSValueID systemFontID, FontDescription&amp;) const = 0;
</span><span class="lines">@@ -315,6 +320,11 @@
</span><span class="cx">     virtual void adjustCapsLockIndicatorStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const;
</span><span class="cx">     virtual bool paintCapsLockIndicator(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;);
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void adjustAttachmentStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const;
+    virtual bool paintAttachment(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;);
+#endif
+
</ins><span class="cx">     virtual void adjustProgressBarStyle(StyleResolver&amp;, RenderStyle&amp;, Element*) const;
</span><span class="cx">     virtual bool paintProgressBar(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) { return true; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.h        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> class RenderProgress;
</span><span class="cx"> class RenderStyle;
</span><ins>+struct AttachmentLayout;
</ins><span class="cx"> 
</span><span class="cx"> class RenderThemeMac final : public RenderTheme {
</span><span class="cx"> public:
</span><span class="lines">@@ -167,6 +168,11 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool paintSnapshottedPluginOverlay(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual LayoutSize attachmentIntrinsicSize(const RenderAttachment&amp;) const override;
+    virtual bool paintAttachment(const RenderObject&amp;, const PaintInfo&amp;, const IntRect&amp;) override;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual String fileListNameForWidth(const FileList*, const FontCascade&amp;, int width, bool multipleFilesAllowed) const override;
</span><span class="cx"> 
</span><span class="lines">@@ -226,6 +232,11 @@
</span><span class="cx">     NSServicesRolloverButtonCell *servicesRolloverButtonCell() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    void paintAttachmentLabelBackground(const RenderAttachment&amp;, GraphicsContext&amp;, AttachmentLayout&amp;) const;
+    void paintAttachmentLabel(const RenderAttachment&amp;, GraphicsContext&amp;, AttachmentLayout&amp;, bool useSelectedStyle) const;
+#endif
+
</ins><span class="cx">     mutable RetainPtr&lt;NSPopUpButtonCell&gt; m_popupButton;
</span><span class="cx">     mutable RetainPtr&lt;NSSearchFieldCell&gt; m_search;
</span><span class="cx">     mutable RetainPtr&lt;NSMenu&gt; m_searchMenuTemplate;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (180719 => 180720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-02-27 02:07:02 UTC (rev 180719)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-02-27 02:07:22 UTC (rev 180720)
</span><span class="lines">@@ -34,19 +34,23 @@
</span><span class="cx"> #import &quot;Frame.h&quot;
</span><span class="cx"> #import &quot;FrameView.h&quot;
</span><span class="cx"> #import &quot;GraphicsContextCG.h&quot;
</span><ins>+#import &quot;HTMLAttachmentElement.h&quot;
</ins><span class="cx"> #import &quot;HTMLAudioElement.h&quot;
</span><span class="cx"> #import &quot;HTMLInputElement.h&quot;
</span><span class="cx"> #import &quot;HTMLMediaElement.h&quot;
</span><span class="cx"> #import &quot;HTMLNames.h&quot;
</span><span class="cx"> #import &quot;HTMLPlugInImageElement.h&quot;
</span><ins>+#import &quot;IconServicesSPI.h&quot;
</ins><span class="cx"> #import &quot;Image.h&quot;
</span><span class="cx"> #import &quot;ImageBuffer.h&quot;
</span><ins>+#import &quot;LaunchServicesSPI.h&quot;
</ins><span class="cx"> #import &quot;LocalCurrentGraphicsContext.h&quot;
</span><span class="cx"> #import &quot;LocalizedStrings.h&quot;
</span><span class="cx"> #import &quot;MediaControlElements.h&quot;
</span><span class="cx"> #import &quot;NSSharingServicePickerSPI.h&quot;
</span><span class="cx"> #import &quot;Page.h&quot;
</span><span class="cx"> #import &quot;PaintInfo.h&quot;
</span><ins>+#import &quot;RenderAttachment.h&quot;
</ins><span class="cx"> #import &quot;RenderLayer.h&quot;
</span><span class="cx"> #import &quot;RenderMedia.h&quot;
</span><span class="cx"> #import &quot;RenderMediaControlElements.h&quot;
</span><span class="lines">@@ -2066,6 +2070,170 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+const CGFloat attachmentIconSize = 48;
+const CGFloat attachmentIconBackgroundPadding = 6;
+const CGFloat attachmentIconBackgroundSize = attachmentIconSize + attachmentIconBackgroundPadding;
+const CGFloat attachmentIconSelectionBorderThickness = 1;
+const CGFloat attachmentIconBackgroundRadius = 3;
+const CGFloat attachmentIconToLabelMargin = 2;
+
+static Color attachmentIconBackgroundColor() { return Color(0, 0, 0, 30); }
+static Color attachmentIconBorderColor() { return Color(255, 255, 255, 125); }
+
+const CGFloat attachmentLabelFontSize = 12;
+const CGFloat attachmentLabelBackgroundRadius = 3;
+const CGFloat attachmentLabelBackgroundPadding = 3;
+
+const CGFloat attachmentMargin = 3;
+
+struct AttachmentLayout {
+    AttachmentLayout(const RenderAttachment&amp;);
+
+    FloatRect textRect;
+    FloatRect textBackgroundRect;
+    FloatRect iconRect;
+    FloatRect iconBackgroundRect;
+    FloatRect attachmentRect;
+
+    RetainPtr&lt;CTFontRef&gt; labelFont;
+    FontCascade labelFontCascade;
+    std::unique_ptr&lt;TextRun&gt; labelTextRun;
+};
+
+AttachmentLayout::AttachmentLayout(const RenderAttachment&amp; attachment)
+{
+    // FIXME: We should have a limit on the width of the label.
+    // FIXME: We should support line-breaking (up to two lines) and always middle-truncate the second line.
+    File* file = attachment.attachmentElement().file();
+
+    labelFont = adoptCF(CTFontCreateUIFontForLanguage(kCTFontSystemFontType, attachmentLabelFontSize, nullptr));
+    labelFontCascade = FontCascade(FontPlatformData(labelFont.get(), attachmentLabelFontSize));
+
+    String filename = file ? file-&gt;name() : String();
+    labelTextRun = std::make_unique&lt;TextRun&gt;(filename);
+    labelTextRun-&gt;setDirection(filename.defaultWritingDirection() == U_LEFT_TO_RIGHT ? LTR : RTL);
+    float textWidth = labelFontCascade.width(*labelTextRun);
+    float textHeight = labelFontCascade.fontMetrics().height();
+    float xOffset = (attachmentIconBackgroundSize / 2) - (textWidth / 2);
+
+    textRect = FloatRect(xOffset, attachmentIconBackgroundSize + attachmentIconToLabelMargin, textWidth, textHeight);
+    textBackgroundRect = textRect;
+    textBackgroundRect.inflateX(attachmentLabelBackgroundPadding);
+    textBackgroundRect = encloseRectToDevicePixels(textBackgroundRect, attachment.document().deviceScaleFactor());
+
+    iconBackgroundRect = FloatRect(0, 0, attachmentIconBackgroundSize, attachmentIconBackgroundSize);
+
+    iconRect = iconBackgroundRect;
+    iconRect.setSize(FloatSize(attachmentIconSize, attachmentIconSize));
+    iconRect.move(attachmentIconBackgroundPadding / 2, attachmentIconBackgroundPadding / 2);
+
+    attachmentRect = iconBackgroundRect;
+    attachmentRect.unite(textBackgroundRect);
+    attachmentRect.inflate(attachmentMargin);
+    attachmentRect = encloseRectToDevicePixels(attachmentRect, attachment.document().deviceScaleFactor());
+}
+
+LayoutSize RenderThemeMac::attachmentIntrinsicSize(const RenderAttachment&amp; attachment) const
+{
+    AttachmentLayout layout(attachment);
+    return LayoutSize(layout.attachmentRect.size());
+}
+
+static void paintAttachmentIconBackground(const RenderAttachment&amp;, GraphicsContext&amp; context, AttachmentLayout&amp; layout)
+{
+    // FIXME: Finder has a discontinuous behavior here when you have a background color other than white,
+    // where it switches into 'bordered mode' and the border pops in on top of the background.
+    bool paintBorder = true;
+
+    FloatRect backgroundRect = layout.iconBackgroundRect;
+    if (paintBorder)
+        backgroundRect.inflate(-attachmentIconSelectionBorderThickness);
+
+    FloatSize iconBackgroundRadiusSize(attachmentIconBackgroundRadius, attachmentIconBackgroundRadius);
+
+    Path backgroundPath;
+    backgroundPath.addRoundedRect(backgroundRect, iconBackgroundRadiusSize);
+    context.setFillColor(attachmentIconBackgroundColor(), ColorSpaceDeviceRGB);
+    context.fillPath(backgroundPath);
+
+    if (paintBorder) {
+        FloatRect borderRect = layout.iconBackgroundRect;
+        borderRect.inflate(-attachmentIconSelectionBorderThickness / 2);
+
+        Path borderPath;
+        borderPath.addRoundedRect(borderRect, iconBackgroundRadiusSize);
+        context.setStrokeColor(attachmentIconBorderColor(), ColorSpaceDeviceRGB);
+        context.setStrokeThickness(attachmentIconSelectionBorderThickness);
+        context.strokePath(borderPath);
+    }
+}
+
+static void paintAttachmentIcon(const RenderAttachment&amp; attachment, GraphicsContext&amp; context, AttachmentLayout&amp; layout)
+{
+    File* file = attachment.attachmentElement().file();
+    RetainPtr&lt;LSBindingRef&gt; lsBinding = adoptCF(_LSBindingCreateWithURL(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:file ? file-&gt;path() : String()]));
+    if (!lsBinding)
+        return;
+
+    // FIXME: This should take transforms and page scale into account, not just deviceScaleFactor.
+    FloatSize iconSizeInPoints(attachmentIconSize, attachmentIconSize);
+    iconSizeInPoints.scale(attachment.document().deviceScaleFactor());
+
+    RetainPtr&lt;CGImageRef&gt; icon = adoptCF(_ISCreateCGImageFromBindingWithSizeScaleAndOptions(lsBinding.get(), iconSizeInPoints, 1, nil));
+    if (!icon)
+        return;
+
+    context.drawNativeImage(icon.get(), iconSizeInPoints, ColorSpaceDeviceRGB, layout.iconRect, FloatRect(FloatPoint(), iconSizeInPoints));
+}
+
+void RenderThemeMac::paintAttachmentLabelBackground(const RenderAttachment&amp;, GraphicsContext&amp; context, AttachmentLayout&amp; layout) const
+{
+    Path backgroundPath;
+    backgroundPath.addRoundedRect(layout.textBackgroundRect, FloatSize(attachmentLabelBackgroundRadius, attachmentLabelBackgroundRadius));
+    context.setFillColor(convertNSColorToColor([NSColor alternateSelectedControlColor]), ColorSpaceDeviceRGB);
+    context.fillPath(backgroundPath);
+}
+
+void RenderThemeMac::paintAttachmentLabel(const RenderAttachment&amp;, GraphicsContext&amp; context, AttachmentLayout&amp; layout, bool useSelectedStyle) const
+{
+    FloatPoint textLocation = layout.textRect.minXMaxYCorner();
+    textLocation.move(0, -layout.labelFontCascade.fontMetrics().descent());
+
+    context.setFillColor(useSelectedStyle ? convertNSColorToColor([NSColor alternateSelectedControlTextColor]) : Color::black, ColorSpaceDeviceRGB);
+    context.drawBidiText(layout.labelFontCascade, *layout.labelTextRun, textLocation);
+}
+
+bool RenderThemeMac::paintAttachment(const RenderObject&amp; renderer, const PaintInfo&amp; paintInfo, const IntRect&amp; paintRect)
+{
+    if (!is&lt;RenderAttachment&gt;(renderer))
+        return false;
+
+    const RenderAttachment&amp; attachment = downcast&lt;RenderAttachment&gt;(renderer);
+
+    AttachmentLayout layout(attachment);
+
+    GraphicsContext&amp; context = *paintInfo.context;
+
+    GraphicsContextStateSaver saver(context);
+
+    context.translate(toFloatSize(paintRect.location()));
+    context.translate(FloatSize((layout.attachmentRect.width() - attachmentIconBackgroundSize) / 2, 0));
+
+    bool useSelectedStyle = attachment.isSelectedOrFocused();
+
+    if (useSelectedStyle)
+        paintAttachmentIconBackground(attachment, context, layout);
+    paintAttachmentIcon(attachment, context, layout);
+    if (useSelectedStyle)
+        paintAttachmentLabelBackground(attachment, context, layout);
+    paintAttachmentLabel(attachment, context, layout, useSelectedStyle);
+
+    return true;
+}
+
+#endif // ENABLE(ATTACHMENT_ELEMENT)
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre>
</div>
</div>

</body>
</html>