Changeset 174540 in webkit
- Timestamp:
- Oct 9, 2014, 4:48:09 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r174537 r174540 1 2014-10-09 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 RenderMathMLUnderOver adds spacing to the child operator indefinitely when zooming or resizing the window. 4 https://bugs.webkit.org/show_bug.cgi?id=137330 5 6 Reviewed by Darin Adler, Daniel Bates. 7 8 When the alignment is center, which is the common case for math, changing the size of 9 an object affects the position of this object also. We need to confirm that zooming or 10 resizing the window should not affect the rectangle of the over/under math object operator. 11 12 * mathml/opentype/munderover-window-resize-expected.txt: Added. 13 * mathml/opentype/munderover-window-resize.html: Added. 14 New test with many under and over math objects. After loading the page, the window is resized and 15 the view is zoomed in and out to make sure the layout of these under and over objects were not changed. 16 * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt: 17 This test was wrong because of the spacing issue. The page has two <mover> math objects at the beginning. 18 Each of them has an <mspace> child. The width of the first <mspace> is 1em while the width of the second 19 <mspace> is 2em. The font size is 10pt. So it is expected to have the first one 10 pixels and the second 20 to be 20 pixels. In the test, the width of the first is 22 and the width of the second is 32. 21 I do expect this test to fail on other platforms since they have the same mistake which is now fixed. I am 22 going to submit the mac expected version only and when it fails I am going to collect the result and submit 23 another patch for the other platforms expected files. 24 1 25 2014-10-09 Dean Jackson <dino@apple.com> 2 26 -
trunk/LayoutTests/platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt
r170699 r174540 8 8 RenderMathMLRow {mstyle} at (1,0) size 16x22 9 9 RenderMathMLUnderOver {mover} at (0,0) size 16x22 10 RenderMathMLOperator {mo} at ( -6,1) size 27x2111 RenderMathMLBlock (anonymous, flex) at (2,0) size 22x410 RenderMathMLOperator {mo} at (0,1) size 16x21 11 RenderMathMLBlock (anonymous, flex) at (2,0) size 11x4 12 12 RenderBlock (anonymous) at (0,0) size 2x4 13 13 RenderText at (0,-3) size 2x10 … … 19 19 RenderMathMLRow {mstyle} at (1,0) size 26x22 20 20 RenderMathMLUnderOver {mover} at (0,0) size 26x22 21 RenderMathMLOperator {mo} at ( -6,1) size 38x2122 RenderMathMLBlock (anonymous, flex) at (2,0) size 32x421 RenderMathMLOperator {mo} at (0,1) size 26x21 22 RenderMathMLBlock (anonymous, flex) at (2,0) size 22x4 23 23 RenderBlock (anonymous) at (0,0) size 2x4 24 24 RenderText at (0,-3) size 2x10 … … 30 30 RenderMathMLRow {mstyle} at (1,0) size 156x42 31 31 RenderMathMLUnderOver {mover} at (0,0) size 156x42 32 RenderMathMLOperator {mo} at ( -3,1) size 162x4133 RenderMathMLBlock (anonymous, flex) at (2,0) size 15 7x432 RenderMathMLOperator {mo} at (0,1) size 156x41 33 RenderMathMLBlock (anonymous, flex) at (2,0) size 151x4 34 34 RenderBlock (anonymous) at (0,0) size 2x4 35 35 RenderText at (0,-3) size 2x10 -
trunk/Source/WebCore/ChangeLog
r174536 r174540 1 2014-10-09 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 RenderMathMLUnderOver adds spacing to the child operator indefinitely when resizing the window. 4 https://bugs.webkit.org/show_bug.cgi?id=137330 5 6 Reviewed by Darin Adler. 7 8 The layout for the <mundercover> math object happens in two separate passes. The first pass runs 9 the layout for the two children and then calculates the maximum child width. It then sets the 10 stretch size for the math operator child. And finally it runs the second layout pass by calling 11 the base class layout() function. The base class function then runs the layout for the children 12 rendering blocks. In the operator child function computePreferredLogicalWidths(), the stretch 13 size is used to adjust the width (or the height) of the operator. Then it adds the leading and 14 trailing spaces and the total will be the operator child width. 15 16 When resizing or zooming the window, the render objects are just invalidated but marked as 'needs- 17 Layout'. The problem is happening because the stretch size of the math operator is not reset 18 before running the layout. The old logical width (or height) of the the math operator child which 19 is equal to the stretch size plus the leading and trailing spaces for is compared with the glyph 20 size if the old logical width ( or height) is larger, it is set to be the stretch size. When it 21 is used again because of invalidation, new leading and trailing spaces are included in the new 22 logical width. So with every zooming-in or out or window resizing, new leading and trailing 23 spaces are added to the logical width of the math operator child or the math <munderober> object. 24 25 Ensure the stretch size of the math operator render object is reset before running its layout. 26 Running the layout means either the page is just loaded or it's invalidated which means, no 27 layout stall data should be used. 28 29 Test: mathml/opentype/munderover-window-resize.html 30 31 * rendering/mathml/RenderMathMLOperator.cpp: 32 (WebCore::RenderMathMLOperator::resetStretchSize): 33 * rendering/mathml/RenderMathMLOperator.h: 34 resetStretchSize() sets the stretch size to its original value when the class is created. 35 * rendering/mathml/RenderMathMLUnderOver.cpp: 36 (WebCore::RenderMathMLUnderOver::layout): 37 Make sure the operator stretch size is reset before calling its layout. Also make sure the new 38 maximum stretch size to the operator objects that were invalid and needsLayout. 39 1 40 2014-10-09 Dean Jackson <dino@apple.com> 2 41 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r170774 r174540 1309 1309 } 1310 1310 1311 void RenderMathMLOperator::resetStretchSize() 1312 { 1313 if (m_isVertical) { 1314 m_stretchHeightAboveBaseline = 0; 1315 m_stretchDepthBelowBaseline = 0; 1316 } else 1317 m_stretchWidth = 0; 1318 } 1319 1311 1320 FloatRect RenderMathMLOperator::boundsForGlyph(const GlyphData& data) const 1312 1321 { -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r174375 r174540 67 67 void stretchTo(LayoutUnit width); 68 68 LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; } 69 void resetStretchSize(); 69 70 70 71 bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
r174375 r174540 75 75 { 76 76 LayoutUnit stretchWidth = 0; 77 Vector<RenderMathMLOperator*, 2> renderOperators; 78 77 79 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 78 if (child->needsLayout()) 80 if (child->needsLayout()) { 81 if (is<RenderMathMLBlock>(child)) { 82 if (auto renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator()) { 83 renderOperator->resetStretchSize(); 84 renderOperators.append(renderOperator); 85 } 86 } 87 79 88 toRenderElement(child)->layout(); 89 } 90 80 91 // Skipping the embellished op does not work for nested structures like 81 92 // <munder><mover><mo>_</mo>...</mover> <mo>_</mo></munder>. … … 85 96 86 97 // Set the sizes of (possibly embellished) stretchy operator children. 87 for (auto& child : childrenOfType<RenderMathMLBlock>(*this)) { 88 if (auto renderOperator = child.unembellishedOperator()) 89 renderOperator->stretchTo(stretchWidth); 90 } 98 for (auto& renderOperator : renderOperators) 99 renderOperator->stretchTo(stretchWidth); 91 100 92 101 RenderMathMLBlock::layout();
Note:
See TracChangeset
for help on using the changeset viewer.