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