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

Unified Diff: Source/core/paint/ScrollbarPainter.cpp

Issue 613503002: Move paint code for RenderScrollbar and RenderScrollbarPart into ScrollbarPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « Source/core/paint/ScrollbarPainter.h ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ScrollbarPainter.cpp
diff --git a/Source/core/paint/ScrollbarPainter.cpp b/Source/core/paint/ScrollbarPainter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..97a3638a5dbbaafc445581ee13928cc991c8d1f2
--- /dev/null
+++ b/Source/core/paint/ScrollbarPainter.cpp
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/ScrollbarPainter.h"
+
+#include "core/paint/BlockPainter.h"
+#include "core/rendering/PaintInfo.h"
+#include "core/rendering/RenderScrollbar.h"
+#include "core/rendering/RenderScrollbarPart.h"
+#include "platform/graphics/GraphicsContext.h"
+namespace blink {
+
+void ScrollbarPainter::paintPart(GraphicsContext* graphicsContext, ScrollbarPart partType, const IntRect& rect)
+{
+ RenderScrollbarPart* partRenderer = m_renderScrollbar.getPart(partType);
+ if (!partRenderer)
+ return;
+ paintIntoRect(partRenderer, graphicsContext, m_renderScrollbar.location(), rect);
+}
+
+void ScrollbarPainter::paintIntoRect(RenderScrollbarPart* renderScrollbarPart, GraphicsContext* graphicsContext, const LayoutPoint& paintOffset, const LayoutRect& rect)
+{
+ // Make sure our dimensions match the rect.
+ // FIXME: Setting these is a bad layering violation!
+ renderScrollbarPart->setLocation(rect.location() - toSize(paintOffset));
+ renderScrollbarPart->setWidth(rect.width());
+ renderScrollbarPart->setHeight(rect.height());
+
+ // Now do the paint.
+ PaintInfo paintInfo(graphicsContext, pixelSnappedIntRect(rect), PaintPhaseBlockBackground, PaintBehaviorNormal);
+ BlockPainter blockPainter(*renderScrollbarPart);
+ blockPainter.paint(paintInfo, paintOffset);
+ paintInfo.phase = PaintPhaseChildBlockBackgrounds;
+ blockPainter.paint(paintInfo, paintOffset);
+ paintInfo.phase = PaintPhaseFloat;
+ blockPainter.paint(paintInfo, paintOffset);
+ paintInfo.phase = PaintPhaseForeground;
+ blockPainter.paint(paintInfo, paintOffset);
+ paintInfo.phase = PaintPhaseOutline;
+ blockPainter.paint(paintInfo, paintOffset);
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/paint/ScrollbarPainter.h ('k') | Source/core/rendering/RenderLayerScrollableArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698