[tor-commits] [tor-messenger-build/master] Add patches for trac 20204

arlo at torproject.org arlo at torproject.org
Sat Oct 1 05:17:35 UTC 2016


commit eb37fc7a210b86efd6a407b8527a41cb1330ebfb
Author: Arlo Breault <arlolra at gmail.com>
Date:   Fri Sep 30 21:44:52 2016 -0700

    Add patches for trac 20204
---
 ChangeLog                                          |   3 +-
 ...d-mozilla-ViewRegion-which-assembles-a.mozpatch | 192 ++++++++++++++++++++
 ...e-ViewRegion-for-vibrant-areas-in-Vibr.mozpatch | 180 +++++++++++++++++++
 ...e-ViewRegion-for-window-dragging.-r-sp.mozpatch | 199 +++++++++++++++++++++
 projects/instantbird/config                        |   3 +
 5 files changed, 576 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 164a902..50ca933 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,8 @@ Tor Messenger 0.2.0b3 --
    * Bug 20208: Put conversations on hold by default
    * Properly handle incoming xmpp server messages (bugzilla 1246431)
  * Mac
-   * Bug 20206: Avoid prompting to download font "Osaka"
+   * Bug 20206: Avoid prompting to download font "Osaka" on macOS Sierra
+   * Bug 20204: Windows don't drag on macOS Sierra
 
 Tor Messenger 0.2.0b2 -- September 06, 2016
  * Mac
diff --git a/projects/instantbird/0001-Bug-1070710-Add-mozilla-ViewRegion-which-assembles-a.mozpatch b/projects/instantbird/0001-Bug-1070710-Add-mozilla-ViewRegion-which-assembles-a.mozpatch
new file mode 100644
index 0000000..c5280e8
--- /dev/null
+++ b/projects/instantbird/0001-Bug-1070710-Add-mozilla-ViewRegion-which-assembles-a.mozpatch
@@ -0,0 +1,192 @@
+From 20344dc64a7177eb6d894df3ee6a77419c67284b Mon Sep 17 00:00:00 2001
+From: Markus Stange <mstange at themasta.com>
+Date: Sat, 16 Jul 2016 17:07:45 -0400
+Subject: [PATCH 1/3] Bug 1070710 - Add mozilla::ViewRegion which assembles a
+ LayoutDeviceIntRegion as NSViews. r=spohl
+
+MozReview-Commit-ID: RrVzLcv27T
+
+--HG--
+extra : amend_source : d14dc262bf300a81feaf03954d5783ea1c7451cb
+extra : histedit_source : aa39b53c122a719a5181b5a41d5351bbdf04cbd8
+---
+ widget/cocoa/ViewRegion.h     | 53 ++++++++++++++++++++++++++++++++
+ widget/cocoa/ViewRegion.mm    | 70 +++++++++++++++++++++++++++++++++++++++++++
+ widget/cocoa/moz.build        |  1 +
+ widget/cocoa/nsScreenCocoa.mm |  4 +--
+ 4 files changed, 126 insertions(+), 2 deletions(-)
+ create mode 100644 widget/cocoa/ViewRegion.h
+ create mode 100644 widget/cocoa/ViewRegion.mm
+
+diff --git a/widget/cocoa/ViewRegion.h b/widget/cocoa/ViewRegion.h
+new file mode 100644
+index 0000000..a8efcca
+--- /dev/null
++++ b/widget/cocoa/ViewRegion.h
+@@ -0,0 +1,53 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=8 sts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef ViewRegion_h
++#define ViewRegion_h
++
++#include "Units.h"
++#include "nsTArray.h"
++
++ at class NSView;
++
++namespace mozilla {
++
++/**
++ * Manages a set of NSViews to cover a LayoutDeviceIntRegion.
++ */
++class ViewRegion {
++public:
++  ~ViewRegion();
++
++  mozilla::LayoutDeviceIntRegion Region() { return mRegion; }
++
++  /**
++   * Update the region.
++   * @param aRegion  The new region.
++   * @param aCoordinateConverter  The nsChildView to use for converting
++   *   LayoutDeviceIntRect device pixel coordinates into Cocoa NSRect coordinates.
++   * @param aContainerView  The view that's going to be the superview of the
++   *   NSViews which will be created for this region.
++   * @param aViewCreationCallback  A block that instantiates new NSViews.
++   * @return  Whether or not the region changed.
++   */
++  bool UpdateRegion(const mozilla::LayoutDeviceIntRegion& aRegion,
++                    const nsChildView& aCoordinateConverter,
++                    NSView* aContainerView,
++                    NSView* (^aViewCreationCallback)());
++
++  /**
++   * Return an NSView from the region, if there is any.
++   */
++  NSView* GetAnyView() { return mViews.Length() > 0 ? mViews[0] : nil; }
++
++private:
++  mozilla::LayoutDeviceIntRegion mRegion;
++  nsTArray<NSView*> mViews;
++};
++
++} // namespace mozilla
++
++#endif // ViewRegion_h
+diff --git a/widget/cocoa/ViewRegion.mm b/widget/cocoa/ViewRegion.mm
+new file mode 100644
+index 0000000..3459849
+--- /dev/null
++++ b/widget/cocoa/ViewRegion.mm
+@@ -0,0 +1,70 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=8 sts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "ViewRegion.h"
++#import <Cocoa/Cocoa.h>
++
++using namespace mozilla;
++
++ViewRegion::~ViewRegion()
++{
++  for (size_t i = 0; i < mViews.Length(); i++) {
++    [mViews[i] removeFromSuperview];
++  }
++}
++
++bool
++ViewRegion::UpdateRegion(const LayoutDeviceIntRegion& aRegion,
++                         const nsChildView& aCoordinateConverter,
++                         NSView* aContainerView,
++                         NSView* (^aViewCreationCallback)())
++{
++  if (mRegion == aRegion) {
++    return false;
++  }
++
++  // We need to construct the required region using as many EffectViews
++  // as necessary. We try to update the geometry of existing views if
++  // possible, or create new ones or remove old ones if the number of
++  // rects in the region has changed.
++
++  nsTArray<NSView*> viewsToRecycle;
++  mViews.SwapElements(viewsToRecycle);
++  // The mViews array is now empty.
++
++  LayoutDeviceIntRegion::RectIterator iter(aRegion);
++  const LayoutDeviceIntRect* iterRect = nullptr;
++  for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
++    if (iterRect) {
++      NSView* view = nil;
++      NSRect rect = aCoordinateConverter.DevPixelsToCocoaPoints(*iterRect);
++      if (i < viewsToRecycle.Length()) {
++        view = viewsToRecycle[i];
++      } else {
++        view = aViewCreationCallback();
++        [aContainerView addSubview:view];
++
++        // Now that the view is in the view hierarchy, it'll be kept alive by
++        // its superview, so we can drop our reference.
++        [view release];
++      }
++      if (!NSEqualRects(rect, [view frame])) {
++        [view setFrame:rect];
++      }
++      [view setNeedsDisplay:YES];
++      mViews.AppendElement(view);
++      iter.Next();
++    } else {
++      // Our new region is made of fewer rects than the old region, so we can
++      // remove this view. We only have a weak reference to it, so removing it
++      // from the view hierarchy will release it.
++      [viewsToRecycle[i] removeFromSuperview];
++    }
++  }
++
++  mRegion = aRegion;
++  return true;
++}
+diff --git a/widget/cocoa/moz.build b/widget/cocoa/moz.build
+index aa8bfac..21b9369 100644
+--- a/widget/cocoa/moz.build
++++ b/widget/cocoa/moz.build
+@@ -58,6 +58,7 @@ UNIFIED_SOURCES += [
+     'SwipeTracker.mm',
+     'TextInputHandler.mm',
+     'VibrancyManager.mm',
++    'ViewRegion.mm',
+     'WidgetTraceEvent.mm',
+ ]
+ 
+diff --git a/widget/cocoa/nsScreenCocoa.mm b/widget/cocoa/nsScreenCocoa.mm
+index 1b72bbf..bd3eef3 100644
+--- a/widget/cocoa/nsScreenCocoa.mm
++++ b/widget/cocoa/nsScreenCocoa.mm
+@@ -44,7 +44,7 @@ nsScreenCocoa::GetRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int32_t
+ {
+   NSRect frame = [mScreen frame];
+ 
+-  LayoutDeviceIntRect r =
++  mozilla::LayoutDeviceIntRect r =
+     nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
+ 
+   *outX = r.x;
+@@ -60,7 +60,7 @@ nsScreenCocoa::GetAvailRect(int32_t *outX, int32_t *outY, int32_t *outWidth, int
+ {
+   NSRect frame = [mScreen visibleFrame];
+ 
+-  LayoutDeviceIntRect r =
++  mozilla::LayoutDeviceIntRect r =
+     nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
+ 
+   *outX = r.x;
+-- 
+2.10.0
+
diff --git a/projects/instantbird/0002-Bug-1070710-Use-ViewRegion-for-vibrant-areas-in-Vibr.mozpatch b/projects/instantbird/0002-Bug-1070710-Use-ViewRegion-for-vibrant-areas-in-Vibr.mozpatch
new file mode 100644
index 0000000..c54ae43
--- /dev/null
+++ b/projects/instantbird/0002-Bug-1070710-Use-ViewRegion-for-vibrant-areas-in-Vibr.mozpatch
@@ -0,0 +1,180 @@
+From 6222ca8ecd339b8fa7ffb1987558ee23970bf071 Mon Sep 17 00:00:00 2001
+From: Markus Stange <mstange at themasta.com>
+Date: Mon, 11 Jul 2016 14:47:05 -0400
+Subject: [PATCH 2/3] Bug 1070710 - Use ViewRegion for vibrant areas in
+ VibrancyManager. r=spohl
+
+MozReview-Commit-ID: 5qVo59SV7QG
+
+--HG--
+extra : histedit_source : 12980052172b2a858a52978fdd98dea28a9ea854
+---
+ widget/cocoa/VibrancyManager.h  | 14 +++------
+ widget/cocoa/VibrancyManager.mm | 70 +++++++++--------------------------------
+ 2 files changed, 18 insertions(+), 66 deletions(-)
+
+diff --git a/widget/cocoa/VibrancyManager.h b/widget/cocoa/VibrancyManager.h
+index 464a106..737fdc2 100644
+--- a/widget/cocoa/VibrancyManager.h
++++ b/widget/cocoa/VibrancyManager.h
+@@ -11,6 +11,7 @@
+ #include "nsClassHashtable.h"
+ #include "nsRegion.h"
+ #include "nsTArray.h"
++#include "ViewRegion.h"
+ 
+ #import <Foundation/NSGeometry.h>
+ 
+@@ -100,20 +101,13 @@ public:
+    */
+   static bool SystemSupportsVibrancy();
+ 
+-  // The following are only public because otherwise ClearVibrantRegionFunc
+-  // can't see them.
+-  struct VibrantRegion {
+-    LayoutDeviceIntRegion region;
+-    nsTArray<NSView*> effectViews;
+-  };
+-  void ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const;
+-
+ protected:
+-  NSView* CreateEffectView(VibrancyType aType, NSRect aRect);
++  void ClearVibrantRegion(const LayoutDeviceIntRegion& aVibrantRegion) const;
++  NSView* CreateEffectView(VibrancyType aType);
+ 
+   const nsChildView& mCoordinateConverter;
+   NSView* mContainerView;
+-  nsClassHashtable<nsUint32HashKey, VibrantRegion> mVibrantRegions;
++  nsClassHashtable<nsUint32HashKey, ViewRegion> mVibrantRegions;
+ };
+ 
+ } // namespace mozilla
+diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm
+index 26f9670..f12cac6 100644
+--- a/widget/cocoa/VibrancyManager.mm
++++ b/widget/cocoa/VibrancyManager.mm
+@@ -15,63 +15,25 @@ VibrancyManager::UpdateVibrantRegion(VibrancyType aType,
+                                      const LayoutDeviceIntRegion& aRegion)
+ {
+   auto& vr = *mVibrantRegions.LookupOrAdd(uint32_t(aType));
+-  if (vr.region == aRegion) {
+-    return;
+-  }
+-
+-  // We need to construct the required region using as many EffectViews
+-  // as necessary. We try to update the geometry of existing views if
+-  // possible, or create new ones or remove old ones if the number of
+-  // rects in the region has changed.
+-
+-  nsTArray<NSView*> viewsToRecycle;
+-  vr.effectViews.SwapElements(viewsToRecycle);
+-  // vr.effectViews is now empty.
+-
+-  LayoutDeviceIntRegion::RectIterator iter(aRegion);
+-  const LayoutDeviceIntRect* iterRect = nullptr;
+-  for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
+-    if (iterRect) {
+-      NSView* view = nil;
+-      NSRect rect = mCoordinateConverter.DevPixelsToCocoaPoints(*iterRect);
+-      if (i < viewsToRecycle.Length()) {
+-        view = viewsToRecycle[i];
+-        [view setFrame:rect];
+-        [view setNeedsDisplay:YES];
+-      } else {
+-        view = CreateEffectView(aType, rect);
+-        [mContainerView addSubview:view];
+-
+-        // Now that the view is in the view hierarchy, it'll be kept alive by
+-        // its superview, so we can drop our reference.
+-        [view release];
+-      }
+-      vr.effectViews.AppendElement(view);
+-    } else {
+-      // Our new region is made of less rects than the old region, so we can
+-      // remove this view. We only have a weak reference to it, so removing it
+-      // from the view hierarchy will release it.
+-      [viewsToRecycle[i] removeFromSuperview];
+-    }
+-  }
+-
+-  vr.region = aRegion;
++  vr.UpdateRegion(aRegion, mCoordinateConverter, mContainerView, ^() {
++    return this->CreateEffectView(aType);
++  });
+ }
+ 
+ void
+ VibrancyManager::ClearVibrantAreas() const
+ {
+   for (auto iter = mVibrantRegions.ConstIter(); !iter.Done(); iter.Next()) {
+-    ClearVibrantRegion(*iter.UserData());
++    ClearVibrantRegion(iter.UserData()->Region());
+   }
+ }
+ 
+ void
+-VibrancyManager::ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const
++VibrancyManager::ClearVibrantRegion(const LayoutDeviceIntRegion& aVibrantRegion) const
+ {
+   [[NSColor clearColor] set];
+ 
+-  LayoutDeviceIntRegion::RectIterator iter(aVibrantRegion.region);
++  LayoutDeviceIntRegion::RectIterator iter(aVibrantRegion);
+   while (const LayoutDeviceIntRect* rect = iter.Next()) {
+     NSRectFill(mCoordinateConverter.DevPixelsToCocoaPoints(*rect));
+   }
+@@ -97,15 +59,13 @@ AdjustedColor(NSColor* aFillColor, VibrancyType aType)
+ NSColor*
+ VibrancyManager::VibrancyFillColorForType(VibrancyType aType)
+ {
+-  const nsTArray<NSView*>& views =
+-    mVibrantRegions.LookupOrAdd(uint32_t(aType))->effectViews;
++  NSView* view = mVibrantRegions.LookupOrAdd(uint32_t(aType))->GetAnyView();
+ 
+-  if (!views.IsEmpty() &&
+-      [views[0] respondsToSelector:@selector(_currentFillColor)]) {
++  if (view && [view respondsToSelector:@selector(_currentFillColor)]) {
+     // -[NSVisualEffectView _currentFillColor] is the color that our view
+     // would draw during its drawRect implementation, if we hadn't
+     // disabled that.
+-    return AdjustedColor([views[0] _currentFillColor], aType);
++    return AdjustedColor([view _currentFillColor], aType);
+   }
+   return [NSColor whiteColor];
+ }
+@@ -117,12 +77,10 @@ VibrancyManager::VibrancyFillColorForType(VibrancyType aType)
+ NSColor*
+ VibrancyManager::VibrancyFontSmoothingBackgroundColorForType(VibrancyType aType)
+ {
+-  const nsTArray<NSView*>& views =
+-    mVibrantRegions.LookupOrAdd(uint32_t(aType))->effectViews;
++  NSView* view = mVibrantRegions.LookupOrAdd(uint32_t(aType))->GetAnyView();
+ 
+-  if (!views.IsEmpty() &&
+-      [views[0] respondsToSelector:@selector(fontSmoothingBackgroundColor)]) {
+-    return [views[0] fontSmoothingBackgroundColor];
++  if (view && [view respondsToSelector:@selector(fontSmoothingBackgroundColor)]) {
++    return [view fontSmoothingBackgroundColor];
+   }
+   return [NSColor clearColor];
+ }
+@@ -250,14 +208,14 @@ enum {
+ @end
+ 
+ NSView*
+-VibrancyManager::CreateEffectView(VibrancyType aType, NSRect aRect)
++VibrancyManager::CreateEffectView(VibrancyType aType)
+ {
+   static Class EffectViewClassWithoutForegroundVibrancy = CreateEffectViewClass(NO);
+   static Class EffectViewClassWithForegroundVibrancy = CreateEffectViewClass(YES);
+ 
+   Class EffectViewClass = HasVibrantForeground(aType)
+     ? EffectViewClassWithForegroundVibrancy : EffectViewClassWithoutForegroundVibrancy;
+-  NSView* effectView = [[EffectViewClass alloc] initWithFrame:aRect];
++  NSView* effectView = [[EffectViewClass alloc] initWithFrame:NSZeroRect];
+   [effectView performSelector:@selector(setAppearance:)
+                    withObject:AppearanceForVibrancyType(aType)];
+   [effectView setState:VisualEffectStateForVibrancyType(aType)];
+-- 
+2.10.0
+
diff --git a/projects/instantbird/0003-Bug-1070710-Use-ViewRegion-for-window-dragging.-r-sp.mozpatch b/projects/instantbird/0003-Bug-1070710-Use-ViewRegion-for-window-dragging.-r-sp.mozpatch
new file mode 100644
index 0000000..94a92fd
--- /dev/null
+++ b/projects/instantbird/0003-Bug-1070710-Use-ViewRegion-for-window-dragging.-r-sp.mozpatch
@@ -0,0 +1,199 @@
+From d378445257ad07190569b98bc1ad3ee93729cc38 Mon Sep 17 00:00:00 2001
+From: Markus Stange <mstange at themasta.com>
+Date: Mon, 11 Jul 2016 16:15:07 -0400
+Subject: [PATCH 3/3] Bug 1070710 - Use ViewRegion for window dragging. r=spohl
+
+MozReview-Commit-ID: 5x2XHl20P6a
+
+--HG--
+extra : histedit_source : 56b671bffe9e6cd497ade61ff9beed2e3bf98e14
+---
+ widget/cocoa/nsChildView.h  |   5 +-
+ widget/cocoa/nsChildView.mm | 117 ++++++++++++++------------------------------
+ 2 files changed, 40 insertions(+), 82 deletions(-)
+
+diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h
+index 8f07c70..e7bd6b0 100644
+--- a/widget/cocoa/nsChildView.h
++++ b/widget/cocoa/nsChildView.h
+@@ -28,6 +28,7 @@
+ 
+ #include "nsString.h"
+ #include "nsIDragService.h"
++#include "ViewRegion.h"
+ 
+ #import <Carbon/Carbon.h>
+ #import <Cocoa/Cocoa.h>
+@@ -493,7 +494,7 @@ public:
+   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
+ 
+   virtual void UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
+-  const LayoutDeviceIntRegion& GetDraggableRegion() { return mDraggableRegion; }
++  LayoutDeviceIntRegion GetNonDraggableRegion() { return mNonDraggableRegion.Region(); }
+ 
+   virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) override;
+ 
+@@ -659,7 +660,7 @@ protected:
+   // uploaded to to mTitlebarImage. Main thread only.
+   nsIntRegion           mDirtyTitlebarRegion;
+ 
+-  LayoutDeviceIntRegion mDraggableRegion;
++  mozilla::ViewRegion   mNonDraggableRegion;
+ 
+   // Cached value of [mView backingScaleFactor], to avoid sending two obj-c
+   // messages (respondsToSelector, backingScaleFactor) every time we need to
+diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
+index 8dbeacc..1415664 100644
+--- a/widget/cocoa/nsChildView.mm
++++ b/widget/cocoa/nsChildView.mm
+@@ -2720,12 +2720,41 @@ nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
+   [(ChildView*)mView postRender:mGLPresenter->GetNSOpenGLContext()];
+ }
+ 
++ at interface NonDraggableView : NSView
++ at end
++
++ at implementation NonDraggableView
++- (BOOL)mouseDownCanMoveWindow { return NO; }
++- (NSView*)hitTest:(NSPoint)aPoint { return nil; }
++ at end
++
+ void
+ nsChildView::UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion)
+ {
+-  if (mDraggableRegion != aRegion) {
+-    mDraggableRegion = aRegion;
+-    [(ChildView*)mView updateWindowDraggableState];
++  // mView returns YES from mouseDownCanMoveWindow, so we need to put NSViews
++  // that return NO from mouseDownCanMoveWindow in the places that shouldn't
++  // be draggable. We can't do it the other way round because returning
++  // YES from mouseDownCanMoveWindow doesn't have any effect if there's a
++  // superview that returns NO.
++  LayoutDeviceIntRegion nonDraggable;
++  nonDraggable.Sub(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height), aRegion);
++
++  __block bool changed = false;
++
++  // Suppress calls to setNeedsDisplay during NSView geometry changes.
++  ManipulateViewWithoutNeedingDisplay(mView, ^() {
++    changed = mNonDraggableRegion.UpdateRegion(nonDraggable, *this, mView, ^() {
++      return [[NonDraggableView alloc] initWithFrame:NSZeroRect];
++    });
++  });
++
++  if (changed) {
++    // Trigger an update to the window server. This will call
++    // mouseDownCanMoveWindow.
++    // Doing this manually is only necessary because we're suppressing
++    // setNeedsDisplay calls above.
++    [[mView window] setMovableByWindowBackground:NO];
++    [[mView window] setMovableByWindowBackground:YES];
+   }
+ }
+ 
+@@ -3566,8 +3595,10 @@ NSEvent* gLastDragMouseDownEvent = nil;
+ 
+ - (BOOL)mouseDownCanMoveWindow
+ {
+-  // Return YES so that _regionForOpaqueDescendants gets called, where the
+-  // actual draggable region will be assembled.
++  // Return YES so that parts of this view can be draggable. The non-draggable
++  // parts will be covered by NSViews that return NO from
++  // mouseDownCanMoveWindow and thus override draggability from the inside.
++  // These views are assembled in nsChildView::UpdateWindowDraggingRegion.
+   return YES;
+ }
+ 
+@@ -4572,7 +4603,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
+   CGFloat locationInTitlebar = [[self window] frame].size.height - [theEvent locationInWindow].y;
+   LayoutDeviceIntPoint pos = geckoEvent.refPoint;
+   if (!defaultPrevented && [theEvent clickCount] == 2 &&
+-      mGeckoChild->GetDraggableRegion().Contains(pos.x, pos.y) &&
++      !mGeckoChild->GetNonDraggableRegion().Contains(pos.x, pos.y) &&
+       [[self window] isKindOfClass:[ToolbarWindow class]] &&
+       (locationInTitlebar < [(ToolbarWindow*)[self window] titlebarHeight] ||
+        locationInTitlebar < [(ToolbarWindow*)[self window] unifiedToolbarHeight])) {
+@@ -4607,80 +4638,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
+   mGeckoChild->DispatchEvent(&event, status);
+ }
+ 
+-- (void)updateWindowDraggableState
+-{
+-  // Trigger update to the window server.
+-  [[self window] setMovableByWindowBackground:NO];
+-  [[self window] setMovableByWindowBackground:YES];
+-}
+-
+-// aRect is in view coordinates relative to this NSView.
+-- (CGRect)convertToFlippedWindowCoordinates:(NSRect)aRect
+-{
+-  // First, convert the rect to regular window coordinates...
+-  NSRect inWindowCoords = [self convertRect:aRect toView:nil];
+-  // ... and then flip it again because window coordinates have their origin
+-  // in the bottom left corner, and we need it to be in the top left corner.
+-  inWindowCoords.origin.y = [[self window] frame].size.height - NSMaxY(inWindowCoords);
+-  return NSRectToCGRect(inWindowCoords);
+-}
+-
+-static CGSRegionObj
+-NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
+-                       CGRect (^aRectConverter)(const LayoutDeviceIntRect&))
+-{
+-  nsTArray<CGRect> rects;
+-  LayoutDeviceIntRegion::RectIterator iter(aRegion);
+-  for (;;) {
+-    const LayoutDeviceIntRect* r = iter.Next();
+-    if (!r) {
+-      break;
+-    }
+-    rects.AppendElement(aRectConverter(*r));
+-  }
+-
+-  CGSRegionObj region;
+-  CGSNewRegionWithRectList(rects.Elements(), rects.Length(), &region);
+-  return region;
+-}
+-
+-// This function is called with forMove:YES to calculate the draggable region
+-// of the window which will be submitted to the window server. Window dragging
+-// is handled on the window server without calling back into our process, so it
+-// also works while our app is unresponsive.
+-- (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect forMove:(BOOL)aForMove
+-{
+-  if (!aForMove || !mGeckoChild) {
+-    return [super _regionForOpaqueDescendants:aRect forMove:aForMove];
+-  }
+-
+-  LayoutDeviceIntRect boundingRect = mGeckoChild->CocoaPointsToDevPixels(aRect);
+-
+-  LayoutDeviceIntRegion opaqueRegion;
+-  opaqueRegion.Sub(boundingRect, mGeckoChild->GetDraggableRegion());
+-
+-  return NewCGSRegionFromRegion(opaqueRegion, ^(const LayoutDeviceIntRect& r) {
+-    return [self convertToFlippedWindowCoordinates:mGeckoChild->DevPixelsToCocoaPoints(r)];
+-  });
+-}
+-
+-// Starting with 10.10, in addition to the traditional
+-// -[NSView _regionForOpaqueDescendants:forMove:] method, there's a new form with
+-// an additional forUnderTitlebar argument, which is sometimes called instead of
+-// the old form. We need to override the new variant as well.
+-- (CGSRegionObj)_regionForOpaqueDescendants:(NSRect)aRect
+-                                    forMove:(BOOL)aForMove
+-                           forUnderTitlebar:(BOOL)aForUnderTitlebar
+-{
+-  if (!aForMove || !mGeckoChild) {
+-    return [super _regionForOpaqueDescendants:aRect
+-                                      forMove:aForMove
+-                             forUnderTitlebar:aForUnderTitlebar];
+-  }
+-
+-  return [self _regionForOpaqueDescendants:aRect forMove:aForMove];
+-}
+-
+ - (void)handleMouseMoved:(NSEvent*)theEvent
+ {
+   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
+-- 
+2.10.0
+
diff --git a/projects/instantbird/config b/projects/instantbird/config
index 32cc28c..19aaba6 100644
--- a/projects/instantbird/config
+++ b/projects/instantbird/config
@@ -142,6 +142,9 @@ input_files:
   - filename: Update-load-local-changes-bug-16940-second.mozpatch
   - filename: Updater-Linux-search-path-bug-18900.mozpatch
   - filename: aboutTBUpdateLogo.png
+  - filename: 0001-Bug-1070710-Add-mozilla-ViewRegion-which-assembles-a.mozpatch
+  - filename: 0002-Bug-1070710-Use-ViewRegion-for-vibrant-areas-in-Vibr.mozpatch
+  - filename: 0003-Bug-1070710-Use-ViewRegion-for-window-dragging.-r-sp.mozpatch
   - filename: trac-16475.mozpatch
   - filename: updater-remove-links.mozpatch
   - filename: OSX-package-as-tar.bz2.mozpatch



More information about the tor-commits mailing list