<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193929] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193929">193929</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2015-12-10 15:30:41 -0800 (Thu, 10 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>TextPainter: Add support for painting multiple text runs.
https://bugs.webkit.org/show_bug.cgi?id=152148
Reviewed by Simon Fraser.
This is in preparation for adding simple line layout as a client.
No change in functionality.
* rendering/InlineTextBox.cpp:
(WebCore::drawSkipInkUnderline): Decouple underline skipping intersection calculation and text painter.
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):
* rendering/InlineTextBox.h:
* rendering/TextPainter.cpp:
(WebCore::TextPainter::TextPainter):
(WebCore::TextPainter::paintTextWithShadows):
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
(WebCore::TextPainter::paintText):
(WebCore::TextPainter::dashesForIntersectionsWithRect): Deleted.
* rendering/TextPainter.h:
(WebCore::TextPainter::setTextPaintStyle):
(WebCore::TextPainter::setSelectionPaintStyle):
(WebCore::TextPainter::setIsHorizontal):
(WebCore::TextPainter::setFont):
(WebCore::TextPainter::addEmphasis):
(WebCore::TextPainter::addTextShadow):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxh">trunk/Source/WebCore/rendering/InlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintercpp">trunk/Source/WebCore/rendering/TextPainter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPainterh">trunk/Source/WebCore/rendering/TextPainter.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193928 => 193929)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-10 23:02:31 UTC (rev 193928)
+++ trunk/Source/WebCore/ChangeLog        2015-12-10 23:30:41 UTC (rev 193929)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2015-12-10 Zalan Bujtas <zalan@apple.com>
+
+ TextPainter: Add support for painting multiple text runs.
+ https://bugs.webkit.org/show_bug.cgi?id=152148
+
+ Reviewed by Simon Fraser.
+
+ This is in preparation for adding simple line layout as a client.
+
+ No change in functionality.
+
+ * rendering/InlineTextBox.cpp:
+ (WebCore::drawSkipInkUnderline): Decouple underline skipping intersection calculation and text painter.
+ (WebCore::InlineTextBox::paint):
+ (WebCore::InlineTextBox::paintDecoration):
+ * rendering/InlineTextBox.h:
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::TextPainter):
+ (WebCore::TextPainter::paintTextWithShadows):
+ (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
+ (WebCore::TextPainter::paintText):
+ (WebCore::TextPainter::dashesForIntersectionsWithRect): Deleted.
+ * rendering/TextPainter.h:
+ (WebCore::TextPainter::setTextPaintStyle):
+ (WebCore::TextPainter::setSelectionPaintStyle):
+ (WebCore::TextPainter::setIsHorizontal):
+ (WebCore::TextPainter::setFont):
+ (WebCore::TextPainter::addEmphasis):
+ (WebCore::TextPainter::addTextShadow):
+
</ins><span class="cx"> 2015-12-10 Enrica Casucci <enrica@apple.com>
</span><span class="cx">
</span><span class="cx"> Change skin tone support for two emoji.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (193928 => 193929)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2015-12-10 23:02:31 UTC (rev 193928)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2015-12-10 23:30:41 UTC (rev 193929)
</span><span class="lines">@@ -119,14 +119,14 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void drawSkipInkUnderline(TextPainter& textPainter, GraphicsContext& context, FloatPoint localOrigin, float underlineOffset, float width, bool isPrinting, bool doubleLines)
</del><ins>+static void drawSkipInkUnderline(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const FloatPoint& textOrigin, const FloatPoint& localOrigin,
+ float underlineOffset, float width, bool isPrinting, bool doubleLines)
</ins><span class="cx"> {
</span><span class="cx"> FloatPoint adjustedLocalOrigin = localOrigin;
</span><span class="cx"> adjustedLocalOrigin.move(0, underlineOffset);
</span><span class="cx"> FloatRect underlineBoundingBox = context.computeLineBoundsForText(adjustedLocalOrigin, width, isPrinting);
</span><del>- DashArray intersections = textPainter.dashesForIntersectionsWithRect(underlineBoundingBox);
</del><ins>+ DashArray intersections = font.dashesForIntersectionsWithRect(textRun, textOrigin, underlineBoundingBox);
</ins><span class="cx"> DashArray a = translateIntersectionPointsToSkipInkBoundaries(intersections, underlineBoundingBox.height(), width);
</span><del>-
</del><span class="cx"> ASSERT(!(a.size() % 2));
</span><span class="cx"> context.drawLinesForText(adjustedLocalOrigin, a, isPrinting, doubleLines);
</span><span class="cx"> }
</span><span class="lines">@@ -612,16 +612,23 @@
</span><span class="cx"> else
</span><span class="cx"> textOrigin.setX(roundToDevicePixel(LayoutUnit(textOrigin.x()), renderer().document().deviceScaleFactor()));
</span><span class="cx">
</span><del>- TextPainter textPainter(context, paintSelectedTextOnly, paintSelectedTextSeparately, font, selectionStart, selectionEnd, length, emphasisMark, combinedText, textRun, boxRect, textOrigin, emphasisMarkOffset, textShadow, selectionShadow, isHorizontal(), textPaintStyle, selectionPaintStyle);
- textPainter.paintText();
</del><ins>+ TextPainter textPainter(context);
+ textPainter.setFont(font);
+ textPainter.setTextPaintStyle(textPaintStyle);
+ textPainter.setSelectionPaintStyle(selectionPaintStyle);
+ textPainter.setIsHorizontal(isHorizontal());
+ textPainter.addTextShadow(textShadow, selectionShadow);
+ textPainter.addEmphasis(emphasisMark, emphasisMarkOffset, combinedText);
</ins><span class="cx">
</span><ins>+ textPainter.paintText(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately);
+
</ins><span class="cx"> // Paint decorations
</span><span class="cx"> TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
</span><span class="cx"> if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection) {
</span><span class="cx"> updateGraphicsContext(context, textPaintStyle);
</span><span class="cx"> if (combinedText)
</span><span class="cx"> context.concatCTM(rotation(boxRect, Clockwise));
</span><del>- paintDecoration(context, boxOrigin, textDecorations, textShadow, textPainter);
</del><ins>+ paintDecoration(context, font, textRun, textOrigin, boxOrigin, textDecorations, textShadow);
</ins><span class="cx"> if (combinedText)
</span><span class="cx"> context.concatCTM(rotation(boxRect, Counterclockwise));
</span><span class="cx"> }
</span><span class="lines">@@ -894,12 +901,14 @@
</span><span class="cx"> context.strokePath(path);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InlineTextBox::paintDecoration(GraphicsContext& context, const FloatPoint& boxOrigin, TextDecoration decoration, const ShadowData* shadow, TextPainter& textPainter)
</del><ins>+void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const FloatPoint& textOrigin, const FloatPoint& boxOrigin,
+ TextDecoration decoration, const ShadowData* shadow)
</ins><span class="cx"> {
</span><span class="cx"> #if !ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
</span><del>- UNUSED_PARAM(textPainter);
</del><ins>+ UNUSED_PARAM(font);
+ UNUSED_PARAM(textRun);
+ UNUSED_PARAM(textOrigin);
</ins><span class="cx"> #endif
</span><del>-
</del><span class="cx"> if (m_truncation == cFullTruncation)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -985,9 +994,8 @@
</span><span class="cx"> default:
</span><span class="cx"> #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
</span><span class="cx"> if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
</span><del>- if (!context.paintingDisabled()) {
- drawSkipInkUnderline(textPainter, context, localOrigin, underlineOffset, width, isPrinting, underlineStyle == TextDecorationStyleDouble);
- }
</del><ins>+ if (!context.paintingDisabled())
+ drawSkipInkUnderline(context, font, textRun, textOrigin, localOrigin, underlineOffset, width, isPrinting, underlineStyle == TextDecorationStyleDouble);
</ins><span class="cx"> } else
</span><span class="cx"> // FIXME: Need to support text-decoration-skip: none.
</span><span class="cx"> #endif // CSS3_TEXT_DECORATION_SKIP_INK
</span><span class="lines">@@ -1008,7 +1016,7 @@
</span><span class="cx"> #if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
</span><span class="cx"> if ((lineStyle.textDecorationSkip() == TextDecorationSkipInk || lineStyle.textDecorationSkip() == TextDecorationSkipAuto) && isHorizontal()) {
</span><span class="cx"> if (!context.paintingDisabled())
</span><del>- drawSkipInkUnderline(textPainter, context, localOrigin, 0, width, isPrinting, overlineStyle == TextDecorationStyleDouble);
</del><ins>+ drawSkipInkUnderline(context, font, textRun, textOrigin, localOrigin, 0, width, isPrinting, overlineStyle == TextDecorationStyleDouble);
</ins><span class="cx"> } else
</span><span class="cx"> // FIXME: Need to support text-decoration-skip: none.
</span><span class="cx"> #endif // CSS3_TEXT_DECORATION_SKIP_INK
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (193928 => 193929)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.h        2015-12-10 23:02:31 UTC (rev 193928)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h        2015-12-10 23:30:41 UTC (rev 193929)
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> void paintCompositionUnderline(GraphicsContext&, const FloatPoint& boxOrigin, const CompositionUnderline&);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- void paintDecoration(GraphicsContext&, const FloatPoint& boxOrigin, TextDecoration, const ShadowData*, TextPainter&);
</del><ins>+ void paintDecoration(GraphicsContext&, const FontCascade&, const TextRun&, const FloatPoint& textOrigin, const FloatPoint& boxOrigin, TextDecoration, const ShadowData*);
</ins><span class="cx"> void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, Color textColor);
</span><span class="cx"> void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
</span><span class="cx"> void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (193928 => 193929)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.cpp        2015-12-10 23:02:31 UTC (rev 193928)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp        2015-12-10 23:30:41 UTC (rev 193929)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "InlineTextBox.h"
</span><span class="cx"> #include "RenderCombineText.h"
</span><del>-#include "TextPaintStyle.h"
</del><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -79,28 +78,8 @@
</span><span class="cx"> m_context.clearShadow();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade& font, int selectionStart,
- int selectionEnd, int length, const AtomicString& emphasisMark, RenderCombineText* combinedText, TextRun& textRun, FloatRect& boxRect,
- FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow, bool textBoxIsHorizontal,
- TextPaintStyle& textPaintStyle, TextPaintStyle& selectionPaintStyle)
</del><ins>+TextPainter::TextPainter(GraphicsContext& context)
</ins><span class="cx"> : m_context(context)
</span><del>- , m_textPaintStyle(textPaintStyle)
- , m_selectionPaintStyle(selectionPaintStyle)
- , m_textShadow(textShadow)
- , m_selectionShadow(selectionShadow)
- , m_paintSelectedTextOnly(paintSelectedTextOnly)
- , m_paintSelectedTextSeparately(paintSelectedTextSeparately)
- , m_font(font)
- , m_selectionStart(selectionStart)
- , m_selectionEnd(selectionEnd)
- , m_length(length)
- , m_emphasisMark(emphasisMark)
- , m_combinedText(combinedText)
- , m_textRun(textRun)
- , m_boxRect(boxRect)
- , m_textOrigin(textOrigin)
- , m_emphasisMarkOffset(emphasisMarkOffset)
- , m_textBoxIsHorizontal(textBoxIsHorizontal)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -114,8 +93,8 @@
</span><span class="cx"> m_context.drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + IntSize(0, emphasisMarkOffset), startOffset, endOffset);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextPainter::paintTextWithShadows(const ShadowData* shadow, const FontCascade& font, const TextRun& textRun, const AtomicString& emphasisMark,
- int emphasisMarkOffset, int startOffset, int endOffset, const FloatPoint& textOrigin, bool stroked)
</del><ins>+void TextPainter::paintTextWithShadows(const ShadowData* shadow, const FontCascade& font, const TextRun& textRun, const FloatRect& boxRect, const FloatPoint& textOrigin,
+ int startOffset, int endOffset, const AtomicString& emphasisMark, int emphasisMarkOffset, bool stroked)
</ins><span class="cx"> {
</span><span class="cx"> if (!shadow) {
</span><span class="cx"> drawTextOrEmphasisMarks(font, textRun, emphasisMark, emphasisMarkOffset, textOrigin, startOffset, endOffset);
</span><span class="lines">@@ -128,7 +107,7 @@
</span><span class="cx"> if (!opaque)
</span><span class="cx"> m_context.setFillColor(Color::black);
</span><span class="cx"> while (shadow) {
</span><del>- ShadowApplier shadowApplier(m_context, shadow, m_boxRect, lastShadowIterationShouldDrawText, opaque, m_textBoxIsHorizontal ? Horizontal : Vertical);
</del><ins>+ ShadowApplier shadowApplier(m_context, shadow, boxRect, lastShadowIterationShouldDrawText, opaque, m_textBoxIsHorizontal ? Horizontal : Vertical);
</ins><span class="cx"> if (!shadowApplier.nothingToDraw())
</span><span class="cx"> drawTextOrEmphasisMarks(font, textRun, emphasisMark, emphasisMarkOffset, textOrigin + shadowApplier.extraOffset(), startOffset, endOffset);
</span><span class="cx"> shadow = shadow->next();
</span><span class="lines">@@ -141,59 +120,56 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void TextPainter::paintTextAndEmphasisMarksIfNeeded(int startOffset, int endOffset, const TextPaintStyle& paintStyle, const ShadowData* shadow)
</del><ins>+void TextPainter::paintTextAndEmphasisMarksIfNeeded(const TextRun& textRun, const FloatRect& boxRect, const FloatPoint& textOrigin, int startOffset, int endOffset,
+ const TextPaintStyle& paintStyle, const ShadowData* shadow)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: Truncate right-to-left text correctly.
</span><del>- paintTextWithShadows(shadow, m_font, m_textRun, nullAtom, 0, startOffset, endOffset, m_textOrigin, paintStyle.strokeWidth > 0);
</del><ins>+ paintTextWithShadows(shadow, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom, 0, paintStyle.strokeWidth > 0);
</ins><span class="cx">
</span><span class="cx"> if (m_emphasisMark.isEmpty())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- FloatPoint boxOrigin = m_boxRect.location();
</del><ins>+ FloatPoint boxOrigin = boxRect.location();
</ins><span class="cx"> updateGraphicsContext(m_context, paintStyle, UseEmphasisMarkColor);
</span><span class="cx"> static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(StringView(&objectReplacementCharacter, 1));
</span><del>- TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : m_textRun;
- FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
</del><ins>+ const TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : textRun;
+ FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + boxRect.width() / 2, boxOrigin.y() + m_font->fontMetrics().ascent()) : textOrigin;
</ins><span class="cx"> if (m_combinedText)
</span><del>- m_context.concatCTM(rotation(m_boxRect, Clockwise));
</del><ins>+ m_context.concatCTM(rotation(boxRect, Clockwise));
</ins><span class="cx">
</span><span class="cx"> // FIXME: Truncate right-to-left text correctly.
</span><del>- paintTextWithShadows(shadow, m_combinedText ? m_combinedText->originalFont() : m_font, emphasisMarkTextRun, m_emphasisMark, m_emphasisMarkOffset, startOffset, endOffset, emphasisMarkTextOrigin, paintStyle.strokeWidth > 0);
</del><ins>+ paintTextWithShadows(shadow, m_combinedText ? m_combinedText->originalFont() : *m_font, emphasisMarkTextRun, boxRect, emphasisMarkTextOrigin, startOffset, endOffset,
+ m_emphasisMark, m_emphasisMarkOffset, paintStyle.strokeWidth > 0);
</ins><span class="cx">
</span><span class="cx"> if (m_combinedText)
</span><del>- m_context.concatCTM(rotation(m_boxRect, Counterclockwise));
</del><ins>+ m_context.concatCTM(rotation(boxRect, Counterclockwise));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void TextPainter::paintText()
</del><ins>+void TextPainter::paintText(const TextRun& textRun, int length, const FloatRect& boxRect, const FloatPoint& textOrigin, int selectionStart, int selectionEnd,
+ bool paintSelectedTextOnly, bool paintSelectedTextSeparately)
</ins><span class="cx"> {
</span><del>- if (!m_paintSelectedTextOnly) {
</del><ins>+ ASSERT(m_font);
+ if (!paintSelectedTextOnly) {
</ins><span class="cx"> // For stroked painting, we have to change the text drawing mode. It's probably dangerous to leave that mutated as a side
</span><span class="cx"> // effect, so only when we know we're stroking, do a save/restore.
</span><span class="cx"> GraphicsContextStateSaver stateSaver(m_context, m_textPaintStyle.strokeWidth > 0);
</span><span class="cx"> updateGraphicsContext(m_context, m_textPaintStyle);
</span><del>- if (m_paintSelectedTextSeparately) {
</del><ins>+ if (paintSelectedTextSeparately) {
</ins><span class="cx"> // Paint the before and after selection parts.
</span><del>- if (m_selectionStart > 0)
- paintTextAndEmphasisMarksIfNeeded(0, m_selectionStart, m_textPaintStyle, m_textShadow);
- if (m_selectionEnd < m_length)
- paintTextAndEmphasisMarksIfNeeded(m_selectionEnd, m_length, m_textPaintStyle, m_textShadow);
</del><ins>+ if (selectionStart > 0)
+ paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, 0, selectionStart, m_textPaintStyle, m_textShadow);
+ if (selectionEnd < length)
+ paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, selectionEnd, length, m_textPaintStyle, m_textShadow);
</ins><span class="cx"> } else
</span><del>- paintTextAndEmphasisMarksIfNeeded(0, m_length, m_textPaintStyle, m_textShadow);
</del><ins>+ paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, 0, length, m_textPaintStyle, m_textShadow);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Paint only the text that is selected.
</span><del>- if ((m_paintSelectedTextOnly || m_paintSelectedTextSeparately) && m_selectionStart < m_selectionEnd) {
</del><ins>+ if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) {
</ins><span class="cx"> GraphicsContextStateSaver stateSaver(m_context, m_selectionPaintStyle.strokeWidth > 0);
</span><span class="cx"> updateGraphicsContext(m_context, m_selectionPaintStyle);
</span><del>- paintTextAndEmphasisMarksIfNeeded(m_selectionStart, m_selectionEnd, m_selectionPaintStyle, m_selectionShadow);
</del><ins>+ paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, selectionStart, selectionEnd, m_selectionPaintStyle, m_selectionShadow);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-DashArray TextPainter::dashesForIntersectionsWithRect(const FloatRect& lineExtents)
-{
- return m_font.dashesForIntersectionsWithRect(m_textRun, m_textOrigin, lineExtents);
-}
-#endif
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPainterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.h (193928 => 193929)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.h        2015-12-10 23:02:31 UTC (rev 193928)
+++ trunk/Source/WebCore/rendering/TextPainter.h        2015-12-10 23:30:41 UTC (rev 193929)
</span><span class="lines">@@ -24,9 +24,9 @@
</span><span class="cx"> #define TextPainter_h
</span><span class="cx">
</span><span class="cx"> #include "AffineTransform.h"
</span><del>-#include "DashArray.h"
</del><span class="cx"> #include "RenderText.h"
</span><span class="cx"> #include "TextFlags.h"
</span><ins>+#include "TextPaintStyle.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -44,43 +44,51 @@
</span><span class="cx">
</span><span class="cx"> class TextPainter {
</span><span class="cx"> public:
</span><del>- TextPainter(GraphicsContext&, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade&,
- int selectionStart, int selectionEnd, int length, const AtomicString& emphasisMark, RenderCombineText*,
- TextRun&, FloatRect& boxRect, FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow,
- bool textBoxIsHorizontal, TextPaintStyle& nonSelectionPaintStyle, TextPaintStyle& selectionPaintStyle);
</del><ins>+ TextPainter(GraphicsContext&);
</ins><span class="cx">
</span><del>- void paintText();
-#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
- DashArray dashesForIntersectionsWithRect(const FloatRect& lineExtents);
-#endif
</del><ins>+ void setTextPaintStyle(const TextPaintStyle& textPaintStyle) { m_textPaintStyle = textPaintStyle; }
+ void setSelectionPaintStyle(const TextPaintStyle& selectionPaintStyle) { m_selectionPaintStyle = selectionPaintStyle; }
+ void setIsHorizontal(bool isHorizontal) { m_textBoxIsHorizontal = isHorizontal; }
+ void setFont(const FontCascade& font) { m_font = &font; }
+ void addEmphasis(const AtomicString& emphasisMark, int emphasisMarkOffset, RenderCombineText*);
+ void addTextShadow(const ShadowData* textShadow, const ShadowData* selectionShadow);
</ins><span class="cx">
</span><ins>+ void paintText(const TextRun&, int length, const FloatRect& boxRect, const FloatPoint& textOrigin,
+ int selectionStart, int selectionEnd, bool paintSelectedTextOnly, bool paintSelectedTextSeparately);
+
</ins><span class="cx"> private:
</span><span class="cx"> void drawTextOrEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& emphasisMark, int emphasisMarkOffset,
</span><span class="cx"> const FloatPoint& textOrigin, int startOffset, int endOffset);
</span><del>- void paintTextWithShadows(const ShadowData*, const FontCascade&, const TextRun&, const AtomicString& emphasisMark, int emphasisMarkOffset,
- int startOffset, int endOffset, const FloatPoint& textOrigin, bool stroked);
- void paintTextAndEmphasisMarksIfNeeded(int startOffset, int endOffset, const TextPaintStyle&, const ShadowData*);
</del><ins>+ void paintTextWithShadows(const ShadowData*, const FontCascade&, const TextRun&, const FloatRect& boxRect, const FloatPoint& textOrigin,
+ int startOffset, int endOffset, const AtomicString& emphasisMark, int emphasisMarkOffset, bool stroked);
+ void paintTextAndEmphasisMarksIfNeeded(const TextRun&, const FloatRect& boxRect, const FloatPoint& textOrigin, int startOffset, int endOffset,
+ const TextPaintStyle&, const ShadowData*);
</ins><span class="cx">
</span><span class="cx"> GraphicsContext& m_context;
</span><del>- TextPaintStyle& m_textPaintStyle;
- TextPaintStyle& m_selectionPaintStyle;
- const ShadowData* m_textShadow;
- const ShadowData* m_selectionShadow;
- bool m_paintSelectedTextOnly;
- bool m_paintSelectedTextSeparately;
- const FontCascade& m_font;
- int m_selectionStart;
- int m_selectionEnd;
- int m_length;
- const AtomicString& m_emphasisMark;
- RenderCombineText* m_combinedText;
- TextRun& m_textRun;
- FloatRect m_boxRect;
- FloatPoint m_textOrigin;
- int m_emphasisMarkOffset;
- bool m_textBoxIsHorizontal;
</del><ins>+ const FontCascade* m_font { nullptr };
+ TextPaintStyle m_textPaintStyle;
+ TextPaintStyle m_selectionPaintStyle;
+ const ShadowData* m_textShadow { nullptr };
+ const ShadowData* m_selectionShadow { nullptr };
+ AtomicString m_emphasisMark;
+ RenderCombineText* m_combinedText { nullptr };
+ int m_emphasisMarkOffset { 0 };
+ bool m_textBoxIsHorizontal { true };
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+inline void TextPainter::addEmphasis(const AtomicString& emphasisMark, int emphasisMarkOffset, RenderCombineText* combinedText)
+{
+ m_emphasisMark = emphasisMark;
+ m_emphasisMarkOffset = emphasisMarkOffset;
+ m_combinedText = combinedText;
+}
+
+inline void TextPainter::addTextShadow(const ShadowData* textShadow, const ShadowData* selectionShadow)
+{
+ m_textShadow = textShadow;
+ m_selectionShadow = selectionShadow;
+}
+
</ins><span class="cx"> class ShadowApplier {
</span><span class="cx"> public:
</span><span class="cx"> ShadowApplier(GraphicsContext&, const ShadowData*, const FloatRect& textRect, bool lastShadowIterationShouldDrawText = true, bool opaque = false, FontOrientation = Horizontal);
</span></span></pre>
</div>
</div>
</body>
</html>