| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 { | 53 { |
| 54 // If the last item is not a data item, create one. Otherwise, we simply app
end the new string to the last data item. | 54 // If the last item is not a data item, create one. Otherwise, we simply app
end the new string to the last data item. |
| 55 if (m_items.isEmpty() || m_items[m_items.size() - 1].type != BlobDataItem::D
ata) | 55 if (m_items.isEmpty() || m_items[m_items.size() - 1].type != BlobDataItem::D
ata) |
| 56 m_items.append(BlobDataItem(RawData::create())); | 56 m_items.append(BlobDataItem(RawData::create())); |
| 57 | 57 |
| 58 return *m_items[m_items.size() - 1].data->mutableData(); | 58 return *m_items[m_items.size() - 1].data->mutableData(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void BlobBuilder::append(const String& text, const String& endingType) | 61 void BlobBuilder::append(const String& text, const String& endingType) |
| 62 { | 62 { |
| 63 CString utf8Text = UTF8Encoding().encode(text, WTF::EntitiesForUnencodables)
; | 63 CString utf8Text = UTF8Encoding().normalizeAndEncode(text, WTF::EntitiesForU
nencodables); |
| 64 | 64 |
| 65 Vector<char>& buffer = getBuffer(); | 65 Vector<char>& buffer = getBuffer(); |
| 66 size_t oldSize = buffer.size(); | 66 size_t oldSize = buffer.size(); |
| 67 | 67 |
| 68 if (endingType == "native") | 68 if (endingType == "native") |
| 69 normalizeLineEndingsToNative(utf8Text, buffer); | 69 normalizeLineEndingsToNative(utf8Text, buffer); |
| 70 else { | 70 else { |
| 71 ASSERT(endingType == "transparent"); | 71 ASSERT(endingType == "transparent"); |
| 72 buffer.append(utf8Text.data(), utf8Text.length()); | 72 buffer.append(utf8Text.data(), utf8Text.length()); |
| 73 } | 73 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size); | 131 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size); |
| 132 | 132 |
| 133 // After creating a blob from the current blob data, we do not need to keep
the data around any more. Instead, we only | 133 // After creating a blob from the current blob data, we do not need to keep
the data around any more. Instead, we only |
| 134 // need to keep a reference to the URL of the blob just created. | 134 // need to keep a reference to the URL of the blob just created. |
| 135 m_items.append(BlobDataItem(blob->url(), 0, m_size)); | 135 m_items.append(BlobDataItem(blob->url(), 0, m_size)); |
| 136 | 136 |
| 137 return blob; | 137 return blob; |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace WebCore | 140 } // namespace WebCore |
| OLD | NEW |