2016-07-19 05:42:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Igalia S.L. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2016-08-24 05:56:08 +00:00
|
|
|
#include "MathMLScriptsElement.h"
|
2016-07-19 05:42:46 +00:00
|
|
|
|
|
|
|
#if ENABLE(MATHML)
|
|
|
|
|
|
|
|
#include "RenderMathMLScripts.h"
|
2018-03-17 06:11:00 +00:00
|
|
|
#include <wtf/IsoMallocInlines.h>
|
2016-07-19 05:42:46 +00:00
|
|
|
|
|
|
|
namespace WebCore {
|
|
|
|
|
2018-03-17 06:11:00 +00:00
|
|
|
WTF_MAKE_ISO_ALLOCATED_IMPL(MathMLScriptsElement);
|
|
|
|
|
2016-07-19 05:42:46 +00:00
|
|
|
using namespace MathMLNames;
|
|
|
|
|
2019-01-29 19:39:55 +00:00
|
|
|
static MathMLScriptsElement::ScriptType scriptTypeOf(const QualifiedName& tagName)
|
2017-12-04 11:30:10 +00:00
|
|
|
{
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(msubTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::Sub;
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(msupTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::Super;
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(msubsupTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::SubSup;
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(munderTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::Under;
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(moverTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::Over;
|
2020-10-11 19:16:49 +00:00
|
|
|
if (tagName.matches(munderoverTag))
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::UnderOver;
|
2020-10-11 19:16:49 +00:00
|
|
|
ASSERT(tagName.matches(mmultiscriptsTag));
|
2019-01-29 19:39:55 +00:00
|
|
|
return MathMLScriptsElement::ScriptType::Multiscripts;
|
2017-12-04 11:30:10 +00:00
|
|
|
}
|
|
|
|
|
2016-07-22 05:33:01 +00:00
|
|
|
MathMLScriptsElement::MathMLScriptsElement(const QualifiedName& tagName, Document& document)
|
2016-08-23 11:36:28 +00:00
|
|
|
: MathMLPresentationElement(tagName, document)
|
2017-12-04 11:30:10 +00:00
|
|
|
, m_scriptType(scriptTypeOf(tagName))
|
2016-07-19 05:42:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<MathMLScriptsElement> MathMLScriptsElement::create(const QualifiedName& tagName, Document& document)
|
|
|
|
{
|
|
|
|
return adoptRef(*new MathMLScriptsElement(tagName, document));
|
|
|
|
}
|
|
|
|
|
|
|
|
const MathMLElement::Length& MathMLScriptsElement::subscriptShift()
|
|
|
|
{
|
|
|
|
return cachedMathMLLength(subscriptshiftAttr, m_subscriptShift);
|
|
|
|
}
|
|
|
|
|
|
|
|
const MathMLElement::Length& MathMLScriptsElement::superscriptShift()
|
|
|
|
{
|
|
|
|
return cachedMathMLLength(superscriptshiftAttr, m_superscriptShift);
|
|
|
|
}
|
|
|
|
|
2019-06-17 01:48:13 +00:00
|
|
|
void MathMLScriptsElement::parseAttribute(const QualifiedName& name, const AtomString& value)
|
2016-07-19 05:42:46 +00:00
|
|
|
{
|
|
|
|
if (name == subscriptshiftAttr)
|
Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280
Reviewed by Chris Dumez.
Source/JavaScriptCore:
* <many files>: Accept the renaming done by do-webcore-rename.
* yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file,
tweaked style to make it happy after the renaming done by do-webcore-rename, and
also hand-updated Optional to std::optional as long as we were touching it.
Source/WebCore:
* <many files>: Accept the renaming done by do-webcore-rename.
* Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained
about the names of some arguments, fixed them, and also hand-updated Optional to
std::optional as long as we were touching it.
* loader/EmptyClients.cpp: Since style checker complained about the mix of
WEBCORE_EXPORT and inlined functions, moved them out of line, and
also hand-updated Optional to std::optional as long as we were touching it.
Also removed is<EmptyFrameLoaderClient>().
* loader/EmptyFrameLoaderClient.h: Ditto.
Source/WebCore/PAL:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebDriver:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKit:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy:
* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy/mac:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy/win:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WTF:
* <many files>: Accept the renaming done by do-webcore-rename.
* wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt.
Tools:
* Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t,
WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily
be done by the script and so will be done in later passes.
* <many files>: Accept the renaming done by do-webcore-rename.
Canonical link: https://commits.webkit.org/238228@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
|
|
|
m_subscriptShift = std::nullopt;
|
2016-07-19 05:42:46 +00:00
|
|
|
else if (name == superscriptshiftAttr)
|
Next step toward using std::optional directly instead of through WTF::Optional typedef
https://bugs.webkit.org/show_bug.cgi?id=226280
Reviewed by Chris Dumez.
Source/JavaScriptCore:
* <many files>: Accept the renaming done by do-webcore-rename.
* yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file,
tweaked style to make it happy after the renaming done by do-webcore-rename, and
also hand-updated Optional to std::optional as long as we were touching it.
Source/WebCore:
* <many files>: Accept the renaming done by do-webcore-rename.
* Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained
about the names of some arguments, fixed them, and also hand-updated Optional to
std::optional as long as we were touching it.
* loader/EmptyClients.cpp: Since style checker complained about the mix of
WEBCORE_EXPORT and inlined functions, moved them out of line, and
also hand-updated Optional to std::optional as long as we were touching it.
Also removed is<EmptyFrameLoaderClient>().
* loader/EmptyFrameLoaderClient.h: Ditto.
Source/WebCore/PAL:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebDriver:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKit:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy:
* Storage/StorageTracker.cpp:
(WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy/mac:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WebKitLegacy/win:
* <many files>: Accept the renaming done by do-webcore-rename.
Source/WTF:
* <many files>: Accept the renaming done by do-webcore-rename.
* wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional.
* wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt.
Tools:
* Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t,
WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily
be done by the script and so will be done in later passes.
* <many files>: Accept the renaming done by do-webcore-rename.
Canonical link: https://commits.webkit.org/238228@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
|
|
|
m_superscriptShift = std::nullopt;
|
2016-07-19 05:42:46 +00:00
|
|
|
|
|
|
|
MathMLElement::parseAttribute(name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderPtr<RenderElement> MathMLScriptsElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
|
|
|
|
{
|
|
|
|
ASSERT(hasTagName(msubTag) || hasTagName(msupTag) || hasTagName(msubsupTag) || hasTagName(mmultiscriptsTag));
|
|
|
|
return createRenderer<RenderMathMLScripts>(*this, WTFMove(style));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ENABLE(MATHML)
|