Commit 4aaa715f authored by dglazkov@chromium.org's avatar dglazkov@chromium.org

Remove the importedDocument functions from HTML imports classes.

The notion of "importedDocument" only exists at the LinkImport level
(because its used, HTMLLinkElement has to deal with both importer
and the importee), so we can just call the imported documents simply
"documents" inside of the imports plumbing.

No functional changes, plumbotron.

R=morrita
BUG=

Review URL: https://codereview.chromium.org/298413004

git-svn-id: svn://svn.chromium.org/blink/trunk@175224 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b069880b
...@@ -101,13 +101,6 @@ bool HTMLImportChild::isFirst() const ...@@ -101,13 +101,6 @@ bool HTMLImportChild::isFirst() const
return m_loader && m_loader->isFirstImport(this); return m_loader && m_loader->isFirstImport(this);
} }
Document* HTMLImportChild::importedDocument() const
{
if (!m_loader)
return 0;
return m_loader->importedDocument();
}
void HTMLImportChild::importDestroyed() void HTMLImportChild::importDestroyed()
{ {
if (parent()) if (parent())
......
...@@ -56,7 +56,6 @@ public: ...@@ -56,7 +56,6 @@ public:
virtual ~HTMLImportChild(); virtual ~HTMLImportChild();
HTMLLinkElement* link() const; HTMLLinkElement* link() const;
Document* importedDocument() const;
const KURL& url() const { return m_url; } const KURL& url() const { return m_url; }
void didShareLoader(); void didShareLoader();
......
...@@ -63,10 +63,10 @@ void HTMLImportLoader::importDestroyed() ...@@ -63,10 +63,10 @@ void HTMLImportLoader::importDestroyed()
void HTMLImportLoader::clear() void HTMLImportLoader::clear()
{ {
m_controller = 0; m_controller = 0;
if (m_importedDocument) { if (m_document) {
m_importedDocument->setImportsController(0); m_document->setImportsController(0);
m_importedDocument->cancelParsing(); m_document->cancelParsing();
m_importedDocument.clear(); m_document.clear();
} }
} }
...@@ -109,8 +109,8 @@ HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR ...@@ -109,8 +109,8 @@ HTMLImportLoader::State HTMLImportLoader::startWritingAndParsing(const ResourceR
ASSERT(!m_imports.isEmpty()); ASSERT(!m_imports.isEmpty());
DocumentInit init = DocumentInit(response.url(), 0, m_controller->master()->contextDocument(), m_controller) DocumentInit init = DocumentInit(response.url(), 0, m_controller->master()->contextDocument(), m_controller)
.withRegistrationContext(m_controller->master()->registrationContext()); .withRegistrationContext(m_controller->master()->registrationContext());
m_importedDocument = HTMLDocument::create(init); m_document = HTMLDocument::create(init);
m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeType(), "UTF-8"); m_writer = DocumentWriter::create(m_document.get(), response.mimeType(), "UTF-8");
return StateLoading; return StateLoading;
} }
...@@ -162,14 +162,7 @@ void HTMLImportLoader::didRemoveAllPendingStylesheet() ...@@ -162,14 +162,7 @@ void HTMLImportLoader::didRemoveAllPendingStylesheet()
bool HTMLImportLoader::hasPendingResources() const bool HTMLImportLoader::hasPendingResources() const
{ {
return m_importedDocument && m_importedDocument->styleEngine()->hasPendingSheets(); return m_document && m_document->styleEngine()->hasPendingSheets();
}
Document* HTMLImportLoader::importedDocument() const
{
if (m_state == StateError)
return 0;
return m_importedDocument.get();
} }
void HTMLImportLoader::didFinishLoading() void HTMLImportLoader::didFinishLoading()
...@@ -179,7 +172,7 @@ void HTMLImportLoader::didFinishLoading() ...@@ -179,7 +172,7 @@ void HTMLImportLoader::didFinishLoading()
clearResource(); clearResource();
ASSERT(!m_importedDocument || !m_importedDocument->parsing()); ASSERT(!m_document || !m_document->parsing());
} }
void HTMLImportLoader::moveToFirst(HTMLImportChild* import) void HTMLImportLoader::moveToFirst(HTMLImportChild* import)
......
...@@ -70,8 +70,7 @@ public: ...@@ -70,8 +70,7 @@ public:
virtual ~HTMLImportLoader(); virtual ~HTMLImportLoader();
Document* document() const { return m_importedDocument.get(); } Document* document() const { return m_document.get(); }
Document* importedDocument() const;
void addImport(HTMLImportChild*); void addImport(HTMLImportChild*);
void removeImport(HTMLImportChild*); void removeImport(HTMLImportChild*);
void moveToFirst(HTMLImportChild*); void moveToFirst(HTMLImportChild*);
...@@ -116,7 +115,7 @@ private: ...@@ -116,7 +115,7 @@ private:
HTMLImportsController* m_controller; HTMLImportsController* m_controller;
Vector<HTMLImportChild*> m_imports; Vector<HTMLImportChild*> m_imports;
State m_state; State m_state;
RefPtr<Document> m_importedDocument; RefPtr<Document> m_document;
RefPtr<DocumentWriter> m_writer; RefPtr<DocumentWriter> m_writer;
RefPtrWillBePersistent<CustomElementMicrotaskQueue> m_microtaskQueue; RefPtrWillBePersistent<CustomElementMicrotaskQueue> m_microtaskQueue;
}; };
......
...@@ -64,7 +64,9 @@ Document* LinkImport::importedDocument() const ...@@ -64,7 +64,9 @@ Document* LinkImport::importedDocument() const
{ {
if (!m_child || !m_owner || !m_owner->inDocument()) if (!m_child || !m_owner || !m_owner->inDocument())
return 0; return 0;
return m_child->importedDocument(); if (m_child->loader()->hasError())
return 0;
return m_child->document();
} }
void LinkImport::process() void LinkImport::process()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment