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

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

Issue 583023002: Move paint code from RenderBlockFlow into BlockFlowPainter. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix 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/BlockFlowPainter.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/BlockFlowPainter.cpp
diff --git a/Source/core/paint/BlockFlowPainter.cpp b/Source/core/paint/BlockFlowPainter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a66ed50f7de6e847477edbffb7c1d4ed1425e0e
--- /dev/null
+++ b/Source/core/paint/BlockFlowPainter.cpp
@@ -0,0 +1,47 @@
+// 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/BlockFlowPainter.h"
+
+#include "core/rendering/FloatingObjects.h"
+#include "core/rendering/PaintInfo.h"
+#include "core/rendering/RenderBlockFlow.h"
+
+namespace blink {
+
+void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paintOffset, bool preservePhase)
+{
+ if (!m_renderBlockFlow.floatingObjects())
+ return;
+
+ const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjects()->set();
+ FloatingObjectSetIterator end = floatingObjectSet.end();
+ for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
+ FloatingObject* floatingObject = it->get();
+ // Only paint the object if our m_shouldPaint flag is set.
+ if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) {
+ PaintInfo currentPaintInfo(paintInfo);
+ currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
+ // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner.
+ LayoutPoint childPoint = m_renderBlockFlow.flipFloatForWritingModeForChild(
+ floatingObject, LayoutPoint(paintOffset.x()
+ + m_renderBlockFlow.xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(), paintOffset.y()
+ + m_renderBlockFlow.yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y()));
+ floatingObject->renderer()->paint(currentPaintInfo, childPoint);
+ if (!preservePhase) {
+ currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
+ floatingObject->renderer()->paint(currentPaintInfo, childPoint);
+ currentPaintInfo.phase = PaintPhaseFloat;
+ floatingObject->renderer()->paint(currentPaintInfo, childPoint);
+ currentPaintInfo.phase = PaintPhaseForeground;
+ floatingObject->renderer()->paint(currentPaintInfo, childPoint);
+ currentPaintInfo.phase = PaintPhaseOutline;
+ floatingObject->renderer()->paint(currentPaintInfo, childPoint);
+ }
+ }
+ }
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/paint/BlockFlowPainter.h ('k') | Source/core/rendering/RenderBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698