Changeset 88609 in webkit
- Timestamp:
- Jun 11, 2011 5:51:11 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r88606 r88609 1 2011-06-11 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 DocumentParser::appendBytes shouldn't have a "flush" boolean parameter 6 https://bugs.webkit.org/show_bug.cgi?id=62499 7 8 This patch removes the "flush" Boolean parameter from 9 DocumentParser::appendBytes in favor of a new flush method. This makes 10 some code in DocumentWriter look less ridiculous. 11 12 There's still lots of on contorting to do here, but it's a start. 13 14 * dom/DecodedDataDocumentParser.cpp: 15 (WebCore::DecodedDataDocumentParser::appendBytes): 16 (WebCore::DecodedDataDocumentParser::flush): 17 * dom/DecodedDataDocumentParser.h: 18 * dom/DocumentParser.h: 19 * dom/RawDataDocumentParser.h: 20 (WebCore::RawDataDocumentParser::flush): 21 * html/ImageDocument.cpp: 22 (WebCore::ImageDocumentParser::appendBytes): 23 * html/MediaDocument.cpp: 24 (WebCore::MediaDocumentParser::appendBytes): 25 * html/PluginDocument.cpp: 26 (WebCore::PluginDocumentParser::appendBytes): 27 * loader/DocumentWriter.cpp: 28 (WebCore::DocumentWriter::reportDataReceived): 29 (WebCore::DocumentWriter::addData): 30 (WebCore::DocumentWriter::endIfNotLoadingMainResource): 31 * loader/DocumentWriter.h: 32 * loader/SinkDocument.cpp: 33 (WebCore::SinkDocumentParser::appendBytes): 34 1 35 2011-06-11 Dimitri Glazkov <dglazkov@chromium.org> 2 36 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r88380 r88609 7438 7438 417DA4CE13734326007C57FB /* Internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Internals.h; sourceTree = "<group>"; }; 7439 7439 417DA4CF13734326007C57FB /* Internals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Internals.cpp; sourceTree = "<group>"; }; 7440 417DA6D013734E02007C57FB /* WebCoreTestSupport.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path =WebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; };7440 417DA6D013734E02007C57FB /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 7441 7441 417DA71B13735DFA007C57FB /* JSInternals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInternals.cpp; sourceTree = "<group>"; }; 7442 7442 417DA71C13735DFA007C57FB /* JSInternals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternals.h; sourceTree = "<group>"; }; … … 12731 12731 children = ( 12732 12732 5D87BB4F11E3EAEB00702B6F /* WebCoreExportFileGenerator */, 12733 417DA6D013734E02007C57FB /* WebCoreTestSupport.dylib */,12733 417DA6D013734E02007C57FB /* libWebCoreTestSupport.dylib */, 12734 12734 93F19B1A08245E5A001E9ABC /* WebCore.framework */, 12735 12735 ); … … 23195 23195 name = WebCoreTestSupport; 23196 23196 productName = WebCoreTestSupport; 23197 productReference = 417DA6D013734E02007C57FB /* WebCoreTestSupport.dylib */;23197 productReference = 417DA6D013734E02007C57FB /* libWebCoreTestSupport.dylib */; 23198 23198 productType = "com.apple.product-type.library.dynamic"; 23199 23199 }; -
trunk/Source/WebCore/dom/DecodedDataDocumentParser.cpp
r66967 r88609 38 38 } 39 39 40 void DecodedDataDocumentParser::appendBytes(DocumentWriter* writer , const char* data, int length, bool shouldFlush)40 void DecodedDataDocumentParser::appendBytes(DocumentWriter* writer, const char* data, int length) 41 41 { 42 if (!length && !shouldFlush)42 if (!length) 43 43 return; 44 44 45 TextResourceDecoder* decoder = writer->createDecoderIfNeeded(); 46 String decoded = decoder->decode(data, length); 47 if (shouldFlush) 48 decoded += decoder->flush(); 45 String decoded = writer->createDecoderIfNeeded()->decode(data, length); 49 46 if (decoded.isEmpty()) 50 47 return; 51 48 52 49 writer->reportDataReceived(); 53 54 50 append(decoded); 55 51 } 56 52 53 void DecodedDataDocumentParser::flush(DocumentWriter* writer) 54 { 55 String remainingData = writer->createDecoderIfNeeded()->flush(); 56 if (remainingData.isEmpty()) 57 return; 58 59 writer->reportDataReceived(); 60 append(remainingData); 61 } 62 57 63 }; 58 -
trunk/Source/WebCore/dom/DecodedDataDocumentParser.h
r66967 r88609 41 41 42 42 private: 43 // append is used by DocumentWriter::replaceDocument 43 // append is used by DocumentWriter::replaceDocument. 44 44 virtual void append(const SegmentedString&) = 0; 45 45 46 // appendBytes is used by DocumentWriter (the loader) 47 virtual void appendBytes(DocumentWriter*, const char* bytes, int length, bool flush); 46 // appendBytes and flush are used by DocumentWriter (the loader). 47 virtual void appendBytes(DocumentWriter*, const char* bytes, int length); 48 virtual void flush(DocumentWriter*); 48 49 }; 49 50 -
trunk/Source/WebCore/dom/DocumentParser.h
r75066 r88609 43 43 virtual bool hasInsertionPoint() { return true; } 44 44 45 // insert is used by document.write 45 // insert is used by document.write. 46 46 virtual void insert(const SegmentedString&) = 0; 47 47 48 // appendBytes is used by DocumentWriter (the loader) 49 virtual void appendBytes(DocumentWriter*, const char* bytes, int length, bool flush) = 0; 48 // appendBytes and flush are used by DocumentWriter (the loader). 49 virtual void appendBytes(DocumentWriter*, const char* bytes, int length) = 0; 50 virtual void flush(DocumentWriter*) = 0; 50 51 51 52 // FIXME: append() should be private, but DocumentWriter::replaceDocument -
trunk/Source/WebCore/dom/RawDataDocumentParser.h
r66670 r88609 45 45 46 46 private: 47 virtual void flush(DocumentWriter* writer) 48 { 49 // Make sure appendBytes is called at least once. 50 appendBytes(writer, 0, 0); 51 } 52 47 53 virtual void insert(const SegmentedString&) 48 54 { -
trunk/Source/WebCore/html/ImageDocument.cpp
r79288 r88609 91 91 } 92 92 93 virtual void appendBytes(DocumentWriter*, const char*, int , bool);93 virtual void appendBytes(DocumentWriter*, const char*, int); 94 94 virtual void finish(); 95 95 }; … … 125 125 } 126 126 127 void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, int , bool)127 void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, int) 128 128 { 129 129 Frame* frame = document()->frame(); -
trunk/Source/WebCore/html/MediaDocument.cpp
r88600 r88609 61 61 } 62 62 63 virtual void appendBytes(DocumentWriter*, const char*, int , bool);63 virtual void appendBytes(DocumentWriter*, const char*, int); 64 64 65 65 void createDocumentStructure(); … … 104 104 } 105 105 106 void MediaDocumentParser::appendBytes(DocumentWriter*, const char*, int , bool)106 void MediaDocumentParser::appendBytes(DocumentWriter*, const char*, int) 107 107 { 108 108 if (m_mediaElement) -
trunk/Source/WebCore/html/PluginDocument.cpp
r88600 r88609 59 59 } 60 60 61 virtual void appendBytes(DocumentWriter*, const char*, int , bool);61 virtual void appendBytes(DocumentWriter*, const char*, int); 62 62 63 63 void createDocumentStructure(); … … 104 104 } 105 105 106 void PluginDocumentParser::appendBytes(DocumentWriter*, const char*, int , bool)106 void PluginDocumentParser::appendBytes(DocumentWriter*, const char*, int) 107 107 { 108 108 if (m_embedElement) -
trunk/Source/WebCore/loader/DocumentWriter.cpp
r88583 r88609 57 57 DocumentWriter::DocumentWriter(Frame* frame) 58 58 : m_frame(frame) 59 , m_ receivedData(false)59 , m_hasReceivedSomeData(false) 60 60 , m_encodingWasChosenByUser(false) 61 61 { … … 71 71 72 72 if (!source.isNull()) { 73 if (!m_ receivedData) {74 m_ receivedData = true;73 if (!m_hasReceivedSomeData) { 74 m_hasReceivedSomeData = true; 75 75 m_frame->document()->setCompatibilityMode(Document::NoQuirksMode); 76 76 } … … 88 88 { 89 89 m_decoder = 0; 90 m_ receivedData = false;90 m_hasReceivedSomeData = false; 91 91 if (!m_encodingWasChosenByUser) 92 92 m_encoding = String(); … … 145 145 document->implicitOpen(); 146 146 147 // We grab a reference to the parser so that we'll always send data to the 148 // original parser, even if the document acquires a new parser (e.g., via 149 // document.open). 147 150 m_parser = document->parser(); 148 151 … … 188 191 { 189 192 ASSERT(m_decoder); 190 if ( !m_receivedData) {191 m_receivedData = true;192 if (m_decoder->encoding().usesVisualOrdering())193 m_frame->document()->setVisuallyOrdered();194 m_frame->document()-> recalcStyle(Node::Force);195 }196 } 197 198 void DocumentWriter::addData(const char* str, int len, bool flush)199 { 200 if (len == -1)201 len = strlen(str);202 203 m_parser->appendBytes(this, str, len, flush);193 if (m_hasReceivedSomeData) 194 return; 195 m_hasReceivedSomeData = true; 196 if (m_decoder->encoding().usesVisualOrdering()) 197 m_frame->document()->setVisuallyOrdered(); 198 m_frame->document()->recalcStyle(Node::Force); 199 } 200 201 void DocumentWriter::addData(const char* bytes, int length) 202 { 203 if (length == -1) 204 length = strlen(bytes); 205 206 m_parser->appendBytes(this, bytes, length); 204 207 } 205 208 … … 220 223 RefPtr<Frame> protector(m_frame); 221 224 222 // FIXME: Can we remove this call? Finishing the parser should flush anyway. 223 addData(0, 0, true); 224 225 // FIXME: m_parser->finish() should imply m_parser->flush(). 226 m_parser->flush(this); 225 227 if (!m_parser) 226 228 return; -
trunk/Source/WebCore/loader/DocumentWriter.h
r88583 r88609 52 52 void begin(); 53 53 void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0); 54 void addData(const char* string, int length = -1, bool flush = false);54 void addData(const char* bytes, int length = -1); 55 55 void end(); 56 56 void endIfNotLoadingMainResource(); … … 83 83 Frame* m_frame; 84 84 85 bool m_ receivedData;85 bool m_hasReceivedSomeData; 86 86 String m_mimeType; 87 87 -
trunk/Source/WebCore/loader/SinkDocument.cpp
r66247 r88609 45 45 46 46 // Ignore all data. 47 virtual void appendBytes(DocumentWriter*, const char*, int , bool) { }47 virtual void appendBytes(DocumentWriter*, const char*, int) { } 48 48 }; 49 49
Note: See TracChangeset
for help on using the changeset viewer.