Title: [142894] trunk/Source/WTF
- Revision
- 142894
- Author
- [email protected]
- Date
- 2013-02-14 11:17:12 -0800 (Thu, 14 Feb 2013)
Log Message
String(Vector) behaves differently from String(vector.data(), vector.size()) for vectors with inline capacity in the size=0 case
https://bugs.webkit.org/show_bug.cgi?id=109784
Reviewed by Darin Adler.
This makes String(Vector) never return null strings.
Which matches behavior of String(UChar*, size_t)
for vectors with inlineCapacity, but differs from
String(UChar*, size_t) in the no-inlineCapacity case.
This incidentally will fix a behavioral regression
in the html threaded parser which came from converting
many String(UChar*, size_t) callsites to using String(Vector).
* wtf/text/WTFString.h:
(String):
(WTF::String::String):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (142893 => 142894)
--- trunk/Source/WTF/ChangeLog 2013-02-14 19:09:41 UTC (rev 142893)
+++ trunk/Source/WTF/ChangeLog 2013-02-14 19:17:12 UTC (rev 142894)
@@ -1,5 +1,25 @@
2013-02-14 Eric Seidel <[email protected]>
+ String(Vector) behaves differently from String(vector.data(), vector.size()) for vectors with inline capacity in the size=0 case
+ https://bugs.webkit.org/show_bug.cgi?id=109784
+
+ Reviewed by Darin Adler.
+
+ This makes String(Vector) never return null strings.
+ Which matches behavior of String(UChar*, size_t)
+ for vectors with inlineCapacity, but differs from
+ String(UChar*, size_t) in the no-inlineCapacity case.
+
+ This incidentally will fix a behavioral regression
+ in the html threaded parser which came from converting
+ many String(UChar*, size_t) callsites to using String(Vector).
+
+ * wtf/text/WTFString.h:
+ (String):
+ (WTF::String::String):
+
+2013-02-14 Eric Seidel <[email protected]>
+
REGRESSION(r142712): attribute values show up as "(null)" instead of null with the threaded parser
https://bugs.webkit.org/show_bug.cgi?id=109784
Modified: trunk/Source/WTF/wtf/text/WTFString.h (142893 => 142894)
--- trunk/Source/WTF/wtf/text/WTFString.h 2013-02-14 19:09:41 UTC (rev 142893)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2013-02-14 19:17:12 UTC (rev 142894)
@@ -110,9 +110,12 @@
// Construct a string by copying the contents of a vector. To avoid
// copying, consider using String::adopt instead.
- // CAUTION: Vectors with size 0 will return empty strings if they have inlineCapacity
- // and null strings if they don't. This is due to https://bugs.webkit.org/show_bug.cgi?id=109792
- // and is done to match String(UChar*, size_t) behavior.
+ // This method will never create a null string. Vectors with size() == 0
+ // will return the empty string.
+ // NOTE: This is different from String(vector.data(), vector.size())
+ // which will sometimes return a null string when vector.data() is null
+ // which can only occur for vectors without inline capacity.
+ // See: https://bugs.webkit.org/show_bug.cgi?id=109792
template<size_t inlineCapacity>
explicit String(const Vector<UChar, inlineCapacity>&);
@@ -538,7 +541,7 @@
template<size_t inlineCapacity>
String::String(const Vector<UChar, inlineCapacity>& vector)
- : m_impl(vector.data() ? StringImpl::create(vector.data(), vector.size()) : 0)
+ : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) : StringImpl::empty())
{
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes