bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow) { WebKit::WebGraphicsContext3D::Attributes webAttributes; webAttributes.alpha = attrs.alpha; webAttributes.depth = attrs.depth; webAttributes.stencil = attrs.stencil; webAttributes.antialias = attrs.antialias; webAttributes.premultipliedAlpha = attrs.premultipliedAlpha; webAttributes.canRecoverFromContextLoss = attrs.canRecoverFromContextLoss; webAttributes.noExtensions = attrs.noExtensions; OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitClient()->createGraphicsContext3D()); if (!webContext) return false; Chrome* chrome = static_cast<Chrome*>(hostWindow); m_webViewImpl = static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()); if (!m_webViewImpl) return false; if (!webContext->initialize(webAttributes, m_webViewImpl, renderDirectlyToHostWindow)) return false; m_impl = webContext.release(); #if USE(ACCELERATED_COMPOSITING) m_compositingLayer = WebGLLayerChromium::create(0); #endif return true; }
void TestChromeBookmarks::itShouldGracefullyExitWhenFileIsNotFound() { FakeFindProfile finder(QList<Profile>() << Profile("FileNotExisting.json", NULL)); Chrome *chrome = new Chrome(&finder, this); chrome->prepare(); QCOMPARE(chrome->match("any", true).size(), 0); }
void TestChromeBookmarks::itShouldFindOnlyMatches() { Chrome *chrome = new Chrome(m_findBookmarksInCurrentDirectory.data(), this); chrome->prepare(); QList<BookmarkMatch> matches = chrome->match("other", false); QCOMPARE(matches.size(), 1); verifyMatch(matches[0], "bookmark in other bookmarks", "http://otherbookmarks.com/", 0.45, QueryMatch::PossibleMatch); }
void TestChromeBookmarks::itShouldClearResultAfterCallingTeardown() { Chrome *chrome = new Chrome(m_findBookmarksInCurrentDirectory.data(), this); chrome->prepare(); QCOMPARE(chrome->match("any", true).size(), 3); chrome->teardown(); QCOMPARE(chrome->match("any", true).size(), 0); }
void TestChromeBookmarks::itShouldFindAllBookmarks() { Chrome *chrome = new Chrome(m_findBookmarksInCurrentDirectory.data(), this); chrome->prepare(); QList<BookmarkMatch> matches = chrome->match("any", true); QCOMPARE(matches.size(), 3); verifyMatch(matches[0], "some bookmark in bookmark bar", "http://somehost.com/", 0.18, QueryMatch::PossibleMatch); verifyMatch(matches[1], "bookmark in other bookmarks", "http://otherbookmarks.com/", 0.18, QueryMatch::PossibleMatch); verifyMatch(matches[2], "bookmark in somefolder", "http://somefolder.com/", 0.18, QueryMatch::PossibleMatch); }
void CalendarPickerElement::closePopup() { if (!m_popup) return; if (!document()->page()) return; Chrome* chrome = document()->page()->chrome(); if (!chrome) return; chrome->client()->closePagePopup(m_popup); }
static inline GtkWidget* widgetFromFrame(Frame* frame) { ASSERT(frame); Page* page = frame->page(); ASSERT(page); Chrome* chrome = page->chrome(); ASSERT(chrome); PlatformPageClient client = chrome->platformPageClient(); ASSERT(client); return client; }
void CalendarPickerElement::openPopup() { if (m_popup) return; if (!document()->page()) return; Chrome* chrome = document()->page()->chrome(); if (!chrome) return; if (!document()->view()) return; IntRect elementRectInRootView = document()->view()->contentsToRootView(hostInput()->getPixelSnappedRect()); m_popup = chrome->client()->openPagePopup(this, elementRectInRootView); }
void ColorInputType::handleDOMActivateEvent(Event* event) { if (element()->isDisabledFormControl() || !element()->renderer()) return; if (!ScriptController::processingUserGesture()) return; Chrome* chrome = this->chrome(); if (chrome && !m_chooser) m_chooser = chrome->createColorChooser(this, valueAsColor()); event->setDefaultHandled(); }
void TestChromeBookmarks::itShouldFindBookmarksFromAllProfiles() { FakeFindProfile findBookmarksFromAllProfiles(QList<Profile>() << Profile("chrome-config-home/Chrome-Bookmarks-Sample.json", new FallbackFavicon(this)) << Profile("chrome-config-home/Chrome-Bookmarks-SecondProfile.json", new FallbackFavicon(this)) ); Chrome *chrome = new Chrome(&findBookmarksFromAllProfiles, this); chrome->prepare(); QList<BookmarkMatch> matches = chrome->match("any", true); QCOMPARE(matches.size(), 4); verifyMatch(matches[0], "some bookmark in bookmark bar", "http://somehost.com/", 0.18, QueryMatch::PossibleMatch); verifyMatch(matches[1], "bookmark in other bookmarks", "http://otherbookmarks.com/", 0.18, QueryMatch::PossibleMatch); verifyMatch(matches[2], "bookmark in somefolder", "http://somefolder.com/", 0.18, QueryMatch::PossibleMatch); verifyMatch(matches[3], "bookmark in secondProfile", "http://secondprofile.com/", 0.18, QueryMatch::PossibleMatch); }
void PickerIndicatorElement::openPopup() { if (m_chooser) return; if (!document()->page()) return; if (!m_pickerIndicatorOwner) return; Chrome* chrome = document()->page()->chrome(); if (!chrome) return; DateTimeChooserParameters parameters; if (!m_pickerIndicatorOwner->setupDateTimeChooserParameters(parameters)) return; m_chooser = chrome->openDateTimeChooser(this, parameters); }
void FileInputType::requestIcon(const Vector<String>& paths) { if (!paths.size()) return; Chrome* chrome = this->chrome(); if (!chrome) return; if (m_fileIconLoader) m_fileIconLoader->invalidate(); m_fileIconLoader = FileIconLoader::create(this); chrome->loadIconForFiles(paths, m_fileIconLoader.get()); }
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { // If the webview has a custom palette, use it if (!m_page) return; Chrome* chrome = m_page->chrome(); if (!chrome) return; ChromeClient* chromeClient = chrome->client(); if (!chromeClient) return; QWebPageClient* pageClient = chromeClient->platformPageClient(); if (!pageClient) return; palette = pageClient->palette(); }
PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle, ThreadUsage threadUsage) { Chrome* chrome = static_cast<Chrome*>(hostWindow); WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0; if (threadUsage == ForUseOnThisThread && !webContext->makeContextCurrent()) return 0; OwnPtr<GraphicsContext3DPrivate> priv = GraphicsContext3DPrivate::create(webViewImpl, webContext, attrs); if (!priv) return 0; bool renderDirectlyToHostWindow = renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow; RefPtr<GraphicsContext3D> result = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderDirectlyToHostWindow)); result->m_private = priv.release(); return result.release(); }
void BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent(Event*) { if (element()->isDisabledOrReadOnly() || !element()->renderer() || !ScriptController::processingUserGesture()) return; if (m_dateTimeChooser) return; if (!element()->document()->page()) return; Chrome* chrome = element()->document()->page()->chrome(); if (!chrome) return; DateTimeChooserParameters parameters; if (!element()->setupDateTimeChooserParameters(parameters)) return; m_dateTimeChooser = chrome->openDateTimeChooser(this, parameters); }
void FileInputType::receiveDropForDirectoryUpload(const Vector<String>& paths) { Chrome* chrome = this->chrome(); if (!chrome) return; FileChooserSettings settings; HTMLInputElement* input = element(); settings.allowsDirectoryUpload = true; settings.allowsMultipleFiles = true; settings.selectedFiles.append(paths[0]); settings.acceptMIMETypes = input->acceptMIMETypes(); settings.acceptFileExtensions = input->acceptFileExtensions(); applyFileChooserSettings(settings); chrome->enumerateChosenDirectory(m_fileChooser); }
void FileInputType::requestIcon(const Vector<String>& paths) { #if PLATFORM(IOS) UNUSED_PARAM(paths); #else if (!paths.size()) return; Chrome* chrome = this->chrome(); if (!chrome) return; if (m_fileIconLoader) m_fileIconLoader->invalidate(); m_fileIconLoader = std::make_unique<FileIconLoader>(static_cast<FileIconLoaderClient&>(*this)); chrome->loadIconForFiles(paths, m_fileIconLoader.get()); #endif }
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { #if USE(QT_MOBILE_THEME) static QPalette lightGrayPalette(Qt::lightGray); palette = lightGrayPalette; return; #endif // If the webview has a custom palette, use it if (!m_page) return; Chrome* chrome = m_page->chrome(); if (!chrome) return; ChromeClient* chromeClient = chrome->client(); if (!chromeClient) return; QWebPageClient* pageClient = chromeClient->platformPageClient(); if (!pageClient) return; palette = pageClient->palette(); }
void TestChromeBookmarks::itShouldFindNothingWhenPrepareIsNotCalled() { Chrome *chrome = new Chrome(m_findBookmarksInCurrentDirectory.data(), this); QCOMPARE(chrome->match("any", true).size(), 0); }