Changeset 202960 in webkit
- Timestamp:
- Jul 7, 2016 10:40:20 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202959 r202960 1 2016-07-07 Frederic Wang <fwang@igalia.com> 2 3 Implement an internal style property for displaystyle. 4 https://bugs.webkit.org/show_bug.cgi?id=133845 5 6 Reviewed by Brent Fulgham. 7 8 This is based on a patch by Alejandro G. Castro <alex@igalia.com> 9 10 Add two new tests to verify that the displaystyle property is correctly inherited 11 on various MathML elements. 12 large-operators-displaystyle verifies that large operators are only drawn bigger when 13 the displaystyle is true. 14 large-operators-displaystyle-dynamic verifies the same displaystyle is calculated when 15 the display and displaystyle attributes are changed dynamically. 16 17 * mathml/opentype/large-operators-displaystyle-dynamic-expected.html: Added. 18 * mathml/opentype/large-operators-displaystyle-dynamic.html: Added. 19 * mathml/opentype/large-operators-displaystyle-expected.txt: Added. 20 * imported/mathml-in-html5/fonts/math/largeop-displayoperatorminheight5000.woff: Added. 21 * imported/mathml-in-html5/mathml/relations/css-styling/displaystyle-1.html: Added. 22 * imported/mathml-in-html5/mathml/relations/css-styling/displaystyle-1-expected.txt: Added. 23 1 24 2016-07-07 Frederic Wang <fwang@igalia.com> 2 25 -
trunk/Source/WebCore/CMakeLists.txt
r202937 r202960 2524 2524 2525 2525 rendering/mathml/MathMLOperatorDictionary.cpp 2526 rendering/mathml/MathMLStyle.cpp 2526 2527 rendering/mathml/MathOperator.cpp 2527 2528 rendering/mathml/RenderMathMLBlock.cpp -
trunk/Source/WebCore/ChangeLog
r202953 r202960 1 2016-07-07 Frederic Wang <fwang@igalia.com> 2 3 Implement an internal style property for displaystyle. 4 https://bugs.webkit.org/show_bug.cgi?id=133845 5 6 Reviewed by Brent Fulgham. 7 8 Tests: mathml/opentype/large-operators-displaystyle-dynamic.html 9 mathml/opentype/large-operators-displaystyle.html 10 11 This is based on a patch by Alejandro G. Castro <alex@igalia.com> 12 13 * CMakeLists.txt: Add MathMLStyle to the build system. 14 * WebCore.xcodeproj/project.pbxproj: ditto. 15 * mathml/MathMLInlineContainerElement.cpp: 16 (WebCore::MathMLInlineContainerElement::parseAttribute): Resolve the mathml style when the 17 displaystyle attribute changes on the mtable or mstyle elements. 18 * mathml/MathMLInlineContainerElement.h: Define parseAttribute. 19 * mathml/MathMLMathElement.cpp: 20 (WebCore::MathMLMathElement::MathMLMathElement): Indicate that we have custom style. 21 (WebCore::MathMLMathElement::parseAttribute): Resolve the mathml style when the display or 22 displaystyle attributes change on the math element. 23 (WebCore::MathMLMathElement::didAttachRenderers): Resolve the mathml style when one 24 renderer is attached. 25 * mathml/MathMLMathElement.h: Declare parseAttribute and didAttachRenderers. 26 * mathml/mathattrs.in: Declare the display and displaystyle attributes. 27 * rendering/mathml/MathMLStyle.cpp: Added. 28 (WebCore::MathMLStyle::MathMLStyle): New class to handle custom MathML style. 29 (WebCore::MathMLStyle::create): 30 (WebCore::MathMLStyle::setDisplayStyle): Helper function to take the displaystyle from 31 the specified rendered. 32 (WebCore::MathMLStyle::resolveMathMLStyleTree): Helper function to resolve the custom 33 MathML style in renderer subtree. 34 (WebCore::MathMLStyle::getMathMLParentNode): Helper function to get a MathML ancestor of 35 the specified renderer. 36 (WebCore::MathMLStyle::updateStyleIfNeeded): Helper function to update the style of the 37 specified renderer if needed. 38 (WebCore::MathMLStyle::resolveMathMLStyle): Resolve the MathML style of a given renderer. 39 For displaystyle, we inherit the value of the parent except for the cases mentioned in the 40 MathML recommendation. 41 * rendering/mathml/MathMLStyle.h: New class header for custom MathML style. 42 Only displaystyle is supported for now. 43 * rendering/mathml/RenderMathMLBlock.cpp: Add a member and getter for custom MathML style. 44 (WebCore::RenderMathMLBlock::RenderMathMLBlock): 45 * rendering/mathml/RenderMathMLBlock.h: ditto. 46 (WebCore::RenderMathMLBlock::mathMLStyle): 47 * rendering/mathml/RenderMathMLMath.h: Add definition to use the syntax is<RenderMathMLMath>. 48 * rendering/mathml/RenderMathMLOperator.h: 49 (WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Do not rerturn true when 50 the operator is not in displaystyle. 51 * rendering/mathml/RenderMathMLRoot.h: Make updateStyle public, so that it can be called 52 by MathMLStyle::updateStyleIfNeeded. 53 * rendering/mathml/RenderMathMLUnderOver.h: Add definition to use the syntax 54 is<RenderMathMLUnderOver>. 55 1 56 2016-07-07 Ryosuke Niwa <rniwa@webkit.org> 2 57 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r202944 r202960 1696 1696 439046DE12DA25E800AF80A2 /* RenderMathMLMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CA12DA25E800AF80A2 /* RenderMathMLMath.h */; }; 1697 1697 439046DF12DA25E17BAF80A2 /* MathMLOperatorDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E17BAF80A2 /* MathMLOperatorDictionary.cpp */; }; 1698 439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439176CB12DA25E17BAF80A2 /* MathMLStyle.cpp */; }; 1698 1699 439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */; }; 1699 1700 439046E012DA25E17BAF80A2 /* MathMLOperatorDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E17BAF80A2 /* MathMLOperatorDictionary.h */; }; 1701 439176E012DA25E17BAF80A2 /* MathMLStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 439176CC12DA25E17BAF80A2 /* MathMLStyle.h */; }; 1700 1702 439046E012DA25E800AF80A2 /* RenderMathMLOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */; }; 1701 1703 439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */; }; … … 9308 9310 439046CA12DA25E800AF80A2 /* RenderMathMLMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLMath.h; sourceTree = "<group>"; }; 9309 9311 439046CB12DA25E17BAF80A2 /* MathMLOperatorDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLOperatorDictionary.cpp; sourceTree = "<group>"; }; 9312 439176CB12DA25E17BAF80A2 /* MathMLStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLStyle.cpp; sourceTree = "<group>"; }; 9310 9313 439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLOperator.cpp; sourceTree = "<group>"; }; 9311 9314 439046CC12DA25E17BAF80A2 /* MathMLOperatorDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLOperatorDictionary.h; sourceTree = "<group>"; }; 9315 439176CC12DA25E17BAF80A2 /* MathMLStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLStyle.h; sourceTree = "<group>"; }; 9312 9316 439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLOperator.h; sourceTree = "<group>"; }; 9313 9317 439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLRoot.cpp; sourceTree = "<group>"; }; … … 17115 17119 439046D512DA25E812AF80AC /* MathOperator.cpp */, 17116 17120 439046D612DA25E812AF80AC /* MathOperator.h */, 17121 439176CB12DA25E17BAF80A2 /* MathMLStyle.cpp */, 17122 439176CC12DA25E17BAF80A2 /* MathMLStyle.h */, 17117 17123 439046C312DA25E800AF80A2 /* RenderMathMLBlock.cpp */, 17118 17124 439046C412DA25E800AF80A2 /* RenderMathMLBlock.h */, … … 27420 27426 44A28AAF12DFB8BF00AE923B /* MathMLNames.h in Headers */, 27421 27427 439046E012DA25E17BAF80A2 /* MathMLOperatorDictionary.h in Headers */, 27428 439176E012DA25E17BAF80A2 /* MathMLStyle.h in Headers */, 27422 27429 FA654A6C1108ABED002615E0 /* MathMLTextElement.h in Headers */, 27423 27430 439046EA12DA25E812AF80AC /* MathOperator.h in Headers */, … … 31245 31252 FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */, 31246 31253 439046DF12DA25E17BAF80A2 /* MathMLOperatorDictionary.cpp in Sources */, 31254 439176DF12DA25E17BAF80A2 /* MathMLStyle.cpp in Sources */, 31247 31255 FED48390CED66C3255F72C59 /* MathMLSelectElement.cpp in Sources */, 31248 31256 FA654A6B1108ABED002615E0 /* MathMLTextElement.cpp in Sources */, -
trunk/Source/WebCore/mathml/MathMLInlineContainerElement.cpp
r202727 r202960 84 84 } 85 85 86 void MathMLInlineContainerElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 87 { 88 if (name == displaystyleAttr && (hasTagName(mstyleTag) || hasTagName(mtableTag)) && renderer()) 89 MathMLStyle::resolveMathMLStyleTree(renderer()); 90 91 MathMLElement::parseAttribute(name, value); 92 } 93 86 94 } 87 95 -
trunk/Source/WebCore/mathml/MathMLInlineContainerElement.h
r202727 r202960 42 42 MathMLInlineContainerElement(const QualifiedName& tagName, Document&); 43 43 void childrenChanged(const ChildChange&) override; 44 void parseAttribute(const QualifiedName&, const AtomicString&) override; 44 45 45 46 private: -
trunk/Source/WebCore/mathml/MathMLMathElement.cpp
r200041 r202960 30 30 31 31 #include "MathMLMathElement.h" 32 33 #include "MathMLNames.h" 32 34 #include "RenderMathMLMath.h" 33 35 34 36 namespace WebCore { 35 37 38 using namespace MathMLNames; 39 36 40 inline MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document& document) 37 41 : MathMLInlineContainerElement(tagName, document) 38 42 { 43 setHasCustomStyleResolveCallbacks(); 39 44 } 40 45 … … 49 54 } 50 55 56 void MathMLMathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 57 { 58 if ((name == displaystyleAttr || name == displayAttr) && hasTagName(mathTag) && renderer()) 59 MathMLStyle::resolveMathMLStyleTree(renderer()); 60 61 MathMLInlineContainerElement::parseAttribute(name, value); 62 } 63 64 void MathMLMathElement::didAttachRenderers() 65 { 66 MathMLInlineContainerElement::didAttachRenderers(); 67 68 MathMLStyle::resolveMathMLStyleTree(renderer()); 69 } 70 51 71 } 52 72 -
trunk/Source/WebCore/mathml/MathMLMathElement.h
r202727 r202960 37 37 static Ref<MathMLMathElement> create(const QualifiedName& tagName, Document&); 38 38 39 protected: 40 void didAttachRenderers() final; 41 39 42 private: 40 43 MathMLMathElement(const QualifiedName& tagName, Document&); 44 void parseAttribute(const QualifiedName&, const AtomicString&) final; 41 45 42 46 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; -
trunk/Source/WebCore/mathml/mathattrs.in
r164418 r202960 15 15 depth 16 16 dir 17 display 18 displaystyle 17 19 encoding 18 20 fence -
trunk/Source/WebCore/rendering/mathml/MathMLStyle.h
r202959 r202960 1 1 /* 2 * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2016 Igalia S.L. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 25 24 */ 26 25 27 #ifndef MathMLInlineContainerElement_h 28 #define MathMLInlineContainerElement_h 26 #ifndef MathMLStyle_h 27 #define MathMLStyle_h 28 #pragma once 29 29 30 30 #if ENABLE(MATHML) 31 #include "MathMLElement.h" 31 32 #include "Element.h" 33 #include <wtf/RefCounted.h> 32 34 33 35 namespace WebCore { 34 36 35 class MathML InlineContainerElement : public MathMLElement{37 class MathMLStyle: public RefCounted<MathMLStyle> { 36 38 public: 37 static Ref<MathMLInlineContainerElement> create(const QualifiedName& tagName, Document&); 39 MathMLStyle() { } 40 static Ref<MathMLStyle> create(); 38 41 39 bool isPresentationMathML() const override { return true; } 42 bool displayStyle() const { return m_displayStyle; } 43 void setDisplayStyle(bool displayStyle) { m_displayStyle = displayStyle; } 40 44 41 protected: 42 MathMLInlineContainerElement(const QualifiedName& tagName, Document&); 43 void childrenChanged(const ChildChange&) override; 45 void resolveMathMLStyle(RenderObject*); 46 static void resolveMathMLStyleTree(RenderObject*); 44 47 45 48 private: 46 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override; 49 bool isDisplayStyleAlwaysFalse(RenderObject*); 50 void setDisplayStyle(RenderObject*); 51 RenderObject* getMathMLParentNode(RenderObject*); 52 void updateStyleIfNeeded(RenderObject*, bool); 53 54 bool m_displayStyle = false; 47 55 }; 48 56 … … 50 58 51 59 #endif // ENABLE(MATHML) 52 #endif // MathML InlineContainerElement_h60 #endif // MathMLStyle_h -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
r202934 r202960 47 47 RenderMathMLBlock::RenderMathMLBlock(Element& container, RenderStyle&& style) 48 48 : RenderBlock(container, WTFMove(style), 0) 49 , m_mathMLStyle(MathMLStyle::create()) 49 50 { 50 51 setChildrenInline(false); // All of our children must be block-level. … … 53 54 RenderMathMLBlock::RenderMathMLBlock(Document& document, RenderStyle&& style) 54 55 : RenderBlock(document, WTFMove(style), 0) 56 , m_mathMLStyle(MathMLStyle::create()) 55 57 { 56 58 setChildrenInline(false); // All of our children must be block-level. -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
r202934 r202960 30 30 #if ENABLE(MATHML) 31 31 32 #include "MathMLStyle.h" 32 33 #include "RenderBlock.h" 33 34 #include "RenderTable.h" … … 45 46 RenderMathMLBlock(Document&, RenderStyle&&); 46 47 virtual ~RenderMathMLBlock(); 48 49 MathMLStyle* mathMLStyle() const { return const_cast<MathMLStyle*>(&m_mathMLStyle.get()); } 47 50 48 51 bool isChildAllowed(const RenderObject&, const RenderStyle&) const override; … … 81 84 bool canDropAnonymousBlockChild() const final { return false; } 82 85 void layoutItems(bool relayoutChildren); 86 87 Ref<MathMLStyle> m_mathMLStyle; 83 88 }; 84 89 … … 87 92 explicit RenderMathMLTable(Element& element, RenderStyle&& style) 88 93 : RenderTable(element, WTFMove(style)) 94 , m_mathMLStyle(MathMLStyle::create()) 89 95 { 90 96 } … … 92 98 Optional<int> firstLineBaseline() const override; 93 99 100 MathMLStyle* mathMLStyle() const { return const_cast<MathMLStyle*>(&m_mathMLStyle.get()); } 101 94 102 private: 95 103 bool isRenderMathMLTable() const override { return true; } 96 104 const char* renderName() const override { return "RenderMathMLTable"; } 105 106 Ref<MathMLStyle> m_mathMLStyle; 97 107 }; 98 108 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r202727 r202960 50 50 51 51 bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; } 52 // FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737). 53 bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp); } 52 bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp) && mathMLStyle()->displayStyle(); } 54 53 bool isVertical() const { return m_isVertical; } 55 54 LayoutUnit italicCorrection() const { return m_mathOperator.italicCorrection(); } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
r202934 r202960 50 50 void computePreferredLogicalWidths() final; 51 51 void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final; 52 void updateStyle(); 52 53 53 54 protected: … … 60 61 bool isRenderMathMLRoot() const final { return true; } 61 62 const char* renderName() const final { return "RenderMathMLRoot"; } 62 void updateStyle();63 63 64 64 MathOperator m_radicalOperator; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
r202934 r202960 62 62 } 63 63 64 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLUnderOver, isRenderMathMLUnderOver()) 65 64 66 #endif // ENABLE(MATHML) 65 67
Note: See TracChangeset
for help on using the changeset viewer.