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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h

Issue 1933183002: Move isEmptyValue and emptyValue to SVGCharacterData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h
index 88c419ef86bef50a9962599643dc7a1d29dc07e2..27d81c7665cd95cf17f82f7cbc1b4bfbf53746e9 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutAttributes.h
@@ -33,6 +33,15 @@ struct SVGCharacterData {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
SVGCharacterData();
+ static float emptyValue() { return std::numeric_limits<float>::quiet_NaN(); }
+ static bool isEmptyValue(float value) { return std::isnan(value); }
+
+ bool hasX() const { return !isEmptyValue(x); }
+ bool hasY() const { return !isEmptyValue(y); }
+ bool hasDx() const { return !isEmptyValue(dx); }
+ bool hasDy() const { return !isEmptyValue(dy); }
+ bool hasRotate() const { return !isEmptyValue(rotate); }
+
float x;
float y;
float dx;
@@ -63,11 +72,11 @@ private:
};
inline SVGCharacterData::SVGCharacterData()
- : x(SVGTextLayoutAttributes::emptyValue())
- , y(SVGTextLayoutAttributes::emptyValue())
- , dx(SVGTextLayoutAttributes::emptyValue())
- , dy(SVGTextLayoutAttributes::emptyValue())
- , rotate(SVGTextLayoutAttributes::emptyValue())
+ : x(emptyValue())
+ , y(emptyValue())
+ , dx(emptyValue())
+ , dy(emptyValue())
+ , rotate(emptyValue())
{
}

Powered by Google App Engine
This is Rietveld 408576698