Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1289)

Unified Diff: Source/core/page/FrameView.cpp

Issue 20061003: Move isValid/isCurrentColor from Color to StyleColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/FrameView.cpp
diff --git a/Source/core/page/FrameView.cpp b/Source/core/page/FrameView.cpp
index 26badff745b01edc786294db90f39d5761b6e9c3..69aa73ea389dab9e49dfc5f72f60a70444a0664e 100644
--- a/Source/core/page/FrameView.cpp
+++ b/Source/core/page/FrameView.cpp
@@ -373,13 +373,13 @@ void FrameView::recalculateScrollbarOverlayStyle()
ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle();
ScrollbarOverlayStyle overlayStyle = ScrollbarOverlayStyleDefault;
- Color backgroundColor = documentBackgroundColor();
+ StyleColor backgroundColor = documentBackgroundColor();
if (backgroundColor.isValid()) {
// Reduce the background color from RGB to a lightness value
// and determine which scrollbar style to use based on a lightness
// heuristic.
double hue, saturation, lightness;
- backgroundColor.getHSL(hue, saturation, lightness);
+ backgroundColor.color().getHSL(hue, saturation, lightness);
if (lightness <= .5)
overlayStyle = ScrollbarOverlayStyleLight;
}
@@ -2034,19 +2034,19 @@ Color FrameView::baseBackgroundColor() const
return m_baseBackgroundColor;
}
-void FrameView::setBaseBackgroundColor(const Color& backgroundColor)
+void FrameView::setBaseBackgroundColor(const StyleColor& backgroundColor)
{
if (!backgroundColor.isValid())
m_baseBackgroundColor = Color::white;
else
- m_baseBackgroundColor = backgroundColor;
+ m_baseBackgroundColor = backgroundColor.color();
if (renderView() && renderView()->layer()->backing())
renderView()->layer()->backing()->updateContentsOpaque();
recalculateScrollbarOverlayStyle();
}
-void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool transparent)
+void FrameView::updateBackgroundRecursively(const StyleColor& backgroundColor, bool transparent)
{
for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
if (FrameView* view = frame->view()) {
@@ -2734,7 +2734,7 @@ void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const I
ScrollView::paintScrollbar(context, bar, rect);
}
-Color FrameView::documentBackgroundColor() const
+StyleColor FrameView::documentBackgroundColor() const
{
// <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of
// the document and the body against the base background color of the frame view.
@@ -2748,21 +2748,21 @@ Color FrameView::documentBackgroundColor() const
Element* bodyElement = frame()->document()->body();
// Start with invalid colors.
- Color htmlBackgroundColor;
- Color bodyBackgroundColor;
+ StyleColor htmlBackgroundColor;
+ StyleColor bodyBackgroundColor;
if (htmlElement && htmlElement->renderer())
- htmlBackgroundColor = htmlElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+ htmlBackgroundColor = htmlElement->renderer()->resolveStyleColor(CSSPropertyBackgroundColor);
if (bodyElement && bodyElement->renderer())
- bodyBackgroundColor = bodyElement->renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
+ bodyBackgroundColor = bodyElement->renderer()->resolveStyleColor(CSSPropertyBackgroundColor);
if (!bodyBackgroundColor.isValid()) {
if (!htmlBackgroundColor.isValid())
- return Color();
- return baseBackgroundColor().blend(htmlBackgroundColor);
+ return StyleColor();
+ return baseBackgroundColor().blend(htmlBackgroundColor.color());
}
if (!htmlBackgroundColor.isValid())
- return baseBackgroundColor().blend(bodyBackgroundColor);
+ return baseBackgroundColor().blend(bodyBackgroundColor.color());
// We take the aggregate of the base background color
// the <html> background color, and the <body>
@@ -2771,7 +2771,7 @@ Color FrameView::documentBackgroundColor() const
// technically part of the document background, but it
// otherwise poses problems when the aggregate is not
// fully opaque.
- return baseBackgroundColor().blend(htmlBackgroundColor).blend(bodyBackgroundColor);
+ return baseBackgroundColor().blend(htmlBackgroundColor.color()).blend(bodyBackgroundColor.color());
}
bool FrameView::hasCustomScrollbars() const

Powered by Google App Engine
This is Rietveld 408576698