Merge pull request #11547 from electron/draggable_regions_patch
fix: draggable region ipc should be frame based
This commit is contained in:
commit
4298aecb7c
6 changed files with 13 additions and 7 deletions
|
@ -688,10 +688,11 @@ void NativeWindow::DidFirstVisuallyNonEmptyPaint() {
|
||||||
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
|
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
|
bool NativeWindow::OnMessageReceived(const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* rfh) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
|
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, rfh)
|
||||||
IPC_MESSAGE_HANDLER(AtomViewHostMsg_UpdateDraggableRegions,
|
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_UpdateDraggableRegions,
|
||||||
UpdateDraggableRegions)
|
UpdateDraggableRegions)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
|
@ -700,6 +701,7 @@ bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::UpdateDraggableRegions(
|
void NativeWindow::UpdateDraggableRegions(
|
||||||
|
content::RenderFrameHost* rfh,
|
||||||
const std::vector<DraggableRegion>& regions) {
|
const std::vector<DraggableRegion>& regions) {
|
||||||
// Draggable region is not supported for non-frameless window.
|
// Draggable region is not supported for non-frameless window.
|
||||||
if (has_frame_)
|
if (has_frame_)
|
||||||
|
|
|
@ -313,13 +313,15 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
|
|
||||||
// Called when the window needs to update its draggable region.
|
// Called when the window needs to update its draggable region.
|
||||||
virtual void UpdateDraggableRegions(
|
virtual void UpdateDraggableRegions(
|
||||||
|
content::RenderFrameHost* rfh,
|
||||||
const std::vector<DraggableRegion>& regions);
|
const std::vector<DraggableRegion>& regions);
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||||
void BeforeUnloadDialogCancelled() override;
|
void BeforeUnloadDialogCancelled() override;
|
||||||
void DidFirstVisuallyNonEmptyPaint() override;
|
void DidFirstVisuallyNonEmptyPaint() override;
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
bool OnMessageReceived(const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* rfh) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Schedule a notification unresponsive event.
|
// Schedule a notification unresponsive event.
|
||||||
|
|
|
@ -159,6 +159,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
|
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
|
||||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
|
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
|
||||||
void UpdateDraggableRegions(
|
void UpdateDraggableRegions(
|
||||||
|
content::RenderFrameHost* rfh,
|
||||||
const std::vector<DraggableRegion>& regions) override;
|
const std::vector<DraggableRegion>& regions) override;
|
||||||
|
|
||||||
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
||||||
|
|
|
@ -1814,8 +1814,9 @@ gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::UpdateDraggableRegions(
|
void NativeWindowMac::UpdateDraggableRegions(
|
||||||
|
content::RenderFrameHost* rfh,
|
||||||
const std::vector<DraggableRegion>& regions) {
|
const std::vector<DraggableRegion>& regions) {
|
||||||
NativeWindow::UpdateDraggableRegions(regions);
|
NativeWindow::UpdateDraggableRegions(rfh, regions);
|
||||||
draggable_regions_ = regions;
|
draggable_regions_ = regions;
|
||||||
UpdateDraggableRegionViews(regions);
|
UpdateDraggableRegionViews(regions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ IPC_MESSAGE_ROUTED1(AtomAutofillFrameMsg_AcceptSuggestion,
|
||||||
base::string16 /* suggestion */)
|
base::string16 /* suggestion */)
|
||||||
|
|
||||||
// Sent by the renderer when the draggable regions are updated.
|
// Sent by the renderer when the draggable regions are updated.
|
||||||
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions,
|
IPC_MESSAGE_ROUTED1(AtomFrameHostMsg_UpdateDraggableRegions,
|
||||||
std::vector<atom::DraggableRegion> /* regions */)
|
std::vector<atom::DraggableRegion> /* regions */)
|
||||||
|
|
||||||
// Update renderer process preferences.
|
// Update renderer process preferences.
|
||||||
|
|
|
@ -52,7 +52,7 @@ void AtomRenderFrameObserver::DraggableRegionsChanged() {
|
||||||
region.draggable = webregion.draggable;
|
region.draggable = webregion.draggable;
|
||||||
regions.push_back(region);
|
regions.push_back(region);
|
||||||
}
|
}
|
||||||
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
Send(new AtomFrameHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomRenderFrameObserver::WillReleaseScriptContext(
|
void AtomRenderFrameObserver::WillReleaseScriptContext(
|
||||||
|
|
Loading…
Reference in a new issue