Bug 1484587 - Put the behavior that overflow-wrap: break-word affecting intrinsic size behind a pref and disable it by default. r=jfkthame
authorXidorn Quan <me@upsuper.org>
Wed, 22 Aug 2018 06:55:13 +0000
changeset 481101 b59a431b833b30bbaf1060937f0bc9ab51b0bf91
parent 481100 2dd1517113c3b4b77ed0baf5313e9b0ae1a6a873
child 481102 05f438b601b5e6d4df5dfef992c2cf1d153757ea
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersjfkthame
bugs1484587
milestone63.0a1
Bug 1484587 - Put the behavior that overflow-wrap: break-word affecting intrinsic size behind a pref and disable it by default. r=jfkthame Differential Revision: https://phabricator.services.mozilla.com/D3749
layout/generic/nsTextFrame.cpp
modules/libpref/init/StaticPrefList.h
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html.ini
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini
testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html.ini
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -12,16 +12,17 @@
 #include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MathAlgorithms.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/BinarySearch.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/Unused.h"
 #include "mozilla/PodOperations.h"
 
 #include "nsCOMPtr.h"
 #include "nsBlockFrame.h"
@@ -8551,17 +8552,18 @@ nsTextFrame::AddInlineMinISizeForFlow(gf
       aData->OptionallyBreak();
     }
     aData->mCurrentLine += provider.GetFontMetrics()->EmHeight();
     aData->mTrailingWhitespace = 0;
     return;
   }
 
   // If overflow-wrap is break-word, we can wrap everywhere.
-  if (textStyle->WordCanWrap(this)) {
+  if (StaticPrefs::layout_css_overflow_break_intrinsic_size() &&
+      textStyle->WordCanWrap(this)) {
     aData->OptionallyBreak();
     aData->mCurrentLine +=
       textRun->GetMinAdvanceWidth(Range(start, flowEndInTextRun));
     aData->mTrailingWhitespace = 0;
     aData->mAtStartOfLine = false;
     aData->OptionallyBreak();
     return;
   }
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -429,16 +429,23 @@ VARCACHE_PREF(
 
 // Is overflow: -moz-scrollbars-* value enabled?
 VARCACHE_PREF(
   "layout.css.overflow.moz-scrollbars.enabled",
    layout_css_overflow_moz_scrollbars_enabled,
   bool, false
 )
 
+// Does overflow-break: break-word affect intrinsic size?
+VARCACHE_PREF(
+  "layout.css.overflow-break.intrinsic-size",
+   layout_css_overflow_break_intrinsic_size,
+  bool, false
+)
+
 //---------------------------------------------------------------------------
 // JavaScript prefs
 //---------------------------------------------------------------------------
 
 // nsJSEnvironmentObserver observes the memory-pressure notifications and
 // forces a garbage collection and cycle collection when it happens, if the
 // appropriate pref is set.
 #ifdef ANDROID
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-001.html.ini
@@ -0,0 +1,2 @@
+[overflow-wrap-min-content-size-001.html]
+  prefs: [layout.css.overflow-break.intrinsic-size:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html.ini
@@ -0,0 +1,2 @@
+[overflow-wrap-min-content-size-002.html]
+  prefs: [layout.css.overflow-break.intrinsic-size:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html.ini
@@ -0,0 +1,2 @@
+[overflow-wrap-min-content-size-003.html]
+  prefs: [layout.css.overflow-break.intrinsic-size:true]