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

Unified Diff: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move accessor methods into derived classes Created 3 years, 9 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: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
index b46e742c2e33dbb443ce2d3856c22bb16242dc8d..c8f792bf228599c22e6666b34221ab0d02e4ceee 100644
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -6,7 +6,9 @@
#include "core/editing/CompositionUnderline.h"
#include "core/editing/Editor.h"
+#include "core/editing/markers/CompositionMarker.h"
#include "core/editing/markers/DocumentMarkerController.h"
+#include "core/editing/markers/TextMatchMarker.h"
#include "core/frame/LocalFrame.h"
#include "core/layout/LayoutTextCombine.h"
#include "core/layout/LayoutTheme.h"
@@ -856,17 +858,21 @@ void InlineTextBoxPainter::paintDocumentMarkers(
marker, style, font, true);
break;
case DocumentMarker::TextMatch:
- if (markerPaintPhase == DocumentMarkerPaintPhase::Background)
- m_inlineTextBox.paintTextMatchMarkerBackground(paintInfo, boxOrigin,
- marker, style, font);
- else
- m_inlineTextBox.paintTextMatchMarkerForeground(paintInfo, boxOrigin,
- marker, style, font);
+ if (markerPaintPhase == DocumentMarkerPaintPhase::Background) {
+ m_inlineTextBox.paintTextMatchMarkerBackground(
+ paintInfo, boxOrigin, toTextMatchMarker(marker), style, font);
+ } else {
+ m_inlineTextBox.paintTextMatchMarkerForeground(
+ paintInfo, boxOrigin, toTextMatchMarker(marker), style, font);
+ }
break;
case DocumentMarker::Composition: {
- CompositionUnderline underline(marker.startOffset(), marker.endOffset(),
- marker.underlineColor(), marker.thick(),
- marker.backgroundColor());
+ const CompositionMarker& compositionMarker =
+ toCompositionMarker(marker);
+ CompositionUnderline underline(
+ compositionMarker.startOffset(), compositionMarker.endOffset(),
+ compositionMarker.underlineColor(), compositionMarker.thick(),
+ compositionMarker.backgroundColor());
if (markerPaintPhase == DocumentMarkerPaintPhase::Background)
paintSingleCompositionBackgroundRun(
paintInfo.context, boxOrigin, style, font,
@@ -1303,7 +1309,7 @@ void InlineTextBoxPainter::paintCompositionUnderline(
void InlineTextBoxPainter::paintTextMatchMarkerForeground(
const PaintInfo& paintInfo,
const LayoutPoint& boxOrigin,
- const DocumentMarker& marker,
+ const TextMatchMarker& marker,
const ComputedStyle& style,
const Font& font) {
if (!inlineLayoutObject().frame()->editor().markedTextMatchesAreHighlighted())
@@ -1342,7 +1348,7 @@ void InlineTextBoxPainter::paintTextMatchMarkerForeground(
void InlineTextBoxPainter::paintTextMatchMarkerBackground(
const PaintInfo& paintInfo,
const LayoutPoint& boxOrigin,
- const DocumentMarker& marker,
+ const TextMatchMarker& marker,
const ComputedStyle& style,
const Font& font) {
if (!LineLayoutAPIShim::layoutObjectFrom(m_inlineTextBox.getLineLayoutItem())

Powered by Google App Engine
This is Rietveld 408576698