Changeset 246755 in webkit
- Timestamp:
- Jun 24, 2019 12:37:59 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246752 r246755 1 2019-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 1 19 2019-06-24 Antoine Quint <graouts@apple.com> 2 20 -
trunk/Source/WebCore/css/StyleResolver.cpp
r246490 r246755 1175 1175 } 1176 1176 1177 static void checkForOrientationChange(RenderStyle *style)1177 static void checkForOrientationChange(RenderStyle& style) 1178 1178 { 1179 1179 FontOrientation fontOrientation; 1180 1180 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(); 1184 1184 if (fontDescription.orientation() == fontOrientation && fontDescription.nonCJKGlyphOrientation() == glyphOrientation) 1185 1185 return; … … 1188 1188 newFontDescription.setNonCJKGlyphOrientation(glyphOrientation); 1189 1189 newFontDescription.setOrientation(fontOrientation); 1190 style ->setFontDescription(WTFMove(newFontDescription));1190 style.setFontDescription(WTFMove(newFontDescription)); 1191 1191 } 1192 1192 … … 1196 1196 return; 1197 1197 1198 RenderStyle* style =m_state.style();1198 auto& style = *m_state.style(); 1199 1199 #if ENABLE(TEXT_AUTOSIZING) 1200 1200 checkForTextSizeAdjust(style); … … 1203 1203 checkForZoomChange(style, m_state.parentStyle()); 1204 1204 checkForOrientationChange(style); 1205 style ->fontCascade().update(&document().fontSelector());1205 style.fontCascade().update(&document().fontSelector()); 1206 1206 if (m_state.fontSizeHasViewportUnits()) 1207 style ->setHasViewportUnits(true);1207 style.setHasViewportUnits(true); 1208 1208 m_state.setFontDirty(false); 1209 1209 } … … 1849 1849 1850 1850 #if ENABLE(TEXT_AUTOSIZING) 1851 void StyleResolver::checkForTextSizeAdjust(RenderStyle* style) 1852 { 1853 ASSERT(style); 1854 if (style->textSizeAdjust().isAuto() || (settings().textAutosizingUsesIdempotentMode() && !style->textSizeAdjust().isNone())) 1851 void StyleResolver::checkForTextSizeAdjust(RenderStyle& style) 1852 { 1853 if (style.textSizeAdjust().isAuto() || (settings().textAutosizingUsesIdempotentMode() && !style.textSizeAdjust().isNone())) 1855 1854 return; 1856 1855 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()); 1860 1859 else 1861 1860 newFontDescription.setComputedSize(newFontDescription.specifiedSize()); 1862 style ->setFontDescription(WTFMove(newFontDescription));1861 style.setFontDescription(WTFMove(newFontDescription)); 1863 1862 } 1864 1863 #endif 1865 1864 1866 void StyleResolver::checkForZoomChange(RenderStyle *style, const RenderStyle* parentStyle)1865 void StyleResolver::checkForZoomChange(RenderStyle& style, const RenderStyle* parentStyle) 1867 1866 { 1868 1867 if (!parentStyle) 1869 1868 return; 1870 1869 1871 if (style ->effectiveZoom() == parentStyle->effectiveZoom() && style->textZoom() == parentStyle->textZoom())1870 if (style.effectiveZoom() == parentStyle->effectiveZoom() && style.textZoom() == parentStyle->textZoom()) 1872 1871 return; 1873 1872 1874 const auto& childFont = style ->fontDescription();1873 const auto& childFont = style.fontDescription(); 1875 1874 auto newFontDescription = childFont; 1876 1875 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 1879 void StyleResolver::checkForGenericFamilyChange(RenderStyle& style, const RenderStyle* parentStyle) 1880 { 1881 const auto& childFont = style.fontDescription(); 1883 1882 1884 1883 if (childFont.isAbsoluteSize() || !parentStyle) … … 1906 1905 auto newFontDescription = childFont; 1907 1906 setFontSize(newFontDescription, size); 1908 style ->setFontDescription(WTFMove(newFontDescription));1907 style.setFontDescription(WTFMove(newFontDescription)); 1909 1908 } 1910 1909 -
trunk/Source/WebCore/css/StyleResolver.h
r246490 r246755 313 313 private: 314 314 // 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); 317 317 #if ENABLE(TEXT_AUTOSIZING) 318 void checkForTextSizeAdjust(RenderStyle *);318 void checkForTextSizeAdjust(RenderStyle&); 319 319 #endif 320 320
Note: See TracChangeset
for help on using the changeset viewer.