PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKPageRef /* relatedPage */, WKDictionaryRef options) : m_options(options) { WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout")); m_usingFixedLayout = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false; m_window = initEcoreEvas(); m_view = EWKViewCreate(context, pageGroup, ecore_evas_get(m_window), /* smart */ 0); WKPageSetUseFixedLayout(WKViewGetPage(EWKViewGetWKView(m_view)), m_usingFixedLayout); if (m_usingFixedLayout) resizeTo(800, 600); ewk_view_theme_set(m_view, TEST_THEME_DIR "/default.edj"); m_windowIsKey = false; evas_object_show(m_view); }
PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const TestOptions& options) : m_options(options) { WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout")); m_usingFixedLayout = options.useFixedLayout; m_window = initEcoreEvas(); WKContextRef context = WKPageConfigurationGetContext(configuration); m_view = EWKViewCreate(context, configuration, ecore_evas_get(m_window), /* smart */ 0); WKPageSetUseFixedLayout(WKViewGetPage(EWKViewGetWKView(m_view)), m_usingFixedLayout); if (m_usingFixedLayout) resizeTo(800, 600); ewk_view_theme_set(m_view, DEFAULT_THEME_DIR "/default.edj"); m_windowIsKey = false; evas_object_show(m_view); }
bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const { WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout")); return m_usingFixedLayout == (options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false); }