mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 05:08:56 +00:00
Instead of having an annoying loop that constantly reschedules a Core::EventLoop trigger, have the ALooperEventLoopManager do it itself in the did_post_event() function. We cannot simply re-use the Unix implementation directly because that implementation expects to actually be called all the time in order to service timers. If you don't call its' pump() method, timers do not get triggered. So, we do still need the seconary thread for Timers that was added earlier.
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Userland/Libraries/LibWebView/ViewImplementation.h>
|
|
#include <android/bitmap.h>
|
|
#include <jni.h>
|
|
|
|
namespace Ladybird {
|
|
class WebViewImplementationNative : public WebView::ViewImplementation {
|
|
public:
|
|
WebViewImplementationNative(jobject thiz);
|
|
|
|
virtual Gfx::IntRect viewport_rect() const override { return m_viewport_rect; }
|
|
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint p) const override { return p; }
|
|
virtual Gfx::IntPoint to_widget_position(Gfx::IntPoint p) const override { return p; }
|
|
virtual void update_zoom() override { }
|
|
|
|
NonnullRefPtr<WebView::WebContentClient> bind_web_content_client();
|
|
|
|
virtual void create_client(WebView::EnableCallgrindProfiling) override;
|
|
|
|
void paint_into_bitmap(void* android_bitmap_raw, AndroidBitmapInfo const& info);
|
|
|
|
void set_viewport_geometry(int w, int h);
|
|
void set_device_pixel_ratio(float f);
|
|
|
|
static jclass global_class_reference;
|
|
static jmethodID bind_webcontent_method;
|
|
static jmethodID invalidate_layout_method;
|
|
|
|
jobject java_instance() const { return m_java_instance; }
|
|
|
|
private:
|
|
jobject m_java_instance = nullptr;
|
|
Gfx::IntRect m_viewport_rect;
|
|
};
|
|
}
|