[Webkit-unassigned] [Bug 37044] MathML Support for mroot & msqrt

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 19 03:50:32 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=37044





--- Comment #3 from Alex Milowski <alex at milowski.com>  2010-04-19 03:50:32 PST ---
> ===================================================================
> --- WebCore/mathml/RenderMathMLRoot.cpp	(revision 0)
> +++ WebCore/mathml/RenderMathMLRoot.cpp	(revision 0)

[snip] 

> +
> +void RenderMathMLRoot::addChild(RenderObject* child, RenderObject* )
> +{
> +    if (isEmpty()) {
> +        // Add a block for the index
> +        RenderBlock* block = new (renderArena()) RenderBlock(node());
> +        RefPtr<RenderStyle> indexStyle = makeBlockStyle();
> +        indexStyle->setDisplay(INLINE_BLOCK);
> +        block->setStyle(indexStyle.release());
> +        RenderBlock::addChild(block);
> +        
> +        // FIXME: the wrapping does not seem to be needed anymore.
> +        // this is the base, so wrap it so we can pad it
> +        block = new (renderArena()) RenderBlock(node());
> +        RefPtr<RenderStyle> baseStyle = makeBlockStyle();
> +        baseStyle->setDisplay(INLINE_BLOCK);
> +//        baseStyle->setPaddingLeft(Length(5 * gRadicalWidth , Percent));

You shouldn't have commented out code in the patch.

> +        block->setStyle(baseStyle.release());
> +        RenderBlock::addChild(block);
> +        block->addChild(child);
> +    } else {
> +        // always add to the index
> +        firstChild()->addChild(child);
> +    }
> +}
> +    
> +void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty)
> +{
> +    RenderMathMLBlock::paint(info , tx , ty);
> +    
> +    tx += x();
> +    ty += y();
> +    
> +    RenderBoxModelObject* indexBox = toRenderBoxModelObject(lastChild());
> +    
> +    int maxHeight = indexBox->offsetHeight();
> +    if (!maxHeight) {
> +        // default to the font size in pixels if we're empty
> +        maxHeight = style()->fontSize();
> +    }

You really shouldn't have the braces around this just to have
the commented for the assignment.  

> +    int width = indexBox->offsetWidth();
> +    
> +    int indexWidth = 0;
> +    RenderObject* current = firstChild();
> +    while (current != lastChild()) {
> +        if (current->isBoxModelObject()) {
> +            RenderBoxModelObject* box = toRenderBoxModelObject(current);
> +            indexWidth += box->offsetWidth();
> +        }
> +        current = current->nextSibling();
> +    }
> +    
> +    int frontWidth = static_cast<int>(style()->fontSize() * gRadicalWidth);
> +    int topStartShift = 0;
> +    // Base height above which the shape of the root changes
> +    int thresholdHeight = static_cast<int>(gThresholdBaseHeight * style()->fontSize());
> +    
> +    if (maxHeight > thresholdHeight && thresholdHeight) {
> +        float shift = (maxHeight - thresholdHeight) / static_cast<float>(thresholdHeight);
> +        if (shift > 1.)
> +            shift = 1.;

I think you want 1.0 because you want to force a float comparison.  I don't see
anything in the style guide that says 1. is bad so it is up to you.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list