WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-156542-20160414133738.patch (text/plain), 13.81 KB, created by
Frédéric Wang Nélar
on 2016-04-14 04:37:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang Nélar
Created:
2016-04-14 04:37:27 PDT
Size:
13.81 KB
patch
obsolete
>Subversion Revision: 199536 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 61628173cdaefc1fba60ddd7293c03aa9589b30a..24a84e1abd7b1c0a6a22eeee84d6140b17bcbe3d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,35 @@ >+2016-04-14 Frederic Wang <fwang@igalia.com> >+ >+ Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operators that have the correct direction >+ https://bugs.webkit.org/show_bug.cgi?id=156542 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ In the RenderMathMLUnderOver refactoring (r199293), we avoided doing a >+ horizontal stretchTo call for non-stretchy operators. Here we do the >+ same for RenderMathMLRow and avoid doing a vertical stretchTo call for >+ horizontal or non-stretchy operators. We also add appropriate ASSERT in >+ the RenderMathMLOperator::stretchTo functions. To avoid failing tests >+ with DOM/style update, we make our updates a bit stricter. Hopefully, >+ we could manage such things better in the future (bug 156536). >+ >+ Tests: mathml/presentation/row-nonstretchy-or-horizontal.html >+ mathml/presentation/underover-nonstretchy-or-vertical.html >+ >+ * mathml/MathMLTextElement.cpp: >+ (WebCore::MathMLTextElement::parseAttribute): Replace setOperatorFlagAndScheduleLayoutIfNeeded with a stronger rendering update. >+ Also ensure that this is done when the lspace/rspace attributes change. >+ This avoids breaking mathml/presentation/mo-lspace-rspace-dynamic.html >+ * rendering/mathml/RenderMathMLOperator.cpp: >+ (WebCore::RenderMathMLOperator::stretchTo): Add ASSERT to ensure that it is only called with stretchy operators that have the correct direction. >+ (WebCore::RenderMathMLOperator::styleDidChange): Do a stronger rendering update when the style changes. >+ This avoids breaking mathml/presentation/style-changed.html >+ (WebCore::RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded): Deleted. >+ * rendering/mathml/RenderMathMLOperator.h: Make updateFromElement public so that it can be called from MathMLTextElement::parseAttribute >+ Remove setOperatorFlagAndScheduleLayoutIfNeeded and declare styleDidChange. >+ * rendering/mathml/RenderMathMLRow.cpp: >+ (WebCore::RenderMathMLRow::layoutRowItems): Only call stretchTo for vertical stretchy operators. >+ > 2016-04-14 Antoine Quint <graouts@apple.com> > > WebGL based canvases composite incorrectly after changing size >diff --git a/Source/WebCore/mathml/MathMLTextElement.cpp b/Source/WebCore/mathml/MathMLTextElement.cpp >index 0a587c8fb26de52793f212dcde098c417f478cc6..37ff69fb3c4846a8fe9f4495af97d0091dc85cc5 100644 >--- a/Source/WebCore/mathml/MathMLTextElement.cpp >+++ b/Source/WebCore/mathml/MathMLTextElement.cpp >@@ -66,9 +66,9 @@ void MathMLTextElement::childrenChanged(const ChildChange& change) > > void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value) > { >- if (name == stretchyAttr) { >+ if (name == stretchyAttr || name == lspaceAttr || name == rspaceAttr) { > if (is<RenderMathMLOperator>(renderer())) >- downcast<RenderMathMLOperator>(*renderer()).setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Stretchy, value); >+ downcast<RenderMathMLOperator>(*renderer()).updateFromElement(); > return; > } > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >index 938a8e47a5d0f0f645f246a6335e8064b9681959..59938174e81029fc379864061cc4a27be673167c 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >@@ -94,16 +94,6 @@ RenderMathMLOperator::RenderMathMLOperator(Document& document, Ref<RenderStyle>& > updateTokenContent(operatorString); > } > >-void RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag flag, const AtomicString& attributeValue) >-{ >- unsigned short oldOperatorFlags = m_operatorFlags; >- >- setOperatorFlagFromAttributeValue(flag, attributeValue); >- >- if (oldOperatorFlags != m_operatorFlags) >- setNeedsLayoutAndPrefWidthsRecalc(); >-} >- > void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name) > { > setOperatorFlagFromAttributeValue(flag, element().fastGetAttribute(name)); >@@ -215,6 +205,8 @@ bool RenderMathMLOperator::isChildAllowed(const RenderObject&, const RenderStyle > > void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline) > { >+ ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && m_isVertical); >+ > if (!m_isVertical || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline)) > return; > >@@ -247,6 +239,8 @@ void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit > > void RenderMathMLOperator::stretchTo(LayoutUnit width) > { >+ ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && !m_isVertical); >+ > if (m_isVertical || m_stretchWidth == width) > return; > >@@ -373,6 +367,12 @@ bool RenderMathMLOperator::shouldAllowStretching() const > return m_textContent && (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle()); > } > >+void RenderMathMLOperator::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) >+{ >+ RenderMathMLBlock::styleDidChange(diff, oldStyle); >+ updateOperatorProperties(); >+} >+ > bool RenderMathMLOperator::getGlyphAssemblyFallBack(Vector<OpenTypeMathData::AssemblyPart> assemblyParts, StretchyData& stretchyData) const > { > GlyphData top; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >index e75272bd5227c09f4ead47721c275e148f880119..8014a2e205b0def6610c0e5ab5b0d27293081f86 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h >@@ -52,6 +52,7 @@ public: > bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp); } > bool isVertical() const { return m_isVertical; } > >+ void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; > void updateStyle() final; > > void paint(PaintInfo&, const LayoutPoint&) override; >@@ -59,7 +60,7 @@ public: > void updateTokenContent(const String& operatorString); > void updateTokenContent() final; > void updateOperatorProperties(); >- void setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue); >+ void updateFromElement() final; > LayoutUnit trailingSpaceError(); > > protected: >@@ -137,7 +138,6 @@ private: > Optional<int> firstLineBaseline() const override; > RenderMathMLOperator* unembellishedOperator() override { return this; } > void rebuildTokenContent(const String& operatorString); >- void updateFromElement() override; > > bool shouldAllowStretching() const; > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >index 5876727ba1d9609b6764acf5243e01c9095d3a96..47e43d56c4092bf0a76acddf7c2a4aa65799f23c 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp >@@ -120,7 +120,8 @@ void RenderMathMLRow::layoutRowItems(int stretchHeightAboveBaseline, int stretch > continue; > > if (is<RenderMathMLBlock>(child)) { >- if (auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator()) >+ auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator(); >+ if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && renderOperator->isVertical()) > renderOperator->stretchTo(stretchHeightAboveBaseline, stretchDepthBelowBaseline); > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index cbd9ca93e122aa8bae2980cca3511d50939a8752..e9f3c19755db7ba3b8604dd551138cbfb2b4883c 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,25 @@ >+2016-04-14 Frederic Wang <fwang@igalia.com> >+ >+ Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operators that have the correct direction >+ https://bugs.webkit.org/show_bug.cgi?id=156542 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test to ensure that nonstretchy or horizontal operators in a >+ RenderMathMLRow do not stretch. This is similar to the existing test >+ for munderover and we improve a bit that one too. >+ Besides the verification of the rendering, these two tests will also >+ check that the RenderMathMLOperator::stretchTo calls are not done in a >+ way that violates the ASSERT at the top of stretchTo. >+ >+ * mathml/presentation/row-nonstretchy-or-horizontal.html: Added. >+ * mathml/presentation/row-nonstretchy-or-horizontal-expected.html: Added. >+ * mathml/presentation/underover-nonstretchy-horizontal.html: Removed. >+ * mathml/presentation/underover-nonstretchy-horizontal-expected.html: Removed. >+ * mathml/presentation/underover-nonstretchy-or-vertical.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html. >+ We now also test the case of vertical operators in munderover. >+ * mathml/presentation/underover-nonstretchy-or-vertical-expected.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html. >+ > 2016-04-14 Antoine Quint <graouts@apple.com> > > WebGL based canvases composite incorrectly after changing size >diff --git a/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal-expected.html b/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..03e1317c3247e36901006c525dce1351cdbe14d2 >--- /dev/null >+++ b/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal-expected.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<p>Horizontal operators or non-stretchy operators inside an mrow element should not stretch.</p> >+<math> >+ <mrow> >+ <mspace height="100px" width="10px" mathbackground="red"/> >+ <mtext>_</mtext> >+ <mtext>|</mtext> >+ </mrow> >+</math> >diff --git a/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal.html b/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7b9773bcf1efc6f1ef2c33793d8e9d571867cdfa >--- /dev/null >+++ b/LayoutTests/mathml/presentation/row-nonstretchy-or-horizontal.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<p>Horizontal operators or non-stretchy operators inside an mrow element should not stretch.</p> >+<math> >+ <mrow> >+ <mspace height="100px" width="10px" mathbackground="red"/> >+ <mo lspace="0px" rspace="0px">_</mo> <!-- stretchy horizontal operator --> >+ <mo lspace="0px" rspace="0px" stretchy="false">|</mo> <!-- non-stretchy vertical operator --> >+ </mrow> >+</math> >diff --git a/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html b/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html >deleted file mode 100644 >index 073c7ecd2f5f7a4fc71276b36e8553b8e83c4483..0000000000000000000000000000000000000000 >--- a/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html >+++ /dev/null >@@ -1,8 +0,0 @@ >-<!DOCTYPE html> >-<math> >- <munderover> >- <mspace width="100px" height="10px" mathbackground="red"/> >- <mtext>_</mtext> >- <mtext>_</mtext> >- </munderover> >-</math> >diff --git a/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html b/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html >deleted file mode 100644 >index c757f195dd7eb0590aec9d3cad1cd035276dff6b..0000000000000000000000000000000000000000 >--- a/LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html >+++ /dev/null >@@ -1,9 +0,0 @@ >-<!DOCTYPE html> >-<!-- Horizontal operators set to non-stretchy should not stretch. --> >-<math> >- <munderover> >- <mspace width="100px" height="10px" mathbackground="red"/> >- <mo stretchy="false" lspace="0px" rspace="0px">_</mo> >- <mo stretchy="false" lspace="0px" rspace="0px">_</mo> >- </munderover> >-</math> >diff --git a/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical-expected.html b/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bb3f0c155e9fdb2ae9909779c0c79716657ffd72 >--- /dev/null >+++ b/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical-expected.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<p>Vertical or non-stretchy operators inside an munderover element should not stretch.</p> >+<math> >+ <munderover> >+ <mspace width="100px" height="10px" mathbackground="red"/> >+ <mtext>|</mtext> >+ <mtext>_</mtext> >+ </munderover> >+</math> >diff --git a/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical.html b/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d301f6dfad68f4f92b7f18807db51f7e7bca63f5 >--- /dev/null >+++ b/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<p>Vertical or non-stretchy operators inside an munderover element should not stretch.</p> >+<math> >+ <munderover> >+ <mspace width="100px" height="10px" mathbackground="red"/> >+ <mo lspace="0px" rspace="0px">|</mo> <!-- stretchy vertical operator --> >+ <mo lspace="0px" rspace="0px" stretchy="false" >_</mo> <!-- non-stretchy horizontal operator --> >+ </munderover> >+</math>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 156542
:
276329
|
276334
|
276376
| 276387