mirror of
https://github.com/electron/electron.git
synced 2026-01-15 02:18:18 -05:00
* chore: bump chromium in DEPS to 142.0.7429.0
* chore: bump chromium in DEPS to 142.0.7430.0
* 6954508: Reland Migrate WrappableWithNamedPropertyInterceptor to gin::Wrappable | https://chromium-review.googlesource.com/c/chromium/src/+/6954508
* https://chromium-review.googlesource.com/c/chromium/src/+/6955633
* 5584820: Fix font face resolution when renderer is blocked | https://chromium-review.googlesource.com/c/chromium/src/+/5584820
* chore: export patches
* chore: remove patch that keeley says is ok to remove in comments
* chore: bump chromium in DEPS to 142.0.7432.0
* chore: export patches
* chore: bump chromium in DEPS to 142.0.7434.0
* 6973697: Use type tags for data stored in V8 internal fields | https://chromium-review.googlesource.com/c/chromium/src/+/6973697
* 6976272: Revert Reland mac: click through content area in main window | https://chromium-review.googlesource.com/c/chromium/src/+/6976272
* chore: export patches
* 6938086: Rename native_widget_types.h -> native_ui_types.h | https://chromium-review.googlesource.com/c/chromium/src/+/6938086
* 6951252: Correct PersistentCache backed code cache context grouping
* chore: bump chromium in DEPS to 142.0.7436.0
* 6981628: Reland Use unordered_map in AcceleratorMap | https://chromium-review.googlesource.com/c/chromium/src/+/6981628
* chore: export patches
* chore: resolve patch conflict with main
* chore: merge conflict with main
* chore: bump chromium in DEPS to 142.0.7438.0
* chore: bump chromium in DEPS to 142.0.7440.0
* chore: bump chromium in DEPS to 142.0.7442.0
* chore: bump chromium in DEPS to 142.0.7444.0
* chore: bump chromium in DEPS to 143.0.7445.0
* chore: bump chromium in DEPS to 143.0.7447.0
* chore: bump chromium in DEPS to 143.0.7449.0
* chore: bump chromium in DEPS to 143.0.7451.0
* 7001364: Migrate GURL accessors to Get* variants in //content | https://chromium-review.googlesource.com/c/chromium/src/+/7001364
* 6986521: Implicit second value 'any' instead of 'span-all' for fallback query | https://chromium-review.googlesource.com/c/chromium/src/+/6986521
* chore: update chromium patches
* chore: update chromium patches
* chore: update patches
* fix: parse macOS SDK version across line break
https://chromium-review.googlesource.com/c/chromium/src/+/6980166
* fix: replace v8::Object::SetPrototype() usage
https://chromium-review.googlesource.com/c/v8/v8/+/6983465
https://github.com/nodejs/node/pull/55453
* fix: regenerate filenames.libcxx.gni
https://chromium-review.googlesource.com/c/chromium/src/+/6980307
* fix: replace additional usages of SetPrototype
https://chromium-review.googlesource.com/c/v8/v8/+/6983465
* build: use macos 15 minimum
https://chromium-review.googlesource.com/c/chromium/src/+/6980166
* ci: ignore missing dir for strip_universal_deep
* fix: js2c compilation failure
https://chromium-review.googlesource.com/c/chromium/src/+/6950738
See patch description explaining MacOS 26 SDK headers incompatibility.
* fixup! chore: export patches
* feat: add new memory-eviction exit reason
https://chromium-review.googlesource.com/c/chromium/src/+/6991933
* fix: set JSON reader parsing options
https://chromium-review.googlesource.com/c/chromium/src/+/6992114
* fix: provide DeviceEmulationCacheBehavior param
https://chromium-review.googlesource.com/c/chromium/src/+/6965238
* fix: views::NonClientFrameView -> views::FrameView
https://chromium-review.googlesource.com/c/chromium/src/+/7005027
https://chromium-review.googlesource.com/c/chromium/src/+/6966937
* fix: check new forced colors enum value
https://chromium-review.googlesource.com/c/chromium/src/+/6944403
* fix: migrate NetworkConditions -> MatchedNetworkConditions
https://chromium-review.googlesource.com/c/chromium/src/+/6827307
* fix: migrate GURL string methods to Get*()
https://chromium-review.googlesource.com/c/chromium/src/+/7007010
* fix: disable C++ modules in electron_lib builds
https://chromium-review.googlesource.com/c/chromium/src/+/6950738
* fix: partially revert is_headless_mode removal
https://chromium-review.googlesource.com/c/chromium/src/+/6955633
This patch should likely be reworked. For now, this partially reverts the
removal of a required class property to restore behavior.
* Revert "build: use macos 15 minimum"
This reverts commit 2fc12d6acc.
Initially this change was made to test if it fixes libcxx
compilation issues. As that's now resolved by disabling libcxx
modules, this can be reverted.
* fix: disable C++ modules in libnode builds
* fixup! fix: replace v8::Object::SetPrototype() usage https://chromium-review.googlesource.com/c/v8/v8/+/6983465 https://github.com/nodejs/node/pull/55453
* fixup! fix: replace v8::Object::SetPrototype() usage https://chromium-review.googlesource.com/c/v8/v8/+/6983465 https://github.com/nodejs/node/pull/55453
* build: switch to macos-15 runner
build/mac/find_sdk.py now requires macOS 15 SDK as a minimum version. The
macos 15 runners default to an Xcode using the 15 SDK and removes older
versions.
* fixup! fix: check new forced colors enum value https://chromium-review.googlesource.com/c/chromium/src/+/6944403
* fixup! fix: migrate GURL string methods to Get*() https://chromium-review.googlesource.com/c/chromium/src/+/7007010
* fix: use std::u16string for Extension::Create() error parameter
https://chromium-review.googlesource.com/c/chromium/src/+/6975452
* fix: add missing image_skia include
https://chromium-review.googlesource.com/c/chromium/src/+/6986762
* fixup! fix: add missing image_skia include https://chromium-review.googlesource.com/c/chromium/src/+/6986762
* fix: remove outdated V8 flag
https://chromium-review.googlesource.com/c/v8/v8/+/6948286
* fix: disable protocol handler DCHECK
https://chromium-review.googlesource.com/c/chromium/src/+/6727594
Ignore the extension custom protocol handler registry DCHECK until
we invest in supporting it. Replacing this DCHECK seems harmless
and will unblock the roll.
* fix: replace deprecated usage of SetPrototype
https://chromium-review.googlesource.com/c/v8/v8/+/6983465
* fixup! fix: migrate NetworkConditions -> MatchedNetworkConditions https://chromium-review.googlesource.com/c/chromium/src/+/6827307
* fixup! fix: migrate GURL string methods to Get*() https://chromium-review.googlesource.com/c/chromium/src/+/7007010
* chore: remove patch already included in roll
* chore: remove extraneous formatting added to patch
* chore: remove fix_harden_blink_scriptstate_maybefrom.patch
https://chromium-review.googlesource.com/c/chromium/src/+/6973697
No longer needed since the above CL landed.
* 6973697: Use type tags for data stored in V8 internal fields
https://chromium-review.googlesource.com/c/chromium/src/+/6973697
* chore: update patches
* fixup! chore: export patches
* chore: restore electron embedder data tag patch
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
125 lines
3.9 KiB
C++
125 lines
3.9 KiB
C++
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/ui/views/frameless_view.h"
|
|
|
|
#include "shell/browser/native_window_views.h"
|
|
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
|
#include "ui/aura/window.h"
|
|
#include "ui/base/hit_test.h"
|
|
#include "ui/base/metadata/metadata_impl_macros.h"
|
|
#include "ui/views/widget/widget.h"
|
|
#include "ui/views/widget/widget_delegate.h"
|
|
|
|
namespace electron {
|
|
|
|
namespace {
|
|
|
|
const int kResizeInsideBoundsSize = 5;
|
|
const int kResizeAreaCornerSize = 16;
|
|
|
|
} // namespace
|
|
|
|
FramelessView::FramelessView() = default;
|
|
|
|
FramelessView::~FramelessView() = default;
|
|
|
|
void FramelessView::Init(NativeWindowViews* window, views::Widget* frame) {
|
|
window_ = window;
|
|
frame_ = frame;
|
|
}
|
|
|
|
int FramelessView::ResizingBorderHitTest(const gfx::Point& point) {
|
|
return ResizingBorderHitTestImpl(point, gfx::Insets(kResizeInsideBoundsSize));
|
|
}
|
|
|
|
int FramelessView::ResizingBorderHitTestImpl(const gfx::Point& point,
|
|
const gfx::Insets& resize_border) {
|
|
// to be used for resize handles.
|
|
bool can_ever_resize = frame_->widget_delegate()
|
|
? frame_->widget_delegate()->CanResize()
|
|
: false;
|
|
|
|
// https://github.com/electron/electron/issues/611
|
|
// If window isn't resizable, we should always return HTNOWHERE, otherwise the
|
|
// hover state of DOM will not be cleared probably.
|
|
if (!can_ever_resize)
|
|
return HTNOWHERE;
|
|
|
|
// Don't allow overlapping resize handles when the window is maximized or
|
|
// fullscreen, as it can't be resized in those states.
|
|
bool allow_overlapping_handles =
|
|
!frame_->IsMaximized() && !frame_->IsFullscreen();
|
|
return GetHTComponentForFrame(
|
|
point, allow_overlapping_handles ? resize_border : gfx::Insets(),
|
|
kResizeAreaCornerSize, kResizeAreaCornerSize, can_ever_resize);
|
|
}
|
|
|
|
gfx::Rect FramelessView::GetBoundsForClientView() const {
|
|
return bounds();
|
|
}
|
|
|
|
gfx::Rect FramelessView::GetWindowBoundsForClientBounds(
|
|
const gfx::Rect& client_bounds) const {
|
|
gfx::Rect window_bounds = client_bounds;
|
|
// Enforce minimum size (1, 1) in case that client_bounds is passed with
|
|
// empty size. This could occur when the frameless window is being
|
|
// initialized.
|
|
if (window_bounds.IsEmpty()) {
|
|
window_bounds.set_width(1);
|
|
window_bounds.set_height(1);
|
|
}
|
|
return window_bounds;
|
|
}
|
|
|
|
int FramelessView::NonClientHitTest(const gfx::Point& point) {
|
|
if (frame_->IsFullscreen())
|
|
return HTCLIENT;
|
|
|
|
int contents_hit_test = window_->NonClientHitTest(point);
|
|
if (contents_hit_test != HTNOWHERE)
|
|
return contents_hit_test;
|
|
|
|
// Support resizing frameless window by dragging the border.
|
|
int frame_component = ResizingBorderHitTest(point);
|
|
if (frame_component != HTNOWHERE)
|
|
return frame_component;
|
|
|
|
return HTCLIENT;
|
|
}
|
|
|
|
views::View* FramelessView::TargetForRect(views::View* root,
|
|
const gfx::Rect& rect) {
|
|
CHECK_EQ(root, this);
|
|
|
|
if (NonClientHitTest(rect.origin()) != HTCLIENT)
|
|
return this;
|
|
|
|
return FrameView::TargetForRect(root, rect);
|
|
}
|
|
|
|
gfx::Size FramelessView::CalculatePreferredSize(
|
|
const views::SizeBounds& available_size) const {
|
|
return frame_->non_client_view()
|
|
->GetWindowBoundsForClientBounds(gfx::Rect(
|
|
frame_->client_view()->CalculatePreferredSize(available_size)))
|
|
.size();
|
|
}
|
|
|
|
gfx::Size FramelessView::GetMinimumSize() const {
|
|
return window_->GetContentMinimumSize();
|
|
}
|
|
|
|
gfx::Size FramelessView::GetMaximumSize() const {
|
|
gfx::Size size = window_->GetContentMaximumSize();
|
|
// Electron public APIs returns (0, 0) when maximum size is not set, but it
|
|
// would break internal window APIs like HWNDMessageHandler::SetAspectRatio.
|
|
return size.IsEmpty() ? gfx::Size(INT_MAX, INT_MAX) : size;
|
|
}
|
|
|
|
BEGIN_METADATA(FramelessView)
|
|
END_METADATA
|
|
|
|
} // namespace electron
|