- Revision
- 204075
- Author
- fred.w...@free.fr
- Date
- 2016-08-03 00:00:38 -0700 (Wed, 03 Aug 2016)
Log Message
Move determination of operator direction into DOM class and reduce relayout
https://bugs.webkit.org/show_bug.cgi?id=160339
Patch by Frederic Wang <fw...@igalia.com> on 2016-08-02
Reviewed by Darin Adler.
We move the determination of operator direction into MathMLOperatorElement. We also simplify
a bit RenderMathMLFencedOperator so that the update of operator properties are done
immediately in updateOperatorContent and the resolution of to LayoutUnit is implemented
in leadingSpace, trailingSpace, minSize and maxSize. After that, setOperatorProperties is no
longer necessary and we can remove many calls that used to update operator properties and
force relayout.
No new tests, already covered by existing tests.
* mathml/MathMLInlineContainerElement.cpp:
(WebCore::MathMLInlineContainerElement::childrenChanged): No need to call updateOperatorProperties.
* mathml/MathMLOperatorElement.cpp: Change names from "text" to "char".
(WebCore::MathMLOperatorElement::parseOperatorChar): Parse character and isVertical in this function.
(WebCore::MathMLOperatorElement::operatorChar):
(WebCore::MathMLOperatorElement::childrenChanged):
(WebCore::MathMLOperatorElement::computeDictionaryProperty): Call operatorChar().character.
(WebCore::MathMLOperatorElement::parseOperatorText): Deleted.
(WebCore::MathMLOperatorElement::operatorText): Deleted.
* mathml/MathMLOperatorElement.h: Use a new structure to hold both the character and direction
and change names from "text" to "char".
* rendering/mathml/RenderMathMLFencedOperator.cpp:
(WebCore::RenderMathMLFencedOperator::updateOperatorContent): Update both the character and
direction using MathMLOperatorElement::parseOperatorChar. Then set the boolean properties
and leading/trailing space using the operator dictionary. minsize and maxsize are constant
so we do not need to set them any more.
(WebCore::RenderMathMLFencedOperator::leadingSpace): Resolve the spacing read from the
dictionary to LayoutUnit. Note that it can never be negative.
(WebCore::RenderMathMLFencedOperator::trailingSpace): Ditto.
(WebCore::RenderMathMLFencedOperator::RenderMathMLFencedOperator): Deleted.
(WebCore::RenderMathMLFencedOperator::setOperatorProperties): Deleted.
* rendering/mathml/RenderMathMLFencedOperator.h: We use the new OperatorChar structure for
accessors and members. We make minSize and maxSize just return the default values and delete
the corresponding members. Finally, leading and trailing space are now stored as unsigned
short in MathUnit.
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::textContent): Use the new OperatorChar structure.
(WebCore::RenderMathMLOperator::isVertical): Helper function forwarding to MathMLOperatorElement.
(WebCore::RenderMathMLOperator::stretchTo): Use isVertical() and remove setOperatorProperties().
(WebCore::RenderMathMLOperator::resetStretchSize): Ditto.
(WebCore::RenderMathMLOperator::updateMathOperator): Rename rebuildTokenContent as this is
now really only used to update MathOperator and hence replace the condition on
useMathOperator() with an ASSERT.
(WebCore::RenderMathMLOperator::updateTokenContent): Call updateMathOperator instead of
rebuildTokenContent.
(WebCore::RenderMathMLOperator::verticalStretchedOperatorShift): We use isVertical().
(WebCore::RenderMathMLOperator::paint): Ditto.
(WebCore::RenderMathMLOperator::setOperatorProperties): Deleted. This is no longer needed.
(WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Deleted.
(WebCore::RenderMathMLOperator::rebuildTokenContent): Deleted. Renamed updateMathOperator.
(WebCore::RenderMathMLOperator::styleDidChange): No need to call updateOperatorProperties.
(WebCore::RenderMathMLOperator::updateOperatorProperties): Ditto..
* rendering/mathml/RenderMathMLOperator.h: Update some declaration and remove m_isVertical.
(WebCore::RenderMathMLOperator::isVertical): Deleted.
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::updateOperatorProperties): Deleted. This is no longer needed.
* rendering/mathml/RenderMathMLRow.h: Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (204074 => 204075)
--- trunk/Source/WebCore/ChangeLog 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/ChangeLog 2016-08-03 07:00:38 UTC (rev 204075)
@@ -1,3 +1,67 @@
+2016-08-02 Frederic Wang <fw...@igalia.com>
+
+ Move determination of operator direction into DOM class and reduce relayout
+ https://bugs.webkit.org/show_bug.cgi?id=160339
+
+ Reviewed by Darin Adler.
+
+ We move the determination of operator direction into MathMLOperatorElement. We also simplify
+ a bit RenderMathMLFencedOperator so that the update of operator properties are done
+ immediately in updateOperatorContent and the resolution of to LayoutUnit is implemented
+ in leadingSpace, trailingSpace, minSize and maxSize. After that, setOperatorProperties is no
+ longer necessary and we can remove many calls that used to update operator properties and
+ force relayout.
+
+ No new tests, already covered by existing tests.
+
+ * mathml/MathMLInlineContainerElement.cpp:
+ (WebCore::MathMLInlineContainerElement::childrenChanged): No need to call updateOperatorProperties.
+ * mathml/MathMLOperatorElement.cpp: Change names from "text" to "char".
+ (WebCore::MathMLOperatorElement::parseOperatorChar): Parse character and isVertical in this function.
+ (WebCore::MathMLOperatorElement::operatorChar):
+ (WebCore::MathMLOperatorElement::childrenChanged):
+ (WebCore::MathMLOperatorElement::computeDictionaryProperty): Call operatorChar().character.
+ (WebCore::MathMLOperatorElement::parseOperatorText): Deleted.
+ (WebCore::MathMLOperatorElement::operatorText): Deleted.
+ * mathml/MathMLOperatorElement.h: Use a new structure to hold both the character and direction
+ and change names from "text" to "char".
+ * rendering/mathml/RenderMathMLFencedOperator.cpp:
+ (WebCore::RenderMathMLFencedOperator::updateOperatorContent): Update both the character and
+ direction using MathMLOperatorElement::parseOperatorChar. Then set the boolean properties
+ and leading/trailing space using the operator dictionary. minsize and maxsize are constant
+ so we do not need to set them any more.
+ (WebCore::RenderMathMLFencedOperator::leadingSpace): Resolve the spacing read from the
+ dictionary to LayoutUnit. Note that it can never be negative.
+ (WebCore::RenderMathMLFencedOperator::trailingSpace): Ditto.
+ (WebCore::RenderMathMLFencedOperator::RenderMathMLFencedOperator): Deleted.
+ (WebCore::RenderMathMLFencedOperator::setOperatorProperties): Deleted.
+ * rendering/mathml/RenderMathMLFencedOperator.h: We use the new OperatorChar structure for
+ accessors and members. We make minSize and maxSize just return the default values and delete
+ the corresponding members. Finally, leading and trailing space are now stored as unsigned
+ short in MathUnit.
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::textContent): Use the new OperatorChar structure.
+ (WebCore::RenderMathMLOperator::isVertical): Helper function forwarding to MathMLOperatorElement.
+ (WebCore::RenderMathMLOperator::stretchTo): Use isVertical() and remove setOperatorProperties().
+ (WebCore::RenderMathMLOperator::resetStretchSize): Ditto.
+ (WebCore::RenderMathMLOperator::updateMathOperator): Rename rebuildTokenContent as this is
+ now really only used to update MathOperator and hence replace the condition on
+ useMathOperator() with an ASSERT.
+ (WebCore::RenderMathMLOperator::updateTokenContent): Call updateMathOperator instead of
+ rebuildTokenContent.
+ (WebCore::RenderMathMLOperator::verticalStretchedOperatorShift): We use isVertical().
+ (WebCore::RenderMathMLOperator::paint): Ditto.
+ (WebCore::RenderMathMLOperator::setOperatorProperties): Deleted. This is no longer needed.
+ (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Deleted.
+ (WebCore::RenderMathMLOperator::rebuildTokenContent): Deleted. Renamed updateMathOperator.
+ (WebCore::RenderMathMLOperator::styleDidChange): No need to call updateOperatorProperties.
+ (WebCore::RenderMathMLOperator::updateOperatorProperties): Ditto..
+ * rendering/mathml/RenderMathMLOperator.h: Update some declaration and remove m_isVertical.
+ (WebCore::RenderMathMLOperator::isVertical): Deleted.
+ * rendering/mathml/RenderMathMLRow.cpp:
+ (WebCore::RenderMathMLRow::updateOperatorProperties): Deleted. This is no longer needed.
+ * rendering/mathml/RenderMathMLRow.h: Ditto.
+
2016-08-02 Chris Dumez <cdu...@apple.com>
Drop custom bindings code for HTMLSelectElement.remove()
Modified: trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp (204074 => 204075)
--- trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp 2016-08-03 07:00:38 UTC (rev 204075)
@@ -60,10 +60,6 @@
static_cast<MathMLOperatorElement*>(child)->setOperatorFormDirty();
}
- // FIXME: Parsing of operator properties should be done in the element classes rather than in the renderer classes.
- // See https://webkit.org/b/156537
- if (renderer() && is<RenderMathMLRow>(*renderer()))
- downcast<RenderMathMLRow>(*renderer()).updateOperatorProperties();
MathMLElement::childrenChanged(change);
}
Modified: trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp (204074 => 204075)
--- trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.cpp 2016-08-03 07:00:38 UTC (rev 204075)
@@ -47,8 +47,10 @@
return adoptRef(*new MathMLOperatorElement(tagName, document));
}
-UChar MathMLOperatorElement::parseOperatorText(const String& string)
+MathMLOperatorElement::OperatorChar MathMLOperatorElement::parseOperatorChar(const String& string)
{
+ OperatorChar operatorChar;
+
// We collapse the whitespace and replace the hyphens by minus signs.
AtomicString textContent = string.stripWhiteSpace().simplifyWhiteSpace().replace(hyphenMinus, minusSign).impl();
@@ -56,14 +58,16 @@
// FIXME: This is a really inefficient way to extract a character from a string (https://webkit.org/b/160241#c7).
// FIXME: This does not handle surrogate pairs (https://webkit.org/b/122296).
// FIXME: This does not handle <mo> operators with multiple characters (https://webkit.org/b/124828).
- return textContent.length() == 1 ? textContent[0] : 0;
+ operatorChar.character = textContent.length() == 1 ? textContent[0] : 0;
+ operatorChar.isVertical = MathMLOperatorDictionary::isVertical(operatorChar.character);
+ return operatorChar;
}
-UChar MathMLOperatorElement::operatorText()
+const MathMLOperatorElement::OperatorChar& MathMLOperatorElement::operatorChar()
{
- if (!m_operatorText)
- m_operatorText = parseOperatorText(textContent());
- return m_operatorText.value();
+ if (!m_operatorChar)
+ m_operatorChar = parseOperatorChar(textContent());
+ return m_operatorChar.value();
}
MathMLOperatorElement::DictionaryProperty MathMLOperatorElement::computeDictionaryProperty()
@@ -91,7 +95,7 @@
}
// We then try and find an entry in the operator dictionary to override the default values.
- if (auto entry = search(operatorText(), dictionaryProperty.form, explicitForm)) {
+ if (auto entry = search(operatorChar().character, dictionaryProperty.form, explicitForm)) {
dictionaryProperty.form = static_cast<MathMLOperatorDictionary::Form>(entry.value().form);
dictionaryProperty.leadingSpaceInMathUnit = entry.value().lspace;
dictionaryProperty.trailingSpaceInMathUnit = entry.value().rspace;
@@ -212,7 +216,7 @@
void MathMLOperatorElement::childrenChanged(const ChildChange& change)
{
- m_operatorText = Nullopt;
+ m_operatorChar = Nullopt;
m_dictionaryProperty = Nullopt;
m_properties.dirtyFlags = MathMLOperatorDictionary::allFlags;
MathMLTextElement::childrenChanged(change);
Modified: trunk/Source/WebCore/mathml/MathMLOperatorElement.h (204074 => 204075)
--- trunk/Source/WebCore/mathml/MathMLOperatorElement.h 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/mathml/MathMLOperatorElement.h 2016-08-03 07:00:38 UTC (rev 204075)
@@ -34,8 +34,12 @@
class MathMLOperatorElement final : public MathMLTextElement {
public:
static Ref<MathMLOperatorElement> create(const QualifiedName& tagName, Document&);
- static UChar parseOperatorText(const String&);
- UChar operatorText();
+ struct OperatorChar {
+ UChar character { 0 };
+ bool isVertical { true };
+ };
+ static OperatorChar parseOperatorChar(const String&);
+ const OperatorChar& operatorChar();
void setOperatorFormDirty() { m_dictionaryProperty = Nullopt; }
MathMLOperatorDictionary::Form form() { return dictionaryProperty().form; }
bool hasProperty(MathMLOperatorDictionary::Flag);
@@ -52,7 +56,7 @@
void childrenChanged(const ChildChange&) final;
void parseAttribute(const QualifiedName&, const AtomicString&) final;
- Optional<UChar> m_operatorText;
+ Optional<OperatorChar> m_operatorChar;
struct DictionaryProperty {
MathMLOperatorDictionary::Form form;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.cpp (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.cpp 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.cpp 2016-08-03 07:00:38 UTC (rev 204075)
@@ -42,46 +42,41 @@
, m_operatorFlags(flags)
{
updateOperatorContent(operatorString);
-
- // maxsize always has the default value "infinity" value for mfenced operators.
- m_maxSize = intMaxForLayoutUnit;
}
void RenderMathMLFencedOperator::updateOperatorContent(const String& operatorString)
{
- m_textContent = MathMLOperatorElement::parseOperatorText(operatorString);
- rebuildTokenContent();
+ m_operatorChar = MathMLOperatorElement::parseOperatorChar(operatorString);
+
+ // We try and read spacing and boolean properties from the operator dictionary.
+ // However we preserve the Fence and Separator properties specified in the constructor.
+ if (auto entry = search(m_operatorChar.character, m_operatorForm, true)) {
+ m_leadingSpaceInMathUnit = entry.value().lspace;
+ m_trailingSpaceInMathUnit = entry.value().rspace;
+ m_operatorFlags = (m_operatorFlags & (MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator)) | entry.value().flags;
+ } else {
+ m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator; // Flags are disabled by default.
+ m_leadingSpaceInMathUnit = 5; // Default spacing is thickmathspace.
+ m_trailingSpaceInMathUnit = 5; // Default spacing is thickmathspace.
+ }
+
+ updateMathOperator();
}
-void RenderMathMLFencedOperator::setOperatorProperties()
+LayoutUnit RenderMathMLFencedOperator::leadingSpace() const
{
- // We determine the stretch direction (default is vertical).
- m_isVertical = MathMLOperatorDictionary::isVertical(m_textContent);
-
- // Resets all but the Fence and Separator properties.
- m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator;
-
- // minsize always has the default value "1em" value for mfenced operators.
- m_minSize = style().fontCascade().size();
-
- // Default spacing is thickmathspace.
MathMLElement::Length leadingSpace;
leadingSpace.type = MathMLElement::LengthType::MathUnit;
- leadingSpace.value = 5;
- MathMLElement::Length trailingSpace = leadingSpace;
+ leadingSpace.value = static_cast<float>(m_leadingSpaceInMathUnit);
+ return toUserUnits(leadingSpace, style(), 0);
+}
- if (auto entry = search(m_textContent, m_operatorForm, true)) {
- // We use the space specified in the operator dictionary.
- leadingSpace.value = static_cast<float>(entry.value().lspace);
- trailingSpace.value = static_cast<float>(entry.value().rspace);
-
- // We use the dictionary but preserve the Fence and Separator properties.
- m_operatorFlags = (m_operatorFlags & (MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator)) | entry.value().flags;
- }
-
- // Resolve the leading and trailing spaces.
- m_leadingSpace = toUserUnits(leadingSpace, style(), 0);
- m_trailingSpace = toUserUnits(trailingSpace, style(), 0);
+LayoutUnit RenderMathMLFencedOperator::trailingSpace() const
+{
+ MathMLElement::Length trailingSpace;
+ trailingSpace.type = MathMLElement::LengthType::MathUnit;
+ trailingSpace.value = static_cast<float>(m_trailingSpaceInMathUnit);
+ return toUserUnits(trailingSpace, style(), 0);
}
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.h (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.h 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFencedOperator.h 2016-08-03 07:00:38 UTC (rev 204075)
@@ -28,6 +28,7 @@
#if ENABLE(MATHML)
#include "MathMLOperatorDictionary.h"
+#include "MathMLOperatorElement.h"
#include "RenderMathMLOperator.h"
namespace WebCore {
@@ -39,22 +40,25 @@
private:
bool isRenderMathMLFencedOperator() const final { return true; }
- void setOperatorProperties() final;
- UChar textContent() const final { return m_textContent; }
- LayoutUnit leadingSpace() const final { return m_leadingSpace; }
- LayoutUnit trailingSpace() const final { return m_trailingSpace; }
- LayoutUnit minSize() const final { return m_minSize; }
- LayoutUnit maxSize() const final { return m_maxSize; }
+ bool isVertical() const final { return m_operatorChar.isVertical; }
+ UChar textContent() const final { return m_operatorChar.character; }
+ LayoutUnit leadingSpace() const final;
+ LayoutUnit trailingSpace() const final;
+
+ // minsize always has the default value "1em".
+ LayoutUnit minSize() const final { return style().fontCascade().size(); }
+
+ // maxsize always has the default value "infinity".
+ LayoutUnit maxSize() const final { return intMaxForLayoutUnit; }
+
bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const final { return m_operatorFlags & flag; }
// We always use the MathOperator class for anonymous mfenced operators, since they do not have text content in the DOM.
bool useMathOperator() const final { return true; }
- UChar m_textContent { 0 };
- LayoutUnit m_leadingSpace;
- LayoutUnit m_trailingSpace;
- LayoutUnit m_minSize;
- LayoutUnit m_maxSize;
+ MathMLOperatorElement::OperatorChar m_operatorChar;
+ unsigned short m_leadingSpaceInMathUnit;
+ unsigned short m_trailingSpaceInMathUnit;
MathMLOperatorDictionary::Form m_operatorForm;
unsigned short m_operatorFlags;
};
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-08-03 07:00:38 UTC (rev 204075)
@@ -65,7 +65,7 @@
UChar RenderMathMLOperator::textContent() const
{
- return element().operatorText();
+ return element().operatorChar().character;
}
bool RenderMathMLOperator::isInvisibleOperator() const
@@ -110,24 +110,23 @@
return std::max<LayoutUnit>(0, maxSize);
}
-void RenderMathMLOperator::setOperatorProperties()
+bool RenderMathMLOperator::isVertical() const
{
- // We determine the stretch direction (default is vertical).
- m_isVertical = MathMLOperatorDictionary::isVertical(textContent());
+ return element().operatorChar().isVertical;
}
+
void RenderMathMLOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
{
ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
- ASSERT(m_isVertical);
+ ASSERT(isVertical());
- if (!m_isVertical || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline))
+ if (!isVertical() || (heightAboveBaseline == m_stretchHeightAboveBaseline && depthBelowBaseline == m_stretchDepthBelowBaseline))
return;
m_stretchHeightAboveBaseline = heightAboveBaseline;
m_stretchDepthBelowBaseline = depthBelowBaseline;
- setOperatorProperties();
if (hasOperatorFlag(MathMLOperatorDictionary::Symmetric)) {
// We make the operator stretch symmetrically above and below the axis.
LayoutUnit axis = mathAxisHeight();
@@ -160,22 +159,20 @@
void RenderMathMLOperator::stretchTo(LayoutUnit width)
{
ASSERT(hasOperatorFlag(MathMLOperatorDictionary::Stretchy));
- ASSERT(!m_isVertical);
+ ASSERT(!isVertical());
- if (m_isVertical || m_stretchWidth == width)
+ if (isVertical() || m_stretchWidth == width)
return;
m_stretchWidth = width;
m_mathOperator.stretchTo(style(), width);
- setOperatorProperties();
-
setLogicalHeight(m_mathOperator.ascent() + m_mathOperator.descent());
}
void RenderMathMLOperator::resetStretchSize()
{
- if (m_isVertical) {
+ if (isVertical()) {
m_stretchHeightAboveBaseline = 0;
m_stretchDepthBelowBaseline = 0;
} else
@@ -188,7 +185,6 @@
LayoutUnit preferredWidth = 0;
- setOperatorProperties();
if (!useMathOperator()) {
RenderMathMLToken::computePreferredLogicalWidths();
preferredWidth = m_maxPreferredLogicalWidth;
@@ -243,22 +239,17 @@
clearNeedsLayout();
}
-void RenderMathMLOperator::rebuildTokenContent()
+void RenderMathMLOperator::updateMathOperator()
{
- setOperatorProperties();
-
- if (useMathOperator()) {
- MathOperator::Type type;
- if (!shouldAllowStretching())
- type = MathOperator::Type::NormalOperator;
- else if (isLargeOperatorInDisplayStyle())
- type = MathOperator::Type::DisplayOperator;
- else
- type = m_isVertical ? MathOperator::Type::VerticalOperator : MathOperator::Type::HorizontalOperator;
- m_mathOperator.setOperator(style(), textContent(), type);
- }
-
- setNeedsLayoutAndPrefWidthsRecalc();
+ ASSERT(useMathOperator());
+ MathOperator::Type type;
+ if (!shouldAllowStretching())
+ type = MathOperator::Type::NormalOperator;
+ else if (isLargeOperatorInDisplayStyle())
+ type = MathOperator::Type::DisplayOperator;
+ else
+ type = isVertical() ? MathOperator::Type::VerticalOperator : MathOperator::Type::HorizontalOperator;
+ m_mathOperator.setOperator(style(), textContent(), type);
}
void RenderMathMLOperator::updateTokenContent()
@@ -265,7 +256,8 @@
{
ASSERT(!isAnonymous());
RenderMathMLToken::updateTokenContent();
- rebuildTokenContent();
+ if (useMathOperator())
+ updateMathOperator();
}
void RenderMathMLOperator::updateFromElement()
@@ -273,12 +265,6 @@
updateTokenContent();
}
-void RenderMathMLOperator::updateOperatorProperties()
-{
- setOperatorProperties();
- setNeedsLayoutAndPrefWidthsRecalc();
-}
-
bool RenderMathMLOperator::shouldAllowStretching() const
{
return textContent() && (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle());
@@ -296,12 +282,11 @@
{
RenderMathMLBlock::styleDidChange(diff, oldStyle);
m_mathOperator.reset(style());
- updateOperatorProperties();
}
LayoutUnit RenderMathMLOperator::verticalStretchedOperatorShift() const
{
- if (!m_isVertical || !stretchSize())
+ if (!isVertical() || !stretchSize())
return 0;
return (m_stretchDepthBelowBaseline - m_stretchHeightAboveBaseline - m_mathOperator.descent() + m_mathOperator.ascent()) / 2;
@@ -324,7 +309,7 @@
operatorTopLeft.move(style().isLeftToRightDirection() ? leadingSpace() : trailingSpace(), 0);
// Center horizontal operators.
- if (!m_isVertical)
+ if (!isVertical())
operatorTopLeft.move(-(m_mathOperator.width() - width()) / 2, 0);
m_mathOperator.paint(style(), info, operatorTopLeft);
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-08-03 07:00:38 UTC (rev 204075)
@@ -44,23 +44,21 @@
void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
void stretchTo(LayoutUnit width);
- LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
+ LayoutUnit stretchSize() const { return isVertical() ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
void resetStretchSize();
virtual bool hasOperatorFlag(MathMLOperatorDictionary::Flag) const;
bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp) && mathMLStyle()->displayStyle(); }
bool shouldMoveLimits() const { return hasOperatorFlag(MathMLOperatorDictionary::MovableLimits) && !mathMLStyle()->displayStyle(); }
- bool isVertical() const { return m_isVertical; }
+ virtual bool isVertical() const;
LayoutUnit italicCorrection() const { return m_mathOperator.italicCorrection(); }
void updateTokenContent() final;
- void updateOperatorProperties();
void updateFromElement() final;
virtual UChar textContent() const;
protected:
- void rebuildTokenContent();
- virtual void setOperatorProperties();
+ virtual void updateMathOperator();
virtual LayoutUnit leadingSpace() const;
virtual LayoutUnit trailingSpace() const;
virtual LayoutUnit minSize() const;
@@ -67,8 +65,6 @@
virtual LayoutUnit maxSize() const;
virtual bool useMathOperator() const;
- bool m_isVertical { true };
-
private:
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
void computePreferredLogicalWidths() final;
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp 2016-08-03 07:00:38 UTC (rev 204075)
@@ -44,18 +44,6 @@
{
}
-void RenderMathMLRow::updateOperatorProperties()
-{
- for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- if (is<RenderMathMLBlock>(*child)) {
- if (auto* renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator())
- renderOperator->updateOperatorProperties();
- }
- }
- setNeedsLayoutAndPrefWidthsRecalc();
-}
-
-
Optional<int> RenderMathMLRow::firstLineBaseline() const
{
auto* baselineChild = firstChildBox();
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h (204074 => 204075)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-08-03 06:35:08 UTC (rev 204074)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.h 2016-08-03 07:00:38 UTC (rev 204075)
@@ -36,8 +36,6 @@
public:
RenderMathMLRow(Element&, RenderStyle&&);
- void updateOperatorProperties();
-
protected:
void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
Optional<int> firstLineBaseline() const override;