Commit ec750779 authored by Ryan Landay's avatar Ryan Landay Committed by Commit Bot

Clean up InlineTextBoxPainter::PaintDocumentMarkers()

This CL consolidates two switch statements in this method and makes the code
easier to follow. It also removes NOTREACHED() from the switch statement to
allow adding painting code for a DocumentMarker in a separate CL from the
editing changes.

Bug: 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ic125d633078ff3e74105f62ba64c5ebc349002bc
Reviewed-on: https://chromium-review.googlesource.com/592327Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Ryan Landay <rlanday@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491866}
parent d625a73a
......@@ -642,20 +642,6 @@ void InlineTextBoxPainter::PaintDocumentMarkers(
DCHECK(*marker_it);
const DocumentMarker& marker = **marker_it;
// Paint either the background markers or the foreground markers, but not
// both.
switch (marker.GetType()) {
case DocumentMarker::kGrammar:
case DocumentMarker::kSpelling:
if (marker_paint_phase == DocumentMarkerPaintPhase::kBackground)
continue;
break;
case DocumentMarker::kTextMatch:
case DocumentMarker::kComposition:
case DocumentMarker::kActiveSuggestion:
break;
}
if (marker.EndOffset() <= inline_text_box_.Start()) {
// marker is completely before this run. This might be a marker that sits
// before the first run we draw, or markers that were within runs we
......@@ -670,10 +656,14 @@ void InlineTextBoxPainter::PaintDocumentMarkers(
// marker intersects this run. Paint it.
switch (marker.GetType()) {
case DocumentMarker::kSpelling:
if (marker_paint_phase == DocumentMarkerPaintPhase::kBackground)
continue;
inline_text_box_.PaintDocumentMarker(paint_info.context, box_origin,
marker, style, font, false);
break;
case DocumentMarker::kGrammar:
if (marker_paint_phase == DocumentMarkerPaintPhase::kBackground)
continue;
inline_text_box_.PaintDocumentMarker(paint_info.context, box_origin,
marker, style, font, true);
break;
......@@ -701,7 +691,8 @@ void InlineTextBoxPainter::PaintDocumentMarkers(
}
} break;
default:
NOTREACHED();
// Marker is not painted, or painting code has not been added yet
break;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment