Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,10 @@ removed in future Electron releases.
* `rot90` - The widget content is rotated to portrait at 90 degrees (clockwise).
* `rot180` - The widget content is rotated to portrait at 180 degrees (clockwise).
* `rot270` - The widget content is rotated to portrait at 270 degrees (clockwise).
* `mirror` - The widget content is mirrored horizontally.
* `mirror_rot90` - The widget content is mirrored horizontally and rotated 90 degrees clockwise.
* `mirror_rot180` - The widget content is mirrored horizontally and rotated 180 degrees clockwise.
* `mirror_rot270` - The widget content is mirrored horizontally and rotated 270 degrees clockwise.

This method sets the browser window's transform.

Expand Down
4 changes: 4 additions & 0 deletions docs/api/structures/web-preferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
* `rot90` - The widget content is rotated to portrait at 90 degrees (clockwise).
* `rot180` - The widget content is rotated to portrait at 180 degrees (clockwise).
* `rot270` - The widget content is rotated to portrait at 270 degrees (clockwise).
* `mirror` - The widget content is mirrored horizontally.
* `mirror_rot90` - The widget content is mirrored horizontally and rotated 90 degrees clockwise.
* `mirror_rot180` - The widget content is mirrored horizontally and rotated 180 degrees clockwise.
* `mirror_rot270` - The widget content is mirrored horizontally and rotated 270 degrees clockwise.

[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment
[runtime-enabled-features]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5
1 change: 1 addition & 0 deletions patches/chromium/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,4 @@ feat_brightsign_add_setattribute_and_setsyncparams_os-21421.patch
add_removetrap_api_os-21158.patch
fix_mojo_trap_leak_os-21158.patch
fix_brightsign_fire_timechanged_for_equal-time-seeks_on-seek_os-21551.patch
os-20201_add_mirrored_window_transforms.patch
374 changes: 374 additions & 0 deletions patches/chromium/os-20201_add_mirrored_window_transforms.patch

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion shell/browser/api/electron_api_base_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,19 @@ void BaseWindow::SetWindowTransform(const std::string& transform) {
blink::mojom::WindowTransformType transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeNone;

if (transform == "rot180") {
if (transform == "mirror") {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeMirror;
} else if (transform == "mirror_rot90") {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate90;
} else if (transform == "mirror_rot180") {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate180;
} else if (transform == "mirror_rot270") {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate270;
} else if (transform == "rot180") {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeRotate180;
} else if (transform == "rot270") {
Expand All @@ -1155,6 +1167,7 @@ void BaseWindow::SetWindowTransform(const std::string& transform) {
transform_type =
blink::mojom::WindowTransformType::kWindowTransformTypeRotate90;
}

window_->SetWindowTransform(transform_type);
}
#endif
Expand Down
12 changes: 12 additions & 0 deletions shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,18 @@ void NativeWindowViews::SetWindowTransform(
case blink::mojom::WindowTransformType::kWindowTransformTypeRotate270:
window_transform = gfx::OVERLAY_TRANSFORM_ROTATE_270;
break;
case blink::mojom::WindowTransformType::kWindowTransformTypeMirror:
window_transform = gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL;
break;
case blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate90:
window_transform = gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL_ROTATE_90;
break;
case blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate180:
window_transform = gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL;
break;
case blink::mojom::WindowTransformType::kWindowTransformTypeMirrorRotate270:
window_transform = gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL_ROTATE_270;
break;
default:
window_transform = gfx::OVERLAY_TRANSFORM_NONE;
break;
Expand Down
4 changes: 4 additions & 0 deletions shell/browser/web_contents_preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ struct Converter<blink::mojom::WindowTransformType> {
using Val = blink::mojom::WindowTransformType;
static constexpr auto Lookup =
base::MakeFixedFlatMapSorted<base::StringPiece, Val>({
{"mirror", Val::kWindowTransformTypeMirror},
{"mirror_rot180", Val::kWindowTransformTypeMirrorRotate180},
{"mirror_rot270", Val::kWindowTransformTypeMirrorRotate270},
{"mirror_rot90", Val::kWindowTransformTypeMirrorRotate90},
{"none", Val::kWindowTransformTypeNone},
{"rot180", Val::kWindowTransformTypeRotate180},
{"rot270", Val::kWindowTransformTypeRotate270},
Expand Down
Loading
Loading