Changeset 179722 in webkit
- Timestamp:
- Feb 5, 2015, 4:32:59 PM (12 years ago)
- Location:
- branches/safari-600.1.4.15-branch
- Files:
-
- 16 edited
- 2 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt (modified) (1 diff)
-
LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html (modified) (1 diff)
-
LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt (modified) (1 diff)
-
LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html (modified) (1 diff)
-
LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html (copied) (copied from trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking-expected.html )
-
LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html (copied) (copied from trunk/LayoutTests/fast/ruby/ruby-punctuation-avoid-breaking.html )
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/InlineBox.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlockFlow.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlockLineLayout.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderRubyBase.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderRubyBase.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderRubyRun.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderRubyRun.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderRubyText.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderRubyText.h (modified) (1 diff)
-
Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog
r179711 r179722 1 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 3 Merge r179366 4 5 2015-01-20 David Hyatt <hyatt@apple.com> 6 7 Japanese line breaking rules need to be respected before and after Ruby. 8 https://bugs.webkit.org/show_bug.cgi?id=91588 9 <rdar://problem/17306535> 10 11 Reviewed by Dean Jackson. 12 13 * fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt: 14 * fast/ruby/ruby-block-style-not-updated-with-before-after-content.html: 15 * fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt: 16 * fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html: 17 * fast/ruby/ruby-punctuation-avoid-breaking-expected.html: Added. 18 * fast/ruby/ruby-punctuation-avoid-breaking.html: Added. 19 1 20 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 21 -
branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content-expected.txt
r94543 r179722 5 5 RenderBody {BODY} at (8,8) size 784x584 6 6 RenderRuby (block) {RUBY} at (0,0) size 784x384 [color=#0000FF] 7 RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]8 RenderText at (0,0) size 512x1289 text run at (0,0) width 512: "1234"7 RenderInline (generated) at (0,0) size 640x128 [color=#FFA500] 8 RenderText at (0,0) size 640x128 9 text run at (0,0) width 640: "1234 " 10 10 RenderRubyRun (anonymous) at (0,128) size 512x128 11 11 RenderRubyBase (anonymous) at (0,0) size 512x128 -
branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-block-style-not-updated-with-before-after-content.html
r94582 r179722 5 5 #test::before 6 6 { 7 content: "1234 ";7 content: "1234 "; 8 8 color: orange; 9 9 } 10 10 #test::after 11 11 { 12 content: " 4578";12 content: " 4578"; 13 13 color: yellow; 14 14 } -
branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content-expected.txt
r94543 r179722 5 5 RenderBody {BODY} at (8,8) size 784x584 6 6 RenderBlock (anonymous) at (0,0) size 784x384 7 RenderRuby (inline) {RUBY} at (0,0) size 512x384 [color=#0000FF]8 RenderInline (generated) at (0,0) size 512x128 [color=#FFA500]9 RenderText at (0,0) size 512x12810 text run at (0,0) width 512: "1234"7 RenderRuby (inline) {RUBY} at (0,0) size 640x384 [color=#0000FF] 8 RenderInline (generated) at (0,0) size 640x128 [color=#FFA500] 9 RenderText at (0,0) size 640x128 10 text run at (0,0) width 640: "1234 " 11 11 RenderRubyRun (anonymous) at (0,128) size 512x128 12 12 RenderRubyBase (anonymous) at (0,0) size 512x128 -
branches/safari-600.1.4.15-branch/LayoutTests/fast/ruby/ruby-inline-style-not-updated-with-before-after-content.html
r94582 r179722 5 5 #test::before 6 6 { 7 content: "1234 ";7 content: "1234 "; 8 8 color: orange; 9 9 } 10 10 #test::after 11 11 { 12 content: " 4578";12 content: " 4578"; 13 13 color: yellow; 14 14 } -
branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog
r179711 r179722 1 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 3 Merge r179366 4 5 2015-01-20 David Hyatt <hyatt@apple.com> 6 7 Japanese line breaking rules need to be respected before and after Ruby. 8 https://bugs.webkit.org/show_bug.cgi?id=91588 9 <rdar://problem/17306535> 10 11 Reviewed by Dean Jackson. 12 13 Added fast/ruby/ruby-punctuation-avoid-breaking.html. 14 15 This patch has to add support for following line breaking rules at both 16 sides of a Ruby boundary. For breaking before a Ruby, unfortunately we 17 just hard-code the rules (and apply this hard-coding only to Ruby and not 18 to other inline replaced elements). 19 20 For breaking after a Ruby we do better. The Ruby run caches its prior characters 21 and line layout is able to obtain them and use them when deciding whether or not 22 to break. This means for the "after" side of a Ruby, we're able to behave the same 23 as if no Ruby was used. 24 25 * rendering/RenderBlockFlow.h: 26 (WebCore::RenderBlockFlow::cachePriorCharactersIfNeeded): 27 * rendering/RenderBlockLineLayout.cpp: 28 (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): 29 * rendering/RenderRubyBase.cpp: 30 (WebCore::RenderRubyBase::cachePriorCharactersIfNeeded): 31 * rendering/RenderRubyBase.h: 32 * rendering/RenderRubyRun.cpp: 33 (WebCore::RenderRubyRun::RenderRubyRun): 34 (WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator): 35 (WebCore::RenderRubyRun::canBreakBefore): 36 * rendering/RenderRubyRun.h: 37 * rendering/RenderRubyText.cpp: 38 (WebCore::RenderRubyText::canBreakBefore): 39 * rendering/RenderRubyText.h: 40 * rendering/line/BreakingContextInlineHeaders.h: 41 (WebCore::BreakingContext::handleReplaced): 42 (WebCore::BreakingContext::canBreakAtThisPosition): 43 (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded): 44 1 45 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 46 -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/InlineBox.h
r179133 r179722 23 23 24 24 #include "RenderBoxModelObject.h" 25 #include "TextBreakIterator.h" 25 26 #include "TextDirection.h" 27 26 28 27 29 namespace WebCore { -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockFlow.h
r179133 r179722 463 463 virtual void computeColumnCountAndWidth(); 464 464 virtual bool requiresColumns(int) const; 465 465 466 virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) {}; 467 466 468 private: 467 469 bool recomputeLogicalWidthAndColumnWidth(); -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r179138 r179722 1173 1173 WordMeasurements wordMeasurements; 1174 1174 end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements); 1175 cachePriorCharactersIfNeeded(renderTextInfo.m_lineBreakIterator); 1175 1176 renderTextInfo.m_lineBreakIterator.resetPriorContext(); 1176 1177 if (resolver.position().atEnd()) { -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyBase.cpp
r179133 r179722 163 163 } 164 164 165 void RenderRubyBase::cachePriorCharactersIfNeeded(const LazyLineBreakIterator& lineBreakIterator) 166 { 167 auto* run = rubyRun(); 168 if (run) 169 run->setCachedPriorCharacters(lineBreakIterator.lastCharacter(), lineBreakIterator.secondToLastCharacter()); 170 } 171 165 172 } // namespace WebCore -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyBase.h
r179133 r179722 59 59 m_isAfterExpansion = true; 60 60 } 61 62 virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) override; 61 63 62 64 private: -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyRun.cpp
r179138 r179722 44 44 RenderRubyRun::RenderRubyRun(Document& document, PassRef<RenderStyle> style) 45 45 : RenderBlockFlow(document, WTF::move(style)) 46 , m_lastCharacter(0) 47 , m_secondToLastCharacter(0) 46 48 { 47 49 setReplaced(true); … … 331 333 } 332 334 335 void RenderRubyRun::updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator& iterator) const 336 { 337 iterator.setPriorContext(m_lastCharacter, m_secondToLastCharacter); 338 } 339 340 bool RenderRubyRun::canBreakBefore(const LazyLineBreakIterator& iterator) const 341 { 342 RenderRubyText* rubyText = this->rubyText(); 343 if (!rubyText) 344 return true; 345 return rubyText->canBreakBefore(iterator); 346 } 347 333 348 } // namespace WebCore -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyRun.h
r179138 r179722 68 68 static RenderRubyRun* staticCreateRubyRun(const RenderObject* parentRuby); 69 69 70 void updatePriorContextFromCachedBreakIterator(LazyLineBreakIterator&) const; 71 void setCachedPriorCharacters(UChar last, UChar secondToLast) 72 { 73 m_lastCharacter = last; 74 m_secondToLastCharacter = secondToLast; 75 } 76 bool canBreakBefore(const LazyLineBreakIterator&) const; 77 70 78 protected: 71 79 RenderRubyBase* createRubyBase() const; … … 76 84 virtual bool createsAnonymousWrapper() const { return true; } 77 85 virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } 86 87 private: 88 UChar m_lastCharacter; 89 UChar m_secondToLastCharacter; 78 90 }; 79 91 -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyText.cpp
r179071 r179722 94 94 } 95 95 96 bool RenderRubyText::canBreakBefore(const LazyLineBreakIterator& iterator) const 97 { 98 // FIXME: It would be nice to improve this so that it isn't just hard-coded, but lookahead in this 99 // case is particularly problematic. 100 101 if (!iterator.priorContextLength()) 102 return true; 103 UChar ch = iterator.lastCharacter(); 104 ULineBreak lineBreak = (ULineBreak)u_getIntPropertyValue(ch, UCHAR_LINE_BREAK); 105 // UNICODE LINE BREAKING ALGORITHM 106 // http://www.unicode.org/reports/tr14/ 107 // And Requirements for Japanese Text Layout, 3.1.7 Characters Not Starting a Line 108 // http://www.w3.org/TR/2012/NOTE-jlreq-20120403/#characters_not_starting_a_line 109 switch (lineBreak) { 110 case U_LB_NONSTARTER: 111 case U_LB_CLOSE_PARENTHESIS: 112 case U_LB_CLOSE_PUNCTUATION: 113 case U_LB_EXCLAMATION: 114 case U_LB_BREAK_SYMBOLS: 115 case U_LB_INFIX_NUMERIC: 116 case U_LB_ZWSPACE: 117 case U_LB_WORD_JOINER: 118 return false; 119 default: 120 break; 121 } 122 // Special care for Requirements for Japanese Text Layout 123 switch (ch) { 124 case 0x2019: // RIGHT SINGLE QUOTATION MARK 125 case 0x201D: // RIGHT DOUBLE QUOTATION MARK 126 case 0x00BB: // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK 127 case 0x2010: // HYPHEN 128 case 0x2013: // EN DASH 129 case 0x300C: // LEFT CORNER BRACKET 130 return false; 131 default: 132 break; 133 } 134 return true; 135 } 136 96 137 } // namespace WebCore -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderRubyText.h
r179071 r179722 46 46 47 47 RenderRubyRun* rubyRun() const; 48 48 49 bool canBreakBefore(const LazyLineBreakIterator&) const; 50 49 51 private: 50 52 virtual const char* renderName() const override { return "RenderRubyText"; } -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h
r167628 r179722 414 414 415 415 // Break on replaced elements if either has normal white-space. 416 if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)) { 416 if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak) 417 && (!m_current.renderer()->isRubyRun() || toRenderRubyRun(m_current.renderer())->canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) { 417 418 m_width.commit(); 418 419 m_lineBreak.moveToStartOf(m_current.renderer()); … … 443 444 } else 444 445 m_width.addUncommittedWidth(replacedLogicalWidth); 445 if (m_current.renderer()->isRubyRun()) 446 if (m_current.renderer()->isRubyRun()) { 446 447 m_width.applyOverhang(toRenderRubyRun(m_current.renderer()), m_lastObject, m_nextObject); 447 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element. 448 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter); 448 toRenderRubyRun(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.m_lineBreakIterator); 449 } else { 450 // Update prior line break context characters, using U+FFFD (OBJECT REPLACEMENT CHARACTER) for replaced element. 451 m_renderTextInfo.m_lineBreakIterator.updatePriorContext(replacementCharacter); 452 } 449 453 } 450 454 … … 952 956 bool currentIsTextOrEmptyInline = m_current.renderer()->isText() || (m_current.renderer()->isRenderInline() && isEmptyInline(toRenderInline(*m_current.renderer()))); 953 957 if (!currentIsTextOrEmptyInline) 954 return m_autoWrap ;958 return m_autoWrap && !m_current.renderer()->isRubyRun(); 955 959 956 960 bool canBreakHere = !m_currentCharacterIsSpace && textBeginsWithBreakablePosition(m_nextObject); … … 999 1003 if (!m_current.renderer()->isFloatingOrOutOfFlowPositioned()) { 1000 1004 m_lastObject = m_current.renderer(); 1001 if (m_lastObject->isReplaced() && m_autoWrap && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMarker(*m_lastObject).isInside())) {1005 if (m_lastObject->isReplaced() && m_autoWrap && !m_lastObject->isRubyRun() && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!m_lastObject->isListMarker() || toRenderListMarker(*m_lastObject).isInside())) { 1002 1006 m_width.commit(); 1003 1007 m_lineBreak.moveToStartOf(m_nextObject);
Note:
See TracChangeset
for help on using the changeset viewer.