<!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>[165479] trunk/Source</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/165479">165479</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-03-12 10:51:54 -0700 (Wed, 12 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Hook up image controls for WebKit1
https://bugs.webkit.org/show_bug.cgi?id=130062
<rdar://problem/15964809>
Reviewed by Brady Eidson.
WebCore/
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSPrimitiveValueMappings.h:
Fix some header ordering.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Handle mapping ImageControlsButtonPart to the -webkit-appearance value CSSValueImageControlsButton.
* css/CSSValueKeywords.in:
* platform/ThemeTypes.h:
Add a -webkit-appearance value image-controls-button, and an associated control part.
* dom/Node.h:
(WebCore::Node::isImageControlsButtonElement): Added.
* html/shadow/mac/ImageControlsButtonElementMac.cpp: Added.
(WebCore::RenderImageControlsButton::RenderImageControlsButton):
(WebCore::RenderImageControlsButton::~RenderImageControlsButton):
(WebCore::RenderImageControlsButton::updateLogicalWidth):
(WebCore::RenderImageControlsButton::computeLogicalHeight):
(WebCore::ImageControlsButtonElementMac::ImageControlsButtonElementMac):
(WebCore::ImageControlsButtonElementMac::~ImageControlsButtonElementMac):
(WebCore::ImageControlsButtonElementMac::maybeCreate):
(WebCore::ImageControlsButtonElementMac::defaultEventHandler):
(WebCore::ImageControlsButtonElementMac::createElementRenderer):
* html/shadow/mac/ImageControlsButtonElementMac.h: Added.
Add a new element/renderer pair for the single button that comprises image controls on Mac.
RenderImageControlsButton gets its size from the theme's imageControlsButtonSize.
* html/shadow/mac/ImageControlsRootElementMac.cpp:
(WebCore::RenderImageControls::RenderImageControls):
(WebCore::RenderImageControls::~RenderImageControls):
(WebCore::RenderImageControls::updateLogicalWidth):
(WebCore::RenderImageControls::computeLogicalHeight):
(WebCore::ImageControlsRootElement::maybeCreate):
(WebCore::ImageControlsRootElementMac::ImageControlsRootElementMac):
(WebCore::ImageControlsRootElementMac::~ImageControlsRootElementMac):
(WebCore::ImageControlsRootElementMac::createElementRenderer):
* html/shadow/mac/ImageControlsRootElementMac.h:
Add a custom renderer for the root image controls element on Mac, which inherits
its size from the <img> that it is shadowing.
Add a ImageControlsButtonElementMac as the sole child of the root element.
* html/shadow/mac/imageControlsMac.css:
(.x-webkit-image-controls):
(.x-webkit-image-controls-button):
(.x-webkit-image-controls:hover .x-webkit-image-controls-button):
The button should become opaque whenever *any* part of the image is hovered,
not just the button itself. Also, use the new image-controls-button -webkit-appearance
value to get the appropriate appearance from the theme.
* page/ContextMenuContext.cpp:
(WebCore::ContextMenuContext::ContextMenuContext):
* page/ContextMenuContext.h:
(WebCore::ContextMenuContext::setControlledImage):
(WebCore::ContextMenuContext::controlledImage):
Store an image on the ContextMenuContext instead of just whether we hit an image.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent):
(WebCore::ContextMenuController::showContextMenu):
(WebCore::imageFromImageElementNode):
(WebCore::ContextMenuController::maybeCreateContextMenu):
(WebCore::ContextMenuController::populate):
Keep track of the hit image in the ContextMenuContext.
(WebCore::ContextMenuController::replaceControlledImage):
Replace the hit image with a new one.
* page/ContextMenuController.h:
* rendering/RenderReplaced.h:
Fix a double-space typo.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
(WebCore::RenderTheme::paintBorderOnly):
(WebCore::RenderTheme::paintDecorations):
Handle ImageControlsButtonPart in RenderTheme's switches.
* rendering/RenderTheme.h:
(WebCore::RenderTheme::imageControlsButtonSize):
(WebCore::RenderTheme::paintImageControlsButton):
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::servicesRolloverButtonCell):
(WebCore::RenderThemeMac::paintImageControlsButton):
(WebCore::RenderThemeMac::imageControlsButtonSize):
Paint the image controls button.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::WebContentReader::readImage):
(WebCore::Editor::WebContentReader::readURL):
* editing/mac/EditorMac.mm:
(WebCore::Editor::WebContentReader::readImage):
* platform/URL.cpp:
(WebCore::URL::fakeURLWithRelativePart):
* platform/URL.h:
Factor out code to create a "fake" URL (with a UUID "hostname" and the
webkit-fake-url protocol), and make use of it where we construct such URLs.
WebKit/
* WebKit.xcodeproj/project.pbxproj:
Add WebSharingServicePickerController.
WebKit/mac/
* Misc/WebSharingServicePickerController.h: Added.
* Misc/WebSharingServicePickerController.mm: Added.
(-[WebSharingServicePickerController initWithImage:menuClient:]):
(-[WebSharingServicePickerController menu]):
(-[WebSharingServicePickerController sharingServicePicker:delegateForSharingService:]):
(-[WebSharingServicePickerController sharingServicePicker:didChooseSharingService:]):
(-[WebSharingServicePickerController sharingService:didShareItems:]):
(-[WebSharingServicePickerController sharingService:didFailToShareItems:error:]):
(-[WebSharingServicePickerController sharingService:sourceWindowForShareItems:sharingContentScope:]):
Add a NSSharingServiceDelegate and NSSharingServicePickerDelegate, which will also
provide a NSMenu instance for WebContextMenuClient to pop up when image controls are needed.
When data is returned from the service, it is re-inserted into the image via replaceControlledImage.
* WebCoreSupport/WebContextMenuClient.h:
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::contextMenuForEvent):
Factor out code to decide which NSMenu to use, so that we can use early-returns to simplify it.
If we hit an image with image controls, use the WebSharingServicePickerController's menu.
(WebContextMenuClient::showContextMenu):
(WebContextMenuClient::clearSharingServicePickerController):
WebKit2/
* Shared/ContextMenuContextData.cpp:
(WebKit::ContextMenuContextData::ContextMenuContextData):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</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="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoreeditingiosEditorIOSmm">trunk/Source/WebCore/editing/ios/EditorIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></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>
<li><a href="#trunkSourceWebCorehtmlshadowmacimageControlsMaccss">trunk/Source/WebCore/html/shadow/mac/imageControlsMac.css</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuContextcpp">trunk/Source/WebCore/page/ContextMenuContext.cpp</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuContexth">trunk/Source/WebCore/page/ContextMenuContext.h</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuControllercpp">trunk/Source/WebCore/page/ContextMenuController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuControllerh">trunk/Source/WebCore/page/ContextMenuController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformThemeTypesh">trunk/Source/WebCore/platform/ThemeTypes.h</a></li>
<li><a href="#trunkSourceWebCoreplatformURLcpp">trunk/Source/WebCore/platform/URL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformURLh">trunk/Source/WebCore/platform/URL.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedh">trunk/Source/WebCore/rendering/RenderReplaced.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>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebContextMenuClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedContextMenuContextDatacpp">trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorehtmlshadowmacImageControlsButtonElementMaccpp">trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowmacImageControlsButtonElementMach">trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebSharingServicePickerControllerh">trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebSharingServicePickerControllermm">trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/ChangeLog        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -1,3 +1,113 @@
</span><ins>+2014-03-12 Tim Horton <timothy_horton@apple.com>
+
+ Hook up image controls for WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=130062
+ <rdar://problem/15964809>
+
+ Reviewed by Brady Eidson.
+
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSPrimitiveValueMappings.h:
+ Fix some header ordering.
+
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ Handle mapping ImageControlsButtonPart to the -webkit-appearance value CSSValueImageControlsButton.
+
+ * css/CSSValueKeywords.in:
+ * platform/ThemeTypes.h:
+ Add a -webkit-appearance value image-controls-button, and an associated control part.
+
+ * dom/Node.h:
+ (WebCore::Node::isImageControlsButtonElement): Added.
+
+ * html/shadow/mac/ImageControlsButtonElementMac.cpp: Added.
+ (WebCore::RenderImageControlsButton::RenderImageControlsButton):
+ (WebCore::RenderImageControlsButton::~RenderImageControlsButton):
+ (WebCore::RenderImageControlsButton::updateLogicalWidth):
+ (WebCore::RenderImageControlsButton::computeLogicalHeight):
+ (WebCore::ImageControlsButtonElementMac::ImageControlsButtonElementMac):
+ (WebCore::ImageControlsButtonElementMac::~ImageControlsButtonElementMac):
+ (WebCore::ImageControlsButtonElementMac::maybeCreate):
+ (WebCore::ImageControlsButtonElementMac::defaultEventHandler):
+ (WebCore::ImageControlsButtonElementMac::createElementRenderer):
+ * html/shadow/mac/ImageControlsButtonElementMac.h: Added.
+ Add a new element/renderer pair for the single button that comprises image controls on Mac.
+ RenderImageControlsButton gets its size from the theme's imageControlsButtonSize.
+
+ * html/shadow/mac/ImageControlsRootElementMac.cpp:
+ (WebCore::RenderImageControls::RenderImageControls):
+ (WebCore::RenderImageControls::~RenderImageControls):
+ (WebCore::RenderImageControls::updateLogicalWidth):
+ (WebCore::RenderImageControls::computeLogicalHeight):
+ (WebCore::ImageControlsRootElement::maybeCreate):
+ (WebCore::ImageControlsRootElementMac::ImageControlsRootElementMac):
+ (WebCore::ImageControlsRootElementMac::~ImageControlsRootElementMac):
+ (WebCore::ImageControlsRootElementMac::createElementRenderer):
+ * html/shadow/mac/ImageControlsRootElementMac.h:
+ Add a custom renderer for the root image controls element on Mac, which inherits
+ its size from the <img> that it is shadowing.
+ Add a ImageControlsButtonElementMac as the sole child of the root element.
+
+ * html/shadow/mac/imageControlsMac.css:
+ (.x-webkit-image-controls):
+ (.x-webkit-image-controls-button):
+ (.x-webkit-image-controls:hover .x-webkit-image-controls-button):
+ The button should become opaque whenever *any* part of the image is hovered,
+ not just the button itself. Also, use the new image-controls-button -webkit-appearance
+ value to get the appropriate appearance from the theme.
+
+ * page/ContextMenuContext.cpp:
+ (WebCore::ContextMenuContext::ContextMenuContext):
+ * page/ContextMenuContext.h:
+ (WebCore::ContextMenuContext::setControlledImage):
+ (WebCore::ContextMenuContext::controlledImage):
+ Store an image on the ContextMenuContext instead of just whether we hit an image.
+
+ * page/ContextMenuController.cpp:
+ (WebCore::ContextMenuController::handleContextMenuEvent):
+ (WebCore::ContextMenuController::showContextMenu):
+ (WebCore::imageFromImageElementNode):
+ (WebCore::ContextMenuController::maybeCreateContextMenu):
+ (WebCore::ContextMenuController::populate):
+ Keep track of the hit image in the ContextMenuContext.
+
+ (WebCore::ContextMenuController::replaceControlledImage):
+ Replace the hit image with a new one.
+
+ * page/ContextMenuController.h:
+
+ * rendering/RenderReplaced.h:
+ Fix a double-space typo.
+
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::paint):
+ (WebCore::RenderTheme::paintBorderOnly):
+ (WebCore::RenderTheme::paintDecorations):
+ Handle ImageControlsButtonPart in RenderTheme's switches.
+
+ * rendering/RenderTheme.h:
+ (WebCore::RenderTheme::imageControlsButtonSize):
+ (WebCore::RenderTheme::paintImageControlsButton):
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::servicesRolloverButtonCell):
+ (WebCore::RenderThemeMac::paintImageControlsButton):
+ (WebCore::RenderThemeMac::imageControlsButtonSize):
+ Paint the image controls button.
+
+ * editing/ios/EditorIOS.mm:
+ (WebCore::Editor::WebContentReader::readImage):
+ (WebCore::Editor::WebContentReader::readURL):
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::WebContentReader::readImage):
+ * platform/URL.cpp:
+ (WebCore::URL::fakeURLWithRelativePart):
+ * platform/URL.h:
+ Factor out code to create a "fake" URL (with a UUID "hostname" and the
+ webkit-fake-url protocol), and make use of it where we construct such URLs.
+
</ins><span class="cx"> 2014-03-12 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [Mac] Crash when running media/fallback.html test in MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification()
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> __ZN7WebCore11BitmapImageC1EPNS_13ImageObserverE
</span><span class="cx"> __ZN7WebCore11CachedFrame23cachedFramePlatformDataEv
</span><span class="cx"> __ZN7WebCore11CachedFrame26setCachedFramePlatformDataENSt3__110unique_ptrINS_23CachedFramePlatformDataENS1_14default_deleteIS3_EEEE
</span><ins>+__ZN7WebCore11CachedImage16imageForRendererEPKNS_12RenderObjectE
</ins><span class="cx"> __ZN7WebCore11FileChooser10chooseFileERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore11FileChooser11chooseFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
</span><span class="cx"> __ZN7WebCore11FileChooserD1Ev
</span><span class="lines">@@ -1551,6 +1552,7 @@
</span><span class="cx"> __ZNK7WebCore13HitTestResult18titleDisplayStringEv
</span><span class="cx"> __ZNK7WebCore13HitTestResult19mediaIsInFullscreenEv
</span><span class="cx"> __ZNK7WebCore13HitTestResult19rectBasedTestResultEv
</span><ins>+__ZNK7WebCore13HitTestResult21innerNonSharedElementEv
</ins><span class="cx"> __ZNK7WebCore13HitTestResult5imageEv
</span><span class="cx"> __ZNK7WebCore13HitTestResult5titleERNS_13TextDirectionE
</span><span class="cx"> __ZNK7WebCore13HitTestResult9imageRectEv
</span><span class="lines">@@ -2930,6 +2932,10 @@
</span><span class="cx"> __ZNK7WebCore12IconDatabase9isEnabledEv
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+__ZN7WebCore21ContextMenuController22replaceControlledImageEN3WTF10PassRefPtrINS_5ImageEEE
+#endif
+
</ins><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> __ZN7WebCore10IDBKeyData14setNumberValueEd
</span><span class="cx"> __ZN7WebCore10IDBKeyData6decodeERNS_12KeyedDecoderERS0_
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -1035,6 +1035,8 @@
</span><span class="cx">                 2B365C841525119E0091D27B /* RenderSVGEllipse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */; };
</span><span class="cx">                 2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
</span><span class="cx">                 2BE8E2C912A58A0100FAD550 /* HTMLMetaCharsetParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */; };
</span><ins>+                2D25396218CE7F6200270222 /* ImageControlsButtonElementMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */; };
+                2D25396318CE7F6200270222 /* ImageControlsButtonElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */; };
</ins><span class="cx">                 2D3A0E3613A7D76100E85AF0 /* SVGParsingError.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */; };
</span><span class="cx">                 2D46F05017B96FD2005647F0 /* IntSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04F17B96FD2005647F0 /* IntSize.cpp */; };
</span><span class="lines">@@ -7879,6 +7881,8 @@
</span><span class="cx">                 2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGEllipse.h; sourceTree = "<group>"; };
</span><span class="cx">                 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLMetaCharsetParser.h; path = parser/HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
</span><span class="cx">                 2BE8E2C812A58A0100FAD550 /* HTMLMetaCharsetParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLMetaCharsetParser.cpp; path = parser/HTMLMetaCharsetParser.cpp; sourceTree = "<group>"; };
</span><ins>+                2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsButtonElementMac.cpp; sourceTree = "<group>"; };
+                2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsButtonElementMac.h; sourceTree = "<group>"; };
</ins><span class="cx">                 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossfadeGeneratedImage.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrossfadeGeneratedImage.h; sourceTree = "<group>"; };
</span><span class="cx">                 2D2FC0561460CD6F00263633 /* GradientImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientImage.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -15740,6 +15744,8 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 510192D818B7D7AB007FC7A1 /* imageControlsMac.css */,
</span><ins>+                                2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */,
+                                2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */,
</ins><span class="cx">                                 510192CF18B6B9AB007FC7A1 /* ImageControlsRootElementMac.cpp */,
</span><span class="cx">                                 510192D018B6B9AB007FC7A1 /* ImageControlsRootElementMac.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -24041,6 +24047,7 @@
</span><span class="cx">                                 7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */,
</span><span class="cx">                                 F3F5CF1312ED81B30084C569 /* InspectorDatabaseInstrumentation.h in Headers */,
</span><span class="cx">                                 41F062140F5F192600A07EAC /* InspectorDatabaseResource.h in Headers */,
</span><ins>+                                2D25396318CE7F6200270222 /* ImageControlsButtonElementMac.h in Headers */,
</ins><span class="cx">                                 7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */,
</span><span class="cx">                                 F3D4C47912E07663003DA150 /* InspectorDOMDebuggerAgent.h in Headers */,
</span><span class="cx">                                 7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */,
</span><span class="lines">@@ -29189,6 +29196,7 @@
</span><span class="cx">                                 01D3CF8614BD0A3000FE9970 /* WebGLSharedObject.cpp in Sources */,
</span><span class="cx">                                 49C7B9E51042D32F0009D447 /* WebGLTexture.cpp in Sources */,
</span><span class="cx">                                 0C3F1F5A10C8871200D72CE1 /* WebGLUniformLocation.cpp in Sources */,
</span><ins>+                                2D25396218CE7F6200270222 /* ImageControlsButtonElementMac.cpp in Sources */,
</ins><span class="cx">                                 77A17A7712F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp in Sources */,
</span><span class="cx">                                 A5840E24187B8AC200843B10 /* WebInjectedScriptHost.cpp in Sources */,
</span><span class="cx">                                 A584FE2F1864CB8400843B10 /* WebInjectedScriptManager.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValueMappingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -38,9 +38,6 @@
</span><span class="cx"> #include "FontDescription.h"
</span><span class="cx"> #include "FontSmoothingMode.h"
</span><span class="cx"> #include "GraphicsTypes.h"
</span><del>-#if ENABLE(CSS_IMAGE_ORIENTATION)
-#include "ImageOrientation.h"
-#endif
</del><span class="cx"> #include "Length.h"
</span><span class="cx"> #include "LineClampValue.h"
</span><span class="cx"> #include "Path.h"
</span><span class="lines">@@ -51,9 +48,12 @@
</span><span class="cx"> #include "ThemeTypes.h"
</span><span class="cx"> #include "UnicodeBidi.h"
</span><span class="cx"> #include "WritingMode.h"
</span><del>-
</del><span class="cx"> #include <wtf/MathExtras.h>
</span><span class="cx">
</span><ins>+#if ENABLE(CSS_IMAGE_ORIENTATION)
+#include "ImageOrientation.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> template<> inline CSSPrimitiveValue::CSSPrimitiveValue(short i)
</span><span class="lines">@@ -604,6 +604,11 @@
</span><span class="cx"> case CapsLockIndicatorPart:
</span><span class="cx"> m_value.valueID = CSSValueCapsLockIndicator;
</span><span class="cx"> break;
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ case ImageControlsButtonPart:
+ m_value.valueID = CSSValueImageControlsButton;
+ break;
+#endif
</ins><span class="cx"> case InputSpeechButtonPart:
</span><span class="cx"> #if ENABLE(INPUT_SPEECH)
</span><span class="cx"> m_value.valueID = CSSValueWebkitInputSpeechButton;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueKeywordsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueKeywords.in        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -718,6 +718,9 @@
</span><span class="cx"> continuous-capacity-level-indicator
</span><span class="cx"> discrete-capacity-level-indicator
</span><span class="cx"> rating-level-indicator
</span><ins>+#if defined(ENABLE_IMAGE_CONTROLS) && ENABLE_IMAGE_CONTROLS
+image-controls-button
+#endif
</ins><span class="cx"> textarea
</span><span class="cx"> // An appearance value that should not be accepted by the parser:
</span><span class="cx"> caps-lock-indicator
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/dom/Node.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -240,6 +240,7 @@
</span><span class="cx"> virtual bool isInsertionPointNode() const { return false; }
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><span class="cx"> virtual bool isImageControlsRootElement() const { return false; }
</span><ins>+ virtual bool isImageControlsButtonElement() const { return false; }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> bool isDocumentNode() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingiosEditorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ios/EditorIOS.mm (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ios/EditorIOS.mm        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/editing/ios/EditorIOS.mm        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -470,14 +470,6 @@
</span><span class="cx"> return fragment;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
-{
- RetainPtr<CFUUIDRef> UUIDRef = adoptCF(CFUUIDCreate(kCFAllocatorDefault));
- RetainPtr<NSString> UUIDString = adoptNS((NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef.get()));
-
- return [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", @"webkit-fake-url", UUIDString.get(), relativePart]];
-}
-
</del><span class="cx"> bool Editor::WebContentReader::readImage(PassRefPtr<SharedBuffer> buffer, const String& type)
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<CFStringRef> stringType = type.createCFString();
</span><span class="lines">@@ -485,7 +477,7 @@
</span><span class="cx"> NSString *relativeURLPart = [@"image" stringByAppendingString:filenameExtension.get()];
</span><span class="cx"> RetainPtr<NSString> mimeType = adoptNS((NSString *)UTTypeCopyPreferredTagWithClass(stringType.get(), kUTTagClassMIMEType));
</span><span class="cx">
</span><del>- addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(buffer, uniqueURLWithRelativePart(relativeURLPart), mimeType.get(), emptyString(), emptyString())));
</del><ins>+ addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(buffer, URL::fakeURLWithRelativePart(relativeURLPart), mimeType.get(), emptyString(), emptyString())));
</ins><span class="cx"> return fragment;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -508,10 +500,10 @@
</span><span class="cx"> RetainPtr<NSString> fileType = adoptNS((NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef)[localPath pathExtension], NULL));
</span><span class="cx"> NSData *data = [NSData dataWithContentsOfFile:localPath];
</span><span class="cx"> if (UTTypeConformsTo((CFStringRef)fileType.get(), kUTTypePNG)) {
</span><del>- addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(SharedBuffer::wrapNSData([[data copy] autorelease]), uniqueURLWithRelativePart(@"image.png"), @"image/png", emptyString(), emptyString())));
</del><ins>+ addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(SharedBuffer::wrapNSData([[data copy] autorelease]), URL::fakeURLWithRelativePart("image.png"), @"image/png", emptyString(), emptyString())));
</ins><span class="cx"> return fragment;
</span><span class="cx"> } else if (UTTypeConformsTo((CFStringRef)fileType.get(), kUTTypeJPEG)) {
</span><del>- addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(SharedBuffer::wrapNSData([[data copy] autorelease]), uniqueURLWithRelativePart(@"image.jpg"), @"image/jpg", emptyString(), emptyString())));
</del><ins>+ addFragment(frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(SharedBuffer::wrapNSData([[data copy] autorelease]), URL::fakeURLWithRelativePart("image.jpg"), @"image/jpg", emptyString(), emptyString())));
</ins><span class="cx"> return fragment;
</span><span class="cx"> }
</span><span class="cx"> } else {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/mac/EditorMac.mm        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -545,7 +545,7 @@
</span><span class="cx"> ASSERT(type.contains('/'));
</span><span class="cx"> String typeAsFilenameWithExtension = type;
</span><span class="cx"> typeAsFilenameWithExtension.replace('/', '.');
</span><del>- URL imageURL = URL(URL(), "webkit-fake-url://" + createCanonicalUUIDString() + '/' + typeAsFilenameWithExtension);
</del><ins>+ URL imageURL = URL::fakeURLWithRelativePart(typeAsFilenameWithExtension);
</ins><span class="cx">
</span><span class="cx"> fragment = frame.editor().createFragmentForImageResourceAndAddResource(ArchiveResource::create(buffer, imageURL, type, emptyString(), emptyString()));
</span><span class="cx"> return fragment;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsButtonElementMaccpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp (0 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp         (rev 0)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -0,0 +1,118 @@
</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 "config.h"
+#include "ImageControlsButtonElementMac.h"
+
+#if ENABLE(IMAGE_CONTROLS)
+
+#include "ContextMenuController.h"
+#include "Event.h"
+#include "HTMLDivElement.h"
+#include "Page.h"
+#include "RenderBlockFlow.h"
+#include "RenderStyle.h"
+#include "RenderTheme.h"
+
+namespace WebCore {
+
+class RenderImageControlsButton final : public RenderBlockFlow {
+public:
+ RenderImageControlsButton(HTMLElement&, PassRef<RenderStyle>);
+ virtual ~RenderImageControlsButton();
+
+private:
+ virtual void updateLogicalWidth() override;
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const override;
+
+ virtual const char* renderName() const override { return "RenderImageControlsButton"; }
+ virtual bool requiresForcedStyleRecalcPropagation() const override { return true; }
+};
+
+RenderImageControlsButton::RenderImageControlsButton(HTMLElement& element, PassRef<RenderStyle> style)
+ : RenderBlockFlow(element, std::move(style))
+{
+}
+
+RenderImageControlsButton::~RenderImageControlsButton()
+{
+}
+
+void RenderImageControlsButton::updateLogicalWidth()
+{
+ RenderBox::updateLogicalWidth();
+
+ IntSize frameSize = theme().imageControlsButtonSize(this);
+ setLogicalWidth(isHorizontalWritingMode() ? frameSize.width() : frameSize.height());
+}
+
+void RenderImageControlsButton::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
+{
+ RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
+
+ IntSize frameSize = theme().imageControlsButtonSize(this);
+ computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
+}
+
+ImageControlsButtonElementMac::ImageControlsButtonElementMac(Document& document)
+ : HTMLDivElement(HTMLNames::divTag, document)
+{
+}
+
+ImageControlsButtonElementMac::~ImageControlsButtonElementMac()
+{
+}
+
+PassRefPtr<ImageControlsButtonElementMac> ImageControlsButtonElementMac::maybeCreate(Document& document)
+{
+ if (!document.page())
+ return nullptr;
+
+ RefPtr<ImageControlsButtonElementMac> button = adoptRef(new ImageControlsButtonElementMac(document));
+ button->setAttribute(HTMLNames::classAttr, "x-webkit-image-controls-button");
+
+ return button.release();
+}
+
+void ImageControlsButtonElementMac::defaultEventHandler(Event* event)
+{
+ if (event->type() == eventNames().clickEvent) {
+ if (Page* page = document().page())
+ page->contextMenuController().showImageControlsMenu(event);
+ event->setDefaultHandled();
+ return;
+ }
+
+ HTMLDivElement::defaultEventHandler(event);
+}
+
+RenderPtr<RenderElement> ImageControlsButtonElementMac::createElementRenderer(PassRef<RenderStyle> style)
+{
+ return createRenderer<RenderImageControlsButton>(*this, std::move(style));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsButtonElementMach"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.h (0 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.h         (rev 0)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsButtonElementMac.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -0,0 +1,54 @@
</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 ImageControlsButtonElementMac_h
+#define ImageControlsButtonElementMac_h
+
+#include "HTMLDivElement.h"
+
+#if ENABLE(IMAGE_CONTROLS)
+
+namespace WebCore {
+
+class ImageControlsButtonElementMac final : public HTMLDivElement {
+public:
+ virtual ~ImageControlsButtonElementMac();
+
+ static PassRefPtr<ImageControlsButtonElementMac> maybeCreate(Document&);
+
+private:
+ ImageControlsButtonElementMac(Document&);
+
+ virtual void defaultEventHandler(Event*) override;
+ virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
+
+ virtual bool isImageControlsButtonElement() const override { return true; }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(IMAGE_CONTROLS)
+
+#endif // ImageControlsButtonElementMac_h
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsRootElementMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -28,54 +28,85 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><span class="cx">
</span><del>-#include "ContextMenuController.h"
-#include "Event.h"
-#include "Page.h"
-#include "Text.h"
</del><ins>+#include "HTMLElement.h"
+#include "ImageControlsButtonElementMac.h"
+#include "RenderBlockFlow.h"
+#include "RenderImage.h"
+#include "RenderStyle.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-ImageControlsRootElementMac::ImageControlsRootElementMac(Document& document)
- : ImageControlsRootElement(document)
</del><ins>+class RenderImageControls final : public RenderBlockFlow {
+public:
+ RenderImageControls(HTMLElement&, PassRef<RenderStyle>);
+ virtual ~RenderImageControls();
+
+private:
+ virtual void updateLogicalWidth() override;
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const override;
+
+ virtual const char* renderName() const override { return "RenderImageControls"; }
+ virtual bool requiresForcedStyleRecalcPropagation() const override { return true; }
+};
+
+RenderImageControls::RenderImageControls(HTMLElement& element, PassRef<RenderStyle> style)
+ : RenderBlockFlow(element, std::move(style))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ImageControlsRootElementMac::~ImageControlsRootElementMac()
</del><ins>+RenderImageControls::~RenderImageControls()
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<ImageControlsRootElement> ImageControlsRootElement::maybeCreate(Document& document)
</del><ins>+void RenderImageControls::updateLogicalWidth()
</ins><span class="cx"> {
</span><del>- return ImageControlsRootElementMac::maybeCreate(document);
</del><ins>+ RenderBox::updateLogicalWidth();
+
+ RenderElement* renderer = element()->shadowHost()->renderer();
+ if (!renderer->isRenderImage())
+ return;
+
+ setLogicalWidth(toRenderImage(renderer)->logicalWidth());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<ImageControlsRootElementMac> ImageControlsRootElementMac::maybeCreate(Document& document)
</del><ins>+void RenderImageControls::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
</ins><span class="cx"> {
</span><ins>+ RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
+
+ RenderElement* renderer = element()->shadowHost()->renderer();
+ if (!renderer->isRenderImage())
+ return;
+
+ computedValues.m_extent = toRenderImage(renderer)->logicalHeight();
+}
+
+PassRefPtr<ImageControlsRootElement> ImageControlsRootElement::maybeCreate(Document& document)
+{
</ins><span class="cx"> if (!document.page())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> RefPtr<ImageControlsRootElementMac> controls = adoptRef(new ImageControlsRootElementMac(document));
</span><del>- controls->setAttribute(HTMLNames::classAttr, "x-webkit-imagemenu");
- ExceptionCode ec;
- controls->appendChild(Text::create(document, ""), ec);
- if (ec)
- return nullptr;
</del><ins>+ controls->setAttribute(HTMLNames::classAttr, "x-webkit-image-controls");
</ins><span class="cx">
</span><ins>+ controls->appendChild(ImageControlsButtonElementMac::maybeCreate(document));
+
</ins><span class="cx"> return controls.release();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageControlsRootElementMac::defaultEventHandler(Event* event)
</del><ins>+ImageControlsRootElementMac::ImageControlsRootElementMac(Document& document)
+ : ImageControlsRootElement(document)
</ins><span class="cx"> {
</span><del>- if (event->type() == eventNames().clickEvent) {
- if (Page* page = document().page())
- page->contextMenuController().showImageControlsMenu(event);
</del><ins>+}
</ins><span class="cx">
</span><del>- return;
- }
-
- HTMLDivElement::defaultEventHandler(event);
</del><ins>+ImageControlsRootElementMac::~ImageControlsRootElementMac()
+{
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+RenderPtr<RenderElement> ImageControlsRootElementMac::createElementRenderer(PassRef<RenderStyle> style)
+{
+ return createRenderer<RenderImageControls>(*this, std::move(style));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(IMAGE_CONTROLS)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacImageControlsRootElementMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/html/shadow/mac/ImageControlsRootElementMac.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -32,16 +32,15 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class ImageControlsRootElementMac : public ImageControlsRootElement {
</del><ins>+class ImageControlsRootElementMac final : public ImageControlsRootElement {
+ friend class ImageControlsRootElement;
</ins><span class="cx"> public:
</span><del>- ~ImageControlsRootElementMac();
</del><ins>+ virtual ~ImageControlsRootElementMac();
</ins><span class="cx">
</span><del>- static PassRefPtr<ImageControlsRootElementMac> maybeCreate(Document&);
-
</del><span class="cx"> private:
</span><span class="cx"> ImageControlsRootElementMac(Document&);
</span><span class="cx">
</span><del>- virtual void defaultEventHandler(Event*) override;
</del><ins>+ virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowmacimageControlsMaccss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/mac/imageControlsMac.css (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/mac/imageControlsMac.css        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/html/shadow/mac/imageControlsMac.css        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -23,16 +23,20 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-.x-webkit-imagemenu {
- opacity: 0;
</del><ins>+.x-webkit-image-controls {
</ins><span class="cx"> position: relative;
</span><del>- background-color: red;
- width: 20px;
- height: 20px;
- border-radius: 5px;
- transition: opacity 0.5s;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-.x-webkit-imagemenu:hover {
</del><ins>+.x-webkit-image-controls-button {
+ position: absolute;
+ right: 18px; /* FIXME: Why is right: 0px off the right edge of the parent? */
+
+ -webkit-appearance: image-controls-button;
+
+ transition: opacity 0.25s;
+ opacity: 0;
+}
+
+.x-webkit-image-controls:hover .x-webkit-image-controls-button {
</ins><span class="cx"> opacity: 1.0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuContext.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuContext.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/page/ContextMenuContext.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -32,22 +32,15 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> ContextMenuContext::ContextMenuContext()
</span><del>-#if ENABLE(IMAGE_CONTROLS)
- : m_isImageControl(false)
-#endif
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ContextMenuContext::ContextMenuContext(const HitTestResult& hitTestResult, bool isImageControl)
</del><ins>+ContextMenuContext::ContextMenuContext(const HitTestResult& hitTestResult)
</ins><span class="cx"> : m_hitTestResult(hitTestResult)
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><del>- , m_isImageControl(isImageControl)
</del><ins>+ , m_controlledImage(nullptr)
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><del>-#if !ENABLE(IMAGE_CONTROLS)
- UNUSED_PARAM(isImageControl);
-#endif
- ASSERT_UNUSED(isImageControl, true);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuContext.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuContext.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/page/ContextMenuContext.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -30,18 +30,20 @@
</span><span class="cx"> #if ENABLE(CONTEXT_MENUS)
</span><span class="cx">
</span><span class="cx"> #include "HitTestResult.h"
</span><ins>+#include "Image.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class ContextMenuContext {
</span><span class="cx"> public:
</span><span class="cx"> ContextMenuContext();
</span><del>- ContextMenuContext(const HitTestResult&, bool isImageControl = false);
</del><ins>+ ContextMenuContext(const HitTestResult&);
</ins><span class="cx">
</span><span class="cx"> const HitTestResult& hitTestResult() const { return m_hitTestResult; }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><del>- bool isImageControl() const { return m_isImageControl; }
</del><ins>+ void setControlledImage(Image* controlledImage) { m_controlledImage = controlledImage; }
+ Image* controlledImage() const { return m_controlledImage.get(); }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -49,7 +51,7 @@
</span><span class="cx"> HitTestResult m_hitTestResult;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><del>- bool m_isImageControl;
</del><ins>+ RefPtr<Image> m_controlledImage;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuController.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> #include "Node.h"
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PlatformEvent.h"
</span><ins>+#include "RenderImage.h"
</ins><span class="cx"> #include "ReplaceSelectionCommand.h"
</span><span class="cx"> #include "ResourceRequest.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="lines">@@ -96,7 +97,7 @@
</span><span class="cx">
</span><span class="cx"> void ContextMenuController::handleContextMenuEvent(Event* event)
</span><span class="cx"> {
</span><del>- m_contextMenu = createContextMenu(event);
</del><ins>+ m_contextMenu = maybeCreateContextMenu(event);
</ins><span class="cx"> if (!m_contextMenu)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_menuProvider = menuProvider;
</span><span class="cx">
</span><del>- m_contextMenu = createContextMenu(event);
</del><ins>+ m_contextMenu = maybeCreateContextMenu(event);
</ins><span class="cx"> if (!m_contextMenu) {
</span><span class="cx"> clearContextMenu();
</span><span class="cx"> return;
</span><span class="lines">@@ -128,8 +129,24 @@
</span><span class="cx"> showContextMenu(event);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(Event* event)
</del><ins>+#if ENABLE(IMAGE_CONTROLS)
+static Image* imageFromImageElementNode(Node& node)
</ins><span class="cx"> {
</span><ins>+ RenderObject* renderer = node.renderer();
+ if (!renderer)
+ return nullptr;
+ if (!renderer->isRenderImage())
+ return nullptr;
+ CachedImage* image = toRenderImage(*renderer).cachedImage();
+ if (!image || image->errorOccurred())
+ return nullptr;
+
+ return image->imageForRenderer(renderer);
+}
+#endif
+
+PassOwnPtr<ContextMenu> ContextMenuController::maybeCreateContextMenu(Event* event)
+{
</ins><span class="cx"> ASSERT(event);
</span><span class="cx">
</span><span class="cx"> if (!event->isMouseEvent())
</span><span class="lines">@@ -145,10 +162,16 @@
</span><span class="cx"> if (!result.innerNonSharedNode())
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><ins>+ m_context = ContextMenuContext(result);
+
</ins><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><del>- m_context = ContextMenuContext(result, node->isImageControlsRootElement());
-#else
- m_context = ContextMenuContext(result);
</del><ins>+ if (node->isImageControlsButtonElement()) {
+ if (Image* image = imageFromImageElementNode(*result.innerNonSharedNode()))
+ m_context.setControlledImage(image);
+
+ // FIXME: If we couldn't get the image then we shouldn't try to show the image controls menu for it.
+ return nullptr;
+ }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> return adoptPtr(new ContextMenu);
</span><span class="lines">@@ -822,7 +845,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><span class="cx"> // The default image control menu gets populated solely by the platform.
</span><del>- if (m_context.isImageControl())
</del><ins>+ if (m_context.controlledImage())
</ins><span class="cx"> return;
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -1429,6 +1452,24 @@
</span><span class="cx"> handleContextMenuEvent(event);
</span><span class="cx"> m_client.showContextMenu();
</span><span class="cx"> }
</span><ins>+
+void ContextMenuController::replaceControlledImage(PassRefPtr<Image> newImage)
+{
+ Node* node = m_context.hitTestResult().innerNonSharedNode();
+ if (!node)
+ return;
+
+ Frame* frame = node->document().frame();
+ if (!frame)
+ return;
+
+ RenderObject* renderer = node->renderer();
+ if (!renderer || !renderer->isRenderImage())
+ return;
+
+ CachedResourceHandle<CachedImage> replacedImage = new CachedImage(URL::fakeURLWithRelativePart("image"), newImage.get(), frame->page()->sessionID());
+ toRenderImage(renderer)->imageResource().setCachedImage(replacedImage.get());
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuController.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuController.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/page/ContextMenuController.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -71,10 +71,11 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><span class="cx"> void showImageControlsMenu(Event*);
</span><ins>+ void replaceControlledImage(PassRefPtr<Image>);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- PassOwnPtr<ContextMenu> createContextMenu(Event*);
</del><ins>+ PassOwnPtr<ContextMenu> maybeCreateContextMenu(Event*);
</ins><span class="cx"> void showContextMenu(Event*);
</span><span class="cx">
</span><span class="cx"> void appendItem(ContextMenuItem&, ContextMenu* parentMenu);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformThemeTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ThemeTypes.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ThemeTypes.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/platform/ThemeTypes.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -58,6 +58,9 @@
</span><span class="cx"> SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
</span><span class="cx"> SearchFieldCancelButtonPart, SnapshottedPluginOverlayPart, TextFieldPart,
</span><span class="cx"> RelevancyLevelIndicatorPart, ContinuousCapacityLevelIndicatorPart, DiscreteCapacityLevelIndicatorPart, RatingLevelIndicatorPart,
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ ImageControlsButtonPart,
+#endif
</ins><span class="cx"> TextAreaPart, CapsLockIndicatorPart
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URL.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URL.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/platform/URL.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "DecodeEscapeSequences.h"
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><span class="cx"> #include "TextEncoding.h"
</span><ins>+#include "UUID.h"
</ins><span class="cx"> #include <stdio.h>
</span><span class="cx"> #include <unicode/uidna.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="lines">@@ -1947,4 +1948,9 @@
</span><span class="cx"> return string().left(length / 2 - 1) + "..." + string().right(length / 2 - 2);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+URL URL::fakeURLWithRelativePart(const String& relativePart)
+{
+ return URL(URL(), "webkit-fake-url://" + createCanonicalUUIDString() + '/' + relativePart);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URL.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URL.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/platform/URL.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -72,6 +72,8 @@
</span><span class="cx"> URL(const URL& base, const String& relative);
</span><span class="cx"> URL(const URL& base, const String& relative, const TextEncoding&);
</span><span class="cx">
</span><ins>+ static URL fakeURLWithRelativePart(const String&);
+
</ins><span class="cx"> String strippedForUseAsReferrer() const;
</span><span class="cx">
</span><span class="cx"> // FIXME: The above functions should be harmonized so that passing a
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> public:
</span><span class="cx"> virtual ~RenderReplaced();
</span><span class="cx">
</span><del>- virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override;
</del><ins>+ virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override;
</ins><span class="cx"> virtual LayoutUnit computeReplacedLogicalHeight() const override;
</span><span class="cx">
</span><span class="cx"> LayoutRect replacedContentRect(const LayoutSize& intrinsicSize) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -253,6 +253,10 @@
</span><span class="cx"> case InputSpeechButtonPart:
</span><span class="cx"> return adjustInputFieldSpeechButtonStyle(&styleResolver, &style, e);
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ case ImageControlsButtonPart:
+ break;
+#endif
</ins><span class="cx"> default:
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -386,6 +390,10 @@
</span><span class="cx"> case InputSpeechButtonPart:
</span><span class="cx"> return paintInputFieldSpeechButton(o, paintInfo, r);
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ case ImageControlsButtonPart:
+ return paintImageControlsButton(o, paintInfo, r);
+#endif
</ins><span class="cx"> default:
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -440,6 +448,9 @@
</span><span class="cx"> #if ENABLE(INPUT_SPEECH)
</span><span class="cx"> case InputSpeechButtonPart:
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ case ImageControlsButtonPart:
+#endif
</ins><span class="cx"> default:
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -499,6 +510,9 @@
</span><span class="cx"> #if ENABLE(INPUT_SPEECH)
</span><span class="cx"> case InputSpeechButtonPart:
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ case ImageControlsButtonPart:
+#endif
</ins><span class="cx"> default:
</span><span class="cx"> break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/rendering/RenderTheme.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -244,6 +244,10 @@
</span><span class="cx"> enum FileUploadDecorations { SingleFile, MultipleFiles };
</span><span class="cx"> virtual bool paintFileUploadIconDecorations(RenderObject* /*inputRenderer*/, RenderObject* /*buttonRenderer*/, const PaintInfo&, const IntRect&, Icon*, FileUploadDecorations) { return true; }
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ virtual IntSize imageControlsButtonSize(const RenderObject*) const { return IntSize(); }
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx"> // The platform selection color.
</span><span class="cx"> virtual Color platformActiveSelectionBackgroundColor() const;
</span><span class="lines">@@ -360,6 +364,10 @@
</span><span class="cx">
</span><span class="cx"> virtual bool paintSnapshottedPluginOverlay(RenderObject*, const PaintInfo&, const IntRect&) { return true; }
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ virtual bool paintImageControlsButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; }
+#endif
+
</ins><span class="cx"> public:
</span><span class="cx"> // Methods for state querying
</span><span class="cx"> ControlStates controlStatesForRenderer(const RenderObject* o) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -28,6 +28,10 @@
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/HashMap.h>
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+OBJC_CLASS NSServicesRolloverButtonCell;
+#endif
+
</ins><span class="cx"> OBJC_CLASS WebCoreRenderThemeNotificationObserver;
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -203,16 +207,16 @@
</span><span class="cx"> void setSearchCellState(RenderObject*, const IntRect&);
</span><span class="cx"> void setSearchFieldSize(RenderStyle*) const;
</span><span class="cx">
</span><del>- NSPopUpButtonCell* popupButton() const;
- NSSearchFieldCell* search() const;
- NSMenu* searchMenuTemplate() const;
- NSSliderCell* sliderThumbHorizontal() const;
- NSSliderCell* sliderThumbVertical() const;
- NSTextFieldCell* textField() const;
</del><ins>+ NSPopUpButtonCell *popupButton() const;
+ NSSearchFieldCell *search() const;
+ NSMenu *searchMenuTemplate() const;
+ NSSliderCell *sliderThumbHorizontal() const;
+ NSSliderCell *sliderThumbVertical() const;
+ NSTextFieldCell *textField() const;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(METER_ELEMENT)
</span><span class="cx"> NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const;
</span><del>- NSLevelIndicatorCell* levelIndicatorFor(const RenderMeter*) const;
</del><ins>+ NSLevelIndicatorCell *levelIndicatorFor(const RenderMeter*) const;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PROGRESS_ELEMENT)
</span><span class="lines">@@ -221,7 +225,12 @@
</span><span class="cx"> const int* progressBarMargins(NSControlSize) const;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-private:
</del><ins>+#if ENABLE(IMAGE_CONTROLS)
+ virtual bool paintImageControlsButton(RenderObject*, const PaintInfo&, const IntRect&) override;
+ virtual IntSize imageControlsButtonSize(const RenderObject*) const override;
+ NSServicesRolloverButtonCell *servicesRolloverButtonCell() const;
+#endif
+
</ins><span class="cx"> mutable RetainPtr<NSPopUpButtonCell> m_popupButton;
</span><span class="cx"> mutable RetainPtr<NSSearchFieldCell> m_search;
</span><span class="cx"> mutable RetainPtr<NSMenu> m_searchMenuTemplate;
</span><span class="lines">@@ -229,6 +238,9 @@
</span><span class="cx"> mutable RetainPtr<NSSliderCell> m_sliderThumbVertical;
</span><span class="cx"> mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator;
</span><span class="cx"> mutable RetainPtr<NSTextFieldCell> m_textField;
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ mutable RetainPtr<NSServicesRolloverButtonCell> m_servicesRolloverButton;
+#endif
</ins><span class="cx">
</span><span class="cx"> bool m_isSliderThumbHorizontalPressed;
</span><span class="cx"> bool m_isSliderThumbVerticalPressed;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.mm        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -70,10 +70,36 @@
</span><span class="cx"> #import <math.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(METER_ELEMENT)
</span><del>-#include "RenderMeter.h"
-#include "HTMLMeterElement.h"
</del><ins>+#import "RenderMeter.h"
+#import "HTMLMeterElement.h"
</ins><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+
+#if __has_include(<AppKit/AppKitDefines_Private.h>)
+#import <AppKit/AppKitDefines_Private.h>
+#else
+#define APPKIT_PRIVATE_CLASS
+#endif
+
+#if __has_include(<AppKit/NSServicesRolloverButtonCell.h>)
+#import <AppKit/NSServicesRolloverButtonCell.h>
+#endif
+
+@interface NSServicesRolloverButtonCell (Details)
++ (NSServicesRolloverButtonCell *)serviceRolloverButtonCellForStyle:(NSSharingServicePickerStyle)style;
+@end
+
+#if __has_include(<AppKit/NSSharingService_Private.h>)
+#import <AppKit/NSSharingService_Private.h>
+#else
+typedef enum {
+ NSSharingServicePickerStyleRollover = 1
+} NSSharingServicePickerStyle;
+#endif
+
+#endif // ENABLE(IMAGE_CONTROLS)
+
</ins><span class="cx"> // The methods in this file are specific to the Mac OS X platform.
</span><span class="cx">
</span><span class="cx"> // FIXME: The platform-independent code in this class should be factored out and merged with RenderThemeSafari.
</span><span class="lines">@@ -1941,7 +1967,43 @@
</span><span class="cx"> return StringTruncator::centerTruncate(strToTruncate, width, font, StringTruncator::EnableRoundingHacks);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+NSServicesRolloverButtonCell* RenderThemeMac::servicesRolloverButtonCell() const
+{
+ if (!m_servicesRolloverButton) {
+ m_servicesRolloverButton = [NSServicesRolloverButtonCell serviceRolloverButtonCellForStyle:NSSharingServicePickerStyleRollover];
+ [m_servicesRolloverButton setBordered:NO];
+ }
</ins><span class="cx">
</span><ins>+ return m_servicesRolloverButton.get();
+}
+
+bool RenderThemeMac::paintImageControlsButton(RenderObject* renderer, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ if (paintInfo.phase != PaintPhaseBlockBackground)
+ return true;
+
+ NSServicesRolloverButtonCell *cell = servicesRolloverButtonCell();
+
+ LocalCurrentGraphicsContext localContext(paintInfo.context);
+ GraphicsContextStateSaver stateSaver(*paintInfo.context);
+
+ paintInfo.context->scale(FloatSize(1, -1));
+ paintInfo.context->translate(rect.x(), -rect.height() - rect.y());
+
+ IntRect innerFrame(IntPoint(), rect.size());
+ [cell drawWithFrame:innerFrame inView:documentViewFor(renderer)];
+ [cell setControlView:nil];
+
+ return true;
+}
+
+IntSize RenderThemeMac::imageControlsButtonSize(const RenderObject*) const
+{
+ return IntSize(servicesRolloverButtonCell().cellSize);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit/ChangeLog        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-03-12 Tim Horton <timothy_horton@apple.com>
+
+ Hook up image controls for WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=130062
+ <rdar://problem/15964809>
+
+ Reviewed by Brady Eidson.
+
+ * WebKit.xcodeproj/project.pbxproj:
+ Add WebSharingServicePickerController.
+
</ins><span class="cx"> 2014-03-11 Jae Hyun Park <jaepark@webkit.org>
</span><span class="cx">
</span><span class="cx"> [GTK][CMake] Add HARFBUZZ_INCLUDE_DIRS to WebKit and WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -80,6 +80,8 @@
</span><span class="cx">                 224100F90918190100D2D266 /* WebPluginsPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = 224100F80918190100D2D266 /* WebPluginsPrivate.m */; };
</span><span class="cx">                 22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 29AEF960134C76FB00FE5096 /* OutlookQuirksUserScript.js in Resources */ = {isa = PBXBuildFile; fileRef = 29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */; };
</span><ins>+                2D25396618CE85C200270222 /* WebSharingServicePickerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396418CE85C200270222 /* WebSharingServicePickerController.h */; };
+                2D25396718CE85C200270222 /* WebSharingServicePickerController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D25396518CE85C200270222 /* WebSharingServicePickerController.mm */; };
</ins><span class="cx">                 312E2FE514E48182007CCA18 /* WebNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 312E2FE314E48182007CCA18 /* WebNotification.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 312E2FE614E48182007CCA18 /* WebNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = 312E2FE414E48182007CCA18 /* WebNotification.mm */; };
</span><span class="cx">                 312E2FE914E48215007CCA18 /* WebNotificationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 312E2FE814E48215007CCA18 /* WebNotificationInternal.h */; };
</span><span class="lines">@@ -527,6 +529,8 @@
</span><span class="cx">                 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 2568C72C0174912D0ECA149E /* WebKit.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKit.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 29AEF95D134C755400FE5096 /* OutlookQuirksUserScript.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = OutlookQuirksUserScript.js; sourceTree = "<group>"; };
</span><ins>+                2D25396418CE85C200270222 /* WebSharingServicePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSharingServicePickerController.h; sourceTree = "<group>"; };
+                2D25396518CE85C200270222 /* WebSharingServicePickerController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSharingServicePickerController.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFormDelegatePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 2D81DAB203EB0B2D00A80166 /* WebFormDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFormDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 2D81DAB303EB0B2D00A80166 /* WebFormDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebFormDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
</span><span class="lines">@@ -1134,6 +1138,8 @@
</span><span class="cx">                                 9345DDAE0365FB27008635CE /* WebNSWindowExtras.h */,
</span><span class="cx">                                 9345DDAF0365FB27008635CE /* WebNSWindowExtras.m */,
</span><span class="cx">                                 A57E2F22120749E600048DF3 /* WebQuotaManager.h */,
</span><ins>+                                2D25396418CE85C200270222 /* WebSharingServicePickerController.h */,
+                                2D25396518CE85C200270222 /* WebSharingServicePickerController.mm */,
</ins><span class="cx">                                 F59668C802AD2923018635CA /* WebStringTruncator.h */,
</span><span class="cx">                                 F59668C902AD2923018635CA /* WebStringTruncator.mm */,
</span><span class="cx">                                 DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */,
</span><span class="lines">@@ -1854,6 +1860,7 @@
</span><span class="cx">                                 939810240824BF01008DF038 /* WebNSViewExtras.h in Headers */,
</span><span class="cx">                                 939810250824BF01008DF038 /* WebNSWindowExtras.h in Headers */,
</span><span class="cx">                                 A58A5799143E727000125F50 /* WebOpenPanelResultListener.h in Headers */,
</span><ins>+                                2D25396618CE85C200270222 /* WebSharingServicePickerController.h in Headers */,
</ins><span class="cx">                                 9398102A0824BF01008DF038 /* WebPanelAuthenticationHandler.h in Headers */,
</span><span class="cx">                                 37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */,
</span><span class="cx">                                 939810A50824BF01008DF038 /* WebPDFRepresentation.h in Headers */,
</span><span class="lines">@@ -2161,6 +2168,7 @@
</span><span class="cx">                         isa = PBXSourcesBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                2D25396718CE85C200270222 /* WebSharingServicePickerController.mm in Sources */,
</ins><span class="cx">                                 1A60519117502A5D00BC62F5 /* BinaryPropertyList.cpp in Sources */,
</span><span class="cx">                                 939811010824BF01008DF038 /* CarbonUtils.m in Sources */,
</span><span class="cx">                                 939810FD0824BF01008DF038 /* CarbonWindowAdapter.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-03-12 Tim Horton <timothy_horton@apple.com>
+
+ Hook up image controls for WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=130062
+ <rdar://problem/15964809>
+
+ Reviewed by Brady Eidson.
+
+ * Misc/WebSharingServicePickerController.h: Added.
+ * Misc/WebSharingServicePickerController.mm: Added.
+ (-[WebSharingServicePickerController initWithImage:menuClient:]):
+ (-[WebSharingServicePickerController menu]):
+ (-[WebSharingServicePickerController sharingServicePicker:delegateForSharingService:]):
+ (-[WebSharingServicePickerController sharingServicePicker:didChooseSharingService:]):
+ (-[WebSharingServicePickerController sharingService:didShareItems:]):
+ (-[WebSharingServicePickerController sharingService:didFailToShareItems:error:]):
+ (-[WebSharingServicePickerController sharingService:sourceWindowForShareItems:sharingContentScope:]):
+ Add a NSSharingServiceDelegate and NSSharingServicePickerDelegate, which will also
+ provide a NSMenu instance for WebContextMenuClient to pop up when image controls are needed.
+ When data is returned from the service, it is re-inserted into the image via replaceControlledImage.
+
+ * WebCoreSupport/WebContextMenuClient.h:
+ * WebCoreSupport/WebContextMenuClient.mm:
+ (WebContextMenuClient::contextMenuForEvent):
+ Factor out code to decide which NSMenu to use, so that we can use early-returns to simplify it.
+ If we hit an image with image controls, use the WebSharingServicePickerController's menu.
+
+ (WebContextMenuClient::showContextMenu):
+ (WebContextMenuClient::clearSharingServicePickerController):
+
</ins><span class="cx"> 2014-03-10 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS][WK1] Crash in HTMLMediaElement::createElementRenderer() - "-[NSSet addObject:]: object cannot be nil"
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebSharingServicePickerControllerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.h (0 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.h         (rev 0)
+++ trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -0,0 +1,41 @@
</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.
+ */
+
+#if ENABLE(IMAGE_CONTROLS)
+
+@class NSSharingServicePicker;
+@protocol NSSharingServiceDelegate;
+@protocol NSSharingServicePickerDelegate;
+
+class WebContextMenuClient;
+
+@interface WebSharingServicePickerController : NSObject <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
+
+- (instancetype)initWithImage:(NSImage *)image menuClient:(WebContextMenuClient*)menuClient;
+- (NSMenu *)menu;
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebSharingServicePickerControllermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.mm (0 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.mm         (rev 0)
+++ trunk/Source/WebKit/mac/Misc/WebSharingServicePickerController.mm        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -0,0 +1,125 @@
</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.
+ */
+
+#import "WebSharingServicePickerController.h"
+
+#if ENABLE(IMAGE_CONTROLS)
+
+#import "WebContextMenuClient.h"
+#import "WebViewInternal.h"
+#import <AppKit/NSSharingService.h>
+#import <WebCore/BitmapImage.h>
+#import <WebCore/ContextMenuController.h>
+#import <WebCore/Page.h>
+
+#if __has_include(<AppKit/NSSharingService_Private.h>)
+#import <AppKit/NSSharingService_Private.h>
+#else
+typedef enum {
+ NSSharingServicePickerStyleRollover = 1
+} NSSharingServicePickerStyle;
+#endif
+
+using namespace WebCore;
+
+@implementation WebSharingServicePickerController {
+ WebContextMenuClient* _menuClient;
+ RetainPtr<NSSharingServicePicker> _picker;
+}
+
+- (instancetype)initWithImage:(NSImage *)image menuClient:(WebContextMenuClient*)menuClient
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ image ]]);
+ [_picker setStyle:NSSharingServicePickerStyleRollover];
+ [_picker setDelegate:self];
+
+ _menuClient = menuClient;
+
+ return self;
+}
+
+- (void)clear
+{
+ _menuClient->clearSharingServicePickerController();
+
+ _picker = nullptr;
+ _menuClient = nullptr;
+}
+
+- (NSMenu *)menu
+{
+ return [_picker menu];
+}
+
+#pragma mark NSSharingServicePickerDelegate methods
+
+- (id <NSSharingServiceDelegate>)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
+{
+ return self;
+}
+
+- (void)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker didChooseSharingService:(NSSharingService *)service
+{
+ if (!service)
+ _menuClient->clearSharingServicePickerController();
+}
+
+#pragma mark NSSharingServiceDelegate methods
+
+- (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray *)items
+{
+ // We only send one item, so we should only get one item back.
+ if ([items count] != 1)
+ return;
+
+ RetainPtr<CGImageSourceRef> source = adoptCF(CGImageSourceCreateWithData((CFDataRef)[items objectAtIndex:0], NULL));
+ RetainPtr<CGImageRef> cgImage = adoptCF(CGImageSourceCreateImageAtIndex(source.get(), 0, NULL));
+ RefPtr<Image> image = BitmapImage::create(cgImage.get());
+
+ Page* page = [_menuClient->webView() page];
+ if (!page)
+ return;
+
+ page->contextMenuController().replaceControlledImage(image.get());
+
+ [self clear];
+}
+
+- (void)sharingService:(NSSharingService *)sharingService didFailToShareItems:(NSArray *)items error:(NSError *)error
+{
+ [self clear];
+}
+
+- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
+{
+ return [_menuClient->webView() window];
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebContextMenuClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.h        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #import <WebCore/ContextMenuClient.h>
</span><span class="cx">
</span><ins>+@class WebSharingServicePickerController;
</ins><span class="cx"> @class WebView;
</span><span class="cx">
</span><span class="cx"> class WebContextMenuClient : public WebCore::ContextMenuClient {
</span><span class="lines">@@ -48,8 +49,17 @@
</span><span class="cx"> virtual void searchWithSpotlight() override;
</span><span class="cx"> virtual void showContextMenu() override;
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ void clearSharingServicePickerController();
+#endif
+
</ins><span class="cx"> WebView *webView() { return m_webView; }
</span><span class="cx">
</span><span class="cx"> private:
</span><ins>+ NSMenu *contextMenuForEvent(NSEvent *, NSView *);
+
</ins><span class="cx"> WebView *m_webView;
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+ RetainPtr<WebSharingServicePickerController> m_sharingServicePickerController;
+#endif
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #import "WebContextMenuClient.h"
</span><span class="cx">
</span><ins>+#import <WebCore/BitmapImage.h>
</ins><span class="cx"> #import "WebDelegateImplementationCaching.h"
</span><span class="cx"> #import "WebElementDictionary.h"
</span><span class="cx"> #import "WebFrame.h"
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx"> #import "WebHTMLViewInternal.h"
</span><span class="cx"> #import "WebKitVersionChecks.h"
</span><span class="cx"> #import "WebNSPasteboardExtras.h"
</span><ins>+#import "WebSharingServicePickerController.h"
</ins><span class="cx"> #import "WebUIDelegate.h"
</span><span class="cx"> #import "WebUIDelegatePrivate.h"
</span><span class="cx"> #import "WebView.h"
</span><span class="lines">@@ -352,6 +354,22 @@
</span><span class="cx"> [NSApp stopSpeaking:nil];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+NSMenu *WebContextMenuClient::contextMenuForEvent(NSEvent *event, NSView *view)
+{
+ Page* page = [m_webView page];
+ if (!page)
+ return nil;
+
+#if ENABLE(IMAGE_CONTROLS)
+ if (Image* image = page->contextMenuController().context().controlledImage()) {
+ m_sharingServicePickerController = adoptNS([[WebSharingServicePickerController alloc] initWithImage:image->getNSImage() menuClient:this]);
+ return [m_sharingServicePickerController menu];
+ }
+#endif
+
+ return [view menuForEvent:event];
+}
+
</ins><span class="cx"> void WebContextMenuClient::showContextMenu()
</span><span class="cx"> {
</span><span class="cx"> Page* page = [m_webView page];
</span><span class="lines">@@ -364,14 +382,21 @@
</span><span class="cx"> if (!frameView)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- IntPoint point = frameView->contentsToWindow(page->contextMenuController().hitTestResult().roundedPointInInnerNodeFrame());
</del><span class="cx"> NSView* view = frameView->documentView();
</span><ins>+ IntPoint point = frameView->contentsToRootView(page->contextMenuController().hitTestResult().roundedPointInInnerNodeFrame());
</ins><span class="cx"> NSPoint nsScreenPoint = [view convertPoint:point toView:nil];
</span><ins>+ NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
+
</ins><span class="cx"> // Show the contextual menu for this event.
</span><del>- NSEvent* event = [NSEvent mouseEventWithType:NSRightMouseDown location:nsScreenPoint modifierFlags:0 timestamp:0 windowNumber:[[view window] windowNumber] context:0 eventNumber:0 clickCount:1 pressure:1];
- NSMenu* nsMenu = [view menuForEvent:event];
- if (nsMenu)
- [NSMenu popUpContextMenu:nsMenu withEvent:event forView:view];
</del><ins>+ if (NSMenu *menu = contextMenuForEvent(event, view))
+ [NSMenu popUpContextMenu:menu withEvent:event forView:view];
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(IMAGE_CONTROLS)
+void WebContextMenuClient::clearSharingServicePickerController()
+{
+ m_sharingServicePickerController = nil;
+}
+#endif
+
</ins><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-03-12 Tim Horton <timothy_horton@apple.com>
+
+ Hook up image controls for WebKit1
+ https://bugs.webkit.org/show_bug.cgi?id=130062
+ <rdar://problem/15964809>
+
+ Reviewed by Brady Eidson.
+
+ * Shared/ContextMenuContextData.cpp:
+ (WebKit::ContextMenuContextData::ContextMenuContextData):
+
</ins><span class="cx"> 2014-03-11 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r165356): [Mac] Multi-part key bindings don't work
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedContextMenuContextDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp (165478 => 165479)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp        2014-03-12 17:44:27 UTC (rev 165478)
+++ trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp        2014-03-12 17:51:54 UTC (rev 165479)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> ContextMenuContextData::ContextMenuContextData(const ContextMenuContext& context)
</span><span class="cx"> : m_webHitTestResultData(WebHitTestResult::Data(context.hitTestResult()))
</span><span class="cx"> #if ENABLE(IMAGE_CONTROLS)
</span><del>- , m_isImageControl(context.isImageControl())
</del><ins>+ , m_isImageControl(context.controlledImage())
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>