RenderMathMLOperator: Add helper function to retrieve italic correction
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 18:27:51 +0000 (18:27 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Apr 2016 18:27:51 +0000 (18:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156572

Reviewed by Darin Adler.

No new tests, the helper function will only be used in bug 153918.

* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::italicCorrection): Return the italic correction from the MATH table if it's a large operator.
* rendering/mathml/RenderMathMLOperator.h: Declare italicCorrection.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h

index 54068e2..5c3218f 100644 (file)
@@ -1,3 +1,16 @@
+2016-04-14  Frederic Wang  <fred.wang@free.fr>
+
+        RenderMathMLOperator: Add helper function to retrieve italic correction
+        https://bugs.webkit.org/show_bug.cgi?id=156572
+
+        Reviewed by Darin Adler.
+
+        No new tests, the helper function will only be used in bug 153918.
+
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::italicCorrection): Return the italic correction from the MATH table if it's a large operator.
+        * rendering/mathml/RenderMathMLOperator.h: Declare italicCorrection.
+
 2016-04-14  Frederic Wang  <fwang@igalia.com>
 
         RenderMathMLOperator: Move glyph measuring helper functions outside the class
index ceefb16..83db352 100644 (file)
@@ -202,6 +202,18 @@ bool RenderMathMLOperator::isChildAllowed(const RenderObject&, const RenderStyle
     return false;
 }
 
+LayoutUnit RenderMathMLOperator::italicCorrection() const
+{
+    if (isLargeOperatorInDisplayStyle()) {
+        const auto& primaryFont = style().fontCascade().primaryFont();
+        if (auto* mathData = primaryFont.mathData()) {
+            StretchyData largeOperator = getDisplayStyleLargeOperator(m_textContent);
+            return mathData->getItalicCorrection(primaryFont, largeOperator.variant().glyph);
+        }
+    }
+    return 0;
+}
+
 void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
 {
     ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
index 4bf2017..aaee46a 100644 (file)
@@ -51,6 +51,7 @@ public:
     // FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737).
     bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp); }
     bool isVertical() const { return m_isVertical; }
+    LayoutUnit italicCorrection() const;
 
     void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
     void updateStyle() final;