-
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(browser): introduce quadrant rendering
- Loading branch information
Showing
38 changed files
with
1,346 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] Add Carbonyl library | ||
|
||
--- | ||
carbonyl/build | 1 + | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] Add Carbonyl service | ||
|
||
--- | ||
cc/trees/layer_tree_host.cc | 21 ++ | ||
|
2 changes: 1 addition & 1 deletion
2
chromium/patches/chromium/0003-Setup-shared-software-rendering-surface.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] Setup shared software rendering surface | ||
|
||
--- | ||
components/viz/host/host_display_client.cc | 4 +++- | ||
|
2 changes: 1 addition & 1 deletion
2
chromium/patches/chromium/0004-Setup-browser-default-settings.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] Setup browser default settings | ||
|
||
--- | ||
headless/public/headless_browser.cc | 4 ++-- | ||
|
2 changes: 1 addition & 1 deletion
2
chromium/patches/chromium/0005-Remove-some-debug-assertions.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] Remove some debug assertions | ||
|
||
--- | ||
.../browser/web_contents/web_contents_impl.cc | 1 - | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/11] 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. | ||
|
@@ -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() { | ||
|
@@ -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. | ||
|
@@ -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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 5557ea65c9769fd0f99bd1f8eb58b05634f9faa2 Mon Sep 17 00:00:00 2001 | ||
From 4f9316128dc474b9b52d3023e1181432231106ec 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/11] Disable text effects | ||
|
||
--- | ||
.../core/paint/ng/ng_text_painter_base.cc | 30 ++++++++-------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 1820cd34967c756d2459f4a2894492662edbf58b Mon Sep 17 00:00:00 2001 | ||
From b858ee163b525247e3fb7fdb2449b75c2df055fa 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/11] Fix text layout | ||
|
||
--- | ||
.../core/css/resolver/style_resolver.cc | 17 ++++++++++++++++- | ||
|
4 changes: 2 additions & 2 deletions
4
chromium/patches/chromium/0009-Bridge-browser-into-Carbonyl-library.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 0697c3ab8f52592b0a0d4241e2938b8e622a01f6 Mon Sep 17 00:00:00 2001 | ||
From 5ced1635901a8fa649f9a534e82babb5a956d920 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/11] Bridge browser into Carbonyl library | ||
|
||
--- | ||
headless/app/headless_shell.cc | 33 +- | ||
|
140 changes: 140 additions & 0 deletions
140
chromium/patches/chromium/0010-Conditionally-enable-text-rendering.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
From 987c9c05601339bfff2bab0ddcfc7a04208b6c93 Mon Sep 17 00:00:00 2001 | ||
From: Fathy Boundjadj <[email protected]> | ||
Date: Sun, 12 Feb 2023 00:55:33 +0100 | ||
Subject: [PATCH 10/11] Conditionally enable text rendering | ||
|
||
--- | ||
content/renderer/render_frame_impl.cc | 3 ++- | ||
.../core/css/resolver/style_resolver.cc | 26 +++++++++++-------- | ||
third_party/blink/renderer/platform/BUILD.gn | 1 + | ||
.../blink/renderer/platform/fonts/font.cc | 10 +++---- | ||
4 files changed, 23 insertions(+), 17 deletions(-) | ||
|
||
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc | ||
index 97b61ffb954be..891efd6a9d796 100644 | ||
--- a/content/renderer/render_frame_impl.cc | ||
+++ b/content/renderer/render_frame_impl.cc | ||
@@ -259,6 +259,7 @@ | ||
// Carbonyl | ||
#include <stdlib.h> | ||
#include <iostream> | ||
+#include "carbonyl/src/browser/bridge.h" | ||
#include "cc/paint/paint_recorder.h" | ||
#include "cc/paint/skia_paint_canvas.h" | ||
#include "cc/raster/playback_image_provider.h" | ||
@@ -2221,7 +2222,7 @@ void RenderFrameImpl::Initialize(blink::WebFrame* parent) { | ||
|
||
render_callback_ = std::make_shared<std::function<bool()>>( | ||
[=]() -> bool { | ||
- if (!IsMainFrame() || IsHidden()) { | ||
+ if (!IsMainFrame() || IsHidden() || carbonyl::Bridge::BitmapMode()) { | ||
return false; | ||
} | ||
|
||
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/third_party/blink/renderer/core/css/resolver/style_resolver.cc | ||
index 79cb8c85b697f..7129982acf4a6 100644 | ||
--- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc | ||
+++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc | ||
@@ -116,6 +116,8 @@ | ||
#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" | ||
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" | ||
|
||
+#include "carbonyl/src/browser/bridge.h" | ||
+ | ||
namespace blink { | ||
|
||
namespace { | ||
@@ -1041,18 +1043,20 @@ scoped_refptr<ComputedStyle> StyleResolver::ResolveStyle( | ||
UseCounter::Count(GetDocument(), WebFeature::kHasGlyphRelativeUnits); | ||
} | ||
|
||
- auto font = state.StyleBuilder().GetFontDescription(); | ||
- FontFamily family; | ||
+ if (!carbonyl::Bridge::BitmapMode()) { | ||
+ auto font = state.StyleBuilder().GetFontDescription(); | ||
+ FontFamily family; | ||
|
||
- family.SetFamily("monospace", FontFamily::Type::kGenericFamily); | ||
- font.SetFamily(family); | ||
- font.SetStretch(ExtraExpandedWidthValue()); | ||
- font.SetKerning(FontDescription::kNoneKerning); | ||
- font.SetComputedSize(11.75 / 7.0); | ||
- font.SetGenericFamily(FontDescription::kMonospaceFamily); | ||
- font.SetIsAbsoluteSize(true); | ||
- state.StyleBuilder().SetFontDescription(font); | ||
- state.StyleBuilder().SetLineHeight(Length::Fixed(14.0 / 7.0)); | ||
+ family.SetFamily("monospace", FontFamily::Type::kGenericFamily); | ||
+ font.SetFamily(family); | ||
+ font.SetStretch(ExtraExpandedWidthValue()); | ||
+ font.SetKerning(FontDescription::kNoneKerning); | ||
+ font.SetComputedSize(13.25 / 4.0); | ||
+ font.SetGenericFamily(FontDescription::kMonospaceFamily); | ||
+ font.SetIsAbsoluteSize(true); | ||
+ state.StyleBuilder().SetFontDescription(font); | ||
+ state.StyleBuilder().SetLineHeight(Length::Fixed(16.0 / 4.0)); | ||
+ } | ||
|
||
state.LoadPendingResources(); | ||
|
||
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn | ||
index e7b1c1a52e4c9..63fc13e44b5ae 100644 | ||
--- a/third_party/blink/renderer/platform/BUILD.gn | ||
+++ b/third_party/blink/renderer/platform/BUILD.gn | ||
@@ -1678,6 +1678,7 @@ component("platform") { | ||
"//base/allocator:buildflags", | ||
"//build:chromecast_buildflags", | ||
"//build:chromeos_buildflags", | ||
+ "//carbonyl/src/browser:carbonyl", | ||
"//cc/ipc", | ||
"//cc/mojo_embedder", | ||
"//components/paint_preview/common", | ||
diff --git a/third_party/blink/renderer/platform/fonts/font.cc b/third_party/blink/renderer/platform/fonts/font.cc | ||
index dfdc79eacce3b..4625300729523 100644 | ||
--- a/third_party/blink/renderer/platform/fonts/font.cc | ||
+++ b/third_party/blink/renderer/platform/fonts/font.cc | ||
@@ -49,6 +49,8 @@ | ||
#include "third_party/skia/include/core/SkTextBlob.h" | ||
#include "ui/gfx/geometry/rect_f.h" | ||
|
||
+#include "carbonyl/src/browser/bridge.h" | ||
+ | ||
namespace blink { | ||
|
||
namespace { | ||
@@ -151,14 +153,12 @@ bool Font::operator==(const Font& other) const { | ||
|
||
namespace { | ||
|
||
-static const bool carbonyl_b64_text = true; | ||
- | ||
void DrawBlobs(cc::PaintCanvas* canvas, | ||
const cc::PaintFlags& flags, | ||
const ShapeResultBloberizer::BlobBuffer& blobs, | ||
const gfx::PointF& point, | ||
cc::NodeId node_id = cc::kInvalidNodeId) { | ||
- if (carbonyl_b64_text) { | ||
+ if (!carbonyl::Bridge::BitmapMode()) { | ||
return; | ||
} | ||
|
||
@@ -237,7 +237,7 @@ void Font::DrawText(cc::PaintCanvas* canvas, | ||
if (ShouldSkipDrawing()) | ||
return; | ||
|
||
- if (carbonyl_b64_text) { | ||
+ if (!carbonyl::Bridge::BitmapMode()) { | ||
auto string = StringView( | ||
run_info.run.ToStringView(), | ||
run_info.from, | ||
@@ -285,7 +285,7 @@ void Font::DrawText(cc::PaintCanvas* canvas, | ||
if (ShouldSkipDrawing()) | ||
return; | ||
|
||
- if (carbonyl_b64_text) { | ||
+ if (!carbonyl::Bridge::BitmapMode()) { | ||
auto string = StringView( | ||
text_info.text, | ||
text_info.from, | ||
-- | ||
2.38.1 | ||
|
Oops, something went wrong.