Skip to content

Commit

Permalink
Cherry-pick 252432.595@safari-7614-branch (60a9996). rdar://101205947
Browse files Browse the repository at this point in the history
    Crash in RenderImage::paintReplaced
    https://bugs.webkit.org/show_bug.cgi?id=246712
    rdar://101205947

    Reviewed by David Kilzer and Myles Maxfield.

    * Source/WebCore/rendering/RenderImage.cpp:
    (WebCore::RenderImage::paintReplaced):

    Canonical link: https://commits.webkit.org/252432.595@safari-7614-branch

Canonical link: https://commits.webkit.org/255960@main
  • Loading branch information
alancoon authored and JonWBedard committed Oct 25, 2022
1 parent 1bf61e6 commit 981c3c4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/WebCore/rendering/RenderImage.cpp
Expand Up @@ -542,7 +542,8 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
if (!m_altText.isEmpty()) {
auto& font = style().fontCascade();
auto& fontMetrics = font.metricsOfPrimaryFont();
auto textRun = RenderBlock::constructTextRun(document().displayStringModifiedByEncoding(m_altText), style(), ExpansionBehavior::defaultBehavior(), RespectDirection | RespectDirectionOverride);
auto encodedDisplayString = document().displayStringModifiedByEncoding(m_altText);
auto textRun = RenderBlock::constructTextRun(encodedDisplayString, style(), ExpansionBehavior::defaultBehavior(), RespectDirection | RespectDirectionOverride);
auto textWidth = LayoutUnit { font.width(textRun) };

auto hasRoomForAltText = [&] {
Expand Down

0 comments on commit 981c3c4

Please sign in to comment.