Lists styled with SVG fonts are not rendered as expected
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jun 2014 20:22:16 +0000 (20:22 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Jun 2014 20:22:16 +0000 (20:22 +0000)
commit14084b4af10cdb642964b1aed79d9fb1377943b5
tree9cfd42873644e83f4e94f8fb99f41ce96f674e5f
parentf25af0e444fd7bec0f1bb7f7c66d3f889bf8dab4
Lists styled with SVG fonts are not rendered as expected
https://bugs.webkit.org/show_bug.cgi?id=133198

Reviewed by Simon Fraser.

Source/WebCore:
There were a couple places in RenderListMarker and RenderMenuList that were
implicitly creating TextRuns by passing a String to a function which
expected a TextRun. Because TextRun has a constructor which takes a single
String and isn't marked explicit, TextRuns were being created without
any of the associated code that initializes the TextRun (such as creating
a RenderingContext if necessary).

There is currently one more client of this code that needs to be fixed.
This is in RenderThemeIOS::adjustMenuListButtonStyle(). However, fixing
this will be a somewhat large change, and is out of scope for this patch.
I will submit a follow-up patch that fixes this permanently. Once this is
fixed, I can mark TextRun's constructors as explicit.

Test: svg/custom/list-items-with-svg-font-family.html

* platform/graphics/TextRun.h:
(WebCore::TextRun::TextRun): Mark constructors as explicit.
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::computePreferredLogicalWidths): Call
RenderBlock::constructTextRun.
(WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.
* rendering/RenderMenuList.cpp:
(RenderMenuList::updateOptionsWidth): Ditto.
* rendering/RenderThemeIOS.mm:
(WebCore::adjustInputElementButtonStyle): Instead of crashing, mark
form controls rendered with SVG fonts as having 0 width. This isn't
perfect, but fixing this is out of scope for this patch.

LayoutTests:
See per-file comments.

* platform/ios-sim/fonts/input-style-with-svg-font-crash.html: Added. Make sure
that iOS input elements don't crash when styled with SVG fonts.
* platform/ios-sim/fonts/resources/graffiti.svg: Added. SVG font for above test.
* svg/custom/list-items-with-svg-font-family-expected.txt: Added.
* svg/custom/list-items-with-svg-font-family.html: Added. Make sure there is
no crash when styling list elements with SVG fonts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/ios-sim/fonts/input-style-with-svg-font-crash.html [new file with mode: 0644]
LayoutTests/platform/ios-sim/fonts/resources/graffiti.svg [new file with mode: 0644]
LayoutTests/svg/custom/list-items-with-svg-font-family-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/list-items-with-svg-font-family.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/FontMac.mm
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderThemeIOS.mm