<!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>[186685] 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/186685">186685</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-10 13:34:30 -0700 (Fri, 10 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cleanup: WebCore::Pair class should use RefPtr&& instead of PassRefPtr
https://bugs.webkit.org/show_bug.cgi?id=146852
Reviewed by Anders Carlsson.
* css/CSSParser.cpp:
(WebCore::createPrimitiveValuePair): Write using a variadic template that forwards its
arguments to the appropriate Pair::create constructor.
(WebCore::CSSParser::parse4ValuesFillPosition): Use RefPtr&& instead of PassRefPtr.
(WebCore::CSSParser::parse3ValuesFillPosition): Ditto.
(WebCore::CSSParser::parseFillPosition): Use WTF::move() instead of RefPtr::release()
so that we pass a rvalue reference to RefPtr.
(WebCore::CSSParser::parseFillSize): Ditto.
(WebCore::CSSParser::parseBorderImageRepeat): Ditto.
* css/CSSParser.h:
* css/Pair.h:
(WebCore::Pair::create): Use RefPtr&& instead of PassRefPtr.
(WebCore::Pair::setFirst): Ditto.
(WebCore::Pair::setSecond): Ditto.
(WebCore::Pair::Pair): Ditto. Also substitute nullptr for 0 in the member initialization
list of the default constructor.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssPairh">trunk/Source/WebCore/css/Pair.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186684 => 186685)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-10 20:19:52 UTC (rev 186684)
+++ trunk/Source/WebCore/ChangeLog        2015-07-10 20:34:30 UTC (rev 186685)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-07-10 Daniel Bates <dabates@apple.com>
+
+ Cleanup: WebCore::Pair class should use RefPtr&& instead of PassRefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=146852
+
+ Reviewed by Anders Carlsson.
+
+ * css/CSSParser.cpp:
+ (WebCore::createPrimitiveValuePair): Write using a variadic template that forwards its
+ arguments to the appropriate Pair::create constructor.
+ (WebCore::CSSParser::parse4ValuesFillPosition): Use RefPtr&& instead of PassRefPtr.
+ (WebCore::CSSParser::parse3ValuesFillPosition): Ditto.
+ (WebCore::CSSParser::parseFillPosition): Use WTF::move() instead of RefPtr::release()
+ so that we pass a rvalue reference to RefPtr.
+ (WebCore::CSSParser::parseFillSize): Ditto.
+ (WebCore::CSSParser::parseBorderImageRepeat): Ditto.
+ * css/CSSParser.h:
+ * css/Pair.h:
+ (WebCore::Pair::create): Use RefPtr&& instead of PassRefPtr.
+ (WebCore::Pair::setFirst): Ditto.
+ (WebCore::Pair::setSecond): Ditto.
+ (WebCore::Pair::Pair): Ditto. Also substitute nullptr for 0 in the member initialization
+ list of the default constructor.
+
</ins><span class="cx"> 2015-07-10 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Crash at WebCore::WebPage::innerFrameQuad.
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (186684 => 186685)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2015-07-10 20:19:52 UTC (rev 186684)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2015-07-10 20:34:30 UTC (rev 186685)
</span><span class="lines">@@ -199,9 +199,10 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static Ref<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
</del><ins>+template<typename... Args>
+static Ref<CSSPrimitiveValue> createPrimitiveValuePair(Args&&... args)
</ins><span class="cx"> {
</span><del>- return cssValuePool().createValue(Pair::create(first, second));
</del><ins>+ return cssValuePool().createValue(Pair::create(std::forward<Args>(args)...));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class AnimationParseContext {
</span><span class="lines">@@ -4311,7 +4312,7 @@
</span><span class="cx"> return value == CSSValueLeft || value == CSSValueTop || value == CSSValueBottom || value == CSSValueRight || value == CSSValueCenter;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CSSParser::parse4ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
</del><ins>+void CSSParser::parse4ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, RefPtr<CSSPrimitiveValue>&& parsedValue1, RefPtr<CSSPrimitiveValue>&& parsedValue2)
</ins><span class="cx"> {
</span><span class="cx"> // [ left | right ] [ <percentage] | <length> ] && [ top | bottom ] [ <percentage> | <length> ]
</span><span class="cx"> // In the case of 4 values <position> requires the second value to be a length or a percentage.
</span><span class="lines">@@ -4351,15 +4352,15 @@
</span><span class="cx"> if (isFillPositionKeyword(value4->getValueID()))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- value1 = createPrimitiveValuePair(parsedValue1, parsedValue2);
- value2 = createPrimitiveValuePair(value3, value4);
</del><ins>+ value1 = createPrimitiveValuePair(WTF::move(parsedValue1), WTF::move(parsedValue2));
+ value2 = createPrimitiveValuePair(value3.copyRef(), value4.copyRef());
</ins><span class="cx">
</span><span class="cx"> if (ident1 == CSSValueTop || ident1 == CSSValueBottom)
</span><span class="cx"> value1.swap(value2);
</span><span class="cx">
</span><span class="cx"> valueList.next();
</span><span class="cx"> }
</span><del>-void CSSParser::parse3ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, PassRefPtr<CSSPrimitiveValue> parsedValue1, PassRefPtr<CSSPrimitiveValue> parsedValue2)
</del><ins>+void CSSParser::parse3ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2, RefPtr<CSSPrimitiveValue>&& parsedValue1, RefPtr<CSSPrimitiveValue>&& parsedValue2)
</ins><span class="cx"> {
</span><span class="cx"> unsigned cumulativeFlags = 0;
</span><span class="cx"> FillPositionFlag value3Flag = InvalidFillPosition;
</span><span class="lines">@@ -4394,7 +4395,7 @@
</span><span class="cx"> swapNeeded = true;
</span><span class="cx"> }
</span><span class="cx"> value1 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(firstPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE));
</span><del>- value2 = createPrimitiveValuePair(parsedValue2, value3);
</del><ins>+ value2 = createPrimitiveValuePair(WTF::move(parsedValue2), value3.copyRef());
</ins><span class="cx"> } else if (ident3 == CSSValueCenter) {
</span><span class="cx"> if (isFillPositionKeyword(ident2))
</span><span class="cx"> return;
</span><span class="lines">@@ -4404,7 +4405,7 @@
</span><span class="cx"> secondPositionKeyword = CSSValueLeft;
</span><span class="cx"> swapNeeded = true;
</span><span class="cx"> }
</span><del>- value1 = createPrimitiveValuePair(parsedValue1, parsedValue2);
</del><ins>+ value1 = createPrimitiveValuePair(WTF::move(parsedValue1), parsedValue2.copyRef());
</ins><span class="cx"> value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE));
</span><span class="cx"> } else {
</span><span class="cx"> RefPtr<CSSPrimitiveValue> firstPositionValue;
</span><span class="lines">@@ -4433,8 +4434,8 @@
</span><span class="cx"> if (isValueConflictingWithCurrentEdge(ident1, secondPositionKeyword))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- value1 = createPrimitiveValuePair(parsedValue1, firstPositionValue);
- value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), secondPositionValue);
</del><ins>+ value1 = createPrimitiveValuePair(WTF::move(parsedValue1), firstPositionValue.copyRef());
+ value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), secondPositionValue.copyRef());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (ident1 == CSSValueTop || ident1 == CSSValueBottom || swapNeeded)
</span><span class="lines">@@ -4516,9 +4517,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (numberOfValues == 3)
</span><del>- parse3ValuesFillPosition(valueList, value1, value2, parsedValue1.release(), parsedValue2.release());
</del><ins>+ parse3ValuesFillPosition(valueList, value1, value2, WTF::move(parsedValue1), WTF::move(parsedValue2));
</ins><span class="cx"> else
</span><del>- parse4ValuesFillPosition(valueList, value1, value2, parsedValue1.release(), parsedValue2.release());
</del><ins>+ parse4ValuesFillPosition(valueList, value1, value2, WTF::move(parsedValue1), WTF::move(parsedValue2));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSParser::parse2ValuesFillPosition(CSSParserValueList& valueList, RefPtr<CSSValue>& value1, RefPtr<CSSValue>& value2)
</span><span class="lines">@@ -4648,7 +4649,7 @@
</span><span class="cx">
</span><span class="cx"> if (!parsedValue2)
</span><span class="cx"> return parsedValue1;
</span><del>- return createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release());
</del><ins>+ return createPrimitiveValuePair(WTF::move(parsedValue1), WTF::move(parsedValue2));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool CSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
</span><span class="lines">@@ -8060,7 +8061,7 @@
</span><span class="cx"> } else
</span><span class="cx"> secondValue = firstValue;
</span><span class="cx">
</span><del>- result = createPrimitiveValuePair(firstValue, secondValue);
</del><ins>+ result = createPrimitiveValuePair(WTF::move(firstValue), WTF::move(secondValue));
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (186684 => 186685)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2015-07-10 20:19:52 UTC (rev 186684)
+++ trunk/Source/WebCore/css/CSSParser.h        2015-07-10 20:34:30 UTC (rev 186685)
</span><span class="lines">@@ -167,8 +167,8 @@
</span><span class="cx"> void parse2ValuesFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
</span><span class="cx"> bool isPotentialPositionValue(CSSParserValue&);
</span><span class="cx"> void parseFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
</span><del>- void parse3ValuesFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&, PassRefPtr<CSSPrimitiveValue>, PassRefPtr<CSSPrimitiveValue>);
- void parse4ValuesFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&, PassRefPtr<CSSPrimitiveValue>, PassRefPtr<CSSPrimitiveValue>);
</del><ins>+ void parse3ValuesFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSPrimitiveValue>&&, RefPtr<CSSPrimitiveValue>&&);
+ void parse4ValuesFillPosition(CSSParserValueList&, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSPrimitiveValue>&&, RefPtr<CSSPrimitiveValue>&&);
</ins><span class="cx">
</span><span class="cx"> void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
</span><span class="cx"> PassRefPtr<CSSValue> parseFillSize(CSSPropertyID, bool &allowComma);
</span></span></pre></div>
<a id="trunkSourceWebCorecssPairh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/Pair.h (186684 => 186685)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/Pair.h        2015-07-10 20:19:52 UTC (rev 186684)
+++ trunk/Source/WebCore/css/Pair.h        2015-07-10 20:34:30 UTC (rev 186685)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * (C) 1999-2003 Lars Knoll (knoll@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006 Apple Inc.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2015 Apple Inc.
</ins><span class="cx"> *
</span><span class="cx"> * This library is free software; you can redistribute it and/or
</span><span class="cx"> * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -38,17 +38,17 @@
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new Pair);
</span><span class="cx"> }
</span><del>- static Ref<Pair> create(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
</del><ins>+ static Ref<Pair> create(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new Pair(first, second));
</del><ins>+ return adoptRef(*new Pair(WTF::move(first), WTF::move(second)));
</ins><span class="cx"> }
</span><span class="cx"> virtual ~Pair() { }
</span><span class="cx">
</span><span class="cx"> CSSPrimitiveValue* first() const { return m_first.get(); }
</span><span class="cx"> CSSPrimitiveValue* second() const { return m_second.get(); }
</span><span class="cx">
</span><del>- void setFirst(PassRefPtr<CSSPrimitiveValue> first) { m_first = first; }
- void setSecond(PassRefPtr<CSSPrimitiveValue> second) { m_second = second; }
</del><ins>+ void setFirst(RefPtr<CSSPrimitiveValue>&& first) { m_first = WTF::move(first); }
+ void setSecond(RefPtr<CSSPrimitiveValue>&& second) { m_second = WTF::move(second); }
</ins><span class="cx">
</span><span class="cx"> String cssText() const
</span><span class="cx"> {
</span><span class="lines">@@ -59,9 +59,8 @@
</span><span class="cx"> bool equals(const Pair& other) const { return compareCSSValuePtr(m_first, other.m_first) && compareCSSValuePtr(m_second, other.m_second); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- Pair() : m_first(0), m_second(0) { }
- Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
- : m_first(first), m_second(second) { }
</del><ins>+ Pair() : m_first(nullptr), m_second(nullptr) { }
+ Pair(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second) : m_first(WTF::move(first)), m_second(WTF::move(second)) { }
</ins><span class="cx">
</span><span class="cx"> static String generateCSSString(const String& first, const String& second)
</span><span class="cx"> {
</span></span></pre>
</div>
</div>
</body>
</html>