Changeset 156036 in webkit


Ignore:
Timestamp:
Sep 18, 2013 5:39:23 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[MathML] Implement the subscriptshift and superscriptshift attributes
https://bugs.webkit.org/show_bug.cgi?id=120069

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-09-18
Reviewed by Darin Adler.

Source/WebCore:

Added support for subscriptshift and superscriptshift attributes. The
subscriptshift attribute is for msup element and superscriptshift for
msup. msubsup can have both subscriptshift and superscriptshift. The
subscriptshift attribute specifies the minimum amount to shift the
baseline of subscript down. The superscriptshift attribute specifies
the minimum amount to shift the baseline of superscript up.

Tests: mathml/presentation/msub-subscriptshift.html

mathml/presentation/msubsup-subscriptshift.html
mathml/presentation/msubsup-superscriptshift.html
mathml/presentation/msup-superscriptshift.html
mathml/presentation/multiscript-subscriptshift.html
mathml/presentation/multiscript-superscriptshift.html

  • mathml/mathattrs.in:
  • rendering/mathml/RenderMathMLScripts.cpp:

(WebCore::RenderMathMLScripts::layout):
For aligning the subscript and superscript padding is added to the base.
So subscriptshift and superscriptshift attributes is set as padding bottom
and padding top of base respectively.

LayoutTests:

  • mathml/presentation/msub-subscriptshift-expected.txt: Added.
  • mathml/presentation/msub-subscriptshift.html: Added.
  • mathml/presentation/msubsup-subscriptshift-expected.txt: Added.
  • mathml/presentation/msubsup-subscriptshift.html: Added.
  • mathml/presentation/msubsup-superscriptshift-expected.txt: Added.
  • mathml/presentation/msubsup-superscriptshift.html: Added.
  • mathml/presentation/msup-superscriptshift-expected.txt: Added.
  • mathml/presentation/msup-superscriptshift.html: Added.
  • mathml/presentation/multiscript-subscriptshift-expected.txt: Added.
  • mathml/presentation/multiscript-subscriptshift.html: Added.
  • mathml/presentation/multiscript-superscriptshift-expected.txt: Added.
  • mathml/presentation/multiscript-superscriptshift.html: Added.

Added new tests for verifying that subscriptshift and superscriptshift are
being applied properly to the script base.

Location:
trunk
Files:
12 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r156033 r156036  
     12013-09-18  Gurpreet Kaur  <k.gurpreet@samsung.com>
     2
     3        [MathML] Implement the subscriptshift and superscriptshift attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=120069
     5
     6        Reviewed by Darin Adler.
     7
     8        * mathml/presentation/msub-subscriptshift-expected.txt: Added.
     9        * mathml/presentation/msub-subscriptshift.html: Added.
     10        * mathml/presentation/msubsup-subscriptshift-expected.txt: Added.
     11        * mathml/presentation/msubsup-subscriptshift.html: Added.
     12        * mathml/presentation/msubsup-superscriptshift-expected.txt: Added.
     13        * mathml/presentation/msubsup-superscriptshift.html: Added.
     14        * mathml/presentation/msup-superscriptshift-expected.txt: Added.
     15        * mathml/presentation/msup-superscriptshift.html: Added.
     16        * mathml/presentation/multiscript-subscriptshift-expected.txt: Added.
     17        * mathml/presentation/multiscript-subscriptshift.html: Added.
     18        * mathml/presentation/multiscript-superscriptshift-expected.txt: Added.
     19        * mathml/presentation/multiscript-superscriptshift.html: Added.
     20        Added new tests for verifying that subscriptshift and superscriptshift are
     21        being applied properly to the script base.
     22
    1232013-09-18  Mario Sanchez Prada  <mario.prada@samsung.com>
    224
  • trunk/Source/WebCore/ChangeLog

    r156033 r156036  
     12013-09-18  Gurpreet Kaur  <k.gurpreet@samsung.com>
     2
     3        [MathML] Implement the subscriptshift and superscriptshift attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=120069
     5
     6        Reviewed by Darin Adler.
     7
     8        Added support for subscriptshift and superscriptshift attributes. The
     9        subscriptshift attribute is for msup element and superscriptshift for
     10        msup. msubsup can have both subscriptshift and superscriptshift. The
     11        subscriptshift attribute specifies the minimum amount to shift the
     12        baseline of subscript down. The superscriptshift attribute specifies
     13        the minimum amount to shift the baseline of superscript up.
     14
     15        Tests: mathml/presentation/msub-subscriptshift.html
     16               mathml/presentation/msubsup-subscriptshift.html
     17               mathml/presentation/msubsup-superscriptshift.html
     18               mathml/presentation/msup-superscriptshift.html
     19               mathml/presentation/multiscript-subscriptshift.html
     20               mathml/presentation/multiscript-superscriptshift.html
     21
     22        * mathml/mathattrs.in:
     23        * rendering/mathml/RenderMathMLScripts.cpp:
     24        (WebCore::RenderMathMLScripts::layout):
     25        For aligning the subscript and superscript padding is added to the base.
     26        So subscriptshift and superscriptshift attributes is set as padding bottom
     27        and padding top of base respectively.
     28
    1292013-09-18  Mario Sanchez Prada  <mario.prada@samsung.com>
    230
  • trunk/Source/WebCore/mathml/mathattrs.in

    r152235 r156036  
    2828separators
    2929stretchy
     30subscriptshift
     31superscriptshift
    3032width
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp

    r155944 r156036  
    278278    // baseline), or the subscript above the axis. Also, don't let the superscript's top edge be
    279279    // below the base's top edge, or the subscript's bottom edge above the base's bottom edge.
    280     //
    281     // FIXME: Check any subscriptshift or superscriptshift attributes, and maybe use more sophisticated
    282     // heuristics from TeX or elsewhere. See https://bugs.webkit.org/show_bug.cgi?id=79274#c5.
    283280
    284281    LayoutUnit baseHeight = base->logicalHeight();
     
    295292    LayoutUnit bottomPadding = 0;
    296293
     294    Element* scriptElement = element();
     295    LayoutUnit superscriptShiftValue = 0;
     296    LayoutUnit subscriptShiftValue = 0;
     297    if (m_kind == Sub || m_kind == SubSup || m_kind == Multiscripts)
     298        parseMathMLLength(scriptElement->fastGetAttribute(MathMLNames::subscriptshiftAttr), subscriptShiftValue, style(), false);
     299    if (m_kind == Super || m_kind == SubSup || m_kind == Multiscripts)
     300        parseMathMLLength(scriptElement->fastGetAttribute(MathMLNames::superscriptshiftAttr), superscriptShiftValue, style(), false);
     301
    297302    bool isPostScript = true;
    298303    RenderMathMLBlock* subSupPair = toRenderMathMLBlock(m_baseWrapper->nextSibling());
     
    312317            if (superscriptBaseline == -1)
    313318                superscriptBaseline = superscriptHeight;
    314             LayoutUnit minBaseline = max<LayoutUnit>(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis);
     319            LayoutUnit minBaseline = max<LayoutUnit>(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis + superscriptShiftValue);
    315320
    316321            topPadding = max<LayoutUnit>(topPadding, minBaseline - baseBaseline);
     
    324329            LayoutUnit baseExtendUnderBaseline = baseHeight - baseBaseline;
    325330            LayoutUnit subscriptUnderItsBaseline = subscriptHeight - subscriptBaseline;
    326             LayoutUnit minExtendUnderBaseline = max<LayoutUnit>(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight - axis);
     331            LayoutUnit minExtendUnderBaseline = max<LayoutUnit>(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight + subscriptShiftValue - axis);
    327332
    328333            bottomPadding = max<LayoutUnit>(bottomPadding, minExtendUnderBaseline - baseExtendUnderBaseline);
Note: See TracChangeset for help on using the changeset viewer.