Title: [174677] trunk
Revision
174677
Author
[email protected]
Date
2014-10-14 02:53:59 -0700 (Tue, 14 Oct 2014)

Log Message

Changes in the stretchy attribute do not update rendering
https://bugs.webkit.org/show_bug.cgi?id=136883

Reviewed by Darin Adler.

Source/WebCore:

Test: mathml/presentation/mo-stretch-update.html

We need to relayout when a change in the stretchy attribute
happens.

* mathml/MathMLTextElement.cpp:
(WebCore::MathMLTextElement::parseAttribute): Parse the
modifications of the stretchy attribute.
* mathml/MathMLTextElement.h:
* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded):
Add function that receives the value instead of looking for it and
checks if the change should schedule a layout.
(WebCore::RenderMathMLOperator::setOperatorFlagFromAttribute):
(WebCore::RenderMathMLOperator::setOperatorFlagFromAttributeValue):
Add function that receives the value instead of looking for it.
* rendering/mathml/RenderMathMLOperator.h:

LayoutTests:

The test updates the stretchy value in a timeout.

* mathml/presentation/mo-stretch-update-expected.html: Added.
* mathml/presentation/mo-stretch-update.html: Added.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (174676 => 174677)


--- trunk/LayoutTests/ChangeLog	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/LayoutTests/ChangeLog	2014-10-14 09:53:59 UTC (rev 174677)
@@ -1,3 +1,15 @@
+2014-10-14  Alejandro G. Castro  <[email protected]>
+
+        Changes in the stretchy attribute do not update rendering
+        https://bugs.webkit.org/show_bug.cgi?id=136883
+
+        Reviewed by Darin Adler.
+
+        The test updates the stretchy value in a timeout.
+
+        * mathml/presentation/mo-stretch-update-expected.html: Added.
+        * mathml/presentation/mo-stretch-update.html: Added.
+
 2014-10-14  Andrzej Badowski  <[email protected]>
 
         [AX] Improve AccessibilityTableCell columnHeaders and rowHeaders functions.

Modified: trunk/Source/WebCore/ChangeLog (174676 => 174677)


--- trunk/Source/WebCore/ChangeLog	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/Source/WebCore/ChangeLog	2014-10-14 09:53:59 UTC (rev 174677)
@@ -1,3 +1,28 @@
+2014-10-14  Alejandro G. Castro  <[email protected]>
+
+        Changes in the stretchy attribute do not update rendering
+        https://bugs.webkit.org/show_bug.cgi?id=136883
+
+        Reviewed by Darin Adler.
+
+        Test: mathml/presentation/mo-stretch-update.html
+
+        We need to relayout when a change in the stretchy attribute
+        happens.
+
+        * mathml/MathMLTextElement.cpp:
+        (WebCore::MathMLTextElement::parseAttribute): Parse the
+        modifications of the stretchy attribute.
+        * mathml/MathMLTextElement.h:
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded):
+        Add function that receives the value instead of looking for it and
+        checks if the change should schedule a layout.
+        (WebCore::RenderMathMLOperator::setOperatorFlagFromAttribute):
+        (WebCore::RenderMathMLOperator::setOperatorFlagFromAttributeValue):
+        Add function that receives the value instead of looking for it.
+        * rendering/mathml/RenderMathMLOperator.h:
+
 2014-10-14  Chris Dumez  <[email protected]>
 
         Use is<>() / downcast<>() for RenderImage

Modified: trunk/Source/WebCore/mathml/MathMLTextElement.cpp (174676 => 174677)


--- trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.cpp	2014-10-14 09:53:59 UTC (rev 174677)
@@ -64,6 +64,17 @@
         downcast<RenderMathMLToken>(*renderer()).updateTokenContent();
 }
 
+void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+    if (name == stretchyAttr) {
+        if (is<RenderMathMLOperator>(renderer()))
+            downcast<RenderMathMLOperator>(*renderer()).setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Stretchy, value);
+        return;
+    }
+
+    MathMLElement::parseAttribute(name, value);
+}
+
 RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(PassRef<RenderStyle> style)
 {
     if (hasTagName(MathMLNames::moTag))

Modified: trunk/Source/WebCore/mathml/MathMLTextElement.h (174676 => 174677)


--- trunk/Source/WebCore/mathml/MathMLTextElement.h	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/Source/WebCore/mathml/MathMLTextElement.h	2014-10-14 09:53:59 UTC (rev 174677)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
     
-class MathMLTextElement : public MathMLElement {
+class MathMLTextElement final : public MathMLElement {
 public:
     static PassRefPtr<MathMLTextElement> create(const QualifiedName& tagName, Document&);
     virtual void didAttachRenderers() override;
@@ -46,6 +46,7 @@
     virtual bool childShouldCreateRenderer(const Node&) const override;
 
     virtual void childrenChanged(const ChildChange&) override;
+    virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
 };
     
 }

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (174676 => 174677)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2014-10-14 09:53:59 UTC (rev 174677)
@@ -1157,10 +1157,25 @@
     updateTokenContent(operatorString);
 }
 
+void RenderMathMLOperator::setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag flag, const AtomicString& attributeValue)
+{
+    unsigned short oldOperatorFlags = m_operatorFlags;
+
+    setOperatorFlagFromAttributeValue(flag, attributeValue);
+
+    if (oldOperatorFlags != m_operatorFlags)
+        setNeedsLayoutAndPrefWidthsRecalc();
+}
+
 void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name)
 {
+    setOperatorFlagFromAttributeValue(flag, element().fastGetAttribute(name));
+}
+
+void RenderMathMLOperator::setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag flag, const AtomicString& attributeValue)
+{
     ASSERT(!isAnonymous());
-    const AtomicString& attributeValue = element().fastGetAttribute(name);
+
     if (attributeValue == "true")
         m_operatorFlags |= flag;
     else if (attributeValue == "false")

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h (174676 => 174677)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h	2014-10-14 09:07:21 UTC (rev 174676)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h	2014-10-14 09:53:59 UTC (rev 174677)
@@ -79,6 +79,7 @@
     void updateTokenContent(const String& operatorString);
     void updateTokenContent() override final;
     void updateOperatorProperties();
+    void setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue);
 
 protected:
     virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
@@ -186,6 +187,7 @@
     LayoutUnit m_maxSize;
 
     void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&);
+    void setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue);
     void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
     virtual void SetOperatorProperties();
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to