This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug JDK-8147476, commit of the following :
FontJava.cpp : - Completes the implementation of the platformBoundsForGlyph(Glyph c) function in FontJava.cpp. - Previous implementation simply returned a (0,0,0,0) rectangle, which explains the bad rendering height of MathML elements. - This affects only MathML elements due to specific mathematic glyphs behavior : WebCore MathML rendering can't use the font ascents and descents which causes gap into assembled glyphs. So getAscent(), getDescent() ... font methods are not appropriate. - WebCore uses bearX and heights informations from the glyph bounding box. MathMLRenderTest.java : - Adds a HeadLess proper unit test for this Bug JDK-8147476. - Tests the height of the first MathML mo token element in a quadratic formula. WCFont.java : - Adds the abstract getGlyphBoundingBox() method. WCFontPerfLogger.java : - Adds the getGlyphBoundingBox() method. WCFontImpl.java : - Implements the getGlyphBoundingBox() method. - Uses and reorders (FontResource) getGlyphBoundingBox values to match perfectly with WebCore requirements. All files : - Changes copyright date and removes white space tabulation.
- Loading branch information
1 parent
f7d4fc7
commit 6e8f2e3
Showing
5 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
modules/javafx.web/src/test/java/test/javafx/scene/web/MathMLRenderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
* | ||
* This code is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 only, as | ||
* published by the Free Software Foundation. Oracle designates this | ||
* particular file as subject to the "Classpath" exception as provided | ||
* by Oracle in the LICENSE file that accompanied this code. | ||
* | ||
* This code is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* version 2 for more details (a copy is included in the LICENSE file that | ||
* accompanied this code). | ||
* | ||
* You should have received a copy of the GNU General Public License version | ||
* 2 along with this work; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
||
package test.javafx.scene.web; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
import org.junit.Test; | ||
|
||
public class MathMLRenderTest extends TestBase { | ||
|
||
@Test public void testTokenHeight() throws Exception { | ||
|
||
// Document test | ||
String mathmlContent | ||
= "<math display=\"block\">" | ||
+ " <mrow>" | ||
+ " <mi>x</mi>" | ||
+ " <mo>=</mo>" | ||
+ " <mfrac>" | ||
+ " <mrow>" | ||
+ " <mo>−</mo>" | ||
+ " <mi>b</mi>" | ||
+ " <mo>±</mo>" | ||
+ " <msqrt>" | ||
+ " <mrow>" | ||
+ " <msup>" | ||
+ " <mi>b</mi>" | ||
+ " <mn>2</mn>" | ||
+ " </msup>" | ||
+ " <mo>−</mo>" | ||
+ " <mn>4</mn>" | ||
+ " <mi>a</mi>" | ||
+ " <mi>c</mi>" | ||
+ " </mrow>" | ||
+ " </msqrt>" | ||
+ " </mrow>" | ||
+ " <mrow>" | ||
+ " <mn>2</mn>" | ||
+ " <mi>a</mi>" | ||
+ " </mrow>" | ||
+ " </mfrac>" | ||
+ " </mrow>" | ||
+ "</math>"; | ||
|
||
String htmlBody = "<!doctype html>" | ||
+ "<html>" | ||
+ " <body>" | ||
+ " <p>" | ||
+ mathmlContent | ||
+ " </p>" | ||
+ " </body>" | ||
+ "</html>"; | ||
|
||
loadContent(htmlBody); | ||
|
||
int height = (int) executeScript( | ||
"elements = document.getElementsByTagName('mo');" | ||
+ "element = elements[0].clientHeight;" | ||
); | ||
|
||
assertTrue("MathML token height must be greater than " + height, height > 1); | ||
} | ||
} |