Changeset 246755 in webkit


Ignore:
Timestamp:
Jun 24, 2019 12:37:59 PM (5 years ago)
Author:
Alan Bujtas
Message:

[StyleResolver] Pass RenderStyle& instead of RenderStyle* to updateFont() related functions.
https://bugs.webkit.org/show_bug.cgi?id=199167
<rdar://problem/52062669>

Reviewed by Antti Koivisto.

It is expected to have a valid RenderStyle object here (and existing code relies on it).

  • css/StyleResolver.cpp:

(WebCore::checkForOrientationChange):
(WebCore::StyleResolver::updateFont):
(WebCore::StyleResolver::checkForTextSizeAdjust):
(WebCore::StyleResolver::checkForZoomChange):
(WebCore::StyleResolver::checkForGenericFamilyChange):

  • css/StyleResolver.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246752 r246755  
     12019-06-24  Zalan Bujtas  <zalan@apple.com>
     2
     3        [StyleResolver] Pass RenderStyle& instead of RenderStyle* to updateFont() related functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=199167
     5        <rdar://problem/52062669>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        It is expected to have a valid RenderStyle object here (and existing code relies on it).
     10
     11        * css/StyleResolver.cpp:
     12        (WebCore::checkForOrientationChange):
     13        (WebCore::StyleResolver::updateFont):
     14        (WebCore::StyleResolver::checkForTextSizeAdjust):
     15        (WebCore::StyleResolver::checkForZoomChange):
     16        (WebCore::StyleResolver::checkForGenericFamilyChange):
     17        * css/StyleResolver.h:
     18
    1192019-06-24  Antoine Quint  <graouts@apple.com>
    220
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r246490 r246755  
    11751175}
    11761176
    1177 static void checkForOrientationChange(RenderStyle* style)
     1177static void checkForOrientationChange(RenderStyle& style)
    11781178{
    11791179    FontOrientation fontOrientation;
    11801180    NonCJKGlyphOrientation glyphOrientation;
    1181     std::tie(fontOrientation, glyphOrientation) = style->fontAndGlyphOrientation();
    1182 
    1183     const auto& fontDescription = style->fontDescription();
     1181    std::tie(fontOrientation, glyphOrientation) = style.fontAndGlyphOrientation();
     1182
     1183    const auto& fontDescription = style.fontDescription();
    11841184    if (fontDescription.orientation() == fontOrientation && fontDescription.nonCJKGlyphOrientation() == glyphOrientation)
    11851185        return;
     
    11881188    newFontDescription.setNonCJKGlyphOrientation(glyphOrientation);
    11891189    newFontDescription.setOrientation(fontOrientation);
    1190     style->setFontDescription(WTFMove(newFontDescription));
     1190    style.setFontDescription(WTFMove(newFontDescription));
    11911191}
    11921192
     
    11961196        return;
    11971197
    1198     RenderStyle* style = m_state.style();
     1198    auto& style = *m_state.style();
    11991199#if ENABLE(TEXT_AUTOSIZING)
    12001200    checkForTextSizeAdjust(style);
     
    12031203    checkForZoomChange(style, m_state.parentStyle());
    12041204    checkForOrientationChange(style);
    1205     style->fontCascade().update(&document().fontSelector());
     1205    style.fontCascade().update(&document().fontSelector());
    12061206    if (m_state.fontSizeHasViewportUnits())
    1207         style->setHasViewportUnits(true);
     1207        style.setHasViewportUnits(true);
    12081208    m_state.setFontDirty(false);
    12091209}
     
    18491849
    18501850#if ENABLE(TEXT_AUTOSIZING)
    1851 void StyleResolver::checkForTextSizeAdjust(RenderStyle* style)
    1852 {
    1853     ASSERT(style);
    1854     if (style->textSizeAdjust().isAuto() || (settings().textAutosizingUsesIdempotentMode() && !style->textSizeAdjust().isNone()))
     1851void StyleResolver::checkForTextSizeAdjust(RenderStyle& style)
     1852{
     1853    if (style.textSizeAdjust().isAuto() || (settings().textAutosizingUsesIdempotentMode() && !style.textSizeAdjust().isNone()))
    18551854        return;
    18561855
    1857     auto newFontDescription = style->fontDescription();
    1858     if (!style->textSizeAdjust().isNone())
    1859         newFontDescription.setComputedSize(newFontDescription.specifiedSize() * style->textSizeAdjust().multiplier());
     1856    auto newFontDescription = style.fontDescription();
     1857    if (!style.textSizeAdjust().isNone())
     1858        newFontDescription.setComputedSize(newFontDescription.specifiedSize() * style.textSizeAdjust().multiplier());
    18601859    else
    18611860        newFontDescription.setComputedSize(newFontDescription.specifiedSize());
    1862     style->setFontDescription(WTFMove(newFontDescription));
     1861    style.setFontDescription(WTFMove(newFontDescription));
    18631862}
    18641863#endif
    18651864
    1866 void StyleResolver::checkForZoomChange(RenderStyle* style, const RenderStyle* parentStyle)
     1865void StyleResolver::checkForZoomChange(RenderStyle& style, const RenderStyle* parentStyle)
    18671866{
    18681867    if (!parentStyle)
    18691868        return;
    18701869
    1871     if (style->effectiveZoom() == parentStyle->effectiveZoom() && style->textZoom() == parentStyle->textZoom())
     1870    if (style.effectiveZoom() == parentStyle->effectiveZoom() && style.textZoom() == parentStyle->textZoom())
    18721871        return;
    18731872
    1874     const auto& childFont = style->fontDescription();
     1873    const auto& childFont = style.fontDescription();
    18751874    auto newFontDescription = childFont;
    18761875    setFontSize(newFontDescription, childFont.specifiedSize());
    1877     style->setFontDescription(WTFMove(newFontDescription));
    1878 }
    1879 
    1880 void StyleResolver::checkForGenericFamilyChange(RenderStyle* style, const RenderStyle* parentStyle)
    1881 {
    1882     const auto& childFont = style->fontDescription();
     1876    style.setFontDescription(WTFMove(newFontDescription));
     1877}
     1878
     1879void StyleResolver::checkForGenericFamilyChange(RenderStyle& style, const RenderStyle* parentStyle)
     1880{
     1881    const auto& childFont = style.fontDescription();
    18831882
    18841883    if (childFont.isAbsoluteSize() || !parentStyle)
     
    19061905    auto newFontDescription = childFont;
    19071906    setFontSize(newFontDescription, size);
    1908     style->setFontDescription(WTFMove(newFontDescription));
     1907    style.setFontDescription(WTFMove(newFontDescription));
    19091908}
    19101909
  • trunk/Source/WebCore/css/StyleResolver.h

    r246490 r246755  
    313313private:
    314314    // This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
    315     void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyle);
    316     void checkForZoomChange(RenderStyle*, const RenderStyle* parentStyle);
     315    void checkForGenericFamilyChange(RenderStyle&, const RenderStyle* parentStyle);
     316    void checkForZoomChange(RenderStyle&, const RenderStyle* parentStyle);
    317317#if ENABLE(TEXT_AUTOSIZING)
    318     void checkForTextSizeAdjust(RenderStyle*);
     318    void checkForTextSizeAdjust(RenderStyle&);
    319319#endif
    320320
Note: See TracChangeset for help on using the changeset viewer.