Move parsing of mspace attributes to a MathMLSpaceElement class
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jul 2016 05:59:55 +0000 (05:59 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jul 2016 05:59:55 +0000 (05:59 +0000)
commit8afbe0d4bf6e6ef58ca168ef052ede33e6efc072
tree3cd285486c58cfcc8166eca08dfe1e877c1dfe98
parent138dc41ec3687555e9ba9d374c5bb84b17974d4f
Move parsing of mspace attributes to a MathMLSpaceElement class
https://bugs.webkit.org/show_bug.cgi?id=156795

Patch by Frederic Wang <fwang@igalia.org> on 2016-07-11
Reviewed by Brent Fulgham.

No new tests, already covered by existing tests.

* CMakeLists.txt: Add MathMLSpaceElement to the build system.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::cachedMathMLLength): Helper function to returned the cached parsed
value of a MathML length and parsing the corresponding attribute value if the cache is dirty.
* mathml/MathMLElement.h: Add a dirty boolean to MathML Length structure. Declare cachedMathMLLength.
* mathml/MathMLSpaceElement.cpp: New class for the <mspace> element.
(WebCore::MathMLSpaceElement::MathMLSpaceElement):
(WebCore::MathMLSpaceElement::create):
(WebCore::MathMLSpaceElement::parseAttribute): Make width, height, depth attributes dirty.
(WebCore::MathMLSpaceElement::createElementRenderer):
* mathml/MathMLSpaceElement.h: New class for the <mspace> element.
We define MathML lengths for width, height and depth attributes are on the class and expose
with the corresponding helper functions via memoization.
* mathml/MathMLTextElement.cpp: Remove handling of mspace from this class.
(WebCore::MathMLTextElement::createElementRenderer):
* mathml/mathtags.in: Change the interface for mspace to use the new class.
* rendering/mathml/RenderMathMLSpace.cpp: Do not store width/height/depth values on the
renderer and instead just use the corresponding MathML lengths on the element class.
(WebCore::RenderMathMLSpace::RenderMathMLSpace): Use MathMLSpaceElement and remove member
initialization.
(WebCore::RenderMathMLSpace::computePreferredLogicalWidths): Use spaceWidth().
(WebCore::RenderMathMLSpace::spaceWidth): Helper function to resolve the width attribute value.
(WebCore::RenderMathMLSpace::getSpaceHeightAndDepth): Ditto for height and depth.
(WebCore::RenderMathMLSpace::layoutBlock): Use the helper functions to get the mspace metrics.
(WebCore::RenderMathMLSpace::firstLineBaseline): Ditto.
(WebCore::RenderMathMLSpace::updateFromElement): Deleted.
(WebCore::RenderMathMLSpace::styleDidChange): Deleted.
* rendering/mathml/RenderMathMLSpace.h: Use MathMLSpaceElement, replace members with helper
functions and and make element() usable from a const instance.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203108 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/mathml/MathMLElement.cpp
Source/WebCore/mathml/MathMLElement.h
Source/WebCore/mathml/MathMLSpaceElement.cpp [new file with mode: 0644]
Source/WebCore/mathml/MathMLSpaceElement.h [new file with mode: 0644]
Source/WebCore/mathml/MathMLTextElement.cpp
Source/WebCore/mathml/mathtags.in
Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp
Source/WebCore/rendering/mathml/RenderMathMLSpace.h