Skip to content

Commit

Permalink
Bad position of large operators inside an munderover element
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=151916

Reviewed by Alejandro G. Castro.

Source/WebCore:

Test: mathml/opentype/large-operators-munderover.html

* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::isVertical): Expose the direction of the operator.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::layout): Remove call to horizontal stretching for vertical operators.

LayoutTests:

* mathml/opentype/large-operators-munderover-expected.txt: Added.
* mathml/opentype/large-operators-munderover.html: Added.

Add a test to verify the position and size of a large operator used as an munderover base.

Canonical link: https://commits.webkit.org/170204@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fred-wang committed Dec 9, 2015
1 parent 09f5a8c commit 2006eb7
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 2 deletions.
12 changes: 12 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2015-12-09 Frederic Wang <fred.wang@free.fr>

Bad position of large operators inside an munderover element
https://bugs.webkit.org/show_bug.cgi?id=151916

Reviewed by Alejandro G. Castro.

* mathml/opentype/large-operators-munderover-expected.txt: Added.
* mathml/opentype/large-operators-munderover.html: Added.

Add a test to verify the position and size of a large operator used as an munderover base.

2015-12-09 Joanmarie Diggs <jdiggs@igalia.com>

[AX][GTK] Accessibility gardening
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This test passes if you see a large black square with a green bar overscript and a red bar underscript.

largeop width: PASS
largeop height: PASS
green bar is above: PASS
red bar is below: PASS

54 changes: 54 additions & 0 deletions LayoutTests/mathml/opentype/large-operators-munderover.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<title>Large Operator Munderover</title>
<meta charset="utf-8"/>
<style type="text/css">
/* This font is taken from Mozilla's test suite. */
@font-face {
font-family: stretchy;
src: url("stretchy.woff");
}
math {
font-family: stretchy;
}
</style>
<script>
var result;
var epsilon = 1;
function almostEqual(x, y) {
return Math.abs(x - y) < epsilon;
}
function assert(text, condition) {
result += text + ": " + (condition ? "PASS" : "FAIL") + "\n";
}
function test() {
result = "";
// font em is 1024, size of glyph L8 is 8389 and font-size is 16px
var largeop = document.getElementById("largeop").getBoundingClientRect();
var green = document.getElementById("green").getBoundingClientRect();
var red = document.getElementById("red").getBoundingClientRect();
var size = (8389/1024)*16;

assert("largeop width", almostEqual(largeop.width, size));
assert("largeop height", almostEqual(largeop.height, size));
assert("green bar is above", green.bottom <= largeop.top);
assert("red bar is below", red.top >= largeop.bottom);
document.getElementById("result").innerText = result;
if (window.testRunner)
testRunner.dumpAsText();
}
</script>
</head>
<body onload="test()">
<p>This test passes if you see a large black square with a green bar overscript and a red bar underscript.</p>
<math display="block">
<munderover>
<mo id="largeop" lspace="0px" rspace="0px" style="font-size: 16px;" >&#x2A1C;</mo>
<mspace id="red" width="200px" height="10px" depth="10px" mathbackground="red"/>
<mspace id="green" width="250px" height="10px" depth="10px" mathbackground="green"/>
</munderover>
</math>
<div id="result"></div>
</body>
</html>
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2015-12-09 Frederic Wang <fred.wang@free.fr>

Bad position of large operators inside an munderover element
https://bugs.webkit.org/show_bug.cgi?id=151916

Reviewed by Alejandro G. Castro.

Test: mathml/opentype/large-operators-munderover.html

* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::isVertical): Expose the direction of the operator.
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::layout): Remove call to horizontal stretching for vertical operators.

2015-12-09 Zan Dobersek <zdobersek@igalia.com>

[TexMap] TextureMapperTiledBackingStore should notify the ImageObserver of the data access
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class RenderMathMLOperator : public RenderMathMLToken {
bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; }
// FIXME: The displaystyle property is not implemented (https://bugs.webkit.org/show_bug.cgi?id=118737).
bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp); }
bool isVertical() const { return m_isVertical; }

virtual void updateStyle() override final;

Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ void RenderMathMLUnderOver::layout()
if (child->needsLayout()) {
if (is<RenderMathMLBlock>(child)) {
if (auto renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator()) {
renderOperator->resetStretchSize();
renderOperators.append(renderOperator);
if (!renderOperator->isVertical()) {
renderOperator->resetStretchSize();
renderOperators.append(renderOperator);
}
}
}

Expand Down

0 comments on commit 2006eb7

Please sign in to comment.