Merge mozilla-central to autoland. a=merge CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Tue, 26 Feb 2019 05:57:14 +0200
changeset 518908 62d66c338b8a4c4f59121bbf91e0b455c33eb404
parent 518907 b36c070f066b2d17c4b3d871cfac28e9c1961e31 (current diff)
parent 518901 7c89a561baee4bf8a5b726a30032d40a5986180f (diff)
child 518909 04b5ccccaa742b42be9a4200b17cfffc29a5d0f9
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland. a=merge CLOSED TREE
--- a/dom/security/PolicyTokenizer.cpp
+++ b/dom/security/PolicyTokenizer.cpp
@@ -22,37 +22,42 @@ PolicyTokenizer::PolicyTokenizer(const c
 }
 
 PolicyTokenizer::~PolicyTokenizer() {
   POLICYTOKENIZERLOG(("PolicyTokenizer::~PolicyTokenizer"));
 }
 
 void PolicyTokenizer::generateNextToken() {
   skipWhiteSpaceAndSemicolon();
+  MOZ_ASSERT(mCurToken.Length() == 0);
+  const char16_t* const start = mCurChar;
   while (!atEnd() && !nsContentUtils::IsHTMLWhitespace(*mCurChar) &&
          *mCurChar != SEMICOL) {
-    mCurToken.Append(*mCurChar++);
+    mCurChar++;
+  }
+  if (start != mCurChar) {
+    mCurToken.Append(start, mCurChar - start);
   }
   POLICYTOKENIZERLOG(("PolicyTokenizer::generateNextToken: %s",
                       NS_ConvertUTF16toUTF8(mCurToken).get()));
 }
 
 void PolicyTokenizer::generateTokens(policyTokens& outTokens) {
   POLICYTOKENIZERLOG(("PolicyTokenizer::generateTokens"));
 
   // dirAndSrcs holds one set of [ name, src, src, src, ... ]
   nsTArray<nsString> dirAndSrcs;
 
   while (!atEnd()) {
     generateNextToken();
     dirAndSrcs.AppendElement(mCurToken);
     skipWhiteSpace();
     if (atEnd() || accept(SEMICOL)) {
-      outTokens.AppendElement(dirAndSrcs);
-      dirAndSrcs.Clear();
+      outTokens.AppendElement(std::move(dirAndSrcs));
+      dirAndSrcs.ClearAndRetainStorage();
     }
   }
 }
 
 void PolicyTokenizer::tokenizePolicy(const nsAString& aPolicyString,
                                      policyTokens& outTokens) {
   POLICYTOKENIZERLOG(("PolicyTokenizer::tokenizePolicy"));
 
--- a/dom/security/PolicyTokenizer.h
+++ b/dom/security/PolicyTokenizer.h
@@ -40,25 +40,25 @@ class PolicyTokenizer {
  private:
   PolicyTokenizer(const char16_t* aStart, const char16_t* aEnd);
   ~PolicyTokenizer();
 
   inline bool atEnd() { return mCurChar >= mEndChar; }
 
   inline void skipWhiteSpace() {
     while (mCurChar < mEndChar && nsContentUtils::IsHTMLWhitespace(*mCurChar)) {
-      mCurToken.Append(*mCurChar++);
+      mCurChar++;
     }
     mCurToken.Truncate();
   }
 
   inline void skipWhiteSpaceAndSemicolon() {
     while (mCurChar < mEndChar &&
            (*mCurChar == ';' || nsContentUtils::IsHTMLWhitespace(*mCurChar))) {
-      mCurToken.Append(*mCurChar++);
+      mCurChar++;
     }
     mCurToken.Truncate();
   }
 
   inline bool accept(char16_t aChar) {
     NS_ASSERTION(mCurChar < mEndChar, "Trying to dereference mEndChar");
     if (*mCurChar == aChar) {
       mCurToken.Append(*mCurChar++);
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5217,21 +5217,21 @@ bool SVGTextFrame::UpdateFontSizeScaleFa
   if (minTextRunSize >= CLAMP_MIN_SIZE && maxTextRunSize <= CLAMP_MAX_SIZE) {
     // We are already in the ideal font size range for all text frames,
     // so we only have to take into account the contextScale.
     mFontSizeScaleFactor = contextScale;
   } else if (maxSize / minSize > CLAMP_MAX_SIZE / CLAMP_MIN_SIZE) {
     // We can't scale the font sizes so that all of the text frames lie
     // within our ideal font size range, so we treat the minimum as more
     // important and just scale so that minSize = CLAMP_MIN_SIZE.
-    mFontSizeScaleFactor = CLAMP_MIN_SIZE / minTextRunSize;
+    mFontSizeScaleFactor = CLAMP_MIN_SIZE / minSize;
   } else if (minTextRunSize < CLAMP_MIN_SIZE) {
-    mFontSizeScaleFactor = CLAMP_MIN_SIZE / minTextRunSize;
+    mFontSizeScaleFactor = CLAMP_MIN_SIZE / minSize;
   } else {
-    mFontSizeScaleFactor = CLAMP_MAX_SIZE / maxTextRunSize;
+    mFontSizeScaleFactor = CLAMP_MAX_SIZE / maxSize;
   }
 
   return mFontSizeScaleFactor != oldFontSizeScaleFactor;
 }
 
 double SVGTextFrame::GetFontSizeScaleFactor() const {
   return mFontSizeScaleFactor;
 }
--- a/toolkit/content/widgets/text.js
+++ b/toolkit/content/widgets/text.js
@@ -8,32 +8,34 @@
 // leaking to window scope.
 {
 const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 class MozTextLink extends MozElementMixin(XULTextElement) {
   constructor() {
     super();
 
-    this.classList.add("text-link");
-
     this.addEventListener("click", (event) => {
       if (event.button == 0 || event.button == 1) {
         this.open(event);
       }
     }, true);
 
     this.addEventListener("keypress", (event) => {
       if (event.keyCode != KeyEvent.DOM_VK_RETURN) {
         return;
       }
       this.click();
     });
   }
 
+  connectedCallback() {
+    this.classList.add("text-link");
+  }
+
   set href(val) {
     this.setAttribute("href", val);
     return val;
   }
 
   get href() {
     return this.getAttribute("href");
   }