<!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>[38458] trunk/WebCore</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/38458">38458</a></dd>
<dt>Author</dt> <dd>bolsinga@apple.com</dd>
<dt>Date</dt> <dd>2008-11-16 17:05:20 -0800 (Sun, 16 Nov 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=21810
        Remove use of static C++ objects that are destroyed at exit time (destructors)

        Use DEFINE_STATIC_LOCAL for static RetainPtr&lt;T&gt;, RefPtr&lt;T&gt;. Add additional
        uses of DEFINE_STATIC_LOCAL where appropriate.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorehtmlHTMLTableElementcpp">trunk/WebCore/html/HTMLTableElement.cpp</a></li>
<li><a href="#trunkWebCoreloaderCachedImagecpp">trunk/WebCore/loader/CachedImage.cpp</a></li>
<li><a href="#trunkWebCoreloaderFTPDirectoryDocumentcpp">trunk/WebCore/loader/FTPDirectoryDocument.cpp</a></li>
<li><a href="#trunkWebCoreloadericonIconDatabasecpp">trunk/WebCore/loader/icon/IconDatabase.cpp</a></li>
<li><a href="#trunkWebCorepageAccessibilityObjectcpp">trunk/WebCore/page/AccessibilityObject.cpp</a></li>
<li><a href="#trunkWebCorepageAccessibilityRenderObjectcpp">trunk/WebCore/page/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkWebCorepagemacEventHandlerMacmm">trunk/WebCore/page/mac/EventHandlerMac.mm</a></li>
<li><a href="#trunkWebCoreplatformScrollViewcpp">trunk/WebCore/platform/ScrollView.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicsImagecpp">trunk/WebCore/platform/graphics/Image.cpp</a></li>
<li><a href="#trunkWebCoreplatformgraphicsmacColorMacmm">trunk/WebCore/platform/graphics/mac/ColorMac.mm</a></li>
<li><a href="#trunkWebCoreplatformgraphicsmacFontCacheMacmm">trunk/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkWebCoreplatformgraphicsmacGraphicsContextMacmm">trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm</a></li>
<li><a href="#trunkWebCoreplatformgraphicsmacSimpleFontDataMacmm">trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm</a></li>
<li><a href="#trunkWebCoreplatformmacPasteboardMacmm">trunk/WebCore/platform/mac/PasteboardMac.mm</a></li>
<li><a href="#trunkWebCorerenderingRenderLayercpp">trunk/WebCore/rendering/RenderLayer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/ChangeLog        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2008-11-16  Greg Bolsinga  &lt;bolsinga@apple.com&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21810
+        Remove use of static C++ objects that are destroyed at exit time (destructors)
+
+        Use DEFINE_STATIC_LOCAL for static RetainPtr&lt;T&gt;, RefPtr&lt;T&gt;. Add additional
+        uses of DEFINE_STATIC_LOCAL where appropriate.
+
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::addSharedCellBordersDecl): new the AtomicStrings
+        * loader/CachedImage.cpp:
+        (WebCore::brokenImage):
+        (WebCore::nullImage):
+        * loader/FTPDirectoryDocument.cpp:
+        (WebCore::_createTemplateDocumentData): Created so accessor has one line initialization
+        (WebCore::FTPDirectoryTokenizer::loadDocumentTemplate):
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::loadDefaultIconRecord):
+        * page/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::actionVerb):
+        * page/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::actionVerb):
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::currentEvent):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::paint):
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::nullImage):
+        * platform/graphics/mac/ColorMac.mm:
+        (WebCore::nsColor):
+        * platform/graphics/mac/FontCacheMac.mm: new the Strings
+        (WebCore::FontCache::getSimilarFontPlatformData):
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::_createPatternColor): Created so accessor has one line initialization
+        (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar):
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::webFallbackFontFamily):
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::writableTypesForURL):
+        (WebCore::createWritableTypesForImage): Created so accessor has one line initialization
+        (WebCore::writableTypesForImage):
+        (WebCore::stripAttachmentCharacters):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintResizer):
+
</ins><span class="cx"> 2008-11-16  Holger Hans Peter Freyther  &lt;zecke@selfish.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLTableElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLTableElement.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLTableElement.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/html/HTMLTableElement.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -520,8 +520,8 @@
</span><span class="cx"> {
</span><span class="cx">     CellBorders borders = cellBorders();
</span><span class="cx"> 
</span><del>-    static const AtomicString cellBorderNames[] = { &quot;none&quot;, &quot;solid&quot;, &quot;inset&quot;, &quot;solid-cols&quot;, &quot;solid-rows&quot; };
-    const AtomicString&amp; cellborderValue = cellBorderNames[borders];
</del><ins>+    static const AtomicString* cellBorderNames[] = { new AtomicString(&quot;none&quot;), new AtomicString(&quot;solid&quot;), new AtomicString(&quot;inset&quot;), new AtomicString(&quot;solid-cols&quot;), new AtomicString(&quot;solid-rows&quot;) };
+    const AtomicString&amp; cellborderValue = *cellBorderNames[borders];
</ins><span class="cx">     CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(ePersistent, cellborderAttr, cellborderValue);
</span><span class="cx">     if (!decl) {
</span><span class="cx">         decl = CSSMappedAttributeDeclaration::create().releaseRef(); // This single ref pins us in the table until the document dies.
</span><span class="lines">@@ -565,7 +565,7 @@
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        setMappedAttributeDecl(ePersistent, cellborderAttr, cellBorderNames[borders], decl);
</del><ins>+        setMappedAttributeDecl(ePersistent, cellborderAttr, *cellBorderNames[borders], decl);
</ins><span class="cx">         decl-&gt;setParent(0);
</span><span class="cx">         decl-&gt;setNode(0);
</span><span class="cx">         decl-&gt;setMappedState(ePersistent, cellborderAttr, cellborderValue);
</span></span></pre></div>
<a id="trunkWebCoreloaderCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/loader/CachedImage.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/loader/CachedImage.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/loader/CachedImage.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include &quot;Request.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;SystemTime.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(CG)
</span><span class="lines">@@ -107,15 +108,13 @@
</span><span class="cx"> 
</span><span class="cx"> static Image* brokenImage()
</span><span class="cx"> {
</span><del>-    static RefPtr&lt;Image&gt; brokenImage;
-    if (!brokenImage)
-        brokenImage = Image::loadPlatformResource(&quot;missingImage&quot;);
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;Image&gt;, brokenImage, (Image::loadPlatformResource(&quot;missingImage&quot;)));
</ins><span class="cx">     return brokenImage.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Image* nullImage()
</span><span class="cx"> {
</span><del>-    static RefPtr&lt;BitmapImage&gt; nullImage = BitmapImage::create();
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;BitmapImage&gt;, nullImage, (BitmapImage::create()));
</ins><span class="cx">     return nullImage.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreloaderFTPDirectoryDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/loader/FTPDirectoryDocument.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/loader/FTPDirectoryDocument.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/loader/FTPDirectoryDocument.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(QT)
</span><span class="cx"> #include &lt;QDateTime&gt;
</span><span class="lines">@@ -323,20 +324,22 @@
</span><span class="cx">     appendEntry(filename, processFilesizeString(result.fileSize, result.type == FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == FTPDirectoryEntry);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline SharedBuffer* createTemplateDocumentData(Settings* settings)
+{
+    SharedBuffer* buffer = 0;
+    if (settings)
+        buffer = SharedBuffer::createWithContentsOfFile(settings-&gt;ftpDirectoryTemplatePath()).releaseRef();
+    if (buffer)
+        LOG(FTP, &quot;Loaded FTPDirectoryTemplate of length %i\n&quot;, templateDocumentData-&gt;size());
+    return buffer;
+}
+    
</ins><span class="cx"> bool FTPDirectoryTokenizer::loadDocumentTemplate()
</span><span class="cx"> {
</span><del>-    static RefPtr&lt;SharedBuffer&gt; templateDocumentData;
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;SharedBuffer&gt;, templateDocumentData, (createTemplateDocumentData(m_doc-&gt;settings())));
</ins><span class="cx">     // FIXME: Instead of storing the data, we'd rather actually parse the template data into the template Document once,
</span><span class="cx">     // store that document, then &quot;copy&quot; it whenever we get an FTP directory listing.  There are complexities with this 
</span><span class="cx">     // approach that make it worth putting this off.
</span><del>-
-    if (!templateDocumentData) {
-        Settings* settings = m_doc-&gt;settings();
-        if (settings)
-            templateDocumentData = SharedBuffer::createWithContentsOfFile(settings-&gt;ftpDirectoryTemplatePath());
-        if (templateDocumentData)
-            LOG(FTP, &quot;Loaded FTPDirectoryTemplate of length %i\n&quot;, templateDocumentData-&gt;size());
-    }
</del><span class="cx">     
</span><span class="cx">     if (!templateDocumentData) {
</span><span class="cx">         LOG_ERROR(&quot;Could not load templateData&quot;);
</span></span></pre></div>
<a id="trunkWebCoreloadericonIconDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/loader/icon/IconDatabase.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/loader/icon/IconDatabase.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/loader/icon/IconDatabase.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -381,7 +381,7 @@
</span><span class="cx">         0x00, 0x00, 0x01, 0x52, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0A, 
</span><span class="cx">         0xFC, 0x80, 0x00, 0x00, 0x27, 0x10, 0x00, 0x0A, 0xFC, 0x80, 0x00, 0x00, 0x27, 0x10 };
</span><span class="cx">         
</span><del>-    static RefPtr&lt;SharedBuffer&gt; defaultIconBuffer(SharedBuffer::create(defaultIconData, sizeof(defaultIconData)));
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;SharedBuffer&gt;, defaultIconBuffer, (SharedBuffer::create(defaultIconData, sizeof(defaultIconData))));
</ins><span class="cx">     defaultIconRecord-&gt;setImageData(defaultIconBuffer);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityObject.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityObject.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/page/AccessibilityObject.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include &quot;TextIterator.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> #include &quot;visible_units.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace std;
</span><span class="cx"> 
</span><span class="lines">@@ -1001,13 +1002,13 @@
</span><span class="cx"> const String&amp; AccessibilityObject::actionVerb() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Need to add verbs for select elements.
</span><del>-    static const String buttonAction = AXButtonActionVerb();
-    static const String textFieldAction = AXTextFieldActionVerb();
-    static const String radioButtonAction = AXRadioButtonActionVerb();
-    static const String checkedCheckBoxAction = AXCheckedCheckBoxActionVerb();
-    static const String uncheckedCheckBoxAction = AXUncheckedCheckBoxActionVerb();
-    static const String linkAction = AXLinkActionVerb();
-    static const String noAction;
</del><ins>+    DEFINE_STATIC_LOCAL(const String, buttonAction, (AXButtonActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, textFieldAction, (AXTextFieldActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, radioButtonAction, (AXRadioButtonActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, checkedCheckBoxAction, (AXCheckedCheckBoxActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, uncheckedCheckBoxAction, (AXUncheckedCheckBoxActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, linkAction, (AXLinkActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, noAction, ());
</ins><span class="cx"> 
</span><span class="cx">     switch (roleValue()) {
</span><span class="cx">         case ButtonRole:
</span></span></pre></div>
<a id="trunkWebCorepageAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/AccessibilityRenderObject.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/AccessibilityRenderObject.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/page/AccessibilityRenderObject.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> #include &quot;TextIterator.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> #include &quot;visible_units.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using namespace std;
</span><span class="cx"> 
</span><span class="lines">@@ -2351,13 +2352,13 @@
</span><span class="cx"> const String&amp; AccessibilityRenderObject::actionVerb() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Need to add verbs for select elements.
</span><del>-    static const String buttonAction = AXButtonActionVerb();
-    static const String textFieldAction = AXTextFieldActionVerb();
-    static const String radioButtonAction = AXRadioButtonActionVerb();
-    static const String checkedCheckBoxAction = AXCheckedCheckBoxActionVerb();
-    static const String uncheckedCheckBoxAction = AXUncheckedCheckBoxActionVerb();
-    static const String linkAction = AXLinkActionVerb();
-    static const String noAction;
</del><ins>+    DEFINE_STATIC_LOCAL(const String, buttonAction, (AXButtonActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, textFieldAction, (AXTextFieldActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, radioButtonAction, (AXRadioButtonActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, checkedCheckBoxAction, (AXCheckedCheckBoxActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, uncheckedCheckBoxAction, (AXUncheckedCheckBoxActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, linkAction, (AXLinkActionVerb()));
+    DEFINE_STATIC_LOCAL(const String, noAction, ());
</ins><span class="cx">     
</span><span class="cx">     switch (roleValue()) {
</span><span class="cx">         case ButtonRole:
</span></span></pre></div>
<a id="trunkWebCorepagemacEventHandlerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/mac/EventHandlerMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/mac/EventHandlerMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/page/mac/EventHandlerMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;RenderWidget.h&quot;
</span><span class="cx"> #include &quot;Scrollbar.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -50,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> static RetainPtr&lt;NSEvent&gt;&amp; currentEvent()
</span><span class="cx"> {
</span><del>-    static RetainPtr&lt;NSEvent&gt; event;
</del><ins>+    DEFINE_STATIC_LOCAL(RetainPtr&lt;NSEvent&gt;, event, ());
</ins><span class="cx">     return event;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreplatformScrollViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/ScrollView.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/ScrollView.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/ScrollView.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;PlatformWheelEvent.h&quot;
</span><span class="cx"> #include &quot;Scrollbar.h&quot;
</span><span class="cx"> #include &quot;ScrollbarTheme.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> using std::max;
</span><span class="cx"> 
</span><span class="lines">@@ -668,10 +669,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Paint the panScroll Icon
</span><del>-    static RefPtr&lt;Image&gt; panScrollIcon;
</del><span class="cx">     if (m_drawPanScrollIcon) {
</span><del>-        if (!panScrollIcon)
-            panScrollIcon = Image::loadPlatformResource(&quot;panIcon&quot;);
</del><ins>+        DEFINE_STATIC_LOCAL(RefPtr&lt;Image&gt;, panScrollIcon, (Image::loadPlatformResource(&quot;panIcon&quot;)));
</ins><span class="cx">         context-&gt;drawImage(panScrollIcon.get(), m_panScrollIconPoint);
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/Image.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/Image.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/graphics/Image.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &quot;GraphicsContext.h&quot;
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><span class="cx"> #include &quot;MIMETypeRegistry.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;math.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -52,7 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> Image* Image::nullImage()
</span><span class="cx"> {
</span><del>-    static RefPtr&lt;Image&gt; nullImage = BitmapImage::create();
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;Image&gt;, nullImage, (BitmapImage::create()));;
</ins><span class="cx">     return nullImage.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsmacColorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/mac/ColorMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/mac/ColorMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/graphics/mac/ColorMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #import &quot;ColorMac.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><ins>+#import &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @interface WebCoreControlTintObserver : NSObject
</span><span class="lines">@@ -59,21 +60,21 @@
</span><span class="cx">     switch (c) {
</span><span class="cx">         case 0: {
</span><span class="cx">             // Need this to avoid returning nil because cachedRGBAValues will default to 0.
</span><del>-            static RetainPtr&lt;NSColor&gt; clearColor = [NSColor clearColor];
</del><ins>+            DEFINE_STATIC_LOCAL(RetainPtr&lt;NSColor&gt;, clearColor, ([NSColor clearColor]));
</ins><span class="cx">             return clearColor.get();
</span><span class="cx">         }
</span><span class="cx">         case Color::black: {
</span><del>-            static RetainPtr&lt;NSColor&gt; blackColor = [NSColor blackColor];
</del><ins>+            DEFINE_STATIC_LOCAL(RetainPtr&lt;NSColor&gt;, blackColor, ([NSColor blackColor]));
</ins><span class="cx">             return blackColor.get();
</span><span class="cx">         }
</span><span class="cx">         case Color::white: {
</span><del>-            static RetainPtr&lt;NSColor&gt; whiteColor = [NSColor whiteColor];
</del><ins>+            DEFINE_STATIC_LOCAL(RetainPtr&lt;NSColor&gt;, whiteColor, ([NSColor whiteColor]));
</ins><span class="cx">             return whiteColor.get();
</span><span class="cx">         }
</span><span class="cx">         default: {
</span><span class="cx">             const int cacheSize = 32;
</span><span class="cx">             static unsigned cachedRGBAValues[cacheSize];
</span><del>-            static RetainPtr&lt;NSColor&gt; cachedColors[cacheSize];
</del><ins>+            static RetainPtr&lt;NSColor&gt;* cachedColors = new RetainPtr&lt;NSColor&gt;[cacheSize];
</ins><span class="cx"> 
</span><span class="cx">             for (int i = 0; i != cacheSize; ++i)
</span><span class="cx">                 if (cachedRGBAValues[i] == c)
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/mac/FontCacheMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/mac/FontCacheMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/graphics/mac/FontCacheMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -140,10 +140,10 @@
</span><span class="cx">     const FontFamily* currFamily = &amp;font.fontDescription().family();
</span><span class="cx">     while (currFamily &amp;&amp; !platformData) {
</span><span class="cx">         if (currFamily-&gt;family().length()) {
</span><del>-            static String matchWords[3] = { String(&quot;Arabic&quot;), String(&quot;Pashto&quot;), String(&quot;Urdu&quot;) };
</del><ins>+            static String* matchWords[3] = { new String(&quot;Arabic&quot;), new String(&quot;Pashto&quot;), new String(&quot;Urdu&quot;) };
</ins><span class="cx">             DEFINE_STATIC_LOCAL(AtomicString, geezaStr, (&quot;Geeza Pro&quot;));
</span><span class="cx">             for (int j = 0; j &lt; 3 &amp;&amp; !platformData; ++j)
</span><del>-                if (currFamily-&gt;family().contains(matchWords[j], false))
</del><ins>+                if (currFamily-&gt;family().contains(*matchWords[j], false))
</ins><span class="cx">                     platformData = getCachedFontPlatformData(font.fontDescription(), geezaStr);
</span><span class="cx">         }
</span><span class="cx">         currFamily = currFamily-&gt;next();
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsmacGraphicsContextMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/graphics/mac/GraphicsContextMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #import &quot;GraphicsContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;../cg/GraphicsContextPlatformPrivateCG.h&quot;
</span><ins>+#import &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -80,53 +81,42 @@
</span><span class="cx">     [pool drain];
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><del>- 
</del><ins>+
+static NSColor* createPatternColor(NSString* name, NSColor* defaultColor, bool&amp; usingDot)
+{
+    NSImage *image = [NSImage imageNamed:name];
+    ASSERT(image); // if image is not available, we want to know
+    NSColor *color = (image ? [NSColor colorWithPatternImage:image] : nil);
+    if (color)
+        usingDot = true;
+    else
+        color = defaultColor;
+    return color;
+}
+    
</ins><span class="cx"> void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint&amp; point, int width, bool grammar)
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx">         
</span><del>-    // Constants for spelling pattern color
-    static RetainPtr&lt;NSColor&gt; spellingPatternColor = nil;
-    static bool usingDotForSpelling = false;
-
-    // Constants for grammar pattern color
-    static RetainPtr&lt;NSColor&gt; grammarPatternColor = nil;
-    static bool usingDotForGrammar = false;
-    
</del><span class="cx">     // These are the same for misspelling or bad grammar
</span><span class="cx">     int patternHeight = cMisspellingLineThickness;
</span><span class="cx">     int patternWidth = cMisspellingLinePatternWidth;
</span><span class="cx">  
</span><del>-    // Initialize pattern color if needed
-    if (!grammar &amp;&amp; !spellingPatternColor) {
-        NSImage *image = [NSImage imageNamed:@&quot;SpellingDot&quot;];
-        ASSERT(image); // if image is not available, we want to know
-        NSColor *color = (image ? [NSColor colorWithPatternImage:image] : nil);
-        if (color)
-            usingDotForSpelling = true;
-        else
-            color = [NSColor redColor];
-        spellingPatternColor = color;
-    }
-    
-    if (grammar &amp;&amp; !grammarPatternColor) {
-        NSImage *image = [NSImage imageNamed:@&quot;GrammarDot&quot;];
-        ASSERT(image); // if image is not available, we want to know
-        NSColor *color = (image ? [NSColor colorWithPatternImage:image] : nil);
-        if (color)
-            usingDotForGrammar = true;
-        else
-            color = [NSColor greenColor];
-        grammarPatternColor = color;
-    }
-    
</del><span class="cx">     bool usingDot;
</span><span class="cx">     NSColor *patternColor;
</span><span class="cx">     if (grammar) {
</span><ins>+        // Constants for grammar pattern color
+        static bool usingDotForGrammar = false;
+        DEFINE_STATIC_LOCAL(RetainPtr&lt;NSColor&gt;, grammarPatternColor, (createPatternColor(@&quot;GrammarDot&quot;, [NSColor greenColor], usingDotForGrammar)));
+        
</ins><span class="cx">         usingDot = usingDotForGrammar;
</span><span class="cx">         patternColor = grammarPatternColor.get();
</span><span class="cx">     } else {
</span><ins>+        // Constants for spelling pattern color
+        static bool usingDotForSpelling = false;
+        DEFINE_STATIC_LOCAL(RetainPtr&lt;NSColor&gt;, spellingPatternColor, (createPatternColor(@&quot;SpellingDot&quot;, [NSColor redColor], usingDotForSpelling)));
+        
</ins><span class="cx">         usingDot = usingDotForSpelling;
</span><span class="cx">         patternColor = spellingPatternColor.get();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkWebCoreplatformgraphicsmacSimpleFontDataMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #import &lt;float.h&gt;
</span><span class="cx"> #import &lt;unicode/uchar.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><ins>+#import &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @interface NSFont (WebAppKitSecretAPI)
</span><span class="lines">@@ -92,9 +93,7 @@
</span><span class="cx"> 
</span><span class="cx"> static NSString *webFallbackFontFamily(void)
</span><span class="cx"> {
</span><del>-    static RetainPtr&lt;NSString&gt; webFallbackFontFamily = nil;
-    if (!webFallbackFontFamily)
-        webFallbackFontFamily = [[NSFont systemFontOfSize:16.0f] familyName];
</del><ins>+    DEFINE_STATIC_LOCAL(RetainPtr&lt;NSString&gt;, webFallbackFontFamily, ([[NSFont systemFontOfSize:16.0f] familyName]));
</ins><span class="cx">     return webFallbackFontFamily.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCoreplatformmacPasteboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/platform/mac/PasteboardMac.mm (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/platform/mac/PasteboardMac.mm        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/platform/mac/PasteboardMac.mm        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #import &quot;WebCoreNSStringExtras.h&quot;
</span><span class="cx"> #import &quot;markup.h&quot;
</span><span class="cx"> 
</span><ins>+#import &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @interface NSAttributedString (AppKitSecretsIKnowAbout)
</span><span class="lines">@@ -78,27 +79,27 @@
</span><span class="cx"> 
</span><span class="cx"> static NSArray* writableTypesForURL()
</span><span class="cx"> {
</span><del>-    static RetainPtr&lt;NSArray&gt; types = nil;
-    if (!types) {
-        types = [[NSArray alloc] initWithObjects:
</del><ins>+    DEFINE_STATIC_LOCAL(RetainPtr&lt;NSArray&gt;, types, ([[NSArray alloc] initWithObjects:
</ins><span class="cx">             WebURLsWithTitlesPboardType,
</span><span class="cx">             NSURLPboardType,
</span><span class="cx">             WebURLPboardType,
</span><span class="cx">             WebURLNamePboardType,
</span><span class="cx">             NSStringPboardType,
</span><del>-            nil];
-    }
</del><ins>+            nil]));
</ins><span class="cx">     return types.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline NSArray* createWritableTypesForImage()
+{
+    NSMutableArray *types = [[NSMutableArray alloc] initWithObjects:NSTIFFPboardType, nil];
+    [types addObjectsFromArray:writableTypesForURL()];
+    [types addObject:NSRTFDPboardType];
+    return types;
+}
+
</ins><span class="cx"> static NSArray* writableTypesForImage()
</span><span class="cx"> {
</span><del>-    static RetainPtr&lt;NSMutableArray&gt; types = nil;
-    if (!types) {
-        types = [[NSMutableArray alloc] initWithObjects:NSTIFFPboardType, nil];
-        [types.get() addObjectsFromArray:writableTypesForURL()];
-        [types.get() addObject:NSRTFDPboardType];
-    }
</del><ins>+    DEFINE_STATIC_LOCAL(RetainPtr&lt;NSArray&gt;, types, (createWritableTypesForImage()));
</ins><span class="cx">     return types.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -121,7 +122,7 @@
</span><span class="cx"> static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string)
</span><span class="cx"> {
</span><span class="cx">     const unichar attachmentCharacter = NSAttachmentCharacter;
</span><del>-    static RetainPtr&lt;NSString&gt; attachmentCharacterString = [NSString stringWithCharacters:&amp;attachmentCharacter length:1];
</del><ins>+    DEFINE_STATIC_LOCAL(RetainPtr&lt;NSString&gt;, attachmentCharacterString, ([NSString stringWithCharacters:&amp;attachmentCharacter length:1]));
</ins><span class="cx">     NSMutableAttributedString *result = [[string mutableCopy] autorelease];
</span><span class="cx">     NSRange attachmentRange = [[result string] rangeOfString:attachmentCharacterString.get()];
</span><span class="cx">     while (attachmentRange.location != NSNotFound) {
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderLayer.cpp (38457 => 38458)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderLayer.cpp        2008-11-16 23:07:46 UTC (rev 38457)
+++ trunk/WebCore/rendering/RenderLayer.cpp        2008-11-17 01:05:20 UTC (rev 38458)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> #include &quot;ScrollbarTheme.h&quot;
</span><span class="cx"> #include &quot;SelectionController.h&quot;
</span><span class="cx"> #include &quot;TranslateTransformOperation.h&quot;
</span><ins>+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(SVG)
</span><span class="cx"> #include &quot;SVGNames.h&quot;
</span><span class="lines">@@ -1518,9 +1519,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Paint the resizer control.
</span><del>-    static RefPtr&lt;Image&gt; resizeCornerImage;
-    if (!resizeCornerImage)
-        resizeCornerImage = Image::loadPlatformResource(&quot;textAreaResizeCorner&quot;);
</del><ins>+    DEFINE_STATIC_LOCAL(RefPtr&lt;Image&gt;, resizeCornerImage, (Image::loadPlatformResource(&quot;textAreaResizeCorner&quot;)));
</ins><span class="cx">     IntPoint imagePoint(absRect.right() - resizeCornerImage-&gt;width(), absRect.bottom() - resizeCornerImage-&gt;height());
</span><span class="cx">     context-&gt;drawImage(resizeCornerImage.get(), imagePoint);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>