Simple line layout crashes with SVG fonts
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 19:45:13 +0000 (19:45 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 19:45:13 +0000 (19:45 +0000)
commitbe8cdf487d067deee64a45c49882a7d02737e58d
tree2d092fde174fcf4ffcf9f906622c90fa8507a1ff
parent167e224b24c6d76fb80893764e92fe33d22abdb3
Simple line layout crashes with SVG fonts
https://bugs.webkit.org/show_bug.cgi?id=124002

Source/WebCore:

Reviewed by Simon Fraser.

Don't use simple line layout for flows using SVG fonts. They crash if kerning is enabled.

Test: fast/text/svg-font-simple-line-crash.html

* platform/graphics/Font.h:
(WebCore::Font::isSVGFont):

    Add isSVGFont() so callers don't need to go via primaryFont().

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::constructTextRun):
* rendering/RenderBlock.cpp:
(WebCore::constructTextRunInternal):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):

    Disallow SVG fonts.

* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):
(WebCore::SVGTextMetrics::SVGTextMetrics):
* rendering/svg/SVGTextRunRenderingContext.h:

    Get rid of the abstract textRunNeedsRenderingContext in favor of just testing isSVGFont().

LayoutTests:

Reviewed by Simon Fraser.

* fast/text/svg-font-simple-line-crash-expected.txt: Added.
* fast/text/svg-font-simple-line-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158860 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/svg-font-simple-line-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/svg-font-simple-line-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Font.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGTextMetrics.cpp
Source/WebCore/rendering/svg/SVGTextRunRenderingContext.h