Exemplo n.º 1
0
int screenDepthPerComponent(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return 0;
    return hostWindow->screenInfo().depthPerComponent;
}
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
	_In_opt_ HINSTANCE hPrevInstance,
	_In_ LPWSTR    lpCmdLine,
	_In_ int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	BoilerplateInit();

	g_window.Setup();
	g_host.Setup();

	// center and show window
	g_window.CenterTopLevelWindow();
	ShowWindow(g_window.m_wnd, TRUE);

	MSG msg;
	while(GetMessage(&msg, nullptr, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}
static PangoLayout* getPangoLayoutForAtk(AtkText* textObject)
{
    AccessibilityObject* coreObject = core(textObject);

    HostWindow* hostWindow = coreObject->document()->view()->hostWindow();
    if (!hostWindow)
        return 0;
    PlatformPageClient webView = hostWindow->platformPageClient();
    if (!webView)
        return 0;

    GString* str = g_string_new(NULL);

    AccessibilityRenderObject* accObject = static_cast<AccessibilityRenderObject*>(coreObject);
    if (!accObject)
        return 0;
    RenderText* renderText = toRenderText(accObject->renderer());
    if (!renderText)
        return 0;

    // Create a string with the layout as it appears on the screen
    InlineTextBox* box = renderText->firstTextBox();
    while (box) {
        gchar *text = convertUniCharToUTF8(renderText->characters(), renderText->textLength(), box->start(), box->end());
        g_string_append(str, text);
        g_string_append(str, "\n");
        box = box->nextTextBox();
    }

    PangoLayout* layout = gtk_widget_create_pango_layout(static_cast<GtkWidget*>(webView), g_string_free(str, FALSE));
    g_object_set_data_full(G_OBJECT(textObject), "webkit-accessible-pango-layout", layout, g_object_unref);
    return layout;
}
Exemplo n.º 4
0
WebScreenOrientationType screenOrientationType(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return WebScreenOrientationUndefined;
    return hostWindow->screenInfo().orientationType;
}
Exemplo n.º 5
0
static AtkObject* atkParentOfRootObject(AtkObject* object)
{
    AccessibilityObject* coreObject = core(object);
    AccessibilityObject* coreParent = coreObject->parentObjectUnignored();

    // The top level object claims to not have a parent. This makes it
    // impossible for assistive technologies to ascend the accessible
    // hierarchy all the way to the application. (Bug 30489)
    if (!coreParent && isRootObject(coreObject)) {
        Document* document = coreObject->document();
        if (!document)
            return 0;

#if PLATFORM(GTK)
        HostWindow* hostWindow = document->view()->hostWindow();
        if (hostWindow) {
            PlatformPageClient scrollView = hostWindow->platformPageClient();
            if (scrollView) {
                GtkWidget* scrollViewParent = gtk_widget_get_parent(scrollView);
                if (scrollViewParent)
                    return gtk_widget_get_accessible(scrollViewParent);
            }
        }
#endif // PLATFORM(GTK)
    }

    if (!coreParent)
        return 0;

    return coreParent->wrapper();
}
Exemplo n.º 6
0
uint16_t screenOrientationAngle(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return 0;
    return hostWindow->screenInfo().orientationAngle;
}
Exemplo n.º 7
0
FloatRect screenAvailableRect(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return FloatRect();
    return IntRect(hostWindow->screenInfo().availableRect);
}
Exemplo n.º 8
0
bool screenIsMonochrome(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return false;
    return hostWindow->screenInfo().isMonochrome;
}
Exemplo n.º 9
0
void IpcClientHost::onMessageReceived(const PIpcMessage& msg)
{
	if (msg.routing_id() != MSG_ROUTING_CONTROL) {
		// ROUTED MESSAGE, forward it to the correct host window
		HostWindow* win = static_cast<HostWindow*>(findWindow(msg.routing_id()));
		if (!win) {
			return;
		}
		win->onMessageReceived(msg);
	} else {
		// CONTROL MESSAGE, Handle it here
		bool msgIsOk;

		IPC_BEGIN_MESSAGE_MAP(IpcClientHost, msg, msgIsOk)
			IPC_MESSAGE_HANDLER(View_Host_ReturnedKeyEvent, onReturnedInputEvent)
			IPC_MESSAGE_HANDLER(ViewHost_PrepareAddWindow, onPrepareAddWindow)
			IPC_MESSAGE_HANDLER(ViewHost_AddWindow, onAddWindow)
			IPC_MESSAGE_HANDLER(ViewHost_RemoveWindow, onRemoveWindow)
			IPC_MESSAGE_HANDLER(ViewHost_SetWindowProperties, onSetWindowProperties)
			IPC_MESSAGE_HANDLER(ViewHost_FocusWindow, onFocusWindow)
			IPC_MESSAGE_HANDLER(ViewHost_UnfocusWindow, onUnfocusWindow)
			IPC_MESSAGE_UNHANDLED( g_critical("%s (%d). IPC Message Not Handled: (0x%x : 0x%x : 0x%x)",
											  __PRETTY_FUNCTION__, __LINE__, msg.routing_id(), msg.type(), msg.message_id()));
		IPC_END_MESSAGE_MAP()
	}
}
Exemplo n.º 10
0
int screenDepth(Widget* widget)
{
    HostWindow* hostWindow = toHostWindow(widget);
    if (!hostWindow)
        return 0;
    return hostWindow->screenInfo().depth;
}
Exemplo n.º 11
0
void Sprite::TrackMouseLeave()
{
	HostWindow *wnd = GetHostWindow();
	if (wnd)
	{
		wnd->TrackMouseLeave(this);
	}
}
Exemplo n.º 12
0
QWebPageClient* PluginView::platformPageClient() const
{
    FrameView* view = m_parentFrame->view();
    if (!view)
        return 0;
    HostWindow* hostWindow = view->hostWindow();
    if (!hostWindow)
        return 0;
    return hostWindow->platformPageClient();
}
Exemplo n.º 13
0
TEST(WebViewDestruction, DestroyHostWindow)
{
    COMPtr<IWebView> webView;
    HostWindow window;
    HWND viewWindow;
    createAndInitializeWebView(webView, window, viewWindow);

    DestroyWindow(window.window());

    finishWebViewDestructionTest(webView, viewWindow);
}
Exemplo n.º 14
0
static PlatformPageClient toPlatformPageClient(Widget* widget)
{
    if (!widget)
        return 0;
    ScrollView* root = widget->root();
    if (!root)
        return 0;
    HostWindow* hostWindow = root->hostWindow();
    if (!hostWindow)
        return 0;
    return hostWindow->platformPageClient();
}
Exemplo n.º 15
0
TEST(WebViewDestruction, CloseThenDestroyHostWindow)
{
    COMPtr<IWebView> webView;
    HostWindow window;
    HWND viewWindow;
    createAndInitializeWebView(webView, window, viewWindow);

    TEST_ASSERT(SUCCEEDED(webView->close()));
    DestroyWindow(window.window());

    finishWebViewDestructionTest(webView, viewWindow);
}
Exemplo n.º 16
0
void WebViewDestructionWithHostWindow::SetUp()
{
    WebViewDestruction::SetUp();

    EXPECT_TRUE(m_window.initialize());
    EXPECT_HRESULT_SUCCEEDED(m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_window.window())));
    EXPECT_HRESULT_SUCCEEDED(m_webView->initWithFrame(m_window.clientRect(), 0, 0));

    COMPtr<IWebViewPrivate> viewPrivate(Query, m_webView);
    ASSERT_NOT_NULL(viewPrivate);
    EXPECT_HRESULT_SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&m_viewWindow)));
    EXPECT_TRUE(::IsWindow(m_viewWindow));
}
Exemplo n.º 17
0
void Sprite::Invalidate()
{
	// 0指针访问 不挂是因为x64系统一个bug 记得打开调试中的Win32异常断点
	HostWindow *wnd = GetHostWindow();
	if (wnd)
	{
		RECT rc;
		Gdiplus::RectF rf = GetAbsRect();
		rc.left = (LONG)(rf.GetLeft() - 0.5f);
		rc.top = (LONG)(rf.GetTop() - 0.5f);  // TODO FIXME 这个值是试出来的 不知其所以然
		rc.right = (LONG)(rf.GetRight() + 1.5f); // 缩小窗口TabCtrl会有拖影 这里改成2 就可以消除拖影现象
		rc.bottom = (LONG)(rf.GetBottom() + 1.5f); // 很诡异 可能是因为GdiPlus认为x取大的 width也取大的
		::InvalidateRect(wnd->GetHWND(), &rc, TRUE);
	}
}
Exemplo n.º 18
0
static bool shouldCreateMainFrameScrollbar(const ScrollView* scrollView)
{
    // Interior frame ScrollViews never have MainFrameScrollbars.
    if (scrollView->parent())
        return false;

    // If we don't have a host window or a containing widget (ala WebKit2).
    HostWindow* hostWindow = scrollView->hostWindow();
    if (!hostWindow || !hostWindow->platformPageClient())
        return false;

    gboolean selfScrolling = FALSE;
    g_object_get(hostWindow->platformPageClient(), "self-scrolling", &selfScrolling, NULL);
    return !selfScrolling;
}
Exemplo n.º 19
0
static void createAndInitializeWebView(COMPtr<IWebView>& outWebView, HostWindow& window, HWND& viewWindow)
{
    COMPtr<IWebView> webView;
    TEST_ASSERT(SUCCEEDED(WebKitCreateInstance(__uuidof(WebView), &webView)));

    TEST_ASSERT(window.initialize());
    TEST_ASSERT(SUCCEEDED(webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(window.window()))));
    TEST_ASSERT(SUCCEEDED(webView->initWithFrame(window.clientRect(), 0, 0)));

    COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
    TEST_ASSERT(viewPrivate);
    TEST_ASSERT(SUCCEEDED(viewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))));
    TEST_ASSERT(IsWindow(viewWindow));

    outWebView.adoptRef(webView.releaseRef());
}
static PangoLayout* getPangoLayoutForAtk(AtkText* textObject)
{
    AccessibilityObject* coreObject = core(textObject);

    Document* document = coreObject->document();
    if (!document)
        return 0;

    HostWindow* hostWindow = document->view()->hostWindow();
    if (!hostWindow)
        return 0;
    PlatformPageClient webView = hostWindow->platformPageClient();
    if (!webView)
        return 0;

    // Create a string with the layout as it appears on the screen
    PangoLayout* layout = gtk_widget_create_pango_layout(static_cast<GtkWidget*>(webView), textForObject(coreObject));
    return layout;
}
Exemplo n.º 21
0
void Widget::setCursor(const Cursor& cursor)
{
#if PLATFORM(AMIGAOS4)
    if (!isFrameView())
        return;

    static const Cursor *waitCursorPtr = &waitCursor();
    HostWindow *hostWindow = static_cast<FrameView*>(this)->hostWindow();
    BalWidget *widget = hostWindow ? hostWindow->platformWindow() : 0;
    Window *window = widget ? widget->window : 0;

    if (window)
        if (waitCursorPtr == &cursor && !cursor.impl())
            IIntuition->SetWindowPointer(window, WA_BusyPointer, TRUE, TAG_DONE);
        else if (widget->curentCursor != cursor.impl()) {
            IIntuition->SetWindowPointer(window, WA_Pointer, cursor.impl(), TAG_DONE);
            widget->curentCursor = cursor.impl();
        }
#endif
}
static AtkObject* webkit_accessible_get_parent(AtkObject* object)
{
    AccessibilityObject* coreParent = core(object)->parentObjectUnignored();

    // The top level web view claims to not have a parent. This makes it
    // impossible for assistive technologies to ascend the accessible
    // hierarchy all the way to the application. (Bug 30489)
    if (!coreParent && core(object)->isWebArea()) {
        HostWindow* hostWindow = core(object)->document()->view()->hostWindow();
        if (hostWindow) {
            PlatformPageClient webView = hostWindow->platformPageClient();
            if (webView) {
                GtkWidget* webViewParent = gtk_widget_get_parent(webView);
                if (webViewParent)
                    return gtk_widget_get_accessible(webViewParent);
            }
        }
    }

    if (!coreParent)
        return NULL;

    return coreParent->wrapper();
}