⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 157613 in webkit


Ignore:
Timestamp:
Oct 17, 2013, 4:33:53 PM (13 years ago)
Author:
akling@apple.com
Message:

CTTE: RenderMathMLSpace always has a MathMLTextElement.
<https://webkit.org/b/122992>

The renderer is never anonymous and always has a corresponding
MathMLTextElement. Overload element() with a tighter return type.

Also marked the class FINAL and made most methods private.

Reviewed by Antti Koivisto.

  • rendering/mathml/RenderMathMLSpace.cpp:

(WebCore::RenderMathMLSpace::RenderMathMLSpace):
(WebCore::RenderMathMLSpace::updateFromElement):

  • rendering/mathml/RenderMathMLSpace.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r157611 r157613  
     12013-10-17  Andreas Kling  <akling@apple.com>
     2
     3        CTTE: RenderMathMLSpace always has a MathMLTextElement.
     4        <https://webkit.org/b/122992>
     5
     6        The renderer is never anonymous and always has a corresponding
     7        MathMLTextElement. Overload element() with a tighter return type.
     8
     9        Also marked the class FINAL and made most methods private.
     10
     11        Reviewed by Antti Koivisto.
     12
     13        * rendering/mathml/RenderMathMLSpace.cpp:
     14        (WebCore::RenderMathMLSpace::RenderMathMLSpace):
     15        (WebCore::RenderMathMLSpace::updateFromElement):
     16        * rendering/mathml/RenderMathMLSpace.h:
     17
    1182013-10-17  Tim Horton  <timothy_horton@apple.com>
    219
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp

    r157408 r157613  
    3737using namespace MathMLNames;
    3838
    39 RenderMathMLSpace::RenderMathMLSpace(Element& element)
     39RenderMathMLSpace::RenderMathMLSpace(MathMLTextElement& element)
    4040    : RenderMathMLBlock(element)
    4141    , m_width(0)
     
    5353void RenderMathMLSpace::updateFromElement()
    5454{
    55     Element* space = element();
     55    const auto& spaceElement = element();
    5656
    5757    // This parses the mspace attributes, using 0 as the default values.
     
    5959    m_height = 0;
    6060    m_depth = 0;
    61     parseMathMLLength(space->getAttribute(MathMLNames::widthAttr), m_width, style());
    62     parseMathMLLength(space->getAttribute(MathMLNames::heightAttr), m_height, style());
    63     parseMathMLLength(space->getAttribute(MathMLNames::depthAttr), m_depth, style());
     61    parseMathMLLength(spaceElement.getAttribute(MathMLNames::widthAttr), m_width, style());
     62    parseMathMLLength(spaceElement.getAttribute(MathMLNames::heightAttr), m_height, style());
     63    parseMathMLLength(spaceElement.getAttribute(MathMLNames::depthAttr), m_depth, style());
    6464
    6565    // FIXME: Negative width values should be accepted.
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLSpace.h

    r157509 r157613  
    2929#if ENABLE(MATHML)
    3030
     31#include "MathMLTextElement.h"
    3132#include "RenderMathMLBlock.h"
    3233
    3334namespace WebCore {
    3435   
    35 class RenderMathMLSpace : public RenderMathMLBlock {
     36class RenderMathMLSpace FINAL : public RenderMathMLBlock {
    3637public:
    37     explicit RenderMathMLSpace(Element&);
     38    explicit RenderMathMLSpace(MathMLTextElement&);
     39    MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); }
    3840
     41private:
     42    virtual const char* renderName() const OVERRIDE { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
     43    virtual bool isRenderMathMLSpace() const OVERRIDE { return true; }
     44    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
     45    virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const OVERRIDE { return false; }
     46    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
     47    virtual void updateFromElement() OVERRIDE;
    3948    virtual int firstLineBoxBaseline() const OVERRIDE;
    4049    virtual void updateLogicalWidth() OVERRIDE;
    4150    virtual void updateLogicalHeight() OVERRIDE;
    42 
    43 private:
    44     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
    45     virtual const char* renderName() const OVERRIDE { return isAnonymous() ? "RenderMathMLSpace (anonymous)" : "RenderMathMLSpace"; }
    46 
    47     virtual bool isRenderMathMLSpace() const OVERRIDE { return true; }
    48 
    49     virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const OVERRIDE { return false; }
    50     virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
    51 
    52     virtual void updateFromElement() OVERRIDE;
    5351
    5452    LayoutUnit m_width;
Note: See TracChangeset for help on using the changeset viewer.