Title: [192978] branches/safari-601.1.46-branch/Source/WebCore

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (192977 => 192978)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-02 23:04:24 UTC (rev 192977)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-02 23:04:28 UTC (rev 192978)
@@ -1,3 +1,34 @@
+2015-12-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Merge r192259. rdar://problem/23189749
+
+    2015-11-10  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+            Tatechuyoko text is not vertically centered in its vertical advance
+            https://bugs.webkit.org/show_bug.cgi?id=151074
+            <rdar://problem/20074305>
+
+            Reviewed by David Hyatt.
+
+            During paint time, the run origin of tatechuyoko needs to be adjusted to compensate for the
+            rotation of the writing mode. The calculation which performed this adjustment was incorrect.
+
+            It is incorrect for two reasons:
+            1. It used the existing text origin, which had the font's ascent incorporated in it, but did
+            not compensate by either inspecting the overflow bounds' ascent nor the font's ascent proper.
+            2. It did not distinguish between the overflow bounds' ascent vs. descent. Instead, it added
+            them together and treated both values together.
+
+            No new tests yet. I need to make a font to test this.
+
+            * rendering/InlineTextBox.cpp:
+            (WebCore::InlineTextBox::paint):
+            * rendering/RenderCombineText.cpp:
+            (WebCore::RenderCombineText::computeTextOrigin):
+            (WebCore::RenderCombineText::combineText):
+            (WebCore::RenderCombineText::adjustTextOrigin): Deleted.
+            * rendering/RenderCombineText.h:
+
 2015-12-02  Matthew Hanson  <matthew_han...@apple.com>
 
         Merge r192368. rdar://problem/23189763

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/InlineTextBox.cpp (192977 => 192978)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/InlineTextBox.cpp	2015-12-02 23:04:24 UTC (rev 192977)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/InlineTextBox.cpp	2015-12-02 23:04:28 UTC (rev 192978)
@@ -602,8 +602,10 @@
     const ShadowData* textShadow = (paintInfo.forceTextColor()) ? nullptr : lineStyle.textShadow();
 
     FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
-    if (combinedText)
-        combinedText->adjustTextOrigin(textOrigin, boxRect);
+    if (combinedText) {
+        if (auto newOrigin = combinedText->computeTextOrigin(boxRect))
+            textOrigin = newOrigin.value();
+    }
 
     if (isHorizontal())
         textOrigin.setY(roundToDevicePixel(LayoutUnit(textOrigin.y()), renderer().document().deviceScaleFactor()));

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp (192977 => 192978)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp	2015-12-02 23:04:24 UTC (rev 192977)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.cpp	2015-12-02 23:04:28 UTC (rev 192978)
@@ -67,10 +67,17 @@
     return RenderText::width(from, length, font, xPosition, fallbackFonts, glyphOverflow);
 }
 
-void RenderCombineText::adjustTextOrigin(FloatPoint& textOrigin, const FloatRect& boxRect) const
+Optional<FloatPoint> RenderCombineText::computeTextOrigin(const FloatRect& boxRect) const
 {
-    if (m_isCombined)
-        textOrigin.move(boxRect.height() / 2 - ceilf(m_combinedTextSize.width()) / 2, boxRect.width() + (boxRect.width() - m_combinedTextSize.height()) / 2);
+    if (!m_isCombined)
+        return Nullopt;
+
+    // Visually center m_combinedTextWidth/Ascent/Descent within boxRect
+    FloatPoint result = boxRect.minXMaxYCorner();
+    FloatSize combinedTextSize(m_combinedTextWidth, m_combinedTextAscent + m_combinedTextDescent);
+    result.move((boxRect.size().transposedSize() - combinedTextSize) / 2);
+    result.move(0, m_combinedTextAscent);
+    return result;
 }
 
 void RenderCombineText::getStringToRender(int start, String& string, int& length) const
@@ -178,7 +185,9 @@
     if (m_isCombined) {
         static NeverDestroyed<String> objectReplacementCharacterString(&objectReplacementCharacter, 1);
         RenderText::setRenderedText(objectReplacementCharacterString.get());
-        m_combinedTextSize = FloatSize(combinedTextWidth, glyphOverflow.bottom + glyphOverflow.top);
+        m_combinedTextWidth = combinedTextWidth;
+        m_combinedTextAscent = glyphOverflow.top;
+        m_combinedTextDescent = glyphOverflow.bottom;
     }
 }
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.h (192977 => 192978)


--- branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.h	2015-12-02 23:04:24 UTC (rev 192977)
+++ branches/safari-601.1.46-branch/Source/WebCore/rendering/RenderCombineText.h	2015-12-02 23:04:28 UTC (rev 192978)
@@ -35,7 +35,7 @@
     Text& textNode() const { return downcast<Text>(nodeForNonAnonymous()); }
 
     void combineText();
-    void adjustTextOrigin(FloatPoint& textOrigin, const FloatRect& boxRect) const;
+    Optional<FloatPoint> computeTextOrigin(const FloatRect& boxRect) const;
     void getStringToRender(int, String&, int& length) const;
     bool isCombined() const { return m_isCombined; }
     float combinedTextWidth(const FontCascade& font) const { return font.size(); }
@@ -52,7 +52,9 @@
     virtual void setRenderedText(const String&) override;
 
     RefPtr<RenderStyle> m_combineFontStyle;
-    FloatSize m_combinedTextSize;
+    float m_combinedTextWidth { 0 };
+    float m_combinedTextAscent { 0 };
+    float m_combinedTextDescent { 0 };
     bool m_isCombined : 1;
     bool m_needsFontUpdate : 1;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to