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

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

Issue 585943004: Move painting code from RenderLineBoxList to LineBoxListPainter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merged. 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/LineBoxListPainter.h ('k') | Source/core/rendering/RenderLineBoxList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/LineBoxListPainter.cpp
diff --git a/Source/core/paint/LineBoxListPainter.cpp b/Source/core/paint/LineBoxListPainter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d440a4535a10c0d1fbe4cfc602a354c1faaa8ca8
--- /dev/null
+++ b/Source/core/paint/LineBoxListPainter.cpp
@@ -0,0 +1,58 @@
+// 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/LineBoxListPainter.h"
+
+#include "core/paint/InlinePainter.h"
+#include "core/rendering/InlineFlowBox.h"
+#include "core/rendering/PaintInfo.h"
+#include "core/rendering/RenderBoxModelObject.h"
+#include "core/rendering/RenderLineBoxList.h"
+#include "core/rendering/RootInlineBox.h"
+
+namespace blink {
+
+void LineBoxListPainter::paint(RenderBoxModelObject* renderer, PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
+{
+ // Only paint during the foreground/selection phases.
+ if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline
+ && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines && paintInfo.phase != PaintPhaseTextClip
+ && paintInfo.phase != PaintPhaseMask)
+ return;
+
+ ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could paint like this is if it has a layer.
+
+ // If we have no lines then we have no work to do.
+ if (!m_renderLineBoxList.firstLineBox())
+ return;
+
+ if (!m_renderLineBoxList.anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset))
+ return;
+
+ PaintInfo info(paintInfo);
+ ListHashSet<RenderInline*> outlineObjects;
+ info.setOutlineObjects(&outlineObjects);
+
+ // See if our root lines intersect with the dirty rect. If so, then we paint
+ // them. Note that boxes can easily overlap, so we can't make any assumptions
+ // based off positions of our first line box or our last line box.
+ for (InlineFlowBox* curr = m_renderLineBoxList.firstLineBox(); curr; curr = curr->nextLineBox()) {
+ if (m_renderLineBoxList.lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) {
+ RootInlineBox& root = curr->root();
+ curr->paint(info, paintOffset, root.lineTop(), root.lineBottom());
+ }
+ }
+
+ if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline || info.phase == PaintPhaseChildOutlines) {
+ ListHashSet<RenderInline*>::iterator end = info.outlineObjects()->end();
+ for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects()->begin(); it != end; ++it) {
+ RenderInline* flow = *it;
+ InlinePainter(*flow).paintOutline(info, paintOffset);
+ }
+ info.outlineObjects()->clear();
+ }
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/paint/LineBoxListPainter.h ('k') | Source/core/rendering/RenderLineBoxList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698