#include "WebDOMEvent.h"
#include "WebDocumentType.h"
#include "WebElement.h"
+#include "WebElementCollection.h"
#include "WebFormElement.h"
#include "WebFrameImpl.h"
-#include "WebNodeCollection.h"
#include "WebNodeList.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ExceptionState.h"
#include "core/html/HTMLHeadElement.h"
#include "core/loader/DocumentLoader.h"
#include "core/rendering/RenderObject.h"
+#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebURL.h"
-#include "weborigin/SecurityOrigin.h"
#include "wtf/PassRefPtr.h"
#include <v8.h>
using namespace WebCore;
-namespace WebKit {
+namespace blink {
WebURL WebDocument::url() const
{
return WebString(constUnwrap<Document>()->title());
}
-WebNodeCollection WebDocument::all()
+WebElementCollection WebDocument::all()
{
- return WebNodeCollection(unwrap<Document>()->all());
+ return WebElementCollection(unwrap<Document>()->all());
}
void WebDocument::images(WebVector<WebElement>& results)
Vector<WebElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
- Node* node = images->item(i);
- if (node && node->isHTMLElement())
- temp.append(WebElement(toElement(node)));
+ Element* element = images->item(i);
+ if (element && element->isHTMLElement())
+ temp.append(WebElement(element));
}
results.assign(temp);
}
Vector<WebFormElement> temp;
temp.reserveCapacity(sourceLength);
for (size_t i = 0; i < sourceLength; ++i) {
- Node* node = forms->item(i);
+ Element* element = forms->item(i);
// Strange but true, sometimes node can be 0.
- if (node && node->isHTMLElement())
- temp.append(WebFormElement(toHTMLFormElement(node)));
+ if (element && element->isHTMLElement())
+ temp.append(WebFormElement(toHTMLFormElement(element)));
}
results.assign(temp);
}
return WebDocumentType(constUnwrap<Document>()->doctype());
}
-void WebDocument::insertUserStyleSheet(const WebString& sourceCode, UserStyleLevel styleLevel)
+void WebDocument::insertStyleSheet(const WebString& sourceCode)
{
RefPtr<Document> document = unwrap<Document>();
ASSERT(document);
- RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(*document.get());
- parsedSheet->setIsUserStyleSheet(styleLevel == UserStyleUserLevel);
+ RefPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParserContext(*document.get(), 0));
parsedSheet->parseString(sourceCode);
- if (parsedSheet->isUserStyleSheet())
- document->styleEngine()->addUserSheet(parsedSheet);
- else
- document->styleEngine()->addAuthorSheet(parsedSheet);
+ document->styleEngine()->addAuthorSheet(parsedSheet);
}
void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors)
WebDOMEvent WebDocument::createEvent(const WebString& eventType)
{
- TrackExceptionState es;
- WebDOMEvent event(unwrap<Document>()->createEvent(eventType, es));
- if (es.hadException())
+ TrackExceptionState exceptionState;
+ WebDOMEvent event(unwrap<Document>()->createEvent(eventType, exceptionState));
+ if (exceptionState.hadException())
return WebDOMEvent();
return event;
}
WebElement WebDocument::createElement(const WebString& tagName)
{
- TrackExceptionState es;
- WebElement element(unwrap<Document>()->createElement(tagName, es));
- if (es.hadException())
+ TrackExceptionState exceptionState;
+ WebElement element(unwrap<Document>()->createElement(tagName, exceptionState));
+ if (exceptionState.hadException())
return WebElement();
return element;
}
{
Document* document = unwrap<Document>();
Dictionary dictionary(options, v8::Isolate::GetCurrent());
- TrackExceptionState es;
- ScriptValue constructor = document->registerElement(ScriptState::current(), name, dictionary, es, CustomElement::EmbedderNames);
- ec = es.code();
- if (es.hadException())
+ TrackExceptionState exceptionState;
+ ScriptValue constructor = document->registerElement(ScriptState::current(), name, dictionary, exceptionState, CustomElement::EmbedderNames);
+ ec = exceptionState.code();
+ if (exceptionState.hadException())
return v8::Handle<v8::Value>();
return constructor.v8Value();
}
return toDocument(m_private.get());
}
-} // namespace WebKit
+} // namespace blink