Bug 1163113 - Implement -moz-window-dragging on Windows for Graphene. r=jimm

This commit is contained in:
Brian R. Bondy 2015-05-12 09:22:33 -04:00
parent ebead6cf18
commit 26bda6ee78
2 changed files with 27 additions and 5 deletions

View File

@ -2673,6 +2673,23 @@ void nsWindow::UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion)
}
}
/**************************************************************
*
* SECTION: nsIWidget::UpdateWindowDraggingRegion
*
* For setting the draggable titlebar region from CSS
* with -moz-window-dragging: drag.
*
**************************************************************/
void
nsWindow::UpdateWindowDraggingRegion(const nsIntRegion& aRegion)
{
if (mDraggableRegion != aRegion) {
mDraggableRegion = aRegion;
}
}
void nsWindow::UpdateGlass()
{
MARGINS margins = mGlassMargins;
@ -5582,7 +5599,9 @@ nsWindow::ClientMarginHitTestPoint(int32_t mx, int32_t my)
::ScreenToClient(mWnd, &pt);
if (pt.x == mCachedHitTestPoint.x && pt.y == mCachedHitTestPoint.y &&
TimeStamp::Now() - mCachedHitTestTime < TimeDuration::FromMilliseconds(HITTEST_CACHE_LIFETIME_MS)) {
testResult = mCachedHitTestResult;
return mCachedHitTestResult;
} else if (mDraggableRegion.Contains(pt.x, pt.y)) {
testResult = HTCAPTION;
} else {
WidgetMouseEvent event(true, NS_MOUSE_MOZHITTEST, this,
WidgetMouseEvent::eReal,
@ -5594,16 +5613,15 @@ nsWindow::ClientMarginHitTestPoint(int32_t mx, int32_t my)
if (result) {
// The mouse is over a blank area
testResult = testResult == HTCLIENT ? HTCAPTION : testResult;
} else {
// There's content over the mouse pointer. Set HTCLIENT
// to possibly override a resizer border.
testResult = HTCLIENT;
}
mCachedHitTestPoint = pt;
mCachedHitTestTime = TimeStamp::Now();
mCachedHitTestResult = testResult;
}
mCachedHitTestPoint = pt;
mCachedHitTestTime = TimeStamp::Now();
mCachedHitTestResult = testResult;
}
return testResult;

View File

@ -194,6 +194,7 @@ public:
void SetDrawsInTitlebar(bool aState);
mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() override;
virtual void EndRemoteDrawing() override;
virtual void UpdateWindowDraggingRegion(const nsIntRegion& aRegion) override;
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
virtual uint32_t GetMaxTouchPoints() const override;
@ -519,6 +520,9 @@ protected:
nsCOMPtr<nsIIdleServiceInternal> mIdleService;
// Draggable titlebar region maintained by UpdateWindowDraggingRegion
nsIntRegion mDraggableRegion;
// Hook Data Memebers for Dropdowns. sProcessHook Tells the
// hook methods whether they should be processing the hook
// messages.