Move decoration context setup calls to InlineTextBox::paintDecoration.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Dec 2015 21:09:07 +0000 (21:09 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Dec 2015 21:09:07 +0000 (21:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152622

Reviewed by Simon Fraser.

No change in functionality.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):
* rendering/InlineTextBox.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194467 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h

index 4c77e51..226efcc 100644 (file)
@@ -1,3 +1,17 @@
+2015-12-31  Zalan Bujtas  <zalan@apple.com>
+
+        Move decoration context setup calls to InlineTextBox::paintDecoration.
+        https://bugs.webkit.org/show_bug.cgi?id=152622
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paint):
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/InlineTextBox.h:
+
 2015-12-31  Simon Fraser  <simon.fraser@apple.com>
 
         More scrollOffset/scrollPosition disambiguation, in RenderLayer
index d0c26c5..39c527b 100644 (file)
@@ -560,14 +560,8 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
 
     // Paint decorations
     TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
-    if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection) {
-        updateGraphicsContext(context, textPaintStyle);
-        if (combinedText)
-            context.concatCTM(rotation(boxRect, Clockwise));
-        paintDecoration(context, font, textRun, textOrigin, boxOrigin, textDecorations, textShadow);
-        if (combinedText)
-            context.concatCTM(rotation(boxRect, Counterclockwise));
-    }
+    if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSelection)
+        paintDecoration(context, font, combinedText, textRun, textOrigin, boxRect, textDecorations, textPaintStyle, textShadow);
 
     if (paintInfo.phase == PaintPhaseForeground) {
         paintDocumentMarkers(context, boxOrigin, lineStyle, font, false);
@@ -699,13 +693,16 @@ void InlineTextBox::paintCompositionBackground(GraphicsContext& context, const F
     context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()), compositionColor);
 }
 
-void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const FloatPoint& textOrigin, const FloatPoint& boxOrigin,
-    TextDecoration decoration, const ShadowData* shadow)
+void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade& font, RenderCombineText* combinedText, const TextRun& textRun, const FloatPoint& textOrigin,
+    const FloatRect& boxRect, TextDecoration decoration, TextPaintStyle textPaintStyle, const ShadowData* shadow)
 {
     if (m_truncation == cFullTruncation)
         return;
 
-    FloatPoint localOrigin = boxOrigin;
+    FloatPoint localOrigin = boxRect.location();
+    updateGraphicsContext(context, textPaintStyle);
+    if (combinedText)
+        context.concatCTM(rotation(boxRect, Clockwise));
 
     float width = m_logicalWidth;
     if (m_truncation != cNoTruncation) {
@@ -724,6 +721,9 @@ void InlineTextBox::paintDecoration(GraphicsContext& context, const FontCascade&
     decorationPainter.addTextShadow(shadow);
 
     decorationPainter.paintTextDecoration(textRun, textOrigin, localOrigin);
+
+    if (combinedText)
+        context.concatCTM(rotation(boxRect, Counterclockwise));
 }
 
 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentMarker::MarkerType markerType)
index f3dd675..53b848f 100644 (file)
 namespace WebCore {
 
 struct CompositionUnderline;
+class RenderCombineText;
 class RenderedDocumentMarker;
 class TextPainter;
+struct TextPaintStyle;
 
 const unsigned short cNoTruncation = USHRT_MAX;
 const unsigned short cFullTruncation = USHRT_MAX - 1;
@@ -159,7 +161,8 @@ protected:
     void paintCompositionUnderline(GraphicsContext&, const FloatPoint& boxOrigin, const CompositionUnderline&);
 
 private:
-    void paintDecoration(GraphicsContext&, const FontCascade&, const TextRun&, const FloatPoint& textOrigin, const FloatPoint& boxOrigin, TextDecoration, const ShadowData*);
+    void paintDecoration(GraphicsContext&, const FontCascade&, RenderCombineText*, const TextRun&, const FloatPoint& textOrigin, const FloatRect& boxRect,
+        TextDecoration, TextPaintStyle, const ShadowData*);
     void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, Color textColor);
     void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
     void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);