*/
#include "config.h"
-#include "WebDocument.h"
-
-#include "WebAXObject.h"
-#include "WebDOMEvent.h"
-#include "WebDocumentType.h"
-#include "WebElement.h"
-#include "WebElementCollection.h"
-#include "WebFormElement.h"
-#include "WebFrameImpl.h"
-#include "WebNodeList.h"
-#include "bindings/v8/Dictionary.h"
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/ScriptState.h"
-#include "bindings/v8/ScriptValue.h"
+#include "public/web/WebDocument.h"
+
+#include "bindings/core/v8/Dictionary.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptValue.h"
#include "core/accessibility/AXObjectCache.h"
-#include "core/css/CSSParserMode.h"
#include "core/css/StyleSheetContents.h"
#include "core/dom/CSSSelectorWatch.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentType.h"
#include "core/dom/Element.h"
-#include "core/dom/FullscreenElementStack.h"
-#include "core/dom/NodeList.h"
+#include "core/dom/Fullscreen.h"
#include "core/dom/StyleEngine.h"
#include "core/html/HTMLAllCollection.h"
#include "core/html/HTMLBodyElement.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLHeadElement.h"
+#include "core/html/HTMLLinkElement.h"
#include "core/loader/DocumentLoader.h"
#include "core/rendering/RenderObject.h"
+#include "core/rendering/RenderView.h"
#include "platform/weborigin/SecurityOrigin.h"
#include "public/platform/WebURL.h"
+#include "public/web/WebAXObject.h"
+#include "public/web/WebDOMEvent.h"
+#include "public/web/WebDocumentType.h"
+#include "public/web/WebElement.h"
+#include "public/web/WebElementCollection.h"
+#include "public/web/WebFormElement.h"
+#include "public/web/WebNodeList.h"
+#include "web/WebLocalFrameImpl.h"
#include "wtf/PassRefPtr.h"
#include <v8.h>
-using namespace WebCore;
-
namespace blink {
WebURL WebDocument::url() const
return constUnwrap<Document>()->referrer();
}
+WebColor WebDocument::themeColor() const
+{
+ return constUnwrap<Document>()->themeColor().rgb();
+}
+
WebURL WebDocument::openSearchDescriptionURL() const
{
return const_cast<Document*>(constUnwrap<Document>())->openSearchDescriptionURL();
}
-WebFrame* WebDocument::frame() const
+WebLocalFrame* WebDocument::frame() const
{
- return WebFrameImpl::fromFrame(constUnwrap<Document>()->frame());
+ return WebLocalFrameImpl::fromFrame(constUnwrap<Document>()->frame());
}
bool WebDocument::isHTMLDocument() const
void WebDocument::images(WebVector<WebElement>& results)
{
- RefPtr<HTMLCollection> images = unwrap<Document>()->images();
+ RefPtrWillBeRawPtr<HTMLCollection> images = unwrap<Document>()->images();
size_t sourceLength = images->length();
Vector<WebElement> temp;
temp.reserveCapacity(sourceLength);
void WebDocument::forms(WebVector<WebFormElement>& results) const
{
- RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>())->forms();
+ RefPtrWillBeRawPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>())->forms();
size_t sourceLength = forms->length();
Vector<WebFormElement> temp;
temp.reserveCapacity(sourceLength);
void WebDocument::insertStyleSheet(const WebString& sourceCode)
{
- RefPtr<Document> document = unwrap<Document>();
+ RefPtrWillBeRawPtr<Document> document = unwrap<Document>();
ASSERT(document);
- RefPtrWillBeRawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParserContext(*document.get(), 0));
+ RefPtrWillBeRawPtr<StyleSheetContents> parsedSheet = StyleSheetContents::create(CSSParserContext(*document, 0));
parsedSheet->parseString(sourceCode);
document->styleEngine()->addAuthorSheet(parsedSheet);
}
void WebDocument::watchCSSSelectors(const WebVector<WebString>& webSelectors)
{
- RefPtr<Document> document = unwrap<Document>();
+ RefPtrWillBeRawPtr<Document> document = unwrap<Document>();
Vector<String> selectors;
selectors.append(webSelectors.data(), webSelectors.size());
CSSSelectorWatch::from(*document).watchCSSSelectors(selectors);
void WebDocument::cancelFullScreen()
{
- if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(*unwrap<Document>()))
- fullscreen->webkitCancelFullScreen();
+ Fullscreen::fullyExitFullscreen(*unwrap<Document>());
}
WebElement WebDocument::fullScreenElement() const
{
Element* fullScreenElement = 0;
- if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(*const_cast<WebDocument*>(this)->unwrap<Document>()))
+ if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*const_cast<WebDocument*>(this)->unwrap<Document>()))
fullScreenElement = fullscreen->webkitCurrentFullScreenElement();
return WebElement(fullScreenElement);
}
return element;
}
+WebSize WebDocument::scrollOffset() const
+{
+ if (FrameView* view = constUnwrap<Document>()->view())
+ return view->scrollOffset();
+ return WebSize();
+}
+
+WebSize WebDocument::minimumScrollOffset() const
+{
+ if (FrameView* view = constUnwrap<Document>()->view())
+ return toIntSize(view->minimumScrollPosition());
+ return WebSize();
+}
+
+WebSize WebDocument::maximumScrollOffset() const
+{
+ if (FrameView* view = constUnwrap<Document>()->view())
+ return toIntSize(view->maximumScrollPosition());
+ return WebSize();
+}
+
+void WebDocument::setIsTransitionDocument()
+{
+ // This ensures the transition UA stylesheet gets applied.
+ unwrap<Document>()->setIsTransitionDocument();
+}
+
+void WebDocument::beginExitTransition(const WebString& cssSelector)
+{
+ RefPtrWillBeRawPtr<Document> document = unwrap<Document>();
+ document->hideTransitionElements(cssSelector);
+ document->styleEngine()->enableExitTransitionStylesheets();
+}
+
WebAXObject WebDocument::accessibilityObject() const
{
const Document* document = constUnwrap<Document>();
- return WebAXObject(document->axObjectCache()->getOrCreate(document->renderer()));
+ AXObjectCache* cache = document->axObjectCache();
+ return cache ? WebAXObject(cache->getOrCreate(document->renderView())) : WebAXObject();
}
WebAXObject WebDocument::accessibilityObjectFromID(int axID) const
{
const Document* document = constUnwrap<Document>();
- return WebAXObject(document->axObjectCache()->objectFromAXID(axID));
+ AXObjectCache* cache = document->axObjectCache();
+ return cache ? WebAXObject(cache->objectFromAXID(axID)) : WebAXObject();
}
WebVector<WebDraggableRegion> WebDocument::draggableRegions() const
for (size_t i = 0; i < regions.size(); i++) {
const AnnotatedRegionValue& value = regions[i];
draggableRegions[i].draggable = value.draggable;
- draggableRegions[i].bounds = WebCore::IntRect(value.bounds);
+ draggableRegions[i].bounds = IntRect(value.bounds);
}
}
return draggableRegions;
v8::Handle<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString& name, v8::Handle<v8::Value> options, WebExceptionCode& ec)
{
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
Document* document = unwrap<Document>();
- Dictionary dictionary(options, v8::Isolate::GetCurrent());
+ Dictionary dictionary(options, isolate);
TrackExceptionState exceptionState;
- ScriptValue constructor = document->registerElement(ScriptState::current(), name, dictionary, exceptionState, CustomElement::EmbedderNames);
+ ScriptValue constructor = document->registerElement(ScriptState::current(isolate), name, dictionary, exceptionState, CustomElement::EmbedderNames);
ec = exceptionState.code();
if (exceptionState.hadException())
return v8::Handle<v8::Value>();
return constructor.v8Value();
}
-WebDocument::WebDocument(const PassRefPtr<Document>& elem)
+WebURL WebDocument::manifestURL() const
+{
+ const Document* document = constUnwrap<Document>();
+ HTMLLinkElement* linkElement = document->linkManifest();
+ if (!linkElement)
+ return WebURL();
+ return linkElement->href();
+}
+
+WebDocument::WebDocument(const PassRefPtrWillBeRawPtr<Document>& elem)
: WebNode(elem)
{
}
-WebDocument& WebDocument::operator=(const PassRefPtr<Document>& elem)
+WebDocument& WebDocument::operator=(const PassRefPtrWillBeRawPtr<Document>& elem)
{
m_private = elem;
return *this;
}
-WebDocument::operator PassRefPtr<Document>() const
+WebDocument::operator PassRefPtrWillBeRawPtr<Document>() const
{
return toDocument(m_private.get());
}