Skip to content

Commit

Permalink
fix: backport fix for zero-size pixels in blink
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Apr 29, 2020
1 parent d8f9044 commit b33938d
Show file tree
Hide file tree
Showing 14 changed files with 214 additions and 69 deletions.
1 change: 1 addition & 0 deletions patches/chromium/.patches
Expand Up @@ -93,3 +93,4 @@ feat_allow_embedders_to_add_observers_on_created_hunspell.patch
feat_enable_offscreen_rendering_with_viz_compositor.patch
when_suspending_context_don_t_clear_handlers.patch
use_keepselfalive_on_audiocontext_to_keep_it_alive_until_rendering.patch
never_let_a_non-zero-size_pixel_snap_to_zero_size.patch
2 changes: 1 addition & 1 deletion patches/chromium/command-ismediakey.patch
Expand Up @@ -97,7 +97,7 @@ index 85378bb565de617b1bd611d28c8714361747a357..d67d558b91b49835dfa9278930939480
}
return VKEY_UNKNOWN;
}
@@ -192,7 +199,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
@@ -192,7 +199,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand Down
2 changes: 1 addition & 1 deletion patches/chromium/disable_compositor_recycling.patch
Expand Up @@ -9,7 +9,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
index 5bec9c5d258c06fe338c8abe3e233e0b9b937234..92d2fa2343d1272dcadfa37c07ed368d18488ef8 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -477,7 +477,11 @@ void RenderWidgetHostViewMac::WasOccluded() {
@@ -477,7 +477,11 @@
return;

host()->WasHidden();
Expand Down
Expand Up @@ -12,7 +12,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
index befe726af9c10b1563a7fc0bb77cc55f65943d5c..bac51f33f35f96fe4ecc764cf5ca887176642f74 100644
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
@@ -39,7 +39,7 @@ GlobalShortcutListenerMac::GlobalShortcutListenerMac()
@@ -39,7 +39,7 @@
// global MediaKeysListener to receive media keys.
if (!content::MediaKeysListenerManager::IsMediaKeysListenerManagerEnabled()) {
media_keys_listener_ = ui::MediaKeysListener::Create(
Expand Down
6 changes: 3 additions & 3 deletions patches/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 2a83d4d8158422c1056725679309c6ced1e531bd..f52934712f8de78193127c426d02982b36e9d422 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -27,7 +27,6 @@ CFTypeID SecKeyGetTypeID();
@@ -27,7 +27,6 @@
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -316,8 +315,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
@@ -316,8 +315,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 2a83d4d8158422c1056725679309c6ced1e531bd..f52934712f8de78193127c426d02982b
return ns_val;
}

@@ -385,9 +383,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
@@ -385,9 +383,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/chromium/mas_blink_no_private_api.patch
Expand Up @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
extern "C" {

// Kill ring calls. Would be better to use NSKillRing.h, but that's not
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
@@ -39,38 +40,53 @@
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index 8f4ae94bc1d8188d041654c50511f3346eee79de..fa06f47abbff3dcda937bf0b794f616e

namespace blink {

@@ -95,10 +97,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
@@ -95,10 +97,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
// behavior change while remaining a fragile solution.
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
if (!use_ns_text_field_cell) {
Expand All @@ -105,7 +105,7 @@ index 8f4ae94bc1d8188d041654c50511f3346eee79de..fa06f47abbff3dcda937bf0b794f616e
return false;
}

@@ -186,10 +190,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
@@ -186,10 +190,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
const IntRect& r) {
ScopedColorSchemeAppearance appearance(style.UsedColorScheme());
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down
16 changes: 8 additions & 8 deletions patches/chromium/mas_disable_custom_window_frame.patch
Expand Up @@ -18,7 +18,7 @@ index 1ffb647e85e00ff60d84234e47f5d7d385f65245..439cc6df5e0cc1ec3732d6f2a2e00d54
@interface NSWindow (PrivateBrowserNativeWidgetAPI)
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
@end
@@ -69,10 +70,13 @@
@@ -69,10 +70,13 @@ - (NSRect)_draggableFrame NS_DEPRECATED_MAC(10_10, 10_11) {

@end

Expand All @@ -32,7 +32,7 @@ index 1ffb647e85e00ff60d84234e47f5d7d385f65245..439cc6df5e0cc1ec3732d6f2a2e00d54
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
// - NSThemeFrame and its subclasses will be nil if it's missing at runtime.
if ([BrowserWindowFrame class])
@@ -87,6 +91,8 @@
@@ -87,6 +91,8 @@ - (BOOL)_usesCustomDrawing {
return NO;
}

Expand All @@ -54,7 +54,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
@interface NSWindow (PrivateAPI)
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
@end
@@ -18,8 +20,12 @@
@@ -18,8 +20,12 @@ - (CGFloat)_titlebarHeight {
}
@end

Expand All @@ -67,7 +67,7 @@ index 8416c7c6e052dafb2aad61c0bd3224c36e945d23..cd356beda023ab2409b16d58ca38c70b
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
if ([NativeWidgetMacFramelessNSWindowFrame class]) {
return [NativeWidgetMacFramelessNSWindowFrame class];
@@ -27,4 +33,6 @@
@@ -27,4 +33,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
return [super frameViewClassForStyleMask:windowStyle];
}

Expand Down Expand Up @@ -108,7 +108,7 @@ index 576ef14c1d67ce7f4a1b2095124d1d302440635c..dd068fc339b80c3e99d89e6d7cc73db8
- (BOOL)hasKeyAppearance;
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
- (BOOL)_isConsideredOpenForPersistentState;
@@ -57,6 +59,8 @@
@@ -57,6 +59,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
}
@end

Expand All @@ -117,7 +117,7 @@ index 576ef14c1d67ce7f4a1b2095124d1d302440635c..dd068fc339b80c3e99d89e6d7cc73db8
@implementation NativeWidgetMacNSWindowTitledFrame
- (void)mouseDown:(NSEvent*)event {
if (self.window.isMovable)
@@ -78,6 +82,8 @@
@@ -78,6 +82,8 @@ - (BOOL)usesCustomDrawing {
}
@end

Expand All @@ -126,7 +126,7 @@ index 576ef14c1d67ce7f4a1b2095124d1d302440635c..dd068fc339b80c3e99d89e6d7cc73db8
@implementation NativeWidgetMacNSWindow {
@private
base::scoped_nsobject<CommandDispatcher> commandDispatcher_;
@@ -159,6 +165,8 @@
@@ -159,6 +165,8 @@ - (BOOL)hasViewsMenuActive {

// NSWindow overrides.

Expand All @@ -135,7 +135,7 @@ index 576ef14c1d67ce7f4a1b2095124d1d302440635c..dd068fc339b80c3e99d89e6d7cc73db8
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
if (windowStyle & NSWindowStyleMaskTitled) {
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
@@ -170,6 +178,8 @@
@@ -170,6 +178,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
return [super frameViewClassForStyleMask:windowStyle];
}

Expand Down
26 changes: 13 additions & 13 deletions patches/chromium/mas_disable_remote_accessibility.patch
Expand Up @@ -10,15 +10,15 @@ diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components
index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209ff3cbfaaa 100644
--- a/components/remote_cocoa/app_shim/application_bridge.mm
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
@@ -49,6 +49,7 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
@@ -49,6 +49,7 @@

// NativeWidgetNSWindowHostHelper:
id GetNativeViewAccessible() override {
+#ifndef MAS_BUILD
if (!remote_accessibility_element_) {
int64_t browser_pid = 0;
std::vector<uint8_t> element_token;
@@ -59,6 +60,9 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
@@ -59,6 +60,9 @@ id GetNativeViewAccessible() override {
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
}
return remote_accessibility_element_.get();
Expand All @@ -28,7 +28,7 @@ index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209f
}
void DispatchKeyEvent(ui::KeyEvent* event) override {
bool event_handled = false;
@@ -96,8 +100,10 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
@@ -96,8 +100,10 @@ void GetWordAt(const gfx::Point& location_in_content,
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;

std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
Expand All @@ -43,7 +43,7 @@ diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
index 53659a0483967a959acada632cd6b504563d95ad..1fbdc2980386583c33eb7a801794cbd8c522bd79 100644
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
@@ -556,10 +556,12 @@ void NativeWidgetNSWindowBridge::CreateContentView(uint64_t ns_view_id,
@@ -556,10 +556,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
// this should be treated as an error and caught early.
CHECK(bridged_view_);

Expand All @@ -60,7 +60,7 @@ diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/cont
index a8e5c8888cb7ea8a85de7c8e8c613cc2b3c5be15..d01468fe77703b2812865b0198b84b0b645283c4 100644
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
@@ -66,8 +66,10 @@ class RenderWidgetHostNSViewBridgeOwner
@@ -66,8 +66,10 @@ id GetFocusedBrowserAccessibilityElement() override {
return nil;
}
void SetAccessibilityWindow(NSWindow* window) override {
Expand All @@ -71,7 +71,7 @@ index a8e5c8888cb7ea8a85de7c8e8c613cc2b3c5be15..d01468fe77703b2812865b0198b84b0b
}

void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
@@ -126,8 +128,10 @@ class RenderWidgetHostNSViewBridgeOwner
@@ -126,8 +128,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override {

mojo::AssociatedRemote<mojom::RenderWidgetHostNSViewHost> host_;
std::unique_ptr<RenderWidgetHostNSViewBridge> bridge_;
Expand Down Expand Up @@ -113,7 +113,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
index b6897c88c2c433e73f092f2ccebf29f097db35b0..5bec9c5d258c06fe338c8abe3e233e0b9b937234 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -239,8 +239,10 @@ RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
@@ -239,8 +239,10 @@
void RenderWidgetHostViewMac::MigrateNSViewBridge(
remote_cocoa::mojom::Application* remote_cocoa_application,
uint64_t parent_ns_view_id) {
Expand All @@ -124,7 +124,7 @@ index b6897c88c2c433e73f092f2ccebf29f097db35b0..5bec9c5d258c06fe338c8abe3e233e0b

// Disconnect from the previous bridge (this will have the effect of
// destroying the associated bridge), and close the receiver (to allow it
@@ -1373,8 +1375,10 @@ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessible() {
@@ -1373,8 +1375,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,

gfx::NativeViewAccessible
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
Expand All @@ -135,7 +135,7 @@ index b6897c88c2c433e73f092f2ccebf29f097db35b0..5bec9c5d258c06fe338c8abe3e233e0b
return [GetInProcessNSView() window];
}

@@ -1406,9 +1410,11 @@ id RenderWidgetHostViewMac::GetFocusedBrowserAccessibilityElement() {
@@ -1406,9 +1410,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
}

void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
Expand All @@ -147,7 +147,7 @@ index b6897c88c2c433e73f092f2ccebf29f097db35b0..5bec9c5d258c06fe338c8abe3e233e0b
}

bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
@@ -1889,12 +1895,14 @@ void RenderWidgetHostViewMac::StopSpeaking() {
@@ -1889,12 +1895,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,

void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
const std::vector<uint8_t>& window_token) {
Expand Down Expand Up @@ -232,7 +232,7 @@ diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa
index dd9e195a4fd0d506f15de93e9c3536efd4bae627..205910ac9a3f2bb12bddf38f50580c21618ef497 100644
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
@@ -296,14 +296,22 @@ gfx::NativeViewAccessible
@@ -296,14 +296,22 @@ bool PositionWindowInScreenCoordinates(Widget* widget,
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
if (in_process_ns_window_bridge_)
return in_process_ns_window_bridge_->ns_view();
Expand All @@ -255,15 +255,15 @@ index dd9e195a4fd0d506f15de93e9c3536efd4bae627..205910ac9a3f2bb12bddf38f50580c21
}

remote_cocoa::mojom::NativeWidgetNSWindow*
@@ -1177,6 +1185,7 @@ void NativeWidgetMacNSWindowHost::OnFocusWindowToolbar() {
@@ -1177,6 +1185,7 @@ bool PositionWindowInScreenCoordinates(Widget* widget,
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
const std::vector<uint8_t>& window_token,
const std::vector<uint8_t>& view_token) {
+#ifndef MAS_BUILD
remote_window_accessible_ =
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
remote_view_accessible_ =
@@ -1184,14 +1193,17 @@ void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
@@ -1184,14 +1193,17 @@ bool PositionWindowInScreenCoordinates(Widget* widget,
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
[remote_view_accessible_
setTopLevelUIElement:remote_window_accessible_.get()];
Expand Down
10 changes: 5 additions & 5 deletions patches/chromium/mas_disable_remote_layer.patch
Expand Up @@ -33,23 +33,23 @@ diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/se
index c1af03a268dc409b043ce3a085a7365f07e0f9e7..b883883ad52b0d625ec7be6e3b0c86503ab33582 100644
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm
@@ -63,6 +63,7 @@ ImageTransportSurfaceOverlayMacBase<
@@ -63,6 +63,7 @@
template <typename BaseClass>
bool ImageTransportSurfaceOverlayMacBase<BaseClass>::Initialize(
gl::GLSurfaceFormat format) {
+#ifndef MAS_BUILD
// Create the CAContext to send this to the GPU process, and the layer for
// the context.
if (use_remote_layer_api_) {
@@ -71,6 +72,7 @@ bool ImageTransportSurfaceOverlayMacBase<BaseClass>::Initialize(
@@ -71,6 +72,7 @@
[CAContext contextWithCGSConnection:connection_id options:@{}] retain]);
[ca_context_ setLayer:ca_layer_tree_coordinator_->GetCALayerForDisplay()];
}
+#endif
return true;
}

@@ -139,7 +141,9 @@ ImageTransportSurfaceOverlayMacBase<BaseClass>::SwapBuffersInternal(
@@ -139,7 +141,9 @@
"GLImpl", static_cast<int>(gl::GetGLImplementation()),
"width", pixel_size_.width());
if (use_remote_layer_api_) {
Expand All @@ -63,15 +63,15 @@ diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated
index 60abe639bd9c9cf6885f811c741a45eeb683ec58..c38eed5fbdefc96a3d60e4ab70d3b007264ccb3c 100644
--- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm
+++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
@@ -98,6 +98,7 @@ void DisplayCALayerTree::UpdateCALayerTree(
@@ -98,6 +98,7 @@ - (void)setContentsChanged;
}

void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
+#ifndef MAS_BUILD
// Early-out if the remote layer has not changed.
if ([remote_layer_ contextId] == ca_context_id)
return;
@@ -122,6 +123,9 @@ void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
@@ -122,6 +123,9 @@ - (void)setContentsChanged;
[io_surface_layer_ removeFromSuperlayer];
io_surface_layer_.reset();
}
Expand Down

0 comments on commit b33938d

Please sign in to comment.