Use Color references where possible
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2016 20:19:47 +0000 (20:19 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2016 20:19:47 +0000 (20:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162643
<rdar://problem/28506550>

Reviewed by Simon Fraser.

There were a bunch of places where we pass or use
Colors by value. As the Color class gets a bit more
complicated, it would be nice to avoid copying, so
use references where possible.

* css/CSSGradientValue.cpp:
(WebCore::interpolate):
* css/StyleColor.h:
(WebCore::StyleColor::getColor):
(WebCore::StyleColor::resolve):
* css/StyleResolver.h:
(WebCore::StyleResolver::State::backgroundColor):
* dom/Document.h:
(WebCore::Document::textColor):
* editing/FrameSelection.cpp:
(WebCore::disappearsIntoBackground):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setShadow):
* html/canvas/CanvasRenderingContext2D.h:
* html/track/TextTrackCueGeneric.h:
* page/PageOverlay.cpp:
(WebCore::PageOverlay::setBackgroundColor):
* page/PageOverlay.h:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::PropertyWrapperColor::PropertyWrapperColor):
(WebCore::PropertyWrapperMaybeInvalidColor::PropertyWrapperMaybeInvalidColor):
(WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::fillRectWithRoundedHole):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::strokeColor):
(WebCore::GraphicsContext::fillColor):
* platform/graphics/InbandTextTrackPrivateClient.h:
(WebCore::GenericCueData::foregroundColor):
(WebCore::GenericCueData::setForegroundColor):
(WebCore::GenericCueData::backgroundColor):
(WebCore::GenericCueData::setBackgroundColor):
(WebCore::GenericCueData::highlightColor):
(WebCore::GenericCueData::setHighlightColor):
* platform/graphics/ca/TileController.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawFocusRingPath::color):
(WebCore::DisplayList::DrawFocusRingRects::color):
(WebCore::DisplayList::FillRectWithColor::color):
(WebCore::DisplayList::FillCompositedRect::color):
(WebCore::DisplayList::FillRoundedRect::color):
(WebCore::DisplayList::FillRectWithRoundedHole::color):
* platform/graphics/filters/FEDiffuseLighting.cpp:
(WebCore::FEDiffuseLighting::lightingColor):
* platform/graphics/filters/FEDiffuseLighting.h:
* platform/graphics/filters/FEDropShadow.h:
(WebCore::FEDropShadow::shadowColor):
* platform/graphics/filters/FEFlood.cpp:
(WebCore::FEFlood::floodColor):
(WebCore::FEFlood::platformApplySoftware):
* platform/graphics/filters/FEFlood.h:
* platform/graphics/filters/FESpecularLighting.cpp:
(WebCore::FESpecularLighting::lightingColor):
* platform/graphics/filters/FESpecularLighting.h:
* platform/graphics/filters/FilterOperation.h:
* rendering/BorderEdge.h:
(WebCore::BorderEdge::color):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintSelection):
* rendering/InlineTextBox.h:
* rendering/RenderFrameSet.cpp:
(WebCore::borderStartEdgeColor):
(WebCore::borderEndEdgeColor):
(WebCore::borderFillColor):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutlineForLine):
* rendering/RenderInline.h:
* rendering/RenderLayerCompositor.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextWithShadows):
* rendering/style/BorderValue.h:
(WebCore::BorderValue::color):
* rendering/style/CollapsedBorderValue.h:
(WebCore::CollapsedBorderValue::color):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::color):
(WebCore::RenderStyle::visitedLinkColor):
(WebCore::RenderStyle::setColor):
(WebCore::RenderStyle::setVisitedLinkColor):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::borderLeftColor):
(WebCore::RenderStyle::borderRightColor):
(WebCore::RenderStyle::borderTopColor):
(WebCore::RenderStyle::borderBottomColor):
(WebCore::RenderStyle::backgroundColor):
(WebCore::RenderStyle::columnRuleColor):
(WebCore::RenderStyle::outlineColor):
(WebCore::RenderStyle::textEmphasisColor):
(WebCore::RenderStyle::textFillColor):
(WebCore::RenderStyle::textStrokeColor):
(WebCore::RenderStyle::visitedLinkBackgroundColor):
(WebCore::RenderStyle::visitedLinkBorderLeftColor):
(WebCore::RenderStyle::visitedLinkBorderRightColor):
(WebCore::RenderStyle::visitedLinkBorderBottomColor):
(WebCore::RenderStyle::visitedLinkBorderTopColor):
(WebCore::RenderStyle::visitedLinkOutlineColor):
(WebCore::RenderStyle::visitedLinkColumnRuleColor):
(WebCore::RenderStyle::textDecorationColor):
(WebCore::RenderStyle::visitedLinkTextDecorationColor):
(WebCore::RenderStyle::visitedLinkTextEmphasisColor):
(WebCore::RenderStyle::visitedLinkTextFillColor):
(WebCore::RenderStyle::visitedLinkTextStrokeColor):
(WebCore::RenderStyle::stopColor):
(WebCore::RenderStyle::floodColor):
(WebCore::RenderStyle::lightingColor):
* svg/SVGFEDiffuseLightingElement.cpp:
(WebCore::SVGFEDiffuseLightingElement::build):
* svg/SVGFEDropShadowElement.cpp:
(WebCore::SVGFEDropShadowElement::build):
* svg/SVGFEFloodElement.cpp:
(WebCore::SVGFEFloodElement::build):
* svg/SVGFESpecularLightingElement.cpp:
(WebCore::SVGFESpecularLightingElement::build):
* svg/SVGGradientElement.cpp:
(WebCore::SVGGradientElement::buildStops):

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

44 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/StyleColor.h
Source/WebCore/css/StyleResolver.h
Source/WebCore/dom/Document.h
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/track/TextTrackCueGeneric.h
Source/WebCore/page/PageOverlay.cpp
Source/WebCore/page/PageOverlay.h
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h
Source/WebCore/platform/graphics/ca/TileController.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp
Source/WebCore/platform/graphics/filters/FEDiffuseLighting.h
Source/WebCore/platform/graphics/filters/FEDropShadow.h
Source/WebCore/platform/graphics/filters/FEFlood.cpp
Source/WebCore/platform/graphics/filters/FEFlood.h
Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp
Source/WebCore/platform/graphics/filters/FESpecularLighting.h
Source/WebCore/platform/graphics/filters/FilterOperation.h
Source/WebCore/rendering/BorderEdge.h
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/TextDecorationPainter.cpp
Source/WebCore/rendering/style/BorderValue.h
Source/WebCore/rendering/style/CollapsedBorderValue.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp
Source/WebCore/svg/SVGFEDropShadowElement.cpp
Source/WebCore/svg/SVGFEFloodElement.cpp
Source/WebCore/svg/SVGFESpecularLightingElement.cpp
Source/WebCore/svg/SVGGradientElement.cpp

index 517ff0b..3581521 100644 (file)
@@ -1,3 +1,143 @@
+2016-09-27  Dean Jackson  <dino@apple.com>
+
+        Use Color references where possible
+        https://bugs.webkit.org/show_bug.cgi?id=162643
+        <rdar://problem/28506550>
+
+        Reviewed by Simon Fraser.
+
+        There were a bunch of places where we pass or use
+        Colors by value. As the Color class gets a bit more
+        complicated, it would be nice to avoid copying, so
+        use references where possible.
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::interpolate):
+        * css/StyleColor.h:
+        (WebCore::StyleColor::getColor):
+        (WebCore::StyleColor::resolve):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::State::backgroundColor):
+        * dom/Document.h:
+        (WebCore::Document::textColor):
+        * editing/FrameSelection.cpp:
+        (WebCore::disappearsIntoBackground):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setShadow):
+        * html/canvas/CanvasRenderingContext2D.h:
+        * html/track/TextTrackCueGeneric.h:
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::setBackgroundColor):
+        * page/PageOverlay.h:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::PropertyWrapperColor::PropertyWrapperColor):
+        (WebCore::PropertyWrapperMaybeInvalidColor::PropertyWrapperMaybeInvalidColor):
+        (WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::strokeColor):
+        (WebCore::GraphicsContext::fillColor):
+        * platform/graphics/InbandTextTrackPrivateClient.h:
+        (WebCore::GenericCueData::foregroundColor):
+        (WebCore::GenericCueData::setForegroundColor):
+        (WebCore::GenericCueData::backgroundColor):
+        (WebCore::GenericCueData::setBackgroundColor):
+        (WebCore::GenericCueData::highlightColor):
+        (WebCore::GenericCueData::setHighlightColor):
+        * platform/graphics/ca/TileController.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::platformFillRoundedRect):
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::DrawFocusRingPath::color):
+        (WebCore::DisplayList::DrawFocusRingRects::color):
+        (WebCore::DisplayList::FillRectWithColor::color):
+        (WebCore::DisplayList::FillCompositedRect::color):
+        (WebCore::DisplayList::FillRoundedRect::color):
+        (WebCore::DisplayList::FillRectWithRoundedHole::color):
+        * platform/graphics/filters/FEDiffuseLighting.cpp:
+        (WebCore::FEDiffuseLighting::lightingColor):
+        * platform/graphics/filters/FEDiffuseLighting.h:
+        * platform/graphics/filters/FEDropShadow.h:
+        (WebCore::FEDropShadow::shadowColor):
+        * platform/graphics/filters/FEFlood.cpp:
+        (WebCore::FEFlood::floodColor):
+        (WebCore::FEFlood::platformApplySoftware):
+        * platform/graphics/filters/FEFlood.h:
+        * platform/graphics/filters/FESpecularLighting.cpp:
+        (WebCore::FESpecularLighting::lightingColor):
+        * platform/graphics/filters/FESpecularLighting.h:
+        * platform/graphics/filters/FilterOperation.h:
+        * rendering/BorderEdge.h:
+        (WebCore::BorderEdge::color):
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintSelection):
+        * rendering/InlineTextBox.h:
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::borderStartEdgeColor):
+        (WebCore::borderEndEdgeColor):
+        (WebCore::borderFillColor):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutlineForLine):
+        * rendering/RenderInline.h:
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::paintBoxDecorations):
+        * rendering/TextDecorationPainter.cpp:
+        (WebCore::TextDecorationPainter::paintTextDecoration):
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::paintTextWithShadows):
+        * rendering/style/BorderValue.h:
+        (WebCore::BorderValue::color):
+        * rendering/style/CollapsedBorderValue.h:
+        (WebCore::CollapsedBorderValue::color):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::color):
+        (WebCore::RenderStyle::visitedLinkColor):
+        (WebCore::RenderStyle::setColor):
+        (WebCore::RenderStyle::setVisitedLinkColor):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::borderLeftColor):
+        (WebCore::RenderStyle::borderRightColor):
+        (WebCore::RenderStyle::borderTopColor):
+        (WebCore::RenderStyle::borderBottomColor):
+        (WebCore::RenderStyle::backgroundColor):
+        (WebCore::RenderStyle::columnRuleColor):
+        (WebCore::RenderStyle::outlineColor):
+        (WebCore::RenderStyle::textEmphasisColor):
+        (WebCore::RenderStyle::textFillColor):
+        (WebCore::RenderStyle::textStrokeColor):
+        (WebCore::RenderStyle::visitedLinkBackgroundColor):
+        (WebCore::RenderStyle::visitedLinkBorderLeftColor):
+        (WebCore::RenderStyle::visitedLinkBorderRightColor):
+        (WebCore::RenderStyle::visitedLinkBorderBottomColor):
+        (WebCore::RenderStyle::visitedLinkBorderTopColor):
+        (WebCore::RenderStyle::visitedLinkOutlineColor):
+        (WebCore::RenderStyle::visitedLinkColumnRuleColor):
+        (WebCore::RenderStyle::textDecorationColor):
+        (WebCore::RenderStyle::visitedLinkTextDecorationColor):
+        (WebCore::RenderStyle::visitedLinkTextEmphasisColor):
+        (WebCore::RenderStyle::visitedLinkTextFillColor):
+        (WebCore::RenderStyle::visitedLinkTextStrokeColor):
+        (WebCore::RenderStyle::stopColor):
+        (WebCore::RenderStyle::floodColor):
+        (WebCore::RenderStyle::lightingColor):
+        * svg/SVGFEDiffuseLightingElement.cpp:
+        (WebCore::SVGFEDiffuseLightingElement::build):
+        * svg/SVGFEDropShadowElement.cpp:
+        (WebCore::SVGFEDropShadowElement::build):
+        * svg/SVGFEFloodElement.cpp:
+        (WebCore::SVGFEFloodElement::build):
+        * svg/SVGFESpecularLightingElement.cpp:
+        (WebCore::SVGFESpecularLightingElement::build):
+        * svg/SVGGradientElement.cpp:
+        (WebCore::SVGGradientElement::buildStops):
+
 2016-09-28  Ryosuke Niwa  <rniwa@webkit.org>
 
         assignedNodes should include fallback contents when flattened option is set
index 292f464..5caa241 100644 (file)
@@ -140,7 +140,7 @@ static inline int interpolate(int min, int max, float position)
     return min + static_cast<int>(position * (max - min));
 }
 
-static inline Color interpolate(Color color1, Color color2, float position)
+static inline Color interpolate(const Color& color1, const Color& color2, float position)
 {
     int red = interpolate(color1.red(), color2.red(), position);
     int green = interpolate(color1.green(), color2.green(), position);
index a6e5669..1d18ce1 100644 (file)
@@ -46,9 +46,9 @@ public:
     static StyleColor currentColor() { return StyleColor(); }
 
     bool isCurrentColor() const { return m_currentColor; }
-    Color getColor() const { ASSERT(!isCurrentColor()); return m_color; }
+    const Color& getColor() const { ASSERT(!isCurrentColor()); return m_color; }
 
-    Color resolve(Color currentColor) const { return m_currentColor ? currentColor : m_color; }
+    const Color& resolve(const Color& currentColor) const { return m_currentColor ? currentColor : m_color; }
 
     static Color colorFromKeyword(CSSValueID);
     static bool isColorKeyword(CSSValueID);
index a9be419..0e5fa69 100644 (file)
@@ -391,7 +391,7 @@ public:
         bool hasUAAppearance() const { return m_hasUAAppearance; }
         BorderData borderData() const { return m_borderData; }
         FillLayer backgroundData() const { return m_backgroundData; }
-        Color backgroundColor() const { return m_backgroundColor; }
+        const Color& backgroundColor() const { return m_backgroundColor; }
 
         const FontCascadeDescription& fontDescription() { return m_style->fontDescription(); }
         const FontCascadeDescription& parentFontDescription() { return m_parentStyle->fontDescription(); }
index 31ff372..570317b 100644 (file)
@@ -688,7 +688,7 @@ public:
     std::chrono::milliseconds elapsedTime() const;
     
     void setTextColor(const Color& color) { m_textColor = color; }
-    Color textColor() const { return m_textColor; }
+    const Color& textColor() const { return m_textColor; }
 
     const Color& linkColor() const { return m_linkColor; }
     const Color& visitedLinkColor() const { return m_visitedLinkColor; }
index ab446eb..d7dc5e8 100644 (file)
@@ -1693,7 +1693,7 @@ void FrameSelection::paintCaret(GraphicsContext& context, const LayoutPoint& pai
 }
 
 #if ENABLE(TEXT_CARET)
-static inline bool disappearsIntoBackground(Color foreground, Color background)
+static inline bool disappearsIntoBackground(const Color& foreground, const Color& background)
 {
     return background.blend(foreground) == background;
 }
index 50c65e3..7996dba 100644 (file)
@@ -1276,7 +1276,7 @@ void CanvasRenderingContext2D::clearShadow()
     setShadow(FloatSize(), 0, Color::transparent);
 }
 
-void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, Color color)
+void CanvasRenderingContext2D::setShadow(const FloatSize& offset, float blur, const Color& color)
 {
     if (state().shadowOffset == offset && state().shadowBlur == blur && state().shadowColor == color)
         return;
index ccb21e5..ae4e0df 100644 (file)
@@ -316,7 +316,7 @@ private:
     const State& state() const { return m_stateStack.last(); }
 
     void applyLineDash() const;
-    void setShadow(const FloatSize& offset, float blur, Color);
+    void setShadow(const FloatSize& offset, float blur, const Color&);
     void applyShadow();
     bool shouldDrawShadows() const;
 
index 536cb0a..856115b 100644 (file)
@@ -61,13 +61,13 @@ public:
     String fontName() const { return m_fontName; }
     void setFontName(String name) { m_fontName = name; }
 
-    Color foregroundColor() const { return m_foregroundColor; }
+    const Color& foregroundColor() const { return m_foregroundColor; }
     void setForegroundColor(Color color) { m_foregroundColor = color; }
     
-    Color backgroundColor() const { return m_backgroundColor; }
+    const Color& backgroundColor() const { return m_backgroundColor; }
     void setBackgroundColor(Color color) { m_backgroundColor = color; }
     
-    Color highlightColor() const { return m_highlightColor; }
+    const Color& highlightColor() const { return m_highlightColor; }
     void setHighlightColor(Color color) { m_highlightColor = color; }
     
     void setFontSize(int, const IntSize&, bool important) override;
index 4e8374a..e70bca0 100644 (file)
@@ -136,7 +136,7 @@ IntSize PageOverlay::viewToOverlayOffset() const
     return IntSize();
 }
 
-void PageOverlay::setBackgroundColor(Color backgroundColor)
+void PageOverlay::setBackgroundColor(const Color& backgroundColor)
 {
     if (m_backgroundColor == backgroundColor)
         return;
index f8d736a..aee90b6 100644 (file)
@@ -106,8 +106,8 @@ public:
 
     WEBCORE_EXPORT IntSize viewToOverlayOffset() const;
 
-    Color backgroundColor() const { return m_backgroundColor; }
-    void setBackgroundColor(Color);
+    const Color& backgroundColor() const { return m_backgroundColor; }
+    void setBackgroundColor(const Color&);
 
     void setShouldIgnoreMouseEventsOutsideBounds(bool flag) { m_shouldIgnoreMouseEventsOutsideBounds = flag; }
 
index 50b53a3..2ff6eaf 100644 (file)
@@ -567,25 +567,24 @@ public:
     }
 };
 
-class PropertyWrapperColor : public PropertyWrapperGetter<Color> {
+class PropertyWrapperColor : public PropertyWrapperGetter<const Color&> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
-        : PropertyWrapperGetter<Color>(prop, getter)
+    PropertyWrapperColor(CSSPropertyID prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+        : PropertyWrapperGetter<const Color&>(prop, getter)
         , m_setter(setter)
     {
     }
 
     void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
-        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_getter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
+        (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<const Color&>::m_getter)(), (b->*PropertyWrapperGetter<const Color&>::m_getter)(), progress));
     }
 
 protected:
     void (RenderStyle::*m_setter)(const Color&);
 };
 
-
 class PropertyWrapperAcceleratedOpacity : public PropertyWrapper<float> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -811,7 +810,7 @@ private:
 class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+    PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
         : AnimationPropertyWrapperBase(prop)
         , m_getter(getter)
         , m_setter(setter)
@@ -868,7 +867,7 @@ public:
 #endif
 
 private:
-    Color (RenderStyle::*m_getter)() const;
+    const Color& (RenderStyle::*m_getter)() const;
     void (RenderStyle::*m_setter)(const Color&);
 };
 
@@ -877,15 +876,15 @@ enum MaybeInvalidColorTag { MaybeInvalidColor };
 class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
-                                        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+        const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
         : AnimationPropertyWrapperBase(prop)
         , m_wrapper(std::make_unique<PropertyWrapperColor>(prop, getter, setter))
         , m_visitedWrapper(std::make_unique<PropertyWrapperColor>(prop, visitedGetter, visitedSetter))
     {
     }
-    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
-                                        Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+    PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&),
+        const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
         : AnimationPropertyWrapperBase(prop)
         , m_wrapper(std::make_unique<PropertyWrapperMaybeInvalidColor>(prop, getter, setter))
         , m_visitedWrapper(std::make_unique<PropertyWrapperMaybeInvalidColor>(prop, visitedGetter, visitedSetter))
index a6e6fb0..3007016 100644 (file)
@@ -264,7 +264,7 @@ public:
     StrokeStyle strokeStyle() const { return m_state.strokeStyle; }
 
     WEBCORE_EXPORT void setStrokeColor(const Color&);
-    Color strokeColor() const { return m_state.strokeColor; }
+    const Color& strokeColor() const { return m_state.strokeColor; }
 
     void setStrokePattern(Ref<Pattern>&&);
     Pattern* strokePattern() const { return m_state.strokePattern.get(); }
@@ -276,7 +276,7 @@ public:
     WindRule fillRule() const { return m_state.fillRule; }
 
     WEBCORE_EXPORT void setFillColor(const Color&);
-    Color fillColor() const { return m_state.fillColor; }
+    const Color& fillColor() const { return m_state.fillColor; }
 
     void setFillPattern(Ref<Pattern>&&);
     Pattern* fillPattern() const { return m_state.fillPattern.get(); }
@@ -592,7 +592,7 @@ private:
 
     void platformFillRoundedRect(const FloatRoundedRect&, const Color&);
 
-    FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatPoint&, float width, bool printing,  Color&);
+    FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatPoint&, float width, bool printing, Color&);
 
     GraphicsContextPlatformPrivate* m_data { nullptr };
     DisplayList::Recorder* m_displayListRecorder { nullptr };
index 32a743b..be252e4 100644 (file)
@@ -86,15 +86,15 @@ public:
     double relativeFontSize() const { return m_relativeFontSize; }
     void setRelativeFontSize(double relativeFontSize) { m_relativeFontSize = relativeFontSize; }
 
-    Color foregroundColor() const { return m_foregroundColor; }
-    void setForegroundColor(Color color) { m_foregroundColor = color; }
+    const Color& foregroundColor() const { return m_foregroundColor; }
+    void setForegroundColor(const Color& color) { m_foregroundColor = color; }
+
+    const Color& backgroundColor() const { return m_backgroundColor; }
+    void setBackgroundColor(const Color& color) { m_backgroundColor = color; }
+
+    const Color& highlightColor() const { return m_highlightColor; }
+    void setHighlightColor(const Color& color) { m_highlightColor = color; }
 
-    Color backgroundColor() const { return m_backgroundColor; }
-    void setBackgroundColor(Color color) { m_backgroundColor = color; }
-    
-    Color highlightColor() const { return m_highlightColor; }
-    void setHighlightColor(Color color) { m_highlightColor = color; }
-    
     enum Status {
         Uninitialized,
         Partial,
index fefed12..1a76a55 100644 (file)
@@ -93,7 +93,7 @@ public:
 
     float deviceScaleFactor() const { return m_deviceScaleFactor; }
 
-    Color tileDebugBorderColor() const { return m_tileDebugBorderColor; }
+    const Color& tileDebugBorderColor() const { return m_tileDebugBorderColor; }
     float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
     ScrollingModeIndication indicatorMode() const { return m_indicatorMode; }
 
index cc74365..3a663f5 100644 (file)
@@ -935,7 +935,7 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float
 
     WindRule oldFillRule = fillRule();
     Color oldFillColor = fillColor();
-    
+
     setFillRule(RULE_EVENODD);
     setFillColor(color);
 
index 470f282..cf57399 100644 (file)
@@ -909,7 +909,7 @@ public:
     const Path& path() const { return m_path; }
     int width() const { return m_width; }
     int offset() const { return m_offset; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
 private:
     DrawFocusRingPath(const Path& path, int width, int offset, const Color& color)
@@ -941,7 +941,7 @@ public:
     const Vector<FloatRect> rects() const { return m_rects; }
     int width() const { return m_width; }
     int offset() const { return m_offset; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
 private:
     DrawFocusRingRects(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
@@ -994,7 +994,7 @@ public:
     }
 
     FloatRect rect() const { return m_rect; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
 private:
     FillRectWithColor(const FloatRect& rect, const Color& color)
@@ -1043,7 +1043,7 @@ public:
     }
 
     FloatRect rect() const { return m_rect; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
     CompositeOperator compositeOperator() const { return m_op; }
     BlendMode blendMode() const { return m_blendMode; }
 
@@ -1074,7 +1074,7 @@ public:
     }
 
     const FloatRoundedRect& roundedRect() const { return m_rect; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
     BlendMode blendMode() const { return m_blendMode; }
 
 private:
@@ -1103,7 +1103,7 @@ public:
 
     const FloatRect& rect() const { return m_rect; }
     const FloatRoundedRect& roundedHoleRect() const { return m_roundedHoleRect; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
 private:
     FillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
index 8bf3eb3..1b4303c 100644 (file)
@@ -44,7 +44,7 @@ FEDiffuseLighting::~FEDiffuseLighting()
 {
 }
 
-Color FEDiffuseLighting::lightingColor() const
+const Color& FEDiffuseLighting::lightingColor() const
 {
     return m_lightingColor;
 }
index 986d09d..9374d7a 100644 (file)
@@ -34,7 +34,7 @@ public:
         float, float, PassRefPtr<LightSource>);
     virtual ~FEDiffuseLighting();
 
-    Color lightingColor() const;
+    const Color& lightingColor() const;
     bool setLightingColor(const Color&);
 
     float surfaceScale() const;
index 8fe16e4..9a5c491 100644 (file)
@@ -42,7 +42,7 @@ public:
     float dy() const { return m_dy; }
     void setDy(float dy) { m_dy = dy; }
 
-    Color shadowColor() const { return m_shadowColor; } 
+    const Color& shadowColor() const { return m_shadowColor; } 
     void setShadowColor(const Color& shadowColor) { m_shadowColor = shadowColor; }
 
     float shadowOpacity() const { return m_shadowOpacity; }
index e8da8d3..f6c4086 100644 (file)
@@ -41,7 +41,7 @@ Ref<FEFlood> FEFlood::create(Filter& filter, const Color& floodColor, float floo
     return adoptRef(*new FEFlood(filter, floodColor, floodOpacity));
 }
 
-Color FEFlood::floodColor() const
+const Color& FEFlood::floodColor() const
 {
     return m_floodColor;
 }
@@ -73,7 +73,7 @@ void FEFlood::platformApplySoftware()
     if (!resultImage)
         return;
 
-    Color color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity());
+    const Color& color = colorWithOverrideAlpha(floodColor().rgb(), floodOpacity());
     resultImage->context().fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()), color);
 }
 
index 62f92fa..ae03b19 100644 (file)
@@ -32,7 +32,7 @@ class FEFlood : public FilterEffect {
 public:
     static Ref<FEFlood> create(Filter&, const Color&, float);
 
-    Color floodColor() const;
+    const Color& floodColor() const;
     bool setFloodColor(const Color&);
 
     float floodOpacity() const;
index 0219ae2..e2e834f 100644 (file)
@@ -46,7 +46,7 @@ FESpecularLighting::~FESpecularLighting()
 {
 }
 
-Color FESpecularLighting::lightingColor() const
+const Color& FESpecularLighting::lightingColor() const
 {
     return m_lightingColor;
 }
index dff2e5e..9d67722 100644 (file)
@@ -32,7 +32,7 @@ public:
         float, float, float, PassRefPtr<LightSource>);
     virtual ~FESpecularLighting();
 
-    Color lightingColor() const;
+    const Color& lightingColor() const;
     bool setLightingColor(const Color&);
 
     float surfaceScale() const;
index 321a5f3..633696f 100644 (file)
@@ -302,7 +302,7 @@ private:
 
 class WEBCORE_EXPORT DropShadowFilterOperation : public FilterOperation {
 public:
-    static PassRefPtr<DropShadowFilterOperation> create(const IntPoint& location, int stdDeviation, Color color)
+    static PassRefPtr<DropShadowFilterOperation> create(const IntPoint& location, int stdDeviation, const Color& color)
     {
         return adoptRef(new DropShadowFilterOperation(location, stdDeviation, color));
     }
@@ -316,7 +316,7 @@ public:
     int y() const { return m_location.y(); }
     IntPoint location() const { return m_location; }
     int stdDeviation() const { return m_stdDeviation; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
     bool affectsOpacity() const override { return true; }
     bool movesPixels() const override { return true; }
@@ -326,7 +326,7 @@ public:
 private:
     bool operator==(const FilterOperation&) const override;
 
-    DropShadowFilterOperation(const IntPoint& location, int stdDeviation, Color color)
+    DropShadowFilterOperation(const IntPoint& location, int stdDeviation, const Color& color)
         : FilterOperation(DROP_SHADOW)
         , m_location(location)
         , m_stdDeviation(stdDeviation)
index be05a4b..1424ff7 100644 (file)
@@ -53,7 +53,7 @@ public:
     static void getBorderEdgeInfo(BorderEdge edges[], const RenderStyle&, float deviceScaleFactor, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
 
     EBorderStyle style() const { return m_style; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
     bool isTransparent() const { return m_isTransparent; }
     bool isPresent() const { return m_isPresent; }
 
index ca7a14a..b1fb30a 100644 (file)
@@ -1379,8 +1379,8 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&
     if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, this))
         paintBoxShadow(paintInfo, lineStyle, Normal, paintRect);
 
-    Color c = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor);
-    paintFillLayers(paintInfo, c, lineStyle.backgroundLayers(), paintRect);
+    const Color& color = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor);
+    paintFillLayers(paintInfo, color, lineStyle.backgroundLayers(), paintRect);
     paintBoxShadow(paintInfo, lineStyle, Inset, paintRect);
 
     // :first-line cannot be used to put borders on a line. Always paint borders with our
index b4fad9f..aa46079 100644 (file)
@@ -617,7 +617,7 @@ std::pair<unsigned, unsigned> InlineTextBox::selectionStartEnd() const
     return { clampedOffset(start), clampedOffset(end) };
 }
 
-void InlineTextBox::paintSelection(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const FontCascade& font, Color textColor)
+void InlineTextBox::paintSelection(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const FontCascade& font, const Color& textColor)
 {
 #if ENABLE(TEXT_SELECTION)
     if (context.paintingDisabled())
index 7236f60..5258aab 100644 (file)
@@ -161,7 +161,7 @@ protected:
 private:
     void paintDecoration(GraphicsContext&, const FontCascade&, RenderCombineText*, const TextRun&, const FloatPoint& textOrigin, const FloatRect& boxRect,
         TextDecoration, TextPaintStyle, const ShadowData*);
-    void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, Color textColor);
+    void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, const Color& textColor);
     void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
     void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
 
index 716108d..179bd42 100644 (file)
@@ -67,19 +67,22 @@ RenderFrameSet::GridAxis::GridAxis()
 {
 }
 
-static Color borderStartEdgeColor()
+static const Color& borderStartEdgeColor()
 {
-    return Color(170, 170, 170);
+    static const Color color(170, 170, 170);
+    return color;
 }
 
-static Color borderEndEdgeColor()
+static const Color& borderEndEdgeColor()
 {
-    return Color::black;
+    static const Color color = Color::black;
+    return color;
 }
 
-static Color borderFillColor()
+static const Color& borderFillColor()
 {
-    return Color(208, 208, 208);
+    static const Color color(208, 208, 208);
+    return color;
 }
 
 void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const IntRect& borderRect)
index 4bbd991..28fc036 100644 (file)
@@ -1644,7 +1644,7 @@ void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf
 }
 
 void RenderInline::paintOutlineForLine(GraphicsContext& graphicsContext, const LayoutPoint& paintOffset,
-    const LayoutRect& previousLine, const LayoutRect& thisLine, const LayoutRect& nextLine, const Color outlineColor)
+    const LayoutRect& previousLine, const LayoutRect& thisLine, const LayoutRect& nextLine, const Color& outlineColor)
 {
     const auto& styleToUse = style();
     float outlineOffset = styleToUse.outlineOffset();
index 00bc9ec..eafebf2 100644 (file)
@@ -173,8 +173,7 @@ private:
     
     RenderPtr<RenderInline> clone() const;
 
-    void paintOutlineForLine(GraphicsContext&, const LayoutPoint&, const LayoutRect& prevLine, const LayoutRect& thisLine,
-                             const LayoutRect& nextLine, const Color);
+    void paintOutlineForLine(GraphicsContext&, const LayoutPoint&, const LayoutRect& prevLine, const LayoutRect& thisLine, const LayoutRect& nextLine, const Color&);
     RenderBoxModelObject* continuationBefore(RenderObject* beforeChild);
 
     bool willChangeCreatesStackingContext() const
index c2e38a0..490fcfc 100644 (file)
@@ -312,7 +312,7 @@ public:
     void didPaintBacking(RenderLayerBacking*);
 
     void setRootExtendedBackgroundColor(const Color&);
-    Color rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
+    const Color& rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
 
 #if ENABLE(CSS_SCROLL_SNAP)
     void updateScrollSnapPropertiesWithFrameView(const FrameView&);
index 2dc51f3..422654f 100644 (file)
@@ -578,8 +578,8 @@ void RenderView::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint&)
     if (frameView().isTransparent()) // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent.
         frameView().setCannotBlitToWindow(); // The parent must show behind the child.
     else {
-        Color documentBackgroundColor = frameView().documentBackgroundColor();
-        Color backgroundColor = (backgroundShouldExtendBeyondPage && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView().baseBackgroundColor();
+        const Color& documentBackgroundColor = frameView().documentBackgroundColor();
+        const Color& backgroundColor = (backgroundShouldExtendBeyondPage && documentBackgroundColor.isValid()) ? documentBackgroundColor : frameView().baseBackgroundColor();
         if (backgroundColor.alpha()) {
             CompositeOperator previousOperator = paintInfo.context().compositeOperation();
             paintInfo.context().setCompositeOperation(CompositeCopy);
index 112e1ae..433a7c7 100644 (file)
@@ -262,7 +262,7 @@ void TextDecorationPainter::paintTextDecoration(const TextRun& textRun, const Fl
     m_context.setStrokeThickness(textDecorationThickness);
     FloatPoint localOrigin = boxOrigin;
 
-    auto paintDecoration = [&](TextDecoration decoration, TextDecorationStyle style, Color color, const FloatPoint& start, const FloatPoint& end, int offset) {
+    auto paintDecoration = [&](TextDecoration decoration, TextDecorationStyle style, const Color& color, const FloatPoint& start, const FloatPoint& end, int offset) {
         m_context.setStrokeColor(color);
 
         auto strokeStyle = textDecorationStyleToStrokeStyle(style);
index 6bbdbd2..4f704a7 100644 (file)
@@ -69,7 +69,7 @@ public:
         m_color = color;
     }
 
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
 
     float width() const { return m_width; }
     EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
index 11c3f84..c73c088 100644 (file)
@@ -51,7 +51,7 @@ public:
     LayoutUnit width() const { return m_style > BHIDDEN ? m_width : LayoutUnit::fromPixel(0); }
     EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
     bool exists() const { return m_precedence != BOFF; }
-    Color color() const { return m_color; }
+    const Color& color() const { return m_color; }
     bool isTransparent() const { return m_transparent; }
     EBorderPrecedence precedence() const { return static_cast<EBorderPrecedence>(m_precedence); }
 
index 1ef89e8..8f5df60 100644 (file)
@@ -1189,10 +1189,25 @@ void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v)
         rareInheritedData.access()->listStyleImage = v;
 }
 
-Color RenderStyle::color() const { return inherited->color; }
-Color RenderStyle::visitedLinkColor() const { return inherited->visitedLinkColor; }
-void RenderStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); }
-void RenderStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, visitedLinkColor, v); }
+const Color& RenderStyle::color() const
+{
+    return inherited->color;
+}
+
+const Color& RenderStyle::visitedLinkColor() const
+{
+    return inherited->visitedLinkColor;
+}
+
+void RenderStyle::setColor(const Color& v)
+{
+    SET_VAR(inherited, color, v);
+}
+
+void RenderStyle::setVisitedLinkColor(const Color& v)
+{
+    SET_VAR(inherited, visitedLinkColor, v);
+}
 
 float RenderStyle::horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
 float RenderStyle::verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
index 84cdd54..21dd5bb 100644 (file)
@@ -2238,36 +2238,36 @@ private:
 
     // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
     static Color invalidColor() { return Color(); }
-    Color borderLeftColor() const { return surround->border.left().color(); }
-    Color borderRightColor() const { return surround->border.right().color(); }
-    Color borderTopColor() const { return surround->border.top().color(); }
-    Color borderBottomColor() const { return surround->border.bottom().color(); }
-    Color backgroundColor() const { return m_background->color(); }
-    Color color() const;
-    Color columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
-    Color outlineColor() const { return m_background->outline().color(); }
-    Color textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
-    Color textFillColor() const { return rareInheritedData->textFillColor; }
-    Color textStrokeColor() const { return rareInheritedData->textStrokeColor; }
-    Color visitedLinkColor() const;
-    Color visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
-    Color visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
-    Color visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
-    Color visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
-    Color visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
-    Color visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
-    Color visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
-    Color textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
-    Color visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
-    Color visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
-    Color visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
-    Color visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
+    const Color& borderLeftColor() const { return surround->border.left().color(); }
+    const Color& borderRightColor() const { return surround->border.right().color(); }
+    const Color& borderTopColor() const { return surround->border.top().color(); }
+    const Color& borderBottomColor() const { return surround->border.bottom().color(); }
+    const Color& backgroundColor() const { return m_background->color(); }
+    const Color& color() const;
+    const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
+    const Color& outlineColor() const { return m_background->outline().color(); }
+    const Color& textEmphasisColor() const { return rareInheritedData->textEmphasisColor; }
+    const Color& textFillColor() const { return rareInheritedData->textFillColor; }
+    const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
+    const Color& visitedLinkColor() const;
+    const Color& visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
+    const Color& visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
+    const Color& visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
+    const Color& visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
+    const Color& visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
+    const Color& visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
+    const Color& visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
+    const Color& textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
+    const Color& visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
+    const Color& visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor; }
+    const Color& visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor; }
+    const Color& visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor; }
 
     Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
 
-    Color stopColor() const { return svgStyle().stopColor(); }
-    Color floodColor() const { return svgStyle().floodColor(); }
-    Color lightingColor() const { return svgStyle().lightingColor(); }
+    const Color& stopColor() const { return svgStyle().stopColor(); }
+    const Color& floodColor() const { return svgStyle().floodColor(); }
+    const Color& lightingColor() const { return svgStyle().lightingColor(); }
 
     void appendContent(std::unique_ptr<ContentData>);
 };
index 1a20720..1ff7f3d 100644 (file)
@@ -186,8 +186,8 @@ RefPtr<FilterEffect> SVGFEDiffuseLightingElement::build(SVGFilterBuilder* filter
     RenderObject* renderer = this->renderer();
     if (!renderer)
         return nullptr;
-    
-    Color color = renderer->style().svgStyle().lightingColor();
+
+    const Color& color = renderer->style().svgStyle().lightingColor();
 
     RefPtr<FilterEffect> effect = FEDiffuseLighting::create(filter, color, surfaceScale(), diffuseConstant(),
                                                                 kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
index f93dacd..31935e1 100644 (file)
@@ -130,7 +130,7 @@ RefPtr<FilterEffect> SVGFEDropShadowElement::build(SVGFilterBuilder* filterBuild
 
     const SVGRenderStyle& svgStyle = renderer->style().svgStyle();
     
-    Color color = svgStyle.floodColor();
+    const Color& color = svgStyle.floodColor();
     float opacity = svgStyle.floodOpacity();
 
     FilterEffect* input1 = filterBuilder->getEffectById(in1());
index e9deeaf..5616949 100644 (file)
@@ -62,7 +62,7 @@ RefPtr<FilterEffect> SVGFEFloodElement::build(SVGFilterBuilder*, Filter& filter)
     
     const SVGRenderStyle& svgStyle = renderer->style().svgStyle();
 
-    Color color = svgStyle.floodColor();
+    const Color& color = svgStyle.floodColor();
     float opacity = svgStyle.floodOpacity();
 
     return FEFlood::create(filter, color, opacity);
index 63f86e1..38f8904 100644 (file)
@@ -198,7 +198,7 @@ RefPtr<FilterEffect> SVGFESpecularLightingElement::build(SVGFilterBuilder* filte
     if (!renderer)
         return nullptr;
     
-    Color color = renderer->style().svgStyle().lightingColor();
+    const Color& color = renderer->style().svgStyle().lightingColor();
 
     RefPtr<FilterEffect> effect = FESpecularLighting::create(filter, color, surfaceScale(), specularConstant(),
                                           specularExponent(), kernelUnitLengthX(), kernelUnitLengthY(), WTFMove(lightSource));
index b1c2506..483352a 100644 (file)
@@ -133,7 +133,7 @@ Vector<Gradient::ColorStop> SVGGradientElement::buildStops()
     float previousOffset = 0.0f;
 
     for (auto& stop : childrenOfType<SVGStopElement>(*this)) {
-        Color color = stop.stopColorIncludingOpacity();
+        const Color& color = stop.stopColorIncludingOpacity();
 
         // Figure out right monotonic offset
         float offset = stop.offset();