Bug 1229278 - Fix dynamic changes to text-emphasis-style. r=dbaron
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 08 Dec 2015 12:55:01 -0500
changeset 310054 67aea49920bc30e931b0f27fbdffc88218d32265
parent 310053 56cf53f1d5e26bf486904b1aab4022f31538e80d
child 310055 266672b18676c699247a6d828558a2c075604b8c
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1229278
milestone45.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
Bug 1229278 - Fix dynamic changes to text-emphasis-style. r=dbaron
layout/reftests/text-decoration/emphasis-style-dynamic-ref.html
layout/reftests/text-decoration/emphasis-style-dynamic.html
layout/reftests/text-decoration/reftest.list
layout/style/nsStyleStruct.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/emphasis-style-dynamic-ref.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="ja">
+<meta charset="UTF-8">
+<title>Bug 1229278 - Dynamic change to text-emphasis-style</title>
+<style>
+  div {
+    line-height: 5;
+    text-emphasis-style: filled triangle;
+  }
+</style>
+<div>テスト</div>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-decoration/emphasis-style-dynamic.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html lang="ja" class="reftest-wait">
+<meta charset="UTF-8">
+<title>Bug 1229278 - Dynamic change to text-emphasis-style</title>
+<style>
+  div {
+    line-height: 5;
+    text-emphasis-style: filled triangle;
+  }
+  .reftest-wait div {
+    text-emphasis-style: filled circle;
+  }
+</style>
+<div>テスト</div>
+<script>
+  document.addEventListener("MozReftestInvalidate", function() {
+    document.documentElement.className = "";
+  });
+</script>
+</html>
--- a/layout/reftests/text-decoration/reftest.list
+++ b/layout/reftests/text-decoration/reftest.list
@@ -104,8 +104,9 @@ fuzzy-if(cocoaWidget,1,5) == decoration-
 != inline-baseline-quirks.html inline-baseline-quirks-ref.html
 == 676538-1.html 676538-1-ref.html
 fuzzy-if(OSX==1010,1,4) == underline-button-1.html underline-button-1-ref.html
 fuzzy-if(OSX==1010,1,2) == underline-button-2.html underline-button-2-ref.html
 == underline-select-1.html underline-select-1-ref.html
 == underline-select-2.html underline-select-2-ref.html
 == 1133392.html 1133392-ref.html
 != 1159729-offset-adjustment.html 1159729-offset-adjustment-notref.html
+pref(layout.css.text-emphasis.enabled,true) == emphasis-style-dynamic.html emphasis-style-dynamic-ref.html
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -3635,29 +3635,24 @@ nsChangeHint nsStyleText::CalcDifference
   if (HasTextEmphasis() != aOther.HasTextEmphasis() ||
       (HasTextEmphasis() &&
        mTextEmphasisPosition != aOther.mTextEmphasisPosition)) {
     // Text emphasis position change could affect line height calculation.
     return nsChangeHint_AllReflowHints |
            nsChangeHint_RepaintFrame;
   }
 
-  if (!AreShadowArraysEqual(mTextShadow, aOther.mTextShadow)) {
+  if (!AreShadowArraysEqual(mTextShadow, aOther.mTextShadow) ||
+      mTextEmphasisStyle != aOther.mTextEmphasisStyle ||
+      mTextEmphasisStyleString != aOther.mTextEmphasisStyleString) {
     return nsChangeHint_UpdateSubtreeOverflow |
            nsChangeHint_SchedulePaint |
            nsChangeHint_RepaintFrame;
   }
 
-  if (mTextEmphasisStyle != aOther.mTextEmphasisStyle ||
-      mTextEmphasisStyleString != aOther.mTextEmphasisStyleString) {
-    return nsChangeHint_UpdateOverflow |
-           nsChangeHint_SchedulePaint |
-           nsChangeHint_RepaintFrame;
-  }
-
   MOZ_ASSERT(!mTextEmphasisColorForeground ||
              !aOther.mTextEmphasisColorForeground ||
              mTextEmphasisColor == aOther.mTextEmphasisColor,
              "If the text-emphasis-color are both foreground color, "
              "mTextEmphasisColor should also be identical");
   if (mTextEmphasisColorForeground != aOther.mTextEmphasisColorForeground ||
       mTextEmphasisColor != aOther.mTextEmphasisColor) {
     return nsChangeHint_SchedulePaint |