Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: Source/core/xml/XPathValue.cpp

Issue 344553002: Fix style erros in XPath-related files. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xml/XPathValue.h ('k') | Source/core/xml/XPathVariableReference.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XPathValue.cpp
diff --git a/Source/core/xml/XPathValue.cpp b/Source/core/xml/XPathValue.cpp
index bcd39b9c43d75f876fca53325a8c6e8a98e933f9..751323ef511611f55365477f20127fbb8a28e8f8 100644
--- a/Source/core/xml/XPathValue.cpp
+++ b/Source/core/xml/XPathValue.cpp
@@ -27,18 +27,16 @@
#include "config.h"
#include "core/xml/XPathValue.h"
-#include <limits>
#include "core/xml/XPathExpressionNode.h"
#include "core/xml/XPathUtil.h"
#include "wtf/MathExtras.h"
#include "wtf/StdLibExtras.h"
-
-using std::numeric_limits;
+#include <limits>
namespace WebCore {
namespace XPath {
-const Value::AdoptTag Value::adopt = {};
+const Value::AdoptTag Value::adopt = { };
void ValueData::trace(Visitor* visitor)
{
@@ -78,14 +76,14 @@ NodeSet& Value::modifiableNodeSet()
bool Value::toBoolean() const
{
switch (m_type) {
- case NodeSetValue:
- return !m_data->nodeSet().isEmpty();
- case BooleanValue:
- return m_bool;
- case NumberValue:
- return m_number && !std::isnan(m_number);
- case StringValue:
- return !m_data->m_string.isEmpty();
+ case NodeSetValue:
+ return !m_data->nodeSet().isEmpty();
+ case BooleanValue:
+ return m_bool;
+ case NumberValue:
+ return m_number && !std::isnan(m_number);
+ case StringValue:
+ return !m_data->m_string.isEmpty();
}
ASSERT_NOT_REACHED();
return false;
@@ -94,29 +92,30 @@ bool Value::toBoolean() const
double Value::toNumber() const
{
switch (m_type) {
- case NodeSetValue:
- return Value(toString()).toNumber();
- case NumberValue:
- return m_number;
- case StringValue: {
- const String& str = m_data->m_string.simplifyWhiteSpace();
-
- // String::toDouble() supports exponential notation, which is not allowed in XPath.
- unsigned len = str.length();
- for (unsigned i = 0; i < len; ++i) {
- UChar c = str[i];
- if (!isASCIIDigit(c) && c != '.' && c != '-')
- return numeric_limits<double>::quiet_NaN();
- }
-
- bool canConvert;
- double value = str.toDouble(&canConvert);
- if (canConvert)
- return value;
- return numeric_limits<double>::quiet_NaN();
+ case NodeSetValue:
+ return Value(toString()).toNumber();
+ case NumberValue:
+ return m_number;
+ case StringValue: {
+ const String& str = m_data->m_string.simplifyWhiteSpace();
+
+ // String::toDouble() supports exponential notation, which is not
+ // allowed in XPath.
+ unsigned len = str.length();
+ for (unsigned i = 0; i < len; ++i) {
+ UChar c = str[i];
+ if (!isASCIIDigit(c) && c != '.' && c != '-')
+ return std::numeric_limits<double>::quiet_NaN();
}
- case BooleanValue:
- return m_bool;
+
+ bool canConvert;
+ double value = str.toDouble(&canConvert);
+ if (canConvert)
+ return value;
+ return std::numeric_limits<double>::quiet_NaN();
+ }
+ case BooleanValue:
+ return m_bool;
}
ASSERT_NOT_REACHED();
return 0.0;
@@ -125,22 +124,22 @@ double Value::toNumber() const
String Value::toString() const
{
switch (m_type) {
- case NodeSetValue:
- if (m_data->nodeSet().isEmpty())
- return "";
- return stringValue(m_data->nodeSet().firstNode());
- case StringValue:
- return m_data->m_string;
- case NumberValue:
- if (std::isnan(m_number))
- return "NaN";
- if (m_number == 0)
- return "0";
- if (std::isinf(m_number))
- return std::signbit(m_number) ? "-Infinity" : "Infinity";
- return String::number(m_number);
- case BooleanValue:
- return m_bool ? "true" : "false";
+ case NodeSetValue:
+ if (m_data->nodeSet().isEmpty())
+ return "";
+ return stringValue(m_data->nodeSet().firstNode());
+ case StringValue:
+ return m_data->m_string;
+ case NumberValue:
+ if (std::isnan(m_number))
+ return "NaN";
+ if (m_number == 0)
+ return "0";
+ if (std::isinf(m_number))
+ return std::signbit(m_number) ? "-Infinity" : "Infinity";
+ return String::number(m_number);
+ case BooleanValue:
+ return m_bool ? "true" : "false";
}
ASSERT_NOT_REACHED();
return String();
« no previous file with comments | « Source/core/xml/XPathValue.h ('k') | Source/core/xml/XPathVariableReference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698