Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(browser): introduce quadrant rendering #120

Merged
merged 36 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3689410
feat(browser): introduce quadrant rendering
fathyb Feb 12, 2023
9dbe75e
update skia patches
fathyb Feb 12, 2023
2db20b9
add Wno-extra-semi
fathyb Feb 12, 2023
2524063
fix linux build
fathyb Feb 12, 2023
face9b6
fix linux again
fathyb Feb 12, 2023
33dff60
fix rename
fathyb Feb 12, 2023
44a9172
fix build
fathyb Feb 12, 2023
7922f85
fix if
fathyb Feb 12, 2023
f960903
fix macos deploy target
fathyb Feb 12, 2023
5740133
try smth
fathyb Feb 12, 2023
da71db5
use current_cpu instead of target_cpu
fathyb Feb 12, 2023
e511306
add blink bridge
fathyb Feb 12, 2023
b136368
refactor bridge
fathyb Feb 13, 2023
198c51d
fix renderer build
fathyb Feb 13, 2023
3b9c761
fix linux build
fathyb Feb 13, 2023
c98ec8e
Move bridge rework
fathyb Feb 13, 2023
537a73e
fix patches
fathyb Feb 13, 2023
e950bc4
tune chromium build concurrency
fathyb Feb 13, 2023
e5483ed
disable -j4
fathyb Feb 13, 2023
f430928
fix fetch check
fathyb Feb 13, 2023
d112286
faster checkout
fathyb Feb 13, 2023
759a2b1
fix
fathyb Feb 13, 2023
a829253
docker publish
fathyb Feb 13, 2023
de2259e
fix ci config
fathyb Feb 13, 2023
5bbe9a8
add carbonyl-publish tag
fathyb Feb 13, 2023
8f5a977
fix docker triple
fathyb Feb 13, 2023
b3adb75
npm publish
fathyb Feb 14, 2023
e104db3
fixes
fathyb Feb 14, 2023
8b676f4
optional depot tools
fathyb Feb 14, 2023
f31702e
fix if
fathyb Feb 14, 2023
181d539
fix
fathyb Feb 14, 2023
34cf169
wrap up
fathyb Feb 14, 2023
bacf3db
fix pkg
fathyb Feb 14, 2023
22cf0e0
real wrap up
fathyb Feb 14, 2023
336bd54
fix npm publish
fathyb Feb 14, 2023
f69570b
default branch
fathyb Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
421 changes: 235 additions & 186 deletions .refloat/config.js

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,15 @@ RUN groupadd -r carbonyl && \
mkdir -p /carbonyl/data && \
chown -R carbonyl:carbonyl /carbonyl && \
apt-get update && \
apt-get install -y \
libasound2 libatk-bridge2.0-0 libatk1.0-0 libatomic1 libatspi2.0-0 \
libbrotli1 libc6 libcairo2 libcups2 libdbus-1-3 libdouble-conversion3 \
libdrm2 libevent-2.1-7 libexpat1 libflac8 libfontconfig1 libfreetype6 \
libgbm1 libgcc-s1 libglib2.0-0 libjpeg62-turbo libjsoncpp24 liblcms2-2 \
libminizip1 libnspr4 libnss3 libopenjp2-7 libopus0 libpango-1.0-0 \
libpng16-16 libpulse0 libre2-9 libsnappy1v5 libstdc++6 libwebp6 \
libwebpdemux2 libwebpmux3 libwoff1 libx11-6 libxcb1 libxcomposite1 \
libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxml2 libxnvctrl0 \
libxrandr2 libxslt1.1 zlib1g libgtk-3-0 && \
apt-get install -y libasound2 libexpat1 libfontconfig1 libnss3 && \
rm -rf /var/lib/apt/lists/*

USER carbonyl
VOLUME /carbonyl/data
ENV HOME=/carbonyl/data

COPY . /carbonyl

RUN /carbonyl/carbonyl --version

ENTRYPOINT ["/carbonyl/carbonyl", "--no-sandbox", "--disable-dev-shm-usage", "--user-data-dir=/carbonyl/data"]
5 changes: 1 addition & 4 deletions chromium/patches/chromium/0001-Add-Carbonyl-library.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0ed9a390f25d73492ce1170ce229b95772fd458d Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:20:50 +0100
Subject: [PATCH 1/9] Add Carbonyl library
Subject: [PATCH 01/14] Add Carbonyl library

---
carbonyl/build | 1 +
Expand Down Expand Up @@ -66,6 +66,3 @@ index bfae1e3290de0..8018111ed9898 100644

if (!headless_use_embedded_resources) {
data = [
--
2.38.1

5 changes: 1 addition & 4 deletions chromium/patches/chromium/0002-Add-Carbonyl-service.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 795b29828fd7ac95548c4dcab483cbc3b6c1d361 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:21:59 +0100
Subject: [PATCH 2/9] Add Carbonyl service
Subject: [PATCH 02/14] Add Carbonyl service

---
cc/trees/layer_tree_host.cc | 21 ++
Expand Down Expand Up @@ -637,6 +637,3 @@ index 089a11b156ade..dfdc79eacce3b 100644
ShapeResultBloberizer::FillGlyphsNG bloberizer(
GetFontDescription(), device_scale_factor > 1.0f, text_info.text,
text_info.from, text_info.to, text_info.shape_result,
--
2.38.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From eea9662f4ba08a655057143d320e4e692fd92469 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:24:29 +0100
Subject: [PATCH 3/9] Setup shared software rendering surface
Subject: [PATCH 03/14] Setup shared software rendering surface

---
components/viz/host/host_display_client.cc | 4 +++-
Expand Down Expand Up @@ -224,6 +224,3 @@ index 50cea82c6b477..f024e6013bfb9 100644
// The root of the Layer tree drawn by this compositor.
raw_ptr<Layer> root_layer_ = nullptr;

--
2.38.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c960c9b1f7ef3f16b27e4eaa4896e3563c88ea91 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:27:27 +0100
Subject: [PATCH 4/9] Setup browser default settings
Subject: [PATCH 04/14] Setup browser default settings

---
headless/public/headless_browser.cc | 4 ++--
Expand Down Expand Up @@ -46,6 +46,3 @@ index 48efaa7d57ca2..afc0236147519 100644

// Whether or not BeginFrames will be issued over DevTools protocol
// (experimental).
--
2.38.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 481ff19118891fe65e80b8be0e1f4498874d3b56 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:28:35 +0100
Subject: [PATCH 5/9] Remove some debug assertions
Subject: [PATCH 05/14] Remove some debug assertions

---
.../browser/web_contents/web_contents_impl.cc | 1 -
Expand Down Expand Up @@ -124,6 +124,3 @@ index 2518b71275670..3a1b8e6646c43 100644
}

void GraphicsContext::CopyConfigFrom(GraphicsContext& other) {
--
2.38.1

67 changes: 46 additions & 21 deletions chromium/patches/chromium/0006-Setup-display-DPI.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
From 5693445bf736c51d3255c10115767ba8886d68da Mon Sep 17 00:00:00 2001
From cc9c37adb3ad2613a114bd37e1fde43f83951d88 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:29:34 +0100
Subject: [PATCH 6/9] Setup display DPI
Date: Sun, 12 Feb 2023 01:00:43 +0100
Subject: [PATCH 06/14] Setup display DPI

---
.../lib/browser/headless_browser_impl_aura.cc | 9 +---
headless/lib/browser/headless_screen.cc | 2 +-
ui/display/display.cc | 50 +++++++++----------
3 files changed, 28 insertions(+), 33 deletions(-)
.../lib/browser/headless_browser_impl_aura.cc | 11 ++--
headless/lib/browser/headless_screen.cc | 5 +-
ui/display/display.cc | 52 ++++++++++---------
3 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/headless/lib/browser/headless_browser_impl_aura.cc b/headless/lib/browser/headless_browser_impl_aura.cc
index 81261215c702f..b8eb5fc429a2a 100644
index 81261215c702f..508660db32151 100644
--- a/headless/lib/browser/headless_browser_impl_aura.cc
+++ b/headless/lib/browser/headless_browser_impl_aura.cc
@@ -57,13 +57,8 @@ void HeadlessBrowserImpl::PlatformSetWebContentsBounds(
@@ -19,6 +19,8 @@
#include "ui/events/devices/device_data_manager.h"
#include "ui/gfx/geometry/rect.h"

+#include "carbonyl/src/browser/bridge.h"
+
namespace headless {

void HeadlessBrowserImpl::PlatformInitialize() {
@@ -57,13 +59,8 @@ void HeadlessBrowserImpl::PlatformSetWebContentsBounds(
const gfx::Rect& bounds) {
// Browser's window bounds should contain all web contents, so that we're sure
// that we will actually produce visible damage when taking a screenshot.
Expand All @@ -24,29 +33,48 @@ index 81261215c702f..b8eb5fc429a2a 100644
- std::max(old_host_bounds.height(), bounds.y() + bounds.height()));
- web_contents->window_tree_host()->SetBoundsInPixels(new_host_bounds);
- web_contents->window_tree_host()->window()->SetBounds(new_host_bounds);
+ web_contents->window_tree_host()->SetBoundsInPixels(ScaleToEnclosedRect(bounds, 1.0 / 7.0));
+ web_contents->window_tree_host()->SetBoundsInPixels(ScaleToEnclosedRect(bounds, carbonyl::Renderer::GetDPI()));
+ web_contents->window_tree_host()->window()->SetBounds(bounds);

gfx::NativeView native_view = web_contents->web_contents()->GetNativeView();
native_view->SetBounds(bounds);
diff --git a/headless/lib/browser/headless_screen.cc b/headless/lib/browser/headless_screen.cc
index 28f1a65f6dce5..e595735be187b 100644
index 28f1a65f6dce5..8bf00ef5e036a 100644
--- a/headless/lib/browser/headless_screen.cc
+++ b/headless/lib/browser/headless_screen.cc
@@ -49,7 +49,7 @@ display::Display HeadlessScreen::GetDisplayNearestWindow(
@@ -13,6 +13,8 @@
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/native_widget_types.h"

+#include "carbonyl/src/browser/bridge.h"
+
namespace headless {

// static
@@ -49,7 +51,8 @@ display::Display HeadlessScreen::GetDisplayNearestWindow(
HeadlessScreen::HeadlessScreen(const gfx::Rect& screen_bounds) {
static int64_t synthesized_display_id = 2000;
display::Display display(synthesized_display_id++);
- display.SetScaleAndBounds(1.0f, screen_bounds);
+ display.SetScaleAndBounds(1.0f / 7.0, ScaleToEnclosedRect(screen_bounds, 1.0 / 7.0));
+ float dpi = carbonyl::Renderer::GetDPI();
+ display.SetScaleAndBounds(dpi, ScaleToEnclosedRect(screen_bounds, dpi));
ProcessDisplayChanged(display, true /* is_primary */);
}

diff --git a/ui/display/display.cc b/ui/display/display.cc
index 466ef1fd1fe6e..cb503dc5cda0f 100644
index 466ef1fd1fe6e..1d71f3b4c9857 100644
--- a/ui/display/display.cc
+++ b/ui/display/display.cc
@@ -39,22 +39,22 @@ float g_forced_device_scale_factor = -1.0;
@@ -21,6 +21,8 @@
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/icc_profile.h"

+#include "carbonyl/src/browser/bridge.h"
+
namespace display {
namespace {

@@ -39,22 +41,22 @@ float g_forced_device_scale_factor = -1.0;
constexpr float kDisplaySizeAllowanceEpsilon = 0.01f;

bool HasForceDeviceScaleFactorImpl() {
Expand Down Expand Up @@ -78,11 +106,11 @@ index 466ef1fd1fe6e..cb503dc5cda0f 100644
+ // scale_in_double = 1.0;
+ // }
+ // }
+ return 1.0 / 7.0;
+ return carbonyl::Bridge::GetCurrent()->GetDPI();
}

const char* ToRotationString(display::Display::Rotation rotation) {
@@ -97,11 +97,11 @@ void Display::ResetForceDeviceScaleFactorForTesting() {
@@ -97,11 +99,11 @@ void Display::ResetForceDeviceScaleFactorForTesting() {
// static
void Display::SetForceDeviceScaleFactor(double dsf) {
// Reset any previously set values and unset the flag.
Expand All @@ -98,7 +126,7 @@ index 466ef1fd1fe6e..cb503dc5cda0f 100644
}

// static
@@ -273,15 +273,15 @@ void Display::SetScaleAndBounds(float device_scale_factor,
@@ -273,15 +275,15 @@ void Display::SetScaleAndBounds(float device_scale_factor,
}

void Display::SetScale(float device_scale_factor) {
Expand All @@ -122,6 +150,3 @@ index 466ef1fd1fe6e..cb503dc5cda0f 100644
}

void Display::SetSize(const gfx::Size& size_in_pixel) {
--
2.38.1

7 changes: 2 additions & 5 deletions chromium/patches/chromium/0007-Disable-text-effects.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5557ea65c9769fd0f99bd1f8eb58b05634f9faa2 Mon Sep 17 00:00:00 2001
From 022ed4d808369659eab4e83cd677eb974215c58c Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:31:17 +0100
Subject: [PATCH 7/9] Disable text effects
Subject: [PATCH 07/14] Disable text effects

---
.../core/paint/ng/ng_text_painter_base.cc | 30 ++++++++--------
Expand Down Expand Up @@ -108,6 +108,3 @@ index 67fbf128ea158..a645ba61c8597 100644
}

StyleIterator::StyleIterator(const BreakList<SkColor>* colors,
--
2.38.1

7 changes: 2 additions & 5 deletions chromium/patches/chromium/0008-Fix-text-layout.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1820cd34967c756d2459f4a2894492662edbf58b Mon Sep 17 00:00:00 2001
From 7b1f72900f704ffecc48c66da7ccd6de205b88f7 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:32:14 +0100
Subject: [PATCH 8/9] Fix text layout
Subject: [PATCH 08/14] Fix text layout

---
.../core/css/resolver/style_resolver.cc | 17 ++++++++++++++++-
Expand Down Expand Up @@ -42,6 +42,3 @@ index 6207b72d17cb9..79cb8c85b697f 100644
state.LoadPendingResources();

// Now return the style.
--
2.38.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0697c3ab8f52592b0a0d4241e2938b8e622a01f6 Mon Sep 17 00:00:00 2001
From 792e123bb57b1b379b0367b2568302e2cb0dc3c9 Mon Sep 17 00:00:00 2001
From: Fathy Boundjadj <[email protected]>
Date: Thu, 9 Feb 2023 03:32:30 +0100
Subject: [PATCH 9/9] Bridge browser into Carbonyl library
Subject: [PATCH 09/14] Bridge browser into Carbonyl library

---
headless/app/headless_shell.cc | 33 +-
Expand Down Expand Up @@ -645,6 +645,3 @@ index b80147fd06be8..09773596aa5ce 100644

content::WebContents* web_contents() const;
bool OpenURL(const GURL& url);
--
2.38.1

Loading