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

Changeset 176465 in webkit


Ignore:
Timestamp:
Nov 21, 2014, 12:42:14 PM (12 years ago)
Author:
akling@apple.com
Message:

RenderMathMLScripts isPrescript() helper should take a reference.
<https://webkit.org/b/138975>

Reviewed by Antti Koivisto.

Tidy this up a bit, since it's never called with a null pointer.

  • rendering/mathml/RenderMathMLScripts.cpp:

(WebCore::isPrescript):
(WebCore::RenderMathMLScripts::fixAnonymousStyles):
(WebCore::RenderMathMLScripts::addChildInternal):
(WebCore::RenderMathMLScripts::removeChildInternal):
(WebCore::RenderMathMLScripts::layout):
(WebCore::RenderMathMLScriptsWrapper::addChildInternal):
(WebCore::RenderMathMLScriptsWrapper::removeChildInternal):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r176464 r176465  
     12014-11-21  Andreas Kling  <akling@apple.com>
     2
     3        RenderMathMLScripts isPrescript() helper should take a reference.
     4        <https://webkit.org/b/138975>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Tidy this up a bit, since it's never called with a null pointer.
     9
     10        * rendering/mathml/RenderMathMLScripts.cpp:
     11        (WebCore::isPrescript):
     12        (WebCore::RenderMathMLScripts::fixAnonymousStyles):
     13        (WebCore::RenderMathMLScripts::addChildInternal):
     14        (WebCore::RenderMathMLScripts::removeChildInternal):
     15        (WebCore::RenderMathMLScripts::layout):
     16        (WebCore::RenderMathMLScriptsWrapper::addChildInternal):
     17        (WebCore::RenderMathMLScriptsWrapper::removeChildInternal):
     18
    1192014-11-21  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp

    r176258 r176465  
    5151//
    5252
    53 static bool isPrescript(RenderObject* renderObject)
    54 {
    55     ASSERT(renderObject);
    56     return renderObject->node() && renderObject->node()->hasTagName(MathMLNames::mprescriptsTag);
     53static bool isPrescript(const RenderObject& renderObject)
     54{
     55    return renderObject.node() && renderObject.node()->hasTagName(MathMLNames::mprescriptsTag);
    5756}
    5857
     
    120119    // This sets the style for postscript pairs.
    121120    RenderObject* subSupPair = m_baseWrapper;
    122     for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(subSupPair); subSupPair = subSupPair->nextSibling())
     121    for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(*subSupPair); subSupPair = subSupPair->nextSibling())
    123122        fixAnonymousStyleForSubSupPair(subSupPair, true);
    124123
    125124    if (subSupPair && m_kind == Multiscripts) {
    126125        // This sets the style for prescript pairs.
    127         for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(subSupPair); subSupPair = subSupPair->nextSibling())
     126        for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(*subSupPair); subSupPair = subSupPair->nextSibling())
    128127            fixAnonymousStyleForSubSupPair(subSupPair, false);
    129128    }
     
    131130    // This resets style for extra subSup pairs.
    132131    for (; subSupPair; subSupPair = subSupPair->nextSibling()) {
    133         if (!isPrescript(subSupPair)) {
     132        if (!isPrescript(*subSupPair)) {
    134133            ASSERT(subSupPair && subSupPair->style().refCount() == 1);
    135134            RenderStyle& scriptsStyle = subSupPair->style();
     
    169168    }
    170169   
    171     if (isPrescript(child)) {
     170    if (isPrescript(*child)) {
    172171        // The new child becomes an <mprescripts/> separator.
    173172        RenderMathMLBlock::addChild(child, beforeChild);
     
    175174    }
    176175
    177     if (!beforeChild || isPrescript(beforeChild)) {
     176    if (!beforeChild || isPrescript(*beforeChild)) {
    178177        // We are at the end of a sequence of subSup pairs.
    179178        RenderMathMLBlock* previousSibling = downcast<RenderMathMLBlock>(beforeChild ? beforeChild->previousSibling() : lastChild());
     
    205204        return RenderMathMLBlock::removeChild(child);
    206205
    207     ASSERT(isPrescript(&child));
     206    ASSERT(isPrescript(child));
    208207
    209208    RenderObject* previousSibling = child.previousSibling();
     
    211210    ASSERT(previousSibling);
    212211
    213     if (nextSibling && !isPrescript(previousSibling) && !isPrescript(nextSibling)) {
     212    if (nextSibling && !isPrescript(*previousSibling) && !isPrescript(*nextSibling)) {
    214213        RenderMathMLScriptsWrapper& previousWrapper = downcast<RenderMathMLScriptsWrapper>(*previousSibling);
    215214        RenderMathMLScriptsWrapper& nextWrapper = downcast<RenderMathMLScriptsWrapper>(*nextSibling);
     
    307306
    308307        // We skip the base and <mprescripts/> elements.
    309         if (isPrescript(subSupPair)) {
     308        if (isPrescript(*subSupPair)) {
    310309            if (!isPostScript)
    311310                break;
     
    397396        if (oldBase)
    398397            RenderMathMLBlock::removeChild(*oldBase);
    399         if (isPrescript(child))
     398        if (isPrescript(*child))
    400399            parentNode->addChildInternal(true, child, sibling);
    401400        else
     
    406405    }
    407406
    408     if (isPrescript(child)) {
     407    if (isPrescript(*child)) {
    409408        // We insert an <mprescripts> element.
    410409        if (!beforeChild)
     
    432431    // We first move to the last subSup pair in the curent sequence of scripts.
    433432    RenderMathMLScriptsWrapper* subSupPair = this;
    434     while (subSupPair->nextSibling() && !isPrescript(subSupPair->nextSibling()))
     433    while (subSupPair->nextSibling() && !isPrescript(*subSupPair->nextSibling()))
    435434        subSupPair = downcast<RenderMathMLScriptsWrapper>(subSupPair->nextSibling());
    436435    if (subSupPair->firstChild()->nextSibling()) {
     
    474473        RenderObject* sibling = nextSibling();
    475474        RenderMathMLBlock::removeChild(child);
    476         if (sibling && !isPrescript(sibling)) {
     475        if (sibling && !isPrescript(*sibling)) {
    477476            // If there are postscripts, the first one becomes the base.
    478477            RenderMathMLScriptsWrapper& wrapper = downcast<RenderMathMLScriptsWrapper>(*sibling);
     
    487486    RenderObject* next = RenderMathMLBlock::removeChild(child);
    488487    RenderMathMLScriptsWrapper* subSupPair = this;
    489     for (RenderObject* nextSibling = subSupPair->nextSibling(); nextSibling && !isPrescript(nextSibling); nextSibling = nextSibling->nextSibling()) {
     488    for (RenderObject* nextSibling = subSupPair->nextSibling(); nextSibling && !isPrescript(*nextSibling); nextSibling = nextSibling->nextSibling()) {
    490489        RenderMathMLScriptsWrapper& nextSubSupPair = downcast<RenderMathMLScriptsWrapper>(*nextSibling);
    491490        RenderObject* script = nextSubSupPair.firstChild();
Note: See TracChangeset for help on using the changeset viewer.