WebKit Bugzilla
Attachment 360476 Details for
Bug 193969
: [MathML] Move enum class ScriptType to MathMLScriptsElement.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193969-20190129105948.patch (text/plain), 19.43 KB, created by
zalan
on 2019-01-29 10:59:48 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-29 10:59:48 PST
Size:
19.43 KB
patch
obsolete
>Subversion Revision: 240589 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index be0b10298aae75e3d17de54c2bfd16ed1e5e2052..e9aabbad4b1f96461e0d680be58f3aa56a33167c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2019-01-29 Zalan Bujtas <zalan@apple.com> >+ >+ [MathML] Move enum class ScriptType to MathMLScriptsElement. >+ https://bugs.webkit.org/show_bug.cgi?id=193969 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * mathml/MathMLScriptsElement.cpp: >+ (WebCore::scriptTypeOf): >+ * mathml/MathMLScriptsElement.h: >+ * rendering/mathml/RenderMathMLScripts.cpp: >+ (WebCore::RenderMathMLScripts::scriptType const): >+ (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): >+ (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): >+ (WebCore::RenderMathMLScripts::verticalMetrics): >+ (WebCore::RenderMathMLScripts::layoutBlock): >+ * rendering/mathml/RenderMathMLScripts.h: >+ * rendering/mathml/RenderMathMLUnderOver.cpp: >+ (WebCore::RenderMathMLUnderOver::isValid const): >+ (WebCore::RenderMathMLUnderOver::under const): >+ (WebCore::RenderMathMLUnderOver::over const): >+ (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): >+ (WebCore::RenderMathMLUnderOver::hasAccent const): >+ (WebCore::RenderMathMLUnderOver::layoutBlock): >+ > 2019-01-28 Oriol Brufau <obrufau@igalia.com> > > [css-logical] Reject unitless length quirk in 'inset' shorthand >diff --git a/Source/WebCore/mathml/MathMLScriptsElement.cpp b/Source/WebCore/mathml/MathMLScriptsElement.cpp >index b11977d3ec3da6ce90bcef6cb4af1cecb51ef937..d22228cc5130a5e1792f3b7dc6a62be33079ec2f 100644 >--- a/Source/WebCore/mathml/MathMLScriptsElement.cpp >+++ b/Source/WebCore/mathml/MathMLScriptsElement.cpp >@@ -38,22 +38,22 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(MathMLScriptsElement); > > using namespace MathMLNames; > >-static ScriptType scriptTypeOf(const QualifiedName& tagName) >+static MathMLScriptsElement::ScriptType scriptTypeOf(const QualifiedName& tagName) > { > if (tagName == msubTag) >- return ScriptType::Sub; >+ return MathMLScriptsElement::ScriptType::Sub; > if (tagName == msupTag) >- return ScriptType::Super; >+ return MathMLScriptsElement::ScriptType::Super; > if (tagName == msubsupTag) >- return ScriptType::SubSup; >+ return MathMLScriptsElement::ScriptType::SubSup; > if (tagName == munderTag) >- return ScriptType::Under; >+ return MathMLScriptsElement::ScriptType::Under; > if (tagName == moverTag) >- return ScriptType::Over; >+ return MathMLScriptsElement::ScriptType::Over; > if (tagName == munderoverTag) >- return ScriptType::UnderOver; >+ return MathMLScriptsElement::ScriptType::UnderOver; > ASSERT(tagName == mmultiscriptsTag); >- return ScriptType::Multiscripts; >+ return MathMLScriptsElement::ScriptType::Multiscripts; > } > > MathMLScriptsElement::MathMLScriptsElement(const QualifiedName& tagName, Document& document) >diff --git a/Source/WebCore/mathml/MathMLScriptsElement.h b/Source/WebCore/mathml/MathMLScriptsElement.h >index d2bc651cfc1e8f67e6773f3708e9d5f4a1b6cfc1..e4fb5428e2ec3f7b4ee593654b1169fec9dddeaa 100644 >--- a/Source/WebCore/mathml/MathMLScriptsElement.h >+++ b/Source/WebCore/mathml/MathMLScriptsElement.h >@@ -31,12 +31,12 @@ > > namespace WebCore { > >-enum class ScriptType; >- > class MathMLScriptsElement : public MathMLPresentationElement { > WTF_MAKE_ISO_ALLOCATED(MathMLScriptsElement); > public: > static Ref<MathMLScriptsElement> create(const QualifiedName& tagName, Document&); >+ >+ enum class ScriptType { Sub, Super, SubSup, Multiscripts, Under, Over, UnderOver }; > ScriptType scriptType() const { return m_scriptType; } > const Length& subscriptShift(); > const Length& superscriptShift(); >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >index 1ec49f21a42c1576be2c4a9c08d159ffa88bf4f9..bff9a06f1194baecef67b4f018d0c4c2ed3ecc55 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp >@@ -54,7 +54,7 @@ MathMLScriptsElement& RenderMathMLScripts::element() const > return static_cast<MathMLScriptsElement&>(nodeForNonAnonymous()); > } > >-ScriptType RenderMathMLScripts::scriptType() const >+MathMLScriptsElement::ScriptType RenderMathMLScripts::scriptType() const > { > return element().scriptType(); > } >@@ -82,10 +82,10 @@ Optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::validateAn > reference.prescriptDelimiter = nullptr; > > switch (scriptType()) { >- case ScriptType::Sub: >- case ScriptType::Super: >- case ScriptType::Under: >- case ScriptType::Over: { >+ case MathMLScriptsElement::ScriptType::Sub: >+ case MathMLScriptsElement::ScriptType::Super: >+ case MathMLScriptsElement::ScriptType::Under: >+ case MathMLScriptsElement::ScriptType::Over: { > // These elements must have exactly two children. > // The second child is a postscript and there are no prescripts. > // <msub> base subscript </msub> >@@ -98,8 +98,8 @@ Optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::validateAn > reference.firstPostScript = script; > return reference; > } >- case ScriptType::SubSup: >- case ScriptType::UnderOver: { >+ case MathMLScriptsElement::ScriptType::SubSup: >+ case MathMLScriptsElement::ScriptType::UnderOver: { > // These elements must have exactly three children. > // The second and third children are postscripts and there are no prescripts. > // <msubsup> base subscript superscript </msubsup> >@@ -113,7 +113,7 @@ Optional<RenderMathMLScripts::ReferenceChildren> RenderMathMLScripts::validateAn > reference.firstPostScript = subScript; > return reference; > } >- case ScriptType::Multiscripts: { >+ case MathMLScriptsElement::ScriptType::Multiscripts: { > // This element accepts the following syntax: > // > // <mmultiscripts> >@@ -189,19 +189,19 @@ void RenderMathMLScripts::computePreferredLogicalWidths() > LayoutUnit space = spaceAfterScript(); > > switch (scriptType()) { >- case ScriptType::Sub: >- case ScriptType::Under: >+ case MathMLScriptsElement::ScriptType::Sub: >+ case MathMLScriptsElement::ScriptType::Under: > m_maxPreferredLogicalWidth += reference.base->maxPreferredLogicalWidth(); > m_maxPreferredLogicalWidth += std::max(0_lu, reference.firstPostScript->maxPreferredLogicalWidth() - baseItalicCorrection + space); > break; >- case ScriptType::Super: >- case ScriptType::Over: >+ case MathMLScriptsElement::ScriptType::Super: >+ case MathMLScriptsElement::ScriptType::Over: > m_maxPreferredLogicalWidth += reference.base->maxPreferredLogicalWidth(); > m_maxPreferredLogicalWidth += std::max(0_lu, reference.firstPostScript->maxPreferredLogicalWidth() + space); > break; >- case ScriptType::SubSup: >- case ScriptType::UnderOver: >- case ScriptType::Multiscripts: { >+ case MathMLScriptsElement::ScriptType::SubSup: >+ case MathMLScriptsElement::ScriptType::UnderOver: >+ case MathMLScriptsElement::ScriptType::Multiscripts: { > auto subScript = reference.firstPreScript; > while (subScript) { > auto supScript = subScript->nextSiblingBox(); >@@ -261,7 +261,7 @@ RenderMathMLScripts::VerticalMetrics RenderMathMLScripts::verticalMetrics(const > > LayoutUnit baseAscent = ascentForChild(*reference.base); > LayoutUnit baseDescent = reference.base->logicalHeight() - baseAscent; >- if (scriptType() == ScriptType::Sub || scriptType() == ScriptType::SubSup || scriptType() == ScriptType::Multiscripts || scriptType() == ScriptType::Under || scriptType() == ScriptType::UnderOver) { >+ if (scriptType() == MathMLScriptsElement::ScriptType::Sub || scriptType() == MathMLScriptsElement::ScriptType::SubSup || scriptType() == MathMLScriptsElement::ScriptType::Multiscripts || scriptType() == MathMLScriptsElement::ScriptType::Under || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) { > metrics.subShift = std::max(parameters.subscriptShiftDown, baseDescent + parameters.subscriptBaselineDropMin); > if (!isRenderMathMLUnderOver()) { > // It is not clear how to interpret the default shift and it is not available yet anyway. >@@ -270,7 +270,7 @@ RenderMathMLScripts::VerticalMetrics RenderMathMLScripts::verticalMetrics(const > metrics.subShift = std::max(metrics.subShift, specifiedMinSubShift); > } > } >- if (scriptType() == ScriptType::Super || scriptType() == ScriptType::SubSup || scriptType() == ScriptType::Multiscripts || scriptType() == ScriptType::Over || scriptType() == ScriptType::UnderOver) { >+ if (scriptType() == MathMLScriptsElement::ScriptType::Super || scriptType() == MathMLScriptsElement::ScriptType::SubSup || scriptType() == MathMLScriptsElement::ScriptType::Multiscripts || scriptType() == MathMLScriptsElement::ScriptType::Over || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) { > metrics.supShift = std::max(parameters.superscriptShiftUp, baseAscent - parameters.superScriptBaselineDropMax); > if (!isRenderMathMLUnderOver()) { > // It is not clear how to interpret the default shift and it is not available yet anyway. >@@ -281,25 +281,25 @@ RenderMathMLScripts::VerticalMetrics RenderMathMLScripts::verticalMetrics(const > } > > switch (scriptType()) { >- case ScriptType::Sub: >- case ScriptType::Under: { >+ case MathMLScriptsElement::ScriptType::Sub: >+ case MathMLScriptsElement::ScriptType::Under: { > LayoutUnit subAscent = ascentForChild(*reference.firstPostScript); > LayoutUnit subDescent = reference.firstPostScript->logicalHeight() - subAscent; > metrics.descent = subDescent; > metrics.subShift = std::max(metrics.subShift, subAscent - parameters.subscriptTopMax); > } > break; >- case ScriptType::Super: >- case ScriptType::Over: { >+ case MathMLScriptsElement::ScriptType::Super: >+ case MathMLScriptsElement::ScriptType::Over: { > LayoutUnit supAscent = ascentForChild(*reference.firstPostScript); > LayoutUnit supDescent = reference.firstPostScript->logicalHeight() - supAscent; > metrics.ascent = supAscent; > metrics.supShift = std::max(metrics.supShift, parameters.superscriptBottomMin + supDescent); > } > break; >- case ScriptType::SubSup: >- case ScriptType::UnderOver: >- case ScriptType::Multiscripts: { >+ case MathMLScriptsElement::ScriptType::SubSup: >+ case MathMLScriptsElement::ScriptType::UnderOver: >+ case MathMLScriptsElement::ScriptType::Multiscripts: { > // FIXME: We should move the code updating VerticalMetrics for each sub/sup pair in a helper > // function. That way, SubSup/UnderOver can just make one call and the loop for Multiscripts > // can be rewritten in a more readable. >@@ -378,8 +378,8 @@ void RenderMathMLScripts::layoutBlock(bool relayoutChildren, LayoutUnit) > setLogicalHeight(ascent + descent); > > switch (scriptType()) { >- case ScriptType::Sub: >- case ScriptType::Under: { >+ case MathMLScriptsElement::ScriptType::Sub: >+ case MathMLScriptsElement::ScriptType::Under: { > setLogicalWidth(reference.base->logicalWidth() + std::max(0_lu, reference.firstPostScript->logicalWidth() - baseItalicCorrection + space)); > LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *reference.base), ascent - baseAscent); > reference.base->setLocation(baseLocation); >@@ -389,8 +389,8 @@ void RenderMathMLScripts::layoutBlock(bool relayoutChildren, LayoutUnit) > reference.firstPostScript->setLocation(scriptLocation); > } > break; >- case ScriptType::Super: >- case ScriptType::Over: { >+ case MathMLScriptsElement::ScriptType::Super: >+ case MathMLScriptsElement::ScriptType::Over: { > setLogicalWidth(reference.base->logicalWidth() + std::max(0_lu, reference.firstPostScript->logicalWidth() + space)); > LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *reference.base), ascent - baseAscent); > reference.base->setLocation(baseLocation); >@@ -400,9 +400,9 @@ void RenderMathMLScripts::layoutBlock(bool relayoutChildren, LayoutUnit) > reference.firstPostScript->setLocation(scriptLocation); > } > break; >- case ScriptType::SubSup: >- case ScriptType::UnderOver: >- case ScriptType::Multiscripts: { >+ case MathMLScriptsElement::ScriptType::SubSup: >+ case MathMLScriptsElement::ScriptType::UnderOver: >+ case MathMLScriptsElement::ScriptType::Multiscripts: { > // Calculate the logical width. > LayoutUnit logicalWidth; > auto subScript = reference.firstPreScript; >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >index dda0be52d42a94c5cafbf022455559dc2aff23c5..82f2570ff8c97a4757ade114ca7ad83b793b460c 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h >@@ -29,14 +29,11 @@ > > #if ENABLE(MATHML) > >+#include "MathMLScriptsElement.h" > #include "RenderMathMLBlock.h" > > namespace WebCore { > >-class MathMLScriptsElement; >- >-enum class ScriptType { Sub, Super, SubSup, Multiscripts, Under, Over, UnderOver }; >- > // Render a base with scripts. > class RenderMathMLScripts : public RenderMathMLBlock { > WTF_MAKE_ISO_ALLOCATED(RenderMathMLScripts); >@@ -47,7 +44,7 @@ public: > protected: > bool isRenderMathMLScripts() const override { return true; } > const char* renderName() const override { return "RenderMathMLScripts"; } >- ScriptType scriptType() const; >+ MathMLScriptsElement::ScriptType scriptType() const; > void computePreferredLogicalWidths() override; > void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override; > >diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp >index 88a8d206cb58c2f8aefc31b94e57076263c1f6bd..6a6ddca76356204fb716af73190015165c8d9b2b 100644 >--- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp >+++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp >@@ -135,10 +135,10 @@ bool RenderMathMLUnderOver::isValid() const > return false; > child = child->nextSiblingBox(); > switch (scriptType()) { >- case ScriptType::Over: >- case ScriptType::Under: >+ case MathMLScriptsElement::ScriptType::Over: >+ case MathMLScriptsElement::ScriptType::Under: > return !child; >- case ScriptType::UnderOver: >+ case MathMLScriptsElement::ScriptType::UnderOver: > return child && !child->nextSiblingBox(); > default: > ASSERT_NOT_REACHED(); >@@ -162,16 +162,16 @@ RenderBox& RenderMathMLUnderOver::base() const > RenderBox& RenderMathMLUnderOver::under() const > { > ASSERT(isValid()); >- ASSERT(scriptType() == ScriptType::Under || scriptType() == ScriptType::UnderOver); >+ ASSERT(scriptType() == MathMLScriptsElement::ScriptType::Under || scriptType() == MathMLScriptsElement::ScriptType::UnderOver); > return *firstChildBox()->nextSiblingBox(); > } > > RenderBox& RenderMathMLUnderOver::over() const > { > ASSERT(isValid()); >- ASSERT(scriptType() == ScriptType::Over || scriptType() == ScriptType::UnderOver); >+ ASSERT(scriptType() == MathMLScriptsElement::ScriptType::Over || scriptType() == MathMLScriptsElement::ScriptType::UnderOver); > auto* secondChild = firstChildBox()->nextSiblingBox(); >- return scriptType() == ScriptType::Over ? *secondChild : *secondChild->nextSiblingBox(); >+ return scriptType() == MathMLScriptsElement::ScriptType::Over ? *secondChild : *secondChild->nextSiblingBox(); > } > > >@@ -192,10 +192,10 @@ void RenderMathMLUnderOver::computePreferredLogicalWidths() > > LayoutUnit preferredWidth = base().maxPreferredLogicalWidth(); > >- if (scriptType() == ScriptType::Under || scriptType() == ScriptType::UnderOver) >+ if (scriptType() == MathMLScriptsElement::ScriptType::Under || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) > preferredWidth = std::max(preferredWidth, under().maxPreferredLogicalWidth()); > >- if (scriptType() == ScriptType::Over || scriptType() == ScriptType::UnderOver) >+ if (scriptType() == MathMLScriptsElement::ScriptType::Over || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) > preferredWidth = std::max(preferredWidth, over().maxPreferredLogicalWidth()); > > m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = preferredWidth; >@@ -210,7 +210,7 @@ LayoutUnit RenderMathMLUnderOver::horizontalOffset(const RenderBox& child) const > > bool RenderMathMLUnderOver::hasAccent(bool accentUnder) const > { >- ASSERT(scriptType() == ScriptType::UnderOver || (accentUnder && scriptType() == ScriptType::Under) || (!accentUnder && scriptType() == ScriptType::Over)); >+ ASSERT(scriptType() == MathMLScriptsElement::ScriptType::UnderOver || (accentUnder && scriptType() == MathMLScriptsElement::ScriptType::Under) || (!accentUnder && scriptType() == MathMLScriptsElement::ScriptType::Over)); > > const MathMLElement::BooleanValue& attributeValue = accentUnder ? element().accentUnder() : element().accent(); > if (attributeValue == MathMLElement::BooleanValue::True) >@@ -306,19 +306,19 @@ void RenderMathMLUnderOver::layoutBlock(bool relayoutChildren, LayoutUnit pageLo > stretchHorizontalOperatorsAndLayoutChildren(); > > ASSERT(!base().needsLayout()); >- ASSERT(scriptType() == ScriptType::Over || !under().needsLayout()); >- ASSERT(scriptType() == ScriptType::Under || !over().needsLayout()); >+ ASSERT(scriptType() == MathMLScriptsElement::ScriptType::Over || !under().needsLayout()); >+ ASSERT(scriptType() == MathMLScriptsElement::ScriptType::Under || !over().needsLayout()); > > LayoutUnit logicalWidth = base().logicalWidth(); >- if (scriptType() == ScriptType::Under || scriptType() == ScriptType::UnderOver) >+ if (scriptType() == MathMLScriptsElement::ScriptType::Under || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) > logicalWidth = std::max(logicalWidth, under().logicalWidth()); >- if (scriptType() == ScriptType::Over || scriptType() == ScriptType::UnderOver) >+ if (scriptType() == MathMLScriptsElement::ScriptType::Over || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) > logicalWidth = std::max(logicalWidth, over().logicalWidth()); > setLogicalWidth(logicalWidth); > > VerticalParameters parameters = verticalParameters(); > LayoutUnit verticalOffset; >- if (scriptType() == ScriptType::Over || scriptType() == ScriptType::UnderOver) { >+ if (scriptType() == MathMLScriptsElement::ScriptType::Over || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) { > verticalOffset += parameters.overExtraAscender; > over().setLocation(LayoutPoint(horizontalOffset(over()), verticalOffset)); > if (parameters.useUnderOverBarFallBack) { >@@ -336,7 +336,7 @@ void RenderMathMLUnderOver::layoutBlock(bool relayoutChildren, LayoutUnit pageLo > } > base().setLocation(LayoutPoint(horizontalOffset(base()), verticalOffset)); > verticalOffset += base().logicalHeight(); >- if (scriptType() == ScriptType::Under || scriptType() == ScriptType::UnderOver) { >+ if (scriptType() == MathMLScriptsElement::ScriptType::Under || scriptType() == MathMLScriptsElement::ScriptType::UnderOver) { > if (parameters.useUnderOverBarFallBack) { > if (!hasAccentUnder()) > verticalOffset += parameters.underGapMin;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193969
: 360476