SVG TextRuns do not always get RenderingContexts
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 May 2014 21:34:38 +0000 (21:34 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 May 2014 21:34:38 +0000 (21:34 +0000)
commitb5a34c73f10a7691f2265ab570dc6242f20c51ff
treeef7b2763a97d030d6f781e9d98849835212aaef1
parentaae93aacd1a1eb11b11a230db3649b8be6dc23ce
SVG TextRuns do not always get RenderingContexts
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).

This patch marks the aforementioned constructor as "explicit" to discourage
such behavior in the future.

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.

LayoutTests:
See per-file comments.

* 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@169400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
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/TextRun.h
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderMenuList.cpp