Changeset 205099 in webkit
- Timestamp:
- Aug 28, 2016 1:41:13 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205098 r205099 1 2016-08-28 Frederic Wang <fwang@igalia.com> 2 3 RenderMathMLRow::firstLineBaseline does not need to be overridden in RenderMathMLMenclose 4 https://bugs.webkit.org/show_bug.cgi?id=161127 5 6 Reviewed by Darin Adler. 7 8 RenderMathMLRow::firstLineBaseline already provides the correct calculation of ascent for 9 non-empty menclose elements. Empty menclose elements are not used in practice so the 10 calculated value is irrelevant. Aligning on mrow (i.e. leaving firstLineBaseline to 0) 11 is fine. This change allows to get rid of the m_ascent member and helps to keep good baseline 12 alignment when the zoom level changes (bug 161126). 13 14 No new tests, already covered by existing tests. 15 16 * rendering/mathml/RenderMathMLMenclose.cpp: 17 (WebCore::RenderMathMLMenclose::RenderMathMLMenclose): Remove initialization of m_ascent. 18 (WebCore::RenderMathMLMenclose::layoutBlock): No need to calculate m_ascent. The height and 19 content location can be determined without introducing local variables ascent or descent. 20 (WebCore::RenderMathMLMenclose::firstLineBaseline): Deleted. We just use the implementation 21 from RenderMathMLRow. 22 * rendering/mathml/RenderMathMLMenclose.h: Delete m_ascent and do not override 23 firstLineBaseline. 24 1 25 2016-08-28 Frederic Wang <fwang@igalia.com> 2 26 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp
r204885 r205099 45 45 RenderMathMLMenclose::RenderMathMLMenclose(MathMLMencloseElement& element, RenderStyle&& style) 46 46 : RenderMathMLRow(element, WTFMove(style)) 47 , m_ascent(0)48 47 { 49 48 } … … 176 175 getSpaceAroundContent(contentWidth, contentAscent + contentDescent, leftSpace, rightSpace, topSpace, bottomSpace); 177 176 setLogicalWidth(leftSpace + contentWidth + rightSpace); 178 m_ascent = topSpace + contentAscent;179 LayoutUnit descent = contentDescent + bottomSpace; 180 LayoutPoint contentLocation(leftSpace, m_ascent - contentAscent);177 setLogicalHeight(topSpace + contentAscent + contentDescent + bottomSpace); 178 179 LayoutPoint contentLocation(leftSpace, topSpace); 181 180 for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) 182 181 child->setLocation(child->location() + contentLocation); 183 182 184 setLogicalHeight(m_ascent + descent);185 186 183 m_contentRect = LayoutRect(leftSpace, topSpace, contentWidth, contentAscent + contentDescent); 187 184 188 185 clearNeedsLayout(); 189 }190 191 Optional<int> RenderMathMLMenclose::firstLineBaseline() const192 {193 return Optional<int>(static_cast<int>(lroundf(m_ascent)));194 186 } 195 187 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h
r204885 r205099 42 42 void computePreferredLogicalWidths() final; 43 43 void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final; 44 Optional<int> firstLineBaseline() const final;45 44 void paint(PaintInfo&, const LayoutPoint&) final; 46 45 … … 50 49 void getSpaceAroundContent(LayoutUnit contentWidth, LayoutUnit contentHeight, LayoutUnit& leftSpace, LayoutUnit& rightSpace, LayoutUnit& topSpace, LayoutUnit& bottomSpace) const; 51 50 52 LayoutUnit m_ascent;53 51 LayoutRect m_contentRect; 54 52 };
Note: See TracChangeset
for help on using the changeset viewer.