haikuwebkit/Source/WebCore/mathml/MathMLScriptsElement.cpp

99 lines
3.6 KiB
C++
Raw Permalink Normal View History

Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
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"
More consistent header inclusions in the MathML module https://bugs.webkit.org/show_bug.cgi?id=161080 Patch by Frederic Wang <fwang@igalia.com> on 2016-08-23 Reviewed by Darin Adler. We adjust header inclusion in the MathML module so that: - implementation file's own header is outside the #if ENABLE(MATHML) - There is always a blank line after the #if ENABLE(MATHML) No new tests, behavior is unchanged. * mathml/MathMLAnnotationElement.cpp: * mathml/MathMLAnnotationElement.h: * mathml/MathMLElement.cpp: * mathml/MathMLFractionElement.cpp: * mathml/MathMLFractionElement.h: * mathml/MathMLMathElement.cpp: * mathml/MathMLMathElement.h: * mathml/MathMLMencloseElement.cpp: * mathml/MathMLMencloseElement.h: * mathml/MathMLOperatorDictionary.cpp: * mathml/MathMLOperatorElement.cpp: * mathml/MathMLOperatorElement.h: * mathml/MathMLPaddedElement.cpp: * mathml/MathMLPaddedElement.h: * mathml/MathMLPresentationElement.cpp: * mathml/MathMLPresentationElement.h: * mathml/MathMLRowElement.cpp: * mathml/MathMLRowElement.h: * mathml/MathMLScriptsElement.cpp: * mathml/MathMLScriptsElement.h: * mathml/MathMLSelectElement.h: * mathml/MathMLSpaceElement.cpp: * mathml/MathMLSpaceElement.h: * mathml/MathMLTokenElement.cpp: * mathml/MathMLUnderOverElement.cpp: * mathml/MathMLUnderOverElement.h: * rendering/mathml/MathMLStyle.cpp: * rendering/mathml/MathOperator.cpp: * rendering/mathml/MathOperator.h: * rendering/mathml/RenderMathMLBlock.cpp: * rendering/mathml/RenderMathMLFenced.cpp: * rendering/mathml/RenderMathMLFencedOperator.cpp: * rendering/mathml/RenderMathMLFraction.cpp: * rendering/mathml/RenderMathMLMath.cpp: * rendering/mathml/RenderMathMLMenclose.cpp: * rendering/mathml/RenderMathMLMenclose.h: * rendering/mathml/RenderMathMLOperator.cpp: * rendering/mathml/RenderMathMLRoot.cpp: * rendering/mathml/RenderMathMLRow.cpp: * rendering/mathml/RenderMathMLScripts.cpp: * rendering/mathml/RenderMathMLUnderOver.cpp: Canonical link: https://commits.webkit.org/179275@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-24 05:56:08 +00:00
#include "MathMLScriptsElement.h"
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-19 05:42:46 +00:00
#if ENABLE(MATHML)
#include "RenderMathMLScripts.h"
Put the DOM in IsoHeaps https://bugs.webkit.org/show_bug.cgi?id=183546 Source/bmalloc: Reviewed by Simon Fraser. Make it easy to runtime-disable IsoHeaps. * bmalloc/Allocator.h: * bmalloc/IsoTLS.cpp: (bmalloc::IsoTLS::determineMallocFallbackState): * bmalloc/IsoTLS.h: * bmalloc/IsoTLSInlines.h: (bmalloc::IsoTLS::allocateSlow): (bmalloc::IsoTLS::deallocateSlow): Source/WebCore: Reviewed by Daniel Bates. No new tests because no change in behavior. This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means that DOM UAFs cannot be used for universal read gadgets. This looks neutral on Speedometer and membuster, though I did have one round of testing that led me to believe that membuster was regressed - I just wasn't able to reproduce that result on subsequent testing. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Attr.cpp: * dom/Attr.h: * dom/CDATASection.cpp: * dom/CDATASection.h: * dom/CharacterData.cpp: * dom/CharacterData.h: * dom/Comment.cpp: * dom/Comment.h: * dom/ContainerNode.cpp: * dom/ContainerNode.h: * dom/Document.cpp: * dom/Document.h: * dom/DocumentFragment.cpp: * dom/DocumentFragment.h: * dom/DocumentType.cpp: * dom/DocumentType.h: * dom/Node.cpp: * dom/Node.h: * dom/ProcessingInstruction.cpp: * dom/ProcessingInstruction.h: * dom/PseudoElement.cpp: * dom/PseudoElement.h: * dom/ShadowRoot.cpp: * dom/ShadowRoot.h: * dom/StyledElement.cpp: * dom/StyledElement.h: * dom/TemplateContentDocumentFragment.cpp: Added. * dom/TemplateContentDocumentFragment.h: * dom/Text.cpp: * dom/Text.h: * dom/XMLDocument.cpp: Added. * dom/XMLDocument.h: * html/FTPDirectoryDocument.cpp: * html/FTPDirectoryDocument.h: * html/FileInputType.cpp: * html/HTMLAnchorElement.cpp: * html/HTMLAnchorElement.h: * html/HTMLAppletElement.cpp: * html/HTMLAppletElement.h: * html/HTMLAreaElement.cpp: * html/HTMLAreaElement.h: * html/HTMLAttachmentElement.cpp: * html/HTMLAttachmentElement.h: * html/HTMLBDIElement.cpp: Added. * html/HTMLBDIElement.h: * html/HTMLBRElement.cpp: * html/HTMLBRElement.h: * html/HTMLBaseElement.cpp: * html/HTMLBaseElement.h: * html/HTMLBodyElement.cpp: * html/HTMLBodyElement.h: * html/HTMLButtonElement.cpp: * html/HTMLButtonElement.h: * html/HTMLCanvasElement.cpp: * html/HTMLCanvasElement.h: * html/HTMLDListElement.cpp: * html/HTMLDListElement.h: * html/HTMLDataElement.cpp: * html/HTMLDataElement.h: * html/HTMLDataListElement.cpp: * html/HTMLDataListElement.h: * html/HTMLDetailsElement.cpp: * html/HTMLDetailsElement.h: * html/HTMLDirectoryElement.cpp: * html/HTMLDirectoryElement.h: * html/HTMLDivElement.cpp: * html/HTMLDivElement.h: * html/HTMLDocument.cpp: * html/HTMLDocument.h: * html/HTMLElement.cpp: * html/HTMLElement.h: * html/HTMLEmbedElement.cpp: * html/HTMLEmbedElement.h: * html/HTMLFieldSetElement.cpp: * html/HTMLFieldSetElement.h: * html/HTMLFontElement.cpp: * html/HTMLFontElement.h: * html/HTMLFormControlElement.cpp: * html/HTMLFormControlElement.h: * html/HTMLFormControlElementWithState.cpp: * html/HTMLFormControlElementWithState.h: * html/HTMLFormElement.cpp: * html/HTMLFormElement.h: * html/HTMLFrameElement.cpp: * html/HTMLFrameElement.h: * html/HTMLFrameElementBase.cpp: * html/HTMLFrameElementBase.h: * html/HTMLFrameOwnerElement.cpp: * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: * html/HTMLFrameSetElement.h: * html/HTMLHRElement.cpp: * html/HTMLHRElement.h: * html/HTMLHeadElement.cpp: * html/HTMLHeadElement.h: * html/HTMLHeadingElement.cpp: * html/HTMLHeadingElement.h: * html/HTMLHtmlElement.cpp: * html/HTMLHtmlElement.h: * html/HTMLIFrameElement.cpp: * html/HTMLIFrameElement.h: * html/HTMLImageElement.cpp: * html/HTMLImageElement.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * html/HTMLKeygenElement.cpp: * html/HTMLKeygenElement.h: * html/HTMLLIElement.cpp: * html/HTMLLIElement.h: * html/HTMLLabelElement.cpp: * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: * html/HTMLLegendElement.h: * html/HTMLLinkElement.cpp: * html/HTMLLinkElement.h: * html/HTMLMapElement.cpp: * html/HTMLMapElement.h: * html/HTMLMarqueeElement.cpp: * html/HTMLMarqueeElement.h: * html/HTMLMenuElement.cpp: * html/HTMLMenuElement.h: * html/HTMLMenuItemElement.cpp: * html/HTMLMenuItemElement.h: * html/HTMLMetaElement.cpp: * html/HTMLMetaElement.h: * html/HTMLMeterElement.cpp: * html/HTMLMeterElement.h: * html/HTMLModElement.cpp: * html/HTMLModElement.h: * html/HTMLOListElement.cpp: * html/HTMLOListElement.h: * html/HTMLObjectElement.cpp: * html/HTMLObjectElement.h: * html/HTMLOptGroupElement.cpp: * html/HTMLOptGroupElement.h: * html/HTMLOptionElement.cpp: * html/HTMLOptionElement.h: * html/HTMLOutputElement.cpp: * html/HTMLOutputElement.h: * html/HTMLParagraphElement.cpp: * html/HTMLParagraphElement.h: * html/HTMLParamElement.cpp: * html/HTMLParamElement.h: * html/HTMLPictureElement.cpp: * html/HTMLPictureElement.h: * html/HTMLPlugInElement.cpp: * html/HTMLPlugInElement.h: * html/HTMLPlugInImageElement.cpp: * html/HTMLPlugInImageElement.h: * html/HTMLPreElement.cpp: * html/HTMLPreElement.h: * html/HTMLProgressElement.cpp: * html/HTMLProgressElement.h: * html/HTMLQuoteElement.cpp: * html/HTMLQuoteElement.h: * html/HTMLScriptElement.cpp: * html/HTMLScriptElement.h: * html/HTMLSelectElement.cpp: * html/HTMLSelectElement.h: * html/HTMLSlotElement.cpp: * html/HTMLSlotElement.h: * html/HTMLSourceElement.cpp: * html/HTMLSourceElement.h: * html/HTMLSpanElement.cpp: * html/HTMLSpanElement.h: * html/HTMLStyleElement.cpp: * html/HTMLStyleElement.h: * html/HTMLSummaryElement.cpp: * html/HTMLSummaryElement.h: * html/HTMLTableCaptionElement.cpp: * html/HTMLTableCaptionElement.h: * html/HTMLTableCellElement.cpp: * html/HTMLTableCellElement.h: * html/HTMLTableColElement.cpp: * html/HTMLTableColElement.h: * html/HTMLTableElement.cpp: * html/HTMLTableElement.h: * html/HTMLTablePartElement.cpp: * html/HTMLTablePartElement.h: * html/HTMLTableRowElement.cpp: * html/HTMLTableRowElement.h: * html/HTMLTableSectionElement.cpp: * html/HTMLTableSectionElement.h: * html/HTMLTemplateElement.cpp: * html/HTMLTemplateElement.h: * html/HTMLTextAreaElement.cpp: * html/HTMLTextAreaElement.h: * html/HTMLTextFormControlElement.cpp: * html/HTMLTextFormControlElement.h: * html/HTMLTimeElement.cpp: * html/HTMLTimeElement.h: * html/HTMLTitleElement.cpp: * html/HTMLTitleElement.h: * html/HTMLTrackElement.cpp: * html/HTMLTrackElement.h: * html/HTMLUListElement.cpp: * html/HTMLUListElement.h: * html/HTMLUnknownElement.cpp: Added. * html/HTMLUnknownElement.h: * html/HTMLWBRElement.cpp: * html/HTMLWBRElement.h: * html/ImageDocument.cpp: * html/ImageDocument.h: * html/LabelableElement.cpp: * html/LabelableElement.h: * html/MediaController.cpp: (MediaController::create): Deleted. (MediaController::MediaController): Deleted. (MediaController::addMediaElement): Deleted. (MediaController::removeMediaElement): Deleted. (MediaController::containsMediaElement const): Deleted. (MediaController::buffered const): Deleted. (MediaController::seekable const): Deleted. (MediaController::played): Deleted. (MediaController::duration const): Deleted. (MediaController::currentTime const): Deleted. (MediaController::setCurrentTime): Deleted. (MediaController::unpause): Deleted. (MediaController::play): Deleted. (MediaController::pause): Deleted. (MediaController::setDefaultPlaybackRate): Deleted. (MediaController::playbackRate const): Deleted. (MediaController::setPlaybackRate): Deleted. (MediaController::setVolume): Deleted. (MediaController::setMuted): Deleted. (playbackStateWaiting): Deleted. (playbackStatePlaying): Deleted. (playbackStateEnded): Deleted. (MediaController::playbackState const): Deleted. (MediaController::reportControllerState): Deleted. (eventNameForReadyState): Deleted. (MediaController::updateReadyState): Deleted. (MediaController::updatePlaybackState): Deleted. (MediaController::updateMediaElements): Deleted. (MediaController::bringElementUpToSpeed): Deleted. (MediaController::isBlocked const): Deleted. (MediaController::hasEnded const): Deleted. (MediaController::scheduleEvent): Deleted. (MediaController::asyncEventTimerFired): Deleted. (MediaController::clearPositionTimerFired): Deleted. (MediaController::hasAudio const): Deleted. (MediaController::hasVideo const): Deleted. (MediaController::hasClosedCaptions const): Deleted. (MediaController::setClosedCaptionsVisible): Deleted. (MediaController::supportsScanning const): Deleted. (MediaController::beginScrubbing): Deleted. (MediaController::endScrubbing): Deleted. (MediaController::beginScanning): Deleted. (MediaController::endScanning): Deleted. (MediaController::canPlay const): Deleted. (MediaController::isLiveStream const): Deleted. (MediaController::hasCurrentSrc const): Deleted. (MediaController::returnToRealtime): Deleted. (MediaController::startTimeupdateTimer): Deleted. (MediaController::scheduleTimeupdateEvent): Deleted. * html/MediaDocument.cpp: * html/MediaDocument.h: * html/PluginDocument.cpp: * html/PluginDocument.h: * html/RubyElement.cpp: * html/RubyElement.h: * html/RubyTextElement.cpp: * html/RubyTextElement.h: * html/TextDocument.cpp: * html/TextDocument.h: * html/shadow/AutoFillButtonElement.cpp: * html/shadow/AutoFillButtonElement.h: * html/shadow/DetailsMarkerControl.cpp: * html/shadow/DetailsMarkerControl.h: * html/shadow/ImageControlsRootElement.cpp: * html/shadow/ImageControlsRootElement.h: * html/shadow/MediaControlElementTypes.cpp: * html/shadow/MediaControlElementTypes.h: * html/shadow/MediaControlElements.cpp: * html/shadow/MediaControlElements.h: * html/shadow/MediaControls.cpp: * html/shadow/MediaControls.h: * html/shadow/ProgressShadowElement.cpp: * html/shadow/ProgressShadowElement.h: * html/shadow/SliderThumbElement.cpp: * html/shadow/SliderThumbElement.h: * html/shadow/SpinButtonElement.cpp: * html/shadow/SpinButtonElement.h: * html/shadow/TextControlInnerElements.cpp: * html/shadow/TextControlInnerElements.h: * html/shadow/YouTubeEmbedShadowElement.cpp: * html/shadow/YouTubeEmbedShadowElement.h: * html/shadow/mac/ImageControlsButtonElementMac.cpp: * html/shadow/mac/ImageControlsButtonElementMac.h: * html/shadow/mac/ImageControlsRootElementMac.cpp: * html/shadow/mac/ImageControlsRootElementMac.h: * html/track/TextTrackCueGeneric.cpp: * html/track/VTTCue.cpp: * html/track/VTTCue.h: * html/track/WebVTTElement.cpp: * html/track/WebVTTElement.h: * loader/SinkDocument.cpp: * loader/SinkDocument.h: * mathml/MathMLAnnotationElement.cpp: * mathml/MathMLAnnotationElement.h: * mathml/MathMLElement.cpp: * mathml/MathMLElement.h: * mathml/MathMLFractionElement.cpp: * mathml/MathMLFractionElement.h: * mathml/MathMLMathElement.cpp: * mathml/MathMLMathElement.h: * mathml/MathMLMencloseElement.cpp: * mathml/MathMLMencloseElement.h: * mathml/MathMLOperatorElement.cpp: * mathml/MathMLOperatorElement.h: * mathml/MathMLPaddedElement.cpp: * mathml/MathMLPaddedElement.h: * mathml/MathMLPresentationElement.cpp: * mathml/MathMLPresentationElement.h: * mathml/MathMLRootElement.cpp: * mathml/MathMLRootElement.h: * mathml/MathMLRowElement.cpp: * mathml/MathMLRowElement.h: * mathml/MathMLScriptsElement.cpp: * mathml/MathMLScriptsElement.h: * mathml/MathMLSelectElement.cpp: * mathml/MathMLSelectElement.h: * mathml/MathMLSpaceElement.cpp: * mathml/MathMLSpaceElement.h: * mathml/MathMLTokenElement.cpp: * mathml/MathMLTokenElement.h: * mathml/MathMLUnderOverElement.cpp: * mathml/MathMLUnderOverElement.h: * mathml/MathMLUnknownElement.cpp: Added. * mathml/MathMLUnknownElement.h: * svg/SVGAElement.cpp: * svg/SVGAElement.h: * svg/SVGAltGlyphDefElement.cpp: * svg/SVGAltGlyphDefElement.h: * svg/SVGAltGlyphElement.cpp: * svg/SVGAltGlyphElement.h: * svg/SVGAltGlyphItemElement.cpp: * svg/SVGAltGlyphItemElement.h: * svg/SVGAnimateColorElement.cpp: * svg/SVGAnimateColorElement.h: * svg/SVGAnimateElement.cpp: * svg/SVGAnimateElement.h: * svg/SVGAnimateElementBase.cpp: * svg/SVGAnimateElementBase.h: * svg/SVGAnimateMotionElement.cpp: * svg/SVGAnimateMotionElement.h: * svg/SVGAnimateTransformElement.cpp: * svg/SVGAnimateTransformElement.h: * svg/SVGAnimationElement.cpp: * svg/SVGAnimationElement.h: * svg/SVGCircleElement.cpp: * svg/SVGCircleElement.h: * svg/SVGClipPathElement.cpp: * svg/SVGClipPathElement.h: * svg/SVGComponentTransferFunctionElement.cpp: * svg/SVGComponentTransferFunctionElement.h: * svg/SVGCursorElement.cpp: * svg/SVGCursorElement.h: * svg/SVGDefsElement.cpp: * svg/SVGDefsElement.h: * svg/SVGDescElement.cpp: * svg/SVGDescElement.h: * svg/SVGDocument.cpp: * svg/SVGDocument.h: * svg/SVGElement.cpp: * svg/SVGElement.h: * svg/SVGEllipseElement.cpp: * svg/SVGEllipseElement.h: * svg/SVGFEBlendElement.cpp: * svg/SVGFEBlendElement.h: * svg/SVGFEColorMatrixElement.cpp: * svg/SVGFEColorMatrixElement.h: * svg/SVGFEComponentTransferElement.cpp: * svg/SVGFEComponentTransferElement.h: * svg/SVGFECompositeElement.cpp: * svg/SVGFECompositeElement.h: * svg/SVGFEConvolveMatrixElement.cpp: * svg/SVGFEConvolveMatrixElement.h: * svg/SVGFEDiffuseLightingElement.cpp: * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFEDisplacementMapElement.cpp: * svg/SVGFEDisplacementMapElement.h: * svg/SVGFEDropShadowElement.cpp: * svg/SVGFEDropShadowElement.h: * svg/SVGFEFloodElement.cpp: * svg/SVGFEFloodElement.h: * svg/SVGFEGaussianBlurElement.cpp: * svg/SVGFEGaussianBlurElement.h: * svg/SVGFEImageElement.cpp: * svg/SVGFEImageElement.h: * svg/SVGFELightElement.cpp: * svg/SVGFELightElement.h: * svg/SVGFEMergeElement.cpp: * svg/SVGFEMergeElement.h: * svg/SVGFEMergeNodeElement.cpp: * svg/SVGFEMergeNodeElement.h: * svg/SVGFEMorphologyElement.cpp: * svg/SVGFEMorphologyElement.h: * svg/SVGFEOffsetElement.cpp: * svg/SVGFEOffsetElement.h: * svg/SVGFESpecularLightingElement.cpp: * svg/SVGFESpecularLightingElement.h: * svg/SVGFETileElement.cpp: * svg/SVGFETileElement.h: * svg/SVGFETurbulenceElement.cpp: * svg/SVGFETurbulenceElement.h: * svg/SVGFilterElement.cpp: * svg/SVGFilterElement.h: * svg/SVGFilterPrimitiveStandardAttributes.cpp: * svg/SVGFilterPrimitiveStandardAttributes.h: * svg/SVGFontFaceElement.cpp: * svg/SVGFontFaceElement.h: * svg/SVGFontFaceFormatElement.cpp: * svg/SVGFontFaceFormatElement.h: * svg/SVGFontFaceNameElement.cpp: * svg/SVGFontFaceNameElement.h: * svg/SVGFontFaceSrcElement.cpp: * svg/SVGFontFaceSrcElement.h: * svg/SVGFontFaceUriElement.cpp: * svg/SVGFontFaceUriElement.h: * svg/SVGForeignObjectElement.cpp: * svg/SVGForeignObjectElement.h: * svg/SVGGElement.cpp: * svg/SVGGElement.h: * svg/SVGGlyphElement.cpp: * svg/SVGGlyphElement.h: * svg/SVGGlyphRefElement.cpp: * svg/SVGGlyphRefElement.h: * svg/SVGGradientElement.cpp: * svg/SVGGradientElement.h: * svg/SVGGraphicsElement.cpp: * svg/SVGGraphicsElement.h: * svg/SVGHKernElement.cpp: * svg/SVGHKernElement.h: * svg/SVGImageElement.cpp: * svg/SVGImageElement.h: * svg/SVGLineElement.cpp: * svg/SVGLineElement.h: * svg/SVGLinearGradientElement.cpp: * svg/SVGLinearGradientElement.h: * svg/SVGMPathElement.cpp: * svg/SVGMPathElement.h: * svg/SVGMarkerElement.cpp: * svg/SVGMarkerElement.h: * svg/SVGMaskElement.cpp: * svg/SVGMaskElement.h: * svg/SVGMetadataElement.cpp: * svg/SVGMetadataElement.h: * svg/SVGMissingGlyphElement.cpp: * svg/SVGMissingGlyphElement.h: * svg/SVGPathElement.cpp: * svg/SVGPathElement.h: * svg/SVGPatternElement.cpp: * svg/SVGPatternElement.h: * svg/SVGPolyElement.cpp: * svg/SVGPolyElement.h: * svg/SVGPolygonElement.cpp: * svg/SVGPolygonElement.h: * svg/SVGPolylineElement.cpp: * svg/SVGPolylineElement.h: * svg/SVGRadialGradientElement.cpp: * svg/SVGRadialGradientElement.h: * svg/SVGRectElement.cpp: * svg/SVGRectElement.h: * svg/SVGSVGElement.cpp: * svg/SVGSVGElement.h: * svg/SVGScriptElement.cpp: * svg/SVGScriptElement.h: * svg/SVGSetElement.cpp: * svg/SVGSetElement.h: * svg/SVGStopElement.cpp: * svg/SVGStopElement.h: * svg/SVGStyleElement.cpp: * svg/SVGStyleElement.h: * svg/SVGSwitchElement.cpp: * svg/SVGSwitchElement.h: * svg/SVGSymbolElement.cpp: * svg/SVGSymbolElement.h: * svg/SVGTRefElement.cpp: * svg/SVGTRefElement.h: * svg/SVGTSpanElement.cpp: * svg/SVGTSpanElement.h: * svg/SVGTextContentElement.cpp: * svg/SVGTextContentElement.h: * svg/SVGTextElement.cpp: * svg/SVGTextElement.h: * svg/SVGTextPathElement.cpp: * svg/SVGTextPathElement.h: * svg/SVGTextPositioningElement.cpp: * svg/SVGTextPositioningElement.h: * svg/SVGTitleElement.cpp: * svg/SVGTitleElement.h: * svg/SVGUnknownElement.cpp: Added. * svg/SVGUnknownElement.h: * svg/SVGUseElement.cpp: * svg/SVGUseElement.h: * svg/SVGVKernElement.cpp: * svg/SVGVKernElement.h: * svg/SVGViewElement.cpp: * svg/SVGViewElement.h: * svg/animation/SVGSMILElement.cpp: * svg/animation/SVGSMILElement.h: Canonical link: https://commits.webkit.org/199361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229694 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-17 06:11:00 +00:00
#include <wtf/IsoMallocInlines.h>
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-19 05:42:46 +00:00
namespace WebCore {
Put the DOM in IsoHeaps https://bugs.webkit.org/show_bug.cgi?id=183546 Source/bmalloc: Reviewed by Simon Fraser. Make it easy to runtime-disable IsoHeaps. * bmalloc/Allocator.h: * bmalloc/IsoTLS.cpp: (bmalloc::IsoTLS::determineMallocFallbackState): * bmalloc/IsoTLS.h: * bmalloc/IsoTLSInlines.h: (bmalloc::IsoTLS::allocateSlow): (bmalloc::IsoTLS::deallocateSlow): Source/WebCore: Reviewed by Daniel Bates. No new tests because no change in behavior. This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means that DOM UAFs cannot be used for universal read gadgets. This looks neutral on Speedometer and membuster, though I did have one round of testing that led me to believe that membuster was regressed - I just wasn't able to reproduce that result on subsequent testing. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Attr.cpp: * dom/Attr.h: * dom/CDATASection.cpp: * dom/CDATASection.h: * dom/CharacterData.cpp: * dom/CharacterData.h: * dom/Comment.cpp: * dom/Comment.h: * dom/ContainerNode.cpp: * dom/ContainerNode.h: * dom/Document.cpp: * dom/Document.h: * dom/DocumentFragment.cpp: * dom/DocumentFragment.h: * dom/DocumentType.cpp: * dom/DocumentType.h: * dom/Node.cpp: * dom/Node.h: * dom/ProcessingInstruction.cpp: * dom/ProcessingInstruction.h: * dom/PseudoElement.cpp: * dom/PseudoElement.h: * dom/ShadowRoot.cpp: * dom/ShadowRoot.h: * dom/StyledElement.cpp: * dom/StyledElement.h: * dom/TemplateContentDocumentFragment.cpp: Added. * dom/TemplateContentDocumentFragment.h: * dom/Text.cpp: * dom/Text.h: * dom/XMLDocument.cpp: Added. * dom/XMLDocument.h: * html/FTPDirectoryDocument.cpp: * html/FTPDirectoryDocument.h: * html/FileInputType.cpp: * html/HTMLAnchorElement.cpp: * html/HTMLAnchorElement.h: * html/HTMLAppletElement.cpp: * html/HTMLAppletElement.h: * html/HTMLAreaElement.cpp: * html/HTMLAreaElement.h: * html/HTMLAttachmentElement.cpp: * html/HTMLAttachmentElement.h: * html/HTMLBDIElement.cpp: Added. * html/HTMLBDIElement.h: * html/HTMLBRElement.cpp: * html/HTMLBRElement.h: * html/HTMLBaseElement.cpp: * html/HTMLBaseElement.h: * html/HTMLBodyElement.cpp: * html/HTMLBodyElement.h: * html/HTMLButtonElement.cpp: * html/HTMLButtonElement.h: * html/HTMLCanvasElement.cpp: * html/HTMLCanvasElement.h: * html/HTMLDListElement.cpp: * html/HTMLDListElement.h: * html/HTMLDataElement.cpp: * html/HTMLDataElement.h: * html/HTMLDataListElement.cpp: * html/HTMLDataListElement.h: * html/HTMLDetailsElement.cpp: * html/HTMLDetailsElement.h: * html/HTMLDirectoryElement.cpp: * html/HTMLDirectoryElement.h: * html/HTMLDivElement.cpp: * html/HTMLDivElement.h: * html/HTMLDocument.cpp: * html/HTMLDocument.h: * html/HTMLElement.cpp: * html/HTMLElement.h: * html/HTMLEmbedElement.cpp: * html/HTMLEmbedElement.h: * html/HTMLFieldSetElement.cpp: * html/HTMLFieldSetElement.h: * html/HTMLFontElement.cpp: * html/HTMLFontElement.h: * html/HTMLFormControlElement.cpp: * html/HTMLFormControlElement.h: * html/HTMLFormControlElementWithState.cpp: * html/HTMLFormControlElementWithState.h: * html/HTMLFormElement.cpp: * html/HTMLFormElement.h: * html/HTMLFrameElement.cpp: * html/HTMLFrameElement.h: * html/HTMLFrameElementBase.cpp: * html/HTMLFrameElementBase.h: * html/HTMLFrameOwnerElement.cpp: * html/HTMLFrameOwnerElement.h: * html/HTMLFrameSetElement.cpp: * html/HTMLFrameSetElement.h: * html/HTMLHRElement.cpp: * html/HTMLHRElement.h: * html/HTMLHeadElement.cpp: * html/HTMLHeadElement.h: * html/HTMLHeadingElement.cpp: * html/HTMLHeadingElement.h: * html/HTMLHtmlElement.cpp: * html/HTMLHtmlElement.h: * html/HTMLIFrameElement.cpp: * html/HTMLIFrameElement.h: * html/HTMLImageElement.cpp: * html/HTMLImageElement.h: * html/HTMLInputElement.cpp: * html/HTMLInputElement.h: * html/HTMLKeygenElement.cpp: * html/HTMLKeygenElement.h: * html/HTMLLIElement.cpp: * html/HTMLLIElement.h: * html/HTMLLabelElement.cpp: * html/HTMLLabelElement.h: * html/HTMLLegendElement.cpp: * html/HTMLLegendElement.h: * html/HTMLLinkElement.cpp: * html/HTMLLinkElement.h: * html/HTMLMapElement.cpp: * html/HTMLMapElement.h: * html/HTMLMarqueeElement.cpp: * html/HTMLMarqueeElement.h: * html/HTMLMenuElement.cpp: * html/HTMLMenuElement.h: * html/HTMLMenuItemElement.cpp: * html/HTMLMenuItemElement.h: * html/HTMLMetaElement.cpp: * html/HTMLMetaElement.h: * html/HTMLMeterElement.cpp: * html/HTMLMeterElement.h: * html/HTMLModElement.cpp: * html/HTMLModElement.h: * html/HTMLOListElement.cpp: * html/HTMLOListElement.h: * html/HTMLObjectElement.cpp: * html/HTMLObjectElement.h: * html/HTMLOptGroupElement.cpp: * html/HTMLOptGroupElement.h: * html/HTMLOptionElement.cpp: * html/HTMLOptionElement.h: * html/HTMLOutputElement.cpp: * html/HTMLOutputElement.h: * html/HTMLParagraphElement.cpp: * html/HTMLParagraphElement.h: * html/HTMLParamElement.cpp: * html/HTMLParamElement.h: * html/HTMLPictureElement.cpp: * html/HTMLPictureElement.h: * html/HTMLPlugInElement.cpp: * html/HTMLPlugInElement.h: * html/HTMLPlugInImageElement.cpp: * html/HTMLPlugInImageElement.h: * html/HTMLPreElement.cpp: * html/HTMLPreElement.h: * html/HTMLProgressElement.cpp: * html/HTMLProgressElement.h: * html/HTMLQuoteElement.cpp: * html/HTMLQuoteElement.h: * html/HTMLScriptElement.cpp: * html/HTMLScriptElement.h: * html/HTMLSelectElement.cpp: * html/HTMLSelectElement.h: * html/HTMLSlotElement.cpp: * html/HTMLSlotElement.h: * html/HTMLSourceElement.cpp: * html/HTMLSourceElement.h: * html/HTMLSpanElement.cpp: * html/HTMLSpanElement.h: * html/HTMLStyleElement.cpp: * html/HTMLStyleElement.h: * html/HTMLSummaryElement.cpp: * html/HTMLSummaryElement.h: * html/HTMLTableCaptionElement.cpp: * html/HTMLTableCaptionElement.h: * html/HTMLTableCellElement.cpp: * html/HTMLTableCellElement.h: * html/HTMLTableColElement.cpp: * html/HTMLTableColElement.h: * html/HTMLTableElement.cpp: * html/HTMLTableElement.h: * html/HTMLTablePartElement.cpp: * html/HTMLTablePartElement.h: * html/HTMLTableRowElement.cpp: * html/HTMLTableRowElement.h: * html/HTMLTableSectionElement.cpp: * html/HTMLTableSectionElement.h: * html/HTMLTemplateElement.cpp: * html/HTMLTemplateElement.h: * html/HTMLTextAreaElement.cpp: * html/HTMLTextAreaElement.h: * html/HTMLTextFormControlElement.cpp: * html/HTMLTextFormControlElement.h: * html/HTMLTimeElement.cpp: * html/HTMLTimeElement.h: * html/HTMLTitleElement.cpp: * html/HTMLTitleElement.h: * html/HTMLTrackElement.cpp: * html/HTMLTrackElement.h: * html/HTMLUListElement.cpp: * html/HTMLUListElement.h: * html/HTMLUnknownElement.cpp: Added. * html/HTMLUnknownElement.h: * html/HTMLWBRElement.cpp: * html/HTMLWBRElement.h: * html/ImageDocument.cpp: * html/ImageDocument.h: * html/LabelableElement.cpp: * html/LabelableElement.h: * html/MediaController.cpp: (MediaController::create): Deleted. (MediaController::MediaController): Deleted. (MediaController::addMediaElement): Deleted. (MediaController::removeMediaElement): Deleted. (MediaController::containsMediaElement const): Deleted. (MediaController::buffered const): Deleted. (MediaController::seekable const): Deleted. (MediaController::played): Deleted. (MediaController::duration const): Deleted. (MediaController::currentTime const): Deleted. (MediaController::setCurrentTime): Deleted. (MediaController::unpause): Deleted. (MediaController::play): Deleted. (MediaController::pause): Deleted. (MediaController::setDefaultPlaybackRate): Deleted. (MediaController::playbackRate const): Deleted. (MediaController::setPlaybackRate): Deleted. (MediaController::setVolume): Deleted. (MediaController::setMuted): Deleted. (playbackStateWaiting): Deleted. (playbackStatePlaying): Deleted. (playbackStateEnded): Deleted. (MediaController::playbackState const): Deleted. (MediaController::reportControllerState): Deleted. (eventNameForReadyState): Deleted. (MediaController::updateReadyState): Deleted. (MediaController::updatePlaybackState): Deleted. (MediaController::updateMediaElements): Deleted. (MediaController::bringElementUpToSpeed): Deleted. (MediaController::isBlocked const): Deleted. (MediaController::hasEnded const): Deleted. (MediaController::scheduleEvent): Deleted. (MediaController::asyncEventTimerFired): Deleted. (MediaController::clearPositionTimerFired): Deleted. (MediaController::hasAudio const): Deleted. (MediaController::hasVideo const): Deleted. (MediaController::hasClosedCaptions const): Deleted. (MediaController::setClosedCaptionsVisible): Deleted. (MediaController::supportsScanning const): Deleted. (MediaController::beginScrubbing): Deleted. (MediaController::endScrubbing): Deleted. (MediaController::beginScanning): Deleted. (MediaController::endScanning): Deleted. (MediaController::canPlay const): Deleted. (MediaController::isLiveStream const): Deleted. (MediaController::hasCurrentSrc const): Deleted. (MediaController::returnToRealtime): Deleted. (MediaController::startTimeupdateTimer): Deleted. (MediaController::scheduleTimeupdateEvent): Deleted. * html/MediaDocument.cpp: * html/MediaDocument.h: * html/PluginDocument.cpp: * html/PluginDocument.h: * html/RubyElement.cpp: * html/RubyElement.h: * html/RubyTextElement.cpp: * html/RubyTextElement.h: * html/TextDocument.cpp: * html/TextDocument.h: * html/shadow/AutoFillButtonElement.cpp: * html/shadow/AutoFillButtonElement.h: * html/shadow/DetailsMarkerControl.cpp: * html/shadow/DetailsMarkerControl.h: * html/shadow/ImageControlsRootElement.cpp: * html/shadow/ImageControlsRootElement.h: * html/shadow/MediaControlElementTypes.cpp: * html/shadow/MediaControlElementTypes.h: * html/shadow/MediaControlElements.cpp: * html/shadow/MediaControlElements.h: * html/shadow/MediaControls.cpp: * html/shadow/MediaControls.h: * html/shadow/ProgressShadowElement.cpp: * html/shadow/ProgressShadowElement.h: * html/shadow/SliderThumbElement.cpp: * html/shadow/SliderThumbElement.h: * html/shadow/SpinButtonElement.cpp: * html/shadow/SpinButtonElement.h: * html/shadow/TextControlInnerElements.cpp: * html/shadow/TextControlInnerElements.h: * html/shadow/YouTubeEmbedShadowElement.cpp: * html/shadow/YouTubeEmbedShadowElement.h: * html/shadow/mac/ImageControlsButtonElementMac.cpp: * html/shadow/mac/ImageControlsButtonElementMac.h: * html/shadow/mac/ImageControlsRootElementMac.cpp: * html/shadow/mac/ImageControlsRootElementMac.h: * html/track/TextTrackCueGeneric.cpp: * html/track/VTTCue.cpp: * html/track/VTTCue.h: * html/track/WebVTTElement.cpp: * html/track/WebVTTElement.h: * loader/SinkDocument.cpp: * loader/SinkDocument.h: * mathml/MathMLAnnotationElement.cpp: * mathml/MathMLAnnotationElement.h: * mathml/MathMLElement.cpp: * mathml/MathMLElement.h: * mathml/MathMLFractionElement.cpp: * mathml/MathMLFractionElement.h: * mathml/MathMLMathElement.cpp: * mathml/MathMLMathElement.h: * mathml/MathMLMencloseElement.cpp: * mathml/MathMLMencloseElement.h: * mathml/MathMLOperatorElement.cpp: * mathml/MathMLOperatorElement.h: * mathml/MathMLPaddedElement.cpp: * mathml/MathMLPaddedElement.h: * mathml/MathMLPresentationElement.cpp: * mathml/MathMLPresentationElement.h: * mathml/MathMLRootElement.cpp: * mathml/MathMLRootElement.h: * mathml/MathMLRowElement.cpp: * mathml/MathMLRowElement.h: * mathml/MathMLScriptsElement.cpp: * mathml/MathMLScriptsElement.h: * mathml/MathMLSelectElement.cpp: * mathml/MathMLSelectElement.h: * mathml/MathMLSpaceElement.cpp: * mathml/MathMLSpaceElement.h: * mathml/MathMLTokenElement.cpp: * mathml/MathMLTokenElement.h: * mathml/MathMLUnderOverElement.cpp: * mathml/MathMLUnderOverElement.h: * mathml/MathMLUnknownElement.cpp: Added. * mathml/MathMLUnknownElement.h: * svg/SVGAElement.cpp: * svg/SVGAElement.h: * svg/SVGAltGlyphDefElement.cpp: * svg/SVGAltGlyphDefElement.h: * svg/SVGAltGlyphElement.cpp: * svg/SVGAltGlyphElement.h: * svg/SVGAltGlyphItemElement.cpp: * svg/SVGAltGlyphItemElement.h: * svg/SVGAnimateColorElement.cpp: * svg/SVGAnimateColorElement.h: * svg/SVGAnimateElement.cpp: * svg/SVGAnimateElement.h: * svg/SVGAnimateElementBase.cpp: * svg/SVGAnimateElementBase.h: * svg/SVGAnimateMotionElement.cpp: * svg/SVGAnimateMotionElement.h: * svg/SVGAnimateTransformElement.cpp: * svg/SVGAnimateTransformElement.h: * svg/SVGAnimationElement.cpp: * svg/SVGAnimationElement.h: * svg/SVGCircleElement.cpp: * svg/SVGCircleElement.h: * svg/SVGClipPathElement.cpp: * svg/SVGClipPathElement.h: * svg/SVGComponentTransferFunctionElement.cpp: * svg/SVGComponentTransferFunctionElement.h: * svg/SVGCursorElement.cpp: * svg/SVGCursorElement.h: * svg/SVGDefsElement.cpp: * svg/SVGDefsElement.h: * svg/SVGDescElement.cpp: * svg/SVGDescElement.h: * svg/SVGDocument.cpp: * svg/SVGDocument.h: * svg/SVGElement.cpp: * svg/SVGElement.h: * svg/SVGEllipseElement.cpp: * svg/SVGEllipseElement.h: * svg/SVGFEBlendElement.cpp: * svg/SVGFEBlendElement.h: * svg/SVGFEColorMatrixElement.cpp: * svg/SVGFEColorMatrixElement.h: * svg/SVGFEComponentTransferElement.cpp: * svg/SVGFEComponentTransferElement.h: * svg/SVGFECompositeElement.cpp: * svg/SVGFECompositeElement.h: * svg/SVGFEConvolveMatrixElement.cpp: * svg/SVGFEConvolveMatrixElement.h: * svg/SVGFEDiffuseLightingElement.cpp: * svg/SVGFEDiffuseLightingElement.h: * svg/SVGFEDisplacementMapElement.cpp: * svg/SVGFEDisplacementMapElement.h: * svg/SVGFEDropShadowElement.cpp: * svg/SVGFEDropShadowElement.h: * svg/SVGFEFloodElement.cpp: * svg/SVGFEFloodElement.h: * svg/SVGFEGaussianBlurElement.cpp: * svg/SVGFEGaussianBlurElement.h: * svg/SVGFEImageElement.cpp: * svg/SVGFEImageElement.h: * svg/SVGFELightElement.cpp: * svg/SVGFELightElement.h: * svg/SVGFEMergeElement.cpp: * svg/SVGFEMergeElement.h: * svg/SVGFEMergeNodeElement.cpp: * svg/SVGFEMergeNodeElement.h: * svg/SVGFEMorphologyElement.cpp: * svg/SVGFEMorphologyElement.h: * svg/SVGFEOffsetElement.cpp: * svg/SVGFEOffsetElement.h: * svg/SVGFESpecularLightingElement.cpp: * svg/SVGFESpecularLightingElement.h: * svg/SVGFETileElement.cpp: * svg/SVGFETileElement.h: * svg/SVGFETurbulenceElement.cpp: * svg/SVGFETurbulenceElement.h: * svg/SVGFilterElement.cpp: * svg/SVGFilterElement.h: * svg/SVGFilterPrimitiveStandardAttributes.cpp: * svg/SVGFilterPrimitiveStandardAttributes.h: * svg/SVGFontFaceElement.cpp: * svg/SVGFontFaceElement.h: * svg/SVGFontFaceFormatElement.cpp: * svg/SVGFontFaceFormatElement.h: * svg/SVGFontFaceNameElement.cpp: * svg/SVGFontFaceNameElement.h: * svg/SVGFontFaceSrcElement.cpp: * svg/SVGFontFaceSrcElement.h: * svg/SVGFontFaceUriElement.cpp: * svg/SVGFontFaceUriElement.h: * svg/SVGForeignObjectElement.cpp: * svg/SVGForeignObjectElement.h: * svg/SVGGElement.cpp: * svg/SVGGElement.h: * svg/SVGGlyphElement.cpp: * svg/SVGGlyphElement.h: * svg/SVGGlyphRefElement.cpp: * svg/SVGGlyphRefElement.h: * svg/SVGGradientElement.cpp: * svg/SVGGradientElement.h: * svg/SVGGraphicsElement.cpp: * svg/SVGGraphicsElement.h: * svg/SVGHKernElement.cpp: * svg/SVGHKernElement.h: * svg/SVGImageElement.cpp: * svg/SVGImageElement.h: * svg/SVGLineElement.cpp: * svg/SVGLineElement.h: * svg/SVGLinearGradientElement.cpp: * svg/SVGLinearGradientElement.h: * svg/SVGMPathElement.cpp: * svg/SVGMPathElement.h: * svg/SVGMarkerElement.cpp: * svg/SVGMarkerElement.h: * svg/SVGMaskElement.cpp: * svg/SVGMaskElement.h: * svg/SVGMetadataElement.cpp: * svg/SVGMetadataElement.h: * svg/SVGMissingGlyphElement.cpp: * svg/SVGMissingGlyphElement.h: * svg/SVGPathElement.cpp: * svg/SVGPathElement.h: * svg/SVGPatternElement.cpp: * svg/SVGPatternElement.h: * svg/SVGPolyElement.cpp: * svg/SVGPolyElement.h: * svg/SVGPolygonElement.cpp: * svg/SVGPolygonElement.h: * svg/SVGPolylineElement.cpp: * svg/SVGPolylineElement.h: * svg/SVGRadialGradientElement.cpp: * svg/SVGRadialGradientElement.h: * svg/SVGRectElement.cpp: * svg/SVGRectElement.h: * svg/SVGSVGElement.cpp: * svg/SVGSVGElement.h: * svg/SVGScriptElement.cpp: * svg/SVGScriptElement.h: * svg/SVGSetElement.cpp: * svg/SVGSetElement.h: * svg/SVGStopElement.cpp: * svg/SVGStopElement.h: * svg/SVGStyleElement.cpp: * svg/SVGStyleElement.h: * svg/SVGSwitchElement.cpp: * svg/SVGSwitchElement.h: * svg/SVGSymbolElement.cpp: * svg/SVGSymbolElement.h: * svg/SVGTRefElement.cpp: * svg/SVGTRefElement.h: * svg/SVGTSpanElement.cpp: * svg/SVGTSpanElement.h: * svg/SVGTextContentElement.cpp: * svg/SVGTextContentElement.h: * svg/SVGTextElement.cpp: * svg/SVGTextElement.h: * svg/SVGTextPathElement.cpp: * svg/SVGTextPathElement.h: * svg/SVGTextPositioningElement.cpp: * svg/SVGTextPositioningElement.h: * svg/SVGTitleElement.cpp: * svg/SVGTitleElement.h: * svg/SVGUnknownElement.cpp: Added. * svg/SVGUnknownElement.h: * svg/SVGUseElement.cpp: * svg/SVGUseElement.h: * svg/SVGVKernElement.cpp: * svg/SVGVKernElement.h: * svg/SVGViewElement.cpp: * svg/SVGViewElement.h: * svg/animation/SVGSMILElement.cpp: * svg/animation/SVGSMILElement.h: Canonical link: https://commits.webkit.org/199361@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229694 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-03-17 06:11:00 +00:00
WTF_MAKE_ISO_ALLOCATED_IMPL(MathMLScriptsElement);
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-19 05:42:46 +00:00
using namespace MathMLNames;
static MathMLScriptsElement::ScriptType scriptTypeOf(const QualifiedName& tagName)
Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes https://bugs.webkit.org/show_bug.cgi?id=161300 Patch by Frederic Wang <fwang@igalia.com> on 2017-12-04 Reviewed by Darin Adler. RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the constructors of the renderer classes from the tag name of the corresponding elements. This patch moves them into the corresponding element classes and makes them const members parsed in the constructors. It also introduces a MathMLRootElement class deriving from MathMLRowElement to store the new member. Finally, the types are redefined as enum classes. No new tests, behavior unchanged and already covered by existing tests. * Sources.txt: Add MathMLRootElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLRootElement.cpp: (WebCore::element): Override this function to downcast to MathMLRootElement. (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot. (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type. (WebCore::MathMLRootElement::create): (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement. * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType member exposed to the renderer class. * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h. (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement. * mathml/MathMLScriptsElement.cpp: Introduce a script type. (WebCore::scriptTypeOf): Helper function to parse the script type, moved from RenerMathMLScripts. (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type. * mathml/MathMLScriptsElement.h: Add new script type member. (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer class. * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement. * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of the root type. (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from the element class. (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class values. (WebCore::RenderMathMLRoot::getBase const): Ditto. (WebCore::RenderMathMLRoot::getIndex const): Ditto. (WebCore::RenderMathMLRoot::horizontalParameters): Ditto. (WebCore::RenderMathMLRoot::verticalParameters): Ditto. (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLRoot::layoutBlock): Ditto. (WebCore::RenderMathMLRoot::paint): Ditto. * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove the m_kind member. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type. (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type from the element class. (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLScripts::verticalMetrics): Ditto. (WebCore::RenderMathMLScripts::layoutBlock): Ditto. * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the scriptType() function and remove the m_scriptType member. * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLUnderOver::under const): Ditto. (WebCore::RenderMathMLUnderOver::over const): Ditto. (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto. (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto. Canonical link: https://commits.webkit.org/196319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-04 11:30:10 +00:00
{
if (tagName.matches(msubTag))
return MathMLScriptsElement::ScriptType::Sub;
if (tagName.matches(msupTag))
return MathMLScriptsElement::ScriptType::Super;
if (tagName.matches(msubsupTag))
return MathMLScriptsElement::ScriptType::SubSup;
if (tagName.matches(munderTag))
return MathMLScriptsElement::ScriptType::Under;
if (tagName.matches(moverTag))
return MathMLScriptsElement::ScriptType::Over;
if (tagName.matches(munderoverTag))
return MathMLScriptsElement::ScriptType::UnderOver;
ASSERT(tagName.matches(mmultiscriptsTag));
return MathMLScriptsElement::ScriptType::Multiscripts;
Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes https://bugs.webkit.org/show_bug.cgi?id=161300 Patch by Frederic Wang <fwang@igalia.com> on 2017-12-04 Reviewed by Darin Adler. RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the constructors of the renderer classes from the tag name of the corresponding elements. This patch moves them into the corresponding element classes and makes them const members parsed in the constructors. It also introduces a MathMLRootElement class deriving from MathMLRowElement to store the new member. Finally, the types are redefined as enum classes. No new tests, behavior unchanged and already covered by existing tests. * Sources.txt: Add MathMLRootElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLRootElement.cpp: (WebCore::element): Override this function to downcast to MathMLRootElement. (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot. (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type. (WebCore::MathMLRootElement::create): (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement. * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType member exposed to the renderer class. * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h. (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement. * mathml/MathMLScriptsElement.cpp: Introduce a script type. (WebCore::scriptTypeOf): Helper function to parse the script type, moved from RenerMathMLScripts. (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type. * mathml/MathMLScriptsElement.h: Add new script type member. (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer class. * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement. * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of the root type. (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from the element class. (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class values. (WebCore::RenderMathMLRoot::getBase const): Ditto. (WebCore::RenderMathMLRoot::getIndex const): Ditto. (WebCore::RenderMathMLRoot::horizontalParameters): Ditto. (WebCore::RenderMathMLRoot::verticalParameters): Ditto. (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLRoot::layoutBlock): Ditto. (WebCore::RenderMathMLRoot::paint): Ditto. * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove the m_kind member. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type. (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type from the element class. (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLScripts::verticalMetrics): Ditto. (WebCore::RenderMathMLScripts::layoutBlock): Ditto. * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the scriptType() function and remove the m_scriptType member. * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLUnderOver::under const): Ditto. (WebCore::RenderMathMLUnderOver::over const): Ditto. (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto. (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto. Canonical link: https://commits.webkit.org/196319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-04 11:30:10 +00:00
}
Move parsing of accentunder and accent attributes from renderer to element classes https://bugs.webkit.org/show_bug.cgi?id=159625 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-21 Reviewed by Brent Fulgham. We introduce a new MathMLUnderOverElement that is used for elements munder, mover and munderover in order to create RenderMathMLUnderOver and parse and expose the values of the accent and accentunder attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). We also do minor clean-up for this and previous renderer classes that no longer do attribute parsing: the MathMLNames namespace is no longer necessary and constructors can take a more accurate element type. No new tests, already covered by existing test. * CMakeLists.txt: Add MathMLUnderOverElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLElement.cpp: (WebCore::MathMLElement::cachedBooleanAttribute): Add parsing of boolean attributes. * mathml/MathMLElement.h: New type and helper functions for boolean attributes. * mathml/MathMLInlineContainerElement.cpp: (WebCore::MathMLInlineContainerElement::createElementRenderer): Remove handling of under/over/underover elements. * mathml/MathMLScriptsElement.cpp: (WebCore::MathMLScriptsElement::MathMLScriptsElement): Remove inline keyword to avoid link errors now that MathMLUnderOverElement overrides that class. * mathml/MathMLScriptsElement.h: Allow MathMLUnderOverElement to override this class. * mathml/MathMLUnderOverElement.cpp: (WebCore::MathMLUnderOverElement::MathMLUnderOverElement): (WebCore::MathMLUnderOverElement::create): (WebCore::MathMLUnderOverElement::accent): Helper function to access the accent value. (WebCore::MathMLUnderOverElement::accentUnder): Helper function to access the accentunder value. (WebCore::MathMLUnderOverElement::parseAttribute): Make accent and accentunder dirty. (WebCore::MathMLUnderOverElement::createElementRenderer): Create RenderMathMLUnderOver * mathml/MathMLUnderOverElement.h: * mathml/mathtags.in: Map under/over/underover to MathMLUnderOverElement. * rendering/mathml/RenderMathMLFraction.cpp: Remove MathMLNames and make the constructor take a MathMLFractionElement. (WebCore::RenderMathMLFraction::RenderMathMLFraction): * rendering/mathml/RenderMathMLFraction.h: * rendering/mathml/RenderMathMLPadded.cpp: Remove MathMLNames and make the constructor take a MathMLPaddedElement. (WebCore::RenderMathMLPadded::RenderMathMLPadded): * rendering/mathml/RenderMathMLPadded.h: * rendering/mathml/RenderMathMLScripts.cpp: Remove MathMLNames and make the constructor take a MathMLScriptsElement. Also rename scriptsElement() to element(). (WebCore::RenderMathMLScripts::RenderMathMLScripts): (WebCore::RenderMathMLScripts::element): (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): (WebCore::RenderMathMLScripts::scriptsElement): Deleted. * rendering/mathml/RenderMathMLScripts.h: * rendering/mathml/RenderMathMLUnderOver.cpp: Remove MathMLNames and make the constructor take a RenderMathMLUnderOver. (WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver): (WebCore::RenderMathMLUnderOver::element): (WebCore::RenderMathMLUnderOver::hasAccent): Use the helper functions for accent and accentunder. * rendering/mathml/RenderMathMLUnderOver.h: Canonical link: https://commits.webkit.org/178228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-22 05:33:01 +00:00
MathMLScriptsElement::MathMLScriptsElement(const QualifiedName& tagName, Document& document)
Rename MathMLInlineContainerElement to MathMLPresentationElement https://bugs.webkit.org/show_bug.cgi?id=161053 Patch by Frederic Wang <fwang@igalia.com> on 2016-08-23 Reviewed by Manuel Rego Casasnovas. MathMLInlineContainerElement sounds a bad name for something that is now going to produce RenderMathMLBlocks. MathML has two kinds of markup (presentation MathML and content MathML). We only implement presentation MathML and most of the MathML elements are currently implemented as MathMLInlineContainerElement. Hence we rename MathMLInlineContainerElement to MathMLPresentationElement and will move more code from MathMLElement into that new class in follow-up bugs. Also, other elements in the MathML namespace could be handled by a separate MathMLUnknownElement class for consistency with SVG and HTML classes. No new tests, behavior is unchanged. * CMakeLists.txt: Rename MathMLInlineContainerElement to MathMLPresentationElement. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLFractionElement.cpp: Ditto. * mathml/MathMLFractionElement.h: Ditto. * mathml/MathMLPresentationElement.cpp: Ditto. * mathml/MathMLPresentationElement.h: Ditto. * mathml/MathMLRowElement.cpp: Ditto. * mathml/MathMLRowElement.h: Ditto. * mathml/MathMLScriptsElement.cpp: Ditto. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Ditto. * rendering/mathml/RenderMathMLFraction.h: Remove useless include. Canonical link: https://commits.webkit.org/179225@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-23 11:36:28 +00:00
: MathMLPresentationElement(tagName, document)
Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes https://bugs.webkit.org/show_bug.cgi?id=161300 Patch by Frederic Wang <fwang@igalia.com> on 2017-12-04 Reviewed by Darin Adler. RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the constructors of the renderer classes from the tag name of the corresponding elements. This patch moves them into the corresponding element classes and makes them const members parsed in the constructors. It also introduces a MathMLRootElement class deriving from MathMLRowElement to store the new member. Finally, the types are redefined as enum classes. No new tests, behavior unchanged and already covered by existing tests. * Sources.txt: Add MathMLRootElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLRootElement.cpp: (WebCore::element): Override this function to downcast to MathMLRootElement. (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot. (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type. (WebCore::MathMLRootElement::create): (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement. * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType member exposed to the renderer class. * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h. (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement. * mathml/MathMLScriptsElement.cpp: Introduce a script type. (WebCore::scriptTypeOf): Helper function to parse the script type, moved from RenerMathMLScripts. (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type. * mathml/MathMLScriptsElement.h: Add new script type member. (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer class. * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement. * rendering/mathml/RenderMathMLRoot.cpp: (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of the root type. (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from the element class. (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class values. (WebCore::RenderMathMLRoot::getBase const): Ditto. (WebCore::RenderMathMLRoot::getIndex const): Ditto. (WebCore::RenderMathMLRoot::horizontalParameters): Ditto. (WebCore::RenderMathMLRoot::verticalParameters): Ditto. (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLRoot::layoutBlock): Ditto. (WebCore::RenderMathMLRoot::paint): Ditto. * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove the m_kind member. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type. (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type from the element class. (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLScripts::verticalMetrics): Ditto. (WebCore::RenderMathMLScripts::layoutBlock): Ditto. * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the scriptType() function and remove the m_scriptType member. * rendering/mathml/RenderMathMLUnderOver.cpp: (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum class values. (WebCore::RenderMathMLUnderOver::under const): Ditto. (WebCore::RenderMathMLUnderOver::over const): Ditto. (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto. (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto. (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto. Canonical link: https://commits.webkit.org/196319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-04 11:30:10 +00:00
, m_scriptType(scriptTypeOf(tagName))
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
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);
}
void MathMLScriptsElement::parseAttribute(const QualifiedName& name, const AtomString& value)
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
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;
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
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;
Move parsing of subscriptshift and superscriptshift from rendering to element classes https://bugs.webkit.org/show_bug.cgi?id=159622 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-18 Reviewed by Darin Adler. We introduce a new MathMLScriptsElement that is used for elements msub, msup, msubsup and mmultiscripts in order to create RenderMathMLScripts and parse and expose the values of the subscriptshift and superscriptshift attributes. This is one more step toward moving MathML attribute parsing to the DOM (bug 156536). No new tests, rendering is unchanged. * CMakeLists.txt: Add MathMLScriptsElement files. * WebCore.xcodeproj/project.pbxproj: Ditto. * mathml/MathMLAllInOne.cpp: Ditto. * mathml/MathMLInlineContainerElement.cpp: Remove handling of scripts. (WebCore::MathMLInlineContainerElement::createElementRenderer): Deleted. * mathml/MathMLScriptsElement.cpp: Added. New class to handle scripted elements supporting parsing for the subscriptshift and superscriptshift MathML lengths. (WebCore::MathMLScriptsElement::MathMLScriptsElement): (WebCore::MathMLScriptsElement::create): (WebCore::MathMLScriptsElement::subscriptShift): Expose the cached length for the shift, parsing the attribute again if necessary. (WebCore::MathMLScriptsElement::superscriptShift): Ditto. (WebCore::MathMLScriptsElement::parseAttribute): Mark attributes dirty. (WebCore::MathMLScriptsElement::createElementRenderer): Create RenderMathMLScripts. * mathml/MathMLScriptsElement.h: Ditto. * mathml/mathtags.in: Map msub, msup, msubsup and mmultiscripts to MathMLScriptsElement. * rendering/mathml/RenderMathMLScripts.cpp: (WebCore::RenderMathMLScripts::scriptsElement): Helper function to cast the node to a MathMLScriptsElement. (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Resolve the attributes using the functions from the MathMLScriptsElement class. * rendering/mathml/RenderMathMLScripts.h: Declare scriptsElement. Canonical link: https://commits.webkit.org/178080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203396 268f45cc-cd09-0410-ab3c-d52691b4dbfc
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)