#include "core/page/PagePopupController.h"
#include "core/page/PrintContext.h"
#include "core/frame/Settings.h"
-#include "core/frame/animation/AnimationController.h"
#include "core/rendering/CompositedLayerMapping.h"
#include "core/rendering/RenderLayer.h"
#include "core/rendering/RenderLayerCompositor.h"
#include "platform/graphics/GraphicsLayer.h"
#include "platform/graphics/filters/FilterOperation.h"
#include "platform/graphics/filters/FilterOperations.h"
-#include "platform/graphics/gpu/SharedGraphicsContext3D.h"
#include "platform/weborigin/SchemeRegistry.h"
+#include "public/platform/Platform.h"
#include "public/platform/WebGraphicsContext3D.h"
+#include "public/platform/WebGraphicsContext3DProvider.h"
#include "public/platform/WebLayer.h"
#include "wtf/InstanceCounter.h"
#include "wtf/PassOwnPtr.h"
page->setDeviceScaleFactor(1);
page->setIsCursorVisible(true);
page->setPageScaleFactor(1, IntPoint(0, 0));
- page->setPagination(Pagination());
TextRun::setAllowsRoundingHacks(false);
WebCore::overrideUserPreferredLanguages(Vector<AtomicString>());
delete s_pagePopupDriver;
Internals::Internals(Document* document)
: ContextLifecycleObserver(document)
, m_runtimeFlags(InternalRuntimeFlags::create())
- , m_scrollingCoordinator(document->page() ? document->page()->scrollingCoordinator() : 0)
{
}
bool Internals::isSharingStyle(Element* element1, Element* element2, ExceptionState& exceptionState) const
{
if (!element1 || !element2) {
- exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
+ exceptionState.throwDOMException(InvalidAccessError, String::format("The %s element provided is invalid.", element1 ? "second" : "first"));
+ return false;
}
return element1->renderStyle() == element2->renderStyle();
}
-PassRefPtr<Element> Internals::createContentElement(ExceptionState& exceptionState)
-{
- Document* document = contextDocument();
- if (!document) {
- exceptionState.throwDOMException(InvalidAccessError, "No context document is available.");
- return 0;
- }
-
- return HTMLContentElement::create(*document);
-}
-
bool Internals::isValidContentSelect(Element* insertionPoint, ExceptionState& exceptionState)
{
if (!insertionPoint || !insertionPoint->isInsertionPoint()) {
{
Frame* contextFrame = frame();
Document* document = contextFrame->document();
- if (RuntimeEnabledFeatures::webAnimationsCSSEnabled())
- return document->timeline()->numberOfActiveAnimationsForTesting() + document->transitionTimeline()->numberOfActiveAnimationsForTesting();
- return contextFrame->animation().numberOfActiveAnimations(document);
+ return document->timeline()->numberOfActiveAnimationsForTesting() + document->transitionTimeline()->numberOfActiveAnimationsForTesting();
}
void Internals::pauseAnimations(double pauseTime, ExceptionState& exceptionState)
return;
}
- if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
- frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime);
- frame()->document()->transitionTimeline()->pauseAnimationsForTesting(pauseTime);
- } else {
- frame()->animation().pauseAnimationsForTesting(pauseTime);
- }
+ // https://code.google.com/p/chromium/issues/detail?id=343760
+ DisableCompositingQueryAsserts disabler;
+
+ frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime);
+ frame()->document()->transitionTimeline()->pauseAnimationsForTesting(pauseTime);
}
bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionState& exceptionState) const
return CSSComputedStyleDeclaration::create(node, allowVisitedStyle);
}
-ShadowRoot* Internals::ensureShadowRoot(Element* host, ExceptionState& exceptionState)
-{
- if (!host) {
- exceptionState.throwDOMException(InvalidAccessError, "The host element provided is invalid.");
- return 0;
- }
-
- if (ElementShadow* shadow = host->shadow())
- return shadow->youngestShadowRoot();
-
- return host->createShadowRoot(exceptionState).get();
-}
-
ShadowRoot* Internals::shadowRoot(Element* host, ExceptionState& exceptionState)
{
// FIXME: Internals::shadowRoot() in tests should be converted to youngestShadowRoot() or oldestShadowRoot().
return toShadowRoot(shadow)->youngerShadowRoot();
}
-ShadowRoot* Internals::olderShadowRoot(Node* shadow, ExceptionState& exceptionState)
-{
- if (!shadow || !shadow->isShadowRoot()) {
- exceptionState.throwDOMException(InvalidAccessError, "The node provided is not a valid shadow root.");
- return 0;
- }
-
- return toShadowRoot(shadow)->olderShadowRoot();
-}
-
String Internals::shadowRootType(const Node* root, ExceptionState& exceptionState) const
{
if (!root || !root->isShadowRoot()) {
node->document().markers()->setMarkersActive(node, startOffset, endOffset, active);
}
+void Internals::setMarkedTextMatchesAreHighlighted(Document* document, bool highlight, ExceptionState&)
+{
+ if (!document || !document->frame())
+ return;
+
+ document->frame()->editor().setMarkedTextMatchesAreHighlighted(highlight);
+}
+
void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionState& exceptionState)
{
if (!document || !document->view()) {
frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue);
}
-void Internals::setPagination(Document* document, const String& mode, int gap, int pageLength, ExceptionState& exceptionState)
-{
- if (!document || !document->page()) {
- exceptionState.throwDOMException(InvalidAccessError, document ? "The document's page cannot be retrieved." : "The document provided is invalid.");
- return;
- }
- Page* page = document->page();
-
- Pagination pagination;
- if (mode == "Unpaginated")
- pagination.mode = Pagination::Unpaginated;
- else if (mode == "LeftToRightPaginated")
- pagination.mode = Pagination::LeftToRightPaginated;
- else if (mode == "RightToLeftPaginated")
- pagination.mode = Pagination::RightToLeftPaginated;
- else if (mode == "TopToBottomPaginated")
- pagination.mode = Pagination::TopToBottomPaginated;
- else if (mode == "BottomToTopPaginated")
- pagination.mode = Pagination::BottomToTopPaginated;
- else {
- exceptionState.throwDOMException(SyntaxError, "The pagination mode provided ('" + mode + "') is invalid.");
- return;
- }
-
- pagination.gap = gap;
- pagination.pageLength = pageLength;
- page->setPagination(pagination);
-}
-
String Internals::viewportAsText(Document* document, float, int availableWidth, int availableHeight, ExceptionState& exceptionState)
{
if (!document || !document->page()) {
if (textField->hasTagName(inputTag))
return toHTMLInputElement(textField)->lastChangeWasUserEdit();
- // FIXME: We should be using hasTagName instead but Windows port doesn't link QualifiedNames properly.
- if (textField->tagName() == "TEXTAREA")
+ if (textField->hasTagName(textareaTag))
return toHTMLTextAreaElement(textField)->lastChangeWasUserEdit();
exceptionState.throwDOMException(InvalidNodeTypeError, "The element provided is not a TEXTAREA.");
frameView->scrollElementToRect(element, IntRect(x, y, w, h));
}
-void Internals::paintControlTints(Document* document, ExceptionState& exceptionState)
-{
- if (!document || !document->view()) {
- exceptionState.throwDOMException(InvalidAccessError, document ? "The document's view cannot be retrieved." : "The document provided is invalid.");
- return;
- }
-
- FrameView* frameView = document->view();
- frameView->paintControlTints();
-}
-
PassRefPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength, ExceptionState& exceptionState)
{
if (!scope) {
bool Internals::loseSharedGraphicsContext3D()
{
- RefPtr<GraphicsContext3D> sharedContext = SharedGraphicsContext3D::get();
- if (!sharedContext)
+ OwnPtr<blink::WebGraphicsContext3DProvider> sharedProvider = adoptPtr(blink::Platform::current()->createSharedOffscreenGraphicsContext3DProvider());
+ if (!sharedProvider)
return false;
- sharedContext->webContext()->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT);
+ blink::WebGraphicsContext3D* sharedContext = sharedProvider->context3d();
+ sharedContext->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT);
// To prevent tests that call loseSharedGraphicsContext3D from being
// flaky, we call finish so that the context is guaranteed to be lost
// synchronously (i.e. before returning).
- sharedContext->webContext()->finish();
+ sharedContext->finish();
return true;
}
view->compositor()->updateCompositingLayers();
}
+bool Internals::isCompositorFramePending(Document* document, ExceptionState& exceptionState)
+{
+ if (!document || !document->renderView()) {
+ exceptionState.throwDOMException(InvalidAccessError, document ? "The document's render view cannot be retrieved." : "The document provided is invalid.");
+ return false;
+ }
+
+ return document->page()->chrome().client().isCompositorFramePending();
+}
+
void Internals::setZoomFactor(float factor)
{
frame()->setPageZoomFactor(factor);
}
+void Internals::setShouldRevealPassword(Element* element, bool reveal, ExceptionState& exceptionState)
+{
+ if (!element || !element->hasTagName(inputTag)) {
+ exceptionState.throwDOMException(InvalidAccessError, "The element provided is invalid.");
+ return;
+ }
+
+ return toHTMLInputElement(element)->setShouldRevealPassword(reveal);
+}
+
namespace {
class AddOneFunction : public ScriptFunction {