Title: [208647] trunk/Source/WebCore
- Revision
- 208647
- Author
- [email protected]
- Date
- 2016-11-12 04:41:35 -0800 (Sat, 12 Nov 2016)
Log Message
Remove RenderMathMLOperator::shouldAllowStretching
https://bugs.webkit.org/show_bug.cgi?id=164313
Patch by Frederic Wang <[email protected]> on 2016-11-12
Reviewed by Darin Adler.
RenderMathMLOperator::shouldAllowStretching is an old function from early implementations of
MathML. Its name is now confusing since it also includes non-stretchy large operators.
Moreover, it is not really useful and is actually only used by two functions: useMathOperator
and updateMathOperator. The former is almost equivalent and is used as a replacement of
shouldAllowStretching everywhere else. We rewrite the two remaining calls with the finer
test functions isStretchy() and isLargeOperatorInDisplayStyle().
No new tests, behavior unchanged.
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::updateMathOperator): Reorder the conditionals to avoid the
use of RenderMathMLOperator::shouldAllowStretching and match useMathOperator.
(WebCore::RenderMathMLOperator::useMathOperator): Rewrite shouldAllowStretching() using
isStretchy() and isLargeOperatorInDisplayStyle().
(WebCore::RenderMathMLOperator::shouldAllowStretching): Deleted.
* rendering/mathml/RenderMathMLOperator.h: Remove declaration of shouldAllowStretching.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (208646 => 208647)
--- trunk/Source/WebCore/ChangeLog 2016-11-12 08:57:21 UTC (rev 208646)
+++ trunk/Source/WebCore/ChangeLog 2016-11-12 12:41:35 UTC (rev 208647)
@@ -1,3 +1,27 @@
+2016-11-12 Frederic Wang <[email protected]>
+
+ Remove RenderMathMLOperator::shouldAllowStretching
+ https://bugs.webkit.org/show_bug.cgi?id=164313
+
+ Reviewed by Darin Adler.
+
+ RenderMathMLOperator::shouldAllowStretching is an old function from early implementations of
+ MathML. Its name is now confusing since it also includes non-stretchy large operators.
+ Moreover, it is not really useful and is actually only used by two functions: useMathOperator
+ and updateMathOperator. The former is almost equivalent and is used as a replacement of
+ shouldAllowStretching everywhere else. We rewrite the two remaining calls with the finer
+ test functions isStretchy() and isLargeOperatorInDisplayStyle().
+
+ No new tests, behavior unchanged.
+
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::updateMathOperator): Reorder the conditionals to avoid the
+ use of RenderMathMLOperator::shouldAllowStretching and match useMathOperator.
+ (WebCore::RenderMathMLOperator::useMathOperator): Rewrite shouldAllowStretching() using
+ isStretchy() and isLargeOperatorInDisplayStyle().
+ (WebCore::RenderMathMLOperator::shouldAllowStretching): Deleted.
+ * rendering/mathml/RenderMathMLOperator.h: Remove declaration of shouldAllowStretching.
+
2016-11-12 Joseph Pecoraro <[email protected]>
Use #pragma once in WebCore
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (208646 => 208647)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-11-12 08:57:21 UTC (rev 208646)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp 2016-11-12 12:41:35 UTC (rev 208647)
@@ -242,12 +242,13 @@
{
ASSERT(useMathOperator());
MathOperator::Type type;
- if (!shouldAllowStretching())
- type = MathOperator::Type::NormalOperator;
- else if (isLargeOperatorInDisplayStyle())
+ if (isStretchy())
+ type = isVertical() ? MathOperator::Type::VerticalOperator : MathOperator::Type::HorizontalOperator;
+ else if (textContent() && isLargeOperatorInDisplayStyle())
type = MathOperator::Type::DisplayOperator;
else
- type = isVertical() ? MathOperator::Type::VerticalOperator : MathOperator::Type::HorizontalOperator;
+ type = MathOperator::Type::NormalOperator;
+
m_mathOperator.setOperator(style(), textContent(), type);
}
@@ -264,17 +265,12 @@
updateTokenContent();
}
-bool RenderMathMLOperator::shouldAllowStretching() const
-{
- return textContent() && (hasOperatorFlag(MathMLOperatorDictionary::Stretchy) || isLargeOperatorInDisplayStyle());
-}
-
bool RenderMathMLOperator::useMathOperator() const
{
// We use the MathOperator class to handle the following cases:
// 1) Stretchy and large operators, since they require special painting.
// 2) The minus sign, since it can be obtained from a hyphen in the DOM.
- return shouldAllowStretching() || textContent() == minusSign;
+ return isStretchy() || (textContent() && isLargeOperatorInDisplayStyle()) || textContent() == minusSign;
}
void RenderMathMLOperator::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (208646 => 208647)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-11-12 08:57:21 UTC (rev 208646)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h 2016-11-12 12:41:35 UTC (rev 208647)
@@ -80,8 +80,6 @@
Optional<int> firstLineBaseline() const final;
RenderMathMLOperator* unembellishedOperator() final { return this; }
- bool shouldAllowStretching() const;
-
LayoutUnit verticalStretchedOperatorShift() const;
LayoutUnit m_stretchHeightAboveBaseline { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes