diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 3c244a741084..980a6089fefa 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -2064,19 +2064,6 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) (mLineContainer->StyleText()->mTextAlign == NS_STYLE_TEXT_ALIGN_JUSTIFY || mLineContainer->StyleText()->mTextAlignLast == NS_STYLE_TEXT_ALIGN_JUSTIFY); - // for word-break style - switch (mLineContainer->StyleText()->mWordBreak) { - case NS_STYLE_WORDBREAK_BREAK_ALL: - mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_BreakAll); - break; - case NS_STYLE_WORDBREAK_KEEP_ALL: - mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_KeepAll); - break; - default: - mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_Normal); - break; - } - const nsStyleText* textStyle = nullptr; const nsStyleFont* fontStyle = nullptr; nsStyleContext* lastStyleContext = nullptr; @@ -2555,6 +2542,19 @@ void BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, const void* aTextPtr) { + // for word-break style + switch (mLineContainer->StyleText()->mWordBreak) { + case NS_STYLE_WORDBREAK_BREAK_ALL: + mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_BreakAll); + break; + case NS_STYLE_WORDBREAK_KEEP_ALL: + mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_KeepAll); + break; + default: + mLineBreaker.SetWordBreak(nsILineBreaker::kWordBreak_Normal); + break; + } + // textruns have uniform language const nsStyleFont *styleFont = mMappedFlows[0].mStartFrame->StyleFont(); // We should only use a language for hyphenation if it was specified diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index 7e4bd55c02ce..b895ecd5acc3 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -122,6 +122,7 @@ HTTP(..) == wordbreak-7a.html wordbreak-7a-ref.html fails HTTP(..) == wordbreak-7b.html wordbreak-7b-ref.html # bug 479829 == wordbreak-8.html wordbreak-8-ref.html pref(gfx.font_rendering.graphite.enabled,true) HTTP(..) == wordbreak-9.html wordbreak-9-ref.html +== wordbreak-dynamic-1.html wordbreak-dynamic-1-ref.html == wordwrap-01.html wordwrap-01-ref.html HTTP(..) == wordwrap-02.html wordwrap-02-ref.html fuzzy-if(gtkWidget,1,177) fuzzy-if(skiaContent,1,50) HTTP(..) == wordwrap-03.html wordwrap-03-ref.html # Fuzzy on Linux because the native textbox gradient is painted in a slightly different position depending on the invalid area. diff --git a/layout/reftests/text/wordbreak-dynamic-1-ref.html b/layout/reftests/text/wordbreak-dynamic-1-ref.html new file mode 100644 index 000000000000..f8feb44cbfe5 --- /dev/null +++ b/layout/reftests/text/wordbreak-dynamic-1-ref.html @@ -0,0 +1,18 @@ + + + + + Reference - word-break: break-all with dynamic change + + + +
a bcdef
+ + diff --git a/layout/reftests/text/wordbreak-dynamic-1.html b/layout/reftests/text/wordbreak-dynamic-1.html new file mode 100644 index 000000000000..930ba6efb5f8 --- /dev/null +++ b/layout/reftests/text/wordbreak-dynamic-1.html @@ -0,0 +1,25 @@ + + + + + Test - word-break: break-all with dynamic change + + + +
a bcdef
+ + +