Changeset 202727 in webkit


Ignore:
Timestamp:
Jul 1, 2016 12:29:53 AM (8 years ago)
Author:
fred.wang@free.fr
Message:

Eliminate trailing whitespace in MathML code
https://bugs.webkit.org/show_bug.cgi?id=159091

Patch by Frederic Wang <fwang.igalia.com> on 2016-07-01
Reviewed by Alex Christensen.

No new tests, behavior is unchanged.

  • rendering/mathml/RenderMathMLBlock.cpp:

(WebCore::RenderMathMLBlock::baselinePosition):
(WebCore::RenderMathMLBlock::paint):
(WebCore::parseMathMLNamedSpace):

  • rendering/mathml/RenderMathMLBlock.h:
  • rendering/mathml/RenderMathMLFenced.cpp:

(WebCore::RenderMathMLFenced::updateFromElement):
(WebCore::RenderMathMLFenced::addChild):

  • rendering/mathml/RenderMathMLFenced.h:
  • rendering/mathml/RenderMathMLFraction.cpp:

(WebCore::RenderMathMLFraction::styleDidChange):
(WebCore::RenderMathMLFraction::paint):

  • rendering/mathml/RenderMathMLFraction.h:
  • rendering/mathml/RenderMathMLMath.h:
  • rendering/mathml/RenderMathMLMenclose.h:
  • rendering/mathml/RenderMathMLOperator.cpp:
  • rendering/mathml/RenderMathMLOperator.h:
  • rendering/mathml/RenderMathMLRoot.cpp:

(WebCore::RenderMathMLRoot::paint):

  • rendering/mathml/RenderMathMLScripts.cpp:
  • rendering/mathml/RenderMathMLSpace.cpp:
  • rendering/mathml/RenderMathMLSpace.h:
  • rendering/mathml/RenderMathMLToken.h:
  • rendering/mathml/RenderMathMLUnderOver.cpp:
  • rendering/mathml/RenderMathMLUnderOver.h:
Location:
trunk/Source/WebCore
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202726 r202727  
     12016-07-01  Frederic Wang  <fwang.igalia.com>
     2
     3        Eliminate trailing whitespace in MathML code
     4        https://bugs.webkit.org/show_bug.cgi?id=159091
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests, behavior is unchanged.
     9
     10        * rendering/mathml/RenderMathMLBlock.cpp:
     11        (WebCore::RenderMathMLBlock::baselinePosition):
     12        (WebCore::RenderMathMLBlock::paint):
     13        (WebCore::parseMathMLNamedSpace):
     14        * rendering/mathml/RenderMathMLBlock.h:
     15        * rendering/mathml/RenderMathMLFenced.cpp:
     16        (WebCore::RenderMathMLFenced::updateFromElement):
     17        (WebCore::RenderMathMLFenced::addChild):
     18        * rendering/mathml/RenderMathMLFenced.h:
     19        * rendering/mathml/RenderMathMLFraction.cpp:
     20        (WebCore::RenderMathMLFraction::styleDidChange):
     21        (WebCore::RenderMathMLFraction::paint):
     22        * rendering/mathml/RenderMathMLFraction.h:
     23        * rendering/mathml/RenderMathMLMath.h:
     24        * rendering/mathml/RenderMathMLMenclose.h:
     25        * rendering/mathml/RenderMathMLOperator.cpp:
     26        * rendering/mathml/RenderMathMLOperator.h:
     27        * rendering/mathml/RenderMathMLRoot.cpp:
     28        (WebCore::RenderMathMLRoot::paint):
     29        * rendering/mathml/RenderMathMLScripts.cpp:
     30        * rendering/mathml/RenderMathMLSpace.cpp:
     31        * rendering/mathml/RenderMathMLSpace.h:
     32        * rendering/mathml/RenderMathMLToken.h:
     33        * rendering/mathml/RenderMathMLUnderOver.cpp:
     34        * rendering/mathml/RenderMathMLUnderOver.h:
     35
    1362016-07-01  Frederic Wang  <fwang@igalia.com>
    237
  • trunk/Source/WebCore/mathml/MathMLElement.cpp

    r202441 r202727  
    4747
    4848namespace WebCore {
    49    
     49
    5050using namespace MathMLNames;
    51    
     51
    5252MathMLElement::MathMLElement(const QualifiedName& tagName, Document& document)
    5353    : StyledElement(tagName, document, CreateMathMLElement)
    5454{
    5555}
    56    
     56
    5757Ref<MathMLElement> MathMLElement::create(const QualifiedName& tagName, Document& document)
    5858{
  • trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp

    r202488 r202727  
    4242
    4343namespace WebCore {
    44    
     44
    4545using namespace MathMLNames;
    4646
  • trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h

    r200041 r202727  
    3232
    3333namespace WebCore {
    34    
     34
    3535class MathMLInlineContainerElement : public MathMLElement {
    3636public:
     
    4646    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    4747};
    48    
     48
    4949}
    5050
  • trunk/Source/WebCore/mathml/MathMLMathElement.h

    r200041 r202727  
    4242    RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
    4343};
    44    
     44
    4545}
    4646
  • trunk/Source/WebCore/mathml/MathMLMencloseElement.cpp

    r200041 r202727  
    4949
    5050RenderPtr<RenderElement> MathMLMencloseElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
    51 {   
     51{
    5252    return createRenderer<RenderMathMLMenclose>(*this, WTFMove(style));
    5353}
  • trunk/Source/WebCore/mathml/MathMLTextElement.cpp

    r202572 r202727  
    3737
    3838namespace WebCore {
    39    
     39
    4040using namespace MathMLNames;
    4141
  • trunk/Source/WebCore/mathml/MathMLTextElement.h

    r200041 r202727  
    3232
    3333namespace WebCore {
    34    
     34
    3535class MathMLTextElement final : public MathMLElement {
    3636public:
     
    4949    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    5050};
    51    
     51
    5252}
    5353
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp

    r202420 r202727  
    4141
    4242namespace WebCore {
    43    
     43
    4444using namespace MathMLNames;
    45    
     45
    4646RenderMathMLBlock::RenderMathMLBlock(Element& container, RenderStyle&& style)
    4747    : RenderFlexibleBox(container, WTFMove(style))
     
    8282    if (linePositionMode == PositionOfInteriorLineBoxes)
    8383        return 0;
    84    
     84
    8585    // FIXME: This may be unnecessary after flex baselines are implemented (https://bugs.webkit.org/show_bug.cgi?id=96188).
    8686    return firstLineBaseline().valueOrCompute([&] {
     
    105105{
    106106    RenderFlexibleBox::paint(info, paintOffset);
    107    
     107
    108108    if (info.context().paintingDisabled() || info.phase != PaintPhaseForeground)
    109109        return;
     
    112112
    113113    GraphicsContextStateSaver stateSaver(info.context());
    114    
     114
    115115    info.context().setStrokeThickness(1.0f);
    116116    info.context().setStrokeStyle(SolidStroke);
    117117    info.context().setStrokeColor(Color(0, 0, 255));
    118    
     118
    119119    info.context().drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y()));
    120120    info.context().drawLine(IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y()), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
    121121    info.context().drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
    122122    info.context().drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + pixelSnappedOffsetHeight()));
    123    
     123
    124124    int topStart = paddingTop();
    125    
     125
    126126    info.context().setStrokeColor(Color(0, 255, 0));
    127    
     127
    128128    info.context().drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + topStart), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + topStart));
    129    
     129
    130130    int baseline = roundToInt(baselinePosition(AlphabeticBaseline, true, HorizontalLine));
    131    
     131
    132132    info.context().setStrokeColor(Color(255, 0, 0));
    133    
     133
    134134    info.context().drawLine(IntPoint(adjustedPaintOffset.x(), adjustedPaintOffset.y() + baseline), IntPoint(adjustedPaintOffset.x() + pixelSnappedOffsetWidth(), adjustedPaintOffset.y() + baseline));
    135135}
     
    147147//
    148148// There should be no space between the number and the unit of a length."
    149 // 
     149//
    150150// "A trailing '%' represents a percent of the default value. The default
    151151// value, or how it is obtained, is listed in the table of attributes for each
     
    154154//
    155155// "The possible units in MathML are:
    156 // 
     156//
    157157// Unit Description
    158158// em   an em (font-relative unit traditionally used for horizontal lengths)
     
    300300            length = -6;
    301301        else if (string == "negativeveryverythickmathspace")
    302             length = -7;       
     302            length = -7;
    303303    }
    304304    if (length) {
     
    317317}
    318318
    319 }   
     319}
    320320
    321321#endif
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h

    r202420 r202727  
    3737
    3838namespace WebCore {
    39    
     39
    4040class RenderMathMLOperator;
    4141
     
    4646
    4747    bool isChildAllowed(const RenderObject&, const RenderStyle&) const override;
    48    
     48
    4949    // MathML defines an "embellished operator" as roughly an <mo> that may have subscripts,
    5050    // superscripts, underscripts, overscripts, or a denominator (as in d/dx, where "d" is some
     
    5555    // https://bugs.webkit.org/show_bug.cgi?id=78617.
    5656    virtual RenderMathMLOperator* unembellishedOperator() { return 0; }
    57    
     57
    5858    int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
    59    
     59
    6060#if ENABLE(DEBUG_MATH_LAYOUT)
    6161    virtual void paint(PaintInfo&, const LayoutPoint&);
    6262#endif
    63    
     63
    6464    LayoutUnit mathAxisHeight() const;
    6565    LayoutUnit mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth = 0) const;
    6666    LayoutUnit mirrorIfNeeded(LayoutUnit horizontalOffset, const RenderBox& child) const { return mirrorIfNeeded(horizontalOffset, child.logicalWidth()); }
    67    
     67
    6868protected:
    6969    static LayoutUnit ascentForChild(const RenderBox& child)
     
    8484    {
    8585    }
    86    
     86
    8787    Optional<int> firstLineBaseline() const override;
    88    
     88
    8989private:
    9090    bool isRenderMathMLTable() const override { return true; }
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp

    r200041 r202727  
    3838
    3939namespace WebCore {
    40    
     40
    4141using namespace MathMLNames;
    42    
     42
    4343static const char* gOpeningBraceChar = "(";
    4444static const char* gClosingBraceChar = ")";
     
    5353{
    5454    const auto& fenced = element();
    55  
     55
    5656    // The open operator defaults to a left parenthesis.
    5757    AtomicString open = fenced.fastGetAttribute(MathMLNames::openAttr);
     
    7474        m_separators = StringImpl::create(",");
    7575    }
    76    
     76
    7777    if (isEmpty())
    7878        makeFences();
     
    106106    if (isEmpty())
    107107        updateFromElement();
    108    
     108
    109109    // FIXME: Adding or removing a child should possibly cause all later separators to shift places if they're different, as later child positions change by +1 or -1. This should also handle surrogate pairs. See https://bugs.webkit.org/show_bug.cgi?id=125938.
    110    
     110
    111111    RenderPtr<RenderMathMLOperator> separatorRenderer;
    112112    if (m_separators.get()) {
     
    121121        }
    122122        // |count| is now the number of element children that will be before our new separator, i.e. it's the 1-based index of the separator.
    123        
     123
    124124        if (count > 0) {
    125125            UChar separator;
    126            
     126
    127127            // Use the last separator if we've run out of specified separators.
    128128            if (count > m_separators.get()->length())
     
    130130            else
    131131                separator = (*m_separators.get())[count - 1];
    132                
     132
    133133            StringBuilder builder;
    134134            builder.append(separator);
     
    136136        }
    137137    }
    138    
     138
    139139    if (beforeChild) {
    140140        // Adding |x| before an existing |y| e.g. in element (y) - first insert our new child |x|, then its separator, to get (x, y).
     
    150150}
    151151
    152 }   
     152}
    153153
    154154#endif
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h

    r200041 r202727  
    3434
    3535namespace WebCore {
    36    
     36
    3737class RenderMathMLFenced final : public RenderMathMLRow {
    3838public:
    3939    RenderMathMLFenced(MathMLInlineContainerElement&, RenderStyle&&);
    4040    MathMLInlineContainerElement& element() { return static_cast<MathMLInlineContainerElement&>(nodeForNonAnonymous()); }
    41    
     41
    4242private:
    4343    bool isRenderMathMLFenced() const override { return true; }
     
    5252    String m_close;
    5353    RefPtr<StringImpl> m_separators;
    54    
     54
    5555    RenderMathMLOperator* m_closeFenceRenderer;
    5656};
    57    
     57
    5858}
    5959
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp

    r202441 r202727  
    3737
    3838namespace WebCore {
    39    
     39
    4040using namespace MathMLNames;
    4141
     
    124124{
    125125    RenderMathMLBlock::styleDidChange(diff, oldStyle);
    126    
     126
    127127    updateFromElement();
    128128}
     
    210210
    211211    IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + LayoutPoint(0, numerator().logicalHeight() + gNumeratorGap * style().fontSize() + m_lineThickness / 2));
    212    
     212
    213213    GraphicsContextStateSaver stateSaver(info.context());
    214    
     214
    215215    info.context().setStrokeThickness(m_lineThickness);
    216216    info.context().setStrokeStyle(SolidStroke);
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.h

    r200041 r202727  
    5858    RenderMathMLOperator* unembellishedOperator() final;
    5959    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
    60    
     60
    6161    bool isValid() const;
    6262    RenderBox& numerator() const;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLMath.h

    r202497 r202727  
    3232
    3333namespace WebCore {
    34    
     34
    3535class RenderMathMLMath final : public RenderMathMLRow {
    3636public:
     
    4141    const char* renderName() const override { return "RenderMathMLMath"; }
    4242};
    43    
     43
    4444}
    4545
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h

    r200041 r202727  
    3333
    3434namespace WebCore {
    35    
     35
    3636class RenderMathMLMenclose final: public RenderMathMLRow {
    3737public:
     
    5353    LayoutRect m_contentRect;
    5454};
    55    
     55
    5656}
    5757
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r202420 r202727  
    4444
    4545namespace WebCore {
    46    
     46
    4747using namespace MathMLNames;
    4848
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h

    r202497 r202727  
    4848    LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
    4949    void resetStretchSize();
    50    
     50
    5151    bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; }
    5252    // FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737).
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

    r202441 r202727  
    250250{
    251251    RenderMathMLRow::paint(info, paintOffset);
    252    
     252
    253253    if (isEmpty() || info.context().paintingDisabled() || style().visibility() != VISIBLE || !isValid())
    254254        return;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp

    r202441 r202727  
    3636
    3737namespace WebCore {
    38    
     38
    3939using namespace MathMLNames;
    4040
     
    435435}
    436436
    437 }   
     437}
    438438
    439439#endif // ENABLE(MATHML)
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp

    r200041 r202727  
    3434
    3535namespace WebCore {
    36    
     36
    3737using namespace MathMLNames;
    3838
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h

    r202569 r202727  
    3333
    3434namespace WebCore {
    35    
     35
    3636class RenderMathMLSpace final : public RenderMathMLBlock {
    3737public:
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.h

    r202569 r202727  
    3535
    3636namespace WebCore {
    37    
     37
    3838class RenderMathMLToken : public RenderMathMLBlock {
    3939public:
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp

    r202441 r202727  
    3939
    4040using namespace MathMLNames;
    41    
     41
    4242RenderMathMLUnderOver::RenderMathMLUnderOver(Element& element, RenderStyle&& style)
    4343    : RenderMathMLBlock(element, WTFMove(style))
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h

    r200041 r202727  
    3333
    3434namespace WebCore {
    35    
     35
    3636class RenderMathMLUnderOver final : public RenderMathMLBlock {
    3737public:
    3838    RenderMathMLUnderOver(Element&, RenderStyle&&);
    39    
     39
    4040    RenderMathMLOperator* unembellishedOperator() override;
    4141
     
    6060    UnderOverType m_scriptType;
    6161};
    62    
     62
    6363}
    6464
Note: See TracChangeset for help on using the changeset viewer.