<!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>[176849] trunk/Source/WebKit2</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/176849">176849</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-05 10:30:14 -0800 (Fri, 05 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>WKBundleCSSStyleDeclarationRef needs to be a real API::Object
https://bugs.webkit.org/show_bug.cgi?id=139291

Patch by Sam Weinig &lt;sam@webkit.org&gt; on 2014-12-05
Reviewed by Dan Bernstein.

Change WKBundleCSSStyleDeclarationRef from being a WebCore::CSSStyleDeclaration, to
being a real API::Object.  WKRetain and WKRelease require this.

* Shared/APIObject.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp: Added.
(WebKit::domHandleCache):
(WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
(WebKit::InjectedBundleCSSStyleDeclarationHandle::InjectedBundleCSSStyleDeclarationHandle):
(WebKit::InjectedBundleCSSStyleDeclarationHandle::~InjectedBundleCSSStyleDeclarationHandle):
* WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h: Added.
* WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
(WebKit::InjectedBundlePageEditorClient::shouldApplyStyle):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIObjecth">trunk/Source/WebKit2/Shared/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleAPICasth">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleCSSStyleDeclarationHandlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleCSSStyleDeclarationHandleh">trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176848 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-05 18:23:52 UTC (rev 176848)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-12-05  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        WKBundleCSSStyleDeclarationRef needs to be a real API::Object
+        https://bugs.webkit.org/show_bug.cgi?id=139291
+
+        Reviewed by Dan Bernstein.
+
+        Change WKBundleCSSStyleDeclarationRef from being a WebCore::CSSStyleDeclaration, to
+        being a real API::Object.  WKRetain and WKRelease require this.
+
+        * Shared/APIObject.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp: Added.
+        (WebKit::domHandleCache):
+        (WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
+        (WebKit::InjectedBundleCSSStyleDeclarationHandle::InjectedBundleCSSStyleDeclarationHandle):
+        (WebKit::InjectedBundleCSSStyleDeclarationHandle::~InjectedBundleCSSStyleDeclarationHandle):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h: Added.
+        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
+        (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle):
+
</ins><span class="cx"> 2014-12-05  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Oops, didn't mean to commit this.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIObject.h (176848 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIObject.h        2014-12-05 18:23:52 UTC (rev 176848)
+++ trunk/Source/WebKit2/Shared/APIObject.h        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -141,6 +141,7 @@
</span><span class="cx">         Bundle,
</span><span class="cx">         BundleBackForwardList,
</span><span class="cx">         BundleBackForwardListItem,
</span><ins>+        BundleCSSStyleDeclarationHandle,
</ins><span class="cx">         BundleDOMWindowExtension,
</span><span class="cx">         BundleFrame,
</span><span class="cx">         BundleHitTestResult,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (176848 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-12-05 18:23:52 UTC (rev 176848)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -252,6 +252,7 @@
</span><span class="cx">                 1A4D664C18A3030E00D82E21 /* WKFrameInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4D664A18A3030E00D82E21 /* WKFrameInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 1A4D664E18A3031B00D82E21 /* WKFrameInfoInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4D664D18A3031B00D82E21 /* WKFrameInfoInternal.h */; };
</span><span class="cx">                 1A50DB66110A3D57000D3FE5 /* WebProcess.app in Copy Files */ = {isa = PBXBuildFile; fileRef = 1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */; };
</span><ins>+                1A53C2A21A323004004E8C70 /* InjectedBundleCSSStyleDeclarationHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */; };
</ins><span class="cx">                 1A5B1C501898606F004FCF9B /* WKNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */; };
</span><span class="cx">                 1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B1C4F1898606F004FCF9B /* WKNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 1A5B1C5418987EDF004FCF9B /* WebDocumentLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */; };
</span><span class="lines">@@ -1046,6 +1047,7 @@
</span><span class="cx">                 7C387434172F5615001BD88A /* PageBanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C387433172F5615001BD88A /* PageBanner.cpp */; };
</span><span class="cx">                 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
</span><span class="cx">                 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
</span><ins>+                7C4ED3291A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */; };
</ins><span class="cx">                 7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; };
</span><span class="cx">                 7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */; };
</span><span class="cx">                 7C85FD7C193415A8000177C4 /* WebPreferencesDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C85FD7B193415A8000177C4 /* WebPreferencesDefinitions.h */; };
</span><span class="lines">@@ -3119,6 +3121,8 @@
</span><span class="cx">                 7C387433172F5615001BD88A /* PageBanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBanner.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleCSSStyleDeclarationHandle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleCSSStyleDeclarationHandle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageBannerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C85FD7B193415A8000177C4 /* WebPreferencesDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesDefinitions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6393,6 +6397,8 @@
</span><span class="cx">                 BC4BEE96120A091700FBA0C7 /* DOM */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                7C4ED3261A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.cpp */,
+                                7C4ED3271A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h */,
</ins><span class="cx">                                 BC4BEEAA120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp */,
</span><span class="cx">                                 BC4BEEA9120A0A5E00FBA0C7 /* InjectedBundleNodeHandle.h */,
</span><span class="cx">                                 BC33E0D012408E8600360F3F /* InjectedBundleRangeHandle.cpp */,
</span><span class="lines">@@ -7094,6 +7100,7 @@
</span><span class="cx">                                 1AF459321946559500F9D4A2 /* WKError.h in Headers */,
</span><span class="cx">                                 E19BDA8A193686A400B97F57 /* SandboxUtilities.h in Headers */,
</span><span class="cx">                                 1A7284471959ED100007BCE5 /* SessionStateConversion.h in Headers */,
</span><ins>+                                7C4ED3291A3119D90079BD49 /* InjectedBundleCSSStyleDeclarationHandle.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -9122,6 +9129,7 @@
</span><span class="cx">                                 0F3C725C196F605200AEDD0C /* WKInspectorHighlightView.mm in Sources */,
</span><span class="cx">                                 1F7506AF1859162800EC0FF7 /* WKWebProcessPlugInNodeHandle.mm in Sources */,
</span><span class="cx">                                 51217460164C20E30037A5C1 /* ShareableResource.cpp in Sources */,
</span><ins>+                                1A53C2A21A323004004E8C70 /* InjectedBundleCSSStyleDeclarationHandle.cpp in Sources */,
</ins><span class="cx">                                 1A24BF3A120896A600FBB059 /* SharedMemoryMac.cpp in Sources */,
</span><span class="cx">                                 1A60224C18C16B9F00C3E8C9 /* VisitedLinkProviderMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 5272B28A1406985D0096A5D0 /* StatisticsData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundleAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h (176848 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h        2014-12-05 18:23:52 UTC (rev 176848)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -33,15 +33,12 @@
</span><span class="cx"> #include &lt;WebCore/EditorInsertAction.h&gt;
</span><span class="cx"> #include &lt;WebCore/TextAffinity.h&gt;
</span><span class="cx"> 
</span><del>-namespace WebCore {
-    class CSSStyleDeclaration;
-}
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class InjectedBundle;
</span><span class="cx"> class InjectedBundleBackForwardList;
</span><span class="cx"> class InjectedBundleBackForwardListItem;
</span><ins>+class InjectedBundleCSSStyleDeclarationHandle;
</ins><span class="cx"> class InjectedBundleDOMWindowExtension;
</span><span class="cx"> class InjectedBundleHitTestResult;
</span><span class="cx"> class InjectedBundleNavigationAction;
</span><span class="lines">@@ -57,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> WK_ADD_API_MAPPING(WKBundleBackForwardListItemRef, InjectedBundleBackForwardListItem)
</span><span class="cx"> WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList)
</span><del>-WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration)
</del><ins>+WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, InjectedBundleCSSStyleDeclarationHandle)
</ins><span class="cx"> WK_ADD_API_MAPPING(WKBundleDOMWindowExtensionRef, InjectedBundleDOMWindowExtension)
</span><span class="cx"> WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame)
</span><span class="cx"> WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleCSSStyleDeclarationHandlecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp (0 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;InjectedBundleCSSStyleDeclarationHandle.h&quot;
+
+#include &lt;WebCore/CSSStyleDeclaration.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+typedef HashMap&lt;CSSStyleDeclaration*, InjectedBundleCSSStyleDeclarationHandle*&gt; DOMHandleCache;
+
+static DOMHandleCache&amp; domHandleCache()
+{
+    static NeverDestroyed&lt;DOMHandleCache&gt; cache;
+    return cache;
+}
+
+PassRefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt; InjectedBundleCSSStyleDeclarationHandle::getOrCreate(CSSStyleDeclaration* styleDeclaration)
+{
+    if (!styleDeclaration)
+        return nullptr;
+
+    DOMHandleCache::AddResult result = domHandleCache().add(styleDeclaration, nullptr);
+    if (!result.isNewEntry)
+        return PassRefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt;(result.iterator-&gt;value);
+
+    RefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt; styleDeclarationHandle = adoptRef(new InjectedBundleCSSStyleDeclarationHandle(*styleDeclaration));
+    result.iterator-&gt;value = styleDeclarationHandle.get();
+    return styleDeclarationHandle.release();
+}
+
+InjectedBundleCSSStyleDeclarationHandle::InjectedBundleCSSStyleDeclarationHandle(CSSStyleDeclaration&amp; styleDeclaration)
+    : m_styleDeclaration(styleDeclaration)
+{
+}
+
+InjectedBundleCSSStyleDeclarationHandle::~InjectedBundleCSSStyleDeclarationHandle()
+{
+    domHandleCache().remove(m_styleDeclaration.ptr());
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleDOMInjectedBundleCSSStyleDeclarationHandleh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h (0 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -0,0 +1,52 @@
</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 InjectedBundleCSSStyleDeclarationHandle_h
+#define InjectedBundleCSSStyleDeclarationHandle_h
+
+#include &quot;APIObject.h&quot;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/Ref.h&gt;
+
+namespace WebCore {
+class CSSStyleDeclaration;
+}
+
+namespace WebKit {
+
+class InjectedBundleCSSStyleDeclarationHandle : public API::ObjectImpl&lt;API::Object::Type::BundleCSSStyleDeclarationHandle&gt; {
+public:
+    static PassRefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt; getOrCreate(WebCore::CSSStyleDeclaration*);
+    virtual ~InjectedBundleCSSStyleDeclarationHandle();
+
+private:
+    InjectedBundleCSSStyleDeclarationHandle(WebCore::CSSStyleDeclaration&amp;);
+
+    Ref&lt;WebCore::CSSStyleDeclaration&gt; m_styleDeclaration;
+};
+
+} // namespace WebKit
+
+#endif // InjectedBundleCSSStyleDeclarationHandle_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp (176848 => 176849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp        2014-12-05 18:23:52 UTC (rev 176848)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp        2014-12-05 18:30:14 UTC (rev 176849)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIArray.h&quot;
</span><span class="cx"> #include &quot;APIData.h&quot;
</span><ins>+#include &quot;InjectedBundleCSSStyleDeclarationHandle.h&quot;
</ins><span class="cx"> #include &quot;InjectedBundleNodeHandle.h&quot;
</span><span class="cx"> #include &quot;InjectedBundleRangeHandle.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="lines">@@ -98,8 +99,9 @@
</span><span class="cx"> bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage* page, CSSStyleDeclaration* style, Range* range)
</span><span class="cx"> {
</span><span class="cx">     if (m_client.shouldApplyStyle) {
</span><ins>+        RefPtr&lt;InjectedBundleCSSStyleDeclarationHandle&gt; styleHandle = InjectedBundleCSSStyleDeclarationHandle::getOrCreate(style);
</ins><span class="cx">         RefPtr&lt;InjectedBundleRangeHandle&gt; rangeHandle = InjectedBundleRangeHandle::getOrCreate(range);
</span><del>-        return m_client.shouldApplyStyle(toAPI(page), toAPI(style), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</del><ins>+        return m_client.shouldApplyStyle(toAPI(page), toAPI(styleHandle.get()), toAPI(rangeHandle.get()), m_client.base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>