<!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>[182224] trunk/Source/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/182224">182224</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-04-01 00:24:00 -0700 (Wed, 01 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>nullptr cleanup in StyleResolver
https://bugs.webkit.org/show_bug.cgi?id=143260

Patch by Joonghun Park &lt;jh718.park@samsung.com&gt; on 2015-04-01
Reviewed by Ryosuke Niwa.

No new tests, no behavior changes

* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::initForStyleResolve):
(WebCore::StyleResolver::locateCousinList):
(WebCore::StyleResolver::locateSharedStyle):
(WebCore::StyleResolver::keyframeStylesForAnimation):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::pseudoStyleRulesForElement):
(WebCore::StyleResolver::findFromMatchedPropertiesCache):
(WebCore::StyleResolver::applyMatchedProperties):
(WebCore::StyleResolver::applyPropertyToStyle):
(WebCore::StyleResolver::MatchedProperties::MatchedProperties):
* css/StyleResolver.h:
(WebCore::PseudoStyleRequest::PseudoStyleRequest):
(WebCore::StyleResolverParentPusher::StyleResolverParentPusher):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182223 => 182224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-01 07:07:12 UTC (rev 182223)
+++ trunk/Source/WebCore/ChangeLog        2015-04-01 07:24:00 UTC (rev 182224)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-04-01  Joonghun Park  &lt;jh718.park@samsung.com&gt;
+
+        nullptr cleanup in StyleResolver
+        https://bugs.webkit.org/show_bug.cgi?id=143260
+
+        Reviewed by Ryosuke Niwa.
+
+        No new tests, no behavior changes
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::initForStyleResolve):
+        (WebCore::StyleResolver::locateCousinList):
+        (WebCore::StyleResolver::locateSharedStyle):
+        (WebCore::StyleResolver::keyframeStylesForAnimation):
+        (WebCore::StyleResolver::pseudoStyleForElement):
+        (WebCore::StyleResolver::pseudoStyleRulesForElement):
+        (WebCore::StyleResolver::findFromMatchedPropertiesCache):
+        (WebCore::StyleResolver::applyMatchedProperties):
+        (WebCore::StyleResolver::applyPropertyToStyle):
+        (WebCore::StyleResolver::MatchedProperties::MatchedProperties):
+        * css/StyleResolver.h:
+        (WebCore::PseudoStyleRequest::PseudoStyleRequest):
+        (WebCore::StyleResolverParentPusher::StyleResolverParentPusher):
+
</ins><span class="cx"> 2015-03-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make it possible to compute a region for elements on the page that have wheel event handlers
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (182223 => 182224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2015-04-01 07:07:12 UTC (rev 182223)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2015-04-01 07:24:00 UTC (rev 182224)
</span><span class="lines">@@ -446,7 +446,7 @@
</span><span class="cx">     } else
</span><span class="cx">         m_parentStyle = parentStyle;
</span><span class="cx"> 
</span><del>-    Node* docElement = e ? e-&gt;document().documentElement() : 0;
</del><ins>+    Node* docElement = e ? e-&gt;document().documentElement() : nullptr;
</ins><span class="cx">     RenderStyle* docStyle = document.renderStyle();
</span><span class="cx">     m_rootElementStyle = docElement &amp;&amp; e != docElement ? docElement-&gt;renderStyle() : docStyle;
</span><span class="cx"> 
</span><span class="lines">@@ -506,14 +506,14 @@
</span><span class="cx">                 return currentNode-&gt;lastChild();
</span><span class="cx">             }
</span><span class="cx">             if (subcount &gt;= cStyleSearchThreshold)
</span><del>-                return 0;
</del><ins>+                return nullptr;
</ins><span class="cx">             currentNode = currentNode-&gt;previousSibling();
</span><span class="cx">         }
</span><span class="cx">         currentNode = locateCousinList(thisCousin-&gt;parentElement(), visitedNodeCount);
</span><span class="cx">         thisCousin = currentNode;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool StyleResolver::styleSharingCandidateMatchesRuleSet(RuleSet* ruleSet)
</span><span class="lines">@@ -735,7 +735,7 @@
</span><span class="cx">     // Check previous siblings and their cousins.
</span><span class="cx">     unsigned count = 0;
</span><span class="cx">     unsigned visitedNodeCount = 0;
</span><del>-    StyledElement* shareElement = 0;
</del><ins>+    StyledElement* shareElement = nullptr;
</ins><span class="cx">     Node* cousinList = state.styledElement()-&gt;previousSibling();
</span><span class="cx">     while (cousinList) {
</span><span class="cx">         shareElement = findSiblingForStyleSharing(cousinList, count);
</span><span class="lines">@@ -921,7 +921,7 @@
</span><span class="cx"> 
</span><span class="cx">         const StyleKeyframe* keyframe = keyframes[i].get();
</span><span class="cx"> 
</span><del>-        KeyframeValue keyframeValue(0, 0);
</del><ins>+        KeyframeValue keyframeValue(0, nullptr);
</ins><span class="cx">         keyframeValue.setStyle(styleForKeyframe(elementStyle, keyframe, keyframeValue));
</span><span class="cx"> 
</span><span class="cx">         // Add this keyframe style to all the indicated key times
</span><span class="lines">@@ -939,7 +939,7 @@
</span><span class="cx">             zeroPercentKeyframe = StyleKeyframe::create(MutableStyleProperties::create()).leakRef();
</span><span class="cx">             zeroPercentKeyframe-&gt;setKeyText(&quot;0%&quot;);
</span><span class="cx">         }
</span><del>-        KeyframeValue keyframeValue(0, 0);
</del><ins>+        KeyframeValue keyframeValue(0, nullptr);
</ins><span class="cx">         keyframeValue.setStyle(styleForKeyframe(elementStyle, zeroPercentKeyframe, keyframeValue));
</span><span class="cx">         list.insert(keyframeValue);
</span><span class="cx">     }
</span><span class="lines">@@ -951,7 +951,7 @@
</span><span class="cx">             hundredPercentKeyframe = StyleKeyframe::create(MutableStyleProperties::create()).leakRef();
</span><span class="cx">             hundredPercentKeyframe-&gt;setKeyText(&quot;100%&quot;);
</span><span class="cx">         }
</span><del>-        KeyframeValue keyframeValue(1, 0);
</del><ins>+        KeyframeValue keyframeValue(1, nullptr);
</ins><span class="cx">         keyframeValue.setStyle(styleForKeyframe(elementStyle, hundredPercentKeyframe, keyframeValue));
</span><span class="cx">         list.insert(keyframeValue);
</span><span class="cx">     }
</span><span class="lines">@@ -961,7 +961,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(parentStyle);
</span><span class="cx">     if (!element)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     State&amp; state = m_state;
</span><span class="cx"> 
</span><span class="lines">@@ -992,14 +992,14 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (collector.matchedResult().matchedProperties().isEmpty())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     state.style()-&gt;setStyleType(pseudoStyleRequest.pseudoId);
</span><span class="cx"> 
</span><span class="cx">     applyMatchedProperties(collector.matchedResult(), element);
</span><span class="cx"> 
</span><span class="cx">     // Clean up our style object's display and text decorations (among other fixups).
</span><del>-    adjustRenderStyle(*state.style(), *m_state.parentStyle(), 0);
</del><ins>+    adjustRenderStyle(*state.style(), *m_state.parentStyle(), nullptr);
</ins><span class="cx"> 
</span><span class="cx">     if (state.style()-&gt;hasViewportUnits())
</span><span class="cx">         document().setHasStyleWithViewportUnits();
</span><span class="lines">@@ -1503,7 +1503,7 @@
</span><span class="cx">         return Vector&lt;RefPtr&lt;StyleRule&gt;&gt;();
</span><span class="cx"> 
</span><span class="cx">     initElement(element);
</span><del>-    m_state.initForStyleResolve(document(), element, 0);
</del><ins>+    m_state.initForStyleResolve(document(), element, nullptr);
</ins><span class="cx"> 
</span><span class="cx">     ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_selectorFilter);
</span><span class="cx">     collector.setMode(SelectorChecker::Mode::CollectingRules);
</span><span class="lines">@@ -1616,18 +1616,18 @@
</span><span class="cx"> 
</span><span class="cx">     MatchedPropertiesCache::iterator it = m_matchedPropertiesCache.find(hash);
</span><span class="cx">     if (it == m_matchedPropertiesCache.end())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     MatchedPropertiesCacheItem&amp; cacheItem = it-&gt;value;
</span><span class="cx"> 
</span><span class="cx">     size_t size = matchResult.matchedProperties().size();
</span><span class="cx">     if (size != cacheItem.matchedProperties.size())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     for (size_t i = 0; i &lt; size; ++i) {
</span><span class="cx">         if (matchResult.matchedProperties()[i] != cacheItem.matchedProperties[i])
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">     }
</span><span class="cx">     if (cacheItem.ranges != matchResult.ranges)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     return &amp;cacheItem;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1725,7 +1725,7 @@
</span><span class="cx">     State&amp; state = m_state;
</span><span class="cx">     unsigned cacheHash = shouldUseMatchedPropertiesCache &amp;&amp; matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()) : 0;
</span><span class="cx">     bool applyInheritedOnly = false;
</span><del>-    const MatchedPropertiesCacheItem* cacheItem = 0;
</del><ins>+    const MatchedPropertiesCacheItem* cacheItem = nullptr;
</ins><span class="cx">     if (cacheHash &amp;&amp; (cacheItem = findFromMatchedPropertiesCache(cacheHash, matchResult))
</span><span class="cx">         &amp;&amp; isCacheableInMatchedPropertiesCache(element, state.style(), state.parentStyle())) {
</span><span class="cx">         // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
</span><span class="lines">@@ -1821,7 +1821,7 @@
</span><span class="cx"> 
</span><span class="cx"> void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, RenderStyle* style)
</span><span class="cx"> {
</span><del>-    initElement(0);
</del><ins>+    initElement(nullptr);
</ins><span class="cx">     m_state.initForStyleResolve(document(), nullptr, style);
</span><span class="cx">     m_state.setStyle(*style);
</span><span class="cx">     applyPropertyToCurrentStyle(id, value);
</span><span class="lines">@@ -2567,7 +2567,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline StyleResolver::MatchedProperties::MatchedProperties()
</span><del>-    : possiblyPaddedMember(0)
</del><ins>+    : possiblyPaddedMember(nullptr)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (182223 => 182224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2015-04-01 07:07:12 UTC (rev 182223)
+++ trunk/Source/WebCore/css/StyleResolver.h        2015-04-01 07:24:00 UTC (rev 182224)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> 
</span><span class="cx"> class PseudoStyleRequest {
</span><span class="cx"> public:
</span><del>-    PseudoStyleRequest(PseudoId pseudoId, RenderScrollbar* scrollbar = 0, ScrollbarPart scrollbarPart = NoPart)
</del><ins>+    PseudoStyleRequest(PseudoId pseudoId, RenderScrollbar* scrollbar = nullptr, ScrollbarPart scrollbarPart = NoPart)
</ins><span class="cx">         : pseudoId(pseudoId)
</span><span class="cx">         , scrollbarPart(scrollbarPart)
</span><span class="cx">         , scrollbar(scrollbar)
</span><span class="lines">@@ -576,7 +576,7 @@
</span><span class="cx"> public:
</span><span class="cx">     StyleResolverParentPusher(Element* parent)
</span><span class="cx">         : m_parent(parent)
</span><del>-        , m_pushedStyleResolver(0)
</del><ins>+        , m_pushedStyleResolver(nullptr)
</ins><span class="cx">     { }
</span><span class="cx">     void push()
</span><span class="cx">     {
</span></span></pre>
</div>
</div>

</body>
</html>