Reduce copying of FontCascadeDescription objects by moving them around
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 00:25:23 +0000 (00:25 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 00:25:23 +0000 (00:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185963

Reviewed by Simon Fraser.

Reduce copying of FontCascadeDescription objects by moving them around when possible.

Source/WebCore:

* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueWebkitLocale):
(WebCore::StyleBuilderCustom::applyInitialFontFamily):
(WebCore::StyleBuilderCustom::applyInheritFontFamily):
(WebCore::StyleBuilderCustom::applyValueFontFamily):
(WebCore::StyleBuilderCustom::applyInheritFontVariantLigatures):
(WebCore::StyleBuilderCustom::applyInitialFontVariantLigatures):
(WebCore::StyleBuilderCustom::applyValueFontVariantLigatures):
(WebCore::StyleBuilderCustom::applyInheritFontVariantNumeric):
(WebCore::StyleBuilderCustom::applyInitialFontVariantNumeric):
(WebCore::StyleBuilderCustom::applyValueFontVariantNumeric):
(WebCore::StyleBuilderCustom::applyInheritFontVariantEastAsian):
(WebCore::StyleBuilderCustom::applyInitialFontVariantEastAsian):
(WebCore::StyleBuilderCustom::applyValueFontVariantEastAsian):
(WebCore::StyleBuilderCustom::applyInitialFontSize):
(WebCore::StyleBuilderCustom::applyInheritFontSize):
(WebCore::StyleBuilderCustom::applyInitialFontStyle):
(WebCore::StyleBuilderCustom::applyInheritFontStyle):
(WebCore::StyleBuilderCustom::applyValueFontStyle):
(WebCore::StyleBuilderCustom::applyValueFontSize):
* css/StyleResolver.cpp:
(WebCore::checkForOrientationChange):
(WebCore::StyleResolver::checkForTextSizeAdjust):
(WebCore::StyleResolver::checkForZoomChange):
(WebCore::StyleResolver::checkForGenericFamilyChange):
(WebCore::StyleResolver::initializeFontStyle):
* css/StyleResolver.h:
(WebCore::StyleResolver::State::setFontDescription):
(WebCore::StyleResolver::setFontDescription):
* css/makeprop.pl:
(generateInitialValueSetter):
(generateInheritValueSetter):
(generateValueSetter):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setFont):
* page/DebugPageOverlays.cpp:
(WebCore::NonFastScrollableRegionOverlay::drawRect):
* page/linux/ResourceUsageOverlayLinux.cpp:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::FontCascade):
* platform/graphics/FontCascade.h:
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::drawTextAtPoint const):
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText):
* platform/win/DragImageWin.cpp:
(WebCore::dragLabelFont):
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::calculatePositionAndSize):
(WebCore::PopupMenuWin::paint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
* rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineTextIfNeeded):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry const):
* rendering/RenderListBox.cpp:
(WebCore::bolder):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::computeMarkerStyle const):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::setFontFromControlSize const):
* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):
(WebCore::TextAutoSizingValue::reset):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setFontDescription):
(WebCore::RenderStyle::setFontSize):
(WebCore::RenderStyle::setFontVariationSettings):
(WebCore::RenderStyle::setFontWeight):
(WebCore::RenderStyle::setFontStretch):
(WebCore::RenderStyle::setFontItalic):
* rendering/style/RenderStyle.h:
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
* rendering/updating/RenderTreeBuilderFirstLetter.cpp:
(WebCore::styleForFirstLetter):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

Source/WebKitLegacy/win:

* FullscreenVideoController.cpp:
(FullscreenVideoController::draw):

Tools:

* TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232175 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/makeprop.pl
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/page/DebugPageOverlays.cpp
Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderCombineText.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListItem.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/TextAutoSizing.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/FullscreenVideoController.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp

index 51422a2..cea4035 100644 (file)
@@ -1,5 +1,97 @@
 2018-05-24  Chris Dumez  <cdumez@apple.com>
 
+        Reduce copying of FontCascadeDescription objects by moving them around
+        https://bugs.webkit.org/show_bug.cgi?id=185963
+
+        Reviewed by Simon Fraser.
+
+        Reduce copying of FontCascadeDescription objects by moving them around when possible.
+
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyValueWebkitLocale):
+        (WebCore::StyleBuilderCustom::applyInitialFontFamily):
+        (WebCore::StyleBuilderCustom::applyInheritFontFamily):
+        (WebCore::StyleBuilderCustom::applyValueFontFamily):
+        (WebCore::StyleBuilderCustom::applyInheritFontVariantLigatures):
+        (WebCore::StyleBuilderCustom::applyInitialFontVariantLigatures):
+        (WebCore::StyleBuilderCustom::applyValueFontVariantLigatures):
+        (WebCore::StyleBuilderCustom::applyInheritFontVariantNumeric):
+        (WebCore::StyleBuilderCustom::applyInitialFontVariantNumeric):
+        (WebCore::StyleBuilderCustom::applyValueFontVariantNumeric):
+        (WebCore::StyleBuilderCustom::applyInheritFontVariantEastAsian):
+        (WebCore::StyleBuilderCustom::applyInitialFontVariantEastAsian):
+        (WebCore::StyleBuilderCustom::applyValueFontVariantEastAsian):
+        (WebCore::StyleBuilderCustom::applyInitialFontSize):
+        (WebCore::StyleBuilderCustom::applyInheritFontSize):
+        (WebCore::StyleBuilderCustom::applyInitialFontStyle):
+        (WebCore::StyleBuilderCustom::applyInheritFontStyle):
+        (WebCore::StyleBuilderCustom::applyValueFontStyle):
+        (WebCore::StyleBuilderCustom::applyValueFontSize):
+        * css/StyleResolver.cpp:
+        (WebCore::checkForOrientationChange):
+        (WebCore::StyleResolver::checkForTextSizeAdjust):
+        (WebCore::StyleResolver::checkForZoomChange):
+        (WebCore::StyleResolver::checkForGenericFamilyChange):
+        (WebCore::StyleResolver::initializeFontStyle):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::State::setFontDescription):
+        (WebCore::StyleResolver::setFontDescription):
+        * css/makeprop.pl:
+        (generateInitialValueSetter):
+        (generateInheritValueSetter):
+        (generateValueSetter):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setFont):
+        * page/DebugPageOverlays.cpp:
+        (WebCore::NonFastScrollableRegionOverlay::drawRect):
+        * page/linux/ResourceUsageOverlayLinux.cpp:
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::FontCascade):
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayerWin::drawTextAtPoint const):
+        * platform/mock/MockRealtimeVideoSource.cpp:
+        (WebCore::MockRealtimeVideoSource::drawText):
+        * platform/win/DragImageWin.cpp:
+        (WebCore::dragLabelFont):
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::calculatePositionAndSize):
+        (WebCore::PopupMenuWin::paint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+        * rendering/RenderCombineText.cpp:
+        (WebCore::RenderCombineText::combineTextIfNeeded):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry const):
+        * rendering/RenderListBox.cpp:
+        (WebCore::bolder):
+        (WebCore::RenderListBox::paintItemForeground):
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::computeMarkerStyle const):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::adjustStyle):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::setFontFromControlSize const):
+        * rendering/TextAutoSizing.cpp:
+        (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
+        (WebCore::TextAutoSizingValue::reset):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::setFontDescription):
+        (WebCore::RenderStyle::setFontSize):
+        (WebCore::RenderStyle::setFontVariationSettings):
+        (WebCore::RenderStyle::setFontWeight):
+        (WebCore::RenderStyle::setFontStretch):
+        (WebCore::RenderStyle::setFontItalic):
+        * rendering/style/RenderStyle.h:
+        * rendering/svg/RenderSVGInlineText.cpp:
+        (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
+        * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
+        (WebCore::styleForFirstLetter):
+        * style/StyleResolveForDocument.cpp:
+        (WebCore::Style::resolveForDocument):
+
+2018-05-24  Chris Dumez  <cdumez@apple.com>
+
         Avoid constructing the string "all" repeatedly in MediaQueryParser
         https://bugs.webkit.org/show_bug.cgi?id=185961
 
index a74f931..f8dd0f0 100644 (file)
@@ -782,7 +782,7 @@ inline void StyleBuilderCustom::applyValueWebkitLocale(StyleResolver& styleResol
         fontDescription.setLocale(nullAtom());
     else
         fontDescription.setLocale(primitiveValue.stringValue());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueWritingMode(StyleResolver& styleResolver, CSSValue& value)
@@ -914,7 +914,7 @@ inline void StyleBuilderCustom::applyInitialFontFamily(StyleResolver& styleResol
     if (!initialDesc.firstFamily().isEmpty())
         fontDescription.setFamilies(initialDesc.families());
 
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInheritFontFamily(StyleResolver& styleResolver)
@@ -924,7 +924,7 @@ inline void StyleBuilderCustom::applyInheritFontFamily(StyleResolver& styleResol
 
     fontDescription.setFamilies(parentFontDescription.families());
     fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontFamily(StyleResolver& styleResolver, CSSValue& value)
@@ -1001,7 +1001,7 @@ inline void StyleBuilderCustom::applyValueFontFamily(StyleResolver& styleResolve
             styleResolver.setFontSize(fontDescription, Style::fontSizeForKeyword(sizeIdentifier, !oldFamilyUsedFixedDefaultSize, styleResolver.document()));
     }
 
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline bool StyleBuilderCustom::isValidDisplayValue(StyleResolver& styleResolver, EDisplay display)
@@ -1468,7 +1468,7 @@ inline void StyleBuilderCustom::applyInheritFontVariantLigatures(StyleResolver&
     fontDescription.setVariantDiscretionaryLigatures(styleResolver.parentFontDescription().variantDiscretionaryLigatures());
     fontDescription.setVariantHistoricalLigatures(styleResolver.parentFontDescription().variantHistoricalLigatures());
     fontDescription.setVariantContextualAlternates(styleResolver.parentFontDescription().variantContextualAlternates());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInitialFontVariantLigatures(StyleResolver& styleResolver)
@@ -1478,7 +1478,7 @@ inline void StyleBuilderCustom::applyInitialFontVariantLigatures(StyleResolver&
     fontDescription.setVariantDiscretionaryLigatures(FontVariantLigatures::Normal);
     fontDescription.setVariantHistoricalLigatures(FontVariantLigatures::Normal);
     fontDescription.setVariantContextualAlternates(FontVariantLigatures::Normal);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontVariantLigatures(StyleResolver& styleResolver, CSSValue& value)
@@ -1489,7 +1489,7 @@ inline void StyleBuilderCustom::applyValueFontVariantLigatures(StyleResolver& st
     fontDescription.setVariantDiscretionaryLigatures(variantLigatures.discretionaryLigatures);
     fontDescription.setVariantHistoricalLigatures(variantLigatures.historicalLigatures);
     fontDescription.setVariantContextualAlternates(variantLigatures.contextualAlternates);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInheritFontVariantNumeric(StyleResolver& styleResolver)
@@ -1500,7 +1500,7 @@ inline void StyleBuilderCustom::applyInheritFontVariantNumeric(StyleResolver& st
     fontDescription.setVariantNumericFraction(styleResolver.parentFontDescription().variantNumericFraction());
     fontDescription.setVariantNumericOrdinal(styleResolver.parentFontDescription().variantNumericOrdinal());
     fontDescription.setVariantNumericSlashedZero(styleResolver.parentFontDescription().variantNumericSlashedZero());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInitialFontVariantNumeric(StyleResolver& styleResolver)
@@ -1511,7 +1511,7 @@ inline void StyleBuilderCustom::applyInitialFontVariantNumeric(StyleResolver& st
     fontDescription.setVariantNumericFraction(FontVariantNumericFraction::Normal);
     fontDescription.setVariantNumericOrdinal(FontVariantNumericOrdinal::Normal);
     fontDescription.setVariantNumericSlashedZero(FontVariantNumericSlashedZero::Normal);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontVariantNumeric(StyleResolver& styleResolver, CSSValue& value)
@@ -1523,7 +1523,7 @@ inline void StyleBuilderCustom::applyValueFontVariantNumeric(StyleResolver& styl
     fontDescription.setVariantNumericFraction(variantNumeric.fraction);
     fontDescription.setVariantNumericOrdinal(variantNumeric.ordinal);
     fontDescription.setVariantNumericSlashedZero(variantNumeric.slashedZero);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInheritFontVariantEastAsian(StyleResolver& styleResolver)
@@ -1532,7 +1532,7 @@ inline void StyleBuilderCustom::applyInheritFontVariantEastAsian(StyleResolver&
     fontDescription.setVariantEastAsianVariant(styleResolver.parentFontDescription().variantEastAsianVariant());
     fontDescription.setVariantEastAsianWidth(styleResolver.parentFontDescription().variantEastAsianWidth());
     fontDescription.setVariantEastAsianRuby(styleResolver.parentFontDescription().variantEastAsianRuby());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInitialFontVariantEastAsian(StyleResolver& styleResolver)
@@ -1541,7 +1541,7 @@ inline void StyleBuilderCustom::applyInitialFontVariantEastAsian(StyleResolver&
     fontDescription.setVariantEastAsianVariant(FontVariantEastAsianVariant::Normal);
     fontDescription.setVariantEastAsianWidth(FontVariantEastAsianWidth::Normal);
     fontDescription.setVariantEastAsianRuby(FontVariantEastAsianRuby::Normal);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontVariantEastAsian(StyleResolver& styleResolver, CSSValue& value)
@@ -1551,7 +1551,7 @@ inline void StyleBuilderCustom::applyValueFontVariantEastAsian(StyleResolver& st
     fontDescription.setVariantEastAsianVariant(variantEastAsian.variant);
     fontDescription.setVariantEastAsianWidth(variantEastAsian.width);
     fontDescription.setVariantEastAsianRuby(variantEastAsian.ruby);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInitialFontSize(StyleResolver& styleResolver)
@@ -1564,7 +1564,7 @@ inline void StyleBuilderCustom::applyInitialFontSize(StyleResolver& styleResolve
 
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     styleResolver.setFontSize(fontDescription, size);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInheritFontSize(StyleResolver& styleResolver)
@@ -1578,7 +1578,7 @@ inline void StyleBuilderCustom::applyInheritFontSize(StyleResolver& styleResolve
     auto fontDescription = styleResolver.style()->fontDescription();
     fontDescription.setKeywordSize(parentFontDescription.keywordSize());
     styleResolver.setFontSize(fontDescription, size);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 // When the CSS keyword "larger" is used, this function will attempt to match within the keyword
@@ -1620,7 +1620,7 @@ inline void StyleBuilderCustom::applyInitialFontStyle(StyleResolver& styleResolv
     auto fontDescription = styleResolver.fontDescription();
     fontDescription.setItalic(FontCascadeDescription::initialItalic());
     fontDescription.setFontStyleAxis(FontCascadeDescription::initialFontStyleAxis());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInheritFontStyle(StyleResolver& styleResolver)
@@ -1628,7 +1628,7 @@ inline void StyleBuilderCustom::applyInheritFontStyle(StyleResolver& styleResolv
     auto fontDescription = styleResolver.fontDescription();
     fontDescription.setItalic(styleResolver.parentFontDescription().italic());
     fontDescription.setFontStyleAxis(styleResolver.parentFontDescription().fontStyleAxis());
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontStyle(StyleResolver& styleResolver, CSSValue& value)
@@ -1637,7 +1637,7 @@ inline void StyleBuilderCustom::applyValueFontStyle(StyleResolver& styleResolver
     auto fontDescription = styleResolver.fontDescription();
     fontDescription.setItalic(StyleBuilderConverter::convertFontStyleFromValue(fontStyleValue));
     fontDescription.setFontStyleAxis(fontStyleValue.fontStyleValue->valueID() == CSSValueItalic ? FontStyleAxis::ital : FontStyleAxis::slnt);
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyValueFontSize(StyleResolver& styleResolver, CSSValue& value)
@@ -1701,7 +1701,7 @@ inline void StyleBuilderCustom::applyValueFontSize(StyleResolver& styleResolver,
         return;
 
     styleResolver.setFontSize(fontDescription, std::min(maximumAllowedFontSize, size));
-    styleResolver.setFontDescription(fontDescription);
+    styleResolver.setFontDescription(WTFMove(fontDescription));
 }
 
 inline void StyleBuilderCustom::applyInitialGridTemplateAreas(StyleResolver& styleResolver)
index f567416..b038ae7 100644 (file)
@@ -1089,7 +1089,7 @@ static void checkForOrientationChange(RenderStyle* style)
     auto newFontDescription = fontDescription;
     newFontDescription.setNonCJKGlyphOrientation(glyphOrientation);
     newFontDescription.setOrientation(fontOrientation);
-    style->setFontDescription(newFontDescription);
+    style->setFontDescription(WTFMove(newFontDescription));
 }
 
 void StyleResolver::updateFont()
@@ -1736,7 +1736,7 @@ void StyleResolver::checkForTextSizeAdjust(RenderStyle* style)
         newFontDescription.setComputedSize(newFontDescription.specifiedSize() * style->textSizeAdjust().multiplier());
     else
         newFontDescription.setComputedSize(newFontDescription.specifiedSize());
-    style->setFontDescription(newFontDescription);
+    style->setFontDescription(WTFMove(newFontDescription));
 }
 #endif
 
@@ -1751,7 +1751,7 @@ void StyleResolver::checkForZoomChange(RenderStyle* style, const RenderStyle* pa
     const auto& childFont = style->fontDescription();
     auto newFontDescription = childFont;
     setFontSize(newFontDescription, childFont.specifiedSize());
-    style->setFontDescription(newFontDescription);
+    style->setFontDescription(WTFMove(newFontDescription));
 }
 
 void StyleResolver::checkForGenericFamilyChange(RenderStyle* style, const RenderStyle* parentStyle)
@@ -1782,7 +1782,7 @@ void StyleResolver::checkForGenericFamilyChange(RenderStyle* style, const Render
 
     auto newFontDescription = childFont;
     setFontSize(newFontDescription, size);
-    style->setFontDescription(newFontDescription);
+    style->setFontDescription(WTFMove(newFontDescription));
 }
 
 void StyleResolver::initializeFontStyle()
@@ -1793,7 +1793,7 @@ void StyleResolver::initializeFontStyle()
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueMedium, false, document()));
     fontDescription.setShouldAllowUserInstalledFonts(settings().shouldAllowUserInstalledFonts() ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No);
-    setFontDescription(fontDescription);
+    setFontDescription(WTFMove(fontDescription));
 }
 
 void StyleResolver::setFontSize(FontCascadeDescription& fontDescription, float size)
index 6d66a62..bc912db 100644 (file)
@@ -377,7 +377,7 @@ public:
 
         const FontCascadeDescription& fontDescription() { return m_style->fontDescription(); }
         const FontCascadeDescription& parentFontDescription() { return m_parentStyle->fontDescription(); }
-        void setFontDescription(const FontCascadeDescription& fontDescription) { m_fontDirty |= m_style->setFontDescription(fontDescription); }
+        void setFontDescription(FontCascadeDescription&& fontDescription) { m_fontDirty |= m_style->setFontDescription(WTFMove(fontDescription)); }
         void setZoom(float f) { m_fontDirty |= m_style->setZoom(f); }
         void setEffectiveZoom(float f) { m_fontDirty |= m_style->setEffectiveZoom(f); }
         void setWritingMode(WritingMode writingMode) { m_fontDirty |= m_style->setWritingMode(writingMode); }
@@ -448,7 +448,7 @@ public:
     InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
     const FontCascadeDescription& fontDescription() { return m_state.fontDescription(); }
     const FontCascadeDescription& parentFontDescription() { return m_state.parentFontDescription(); }
-    void setFontDescription(const FontCascadeDescription& fontDescription) { m_state.setFontDescription(fontDescription); }
+    void setFontDescription(FontCascadeDescription&& fontDescription) { m_state.setFontDescription(WTFMove(fontDescription)); }
     void setZoom(float f) { m_state.setZoom(f); }
     void setEffectiveZoom(float f) { m_state.setEffectiveZoom(f); }
     void setWritingMode(WritingMode writingMode) { m_state.setWritingMode(writingMode); }
index a8b46b0..3e36b19 100755 (executable)
@@ -853,7 +853,7 @@ sub generateInitialValueSetter {
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
     $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
     $setterContent .= $indent . "    fontDescription." . $setter . "(FontCascadeDescription::" . $initial . "());\n";
-    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
+    $setterContent .= $indent . "    styleResolver.setFontDescription(WTFMove(fontDescription));\n";
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
     $setterContent .= generateFillLayerPropertyInitialValueSetter($name, $indent . "    ");
   } else {
@@ -897,7 +897,7 @@ sub generateInheritValueSetter {
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
     $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
     $setterContent .= $indent . "    fontDescription." . $setter . "(styleResolver.parentFontDescription()." . $getter . "());\n";
-    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
+    $setterContent .= $indent . "    styleResolver.setFontDescription(WTFMove(fontDescription));\n";
     $didCallSetValue = 1;
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
     $setterContent .= generateFillLayerPropertyInheritValueSetter($name, $indent . "    ");
@@ -951,7 +951,7 @@ sub generateValueSetter {
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"font-property"}) {
     $setterContent .= $indent . "    auto fontDescription = styleResolver.fontDescription();\n";
     $setterContent .= $indent . "    fontDescription." . $setter . "(" . $convertedValue . ");\n";
-    $setterContent .= $indent . "    styleResolver.setFontDescription(fontDescription);\n";
+    $setterContent .= $indent . "    styleResolver.setFontDescription(WTFMove(fontDescription));\n";
     $didCallSetValue = 1;
   } elsif (exists $propertiesWithStyleBuilderOptions{$name}{"fill-layer-property"}) {
     $setterContent .= generateFillLayerPropertyValueSetter($name, $indent . "    ");
index 77635a6..e9ae63c 100644 (file)
@@ -150,14 +150,14 @@ void CanvasRenderingContext2D::setFont(const String& newFont)
     document.updateStyleIfNeeded();
 
     if (auto* computedStyle = canvas().computedStyle())
-        newStyle->setFontDescription(computedStyle->fontDescription());
+        newStyle->setFontDescription(FontCascadeDescription { computedStyle->fontDescription() });
     else {
         FontCascadeDescription defaultFontDescription;
         defaultFontDescription.setOneFamily(DefaultFontFamily);
         defaultFontDescription.setSpecifiedSize(DefaultFontSize);
         defaultFontDescription.setComputedSize(DefaultFontSize);
 
-        newStyle->setFontDescription(defaultFontDescription);
+        newStyle->setFontDescription(WTFMove(defaultFontDescription));
     }
 
     newStyle->fontCascade().update(&document.fontSelector());
index 0255463..a979f65 100644 (file)
@@ -189,7 +189,7 @@ void NonFastScrollableRegionOverlay::drawRect(PageOverlay& pageOverlay, Graphics
     fontDescription.setSpecifiedSize(12);
     fontDescription.setComputedSize(12);
     fontDescription.setWeight(FontSelectionValue(500));
-    FontCascade font(fontDescription, 0, 0);
+    FontCascade font(WTFMove(fontDescription), 0, 0);
     font.update(nullptr);
 
 #if ENABLE(TOUCH_EVENTS)
index 9643d9c..4c52d98 100644 (file)
@@ -76,7 +76,7 @@ public:
         FontCascadeDescription fontDescription;
         RenderTheme::singleton().systemFont(CSSValueMessageBox, fontDescription);
         fontDescription.setComputedSize(gFontSize);
-        m_textFont = FontCascade(fontDescription, 0, 0);
+        m_textFont = FontCascade(WTFMove(fontDescription), 0, 0);
         m_textFont.update(nullptr);
     }
 
index 847861f..bfbcb83 100644 (file)
@@ -77,11 +77,11 @@ FontCascade::FontCascade()
 {
 }
 
-FontCascade::FontCascade(const FontCascadeDescription& fd, float letterSpacing, float wordSpacing)
-    : m_fontDescription(fd)
+FontCascade::FontCascade(FontCascadeDescription&& fd, float letterSpacing, float wordSpacing)
+    : m_fontDescription(WTFMove(fd))
     , m_letterSpacing(letterSpacing)
     , m_wordSpacing(wordSpacing)
-    , m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(fd.firstFamily()))
+    , m_useBackslashAsYenSymbol(useBackslashAsYenSignForFamily(m_fontDescription.firstFamily()))
     , m_enableKerning(computeEnableKerning())
     , m_requiresShaping(computeRequiresShaping())
 {
index e1e1b52..3529a95 100644 (file)
@@ -101,7 +101,7 @@ public:
 class FontCascade {
 public:
     WEBCORE_EXPORT FontCascade();
-    WEBCORE_EXPORT FontCascade(const FontCascadeDescription&, float letterSpacing = 0, float wordSpacing = 0);
+    WEBCORE_EXPORT FontCascade(FontCascadeDescription&&, float letterSpacing = 0, float wordSpacing = 0);
     // This constructor is only used if the platform wants to start with a native font.
     WEBCORE_EXPORT FontCascade(const FontPlatformData&, FontSmoothingMode = AutoSmoothing);
 
index c000b43..9700bb7 100644 (file)
@@ -963,7 +963,7 @@ void PlatformCALayerWin::drawTextAtPoint(CGContextRef context, CGFloat x, CGFloa
 
     desc.setComputedSize(scale.width * fontSize);
 
-    FontCascade font = FontCascade(desc, 0, 0);
+    FontCascade font = FontCascade(WTFMove(desc), 0, 0);
     font.update(nullptr);
 
     GraphicsContext cg(context);
index 40aae99..ea153c9 100644 (file)
@@ -336,17 +336,17 @@ void MockRealtimeVideoSource::drawText(GraphicsContext& context)
 
     fontDescription.setSpecifiedSize(m_baseFontSize);
     fontDescription.setComputedSize(m_baseFontSize);
-    FontCascade timeFont { fontDescription, 0, 0 };
+    FontCascade timeFont { FontCascadeDescription { fontDescription }, 0, 0 };
     timeFont.update(nullptr);
 
     fontDescription.setSpecifiedSize(m_bipBopFontSize);
     fontDescription.setComputedSize(m_bipBopFontSize);
-    FontCascade bipBopFont { fontDescription, 0, 0 };
+    FontCascade bipBopFont { FontCascadeDescription { fontDescription }, 0, 0 };
     bipBopFont.update(nullptr);
 
     fontDescription.setSpecifiedSize(m_statsFontSize);
     fontDescription.setComputedSize(m_statsFontSize);
-    FontCascade statsFont { fontDescription, 0, 0 };
+    FontCascade statsFont { WTFMove(fontDescription), 0, 0 };
     statsFont.update(nullptr);
 
     IntSize size = this->size();
index f9971e6..1dfa50b 100644 (file)
@@ -116,7 +116,7 @@ static FontCascade dragLabelFont(int size, bool bold, FontRenderingMode renderin
     description.setSpecifiedSize((float)size);
     description.setComputedSize((float)size);
     description.setRenderingMode(renderingMode);
-    result = FontCascade(description, 0, 0);
+    result = FontCascade(WTFMove(description), 0, 0);
     result.update(0);
     return result;
 }
index 58433c5..f29406a 100644 (file)
@@ -322,7 +322,7 @@ void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v)
     m_font = client()->menuStyle().font();
     auto d = m_font.fontDescription();
     d.setComputedSize(d.computedSize() * m_scaleFactor);
-    m_font = FontCascade(d, m_font.letterSpacing(), m_font.wordSpacing());
+    m_font = FontCascade(WTFMove(d), m_font.letterSpacing(), m_font.wordSpacing());
     m_font.update(m_popupClient->fontSelector());
 
     // First, determine the popup's height
@@ -345,7 +345,7 @@ void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v)
         if (client()->itemIsLabel(i)) {
             auto d = itemFont.fontDescription();
             d.setWeight(d.bolderWeight());
-            itemFont = FontCascade(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+            itemFont = FontCascade(WTFMove(d), itemFont.letterSpacing(), itemFont.wordSpacing());
             itemFont.update(m_popupClient->fontSelector());
         }
 
@@ -650,7 +650,7 @@ void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)
         if (client()->itemIsLabel(index)) {
             auto d = itemFont.fontDescription();
             d.setWeight(d.bolderWeight());
-            itemFont = FontCascade(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+            itemFont = FontCascade(WTFMove(d), itemFont.letterSpacing(), itemFont.wordSpacing());
             itemFont.update(m_popupClient->fontSelector());
         }
         
index 192373d..d343191 100644 (file)
@@ -392,7 +392,7 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
             // Propagate the body font back up to the RenderView and use it as
             // the basis of the grid.
             if (newStyle.fontDescription() != view().style().fontDescription()) {
-                view().mutableStyle().setFontDescription(newStyle.fontDescription());
+                view().mutableStyle().setFontDescription(FontCascadeDescription { newStyle.fontDescription() });
                 view().mutableStyle().fontCascade().update(&document().fontSelector());
             }
         }
index 9cf4fb8..d616329 100644 (file)
@@ -124,7 +124,7 @@ void RenderCombineText::combineTextIfNeeded()
 
     description.setOrientation(Horizontal); // We are going to draw combined text horizontally.
 
-    FontCascade horizontalFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
+    FontCascade horizontalFont(FontCascadeDescription { description }, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
     horizontalFont.update(fontSelector);
     
     GlyphOverflow glyphOverflow;
@@ -137,14 +137,14 @@ void RenderCombineText::combineTextIfNeeded()
     m_isCombined = combinedTextWidth <= emWidth;
     
     if (m_isCombined)
-        shouldUpdateFont = m_combineFontStyle->setFontDescription(description); // Need to change font orientation to horizontal.
+        shouldUpdateFont = m_combineFontStyle->setFontDescription(WTFMove(description)); // Need to change font orientation to horizontal.
     else {
         // Need to try compressed glyphs.
         static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
         for (auto widthVariant : widthVariants) {
             description.setWidthVariant(widthVariant); // When modifying this, make sure to keep it in sync with FontPlatformData::isForTextCombine()!
 
-            FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
+            FontCascade compressedFont(FontCascadeDescription { description }, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
             compressedFont.update(fontSelector);
             
             glyphOverflow.left = glyphOverflow.top = glyphOverflow.right = glyphOverflow.bottom = 0;
@@ -154,7 +154,7 @@ void RenderCombineText::combineTextIfNeeded()
                 m_isCombined = true;
 
                 // Replace my font with the new one.
-                shouldUpdateFont = m_combineFontStyle->setFontDescription(description);
+                shouldUpdateFont = m_combineFontStyle->setFontDescription(WTFMove(description));
                 break;
             }
             
@@ -172,9 +172,9 @@ void RenderCombineText::combineTextIfNeeded()
         do {
             float computedSize = originalSize * scaleFactor;
             bestFitDescription.setComputedSize(computedSize);
-            shouldUpdateFont = m_combineFontStyle->setFontDescription(bestFitDescription);
+            shouldUpdateFont = m_combineFontStyle->setFontDescription(FontCascadeDescription { bestFitDescription });
         
-            FontCascade compressedFont(bestFitDescription, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
+            FontCascade compressedFont(WTFMove(bestFitDescription), style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
             compressedFont.update(fontSelector);
             
             glyphOverflow.left = glyphOverflow.top = glyphOverflow.right = glyphOverflow.bottom = 0;
index cd1cb99..b982504 100644 (file)
@@ -378,7 +378,7 @@ void RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
     fontDescription.setWeight(boldWeightValue());
     fontDescription.setRenderingMode(settings().fontRenderingMode());
     fontDescription.setComputedSize(12);
-    font = FontCascade(fontDescription, 0, 0);
+    font = FontCascade(WTFMove(fontDescription), 0, 0);
     font.update(0);
 
     run = TextRun(m_unavailablePluginReplacementText);
index 94f7d52..101064c 100644 (file)
@@ -120,7 +120,7 @@ static FontCascade bolder(Document& document, const FontCascade& font)
 {
     auto description = font.fontDescription();
     description.setWeight(description.bolderWeight());
-    auto result = FontCascade { description, font.letterSpacing(), font.wordSpacing() };
+    auto result = FontCascade { WTFMove(description), font.letterSpacing(), font.wordSpacing() };
     result.update(&document.fontSelector());
     return result;
 }
@@ -441,7 +441,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
     if (is<HTMLOptGroupElement>(*listItemElement)) {
         auto description = itemFont.fontDescription();
         description.setWeight(description.bolderWeight());
-        itemFont = FontCascade(description, itemFont.letterSpacing(), itemFont.wordSpacing());
+        itemFont = FontCascade(WTFMove(description), itemFont.letterSpacing(), itemFont.wordSpacing());
         itemFont.update(&document().fontSelector());
     }
 
index c738a9b..4be2330 100644 (file)
@@ -69,7 +69,7 @@ RenderStyle RenderListItem::computeMarkerStyle() const
     RenderStyle parentStyle = RenderStyle::clone(style());
     auto fontDescription = style().fontDescription();
     fontDescription.setVariantNumericSpacing(FontVariantNumericSpacing::TabularNumbers);
-    parentStyle.setFontDescription(fontDescription);
+    parentStyle.setFontDescription(WTFMove(fontDescription));
     parentStyle.fontCascade().update(&document().fontSelector());
     if (auto markerStyle = getCachedPseudoStyle(MARKER, &parentStyle))
         return RenderStyle::clone(*markerStyle);
index 424d2d5..af539f2 100644 (file)
@@ -176,7 +176,7 @@ void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style,
         if (auto themeFont = Theme::singleton().controlFont(part, style.fontCascade(), style.effectiveZoom())) {
             // If overriding the specified font with the theme font, also override the line height with the standard line height.
             style.setLineHeight(RenderStyle::initialLineHeight());
-            if (style.setFontDescription(themeFont.value()))
+            if (style.setFontDescription(WTFMove(themeFont.value())))
                 style.fontCascade().update(nullptr);
         }
 
index 9cf6082..33b22b9 100644 (file)
@@ -791,7 +791,7 @@ void RenderThemeMac::setFontFromControlSize(StyleResolver&, RenderStyle& style,
     // Reset line height
     style.setLineHeight(RenderStyle::initialLineHeight());
 
-    if (style.setFontDescription(fontDescription))
+    if (style.setFontDescription(WTFMove(fontDescription)))
         style.fontCascade().update(0);
 }
 
index b7a9079..3ba130d 100644 (file)
@@ -122,7 +122,7 @@ auto TextAutoSizingValue::adjustTextNodeSizes() -> StillHasNodes
         auto style = cloneRenderStyleWithState(renderer.style());
         auto fontDescription = style.fontDescription();
         fontDescription.setComputedSize(averageSize);
-        style.setFontDescription(fontDescription);
+        style.setFontDescription(FontCascadeDescription { fontDescription });
         style.fontCascade().update(&node->document().fontSelector());
         parentRenderer->setStyle(WTFMove(style));
 
@@ -133,7 +133,7 @@ auto TextAutoSizingValue::adjustTextNodeSizes() -> StillHasNodes
         if (is<RenderListMarker>(*parentRenderer->firstChild())) {
             auto& listMarkerRenderer = downcast<RenderListMarker>(*parentRenderer->firstChild());
             auto style = cloneRenderStyleWithState(listMarkerRenderer.style());
-            style.setFontDescription(fontDescription);
+            style.setFontDescription(FontCascadeDescription { fontDescription });
             style.fontCascade().update(&node->document().fontSelector());
             listMarkerRenderer.setStyle(WTFMove(style));
         }
@@ -156,7 +156,7 @@ auto TextAutoSizingValue::adjustTextNodeSizes() -> StillHasNodes
         auto newParentStyle = cloneRenderStyleWithState(parentStyle);
         newParentStyle.setLineHeight(Length(lineHeight, Fixed));
         newParentStyle.setSpecifiedLineHeight(Length { lineHeightLength });
-        newParentStyle.setFontDescription(fontDescription);
+        newParentStyle.setFontDescription(WTFMove(fontDescription));
         newParentStyle.fontCascade().update(&node->document().fontSelector());
         parentRenderer->setStyle(WTFMove(newParentStyle));
 
@@ -198,7 +198,7 @@ void TextAutoSizingValue::reset()
         if (fontDescription.computedSize() != originalSize) {
             fontDescription.setComputedSize(originalSize);
             auto style = cloneRenderStyleWithState(renderer->style());
-            style.setFontDescription(fontDescription);
+            style.setFontDescription(FontCascadeDescription { fontDescription });
             style.fontCascade().update(&node->document().fontSelector());
             parentRenderer->setStyle(WTFMove(style));
         }
@@ -214,7 +214,7 @@ void TextAutoSizingValue::reset()
 
         auto newParentStyle = cloneRenderStyleWithState(parentStyle);
         newParentStyle.setLineHeight(Length { originalLineHeight });
-        newParentStyle.setFontDescription(fontDescription);
+        newParentStyle.setFontDescription(WTFMove(fontDescription));
         newParentStyle.fontCascade().update(&node->document().fontSelector());
         parentRenderer->setStyle(WTFMove(newParentStyle));
     }
index 4cfea84..00d2d81 100644 (file)
@@ -1548,12 +1548,12 @@ float RenderStyle::letterSpacing() const
     return m_inheritedData->fontCascade.letterSpacing();
 }
 
-bool RenderStyle::setFontDescription(const FontCascadeDescription& description)
+bool RenderStyle::setFontDescription(FontCascadeDescription&& description)
 {
     if (m_inheritedData->fontCascade.fontDescription() == description)
         return false;
     auto& cascade = m_inheritedData.access().fontCascade;
-    cascade = { description, cascade.letterSpacing(), cascade.wordSpacing() };
+    cascade = { WTFMove(description), cascade.letterSpacing(), cascade.wordSpacing() };
     return true;
 }
 
@@ -1642,7 +1642,7 @@ void RenderStyle::setFontSize(float size)
     description.setSpecifiedSize(size);
     description.setComputedSize(size);
 
-    setFontDescription(description);
+    setFontDescription(WTFMove(description));
     fontCascade().update(currentFontSelector);
 }
 
@@ -1653,7 +1653,7 @@ void RenderStyle::setFontVariationSettings(FontVariationSettings settings)
     auto description = fontDescription();
     description.setVariationSettings(WTFMove(settings));
 
-    setFontDescription(description);
+    setFontDescription(WTFMove(description));
     fontCascade().update(currentFontSelector);
 }
 #endif
@@ -1664,7 +1664,7 @@ void RenderStyle::setFontWeight(FontSelectionValue value)
     auto description = fontDescription();
     description.setWeight(value);
 
-    setFontDescription(description);
+    setFontDescription(WTFMove(description));
     fontCascade().update(currentFontSelector);
 }
 
@@ -1674,7 +1674,7 @@ void RenderStyle::setFontStretch(FontSelectionValue value)
     auto description = fontDescription();
     description.setStretch(value);
 
-    setFontDescription(description);
+    setFontDescription(WTFMove(description));
     fontCascade().update(currentFontSelector);
 }
 
@@ -1684,7 +1684,7 @@ void RenderStyle::setFontItalic(FontSelectionValue value)
     auto description = fontDescription();
     description.setItalic(value);
 
-    setFontDescription(description);
+    setFontDescription(WTFMove(description));
     fontCascade().update(currentFontSelector);
 }
 
index 66a8f07..b471c48 100644 (file)
@@ -899,7 +899,7 @@ public:
     void setClear(Clear v) { m_nonInheritedFlags.clear = static_cast<unsigned>(v); }
     void setTableLayout(TableLayoutType v) { m_nonInheritedFlags.tableLayout = static_cast<unsigned>(v); }
 
-    bool setFontDescription(const FontCascadeDescription&);
+    bool setFontDescription(FontCascadeDescription&&);
 
     // Only used for blending font sizes when animating, for MathML anonymous blocks, and for text autosizing.
     void setFontSize(float);
index a9a1669..fd8f5cc 100644 (file)
@@ -247,7 +247,7 @@ void RenderSVGInlineText::computeNewScaledFontForStyle(const RenderObject& rende
     if (fontDescription.orientation() != FontOrientation::Horizontal)
         fontDescription.setOrientation(FontOrientation::Horizontal);
 
-    scaledFont = FontCascade(fontDescription, 0, 0);
+    scaledFont = FontCascade(WTFMove(fontDescription), 0, 0);
     scaledFont.update(&renderer.document().fontSelector());
 }
 
index 643dda3..a7eafa8 100644 (file)
@@ -66,7 +66,7 @@ static RenderStyle styleForFirstLetter(const RenderBlock& firstLetterBlock, cons
         float startingFontSize = ((firstLetterStyle.initialLetterHeight() - 1) * lineHeight + paragraph->style().fontMetrics().capHeight()) / capRatio;
         newFontDescription.setSpecifiedSize(startingFontSize);
         newFontDescription.setComputedSize(startingFontSize);
-        firstLetterStyle.setFontDescription(newFontDescription);
+        firstLetterStyle.setFontDescription(WTFMove(newFontDescription));
         firstLetterStyle.fontCascade().update(firstLetterStyle.fontCascade().fontSelector());
 
         int desiredCapHeight = (firstLetterStyle.initialLetterHeight() - 1) * lineHeight + paragraph->style().fontMetrics().capHeight();
@@ -75,7 +75,7 @@ static RenderStyle styleForFirstLetter(const RenderBlock& firstLetterBlock, cons
             auto newFontDescription = firstLetterStyle.fontDescription();
             newFontDescription.setSpecifiedSize(newFontDescription.specifiedSize() - 1);
             newFontDescription.setComputedSize(newFontDescription.computedSize() -1);
-            firstLetterStyle.setFontDescription(newFontDescription);
+            firstLetterStyle.setFontDescription(WTFMove(newFontDescription));
             firstLetterStyle.fontCascade().update(firstLetterStyle.fontCascade().fontSelector());
             actualCapHeight = firstLetterStyle.fontMetrics().capHeight();
         }
index 3a9db18..dafc9a6 100644 (file)
@@ -123,7 +123,7 @@ RenderStyle resolveForDocument(const Document& document)
     fontDescription.setOrientation(fontOrientation);
     fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
 
-    documentStyle.setFontDescription(fontDescription);
+    documentStyle.setFontDescription(WTFMove(fontDescription));
 
     documentStyle.fontCascade().update(&const_cast<Document&>(document).fontSelector());
 
index 74953be..425f49b 100644 (file)
@@ -1,3 +1,15 @@
+2018-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Reduce copying of FontCascadeDescription objects by moving them around
+        https://bugs.webkit.org/show_bug.cgi?id=185963
+
+        Reviewed by Simon Fraser.
+
+        Reduce copying of FontCascadeDescription objects by moving them around when possible.
+
+        * FullscreenVideoController.cpp:
+        (FullscreenVideoController::draw):
+
 2018-05-15  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Expose Web Animations CSS integration as an experimental feature
index 318f1a6..f81cfef 100644 (file)
@@ -520,7 +520,7 @@ void FullscreenVideoController::draw()
     desc.setOneFamily(metrics.lfSmCaptionFont.lfFaceName);
 
     desc.setComputedSize(textSize);
-    FontCascade font = FontCascade(desc, 0, 0);
+    FontCascade font = FontCascade(WTFMove(desc), 0, 0);
     font.update(0);
 
     String s;
index fbee6d5..645f70c 100644 (file)
@@ -1,3 +1,15 @@
+2018-05-24  Chris Dumez  <cdumez@apple.com>
+
+        Reduce copying of FontCascadeDescription objects by moving them around
+        https://bugs.webkit.org/show_bug.cgi?id=185963
+
+        Reviewed by Simon Fraser.
+
+        Reduce copying of FontCascadeDescription objects by moving them around when possible.
+
+        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2018-05-24  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         WebDriver: implement maximize, minimize and fullscreen window commands
index 8af8158..7595fe2 100644 (file)
@@ -49,7 +49,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceWithLeftRunInRTL)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(80);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
     auto spaceWidth = font.primaryFont().spaceWidth();
 
@@ -96,7 +96,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceInRTL)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(80);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     Vector<FloatSize> advances = { FloatSize(), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
@@ -140,7 +140,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceWithLeftRunInLTR)
     FontCascadeDescription description;
     description.setOneFamily("LucidaGrande");
     description.setComputedSize(80);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
     auto spaceWidth = font.primaryFont().spaceWidth();
 
@@ -183,7 +183,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceInLTR)
     FontCascadeDescription description;
     description.setOneFamily("LucidaGrande");
     description.setComputedSize(80);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     Vector<FloatSize> advances = { FloatSize(76.347656, 0.000000), FloatSize(0.000000, 0.000000) };
@@ -220,7 +220,7 @@ TEST_F(ComplexTextControllerTest, InitialAdvanceInRTLNoOrigins)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(48);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     FloatSize initialAdvance = FloatSize(4.33996383363472, 12.368896925859);
@@ -266,7 +266,7 @@ TEST_F(ComplexTextControllerTest, LeadingExpansion)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(48);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     UChar characters[] = { 'a' };
@@ -296,7 +296,7 @@ TEST_F(ComplexTextControllerTest, VerticalAdvances)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(48);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     UChar characters[] = { 'a', 'b', 'c', 'd' };
@@ -340,7 +340,7 @@ TEST_F(ComplexTextControllerTest, TotalWidthWithJustification)
     FontCascadeDescription description;
     description.setOneFamily("Times");
     description.setComputedSize(80);
-    FontCascade font(description);
+    FontCascade font(WTFMove(description));
     font.update();
 
     Vector<FloatSize> advances = { FloatSize(1, 0), FloatSize(2, 0), FloatSize(4, 0), FloatSize(8, 0), FloatSize(16, 0) };