RESOLVED FIXED 156921
Move selection and drawing of stretchy operators into a separate MathOperator class
https://bugs.webkit.org/show_bug.cgi?id=156921
Summary Move selection and drawing of stretchy operators into a separate MathOperator...
Frédéric Wang (:fredw)
Reported 2016-04-22 12:50:07 PDT
Yet another step towards bug 152244.
Attachments
Patch (73.98 KB, patch)
2016-04-22 13:02 PDT, Frédéric Wang (:fredw)
no flags
Patch for EWS testing (81.81 KB, patch)
2016-04-22 13:03 PDT, Frédéric Wang (:fredw)
no flags
Patch for EWS testing (81.71 KB, patch)
2016-04-23 01:32 PDT, Frédéric Wang (:fredw)
no flags
Patch (74.95 KB, patch)
2016-04-25 01:03 PDT, Frédéric Wang (:fredw)
no flags
Patch (74.90 KB, patch)
2016-04-25 09:14 PDT, Frédéric Wang (:fredw)
no flags
Patch (74.86 KB, patch)
2016-04-26 05:07 PDT, Frédéric Wang (:fredw)
no flags
Patch (74.84 KB, patch)
2016-04-27 06:24 PDT, Frédéric Wang (:fredw)
no flags
Patch (75.41 KB, patch)
2016-05-09 00:50 PDT, Frédéric Wang (:fredw)
no flags
Patch (75.30 KB, patch)
2016-06-08 00:05 PDT, Frédéric Wang (:fredw)
mrobinson: review+
Frédéric Wang (:fredw)
Comment 1 2016-04-22 13:02:38 PDT
Frédéric Wang (:fredw)
Comment 2 2016-04-22 13:03:11 PDT
Created attachment 277088 [details] Patch for EWS testing
Frédéric Wang (:fredw)
Comment 3 2016-04-23 01:32:14 PDT
Created attachment 277144 [details] Patch for EWS testing I'm removing the ASSERT for large operator until we know the exact operator type (bug 156950).
Frédéric Wang (:fredw)
Comment 4 2016-04-25 01:03:44 PDT
Created attachment 277231 [details] Patch Update patch to fix conflict after bug 156846 and bug 156906.
Frédéric Wang (:fredw)
Comment 5 2016-04-25 09:14:53 PDT
Frédéric Wang (:fredw)
Comment 6 2016-04-26 05:07:51 PDT
Frédéric Wang (:fredw)
Comment 7 2016-04-27 06:24:01 PDT
Created attachment 277473 [details] Patch Minor change: Remove useless MathOperator:: prefix in setGlyphAssembly during the code move.
Frédéric Wang (:fredw)
Comment 8 2016-05-09 00:50:56 PDT
Martin Robinson
Comment 9 2016-06-06 09:06:22 PDT
Comment on attachment 278390 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=278390&action=review Most of this is just code movement, so it looks good to me. I have a couple quick questions and nits though: > Source/WebCore/rendering/mathml/MathOperator.cpp:85 > + : m_baseCharacter(0) > + , m_isVertical(false) > + , m_stretchType(StretchType::Unstretched) > + , m_width(0) > + , m_ascent(0) > + , m_descent(0) > + , m_italicCorrection(0) I think we are preferring in-class declaration initializers now. Perhaps that will allow you to remove this constructor. http://www.stroustrup.com/C++11FAQ.html#member-init > Source/WebCore/rendering/mathml/MathOperator.cpp:103 > + ASSERT(sizeVariant.isValid() && sizeVariant.font->mathData()); Make this ASSERT two separate ASSERTs so it is easier to tell from a stack trace which one failed. > Source/WebCore/rendering/mathml/MathOperator.cpp:128 > + baseGlyph.font->mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts); Move the declaration of sizeVariants and assemblyParts right before this line. > Source/WebCore/rendering/mathml/MathOperator.cpp:137 > + GlyphData glyphData(sizeVariant, baseGlyph.font); > + setSizeVariant(glyphData); > + m_italicCorrection = glyphData.font->mathData()->getItalicCorrection(*glyphData.font, glyphData.glyph); > + if (heightForGlyph(glyphData) >= displayOperatorMinHeight) > + break; > + } Why not wait to call setSizeVariant and set m_italicCorrection until heightForGlyph(glyphData) >= displayOperatorMinHeight is true? > Source/WebCore/rendering/mathml/MathOperator.cpp:140 > +bool MathOperator::calculateGlyphAssemblyFallBack(const RenderStyle& style, const Vector<OpenTypeMathData::AssemblyPart>& assemblyParts, GlyphAssemblyData& assemblyData) const Nit: FallBack -> Fallback
Frédéric Wang (:fredw)
Comment 10 2016-06-06 09:11:30 PDT
(In reply to comment #9) > > Source/WebCore/rendering/mathml/MathOperator.cpp:85 > > + : m_baseCharacter(0) > > + , m_isVertical(false) > > + , m_stretchType(StretchType::Unstretched) > > + , m_width(0) > > + , m_ascent(0) > > + , m_descent(0) > > + , m_italicCorrection(0) > > I think we are preferring in-class declaration initializers now. Perhaps > that will allow you to remove this constructor. OK, I think I already did that in my branch after feedback in other patches :-) > > Source/WebCore/rendering/mathml/MathOperator.cpp:137 > > + GlyphData glyphData(sizeVariant, baseGlyph.font); > > + setSizeVariant(glyphData); > > + m_italicCorrection = glyphData.font->mathData()->getItalicCorrection(*glyphData.font, glyphData.glyph); > > + if (heightForGlyph(glyphData) >= displayOperatorMinHeight) > > + break; > > + } > > Why not wait to call setSizeVariant and set m_italicCorrection until > heightForGlyph(glyphData) >= displayOperatorMinHeight is true? So the idea is that if we were not able to find a large enough stretchy operator, we use the latest (largest) one in the list as a fallback.
Martin Robinson
Comment 11 2016-06-06 10:01:42 PDT
(In reply to comment #10) > > > Source/WebCore/rendering/mathml/MathOperator.cpp:137 > > > + GlyphData glyphData(sizeVariant, baseGlyph.font); > > > + setSizeVariant(glyphData); > > > + m_italicCorrection = glyphData.font->mathData()->getItalicCorrection(*glyphData.font, glyphData.glyph); > > > + if (heightForGlyph(glyphData) >= displayOperatorMinHeight) > > > + break; > > > + } > > > > Why not wait to call setSizeVariant and set m_italicCorrection until > > heightForGlyph(glyphData) >= displayOperatorMinHeight is true? > > So the idea is that if we were not able to find a large enough stretchy > operator, we use the latest (largest) one in the list as a fallback. Ah, I understand. Thanks!
Frédéric Wang (:fredw)
Comment 12 2016-06-08 00:05:21 PDT
Frédéric Wang (:fredw)
Comment 13 2016-06-08 23:16:21 PDT
Note You need to log in before you can comment on or make changes to this bug.