Diff
Modified: trunk/LayoutTests/ChangeLog (198997 => 198998)
--- trunk/LayoutTests/ChangeLog 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/LayoutTests/ChangeLog 2016-04-04 08:25:37 UTC (rev 198998)
@@ -1,3 +1,20 @@
+2016-04-04 Frederic Wang <[email protected]>
+
+ Refactor RenderMathMLRow layout functions to avoid using flexbox
+ https://bugs.webkit.org/show_bug.cgi?id=153208
+
+ Reviewed by Martin Robinson.
+
+ Apply some small adjustments to MathML tests after the refactoring of RenderMathMLRow.
+
+ * TestExpectations: Skip fractions-positions reftest for now. The small difference will be fixed after refactoring completely RenderMathMLFraction.
+ We also ignore a test for margin/padding on MathML renderers.
+ * platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.png: Update reference to take into account small changes in stretch size.
+ The intended test behavior (reading variants and construction from the MATH table) is preserved.
+ * platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt: ditto.
+ * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.png: ditto.
+ * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt: ditto.
+
2016-04-04 Hunseop Jeong <[email protected]>
[EFL] Unreviewed EFL Gardening on 4th Apr.
Modified: trunk/LayoutTests/TestExpectations (198997 => 198998)
--- trunk/LayoutTests/TestExpectations 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/LayoutTests/TestExpectations 2016-04-04 08:25:37 UTC (rev 198998)
@@ -112,6 +112,12 @@
# This test verifies dynamic manipulation of the mroot and msqrt elements.
mathml/roots-removeChild.html [ ImageOnlyFailure ]
+# There is a small 1px size difference but this will be fixed when we refactor completely RenderMathMLFraction.
+mathml/presentation/fractions-positions.html [ Skip ]
+
+# For now we ignore margin/padding/border properties of MathML renderers.
+mathml/presentation/bug97990.html [ Skip ]
+
# This test verifies that a mismatch reftest will fail as intended if both results are same. (introduced in r93187)
fast/harness/sample-fail-mismatch-reftest.html [ WontFix ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt (198997 => 198998)
--- trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2016-04-04 08:25:37 UTC (rev 198998)
@@ -4,35 +4,35 @@
RenderBlock {HTML} at (0,0) size 800x157
RenderBody {BODY} at (8,16) size 784x125
RenderBlock {P} at (0,0) size 784x25
- RenderMathMLMath {math} at (0,2) size 18x23 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 16x23
- RenderMathMLUnderOver {mover} at (0,0) size 16x23
- RenderMathMLOperator {mo} at (0,1) size 16x22
+ RenderMathMLMath {math} at (0,2) size 10x23 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 8x23
+ RenderMathMLUnderOver {mover} at (0,0) size 8x23
+ RenderMathMLOperator {mo} at (-5,1) size 17x22
RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4
RenderBlock (anonymous) at (0,0) size 1x4
RenderText at (0,-3) size 1x0
text run at (0,-3) width 1: "\x{219C}"
- RenderMathMLSpace {mspace} at (4,0) size 8x1
+ RenderMathMLSpace {mspace} at (0,0) size 8x1
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,41) size 784x25
- RenderMathMLMath {math} at (0,2) size 28x23 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 26x23
- RenderMathMLUnderOver {mover} at (0,0) size 26x23
- RenderMathMLOperator {mo} at (0,1) size 26x22
+ RenderMathMLMath {math} at (0,2) size 17x23 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 15x23
+ RenderMathMLUnderOver {mover} at (0,0) size 15x23
+ RenderMathMLOperator {mo} at (-6,1) size 27x22
RenderMathMLBlock (anonymous, flex) at (2,0) size 21x4
RenderBlock (anonymous) at (0,0) size 1x4
RenderText at (0,-3) size 1x0
text run at (0,-3) width 1: "\x{219C}"
- RenderMathMLSpace {mspace} at (5,0) size 16x1
+ RenderMathMLSpace {mspace} at (0,0) size 15x1
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,82) size 784x43
- RenderMathMLMath {math} at (0,0) size 158x43 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 156x43
- RenderMathMLUnderOver {mover} at (0,0) size 156x43
- RenderMathMLOperator {mo} at (0,1) size 156x42
+ RenderMathMLMath {math} at (0,0) size 152x43 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 150x43
+ RenderMathMLUnderOver {mover} at (0,0) size 150x43
+ RenderMathMLOperator {mo} at (-3,1) size 156x42
RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4
RenderBlock (anonymous) at (0,0) size 1x4
RenderText at (0,-3) size 1x0
text run at (0,-3) width 1: "\x{219C}"
- RenderMathMLSpace {mspace} at (2,0) size 151x1
+ RenderMathMLSpace {mspace} at (0,0) size 150x1
RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt (198997 => 198998)
--- trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt 2016-04-04 08:25:37 UTC (rev 198998)
@@ -4,35 +4,35 @@
RenderBlock {HTML} at (0,0) size 800x153
RenderBody {BODY} at (8,16) size 784x121
RenderBlock {P} at (0,0) size 784x24
- RenderMathMLMath {math} at (0,3) size 18x22 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 16x22
- RenderMathMLUnderOver {mover} at (0,0) size 16x22
- RenderMathMLOperator {mo} at (0,1) size 16x21
+ RenderMathMLMath {math} at (0,3) size 10x22 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 8x22
+ RenderMathMLUnderOver {mover} at (0,0) size 8x22
+ RenderMathMLOperator {mo} at (-5,1) size 17x21
RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x0
text run at (0,-3) width 2: "\x{219C}"
- RenderMathMLSpace {mspace} at (4,0) size 8x1
+ RenderMathMLSpace {mspace} at (0,0) size 8x1
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,40) size 784x24
- RenderMathMLMath {math} at (0,3) size 28x22 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 26x22
- RenderMathMLUnderOver {mover} at (0,0) size 26x22
- RenderMathMLOperator {mo} at (0,1) size 26x21
+ RenderMathMLMath {math} at (0,3) size 17x22 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 15x22
+ RenderMathMLUnderOver {mover} at (0,0) size 15x22
+ RenderMathMLOperator {mo} at (-6,1) size 27x21
RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x0
text run at (0,-3) width 2: "\x{219C}"
- RenderMathMLSpace {mspace} at (5,0) size 16x1
+ RenderMathMLSpace {mspace} at (0,0) size 15x1
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,80) size 784x41
- RenderMathMLMath {math} at (0,0) size 158x42 [padding: 0 1 0 1]
- RenderMathMLRow {mstyle} at (1,0) size 156x42
- RenderMathMLUnderOver {mover} at (0,0) size 156x42
- RenderMathMLOperator {mo} at (0,1) size 156x41
+ RenderMathMLMath {math} at (0,0) size 152x42 [padding: 0 1 0 1]
+ RenderMathMLRow {mstyle} at (1,0) size 150x42
+ RenderMathMLUnderOver {mover} at (0,0) size 150x42
+ RenderMathMLOperator {mo} at (-3,1) size 156x41
RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4
RenderBlock (anonymous) at (0,0) size 2x4
RenderText at (0,-3) size 2x0
text run at (0,-3) width 2: "\x{219C}"
- RenderMathMLSpace {mspace} at (2,0) size 151x1
+ RenderMathMLSpace {mspace} at (0,0) size 150x1
RenderText {#text} at (0,0) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (198997 => 198998)
--- trunk/Source/WebCore/ChangeLog 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/ChangeLog 2016-04-04 08:25:37 UTC (rev 198998)
@@ -1,3 +1,40 @@
+2016-04-04 Frederic Wang <[email protected]>
+
+ Refactor RenderMathMLRow layout functions to avoid using flexbox
+ https://bugs.webkit.org/show_bug.cgi?id=153208
+
+ Reviewed by Martin Robinson.
+
+ This is the first patch to rewrite MathML layout without relying on
+ flexboxes or anonymous renderers.
+ We have done some temporary changes to allow overriding of
+ layoutBlock and to implement paintChildren, but this will be remove in a
+ follow-up patch. We also implement firstLineBaseline,
+ computePreferredLogicalWidths and layoutBlock of RenderMathMLRow without
+ using any flexbox functions. We adjust a bit the MathML CSS to take into
+ account these changes. Finally, we delete the unused helper function to
+ create anonymous RenderMathMLRow.
+
+ * css/mathml.css:
+ (ms, mtext, mi, mn, mo, annotation, mtd): Prevent linebreaking inside token elements and table cells, otherwise this cause test failures with the new implementation of RenderMathMLRow.
+ (math, mrow, mfenced, merror, mphantom, mstyle, menclose): Deleted. We no longer rely on flexbox for baseline alignment of RenderMathMLRow.
+ * rendering/RenderFlexibleBox.h: Allow overrider of the LayoutBlock for the moment.
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isRenderMathMLMenclose): Add helper function.
+ * rendering/mathml/RenderMathMLMenclose.h: ditto.
+ * rendering/mathml/RenderMathMLBlock.h:
+ (WebCore::ascentForChild): Add helper function to easily compute the ascent of a child.
+ * rendering/mathml/RenderMathMLRow.cpp: Reimplement the class without using the flexbox layout.
+ (WebCore::RenderMathMLRow::firstLineBaseline): Implement the function to determine the baseline.
+ (WebCore::RenderMathMLRow::computeLineVerticalStretch): Add a function that browses non-stretchy children to determine the desired vertical stretch metrics.
+ (WebCore::RenderMathMLRow::computePreferredLogicalWidths): Implement the function to determine the preferred widths of the RenderMathMLRow.
+ (WebCore::RenderMathMLRow::layoutRowItems): Helper function that layouts children (stretching vertical operators if needed), calculate the exact logical width and position children.
+ (WebCore::RenderMathMLRow::layoutBlock): Implement the function to do the actual layout, which essentially calls layoutRowItems.
+ (WebCore::RenderMathMLRow::paintChildren): Temporarily implement this function, which just calls paintChild on each child.
+ (WebCore::RenderMathMLRow::createAnonymousWithParentRenderer): Deleted. We actually don't create anonymous RenderMathMLRow at the moment.
+ (WebCore::RenderMathMLRow::layout): Deleted.
+ * rendering/mathml/RenderMathMLRow.h: Update declarations of functions.
+
2016-04-04 Chris Fleizach <[email protected]>
AX: Consolidate radio button group member code with that in HTMLElement derivatives
Modified: trunk/Source/WebCore/css/mathml.css (198997 => 198998)
--- trunk/Source/WebCore/css/mathml.css 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/css/mathml.css 2016-04-04 08:25:37 UTC (rev 198998)
@@ -40,8 +40,8 @@
display: -webkit-inline-flex !important;
}
-math, mrow, mfenced, merror, mphantom, mstyle, menclose {
- align-items: baseline;
+ms, mtext, mi, mn, mo, annotation, mtd {
+ white-space: nowrap !important;
}
mo, mfrac, munder, mover, munderover {
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (198997 => 198998)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h 2016-04-04 08:25:37 UTC (rev 198998)
@@ -46,7 +46,7 @@
bool avoidsFloats() const final { return true; }
bool canDropAnonymousBlockChild() const final { return false; }
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
Optional<int> firstLineBaseline() const override;
Modified: trunk/Source/WebCore/rendering/RenderObject.h (198997 => 198998)
--- trunk/Source/WebCore/rendering/RenderObject.h 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2016-04-04 08:25:37 UTC (rev 198998)
@@ -388,6 +388,7 @@
virtual bool isRenderMathMLRadicalOperator() const { return false; }
virtual bool isRenderMathMLRow() const { return false; }
virtual bool isRenderMathMLMath() const { return false; }
+ virtual bool isRenderMathMLMenclose() const { return false; }
virtual bool isRenderMathMLFenced() const { return false; }
virtual bool isRenderMathMLFraction() const { return false; }
virtual bool isRenderMathMLRoot() const { return false; }
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h (198997 => 198998)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h 2016-04-04 08:25:37 UTC (rev 198998)
@@ -64,6 +64,12 @@
// Create a new RenderMathMLBlock, with a new style inheriting from this->style().
RenderPtr<RenderMathMLBlock> createAnonymousMathMLBlock();
+protected:
+ static LayoutUnit ascentForChild(const RenderBox& child)
+ {
+ return child.firstLineBaseline().valueOr(child.logicalHeight());
+ }
+
private:
bool isRenderMathMLBlock() const final { return true; }
const char* renderName() const override;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h (198997 => 198998)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h 2016-04-04 08:25:37 UTC (rev 198998)
@@ -36,15 +36,18 @@
RenderMathMLMenclose(Element&, Ref<RenderStyle>&&);
private:
- const char* renderName() const override { return "RenderMathMLMenclose"; }
- void paint(PaintInfo&, const LayoutPoint&) override;
+ bool isRenderMathMLMenclose() const final { return true; }
+ const char* renderName() const final { return "RenderMathMLMenclose"; }
+ void paint(PaintInfo&, const LayoutPoint&) final;
void updateLogicalHeight() override;
void addChild(RenderObject* newChild, RenderObject* beforeChild = nullptr) override;
- void computePreferredLogicalWidths() override;
+ void computePreferredLogicalWidths() final;
bool checkNotationalValuesValidity(const Vector<String>&) const;
};
}
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLMenclose, isRenderMathMLMenclose())
+
#endif // ENABLE(MATHML)
#endif // RenderMathMLMenclose_h
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (198997 => 198998)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-04-04 08:25:37 UTC (rev 198998)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Alex Milowski ([email protected]). All rights reserved.
+ * Copyright (C) 2016 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,13 +49,6 @@
{
}
-RenderPtr<RenderMathMLRow> RenderMathMLRow::createAnonymousWithParentRenderer(RenderMathMLRoot& parent)
-{
- RenderPtr<RenderMathMLRow> newMRow = createRenderer<RenderMathMLRow>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX));
- newMRow->initializeStyle();
- return newMRow;
-}
-
void RenderMathMLRow::updateOperatorProperties()
{
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
@@ -66,46 +60,152 @@
setNeedsLayoutAndPrefWidthsRecalc();
}
-void RenderMathMLRow::layout()
+
+Optional<int> RenderMathMLRow::firstLineBaseline() const
{
- int stretchHeightAboveBaseline = 0, stretchDepthBelowBaseline = 0;
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->needsLayout())
- downcast<RenderElement>(*child).layout();
- if (is<RenderMathMLBlock>(*child)) {
- // We skip the stretchy operators as they must not be included in the computation of the stretch size.
- auto* renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator();
+ RenderBox* baselineChild = firstChildBox();
+ if (!baselineChild)
+ return Optional<int>();
+
+ return Optional<int>(static_cast<int>(lroundf(ascentForChild(*baselineChild) + baselineChild->logicalTop())));
+}
+
+void RenderMathMLRow::computeLineVerticalStretch(int& stretchHeightAboveBaseline, int& stretchDepthBelowBaseline)
+{
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (is<RenderMathMLBlock>(child)) {
+ auto* renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator();
if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
continue;
}
- LayoutUnit childHeightAboveBaseline = 0, childDepthBelowBaseline = 0;
- if (is<RenderMathMLBlock>(*child)) {
- RenderMathMLBlock& mathmlChild = downcast<RenderMathMLBlock>(*child);
- childHeightAboveBaseline = mathmlChild.firstLineBaseline().valueOr(mathmlChild.logicalHeight());
- childDepthBelowBaseline = mathmlChild.logicalHeight() - childHeightAboveBaseline;
- } else if (is<RenderMathMLTable>(*child)) {
- RenderMathMLTable& tableChild = downcast<RenderMathMLTable>(*child);
- childHeightAboveBaseline = tableChild.firstLineBaseline().valueOr(-1);
- childDepthBelowBaseline = tableChild.logicalHeight() - childHeightAboveBaseline;
- } else if (is<RenderBox>(*child)) {
- childHeightAboveBaseline = downcast<RenderBox>(*child).logicalHeight();
- childDepthBelowBaseline = 0;
- }
+
+ child->layoutIfNeeded();
+
+ LayoutUnit childHeightAboveBaseline = ascentForChild(*child);
+ LayoutUnit childDepthBelowBaseline = child->logicalHeight() - childHeightAboveBaseline;
+
stretchHeightAboveBaseline = std::max<LayoutUnit>(stretchHeightAboveBaseline, childHeightAboveBaseline);
stretchDepthBelowBaseline = std::max<LayoutUnit>(stretchDepthBelowBaseline, childDepthBelowBaseline);
}
- if (stretchHeightAboveBaseline + stretchDepthBelowBaseline <= 0)
+
+ // We ensure a minimal stretch size.
+ if (stretchHeightAboveBaseline + stretchDepthBelowBaseline <= 0) {
stretchHeightAboveBaseline = style().fontSize();
-
- // Set the sizes of (possibly embellished) stretchy operator children.
- for (auto& child : childrenOfType<RenderMathMLBlock>(*this)) {
- if (auto renderOperator = child.unembellishedOperator())
- renderOperator->stretchTo(stretchHeightAboveBaseline, stretchDepthBelowBaseline);
+ stretchDepthBelowBaseline = 0;
}
+}
- RenderMathMLBlock::layout();
+void RenderMathMLRow::computePreferredLogicalWidths()
+{
+ ASSERT(preferredLogicalWidthsDirty());
+
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
+
+ LayoutUnit preferredWidth = 0;
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox())
+ preferredWidth += child->maxPreferredLogicalWidth() + child->marginLogicalWidth();
+
+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = preferredWidth + borderAndPaddingLogicalWidth();
+
+ setPreferredLogicalWidthsDirty(false);
}
+void RenderMathMLRow::layoutRowItems(int stretchHeightAboveBaseline, int stretchDepthBelowBaseline)
+{
+ // We first stretch the vertical operators.
+ // For inline formulas, we can then calculate the logical width.
+ LayoutUnit width = borderAndPaddingStart();
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (child->isOutOfFlowPositioned())
+ continue;
+
+ if (is<RenderMathMLBlock>(child)) {
+ if (auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator())
+ renderOperator->stretchTo(stretchHeightAboveBaseline, stretchDepthBelowBaseline);
+ }
+
+ child->layoutIfNeeded();
+
+ width += child->marginStart() + child->logicalWidth() + child->marginEnd();
+ }
+
+ width += borderEnd() + paddingEnd();
+ // FIXME: RenderMathMLRoot and RenderMathMLEnclose classes should also recalculate the exact logical width instead of using the preferred width.
+ // See https://bugs.webkit.org/show_bug.cgi?id=130326
+ if ((!isRenderMathMLMath() || style().display() == INLINE) && !isRenderMathMLRoot() && !isRenderMathMLMenclose())
+ setLogicalWidth(width);
+
+ LayoutUnit verticalOffset = borderTop() + paddingTop();
+ LayoutUnit maxAscent = 0, maxDescent = 0; // Used baseline alignment.
+ LayoutUnit horizontalOffset = borderAndPaddingStart();
+ bool shouldFlipHorizontal = !style().isLeftToRightDirection();
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (child->isOutOfFlowPositioned()) {
+ child->containingBlock()->insertPositionedObject(*child);
+ continue;
+ }
+ LayoutUnit childHorizontalExtent = child->logicalWidth();
+ LayoutUnit ascent = ascentForChild(*child);
+ LayoutUnit descent = child->verticalMarginExtent() + child->logicalHeight() - ascent;
+ maxAscent = std::max(maxAscent, ascent);
+ maxDescent = std::max(maxDescent, descent);
+ LayoutUnit childVerticalMarginBoxExtent = maxAscent + maxDescent;
+
+ horizontalOffset += child->marginStart();
+
+ setLogicalHeight(std::max(logicalHeight(), verticalOffset + borderBottom() + paddingBottom() + childVerticalMarginBoxExtent + horizontalScrollbarHeight()));
+
+ LayoutPoint childLocation(shouldFlipHorizontal ? logicalWidth() - horizontalOffset - childHorizontalExtent : horizontalOffset, verticalOffset + child->marginTop());
+ child->setLocation(childLocation);
+
+ horizontalOffset += childHorizontalExtent + child->marginEnd();
+ }
+
+ LayoutUnit centerBlockOffset = 0;
+ // FIXME: Remove the FLEX when it is not required by the css.
+ if (style().display() == BLOCK || style().display() == FLEX)
+ centerBlockOffset = std::max<LayoutUnit>(0, (logicalWidth() - (horizontalOffset + borderEnd() + paddingEnd())) / 2);
+
+ if (shouldFlipHorizontal && centerBlockOffset > 0)
+ centerBlockOffset = -centerBlockOffset;
+
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ LayoutUnit ascent = ascentForChild(*child);
+ LayoutUnit startOffset = maxAscent - ascent;
+ child->setLocation(child->location() + LayoutPoint(centerBlockOffset, startOffset));
+ }
}
+void RenderMathMLRow::layoutBlock(bool relayoutChildren, LayoutUnit)
+{
+ ASSERT(needsLayout());
+
+ if (!relayoutChildren && simplifiedLayout())
+ return;
+
+ int stretchHeightAboveBaseline = 0;
+ int stretchDepthBelowBaseline = 0;
+ computeLineVerticalStretch(stretchHeightAboveBaseline, stretchDepthBelowBaseline);
+
+ recomputeLogicalWidth();
+
+ setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
+
+ layoutRowItems(stretchHeightAboveBaseline, stretchDepthBelowBaseline);
+
+ updateLogicalHeight();
+
+ clearNeedsLayout();
+}
+
+void RenderMathMLRow::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)
+{
+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (!paintChild(*child, paintInfo, paintOffset, paintInfoForChild, usePrintRect, PaintAsInlineBlock))
+ return;
+ }
+}
+
+}
+
#endif // ENABLE(MATHML)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (198997 => 198998)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-04-04 07:53:40 UTC (rev 198997)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-04-04 08:25:37 UTC (rev 198998)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Alex Milowski ([email protected]). All rights reserved.
+ * Copyright (C) 2016 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,15 +40,19 @@
RenderMathMLRow(Element&, Ref<RenderStyle>&&);
RenderMathMLRow(Document&, Ref<RenderStyle>&&);
- static RenderPtr<RenderMathMLRow> createAnonymousWithParentRenderer(RenderMathMLRoot&);
void updateOperatorProperties();
-protected:
- void layout() override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) final;
+ Optional<int> firstLineBaseline() const final;
private:
bool isRenderMathMLRow() const final { return true; }
const char* renderName() const override { return isAnonymous() ? "RenderMathMLRow (anonymous)" : "RenderMathMLRow"; }
+
+ void layoutRowItems(int stretchHeightAboveBaseline, int stretchDepthBelowBaseline);
+ void computeLineVerticalStretch(int& stretchHeightAboveBaseline, int& stretchDepthBelowBaseline);
+ void computePreferredLogicalWidths() override;
};
} // namespace WebCore