aboutsummaryrefslogblamecommitdiff
path: root/www/waterfox/files/patch-bug1377158
blob: dc4385635715337a4406e80d1a34fb6e8967b8c1 (plain) (tree)




























































































































































































































































































                                                                                                                                                                                                                             
commit 9e809e01c262
Author: Xidorn Quan <me@upsuper.org>
Date:   Thu Aug 3 11:24:55 2017 +1000

    Bug 1377158 - (Part 1) Set style backend to stylo when SVG is used as an image. r=heycam
    
    MozReview-Commit-ID: 9FnA8X84h87
    
    --HG--
    extra : rebase_source : 49a6140c4c78c35f755710934c798ce46dafa213
---
 dom/base/nsDocument.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git dom/base/nsDocument.cpp dom/base/nsDocument.cpp
index 3585a7e222df..b4773160af92 100644
--- dom/base/nsDocument.cpp
+++ dom/base/nsDocument.cpp
@@ -13219,7 +13219,10 @@ nsIDocument::UpdateStyleBackendType()
 
 #ifdef MOZ_STYLO
   if (nsLayoutUtils::StyloEnabled()) {
-    if (!mDocumentContainer) {
+    if (IsBeingUsedAsImage()) {
+      // Enable stylo for SVG-as-image.
+      mStyleBackendType = StyleBackendType::Servo;
+    } else if (!mDocumentContainer) {
       NS_WARNING("stylo: No docshell yet, assuming Gecko style system");
     } else if ((IsHTMLOrXHTML() || IsSVGDocument()) &&
                IsContentDocument()) {

commit e418f1ccf520
Author: KuoE0 <kuoe0.tw@gmail.com>
Date:   Mon Jul 24 11:51:20 2017 +0800

    Bug 1377158 - (Part 2) Add the info of StyloEnabled() to hash function to make reftests of styloVsGecko get the correct caches. r=heycam
    
    MozReview-Commit-ID: 7cyXheHQ7Ot
    
    --HG--
    extra : rebase_source : 4a92de63228cb2a138d95d8f366b39122dbdc05e
---
 image/ImageCacheKey.cpp | 20 ++++++++++++++++----
 image/ImageCacheKey.h   |  7 ++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git image/ImageCacheKey.cpp image/ImageCacheKey.cpp
index c3327155c1cd..2dfdc7c763cc 100644
--- image/ImageCacheKey.cpp
+++ image/ImageCacheKey.cpp
@@ -8,6 +8,7 @@
 #include "mozilla/Move.h"
 #include "ImageURL.h"
 #include "nsHostObjectProtocolHandler.h"
+#include "nsLayoutUtils.h"
 #include "nsString.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/workers/ServiceWorkerManager.h"
@@ -53,6 +54,7 @@ ImageCacheKey::ImageCacheKey(nsIURI* aURI,
   , mOriginAttributes(aAttrs)
   , mControlledDocument(GetControlledDocumentToken(aDocument))
   , mIsChrome(URISchemeIs(mURI, "chrome"))
+  , mIsStyloEnabled(nsLayoutUtils::StyloEnabled())
 {
   NS_ENSURE_SUCCESS_VOID(aRv);
 
@@ -62,7 +64,8 @@ ImageCacheKey::ImageCacheKey(nsIURI* aURI,
     mBlobSerial = BlobSerial(mURI);
   }
 
-  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument);
+  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument,
+                      mIsStyloEnabled);
 }
 
 ImageCacheKey::ImageCacheKey(ImageURL* aURI,
@@ -72,6 +75,7 @@ ImageCacheKey::ImageCacheKey(ImageURL* aURI,
   , mOriginAttributes(aAttrs)
   , mControlledDocument(GetControlledDocumentToken(aDocument))
   , mIsChrome(URISchemeIs(mURI, "chrome"))
+  , mIsStyloEnabled(nsLayoutUtils::StyloEnabled())
 {
   MOZ_ASSERT(aURI);
 
@@ -79,7 +83,8 @@ ImageCacheKey::ImageCacheKey(ImageURL* aURI,
     mBlobSerial = BlobSerial(mURI);
   }
 
-  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument);
+  mHash = ComputeHash(mURI, mBlobSerial, mOriginAttributes, mControlledDocument,
+                      mIsStyloEnabled);
 }
 
 ImageCacheKey::ImageCacheKey(const ImageCacheKey& aOther)
@@ -89,6 +94,7 @@ ImageCacheKey::ImageCacheKey(const ImageCacheKey& aOther)
   , mControlledDocument(aOther.mControlledDocument)
   , mHash(aOther.mHash)
   , mIsChrome(aOther.mIsChrome)
+  , mIsStyloEnabled(aOther.mIsStyloEnabled)
 { }
 
 ImageCacheKey::ImageCacheKey(ImageCacheKey&& aOther)
@@ -98,11 +104,15 @@ ImageCacheKey::ImageCacheKey(ImageCacheKey&& aOther)
   , mControlledDocument(aOther.mControlledDocument)
   , mHash(aOther.mHash)
   , mIsChrome(aOther.mIsChrome)
+  , mIsStyloEnabled(aOther.mIsStyloEnabled)
 { }
 
 bool
 ImageCacheKey::operator==(const ImageCacheKey& aOther) const
 {
+  if (mIsStyloEnabled != aOther.mIsStyloEnabled) {
+    return false;
+  }
   // Don't share the image cache between a controlled document and anything else.
   if (mControlledDocument != aOther.mControlledDocument) {
     return false;
@@ -132,7 +142,8 @@ ImageCacheKey::Spec() const
 ImageCacheKey::ComputeHash(ImageURL* aURI,
                            const Maybe<uint64_t>& aBlobSerial,
                            const OriginAttributes& aAttrs,
-                           void* aControlledDocument)
+                           void* aControlledDocument,
+                           bool aIsStyloEnabled)
 {
   // Since we frequently call Hash() several times in a row on the same
   // ImageCacheKey, as an optimization we compute our hash once and store it.
@@ -142,7 +153,8 @@ ImageCacheKey::ComputeHash(ImageURL* aURI,
   aAttrs.CreateSuffix(suffix);
 
   return AddToHash(0, aURI->ComputeHash(aBlobSerial),
-                   HashString(suffix), HashString(ptr));
+                   HashString(suffix), HashString(ptr),
+                   aIsStyloEnabled);
 }
 
 /* static */ void*
diff --git image/ImageCacheKey.h image/ImageCacheKey.h
index c5acd0ea495e..6d676ccb6338 100644
--- image/ImageCacheKey.h
+++ image/ImageCacheKey.h
@@ -58,7 +58,8 @@ private:
   static PLDHashNumber ComputeHash(ImageURL* aURI,
                                    const Maybe<uint64_t>& aBlobSerial,
                                    const OriginAttributes& aAttrs,
-                                   void* aControlledDocument);
+                                   void* aControlledDocument,
+                                   bool aIsStyloEnabled);
   static void* GetControlledDocumentToken(nsIDocument* aDocument);
 
   RefPtr<ImageURL> mURI;
@@ -67,6 +68,10 @@ private:
   void* mControlledDocument;
   PLDHashNumber mHash;
   bool mIsChrome;
+  // To prevent the reftests of styloVsGecko taking the same image cache after
+  // refreshing, we need to store different caches of stylo and gecko. So, we
+  // also consider the info of StyloEnabled() in ImageCacheKey.
+  bool mIsStyloEnabled;
 };
 
 } // namespace image

commit c95ed14053c7
Author: KuoE0 <kuoe0.tw@gmail.com>
Date:   Thu Jul 27 14:06:54 2017 +0800

    Bug 1377158 - (Part 3) Update the expectation of test cases. r=bholley,heycam
    
    MozReview-Commit-ID: K3gmTudkzol
    
    --HG--
    extra : rebase_source : 32ba6ceb37fa2f29cde8d2534d73108e87dfa406
---
 layout/reftests/css-break/reftest.list        | 2 +-
 layout/reftests/svg/as-image/reftest.list     | 2 +-
 layout/reftests/table-background/reftest.list | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git layout/reftests/css-break/reftest.list layout/reftests/css-break/reftest.list
index 4364cf7d93fc..54cfbcbbeefc 100644
--- layout/reftests/css-break/reftest.list
+++ layout/reftests/css-break/reftest.list
@@ -2,7 +2,7 @@ default-preferences pref(layout.css.box-decoration-break.enabled,true)
 
 == box-decoration-break-1.html box-decoration-break-1-ref.html
 fuzzy(1,20) fuzzy-if(skiaContent,1,700) fuzzy-if(webrender,4-4,3273-3273) == box-decoration-break-with-inset-box-shadow-1.html box-decoration-break-with-inset-box-shadow-1-ref.html
-fuzzy(16,460) fuzzy-if(Android,10,3673) fuzzy-if(skiaContent,57,374) == box-decoration-break-with-outset-box-shadow-1.html box-decoration-break-with-outset-box-shadow-1-ref.html
+fuzzy(16,460) fuzzy-if(Android,10,3673) fuzzy-if(skiaContent,57,374) fuzzy-if(styloVsGecko,1,420) == box-decoration-break-with-outset-box-shadow-1.html box-decoration-break-with-outset-box-shadow-1-ref.html # Bug 1386543
 random-if(!gtkWidget) HTTP(..) == box-decoration-break-border-image.html box-decoration-break-border-image-ref.html
 == box-decoration-break-block-border-padding.html box-decoration-break-block-border-padding-ref.html
 == box-decoration-break-block-margin.html box-decoration-break-block-margin-ref.html
diff --git layout/reftests/svg/as-image/reftest.list layout/reftests/svg/as-image/reftest.list
index d5feb66693ad..acff18d18b50 100644
--- layout/reftests/svg/as-image/reftest.list
+++ layout/reftests/svg/as-image/reftest.list
@@ -58,7 +58,7 @@ fuzzy(1,2) fuzzy-if(azureSkia,1,40000) == canvas-drawImage-alpha-2.html canvas-d
 # context-fill:
 == context-fill-01.html blue100x100-ref.html
 test-pref(svg.context-properties.content.enabled,true) == context-fill-01.html lime100x100-ref.html
-== context-fill-02.html transparent100x100-w-border-ref.html
+fails-if(styloVsGecko||stylo) == context-fill-02.html transparent100x100-w-border-ref.html # Bug 1380590
 test-pref(svg.context-properties.content.enabled,true) == context-fill-02.html lime100x100-w-border-ref.html
 test-pref(svg.context-properties.content.enabled,true) == context-fill-03.html lime100x100-50pct-ref.html
 # fuzz because on win8 the r & b components are off by one
diff --git layout/reftests/table-background/reftest.list layout/reftests/table-background/reftest.list
index d8a138112527..df2f629d0d7f 100644
--- layout/reftests/table-background/reftest.list
+++ layout/reftests/table-background/reftest.list
@@ -1,11 +1,11 @@
 # these could be moved to crashtests
 != backgr_border-table-cell.html empty.html
-!= backgr_border-table-column-group.html empty.html
+fuzzy-if(styloVsGecko,5,330) != backgr_border-table-column-group.html empty.html # Bug 1386543
 # This seems to be caused by bug 527825
-asserts-if(gtkWidget,0-12) != backgr_border-table-column.html empty.html
+fuzzy-if(styloVsGecko,5,561) asserts-if(gtkWidget,0-12) != backgr_border-table-column.html empty.html # Bug 1386543
 asserts-if(gtkWidget,0-6) != backgr_border-table-quirks.html empty.html
-!= backgr_border-table-row-group.html empty.html
-!= backgr_border-table-row.html empty.html
+fuzzy-if(styloVsGecko,1,168) != backgr_border-table-row-group.html empty.html # Bug 1386543
+fuzzy-if(styloVsGecko,1,168) != backgr_border-table-row.html empty.html # Bug 1386543
 != backgr_border-table.html empty.html
 != backgr_fixed-bg.html empty.html
 != backgr_index.html empty.html

commit dd7cb82fb7b5
Author: KuoE0 <kuoe0.tw@gmail.com>
Date:   Fri Jul 28 00:23:05 2017 +0800

    Bug 1377158 - (Part 4) Reduce the assertion cost to check reconstruction frame hint. r=bholley,heycam
    
    The original assertion took too long time to check nsStyleChangeList. It
    caused the test case with many elements timed-out and failed.
    
    MozReview-Commit-ID: FpNZvdQFTtR
    
    --HG--
    extra : rebase_source : c68072448061c4dcc8399131924cf718a5e53700
---
 layout/base/nsStyleChangeList.cpp | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git layout/base/nsStyleChangeList.cpp layout/base/nsStyleChangeList.cpp
index 6f68cded3814..af6256f46c22 100644
--- layout/base/nsStyleChangeList.cpp
+++ layout/base/nsStyleChangeList.cpp
@@ -41,17 +41,25 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
              (aHint & nsChangeHint_NeedReflow),
              "Reflow hint bits set without actually asking for a reflow");
 
-  // If Servo fires reconstruct at a node, it is the only change hint fired at
-  // that node.
-  if (IsServo()) {
-    for (size_t i = 0; i < Length(); ++i) {
-      MOZ_ASSERT(!aContent || !((aHint | (*this)[i].mHint) & nsChangeHint_ReconstructFrame) ||
-                 (*this)[i].mContent != aContent);
-    }
-  } else {
-    // Filter out all other changes for same content for Gecko (Servo asserts against this
-    // case above).
-    if (aContent && (aHint & nsChangeHint_ReconstructFrame)) {
+  if (aContent && (aHint & nsChangeHint_ReconstructFrame)) {
+    // If Servo fires reconstruct at a node, it is the only change hint fired at
+    // that node.
+    if (IsServo()) {
+      // Note: Because we check whether |aHint| is a reconstruct above (which is
+      // necessary to avoid debug test timeouts on certain crashtests), this check
+      // will not find bugs where we add a non-reconstruct hint for an element after
+      // adding a reconstruct. This is ok though, since ProcessRestyledFrames will
+      // handle that case via mDestroyedFrames.
+      for (size_t i = 0; i < Length(); ++i) {
+        MOZ_ASSERT(aContent != (*this)[i].mContent ||
+                   !((*this)[i].mHint & nsChangeHint_ReconstructFrame),
+                   "Should not append a non-ReconstructFrame hint after \
+                   appending a ReconstructFrame hint for the same \
+                   content.");
+      }
+    } else {
+      // Filter out all other changes for same content for Gecko (Servo asserts against this
+      // case above).
       // NOTE: This is captured by reference to please static analysis.
       // Capturing it by value as a pointer should be fine in this case.
       RemoveElementsBy([&](const nsStyleChangeData& aData) {