void ImageDocumentTest::loadImage() { DocumentParser* parser = document().implicitOpen( ParserSynchronizationPolicy::ForceSynchronousParsing); const Vector<unsigned char>& data = jpegImage(); parser->appendBytes(reinterpret_cast<const char*>(data.data()), data.size()); parser->finish(); }
void DocumentWriter::addData(const char* str, int len, bool flush) { if (len == -1) len = strlen(str); DocumentParser* parser = m_frame->document()->parser(); if (parser) parser->appendBytes(this, str, len, flush); }
void HTMLImportLoader::notifyParserStopped() { setState(finishParsing()); if (!hasPendingResources()) setState(finishLoading()); DocumentParser* parser = m_document->parser(); ASSERT(parser); parser->removeClient(this); }
HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceResponse& response) { ASSERT(!m_imports.isEmpty()); DocumentInit init = DocumentInit(response.url(), 0, m_controller->master()->contextDocument(), m_controller) .withRegistrationContext(m_controller->master()->registrationContext()); m_document = HTMLDocument::create(init); m_writer = DocumentWriter::create(m_document.get(), AllowAsynchronousParsing, response.mimeType(), "UTF-8"); DocumentParser* parser = m_document->parser(); ASSERT(parser); parser->addClient(this); return StateLoading; }