[Webkit-unassigned] [Bug 179682] Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Nov 28 11:48:47 PST 2017
https://bugs.webkit.org/show_bug.cgi?id=179682
--- Comment #24 from Minsheng Liu <lambda at liu.ms> ---
I have adopted the first part of your change of layout-ing sub-expressions with their stretchy operators’ widths set to zero. However, due to the <munderover> with narrow base case, the hacky last line cannot be removed. My code now looks like this:
void RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
{
// The function will be called either "freshly"
// or as a fix after an embellished operator is stretched.
ASSERT(isValid());
ASSERT(needsLayout());
LayoutUnit stretchWidth = 0;
// The loop layouts each sub-expression's width with
// embellished stretchy operators' width set to 0,
// unless the stretchy operators' stretch widths have been locked.
for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
auto renderOperator = toHorizontalStretchyOperator(child);
if (renderOperator) {
if (!renderOperator->isStretchWidthLocked())
renderOperator->resetStretchSize();
renderOperator->setStretchWidthLocked(true);
// This step is necessary if the function is called as a fix,
// since the embellished operator could be nested down deeply.
// Each direct ancestor of the operator shall be re-layout-ed.
child->setNeedsLayout();
}
child->layoutIfNeeded();
if (renderOperator) {
// Note that during the fix the embellished operator might be locked
// and unlocked multiple times, so I change the implementation of the lock
// to a counter.
renderOperator->setStretchWidthLocked(false);
}
// Only base() will stretch to the maximum of all other elements,
// but the spec requires base() to stretch to the maximum width of elements other than the base().
// A decision is needed.
// The behavior is not consistent with Firefox.
stretchWidth = std::max(stretchWidth, child->logicalWidth());
}
for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (auto renderOperator = toHorizontalStretchyOperator(child)) {
if (!renderOperator->isStretchWidthLocked()) {
renderOperator->resetStretchSize();
renderOperator->stretchTo(stretchWidth);
renderOperator->setStretchWidthLocked(true);
child->setNeedsLayout();
child->layout();
renderOperator->setStretchWidthLocked(false);
}
}
// For children other than base(), the stretchWidth is the width of base().
// This is for <munderover> in which we have braces on the top and the bottom.
// The braces should be stretched as wide as the base(), not lonoger or shorter.
// The behavior is consistent with Firefox.
stretchWidth = firstChildBox()->logicalWidth();
}
}
And it causes no regression other than the expected one. I will provide a review-ready patch (without tests for now) soon.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171128/34dfb74a/attachment.html>
More information about the webkit-unassigned
mailing list