From dadef50bdc3c6b546aad9e3231943e41ad3ccb97 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 3 Oct 2020 14:52:47 +0000 Subject: Issue #1666 - Implement overflow-wrap: anywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This aligns with the current spec regarding overflow-wrap: break-word and overflow-wrap: anywhere in if it affects intrinsic sized due to considering soft-wrap opportunities or not. See CSS Text Module Level 3, Editor’s Draft, 1 October 2020, Section 5.5 --- layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSProps.cpp | 1 + layout/style/nsStyleConsts.h | 1 + layout/style/nsStyleStruct.h | 7 +++++-- 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'layout/style') diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 9045da9ff..86ba59142 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -144,6 +144,7 @@ CSS_KEY(alternate, alternate) CSS_KEY(alternate-reverse, alternate_reverse) CSS_KEY(always, always) CSS_KEY(annotation, annotation) +CSS_KEY(anywhere, anywhere) CSS_KEY(appworkspace, appworkspace) CSS_KEY(auto, auto) CSS_KEY(auto-fill, auto_fill) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 24c97cf33..e0cda2488 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2284,6 +2284,7 @@ const KTableEntry nsCSSProps::kWordBreakKTable[] = { const KTableEntry nsCSSProps::kOverflowWrapKTable[] = { { eCSSKeyword_normal, NS_STYLE_OVERFLOWWRAP_NORMAL }, { eCSSKeyword_break_word, NS_STYLE_OVERFLOWWRAP_BREAK_WORD }, + { eCSSKeyword_anywhere, NS_STYLE_OVERFLOWWRAP_ANYWHERE }, { eCSSKeyword_UNKNOWN, -1 } }; diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index f54387aa8..e6a0cc65a 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -997,6 +997,7 @@ enum class StyleDisplay : uint8_t { // See nsStyleText #define NS_STYLE_OVERFLOWWRAP_NORMAL 0 #define NS_STYLE_OVERFLOWWRAP_BREAK_WORD 1 +#define NS_STYLE_OVERFLOWWRAP_ANYWHERE 2 // See nsStyleText #define NS_STYLE_HYPHENS_NONE 0 diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 0fec27d21..e4d02a24a 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2133,8 +2133,11 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText } bool WordCanWrapStyle() const { - return WhiteSpaceCanWrapStyle() && - mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD; + if (!WhiteSpaceCanWrapStyle()) { + return false; + } + return (mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD || + mOverflowWrap == NS_STYLE_OVERFLOWWRAP_ANYWHERE); } bool HasTextEmphasis() const { -- cgit v1.2.3