Commit 67822d02 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Don't adopt a null FontSelector in CanvasRenderingContext2D::setFont()

This function does the following:
1. Create a temporary ComputedStyle |font_style|
2. Make |font_style| adopt its current FontSelector, which is always
   nullptr at the call site
3. Use StyleResolver::ComputeFont() to resolve font-related properties,
   which overrides the FontSelector of |font_style| with the underlying
   document's FontSelector

This isn't correct, as it switches the FontSelector of |font_style|,
while ComputeFont() can already use the document's FontSelector. The
null FontSelector is actually never used.

Hence, this patch removes the adoption of null FontSelector.

Bug: 1049295
Change-Id: I2d3b2d1affd9317c6535933c1e4cc2421f5be1c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2103258Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750625}
parent 898b5cf9
......@@ -539,7 +539,6 @@ void CanvasRenderingContext2D::setFont(const String& new_font) {
element_font_description.SpecifiedSize());
font_style->SetFontDescription(element_font_description);
font_style->GetFont().Update(font_style->GetFont().GetFontSelector());
canvas()->GetDocument().EnsureStyleResolver().ComputeFont(
*canvas(), font_style.get(), *parsed_style);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment