bool SVGImage::dataChanged(bool allDataReceived) { // Don't do anything if is an empty image. if (!data()->size()) return true; if (allDataReceived) { static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClient; Page::PageClients pageClients; m_chromeClient = adoptPtr(new SVGImageChromeClient(this)); pageClients.chromeClient = m_chromeClient.get(); #if ENABLE(CONTEXT_MENUS) static ContextMenuClient* dummyContextMenuClient = new EmptyContextMenuClient; pageClients.contextMenuClient = dummyContextMenuClient; #endif static EditorClient* dummyEditorClient = new EmptyEditorClient; pageClients.editorClient = dummyEditorClient; #if ENABLE(DRAG_SUPPORT) static DragClient* dummyDragClient = new EmptyDragClient; pageClients.dragClient = dummyDragClient; #endif static InspectorClient* dummyInspectorClient = new EmptyInspectorClient; pageClients.inspectorClient = dummyInspectorClient; #if ENABLE(DEVICE_ORIENTATION) static DeviceMotionClient* dummyDeviceMotionClient = new EmptyDeviceMotionClient; pageClients.deviceMotionClient = dummyDeviceMotionClient; static DeviceOrientationClient* dummyDeviceOrientationClient = new EmptyDeviceOrientationClient; pageClients.deviceOrientationClient = dummyDeviceOrientationClient; #endif // FIXME: If this SVG ends up loading itself, we might leak the world. // The comment said that the Cache code does not know about CachedImages // holding Frames and won't know to break the cycle. But m_page.set(new Page(pageClients)); m_page->settings()->setMediaEnabled(false); m_page->settings()->setJavaScriptEnabled(false); m_page->settings()->setPluginsEnabled(false); RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); frame->setView(FrameView::create(frame.get())); frame->init(); ResourceRequest fakeRequest(KURL(ParsedURLString, "")); FrameLoader* loader = frame->loader(); loader->setForcedSandboxFlags(SandboxAll); loader->load(fakeRequest, false); // Make sure the DocumentLoader is created loader->policyChecker()->cancelCheck(); // cancel any policy checks loader->commitProvisionalLoad(); loader->writer()->setMIMEType("image/svg+xml"); loader->writer()->begin(KURL()); // create the empty document loader->writer()->addData(data()->data(), data()->size()); loader->writer()->end(); frame->view()->setTransparent(true); // SVG Images are transparent. } return m_page; }
void WMLGoElement::executeTask() { ASSERT(document()->isWMLDocument()); WMLDocument* document = static_cast<WMLDocument*>(this->document()); WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; WMLCardElement* card = document->activeCard(); if (!card) return; Frame* frame = document->frame(); if (!frame) return; FrameLoader* loader = frame->loader(); if (!loader) return; String href = getAttribute(HTMLNames::hrefAttr); if (href.isEmpty()) return; // Substitute variables within target url attribute value KURL url = document->completeURL(substituteVariableReferences(href, document, WMLVariableEscapingEscape)); if (url.isEmpty()) return; storeVariableState(pageState); // Stop the timer of the current card if it is active if (WMLTimerElement* eventTimer = card->eventTimer()) eventTimer->stop(); // FIXME: 'newcontext' handling not implemented for external cards bool inSameDeck = document->url().path() == url.path(); if (inSameDeck && url.hasFragmentIdentifier()) { if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(document, url.fragmentIdentifier())) { if (card->isNewContext()) pageState->reset(); } } // Prepare loading the destination url ResourceRequest request(url); if (getAttribute(sendrefererAttr) == "true") request.setHTTPReferrer(loader->outgoingReferrer()); String cacheControl = getAttribute(cache_controlAttr); if (m_formAttributes.method() == FormSubmission::PostMethod) preparePOSTRequest(request, inSameDeck, cacheControl); else prepareGETRequest(request, url); // Set HTTP cache-control header if needed if (!cacheControl.isEmpty()) { request.setHTTPHeaderField("cache-control", cacheControl); if (cacheControl == "no-cache") request.setCachePolicy(ReloadIgnoringCacheData); } loader->load(request, false); }