Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Apr 2018 00:28:38 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r468312 - in head/www/waterfox: . files
Message-ID:  <201804260028.w3Q0SdIc083150@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Thu Apr 26 00:28:38 2018
New Revision: 468312
URL: https://svnweb.freebsd.org/changeset/ports/468312

Log:
  www/waterfox: apply some FF60 fixes

Added:
  head/www/waterfox/files/patch-bug1447989   (contents, props changed)
  head/www/waterfox/files/patch-bug1448089   (contents, props changed)
  head/www/waterfox/files/patch-bug1449358   (contents, props changed)
  head/www/waterfox/files/patch-bug1451908   (contents, props changed)
  head/www/waterfox/files/patch-bug1453127   (contents, props changed)
  head/www/waterfox/files/patch-bug1454572   (contents, props changed)
  head/www/waterfox/files/patch-bug1455235   (contents, props changed)
  head/www/waterfox/files/patch-z-bug1355143   (contents, props changed)
Modified:
  head/www/waterfox/Makefile   (contents, props changed)

Modified: head/www/waterfox/Makefile
==============================================================================
--- head/www/waterfox/Makefile	Thu Apr 26 00:28:23 2018	(r468311)
+++ head/www/waterfox/Makefile	Thu Apr 26 00:28:38 2018	(r468312)
@@ -2,7 +2,7 @@
 
 PORTNAME=	waterfox
 DISTVERSION=	56.1.0
-PORTREVISION=	15
+PORTREVISION=	16
 CATEGORIES=	www ipv6
 
 MAINTAINER=	jbeich@FreeBSD.org

Added: head/www/waterfox/files/patch-bug1447989
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1447989	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,25 @@
+commit d6e448266552
+Author: Jan de Mooij <jdemooij@mozilla.com>
+Date:   Wed Apr 25 09:02:12 2018 +0300
+
+    Bug 1447989 - Sweep script types in TypeMonitorResult. r=tcampbell a=lizzard
+    
+    --HG--
+    extra : amend_source : f0b61269c44b087719613e4709a9e802cf9819f1
+---
+ js/src/vm/TypeInference.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git js/src/vm/TypeInference.cpp js/src/vm/TypeInference.cpp
+index 55897aa816db..4b44353d8d47 100644
+--- js/src/vm/TypeInference.cpp
++++ js/src/vm/TypeInference.cpp
+@@ -3329,6 +3329,8 @@ js::TypeMonitorResult(JSContext* cx, JSScript* script, jsbytecode* pc, StackType
+ 
+     AutoEnterAnalysis enter(cx);
+ 
++    script->maybeSweepTypes(nullptr);
++
+     MOZ_ASSERT(types == TypeScript::BytecodeTypes(script, pc));
+     MOZ_ASSERT(!types->hasType(type));
+ 

Added: head/www/waterfox/files/patch-bug1448089
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1448089	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,207 @@
+commit f19c0ad7f5d0
+Author: Nicolas B. Pierron <nicolas.b.pierron@gmail.com>
+Date:   Thu Apr 19 07:32:00 2018 -0400
+
+    Bug 1448089 - Make MBasicBlock::addPredecessorSameInputsAs fallible. r=tcampbell a=lizzard
+    
+    --HG--
+    extra : source : 131166cff47d79cdc09dd89a5a7d5d4ec9af6a75
+---
+ js/src/jit/IonAnalysis.cpp | 51 ++++++++++++++++++++++++++++++----------------
+ js/src/jit/MIRGraph.cpp    |  7 ++++---
+ js/src/jit/MIRGraph.h      |  2 +-
+ 3 files changed, 39 insertions(+), 21 deletions(-)
+
+diff --git js/src/jit/IonAnalysis.cpp js/src/jit/IonAnalysis.cpp
+index 7d15bbe0f290..d84af88991de 100644
+--- js/src/jit/IonAnalysis.cpp
++++ js/src/jit/IonAnalysis.cpp
+@@ -714,7 +714,7 @@ BlockIsSingleTest(MBasicBlock* phiBlock, MBasicBlock* testBlock, MPhi** pphi, MT
+ 
+ // Change block so that it ends in a goto to the specific target block.
+ // existingPred is an existing predecessor of the block.
+-static void
++static MOZ_MUST_USE bool
+ UpdateGotoSuccessor(TempAllocator& alloc, MBasicBlock* block, MBasicBlock* target,
+                      MBasicBlock* existingPred)
+ {
+@@ -726,7 +726,7 @@ UpdateGotoSuccessor(TempAllocator& alloc, MBasicBlock* block, MBasicBlock* targe
+     MGoto* newGoto = MGoto::New(alloc, target);
+     block->end(newGoto);
+ 
+-    target->addPredecessorSameInputsAs(block, existingPred);
++    return target->addPredecessorSameInputsAs(block, existingPred);
+ }
+ 
+ // Change block so that it ends in a test of the specified value, going to
+@@ -734,7 +734,7 @@ UpdateGotoSuccessor(TempAllocator& alloc, MBasicBlock* block, MBasicBlock* targe
+ // or ifFalse with the same values incoming to ifTrue/ifFalse as block.
+ // existingPred is not required to be a predecessor of ifTrue/ifFalse if block
+ // already ends in a test going to that block on a true/false result.
+-static void
++static MOZ_MUST_USE bool
+ UpdateTestSuccessors(TempAllocator& alloc, MBasicBlock* block,
+                      MDefinition* value, MBasicBlock* ifTrue, MBasicBlock* ifFalse,
+                      MBasicBlock* existingPred)
+@@ -746,19 +746,21 @@ UpdateTestSuccessors(TempAllocator& alloc, MBasicBlock* block,
+ 
+         if (ifTrue != test->ifTrue()) {
+             test->ifTrue()->removePredecessor(block);
+-            ifTrue->addPredecessorSameInputsAs(block, existingPred);
++            if (!ifTrue->addPredecessorSameInputsAs(block, existingPred))
++                return false;
+             MOZ_ASSERT(test->ifTrue() == test->getSuccessor(0));
+             test->replaceSuccessor(0, ifTrue);
+         }
+ 
+         if (ifFalse != test->ifFalse()) {
+             test->ifFalse()->removePredecessor(block);
+-            ifFalse->addPredecessorSameInputsAs(block, existingPred);
++            if (!ifFalse->addPredecessorSameInputsAs(block, existingPred))
++                return false;
+             MOZ_ASSERT(test->ifFalse() == test->getSuccessor(1));
+             test->replaceSuccessor(1, ifFalse);
+         }
+ 
+-        return;
++        return true;
+     }
+ 
+     MOZ_ASSERT(ins->isGoto());
+@@ -768,8 +770,11 @@ UpdateTestSuccessors(TempAllocator& alloc, MBasicBlock* block,
+     MTest* test = MTest::New(alloc, value, ifTrue, ifFalse);
+     block->end(test);
+ 
+-    ifTrue->addPredecessorSameInputsAs(block, existingPred);
+-    ifFalse->addPredecessorSameInputsAs(block, existingPred);
++    if (!ifTrue->addPredecessorSameInputsAs(block, existingPred))
++        return false;
++    if (!ifFalse->addPredecessorSameInputsAs(block, existingPred))
++        return false;
++    return true;
+ }
+ 
+ static bool
+@@ -874,10 +879,14 @@ MaybeFoldConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock)
+         phiBlock->removePredecessor(trueBranch);
+         graph.removeBlock(trueBranch);
+     } else if (initialTest->input() == trueResult) {
+-        UpdateGotoSuccessor(graph.alloc(), trueBranch, finalTest->ifTrue(), testBlock);
++        if (!UpdateGotoSuccessor(graph.alloc(), trueBranch, finalTest->ifTrue(), testBlock))
++            return false;
+     } else {
+-        UpdateTestSuccessors(graph.alloc(), trueBranch, trueResult,
+-                             finalTest->ifTrue(), finalTest->ifFalse(), testBlock);
++        if (!UpdateTestSuccessors(graph.alloc(), trueBranch, trueResult,
++                                  finalTest->ifTrue(), finalTest->ifFalse(), testBlock))
++        {
++            return false;
++        }
+     }
+ 
+     MBasicBlock* falseTarget = falseBranch;
+@@ -886,15 +895,22 @@ MaybeFoldConditionBlock(MIRGraph& graph, MBasicBlock* initialBlock)
+         phiBlock->removePredecessor(falseBranch);
+         graph.removeBlock(falseBranch);
+     } else if (initialTest->input() == falseResult) {
+-        UpdateGotoSuccessor(graph.alloc(), falseBranch, finalTest->ifFalse(), testBlock);
++        if (!UpdateGotoSuccessor(graph.alloc(), falseBranch, finalTest->ifFalse(), testBlock))
++            return false;
+     } else {
+-        UpdateTestSuccessors(graph.alloc(), falseBranch, falseResult,
+-                             finalTest->ifTrue(), finalTest->ifFalse(), testBlock);
++        if (!UpdateTestSuccessors(graph.alloc(), falseBranch, falseResult,
++                                  finalTest->ifTrue(), finalTest->ifFalse(), testBlock))
++        {
++            return false;
++        }
+     }
+ 
+     // Short circuit the initial test to skip any constant branch eliminated above.
+-    UpdateTestSuccessors(graph.alloc(), initialBlock, initialTest->input(),
+-                         trueTarget, falseTarget, testBlock);
++    if (!UpdateTestSuccessors(graph.alloc(), initialBlock, initialTest->input(),
++                              trueTarget, falseTarget, testBlock))
++    {
++        return false;
++    }
+ 
+     // Remove phiBlock, if different from testBlock.
+     if (phiBlock != testBlock) {
+@@ -950,7 +966,8 @@ jit::FoldEmptyBlocks(MIRGraph& graph)
+ 
+         graph.removeBlock(block);
+ 
+-        succ->addPredecessorSameInputsAs(pred, block);
++        if (!succ->addPredecessorSameInputsAs(pred, block))
++            return false;
+         succ->removePredecessor(block);
+     }
+     return true;
+diff --git js/src/jit/MIRGraph.cpp js/src/jit/MIRGraph.cpp
+index 13d90d064555..f3466310f771 100644
+--- js/src/jit/MIRGraph.cpp
++++ js/src/jit/MIRGraph.cpp
+@@ -1146,7 +1146,7 @@ MBasicBlock::addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_
+     return predecessors_.append(pred);
+ }
+ 
+-void
++bool
+ MBasicBlock::addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existingPred)
+ {
+     MOZ_ASSERT(pred);
+@@ -1162,12 +1162,13 @@ MBasicBlock::addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existing
+         size_t existingPosition = indexForPredecessor(existingPred);
+         for (MPhiIterator iter = phisBegin(); iter != phisEnd(); iter++) {
+             if (!iter->addInputSlow(iter->getOperand(existingPosition)))
+-                oomUnsafe.crash("MBasicBlock::addPredecessorAdjustPhis");
++                return false;
+         }
+     }
+ 
+     if (!predecessors_.append(pred))
+-        oomUnsafe.crash("MBasicBlock::addPredecessorAdjustPhis");
++        return false;
++    return true;
+ }
+ 
+ bool
+diff --git js/src/jit/MIRGraph.h js/src/jit/MIRGraph.h
+index bd661c5ca78f..ecc9a8871604 100644
+--- js/src/jit/MIRGraph.h
++++ js/src/jit/MIRGraph.h
+@@ -272,7 +272,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
+ 
+     // Add a predecessor which won't introduce any new phis to this block.
+     // This may be called after the contents of this block have been built.
+-    void addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existingPred);
++    MOZ_MUST_USE bool addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existingPred);
+ 
+     // Stranger utilities used for inlining.
+     MOZ_MUST_USE bool addPredecessorWithoutPhis(MBasicBlock* pred);
+commit 9544b32ac2a8
+Author: Steve Fink <sfink@mozilla.com>
+Date:   Fri Apr 20 13:32:47 2018 -0700
+
+    Bug 1448089 followup, remove now-unused variable to fix a CLOSED TREE. a=lizzard
+    
+    --HG--
+    extra : source : d9f508d0e46e29c30a74d17820de3db933978324
+---
+ js/src/jit/MIRGraph.cpp | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git js/src/jit/MIRGraph.cpp js/src/jit/MIRGraph.cpp
+index f3466310f771..783ca2459226 100644
+--- js/src/jit/MIRGraph.cpp
++++ js/src/jit/MIRGraph.cpp
+@@ -1156,8 +1156,6 @@ MBasicBlock::addPredecessorSameInputsAs(MBasicBlock* pred, MBasicBlock* existing
+     MOZ_ASSERT(pred->hasLastIns());
+     MOZ_ASSERT(!pred->successorWithPhis());
+ 
+-    AutoEnterOOMUnsafeRegion oomUnsafe;
+-
+     if (!phisEmpty()) {
+         size_t existingPosition = indexForPredecessor(existingPred);
+         for (MPhiIterator iter = phisBegin(); iter != phisEnd(); iter++) {

Added: head/www/waterfox/files/patch-bug1449358
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1449358	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,51 @@
+commit 98fd83a90019
+Author: Alex Gaynor <agaynor@mozilla.com>
+Date:   Tue Apr 17 10:14:20 2018 -0400
+
+    Bug 1449358 - Consistently use PR memory functions. r=mayhemer a=lizzard
+    
+    --HG--
+    extra : source : b876ed208711bc346d7ca95b0599f6e4eb02ff2e
+---
+ extensions/auth/nsAuthSambaNTLM.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git extensions/auth/nsAuthSambaNTLM.cpp extensions/auth/nsAuthSambaNTLM.cpp
+index 6aa34e211be6..86c408ec5bf4 100644
+--- extensions/auth/nsAuthSambaNTLM.cpp
++++ extensions/auth/nsAuthSambaNTLM.cpp
+@@ -5,6 +5,7 @@
+ 
+ #include "nsAuth.h"
+ #include "nsAuthSambaNTLM.h"
++#include "nspr.h"
+ #include "prenv.h"
+ #include "plbase64.h"
+ #include "prerror.h"
+@@ -23,7 +24,7 @@ nsAuthSambaNTLM::~nsAuthSambaNTLM()
+     // ntlm_auth reads from stdin regularly so closing our file handles
+     // should cause it to exit.
+     Shutdown();
+-    free(mInitialMessage);
++    PR_Free(mInitialMessage);
+ }
+ 
+ void
+@@ -248,7 +249,7 @@ nsAuthSambaNTLM::GetNextToken(const void *inToken,
+     nsCString request;
+     request.AssignLiteral("TT ");
+     request.Append(encoded);
+-    free(encoded);
++    PR_Free(encoded);
+     request.Append('\n');
+ 
+     if (!WriteString(mToChildFD, request))
+@@ -265,7 +266,7 @@ nsAuthSambaNTLM::GetNextToken(const void *inToken,
+     if (!buf)
+         return NS_ERROR_FAILURE;
+     *outToken = nsMemory::Clone(buf, *outTokenLen);
+-    free(buf);
++    PR_Free(buf);
+     if (!*outToken) {
+         return NS_ERROR_OUT_OF_MEMORY;
+     }

Added: head/www/waterfox/files/patch-bug1451908
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1451908	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,29 @@
+commit 507fd5c4b515
+Author: Eric Rahm <erahm@mozilla.com>
+Date:   Tue Apr 17 11:22:04 2018 -0700
+
+    Bug 1451908 - Check for infinite value in txFormatNumberFunctionCall. r=peterv a=abillings
+    
+    --HG--
+    extra : source : e47d7dbc1cd289086eb63c24cce1600c2b5329c7
+---
+ dom/xslt/xslt/txFormatNumberFunctionCall.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git dom/xslt/xslt/txFormatNumberFunctionCall.cpp dom/xslt/xslt/txFormatNumberFunctionCall.cpp
+index ddeede2502a3..54de0b48daa8 100644
+--- dom/xslt/xslt/txFormatNumberFunctionCall.cpp
++++ dom/xslt/xslt/txFormatNumberFunctionCall.cpp
+@@ -265,6 +265,12 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
+ 
+     value = fabs(value) * multiplier;
+ 
++    // Make sure the multiplier didn't push value to infinity.
++    if (value == mozilla::PositiveInfinity<double>()) {
++        return aContext->recycler()->getStringResult(format->mInfinity,
++                                                     aResult);
++    }
++
+     // Prefix
+     nsAutoString res(prefix);
+ 

Added: head/www/waterfox/files/patch-bug1453127
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1453127	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,36 @@
+commit 7f8f5d958ed6
+Author: Bryce Van Dyk <bvandyk@mozilla.com>
+Date:   Wed Apr 18 15:30:57 2018 -0400
+
+    Bug 1453127 - Do not use iterators in MediaStreamTrack when removing listeners. r=pehrsons a=lizzard
+    
+    --HG--
+    extra : source : 6b3aaee40f7507e240da08d6e073cff3c53971f4
+---
+ dom/media/MediaStreamTrack.cpp | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git dom/media/MediaStreamTrack.cpp dom/media/MediaStreamTrack.cpp
+index 010373e9086d..af6c6014cf02 100644
+--- dom/media/MediaStreamTrack.cpp
++++ dom/media/MediaStreamTrack.cpp
+@@ -166,11 +166,15 @@ MediaStreamTrack::Destroy()
+     mPrincipalHandleListener->Forget();
+     mPrincipalHandleListener = nullptr;
+   }
+-  for (auto l : mTrackListeners) {
+-    RemoveListener(l);
++  // Remove all listeners -- avoid iterating over the list we're removing from
++  const nsTArray<RefPtr<MediaStreamTrackListener>> trackListeners(mTrackListeners);
++  for (auto listener : trackListeners) {
++    RemoveListener(listener);
+   }
+-  for (auto l : mDirectTrackListeners) {
+-    RemoveDirectListener(l);
++  // Do the same as above for direct listeners
++  const nsTArray<RefPtr<DirectMediaStreamTrackListener>> directTrackListeners(mDirectTrackListeners);
++  for (auto listener : directTrackListeners) {
++    RemoveDirectListener(listener);
+   }
+ }
+ 

Added: head/www/waterfox/files/patch-bug1454572
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1454572	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,43 @@
+commit 6c5f29ecc4a3
+Author: James Teh <jteh@mozilla.com>
+Date:   Thu Apr 19 15:53:25 2018 +1000
+
+    Bug 1454572: nsComputedDOMStyle: Don't crash when used on a detached pseudo-element. r=emilio,xidorn:emilio a=RyanVM
+    
+    This shouldn't normally happen, but it does in some rare cases; e.g. if an accessibility client queries info for a node that is being removed.
+    
+    MozReview-Commit-ID: 3nac9ITN66f
+    
+    --HG--
+    extra : source : 0fcbe086a09ba9e9684f43706290b3e0f2226103
+---
+ layout/style/nsComputedDOMStyle.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git layout/style/nsComputedDOMStyle.cpp layout/style/nsComputedDOMStyle.cpp
+index 2ab4b28ad42a..f55675ee8ba4 100644
+--- layout/style/nsComputedDOMStyle.cpp
++++ layout/style/nsComputedDOMStyle.cpp
+@@ -686,6 +686,7 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
+                                              AnimationFlag aAnimationFlag)
+ {
+   MOZ_ASSERT(aElement, "NULL element");
++
+   // If the content has a pres shell, we must use it.  Otherwise we'd
+   // potentially mix rule trees by using the wrong pres shell's style
+   // set.  Using the pres shell from the content also means that any
+@@ -728,6 +729,14 @@ nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
+     }
+   }
+ 
++  if (aElement->IsInNativeAnonymousSubtree() && !aElement->IsInComposedDoc()) {
++    // Normal web content can't access NAC, but Accessibility, DevTools and
++    // Editor use this same API and this may get called for anonymous content.
++    // Computing the style of a pseudo-element that doesn't have a parent doesn't
++    // really make sense.
++    return nullptr;
++  }
++
+   // XXX the !aElement->IsHTMLElement(nsGkAtoms::area)
+   // check is needed due to bug 135040 (to avoid using
+   // mPrimaryFrame). Remove it once that's fixed.

Added: head/www/waterfox/files/patch-bug1455235
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-bug1455235	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,67 @@
+commit 7d43e67e661a
+Author: Jan Horak <jhorak@redhat.com>
+Date:   Thu Apr 19 12:39:57 2018 +0200
+
+    Bug 1455235 [gtk] Don't start moving window before mousemove event, r=dao a=lizzard
+    
+    We need to start moving the window in GTK after mousemove event arrives,
+    not with mousedown, because the drag area can also process doubleclick
+    event to restore/maximize window. This also match to the GTK implementation,
+    see gedit behaviour for example.
+    
+    MozReview-Commit-ID: WXP3D2wIp0
+    
+    --HG--
+    extra : source : cc0d7de218cb0c260c8ba0cf6637845ad2222f49
+---
+ toolkit/modules/WindowDraggingUtils.jsm | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+diff --git toolkit/modules/WindowDraggingUtils.jsm toolkit/modules/WindowDraggingUtils.jsm
+index 465747e736f2..595d501ff7ec 100644
+--- toolkit/modules/WindowDraggingUtils.jsm
++++ toolkit/modules/WindowDraggingUtils.jsm
+@@ -61,26 +61,29 @@ WindowDraggingElement.prototype = {
+       case "mousedown":
+         if (!this.shouldDrag(aEvent))
+           return;
+-
+-        if (/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) {
+-          // On GTK, there is a toolkit-level function which handles
+-          // window dragging, which must be used.
+-          this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
+-          break;
+-        }
+-        if (isPanel) {
+-          let screenRect = this._elem.getOuterScreenRect();
+-          this._deltaX = aEvent.screenX - screenRect.left;
+-          this._deltaY = aEvent.screenY - screenRect.top;
+-        } else {
+-          this._deltaX = aEvent.screenX - this._window.screenX;
+-          this._deltaY = aEvent.screenY - this._window.screenY;
++        if (!/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) {
++          if (isPanel) {
++            let screenRect = this._elem.getOuterScreenRect();
++            this._deltaX = aEvent.screenX - screenRect.left;
++            this._deltaY = aEvent.screenY - screenRect.top;
++          } else {
++            this._deltaX = aEvent.screenX - this._window.screenX;
++            this._deltaY = aEvent.screenY - this._window.screenY;
++          }
+         }
+         this._draggingWindow = true;
+         this._window.addEventListener("mousemove", this);
+         this._window.addEventListener("mouseup", this);
+         break;
+       case "mousemove":
++        if (/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) {
++          // On GTK, there is a toolkit-level function which handles
++          // window dragging. We want to start moving the window
++          // on the first mousemove event after mousedown.
++          this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
++          this._window.removeEventListener("mousemove", this);
++          break;
++        }
+         if (this._draggingWindow) {
+           let toDrag = this.isPanel() ? this._elem : this._window;
+           toDrag.moveTo(aEvent.screenX - this._deltaX, aEvent.screenY - this._deltaY);

Added: head/www/waterfox/files/patch-z-bug1355143
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/waterfox/files/patch-z-bug1355143	Thu Apr 26 00:28:38 2018	(r468312)
@@ -0,0 +1,384 @@
+commit ebd5363fd4ff
+Author: Martin Stransky <stransky@redhat.com>
+Date:   Wed Apr 18 11:03:39 2018 +0200
+
+    Bug 1355143 - Implement CreateStyleContextWithStates to style with fully stated css path, r=jhorak a=lizzard
+    
+    MozReview-Commit-ID: ENWBekzq4Oq
+    
+    --HG--
+    extra : source : 8683842b60582c60de0226d1398c335a7e1a7b3f
+---
+ widget/gtk/WidgetStyleCache.cpp | 30 ++++++++++++++++++++++++++++++
+ widget/gtk/WidgetStyleCache.h   | 19 ++++++++++++++++++-
+ widget/gtk/mozgtk/mozgtk.c      |  1 +
+ 3 files changed, 49 insertions(+), 1 deletion(-)
+
+diff --git widget/gtk/WidgetStyleCache.cpp widget/gtk/WidgetStyleCache.cpp
+index 0b69b6c83f24..8ee7e49ee48d 100644
+--- widget/gtk/WidgetStyleCache.cpp
++++ widget/gtk/WidgetStyleCache.cpp
+@@ -1514,3 +1514,33 @@ GetStyleContext(WidgetNodeType aNodeType, GtkTextDirection aDirection,
+   }
+   return style;
+ }
++
++GtkStyleContext*
++CreateStyleContextWithStates(WidgetNodeType aNodeType, GtkTextDirection aDirection,
++                             GtkStateFlags aStateFlags)
++{
++  GtkStyleContext* style = GetStyleContext(aNodeType, aDirection, aStateFlags);
++  GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(style));
++
++  if (gtk_check_version(3, 14, 0) == nullptr) {
++
++    static auto sGtkWidgetPathIterGetState =
++      (GtkStateFlags (*)(const GtkWidgetPath*, gint))
++      dlsym(RTLD_DEFAULT, "gtk_widget_path_iter_get_state");
++    static auto sGtkWidgetPathIterSetState =
++      (void (*)(GtkWidgetPath*, gint, GtkStateFlags))
++      dlsym(RTLD_DEFAULT, "gtk_widget_path_iter_set_state");
++
++    int pathLength = gtk_widget_path_length(path);
++    for(int i = 0; i < pathLength; i++) {
++      unsigned state = aStateFlags | sGtkWidgetPathIterGetState(path, i);
++      sGtkWidgetPathIterSetState(path, i, GtkStateFlags(state));
++    }
++  }
++
++  style = gtk_style_context_new();
++  gtk_style_context_set_path(style, path);
++  gtk_widget_path_unref(path);
++
++  return style;
++}
+diff --git widget/gtk/WidgetStyleCache.h widget/gtk/WidgetStyleCache.h
+index 1e7748dfb17c..e434bc8230b0 100644
+--- widget/gtk/WidgetStyleCache.h
++++ widget/gtk/WidgetStyleCache.h
+@@ -38,7 +38,13 @@ CreateCSSNode(const char*      aName,
+ 
+ /*
+  * Returns a pointer to a style context for the specified node and state.
+- * The context is owned by WidgetStyleCache.  Do not unref.
++ * aStateFlags is applied only to last widget in css style path,
++ * for instance GetStyleContext(MOZ_GTK_BUTTON, .., GTK_STATE_FLAG_HOVER)
++ * you get "window button:hover" css selector.
++ * If you want aStateFlags applied to all path elements use
++ * CreateStyleContextWithStates().
++ *
++ * The context is owned by WidgetStyleCache. Do not unref.
+  */
+ GtkStyleContext*
+ GetStyleContext(WidgetNodeType aNodeType,
+@@ -46,6 +52,17 @@ GetStyleContext(WidgetNodeType aNodeType,
+                 GtkStateFlags aStateFlags = GTK_STATE_FLAG_NORMAL,
+                 StyleFlags aFlags = NO_STYLE_FLAGS);
+ 
++/*
++ * Returns a pointer to a style context for the specified node
++ * and state applied to all elements at widget style path.
++ *
++ * The context is owned by caller and must be released by g_object_unref().
++ */
++GtkStyleContext*
++CreateStyleContextWithStates(WidgetNodeType aNodeType,
++                             GtkTextDirection aDirection = GTK_TEXT_DIR_NONE,
++                             GtkStateFlags aStateFlags = GTK_STATE_FLAG_NORMAL);
++
+ void
+ ResetWidgetCache(void);
+ 
+diff --git widget/gtk/mozgtk/mozgtk.c widget/gtk/mozgtk/mozgtk.c
+index 8ed3d7eae82c..b29154a101bf 100644
+--- widget/gtk/mozgtk/mozgtk.c
++++ widget/gtk/mozgtk/mozgtk.c
+@@ -601,6 +601,7 @@ STUB(gtk_widget_path_copy)
+ STUB(gtk_widget_path_free)
+ STUB(gtk_widget_path_iter_add_class)
+ STUB(gtk_widget_path_get_object_type)
++STUB(gtk_widget_path_length)
+ STUB(gtk_widget_path_new)
+ STUB(gtk_widget_path_unref)
+ STUB(gtk_widget_set_valign)
+
+commit b807309b6108
+Author: Martin Stransky <stransky@redhat.com>
+Date:   Wed Apr 18 11:05:46 2018 +0200
+
+    Bug 1355143 - Provide ScrollbarGTKMetrics for active (mouse over) scrollbars, r=jhorak a=lizzard
+    
+    MozReview-Commit-ID: 95d1jeQ8mXd
+    
+    --HG--
+    extra : source : 111bb4416a8541abbe481459c6c3f6189dc2eb56
+---
+ widget/gtk/gtk3drawing.cpp | 67 +++++++++++++++++++++++++++++++++++++---------
+ widget/gtk/gtkdrawing.h    | 10 ++++++-
+ 2 files changed, 63 insertions(+), 14 deletions(-)
+
+diff --git widget/gtk/gtk3drawing.cpp widget/gtk/gtk3drawing.cpp
+index 357d8a5ce5b9..3df564b05d0e 100644
+--- widget/gtk/gtk3drawing.cpp
++++ widget/gtk/gtk3drawing.cpp
+@@ -24,6 +24,7 @@ static gboolean checkbox_check_state;
+ static gboolean notebook_has_tab_gap;
+ 
+ static ScrollbarGTKMetrics sScrollbarMetrics[2];
++static ScrollbarGTKMetrics sScrollbarMetricsActive[2];
+ static ToggleGTKMetrics sCheckboxMetrics;
+ static ToggleGTKMetrics sRadioMetrics;
+ static ToolbarGTKMetrics sToolbarMetrics;
+@@ -182,6 +183,8 @@ moz_gtk_refresh()
+ 
+     sScrollbarMetrics[GTK_ORIENTATION_HORIZONTAL].initialized = false;
+     sScrollbarMetrics[GTK_ORIENTATION_VERTICAL].initialized = false;
++    sScrollbarMetricsActive[GTK_ORIENTATION_HORIZONTAL].initialized = false;
++    sScrollbarMetricsActive[GTK_ORIENTATION_VERTICAL].initialized = false;
+     sCheckboxMetrics.initialized = false;
+     sRadioMetrics.initialized = false;
+     sToolbarMetrics.initialized = false;
+@@ -740,10 +743,9 @@ GetMinContentBox(GtkStyleContext* style)
+  * min-width/min-height.
+  */
+ static void
+-moz_gtk_get_widget_min_size(WidgetNodeType aGtkWidgetType, int* width,
++moz_gtk_get_widget_min_size(GtkStyleContext* style, int* width,
+                             int* height)
+ {
+-  GtkStyleContext* style = GetStyleContext(aGtkWidgetType);
+   GtkStateFlags state_flags = gtk_style_context_get_state(style);
+   gtk_style_context_get(style, state_flags,
+                         "min-height", height,
+@@ -762,10 +764,10 @@ moz_gtk_get_widget_min_size(WidgetNodeType aGtkWidgetType, int* width,
+ }
+ 
+ static MozGtkSize
+-GetMinMarginBox(WidgetNodeType aNodeType)
++GetMinMarginBox(GtkStyleContext* style)
+ {
+     gint width, height;
+-    moz_gtk_get_widget_min_size(aNodeType, &width, &height);
++    moz_gtk_get_widget_min_size(style, &width, &height);
+     return {width, height};
+ }
+ 
+@@ -947,7 +949,7 @@ moz_gtk_scrollbar_trough_paint(WidgetNodeType widget,
+         WidgetNodeType thumb = widget == MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL ?
+             MOZ_GTK_SCROLLBAR_THUMB_VERTICAL :
+             MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL;
+-        MozGtkSize thumbSize = GetMinMarginBox(thumb);
++        MozGtkSize thumbSize = GetMinMarginBox(GetStyleContext(thumb));
+         style = GetStyleContext(widget, direction);
+         MozGtkSize trackSize = GetMinContentBox(style);
+         trackSize.Include(thumbSize);
+@@ -2765,7 +2767,8 @@ moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
+       WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
+                                MOZ_GTK_SCALE_TROUGH_HORIZONTAL :
+                                MOZ_GTK_SCALE_TROUGH_VERTICAL;
+-      moz_gtk_get_widget_min_size(widget, scale_width, scale_height);
++      moz_gtk_get_widget_min_size(GetStyleContext(widget),
++                                  scale_width, scale_height);
+   }
+ }
+ 
+@@ -2884,9 +2887,10 @@ GetToggleMetrics(bool isRadio)
+ }
+ 
+ const ScrollbarGTKMetrics*
+-GetScrollbarMetrics(GtkOrientation aOrientation)
++GetScrollbarMetrics(GtkOrientation aOrientation, bool aActive)
+ {
+-    auto metrics = &sScrollbarMetrics[aOrientation];
++    auto metrics = aActive ? &sScrollbarMetricsActive[aOrientation] :
++                             &sScrollbarMetrics[aOrientation];
+     if (metrics->initialized)
+         return metrics;
+ 
+@@ -2896,7 +2900,9 @@ GetScrollbarMetrics(GtkOrientation aOrientation)
+         MOZ_GTK_SCROLLBAR_HORIZONTAL : MOZ_GTK_SCROLLBAR_VERTICAL;
+ 
+     gboolean backward, forward, secondary_backward, secondary_forward;
+-    GtkStyleContext* style = GetStyleContext(scrollbar);
++    GtkStyleContext* style = GetStyleContext(scrollbar, GTK_TEXT_DIR_NONE,
++                             aActive ? GTK_STATE_FLAG_PRELIGHT :
++                                       GTK_STATE_FLAG_NORMAL);
+     gtk_style_context_get_style(style,
+                                 "has-backward-stepper", &backward,
+                                 "has-forward-stepper", &forward,
+@@ -2963,16 +2969,48 @@ GetScrollbarMetrics(GtkOrientation aOrientation)
+         track = MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL;
+         thumb = MOZ_GTK_SCROLLBAR_THUMB_VERTICAL;
+     }
++
++    /* GetStyleContext() sets GtkStateFlags to the latest widget name
++     * in css selector string. When we call:
++     *
++     *     GetStyleContext(thumb, GTK_STATE_FLAG_PRELIGHT)
++     *
++     * we get:
++     *
++     *    "scrollbar contents trough slider:hover"
++     *
++     * Some themes (Ubuntu Ambiance) styles trough/thumb by scrollbar,
++     * the Gtk+ css rule looks like:
++     *
++     *    "scrollbar:hover contents trough slider"
++     *
++     *  So we need to apply GtkStateFlags to each widgets in style path.
++     */
++
+     // thumb
+-    metrics->size.thumb = GetMinMarginBox(thumb);
++    style = CreateStyleContextWithStates(thumb, GTK_TEXT_DIR_NONE,
++                                         aActive ? GTK_STATE_FLAG_PRELIGHT :
++                                                   GTK_STATE_FLAG_NORMAL);
++    metrics->size.thumb = GetMinMarginBox(style);
++    g_object_unref(style);
++
+     // track
+-    style = GetStyleContext(track);
++    style = CreateStyleContextWithStates(track, GTK_TEXT_DIR_NONE,
++                                         aActive ? GTK_STATE_FLAG_PRELIGHT :
++                                                   GTK_STATE_FLAG_NORMAL);
+     metrics->border.track = GetMarginBorderPadding(style);
+     MozGtkSize trackMinSize = GetMinContentBox(style) + metrics->border.track;
+     MozGtkSize trackSizeForThumb = metrics->size.thumb + metrics->border.track;
++    g_object_unref(style);
++
+     // button
+     if (hasButtons) {
+-        metrics->size.button = GetMinMarginBox(MOZ_GTK_SCROLLBAR_BUTTON);
++        style = CreateStyleContextWithStates(MOZ_GTK_SCROLLBAR_BUTTON,
++                                             GTK_TEXT_DIR_NONE,
++                                             aActive ? GTK_STATE_FLAG_PRELIGHT :
++                                                       GTK_STATE_FLAG_NORMAL);
++        metrics->size.button = GetMinMarginBox(style);
++        g_object_unref(style);
+     } else {
+         metrics->size.button = {0, 0};
+     }
+@@ -3006,8 +3044,11 @@ GetScrollbarMetrics(GtkOrientation aOrientation)
+         }
+     }
+ 
+-    style = GetStyleContext(contents);
++    style = CreateStyleContextWithStates(contents, GTK_TEXT_DIR_NONE,
++                                            aActive ? GTK_STATE_FLAG_PRELIGHT :
++                                                      GTK_STATE_FLAG_NORMAL);
+     GtkBorder contentsBorder = GetMarginBorderPadding(style);
++    g_object_unref(style);
+ 
+     metrics->size.scrollbar =
+         trackSizeForThumb + contentsBorder + metrics->border.scrollbar;
+diff --git widget/gtk/gtkdrawing.h widget/gtk/gtkdrawing.h
+index 2ce31a3dc68a..47da7c1ccaac 100644
+--- widget/gtk/gtkdrawing.h
++++ widget/gtk/gtkdrawing.h
+@@ -53,6 +53,11 @@ struct MozGtkSize {
+     MozGtkSize result = *this;
+     return result += aBorder;
+   }
++  bool operator<(const MozGtkSize &aOther) const
++  {
++    return (width < aOther.width && height <= aOther.height) ||
++           (width <= aOther.width && height < aOther.height);
++  }
+   void Include(MozGtkSize aOther)
+   {
+     width = std::max(width, aOther.width);
+@@ -491,9 +496,12 @@ moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint*
+ 
+ /**
+  * Get the metrics in GTK pixels for a scrollbar.
++ * aOrientation:     [IN] the scrollbar orientation
++ * aActive:          [IN] Metricts for scrollbar with mouse pointer over it.
++ *
+  */
+ const ScrollbarGTKMetrics*
+-GetScrollbarMetrics(GtkOrientation aOrientation);
++GetScrollbarMetrics(GtkOrientation aOrientation, bool aActive = false);
+ 
+ /**
+  * Get the desired size of a dropdown arrow button
+
+commit e31268bc56be
+Author: Martin Stransky <stransky@redhat.com>
+Date:   Wed Apr 18 11:09:19 2018 +0200
+
+    Bug 1355143 - Size scrollbars with 'hover' Gtk+ state, r=jhorak a=lizzard
+    
+    Ubuntu/Ambiance has tiny scrollbars when it's not hovered by mouse and large
+    ones when it's hovered/active. Our current Gtk+ toolkit code does not support such scrollbar
+    resize on the fly.
+    
+    We use a workaround as we get size of active (hovered) scrollbar only and that
+    we pass to gecko. Then we draw scrolbar smaller when it's not hovered and full sized
+    when it's hovered.
+    
+    MozReview-Commit-ID: mxt9q5Bcg9
+    
+    --HG--
+    extra : source : 4405d1c4673b0b1eb415b528c5e252585094b150
+---
+ widget/gtk/nsNativeThemeGTK.cpp | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git widget/gtk/nsNativeThemeGTK.cpp widget/gtk/nsNativeThemeGTK.cpp
+index 059bd38f69cd..25b6105cd5f4 100644
+--- widget/gtk/nsNativeThemeGTK.cpp
++++ widget/gtk/nsNativeThemeGTK.cpp
+@@ -1287,7 +1287,7 @@ nsNativeThemeGTK::GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
+       GtkOrientation orientation =
+         aWidgetType == NS_THEME_SCROLLBAR_HORIZONTAL ?
+         GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
+-      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation);
++      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation, true);
+ 
+       const GtkBorder& border = metrics->border.scrollbar;
+       aResult->top = border.top;
+@@ -1302,7 +1302,7 @@ nsNativeThemeGTK::GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
+       GtkOrientation orientation =
+         aWidgetType == NS_THEME_SCROLLBARTRACK_HORIZONTAL ?
+         GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
+-      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation);
++      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation, true);
+ 
+       const GtkBorder& border = metrics->border.track;
+       aResult->top = border.top;
+@@ -1457,7 +1457,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
+     case NS_THEME_SCROLLBARBUTTON_DOWN:
+       {
+         const ScrollbarGTKMetrics* metrics =
+-          GetScrollbarMetrics(GTK_ORIENTATION_VERTICAL);
++          GetScrollbarMetrics(GTK_ORIENTATION_VERTICAL, true);
+ 
+         aResult->width = metrics->size.button.width;
+         aResult->height = metrics->size.button.height;
+@@ -1468,7 +1468,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
+     case NS_THEME_SCROLLBARBUTTON_RIGHT:
+       {
+         const ScrollbarGTKMetrics* metrics =
+-          GetScrollbarMetrics(GTK_ORIENTATION_HORIZONTAL);
++          GetScrollbarMetrics(GTK_ORIENTATION_HORIZONTAL, true);
+ 
+         aResult->width = metrics->size.button.width;
+         aResult->height = metrics->size.button.height;
+@@ -1501,7 +1501,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
+       GtkOrientation orientation =
+         aWidgetType == NS_THEME_SCROLLBAR_HORIZONTAL ?
+         GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
+-      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation);
++      const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation, true);
+ 
+       aResult->width = metrics->size.scrollbar.width;
+       aResult->height = metrics->size.scrollbar.height;
+@@ -1513,7 +1513,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
+         GtkOrientation orientation =
+           aWidgetType == NS_THEME_SCROLLBARTHUMB_HORIZONTAL ?
+           GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
+-        const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation);
++        const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation, true);
+ 
+         aResult->width = metrics->size.thumb.width;
+         aResult->height = metrics->size.thumb.height;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804260028.w3Q0SdIc083150>