haikuwebkit/LayoutTests/svg/text/text-overflow-ellipsis-svgf...

40 lines
816 B
HTML
Raw Permalink Normal View History

2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 font substitution doesn't work for HTML text using SVG fonts https://bugs.webkit.org/show_bug.cgi?id=17608 Selection rects are wrong for text with SVG fonts https://bugs.webkit.org/show_bug.cgi?id=25460 With @font-face, SVG fonts only work as primary, non-segmented https://bugs.webkit.org/show_bug.cgi?id=32227 When using SVG fonts with @font-face word-spacing and text-align: justify are not being honored https://bugs.webkit.org/show_bug.cgi?id=34236 SVG @font-face breaks text-overflow: ellipsis https://bugs.webkit.org/show_bug.cgi?id=36840 REGRESSION: SVG Font selection problems https://bugs.webkit.org/show_bug.cgi?id=41934 Rewrite the SVG Fonts support to fully integrate within the GlyphPage concept and the "simple" code path used to render platform fonts. That means the special logic for measuring text using SVG Fonts, calculating offset for positions, computing selection rects etc. is all gone now. There's no difference anymore between using a native font or a SVG Font, in terms of these operations. Update SVG pixel test baseline. Use all results that have been checked in when I landed the patch the last time. * platform/chromium/test_expectations.txt: * platform/mac/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.png: * platform/mac/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-03-t-expected.png: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-03-t-expected.txt: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.png: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.txt: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.png: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.txt: * platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.png: * platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt: * platform/mac/svg/batik/text/textEffect-expected.png: * platform/mac/svg/batik/text/textEffect-expected.txt: * platform/mac/svg/batik/text/textEffect3-expected.png: * platform/mac/svg/batik/text/textEffect3-expected.txt: * platform/mac/svg/batik/text/xmlSpace-expected.png: * platform/mac/svg/batik/text/xmlSpace-expected.txt: * platform/mac/svg/custom/glyph-selection-lang-attribute-expected.png: * platform/mac/svg/custom/glyph-selection-lang-attribute-expected.txt: * platform/mac/svg/custom/svg-fonts-fallback-expected.png: Added. * platform/mac/svg/custom/svg-fonts-fallback-expected.txt: Added. * platform/mac/svg/custom/svg-fonts-segmented-expected.png: Added. * platform/mac/svg/custom/svg-fonts-segmented-expected.txt: Added. * platform/mac/svg/custom/svg-fonts-with-no-element-reference-expected.png: * platform/mac/svg/custom/svg-fonts-with-no-element-reference-expected.txt: * platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.png: * platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.txt: * platform/mac/svg/custom/svg-fonts-word-spacing-expected.png: Added. * platform/mac/svg/custom/svg-fonts-word-spacing-expected.txt: Added. * platform/mac/svg/dynamic-updates/SVGFEConvolveMatrixElement-dom-preserveAlpha-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGFEConvolveMatrixElement-svgdom-preserveAlpha-prop-expected.png: * platform/mac/svg/foreignObject/text-tref-02-b-expected.png: * platform/mac/svg/foreignObject/text-tref-02-b-expected.txt: * platform/mac/svg/text/text-altglyph-01-b-expected.png: * platform/mac/svg/text/text-altglyph-01-b-expected.txt: * platform/mac/svg/text/text-overflow-ellipsis-svgfont-expected.png: Added. * platform/mac/svg/text/text-overflow-ellipsis-svgfont-expected.txt: Added. * platform/mac/svg/text/text-text-04-t-expected.png: * platform/mac/svg/text/text-text-04-t-expected.txt: * platform/mac/svg/text/text-text-05-t-expected.png: * platform/mac/svg/text/text-text-05-t-expected.txt: * platform/mac/svg/text/text-text-06-t-expected.png: * platform/mac/svg/text/text-text-06-t-expected.txt: * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.png: * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.txt: * platform/mac/svg/wicd/test-rightsizing-b-expected.png: * platform/mac/svg/wicd/test-rightsizing-b-expected.txt: * platform/qt-mac/Skipped: * platform/qt-wk2/Skipped: * platform/qt-wk2/fast/dom/Window/window-properties-expected.txt: * platform/qt-wk2/fast/dom/Window/window-property-descriptors-expected.txt: * platform/qt-wk2/fast/dom/prototype-inheritance-2-expected.txt: * platform/qt/Skipped: * platform/qt/fast/dom/Window/window-properties-expected.png: Added. * platform/qt/fast/dom/Window/window-properties-expected.txt: * platform/qt/fast/dom/Window/window-property-descriptors-expected.png: Added. * platform/qt/fast/dom/Window/window-property-descriptors-expected.txt: * platform/qt/fast/dom/prototype-inheritance-2-expected.png: Added. * platform/qt/fast/dom/prototype-inheritance-2-expected.txt: * platform/qt/fast/dom/prototype-inheritance-expected.png: Added. * platform/qt/fast/dom/prototype-inheritance-expected.txt: * platform/qt/fast/js/global-constructors-expected.png: Added. * platform/qt/fast/js/global-constructors-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-04-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-04-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/paths-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/paths-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-03-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-03-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-06-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-06-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1/filters-turb-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1/filters-turb-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-06-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-06-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-07-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-07-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-08-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-08-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-groups-01-b-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-groups-03-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt: * platform/qt/svg/custom/glyph-transformation-with-hkern-expected.png: Added. * platform/qt/svg/custom/glyph-transformation-with-hkern-expected.txt: Added. * platform/qt/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.png: * platform/qt/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt: * platform/qt/svg/custom/svg-features-expected.png: Added. * platform/qt/svg/custom/svg-features-expected.txt: Added. * platform/qt/svg/custom/svg-fonts-in-html-expected.png: * platform/qt/svg/custom/svg-fonts-in-html-expected.txt: * platform/qt/svg/foreignObject/text-tref-02-b-expected.png: * platform/qt/svg/foreignObject/text-tref-02-b-expected.txt: * platform/qt/svg/transforms/text-with-mask-with-svg-transform-expected.png: * platform/qt/svg/transforms/text-with-mask-with-svg-transform-expected.txt: * platform/qt/svg/wicd/test-rightsizing-b-expected.png: * platform/qt/svg/wicd/test-rightsizing-b-expected.txt: * svg/custom/resources/ABCFont.svg: * svg/custom/svg-fonts-fallback.xhtml: Added. * svg/custom/svg-fonts-segmented.xhtml: Added. * svg/custom/svg-fonts-word-spacing.html: Added. * svg/text/select-text-svgfont-expected.txt: Added. * svg/text/select-text-svgfont.html: Added. * svg/text/text-overflow-ellipsis-svgfont.html: Added. 2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 * wtf/Platform.h: Force Qt-EWS into a full rebuild, otherwhise this patch breaks the EWS. 2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 font substitution doesn't work for HTML text using SVG fonts https://bugs.webkit.org/show_bug.cgi?id=17608 Selection rects are wrong for text with SVG fonts https://bugs.webkit.org/show_bug.cgi?id=25460 With @font-face, SVG fonts only work as primary, non-segmented https://bugs.webkit.org/show_bug.cgi?id=32227 When using SVG fonts with @font-face word-spacing and text-align: justify are not being honored https://bugs.webkit.org/show_bug.cgi?id=34236 SVG @font-face breaks text-overflow: ellipsis https://bugs.webkit.org/show_bug.cgi?id=36840 REGRESSION: SVG Font selection problems https://bugs.webkit.org/show_bug.cgi?id=41934 Tests: svg/custom/svg-fonts-fallback.xhtml (for bug 17608, extended the original test from Mark Ambachtsheer) svg/custom/svg-fonts-segmented.xhtml (for bug 32227) svg/custom/svg-fonts-word-spacing.html (for bug 34236, from Michael Lewis) svg/text/select-text-svgfont.html (for bug 25460/41934, from Emil Schutte) svg/text/text-overflow-ellipsis-svgfont.html (for 36840, from Emil Schutte) Rewrite the SVG Fonts support to fully integrate within the GlyphPage concept and the "simple" code path used to render platform fonts. That means the special logic for measuring text using SVG Fonts, calculating offset for positions, computing selection rects etc. is all gone now. There's no difference anymore between using a native font or a SVG Font, in terms of these operations. This makes text selection using SVG Fonts possible again. * features.pri: Temporarily turn of SVG Fonts for Qt, as long as QRawFont support is not available and the fast path is disabled. * page/DOMWindow.idl: Touched file to force Qt regenerating the bindings. * platform/graphics/Font.cpp: Remove SVG Font special cases, the simple code path now handles SVG Fonts as well. (WebCore::Font::drawText): (WebCore::Font::drawEmphasisMarks): (WebCore::Font::width): (WebCore::Font::selectionRectForText): (WebCore::Font::offsetForPosition): (WebCore::Font::codePath): * platform/graphics/Font.h: Pass TextRun to drawGlyphBuffer/drawEmphasisMarks. Add new glyphDataAndPageForCharacter() method which returns a pair std::pair<GlyphData, GlyphPage*>, so we know the associated GlyphPage for a certain GlyphData object, which is needed to properly handle font fallback glyph matching for SVG Fonts.. (WebCore::Font::fontList): Add FontFallbackList accessor. * platform/graphics/FontFallbackList.h: Add getters/setters for glyphPageZero -- SVG Fonts support needs access to these objects from SVGTextRunRenderingContext. (WebCore::FontFallbackList::glyphPageZero): (WebCore::FontFallbackList::glyphPages): (WebCore::FontFallbackList::setGlyphPageZero): (WebCore::FontFallbackList::setGlyphPages): * platform/graphics/FontFastPath.cpp: (WebCore::Font::glyphDataForCharacter): Move implementation to glyphDataAndPageForCharacter(), and use that method from here. (WebCore::Font::glyphDataAndPageForCharacter): Does the same as before, just returns an additional GlyphPage* pointer. (WebCore::Font::getEmphasisMarkGlyphData): Remove SVG Fonts special case. (WebCore::Font::drawGlyphBuffer): Ditto. * platform/graphics/FontMetrics.h: (WebCore::scaleEmToUnits): Refactored scaleEmToUnits free function from SimpleFontDataMac/CGWin to share with SVGFontData/SVGTextRunRenderingContext. * platform/graphics/GlyphPageTreeNode.cpp: (WebCore::fill): Stop skipping SVG Fonts, they now also fill the GlyphPage using the glyphs defined in the SVG Font. * platform/graphics/SVGGlyph.h: s/isValid/isPartOfLigature/. Its usage has been changed. (WebCore::SVGGlyph::SVGGlyph): (WebCore::SVGGlyph::operator==): * platform/graphics/SimpleFontData.cpp: Change font size to be a float, not an int. (WebCore::SimpleFontData::SimpleFontData): * platform/graphics/SimpleFontData.h: Add new pure virtual methods to the AdditionalFontData interface, to be implemented in SVGFontData. (WebCore::SimpleFontData::widthForGlyph): Call widthForSVGGlyph, if we encounter a SVG glyph. * platform/graphics/TextRun.h: * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::glyphDataForCharacter): (WebCore::WidthIterator::advance): * platform/graphics/WidthIterator.h: Store several new members needed for SVG Fonts support (last processed glyph name used for kerning pair lookup) and a map mapping each character of a text to its arabic-form (if needed, to perform SVG glyph selection for Arabic text). (WebCore::WidthIterator::run): (WebCore::WidthIterator::runWidthSoFar): (WebCore::WidthIterator::lastGlyphName): (WebCore::WidthIterator::setLastGlyphName): (WebCore::WidthIterator::arabicForms): * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: Use new scaleEmToUnits free function from FontMetrics.h. * platform/graphics/mac/SimpleFontDataMac.mm: Ditto. * platform/graphics/win/SimpleFontDataCGWin.cpp: Ditto. * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: (WebCore::SVGTextLayoutAttributesBuilder::propagateLayoutAttributes): Handle UTF-16 surrogate pairs correctly, fixes the previous Acid3 regression. * rendering/svg/SVGTextMetrics.cpp: (WebCore::SVGTextMetrics::SVGTextMetrics): (WebCore::constructTextRun): (WebCore::SVGTextMetrics::measureCharacterRange): * rendering/svg/SVGTextMetrics.h: * rendering/svg/SVGTextRunRenderingContext.cpp: Remove drawTextUsingSVGFont/floatWidthUsingSVGFont/selectionRectForTextUsingSVGFont/offsetForPositionForTextUsingSVGFont. (WebCore::firstParentRendererForNonTextNode): Don't assert node() exists, doesn't hold true for generated render objects. (WebCore::renderObjectFromRun): Renamed from referencingRenderObjectFromRun. (WebCore::SVGTextRunRenderingContext::floatWidthUsingSVGFont): Remove extra "extraCharsAvailable" parameter, now solves via TextRun::charactersLength(). (WebCore::calculateEmUnitToPixelScaleFactor): Add helper method. (WebCore::SVGTextRunRenderingContext::drawSVGGlyphs): Main drawing method, this actually creates/renders Paths. (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter): Part 1/2 of SVG Glyph selection code. * rendering/svg/SVGTextRunRenderingContext.h: * svg/SVGAltGlyphElement.cpp: (WebCore::SVGAltGlyphElement::hasValidGlyphElement): * svg/SVGAltGlyphElement.h: * svg/SVGFontData.cpp: (WebCore::SVGFontData::initializeFontData): Changed font size from int to float. (WebCore::SVGFontData::widthForSVGGlyph): Lookup a SVGGlyph from a Glyph using the glyph table in SVGFontElement and calculate its width. (WebCore::SVGFontData::applySVGGlyphSelection): Part 2/2 of SVG Glyph selection code. (WebCore::SVGFontData::fillSVGGlyphPage): Fill GlyphPage using glyphs defined in the SVG Font. (WebCore::SVGFontData::fillBMPGlyphs): Moved from the previous fillSVGGlyphPage implementation. (WebCore::SVGFontData::fillNonBMPGlyphs): Add non-bmp glyph handling, fixing the Acid3 regression (support using SVGGlyphs for UTF-16 surrogate pairs). * svg/SVGFontData.h: * svg/SVGFontElement.cpp: (WebCore::SVGFontElement::registerLigaturesInGlyphCache): Enable ligature registration for the use within GlyphPage. (WebCore::SVGFontElement::ensureGlyphCache): * svg/SVGGlyphMap.h: Switch to use SurrogatePairTextIterator, and switch glyph table from UChar to UChar32, just like GlyphPage, to handle glyphs from non-BMP correctly. (WebCore::SVGGlyphMap::addGlyph): Remove setting isValid, it's not needed anymore and gone. (WebCore::SVGGlyphMap::collectGlyphsForString): * svg/svgtags.in: Surround vkern in ENABLE_SVG_FONTS block. Canonical link: https://commits.webkit.org/79028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89732 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-06-25 06:28:12 +00:00
<!DOCTYPE html>
<html>
<head>
<title>Test for text-overflow: ellipsis using SVG font</title>
<style>
@font-face {
font-family: 'ABCFont';
src: local('☺'), url('../../svg/custom/resources/ABCFont.svg#ABCFont') format('svg');
font-weight: normal;
font-style: normal;
}
.ellipsis {
width: 180px;
margin: 0 0 20px 0;
border: 1px solid black;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.svgfont {
font-family: 'ABCFont';
}
</style>
</head>
<body>
This test checks that the text-overflow: ellipsis property is handled correctly when using an SVG font.<br><br>
Remove unneeded whitespace between content and <br> https://bugs.webkit.org/show_bug.cgi?id=218151 <rdar://problem/70662471> Reviewed by Antti Koivisto. Missed these files in r268958. * fast/css/text-overflow-ellipsis-bidi.html: * fast/css/text-overflow-ellipsis-strict.html: * fast/forms/basic-buttons.html: * fast/repaint/add-table-overpaint-expected.txt: * fast/repaint/hidpi-wrong-repaint-rect-when-parent-has-noncompositing-transform-expected.txt: * fast/repaint/obscured-background-no-repaint-expected.txt: * fast/repaint/resources/line-flow-with-floats.html: * platform/mac/fast/css/text-overflow-ellipsis-bidi-expected.txt: * platform/mac/fast/css/text-overflow-ellipsis-strict-expected.txt: * platform/mac/fast/forms/basic-buttons-expected.txt: * platform/mac/fast/repaint/japanese-rl-selection-clear-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-1-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-10-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-2-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-3-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-4-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-5-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-6-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-7-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-8-expected.txt: * platform/mac/fast/repaint/line-flow-with-floats-9-expected.txt: * platform/mac/svg/text/text-overflow-ellipsis-svgfont-expected.txt: * platform/mac/svg/text/text-overflow-ellipsis-svgfont-kerning-ligatures-expected.txt: * svg/text/text-overflow-ellipsis-svgfont-kerning-ligatures.html: * svg/text/text-overflow-ellipsis-svgfont.html: Canonical link: https://commits.webkit.org/230877@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-26 13:28:38 +00:00
Pass if some text is shown followed by an ellipsis (NOT just the ellipsis by itself).<br><br>
2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 font substitution doesn't work for HTML text using SVG fonts https://bugs.webkit.org/show_bug.cgi?id=17608 Selection rects are wrong for text with SVG fonts https://bugs.webkit.org/show_bug.cgi?id=25460 With @font-face, SVG fonts only work as primary, non-segmented https://bugs.webkit.org/show_bug.cgi?id=32227 When using SVG fonts with @font-face word-spacing and text-align: justify are not being honored https://bugs.webkit.org/show_bug.cgi?id=34236 SVG @font-face breaks text-overflow: ellipsis https://bugs.webkit.org/show_bug.cgi?id=36840 REGRESSION: SVG Font selection problems https://bugs.webkit.org/show_bug.cgi?id=41934 Rewrite the SVG Fonts support to fully integrate within the GlyphPage concept and the "simple" code path used to render platform fonts. That means the special logic for measuring text using SVG Fonts, calculating offset for positions, computing selection rects etc. is all gone now. There's no difference anymore between using a native font or a SVG Font, in terms of these operations. Update SVG pixel test baseline. Use all results that have been checked in when I landed the patch the last time. * platform/chromium/test_expectations.txt: * platform/mac/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.png: * platform/mac/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-03-t-expected.png: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-03-t-expected.txt: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.png: * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.txt: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.png: * platform/mac/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.txt: * platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.png: * platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt: * platform/mac/svg/batik/text/textEffect-expected.png: * platform/mac/svg/batik/text/textEffect-expected.txt: * platform/mac/svg/batik/text/textEffect3-expected.png: * platform/mac/svg/batik/text/textEffect3-expected.txt: * platform/mac/svg/batik/text/xmlSpace-expected.png: * platform/mac/svg/batik/text/xmlSpace-expected.txt: * platform/mac/svg/custom/glyph-selection-lang-attribute-expected.png: * platform/mac/svg/custom/glyph-selection-lang-attribute-expected.txt: * platform/mac/svg/custom/svg-fonts-fallback-expected.png: Added. * platform/mac/svg/custom/svg-fonts-fallback-expected.txt: Added. * platform/mac/svg/custom/svg-fonts-segmented-expected.png: Added. * platform/mac/svg/custom/svg-fonts-segmented-expected.txt: Added. * platform/mac/svg/custom/svg-fonts-with-no-element-reference-expected.png: * platform/mac/svg/custom/svg-fonts-with-no-element-reference-expected.txt: * platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.png: * platform/mac/svg/custom/svg-fonts-without-missing-glyph-expected.txt: * platform/mac/svg/custom/svg-fonts-word-spacing-expected.png: Added. * platform/mac/svg/custom/svg-fonts-word-spacing-expected.txt: Added. * platform/mac/svg/dynamic-updates/SVGFEConvolveMatrixElement-dom-preserveAlpha-attr-expected.png: * platform/mac/svg/dynamic-updates/SVGFEConvolveMatrixElement-svgdom-preserveAlpha-prop-expected.png: * platform/mac/svg/foreignObject/text-tref-02-b-expected.png: * platform/mac/svg/foreignObject/text-tref-02-b-expected.txt: * platform/mac/svg/text/text-altglyph-01-b-expected.png: * platform/mac/svg/text/text-altglyph-01-b-expected.txt: * platform/mac/svg/text/text-overflow-ellipsis-svgfont-expected.png: Added. * platform/mac/svg/text/text-overflow-ellipsis-svgfont-expected.txt: Added. * platform/mac/svg/text/text-text-04-t-expected.png: * platform/mac/svg/text/text-text-04-t-expected.txt: * platform/mac/svg/text/text-text-05-t-expected.png: * platform/mac/svg/text/text-text-05-t-expected.txt: * platform/mac/svg/text/text-text-06-t-expected.png: * platform/mac/svg/text/text-text-06-t-expected.txt: * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.png: * platform/mac/svg/transforms/text-with-mask-with-svg-transform-expected.txt: * platform/mac/svg/wicd/test-rightsizing-b-expected.png: * platform/mac/svg/wicd/test-rightsizing-b-expected.txt: * platform/qt-mac/Skipped: * platform/qt-wk2/Skipped: * platform/qt-wk2/fast/dom/Window/window-properties-expected.txt: * platform/qt-wk2/fast/dom/Window/window-property-descriptors-expected.txt: * platform/qt-wk2/fast/dom/prototype-inheritance-2-expected.txt: * platform/qt/Skipped: * platform/qt/fast/dom/Window/window-properties-expected.png: Added. * platform/qt/fast/dom/Window/window-properties-expected.txt: * platform/qt/fast/dom/Window/window-property-descriptors-expected.png: Added. * platform/qt/fast/dom/Window/window-property-descriptors-expected.txt: * platform/qt/fast/dom/prototype-inheritance-2-expected.png: Added. * platform/qt/fast/dom/prototype-inheritance-2-expected.txt: * platform/qt/fast/dom/prototype-inheritance-expected.png: Added. * platform/qt/fast/dom/prototype-inheritance-expected.txt: * platform/qt/fast/js/global-constructors-expected.png: Added. * platform/qt/fast/js/global-constructors-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-04-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-dom-04-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/paths-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/paths-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-03-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-03-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-06-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-06-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.png: * platform/qt/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1/filters-turb-02-f-expected.png: * platform/qt/svg/W3C-SVG-1.1/filters-turb-02-f-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-06-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-06-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-07-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-07-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-elems-08-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-elems-08-t-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-groups-01-b-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt: * platform/qt/svg/W3C-SVG-1.1/render-groups-03-t-expected.png: * platform/qt/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt: * platform/qt/svg/custom/glyph-transformation-with-hkern-expected.png: Added. * platform/qt/svg/custom/glyph-transformation-with-hkern-expected.txt: Added. * platform/qt/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.png: * platform/qt/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt: * platform/qt/svg/custom/svg-features-expected.png: Added. * platform/qt/svg/custom/svg-features-expected.txt: Added. * platform/qt/svg/custom/svg-fonts-in-html-expected.png: * platform/qt/svg/custom/svg-fonts-in-html-expected.txt: * platform/qt/svg/foreignObject/text-tref-02-b-expected.png: * platform/qt/svg/foreignObject/text-tref-02-b-expected.txt: * platform/qt/svg/transforms/text-with-mask-with-svg-transform-expected.png: * platform/qt/svg/transforms/text-with-mask-with-svg-transform-expected.txt: * platform/qt/svg/wicd/test-rightsizing-b-expected.png: * platform/qt/svg/wicd/test-rightsizing-b-expected.txt: * svg/custom/resources/ABCFont.svg: * svg/custom/svg-fonts-fallback.xhtml: Added. * svg/custom/svg-fonts-segmented.xhtml: Added. * svg/custom/svg-fonts-word-spacing.html: Added. * svg/text/select-text-svgfont-expected.txt: Added. * svg/text/select-text-svgfont.html: Added. * svg/text/text-overflow-ellipsis-svgfont.html: Added. 2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 * wtf/Platform.h: Force Qt-EWS into a full rebuild, otherwhise this patch breaks the EWS. 2011-06-24 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Rob Buis. Integrate SVG Fonts within GlyphPage concept, removing the special SVG code paths from Font, making it possible to reuse the simple text code path for SVG Fonts https://bugs.webkit.org/show_bug.cgi?id=59085 font substitution doesn't work for HTML text using SVG fonts https://bugs.webkit.org/show_bug.cgi?id=17608 Selection rects are wrong for text with SVG fonts https://bugs.webkit.org/show_bug.cgi?id=25460 With @font-face, SVG fonts only work as primary, non-segmented https://bugs.webkit.org/show_bug.cgi?id=32227 When using SVG fonts with @font-face word-spacing and text-align: justify are not being honored https://bugs.webkit.org/show_bug.cgi?id=34236 SVG @font-face breaks text-overflow: ellipsis https://bugs.webkit.org/show_bug.cgi?id=36840 REGRESSION: SVG Font selection problems https://bugs.webkit.org/show_bug.cgi?id=41934 Tests: svg/custom/svg-fonts-fallback.xhtml (for bug 17608, extended the original test from Mark Ambachtsheer) svg/custom/svg-fonts-segmented.xhtml (for bug 32227) svg/custom/svg-fonts-word-spacing.html (for bug 34236, from Michael Lewis) svg/text/select-text-svgfont.html (for bug 25460/41934, from Emil Schutte) svg/text/text-overflow-ellipsis-svgfont.html (for 36840, from Emil Schutte) Rewrite the SVG Fonts support to fully integrate within the GlyphPage concept and the "simple" code path used to render platform fonts. That means the special logic for measuring text using SVG Fonts, calculating offset for positions, computing selection rects etc. is all gone now. There's no difference anymore between using a native font or a SVG Font, in terms of these operations. This makes text selection using SVG Fonts possible again. * features.pri: Temporarily turn of SVG Fonts for Qt, as long as QRawFont support is not available and the fast path is disabled. * page/DOMWindow.idl: Touched file to force Qt regenerating the bindings. * platform/graphics/Font.cpp: Remove SVG Font special cases, the simple code path now handles SVG Fonts as well. (WebCore::Font::drawText): (WebCore::Font::drawEmphasisMarks): (WebCore::Font::width): (WebCore::Font::selectionRectForText): (WebCore::Font::offsetForPosition): (WebCore::Font::codePath): * platform/graphics/Font.h: Pass TextRun to drawGlyphBuffer/drawEmphasisMarks. Add new glyphDataAndPageForCharacter() method which returns a pair std::pair<GlyphData, GlyphPage*>, so we know the associated GlyphPage for a certain GlyphData object, which is needed to properly handle font fallback glyph matching for SVG Fonts.. (WebCore::Font::fontList): Add FontFallbackList accessor. * platform/graphics/FontFallbackList.h: Add getters/setters for glyphPageZero -- SVG Fonts support needs access to these objects from SVGTextRunRenderingContext. (WebCore::FontFallbackList::glyphPageZero): (WebCore::FontFallbackList::glyphPages): (WebCore::FontFallbackList::setGlyphPageZero): (WebCore::FontFallbackList::setGlyphPages): * platform/graphics/FontFastPath.cpp: (WebCore::Font::glyphDataForCharacter): Move implementation to glyphDataAndPageForCharacter(), and use that method from here. (WebCore::Font::glyphDataAndPageForCharacter): Does the same as before, just returns an additional GlyphPage* pointer. (WebCore::Font::getEmphasisMarkGlyphData): Remove SVG Fonts special case. (WebCore::Font::drawGlyphBuffer): Ditto. * platform/graphics/FontMetrics.h: (WebCore::scaleEmToUnits): Refactored scaleEmToUnits free function from SimpleFontDataMac/CGWin to share with SVGFontData/SVGTextRunRenderingContext. * platform/graphics/GlyphPageTreeNode.cpp: (WebCore::fill): Stop skipping SVG Fonts, they now also fill the GlyphPage using the glyphs defined in the SVG Font. * platform/graphics/SVGGlyph.h: s/isValid/isPartOfLigature/. Its usage has been changed. (WebCore::SVGGlyph::SVGGlyph): (WebCore::SVGGlyph::operator==): * platform/graphics/SimpleFontData.cpp: Change font size to be a float, not an int. (WebCore::SimpleFontData::SimpleFontData): * platform/graphics/SimpleFontData.h: Add new pure virtual methods to the AdditionalFontData interface, to be implemented in SVGFontData. (WebCore::SimpleFontData::widthForGlyph): Call widthForSVGGlyph, if we encounter a SVG glyph. * platform/graphics/TextRun.h: * platform/graphics/WidthIterator.cpp: (WebCore::WidthIterator::glyphDataForCharacter): (WebCore::WidthIterator::advance): * platform/graphics/WidthIterator.h: Store several new members needed for SVG Fonts support (last processed glyph name used for kerning pair lookup) and a map mapping each character of a text to its arabic-form (if needed, to perform SVG glyph selection for Arabic text). (WebCore::WidthIterator::run): (WebCore::WidthIterator::runWidthSoFar): (WebCore::WidthIterator::lastGlyphName): (WebCore::WidthIterator::setLastGlyphName): (WebCore::WidthIterator::arabicForms): * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: Use new scaleEmToUnits free function from FontMetrics.h. * platform/graphics/mac/SimpleFontDataMac.mm: Ditto. * platform/graphics/win/SimpleFontDataCGWin.cpp: Ditto. * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: (WebCore::SVGTextLayoutAttributesBuilder::propagateLayoutAttributes): Handle UTF-16 surrogate pairs correctly, fixes the previous Acid3 regression. * rendering/svg/SVGTextMetrics.cpp: (WebCore::SVGTextMetrics::SVGTextMetrics): (WebCore::constructTextRun): (WebCore::SVGTextMetrics::measureCharacterRange): * rendering/svg/SVGTextMetrics.h: * rendering/svg/SVGTextRunRenderingContext.cpp: Remove drawTextUsingSVGFont/floatWidthUsingSVGFont/selectionRectForTextUsingSVGFont/offsetForPositionForTextUsingSVGFont. (WebCore::firstParentRendererForNonTextNode): Don't assert node() exists, doesn't hold true for generated render objects. (WebCore::renderObjectFromRun): Renamed from referencingRenderObjectFromRun. (WebCore::SVGTextRunRenderingContext::floatWidthUsingSVGFont): Remove extra "extraCharsAvailable" parameter, now solves via TextRun::charactersLength(). (WebCore::calculateEmUnitToPixelScaleFactor): Add helper method. (WebCore::SVGTextRunRenderingContext::drawSVGGlyphs): Main drawing method, this actually creates/renders Paths. (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter): Part 1/2 of SVG Glyph selection code. * rendering/svg/SVGTextRunRenderingContext.h: * svg/SVGAltGlyphElement.cpp: (WebCore::SVGAltGlyphElement::hasValidGlyphElement): * svg/SVGAltGlyphElement.h: * svg/SVGFontData.cpp: (WebCore::SVGFontData::initializeFontData): Changed font size from int to float. (WebCore::SVGFontData::widthForSVGGlyph): Lookup a SVGGlyph from a Glyph using the glyph table in SVGFontElement and calculate its width. (WebCore::SVGFontData::applySVGGlyphSelection): Part 2/2 of SVG Glyph selection code. (WebCore::SVGFontData::fillSVGGlyphPage): Fill GlyphPage using glyphs defined in the SVG Font. (WebCore::SVGFontData::fillBMPGlyphs): Moved from the previous fillSVGGlyphPage implementation. (WebCore::SVGFontData::fillNonBMPGlyphs): Add non-bmp glyph handling, fixing the Acid3 regression (support using SVGGlyphs for UTF-16 surrogate pairs). * svg/SVGFontData.h: * svg/SVGFontElement.cpp: (WebCore::SVGFontElement::registerLigaturesInGlyphCache): Enable ligature registration for the use within GlyphPage. (WebCore::SVGFontElement::ensureGlyphCache): * svg/SVGGlyphMap.h: Switch to use SurrogatePairTextIterator, and switch glyph table from UChar to UChar32, just like GlyphPage, to handle glyphs from non-BMP correctly. (WebCore::SVGGlyphMap::addGlyph): Remove setting isValid, it's not needed anymore and gone. (WebCore::SVGGlyphMap::collectGlyphsForString): * svg/svgtags.in: Surround vkern in ENABLE_SVG_FONTS block. Canonical link: https://commits.webkit.org/79028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89732 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-06-25 06:28:12 +00:00
<div class="ellipsis svgfont">
abc abc abc abc abc abc abc abc abc abc
</div>
</body>
</html>