Skip to content

Commit

Permalink
Merge r174677 - Changes in the stretchy attribute do not update rende…
Browse files Browse the repository at this point in the history
…ring

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.

Canonical link: https://commits.webkit.org/154760.136@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@175885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alexgcastro authored and carlosgcampos committed Nov 11, 2014
1 parent e7ca825 commit 968580c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 2 deletions.
12 changes: 12 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
2014-10-14 Alejandro G. Castro <alex@igalia.com>

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-12 Mike West <mkwst@chromium.org>

Referrer Policy: Update <meta name="referrer"> values to match the spec
Expand Down
25 changes: 25 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
2014-10-14 Alejandro G. Castro <alex@igalia.com>

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-12 Mike West <mkwst@chromium.org>

Referrer Policy: Update <meta name="referrer"> values to match the spec
Expand Down
11 changes: 11 additions & 0 deletions Source/WebCore/mathml/MathMLTextElement.cpp
Expand Up @@ -64,6 +64,17 @@ void MathMLTextElement::childrenChanged(const ChildChange& change)
toRenderMathMLToken(renderer())->updateTokenContent();
}

void MathMLTextElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == stretchyAttr) {
if (renderer() && renderer()->isRenderMathMLOperator())
toRenderMathMLOperator(renderer())->setOperatorFlagAndScheduleLayoutIfNeeded(MathMLOperatorDictionary::Stretchy, value);
return;
}

MathMLElement::parseAttribute(name, value);
}

RenderPtr<RenderElement> MathMLTextElement::createElementRenderer(PassRef<RenderStyle> style)
{
if (hasTagName(MathMLNames::moTag))
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/mathml/MathMLTextElement.h
Expand Up @@ -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;
Expand All @@ -46,6 +46,7 @@ class MathMLTextElement : public MathMLElement {
virtual bool childShouldCreateRenderer(const Node&) const override;

virtual void childrenChanged(const ChildChange&) override;
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
};

}
Expand Down
17 changes: 16 additions & 1 deletion Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
Expand Up @@ -1157,10 +1157,25 @@ RenderMathMLOperator::RenderMathMLOperator(Document& document, PassRef<RenderSty
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")
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Expand Up @@ -79,6 +79,7 @@ class RenderMathMLOperator : public RenderMathMLToken {
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"; }
Expand Down Expand Up @@ -186,6 +187,7 @@ class RenderMathMLOperator : public RenderMathMLToken {
LayoutUnit m_maxSize;

void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&);
void setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue);
void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
virtual void SetOperatorProperties();
};
Expand Down

0 comments on commit 968580c

Please sign in to comment.