#include "config.h"
#if ENABLE(WML)
#include "WMLDocument.h"
#include "Page.h"
#include "Tokenizer.h"
#include "WMLCardElement.h"
#include "WMLErrorHandling.h"
#include "WMLPageState.h"
#include "WMLTemplateElement.h"
namespace WebCore {
WMLDocument::WMLDocument(Frame* frame)
: Document(frame, false)
{
clearXMLVersion();
}
WMLDocument::~WMLDocument()
{
}
void WMLDocument::finishedParsing()
{
if (Tokenizer* tokenizer = this->tokenizer()) {
if (!tokenizer->wellFormed()) {
Document::finishedParsing();
return;
}
}
WMLPageState* wmlPageState = wmlPageStateForDocument(this);
if (!wmlPageState->isDeckAccessible()) {
reportWMLError(this, WMLErrorDeckNotAccessible);
Document::finishedParsing();
return;
}
wmlPageState->setNeedCheckDeckAccess(false);
WMLTemplateElement::registerTemplatesInDocument(this);
WMLCardElement* card = WMLCardElement::determineActiveCard(this);
if (!card) {
reportWMLError(this, WMLErrorNoCardInDocument);
Document::finishedParsing();
return;
}
card->handleDeckLevelTaskOverridesIfNeeded();
card->handleIntrinsicEventIfNeeded();
Document::finishedParsing();
}
WMLPageState* wmlPageStateForDocument(Document* doc)
{
ASSERT(doc);
Page* page = doc->page();
ASSERT(page);
return page->wmlPageState();
}
}
#endif