<!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>[163439] 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/163439">163439</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2014-02-05 03:19:54 -0800 (Wed, 05 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Manage CalcExpressionNode and derived classes through std::unique_ptr instead of OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=128118
Reviewed by Darin Adler.
Replace uses of OwnPtr for CalcExpressionNode and derived classes with std::unique_ptr.
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcPrimitiveValue::toCalcValue):
(WebCore::CSSCalcBinaryOperation::toCalcValue):
* css/CSSCalculationValue.h:
* platform/CalculationValue.cpp:
(WebCore::CalculationValue::create):
* platform/CalculationValue.h:
(WebCore::CalculationValue::CalculationValue):
(WebCore::CalcExpressionBinaryOperation::CalcExpressionBinaryOperation):
* platform/Length.cpp:
(WebCore::Length::blendMixedTypes):
* rendering/style/BasicShapes.cpp:
(WebCore::BasicShapeCenterCoordinate::updateComputedLength):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSCalculationValuecpp">trunk/Source/WebCore/css/CSSCalculationValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSCalculationValueh">trunk/Source/WebCore/css/CSSCalculationValue.h</a></li>
<li><a href="#trunkSourceWebCoreplatformCalculationValuecpp">trunk/Source/WebCore/platform/CalculationValue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformCalculationValueh">trunk/Source/WebCore/platform/CalculationValue.h</a></li>
<li><a href="#trunkSourceWebCoreplatformLengthcpp">trunk/Source/WebCore/platform/Length.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleBasicShapescpp">trunk/Source/WebCore/rendering/style/BasicShapes.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/ChangeLog        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2014-02-05 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><ins>+ Manage CalcExpressionNode and derived classes through std::unique_ptr instead of OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=128118
+
+ Reviewed by Darin Adler.
+
+ Replace uses of OwnPtr for CalcExpressionNode and derived classes with std::unique_ptr.
+
+ * css/CSSCalculationValue.cpp:
+ (WebCore::CSSCalcPrimitiveValue::toCalcValue):
+ (WebCore::CSSCalcBinaryOperation::toCalcValue):
+ * css/CSSCalculationValue.h:
+ * platform/CalculationValue.cpp:
+ (WebCore::CalculationValue::create):
+ * platform/CalculationValue.h:
+ (WebCore::CalculationValue::CalculationValue):
+ (WebCore::CalcExpressionBinaryOperation::CalcExpressionBinaryOperation):
+ * platform/Length.cpp:
+ (WebCore::Length::blendMixedTypes):
+ * rendering/style/BasicShapes.cpp:
+ (WebCore::BasicShapeCenterCoordinate::updateComputedLength):
+
+2014-02-05 Zan Dobersek <zdobersek@igalia.com>
+
</ins><span class="cx"> Remove CLASS_IF_GCC workarounds
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=128207
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCalculationValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCalculationValue.cpp (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCalculationValue.cpp        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/css/CSSCalculationValue.cpp        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -37,8 +37,6 @@
</span><span class="cx"> #include "StyleResolver.h"
</span><span class="cx">
</span><span class="cx"> #include <wtf/MathExtras.h>
</span><del>-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
</del><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="cx"> static const int maxExpressionDepth = 100;
</span><span class="lines">@@ -207,19 +205,18 @@
</span><span class="cx"> return m_value->cssText();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
</del><ins>+ virtual std::unique_ptr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
</ins><span class="cx"> {
</span><span class="cx"> switch (m_category) {
</span><span class="cx"> case CalcNumber:
</span><del>- return adoptPtr(new CalcExpressionNumber(m_value->getFloatValue()));
</del><ins>+ return std::make_unique<CalcExpressionNumber>(m_value->getFloatValue());
</ins><span class="cx"> case CalcLength:
</span><del>- return adoptPtr(new CalcExpressionNumber(m_value->computeLength<float>(style, rootStyle, zoom)));
</del><ins>+ return std::make_unique<CalcExpressionNumber>(m_value->computeLength<float>(style, rootStyle, zoom));
</ins><span class="cx"> case CalcPercent:
</span><span class="cx"> case CalcPercentLength: {
</span><span class="cx"> CSSPrimitiveValue* primitiveValue = m_value.get();
</span><del>- return adoptPtr(new CalcExpressionLength(primitiveValue
- ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion>(style, rootStyle, zoom)
- : Length(Undefined)));
</del><ins>+ return std::make_unique<CalcExpressionLength>(primitiveValue
+ ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion | FractionConversion>(style, rootStyle, zoom) : Length(Undefined));
</ins><span class="cx"> }
</span><span class="cx"> // Only types that could be part of a Length expression can be converted
</span><span class="cx"> // to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
</span><span class="lines">@@ -399,15 +396,15 @@
</span><span class="cx"> return !doubleValue();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
</del><ins>+ virtual std::unique_ptr<CalcExpressionNode> toCalcValue(const RenderStyle* style, const RenderStyle* rootStyle, double zoom) const
</ins><span class="cx"> {
</span><del>- OwnPtr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));
</del><ins>+ std::unique_ptr<CalcExpressionNode> left(m_leftSide->toCalcValue(style, rootStyle, zoom));
</ins><span class="cx"> if (!left)
</span><span class="cx"> return nullptr;
</span><del>- OwnPtr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
</del><ins>+ std::unique_ptr<CalcExpressionNode> right(m_rightSide->toCalcValue(style, rootStyle, zoom));
</ins><span class="cx"> if (!right)
</span><span class="cx"> return nullptr;
</span><del>- return adoptPtr(new CalcExpressionBinaryOperation(left.release(), right.release(), m_operator));
</del><ins>+ return std::make_unique<CalcExpressionBinaryOperation>(std::move(left), std::move(right), m_operator);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> virtual double doubleValue() const
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCalculationValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCalculationValue.h (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCalculationValue.h        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/css/CSSCalculationValue.h        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include "CSSPrimitiveValue.h"
</span><span class="cx"> #include "CSSValue.h"
</span><span class="cx"> #include "CalculationValue.h"
</span><del>-#include <wtf/PassOwnPtr.h>
</del><ins>+#include <memory>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx">
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">
</span><span class="cx"> virtual ~CSSCalcExpressionNode() = 0;
</span><span class="cx"> virtual bool isZero() const = 0;
</span><del>- virtual PassOwnPtr<CalcExpressionNode> toCalcValue(const RenderStyle*, const RenderStyle* rootStyle, double zoom = 1.0) const = 0;
</del><ins>+ virtual std::unique_ptr<CalcExpressionNode> toCalcValue(const RenderStyle*, const RenderStyle* rootStyle, double zoom = 1.0) const = 0;
</ins><span class="cx"> virtual double doubleValue() const = 0;
</span><span class="cx"> virtual double computeLengthPx(const RenderStyle* currentStyle, const RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false) const = 0;
</span><span class="cx"> virtual String customCSSText() const = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCalculationValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/CalculationValue.cpp (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/CalculationValue.cpp        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/platform/CalculationValue.cpp        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -55,9 +55,9 @@
</span><span class="cx"> return std::numeric_limits<float>::quiet_NaN();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<CalculationValue> CalculationValue::create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
</del><ins>+PassRefPtr<CalculationValue> CalculationValue::create(std::unique_ptr<CalcExpressionNode> value, CalculationPermittedValueRange range)
</ins><span class="cx"> {
</span><del>- return adoptRef(new CalculationValue(value, range));
</del><ins>+ return adoptRef(new CalculationValue(std::move(value), range));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> float CalculationValue::evaluate(float maxValue) const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCalculationValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/CalculationValue.h (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/CalculationValue.h        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/platform/CalculationValue.h        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -33,8 +33,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Length.h"
</span><span class="cx"> #include "LengthFunctions.h"
</span><del>-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
</del><ins>+#include <memory>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="lines">@@ -83,7 +82,7 @@
</span><span class="cx">
</span><span class="cx"> class CalculationValue : public RefCounted<CalculationValue> {
</span><span class="cx"> public:
</span><del>- static PassRefPtr<CalculationValue> create(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange);
</del><ins>+ static PassRefPtr<CalculationValue> create(std::unique_ptr<CalcExpressionNode> value, CalculationPermittedValueRange);
</ins><span class="cx"> float evaluate(float maxValue) const;
</span><span class="cx">
</span><span class="cx"> bool operator==(const CalculationValue& o) const
</span><span class="lines">@@ -95,13 +94,13 @@
</span><span class="cx"> const CalcExpressionNode* expression() const { return m_value.get(); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- CalculationValue(PassOwnPtr<CalcExpressionNode> value, CalculationPermittedValueRange range)
- : m_value(value)
</del><ins>+ CalculationValue(std::unique_ptr<CalcExpressionNode> value, CalculationPermittedValueRange range)
+ : m_value(std::move(value))
</ins><span class="cx"> , m_isNonNegative(range == CalculationRangeNonNegative)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- OwnPtr<CalcExpressionNode> m_value;
</del><ins>+ std::unique_ptr<CalcExpressionNode> m_value;
</ins><span class="cx"> bool m_isNonNegative;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -177,9 +176,9 @@
</span><span class="cx">
</span><span class="cx"> class CalcExpressionBinaryOperation : public CalcExpressionNode {
</span><span class="cx"> public:
</span><del>- CalcExpressionBinaryOperation(PassOwnPtr<CalcExpressionNode> leftSide, PassOwnPtr<CalcExpressionNode> rightSide, CalcOperator op)
- : m_leftSide(leftSide)
- , m_rightSide(rightSide)
</del><ins>+ CalcExpressionBinaryOperation(std::unique_ptr<CalcExpressionNode> leftSide, std::unique_ptr<CalcExpressionNode> rightSide, CalcOperator op)
+ : m_leftSide(std::move(leftSide))
+ , m_rightSide(std::move(rightSide))
</ins><span class="cx"> , m_operator(op)
</span><span class="cx"> {
</span><span class="cx"> m_type = CalcExpressionNodeBinaryOperation;
</span><span class="lines">@@ -202,8 +201,8 @@
</span><span class="cx"> CalcOperator getOperator() const { return m_operator; }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- OwnPtr<CalcExpressionNode> m_leftSide;
- OwnPtr<CalcExpressionNode> m_rightSide;
</del><ins>+ std::unique_ptr<CalcExpressionNode> m_leftSide;
+ std::unique_ptr<CalcExpressionNode> m_rightSide;
</ins><span class="cx"> CalcOperator m_operator;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLengthcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Length.cpp (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Length.cpp        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/platform/Length.cpp        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -223,8 +223,8 @@
</span><span class="cx"> if (progress >= 1.0)
</span><span class="cx"> return *this;
</span><span class="cx">
</span><del>- OwnPtr<CalcExpressionNode> blend = adoptPtr(new CalcExpressionBlendLength(from, *this, progress));
- return Length(CalculationValue::create(blend.release(), CalculationRangeAll));
</del><ins>+ auto blend = std::make_unique<CalcExpressionBlendLength>(from, *this, progress);
+ return Length(CalculationValue::create(std::move(blend), CalculationRangeAll));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<CalculationValue> Length::calculationValue() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleBasicShapescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/BasicShapes.cpp (163438 => 163439)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/BasicShapes.cpp        2014-02-05 11:11:46 UTC (rev 163438)
+++ trunk/Source/WebCore/rendering/style/BasicShapes.cpp        2014-02-05 11:19:54 UTC (rev 163439)
</span><span class="lines">@@ -51,10 +51,10 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- OwnPtr<CalcExpressionLength> lhs = adoptPtr(new CalcExpressionLength(Length(100, Percent)));
- OwnPtr<CalcExpressionLength> rhs = adoptPtr(new CalcExpressionLength(m_length));
- OwnPtr<CalcExpressionBinaryOperation> op = adoptPtr(new CalcExpressionBinaryOperation(lhs.release(), rhs.release(), CalcSubtract));
- m_computedLength = Length(CalculationValue::create(op.release(), CalculationRangeAll));
</del><ins>+ auto lhs = std::make_unique<CalcExpressionLength>(Length(100, Percent));
+ auto rhs = std::make_unique<CalcExpressionLength>(m_length);
+ auto op = std::make_unique<CalcExpressionBinaryOperation>(std::move(lhs), std::move(rhs), CalcSubtract);
+ m_computedLength = Length(CalculationValue::create(std::move(op), CalculationRangeAll));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool BasicShape::canBlend(const BasicShape* other) const
</span></span></pre>
</div>
</div>
</body>
</html>