summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/CMakeLists.txt2
-rw-r--r--Source/WebCore/platform/graphics/WOFFFileFormat.cpp8
-rw-r--r--Source/WebCore/platform/text/TextCodecUTF8.cpp156
-rw-r--r--Source/WebCore/platform/text/TextCodecUTF8.h19
-rw-r--r--Source/WebCore/platform/text/TextEncoding.h106
-rw-r--r--Source/WebCore/platform/text/TextEncodingRegistry.h30
-rw-r--r--Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h9
-rw-r--r--Source/WebCore/svg/properties/SVGListProperty.h10
-rw-r--r--Source/WebCore/svg/properties/SVGListPropertyTearOff.h4
-rw-r--r--Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h2
10 files changed, 173 insertions, 173 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index e1efb9991..02f9d3bf3 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -3353,7 +3353,7 @@ if (ENABLE_USER_MESSAGE_HANDLERS)
endif ()
if (USE_WOFF2)
- list(APPEND WebCore_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/woff2/src")
+ list(APPEND WebCore_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/woff2/include")
list(APPEND WebCore_LIBRARIES woff2)
endif ()
diff --git a/Source/WebCore/platform/graphics/WOFFFileFormat.cpp b/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
index c2323cf04..d8f4a5da7 100644
--- a/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
+++ b/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
@@ -31,8 +31,8 @@
#include <wtf/ByteOrder.h>
#if USE(WOFF2)
-#include "woff2_common.h"
-#include "woff2_dec.h"
+#include <woff2/decode.h>
+static const uint32_t kWoff2Signature = 0x774f4632; // "wOF2"
#endif
namespace WebCore {
@@ -84,7 +84,7 @@ bool isWOFF(SharedBuffer& buffer)
return false;
#if USE(WOFF2)
- return signature == woffSignature || signature == woff2::kWoff2Signature;
+ return signature == woffSignature || signature == kWoff2Signature;
#else
return signature == woffSignature;
#endif
@@ -140,7 +140,7 @@ bool convertWOFFToSfnt(SharedBuffer& woff, Vector<char>& sfnt)
}
#if USE(WOFF2)
- if (signature == woff2::kWoff2Signature) {
+ if (signature == kWoff2Signature) {
const uint8_t* woffData = reinterpret_cast_ptr<const uint8_t*>(woff.data());
const size_t woffSize = woff.size();
const size_t sfntSize = woff2::ComputeWOFF2FinalSize(woffData, woffSize);
diff --git a/Source/WebCore/platform/text/TextCodecUTF8.cpp b/Source/WebCore/platform/text/TextCodecUTF8.cpp
index 6b32955c1..31f548662 100644
--- a/Source/WebCore/platform/text/TextCodecUTF8.cpp
+++ b/Source/WebCore/platform/text/TextCodecUTF8.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,18 +31,10 @@
#include <wtf/text/StringBuffer.h>
#include <wtf/unicode/CharacterNames.h>
-using namespace WTF;
-using namespace WTF::Unicode;
-
namespace WebCore {
const int nonCharacter = -1;
-std::unique_ptr<TextCodec> TextCodecUTF8::create(const TextEncoding&, const void*)
-{
- return std::make_unique<TextCodecUTF8>();
-}
-
void TextCodecUTF8::registerEncodingNames(EncodingNameRegistrar registrar)
{
registrar("UTF-8", "UTF-8");
@@ -59,7 +51,9 @@ void TextCodecUTF8::registerEncodingNames(EncodingNameRegistrar registrar)
void TextCodecUTF8::registerCodecs(TextCodecRegistrar registrar)
{
- registrar("UTF-8", create, 0);
+ registrar("UTF-8", [] (const TextEncoding&, const void*) -> std::unique_ptr<TextCodec> {
+ return std::make_unique<TextCodecUTF8>();
+ }, nullptr);
}
static inline int nonASCIISequenceLength(uint8_t firstByte)
@@ -73,11 +67,11 @@ static inline int nonASCIISequenceLength(uint8_t firstByte)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@@ -85,55 +79,76 @@ static inline int nonASCIISequenceLength(uint8_t firstByte)
return lengths[firstByte];
}
-static inline int decodeNonASCIISequence(const uint8_t* sequence, unsigned length)
+static inline int decodeNonASCIISequence(const uint8_t* sequence, int& length)
{
ASSERT(!isASCII(sequence[0]));
if (length == 2) {
+ ASSERT(sequence[0] >= 0xC2);
ASSERT(sequence[0] <= 0xDF);
- if (sequence[0] < 0xC2)
- return nonCharacter;
- if (sequence[1] < 0x80 || sequence[1] > 0xBF)
+ if (sequence[1] < 0x80 || sequence[1] > 0xBF) {
+ length = 1;
return nonCharacter;
+ }
return ((sequence[0] << 6) + sequence[1]) - 0x00003080;
}
if (length == 3) {
- ASSERT(sequence[0] >= 0xE0 && sequence[0] <= 0xEF);
+ ASSERT(sequence[0] >= 0xE0);
+ ASSERT(sequence[0] <= 0xEF);
switch (sequence[0]) {
case 0xE0:
- if (sequence[1] < 0xA0 || sequence[1] > 0xBF)
+ if (sequence[1] < 0xA0 || sequence[1] > 0xBF) {
+ length = 1;
return nonCharacter;
+ }
break;
case 0xED:
- if (sequence[1] < 0x80 || sequence[1] > 0x9F)
+ if (sequence[1] < 0x80 || sequence[1] > 0x9F) {
+ length = 1;
return nonCharacter;
+ }
break;
default:
- if (sequence[1] < 0x80 || sequence[1] > 0xBF)
+ if (sequence[1] < 0x80 || sequence[1] > 0xBF) {
+ length = 1;
return nonCharacter;
+ }
}
- if (sequence[2] < 0x80 || sequence[2] > 0xBF)
+ if (sequence[2] < 0x80 || sequence[2] > 0xBF) {
+ length = 2;
return nonCharacter;
+ }
return ((sequence[0] << 12) + (sequence[1] << 6) + sequence[2]) - 0x000E2080;
}
ASSERT(length == 4);
- ASSERT(sequence[0] >= 0xF0 && sequence[0] <= 0xF4);
+ ASSERT(sequence[0] >= 0xF0);
+ ASSERT(sequence[0] <= 0xF4);
switch (sequence[0]) {
case 0xF0:
- if (sequence[1] < 0x90 || sequence[1] > 0xBF)
+ if (sequence[1] < 0x90 || sequence[1] > 0xBF) {
+ length = 1;
return nonCharacter;
+ }
break;
case 0xF4:
- if (sequence[1] < 0x80 || sequence[1] > 0x8F)
+ if (sequence[1] < 0x80 || sequence[1] > 0x8F) {
+ length = 1;
return nonCharacter;
+ }
break;
default:
- if (sequence[1] < 0x80 || sequence[1] > 0xBF)
+ if (sequence[1] < 0x80 || sequence[1] > 0xBF) {
+ length = 1;
return nonCharacter;
+ }
}
- if (sequence[2] < 0x80 || sequence[2] > 0xBF)
+ if (sequence[2] < 0x80 || sequence[2] > 0xBF) {
+ length = 2;
return nonCharacter;
- if (sequence[3] < 0x80 || sequence[3] > 0xBF)
+ }
+ if (sequence[3] < 0x80 || sequence[3] > 0xBF) {
+ length = 3;
return nonCharacter;
+ }
return ((sequence[0] << 18) + (sequence[1] << 12) + (sequence[2] << 6) + sequence[3]) - 0x03C82080;
}
@@ -156,18 +171,7 @@ void TextCodecUTF8::consumePartialSequenceByte()
memmove(m_partialSequence, m_partialSequence + 1, m_partialSequenceSize);
}
-void TextCodecUTF8::handleError(UChar*& destination, bool stopOnError, bool& sawError)
-{
- sawError = true;
- if (stopOnError)
- return;
- // Each error generates a replacement character and consumes one byte.
- *destination++ = replacementCharacter;
- consumePartialSequenceByte();
-}
-
-template <>
-bool TextCodecUTF8::handlePartialSequence<LChar>(LChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool, bool&)
+bool TextCodecUTF8::handlePartialSequence(LChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush)
{
ASSERT(m_partialSequenceSize);
do {
@@ -199,7 +203,7 @@ bool TextCodecUTF8::handlePartialSequence<LChar>(LChar*& destination, const uint
m_partialSequenceSize = count;
}
int character = decodeNonASCIISequence(m_partialSequence, count);
- if ((character == nonCharacter) || (character > 0xff))
+ if (character == nonCharacter || character > 0xFF)
return true;
m_partialSequenceSize -= count;
@@ -209,8 +213,7 @@ bool TextCodecUTF8::handlePartialSequence<LChar>(LChar*& destination, const uint
return false;
}
-template <>
-bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError)
+void TextCodecUTF8::handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError)
{
ASSERT(m_partialSequenceSize);
do {
@@ -221,9 +224,11 @@ bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint
}
int count = nonASCIISequenceLength(m_partialSequence[0]);
if (!count) {
- handleError(destination, stopOnError, sawError);
+ sawError = true;
if (stopOnError)
- return false;
+ return;
+ *destination++ = replacementCharacter;
+ consumePartialSequenceByte();
continue;
}
if (count > m_partialSequenceSize) {
@@ -233,12 +238,15 @@ bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint
// add it to the existing partial sequence.
memcpy(m_partialSequence + m_partialSequenceSize, source, end - source);
m_partialSequenceSize += end - source;
- return false;
+ return;
}
// An incomplete partial sequence at the end is an error.
- handleError(destination, stopOnError, sawError);
+ sawError = true;
if (stopOnError)
- return false;
+ return;
+ *destination++ = replacementCharacter;
+ m_partialSequenceSize = 0;
+ source = end;
continue;
}
memcpy(m_partialSequence + m_partialSequenceSize, source, count - m_partialSequenceSize);
@@ -247,17 +255,18 @@ bool TextCodecUTF8::handlePartialSequence<UChar>(UChar*& destination, const uint
}
int character = decodeNonASCIISequence(m_partialSequence, count);
if (character == nonCharacter) {
- handleError(destination, stopOnError, sawError);
+ sawError = true;
if (stopOnError)
- return false;
+ return;
+ *destination++ = replacementCharacter;
+ m_partialSequenceSize -= count;
+ memmove(m_partialSequence, m_partialSequence + count, m_partialSequenceSize);
continue;
}
m_partialSequenceSize -= count;
destination = appendCharacter(destination, character);
} while (m_partialSequenceSize);
-
- return false;
}
String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool stopOnError, bool& sawError)
@@ -269,7 +278,7 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool
const uint8_t* source = reinterpret_cast<const uint8_t*>(bytes);
const uint8_t* end = source + length;
- const uint8_t* alignedEnd = alignToMachineWord(end);
+ const uint8_t* alignedEnd = WTF::alignToMachineWord(end);
LChar* destination = buffer.characters();
do {
@@ -279,7 +288,7 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool
// in some compilers.
LChar* destinationForHandlePartialSequence = destination;
const uint8_t* sourceForHandlePartialSequence = source;
- if (handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush, stopOnError, sawError)) {
+ if (handlePartialSequence(destinationForHandlePartialSequence, sourceForHandlePartialSequence, end, flush)) {
source = sourceForHandlePartialSequence;
goto upConvertTo16Bit;
}
@@ -292,14 +301,14 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool
while (source < end) {
if (isASCII(*source)) {
// Fast path for ASCII. Most UTF-8 text will be ASCII.
- if (isAlignedToMachineWord(source)) {
+ if (WTF::isAlignedToMachineWord(source)) {
while (source < alignedEnd) {
- MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source);
- if (!isAllASCII<LChar>(chunk))
+ auto chunk = *reinterpret_cast_ptr<const WTF::MachineWord*>(source);
+ if (!WTF::isAllASCII<LChar>(chunk))
break;
copyASCIIMachineWord(destination, source);
- source += sizeof(MachineWord);
- destination += sizeof(MachineWord);
+ source += sizeof(WTF::MachineWord);
+ destination += sizeof(WTF::MachineWord);
}
if (source == end)
break;
@@ -328,10 +337,10 @@ String TextCodecUTF8::decode(const char* bytes, size_t length, bool flush, bool
sawError = true;
if (stopOnError)
break;
-
+
goto upConvertTo16Bit;
}
- if (character > 0xff)
+ if (character > 0xFF)
goto upConvertTo16Bit;
source += count;
@@ -369,14 +378,14 @@ upConvertTo16Bit:
while (source < end) {
if (isASCII(*source)) {
// Fast path for ASCII. Most UTF-8 text will be ASCII.
- if (isAlignedToMachineWord(source)) {
+ if (WTF::isAlignedToMachineWord(source)) {
while (source < alignedEnd) {
- MachineWord chunk = *reinterpret_cast_ptr<const MachineWord*>(source);
- if (!isAllASCII<LChar>(chunk))
+ auto chunk = *reinterpret_cast_ptr<const WTF::MachineWord*>(source);
+ if (!WTF::isAllASCII<LChar>(chunk))
break;
copyASCIIMachineWord(destination16, source);
- source += sizeof(MachineWord);
- destination16 += sizeof(MachineWord);
+ source += sizeof(WTF::MachineWord);
+ destination16 += sizeof(WTF::MachineWord);
}
if (source == end)
break;
@@ -405,9 +414,8 @@ upConvertTo16Bit:
sawError = true;
if (stopOnError)
break;
- // Each error generates a replacement character and consumes one byte.
*destination16++ = replacementCharacter;
- ++source;
+ source += count ? count : 1;
continue;
}
source += count;
@@ -427,17 +435,15 @@ CString TextCodecUTF8::encode(const UChar* characters, size_t length, Unencodabl
// Non-BMP characters take two UTF-16 code units and can take up to 4 bytes (2x).
if (length > std::numeric_limits<size_t>::max() / 3)
CRASH();
- Vector<uint8_t> bytes(length * 3);
- size_t i = 0;
+ Vector<char, 3000> bytes(length * 3);
size_t bytesWritten = 0;
- while (i < length) {
+ for (size_t i = 0; i < length; ) {
UChar32 character;
U16_NEXT(characters, i, length, character);
U8_APPEND_UNSAFE(bytes.data(), bytesWritten, character);
}
-
- return CString(reinterpret_cast<char*>(bytes.data()), bytesWritten);
+ return CString { bytes.data(), bytesWritten };
}
} // namespace WebCore
diff --git a/Source/WebCore/platform/text/TextCodecUTF8.h b/Source/WebCore/platform/text/TextCodecUTF8.h
index 94305ce18..636a0cb8d 100644
--- a/Source/WebCore/platform/text/TextCodecUTF8.h
+++ b/Source/WebCore/platform/text/TextCodecUTF8.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TextCodecUTF8_h
-#define TextCodecUTF8_h
+#pragma once
#include "TextCodec.h"
@@ -32,12 +31,6 @@ namespace WebCore {
class TextCodecUTF8 : public TextCodec {
public:
- static std::unique_ptr<TextCodec> create(const TextEncoding&, const void*);
- TextCodecUTF8()
- : m_partialSequenceSize(0)
- {
- }
-
static void registerEncodingNames(EncodingNameRegistrar);
static void registerCodecs(TextCodecRegistrar);
@@ -45,16 +38,14 @@ private:
virtual String decode(const char*, size_t length, bool flush, bool stopOnError, bool& sawError);
virtual CString encode(const UChar*, size_t length, UnencodableHandling);
- template <typename CharType>
- bool handlePartialSequence(CharType*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError);
- void handleError(UChar*& destination, bool stopOnError, bool& sawError);
+ bool handlePartialSequence(LChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush);
+ void handlePartialSequence(UChar*& destination, const uint8_t*& source, const uint8_t* end, bool flush, bool stopOnError, bool& sawError);
void consumePartialSequenceByte();
- int m_partialSequenceSize;
+ int m_partialSequenceSize { 0 };
uint8_t m_partialSequence[U8_MAX_LENGTH];
};
} // namespace WebCore
-#endif // TextCodecUTF8_h
diff --git a/Source/WebCore/platform/text/TextEncoding.h b/Source/WebCore/platform/text/TextEncoding.h
index d9943024f..922fc3e21 100644
--- a/Source/WebCore/platform/text/TextEncoding.h
+++ b/Source/WebCore/platform/text/TextEncoding.h
@@ -31,68 +31,68 @@
namespace WebCore {
- class TextEncoding {
- public:
- TextEncoding() : m_name(0) { }
- TextEncoding(const char* name);
- WEBCORE_EXPORT TextEncoding(const String& name);
+class TextEncoding {
+public:
+ TextEncoding() : m_name(0) { }
+ WEBCORE_EXPORT TextEncoding(const char* name);
+ WEBCORE_EXPORT TextEncoding(const String& name);
- bool isValid() const { return m_name; }
- const char* name() const { return m_name; }
- const char* domName() const; // name exposed via DOM
- bool usesVisualOrdering() const;
- bool isJapanese() const;
-
- PassRefPtr<StringImpl> displayString(PassRefPtr<StringImpl> str) const
- {
- if (m_backslashAsCurrencySymbol == '\\' || !str)
- return str;
- return str->replace('\\', m_backslashAsCurrencySymbol);
- }
- template <typename CharacterType>
- void displayBuffer(CharacterType* characters, unsigned len) const
- {
- if (m_backslashAsCurrencySymbol == '\\')
- return;
- for (unsigned i = 0; i < len; ++i) {
- if (characters[i] == '\\')
- characters[i] = m_backslashAsCurrencySymbol;
- }
+ bool isValid() const { return m_name; }
+ const char* name() const { return m_name; }
+ const char* domName() const; // name exposed via DOM
+ bool usesVisualOrdering() const;
+ bool isJapanese() const;
+
+ PassRefPtr<StringImpl> displayString(PassRefPtr<StringImpl> str) const
+ {
+ if (m_backslashAsCurrencySymbol == '\\' || !str)
+ return str;
+ return str->replace('\\', m_backslashAsCurrencySymbol);
+ }
+ template <typename CharacterType>
+ void displayBuffer(CharacterType* characters, unsigned len) const
+ {
+ if (m_backslashAsCurrencySymbol == '\\')
+ return;
+ for (unsigned i = 0; i < len; ++i) {
+ if (characters[i] == '\\')
+ characters[i] = m_backslashAsCurrencySymbol;
}
+ }
- const TextEncoding& closestByteBasedEquivalent() const;
- const TextEncoding& encodingForFormSubmission() const;
+ const TextEncoding& closestByteBasedEquivalent() const;
+ const TextEncoding& encodingForFormSubmission() const;
- String decode(const char* str, size_t length) const
- {
- bool ignored;
- return decode(str, length, false, ignored);
- }
- WEBCORE_EXPORT String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
- CString encode(StringView, UnencodableHandling) const;
+ String decode(const char* str, size_t length) const
+ {
+ bool ignored;
+ return decode(str, length, false, ignored);
+ }
+ WEBCORE_EXPORT String decode(const char*, size_t length, bool stopOnError, bool& sawError) const;
+ CString encode(StringView, UnencodableHandling) const;
- UChar backslashAsCurrencySymbol() const;
- bool isByteBasedEncoding() const { return !isNonByteBasedEncoding(); }
+ UChar backslashAsCurrencySymbol() const;
+ bool isByteBasedEncoding() const { return !isNonByteBasedEncoding(); }
- private:
- bool isNonByteBasedEncoding() const;
- bool isUTF7Encoding() const;
+private:
+ bool isNonByteBasedEncoding() const;
+ bool isUTF7Encoding() const;
- const char* m_name;
- UChar m_backslashAsCurrencySymbol;
- };
+ const char* m_name;
+ UChar m_backslashAsCurrencySymbol;
+};
- inline bool operator==(const TextEncoding& a, const TextEncoding& b) { return a.name() == b.name(); }
- inline bool operator!=(const TextEncoding& a, const TextEncoding& b) { return a.name() != b.name(); }
+inline bool operator==(const TextEncoding& a, const TextEncoding& b) { return a.name() == b.name(); }
+inline bool operator!=(const TextEncoding& a, const TextEncoding& b) { return a.name() != b.name(); }
- const TextEncoding& ASCIIEncoding();
- const TextEncoding& Latin1Encoding();
- const TextEncoding& UTF16BigEndianEncoding();
- const TextEncoding& UTF16LittleEndianEncoding();
- const TextEncoding& UTF32BigEndianEncoding();
- const TextEncoding& UTF32LittleEndianEncoding();
- WEBCORE_EXPORT const TextEncoding& UTF8Encoding();
- WEBCORE_EXPORT const TextEncoding& WindowsLatin1Encoding();
+const TextEncoding& ASCIIEncoding();
+const TextEncoding& Latin1Encoding();
+const TextEncoding& UTF16BigEndianEncoding();
+const TextEncoding& UTF16LittleEndianEncoding();
+const TextEncoding& UTF32BigEndianEncoding();
+const TextEncoding& UTF32LittleEndianEncoding();
+WEBCORE_EXPORT const TextEncoding& UTF8Encoding();
+WEBCORE_EXPORT const TextEncoding& WindowsLatin1Encoding();
} // namespace WebCore
diff --git a/Source/WebCore/platform/text/TextEncodingRegistry.h b/Source/WebCore/platform/text/TextEncodingRegistry.h
index e882a9ab3..6623fb949 100644
--- a/Source/WebCore/platform/text/TextEncodingRegistry.h
+++ b/Source/WebCore/platform/text/TextEncodingRegistry.h
@@ -31,26 +31,26 @@
namespace WebCore {
- class TextCodec;
- class TextEncoding;
+class TextCodec;
+class TextEncoding;
- // Use TextResourceDecoder::decode to decode resources, since it handles BOMs.
- // Use TextEncoding::encode to encode, since it takes care of normalization.
- std::unique_ptr<TextCodec> newTextCodec(const TextEncoding&);
+// Use TextResourceDecoder::decode to decode resources, since it handles BOMs.
+// Use TextEncoding::encode to encode, since it takes care of normalization.
+WEBCORE_EXPORT std::unique_ptr<TextCodec> newTextCodec(const TextEncoding&);
- // Only TextEncoding should use the following functions directly.
- const char* atomicCanonicalTextEncodingName(const char* alias);
- template <typename CharacterType>
- const char* atomicCanonicalTextEncodingName(const CharacterType*, size_t);
- const char* atomicCanonicalTextEncodingName(const String&);
- bool noExtendedTextEncodingNameUsed();
- bool isJapaneseEncoding(const char* canonicalEncodingName);
- bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName);
+// Only TextEncoding should use the following functions directly.
+const char* atomicCanonicalTextEncodingName(const char* alias);
+template <typename CharacterType>
+const char* atomicCanonicalTextEncodingName(const CharacterType*, size_t);
+const char* atomicCanonicalTextEncodingName(const String&);
+bool noExtendedTextEncodingNameUsed();
+bool isJapaneseEncoding(const char* canonicalEncodingName);
+bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName);
- WEBCORE_EXPORT String defaultTextEncodingNameForSystemLanguage();
+WEBCORE_EXPORT String defaultTextEncodingNameForSystemLanguage();
#ifndef NDEBUG
- void dumpTextEncodingNameMap();
+void dumpTextEncodingNameMap();
#endif
}
diff --git a/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
index 0fd56cc65..f2b8f562c 100644
--- a/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
+++ b/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
@@ -35,7 +35,7 @@ class SVGAnimatedListPropertyTearOff : public SVGAnimatedProperty {
public:
typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
- typedef Vector<RefPtr<ListItemTearOff>> ListWrapperCache;
+ typedef Vector<ListItemTearOff*> ListWrapperCache;
typedef SVGListProperty<PropertyType> ListProperty;
typedef SVGListPropertyTearOff<PropertyType> ListPropertyTearOff;
typedef PropertyType ContentType;
@@ -68,8 +68,11 @@ public:
m_baseVal = nullptr;
else if (&property == m_animVal)
m_animVal = nullptr;
- if (!m_baseVal && !m_animVal)
- detachListWrappers(m_values.size());
+ else {
+ size_t i = m_wrappers.find(&property);
+ if (i != notFound)
+ m_wrappers[i] = nullptr;
+ }
}
int findItem(SVGProperty* property)
diff --git a/Source/WebCore/svg/properties/SVGListProperty.h b/Source/WebCore/svg/properties/SVGListProperty.h
index 77788e102..cd6c44596 100644
--- a/Source/WebCore/svg/properties/SVGListProperty.h
+++ b/Source/WebCore/svg/properties/SVGListProperty.h
@@ -159,7 +159,7 @@ public:
m_values->clear();
m_values->append(newItem->propertyReference());
- m_wrappers->append(newItem);
+ m_wrappers->append(newItem.get());
commitChange();
return newItem;
@@ -200,7 +200,7 @@ public:
// It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
// that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
wrapper = ListItemTearOff::create(animatedList, UndefinedRole, m_values->at(index));
- m_wrappers->at(index) = wrapper;
+ m_wrappers->at(index) = wrapper.get();
}
return wrapper.release();
@@ -257,7 +257,7 @@ public:
m_values->insert(index, newItem->propertyReference());
// Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
- m_wrappers->insert(index, newItem);
+ m_wrappers->insert(index, newItem.get());
commitChange();
return newItem;
@@ -335,7 +335,7 @@ public:
// Update the value and the wrapper at the desired position 'index'.
m_values->at(index) = newItem->propertyReference();
- m_wrappers->at(index) = newItem;
+ m_wrappers->at(index) = newItem.get();
commitChange();
return newItem;
@@ -423,7 +423,7 @@ public:
// Append the value and wrapper at the end of the list.
m_values->append(newItem->propertyReference());
- m_wrappers->append(newItem);
+ m_wrappers->append(newItem.get());
commitChange(ListModificationAppend);
return newItem;
diff --git a/Source/WebCore/svg/properties/SVGListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGListPropertyTearOff.h
index 94df5474d..86bef088f 100644
--- a/Source/WebCore/svg/properties/SVGListPropertyTearOff.h
+++ b/Source/WebCore/svg/properties/SVGListPropertyTearOff.h
@@ -68,7 +68,7 @@ public:
ASSERT(m_values->size() == m_wrappers->size());
ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_wrappers->size());
- RefPtr<ListItemTearOff>& item = m_wrappers->at(itemIndex);
+ RefPtr<ListItemTearOff> item = m_wrappers->at(itemIndex);
item->detachWrapper();
m_wrappers->remove(itemIndex);
m_values->remove(itemIndex);
@@ -144,7 +144,7 @@ protected:
unsigned size = m_wrappers->size();
ASSERT(size == m_values->size());
for (unsigned i = 0; i < size; ++i) {
- ListItemTearOff* item = m_wrappers->at(i).get();
+ ListItemTearOff* item = m_wrappers->at(i);
if (!item)
continue;
item->setAnimatedProperty(m_animatedProperty.get());
diff --git a/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h
index 066364876..f30c910a9 100644
--- a/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h
+++ b/Source/WebCore/svg/properties/SVGTransformListPropertyTearOff.h
@@ -62,7 +62,7 @@ public:
detachListWrappers(0);
RefPtr<SVGPropertyTearOff<SVGTransform>> wrapper = SVGPropertyTearOff<SVGTransform>::create(m_values->consolidate());
- m_wrappers->append(wrapper);
+ m_wrappers->append(wrapper.get());
ASSERT(m_values->size() == m_wrappers->size());
return wrapper;