Changeset 199544 in webkit
- Timestamp:
- Apr 14, 2016 11:04:44 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r199539 r199544 1 2016-04-14 Frederic Wang <fwang@igalia.com> 2 3 Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operators that have the correct direction 4 https://bugs.webkit.org/show_bug.cgi?id=156542 5 6 Reviewed by Darin Adler. 7 8 Add a test to ensure that nonstretchy or horizontal operators in a 9 RenderMathMLRow do not stretch. This is similar to the existing test 10 for munderover and we improve a bit that one too. 11 Besides the verification of the rendering, these two tests will also 12 check that the RenderMathMLOperator::stretchTo calls are not done in a 13 way that violates the ASSERT at the top of stretchTo. 14 15 * mathml/presentation/row-nonstretchy-or-horizontal.html: Added. 16 * mathml/presentation/row-nonstretchy-or-horizontal-expected.html: Added. 17 * mathml/presentation/underover-nonstretchy-horizontal.html: Removed. 18 * mathml/presentation/underover-nonstretchy-horizontal-expected.html: Removed. 19 * mathml/presentation/underover-nonstretchy-or-vertical.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal.html. 20 We now also test the case of vertical operators in munderover. 21 * mathml/presentation/underover-nonstretchy-or-vertical-expected.html: Renamed from LayoutTests/mathml/presentation/underover-nonstretchy-horizontal-expected.html. 22 1 23 2016-04-14 Darin Adler <darin@apple.com> 2 24 -
trunk/LayoutTests/mathml/presentation/underover-nonstretchy-or-vertical-expected.html
r199543 r199544 1 1 <!DOCTYPE html> 2 <p>Vertical or non-stretchy operators inside an munderover element should not stretch.</p> 2 3 <math> 3 4 <munderover> 4 5 <mspace width="100px" height="10px" mathbackground="red"/> 5 <mtext> _</mtext>6 <mtext>|</mtext> 6 7 <mtext>_</mtext> 7 8 </munderover> -
trunk/Source/WebCore/ChangeLog
r199540 r199544 1 2016-04-14 Frederic Wang <fwang@igalia.com> 2 3 Ensure that RenderMathMLOperator::stretchTo functions are called with stretchy operators that have the correct direction 4 https://bugs.webkit.org/show_bug.cgi?id=156542 5 6 Reviewed by Darin Adler. 7 8 In the RenderMathMLUnderOver refactoring (r199293), we avoided doing a 9 horizontal stretchTo call for non-stretchy operators. Here we do the 10 same for RenderMathMLRow and avoid doing a vertical stretchTo call for 11 horizontal or non-stretchy operators. We also add appropriate ASSERT in 12 the RenderMathMLOperator::stretchTo functions. To avoid failing tests 13 with DOM/style update, we make our updates a bit stricter. Hopefully, 14 we could manage such things better in the future (bug 156536). 15 16 Tests: mathml/presentation/row-nonstretchy-or-horizontal.html 17 mathml/presentation/underover-nonstretchy-or-vertical.html 18 19 * mathml/MathMLTextElement.cpp: 20 (WebCore::MathMLTextElement::parseAttribute): Replace setOperatorFlagAndScheduleLayoutIfNeeded with a stronger rendering update. 21 Also ensure that this is done when the lspace/rspace attributes change. 22 This avoids breaking mathml/presentation/mo-lspace-rspace-dynamic.html 23 * rendering/mathml/RenderMathMLOperator.cpp: 24 (WebCore::RenderMathMLOperator::stretchTo): Add ASSERT to ensure that it is only called with stretchy operators that have the correct direction. 25 (WebCore::RenderMathMLOperator::styleDidChange): Do a stronger rendering update when the style changes. 26 This avoids breaking mathml/presentation/style-changed.html 27 (WebCore::RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded): Deleted. 28 * rendering/mathml/RenderMathMLOperator.h: Make updateFromElement public so that it can be called from MathMLTextElement::parseAttribute 29 Remove setOperatorFlagAndScheduleLayoutIfNeeded and declare styleDidChange. 30 * rendering/mathml/RenderMathMLRow.cpp: 31 (WebCore::RenderMathMLRow::layoutRowItems): Only call stretchTo for vertical stretchy operators. 32 1 33 2016-04-14 Anders Carlsson <andersca@apple.com> 2 34 -
trunk/Source/WebCore/mathml/MathMLTextElement.cpp
r194496 r199544 67 67 void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 68 68 { 69 if (name == stretchyAttr ) {69 if (name == stretchyAttr || name == lspaceAttr || name == rspaceAttr) { 70 70 if (is<RenderMathMLOperator>(renderer())) 71 downcast<RenderMathMLOperator>(*renderer()). setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Stretchy, value);71 downcast<RenderMathMLOperator>(*renderer()).updateFromElement(); 72 72 return; 73 73 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r194496 r199544 95 95 } 96 96 97 void RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag flag, const AtomicString& attributeValue)98 {99 unsigned short oldOperatorFlags = m_operatorFlags;100 101 setOperatorFlagFromAttributeValue(flag, attributeValue);102 103 if (oldOperatorFlags != m_operatorFlags)104 setNeedsLayoutAndPrefWidthsRecalc();105 }106 107 97 void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name) 108 98 { … … 216 206 void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline) 217 207 { 208 ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy)); 209 ASSERT(m_isVertical); 210 218 211 if (!m_isVertical || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline)) 219 212 return; … … 248 241 void RenderMathMLOperator::stretchTo(LayoutUnit width) 249 242 { 243 ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy)); 244 ASSERT(!m_isVertical); 245 250 246 if (m_isVertical || m_stretchWidth == width) 251 247 return; … … 372 368 { 373 369 return m_textContent && (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle()); 370 } 371 372 void RenderMathMLOperator::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 373 { 374 RenderMathMLBlock::styleDidChange(diff, oldStyle); 375 updateOperatorProperties(); 374 376 } 375 377 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r197566 r199544 53 53 bool isVertical() const { return m_isVertical; } 54 54 55 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; 55 56 void updateStyle() final; 56 57 … … 60 61 void updateTokenContent() final; 61 62 void updateOperatorProperties(); 62 void setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue);63 void updateFromElement() final; 63 64 LayoutUnit trailingSpaceError(); 64 65 … … 138 139 RenderMathMLOperator* unembellishedOperator() override { return this; } 139 140 void rebuildTokenContent(const String& operatorString); 140 void updateFromElement() override;141 141 142 142 bool shouldAllowStretching() const; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
r198998 r199544 121 121 122 122 if (is<RenderMathMLBlock>(child)) { 123 if (auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator()) 123 auto renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator(); 124 if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && renderOperator->isVertical()) 124 125 renderOperator->stretchTo(stretchHeightAboveBaseline, stretchDepthBelowBaseline); 125 126 }
Note: See TracChangeset
for help on using the changeset viewer.