OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/InlineTextBoxPainter.h" | 5 #include "core/paint/InlineTextBoxPainter.h" |
6 | 6 |
7 #include "core/editing/CompositionUnderline.h" | 7 #include "core/editing/CompositionUnderline.h" |
8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
9 #include "core/editing/markers/DocumentMarkerController.h" | 9 #include "core/editing/markers/DocumentMarkerController.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 const DocumentMarker& marker, | 1306 const DocumentMarker& marker, |
1307 const ComputedStyle& style, | 1307 const ComputedStyle& style, |
1308 const Font& font) { | 1308 const Font& font) { |
1309 if (!inlineLayoutObject().frame()->editor().markedTextMatchesAreHighlighted()) | 1309 if (!inlineLayoutObject().frame()->editor().markedTextMatchesAreHighlighted()) |
1310 return; | 1310 return; |
1311 | 1311 |
1312 const auto paintOffsets = GetMarkerPaintOffsets(marker, m_inlineTextBox); | 1312 const auto paintOffsets = GetMarkerPaintOffsets(marker, m_inlineTextBox); |
1313 TextRun run = m_inlineTextBox.constructTextRun(style); | 1313 TextRun run = m_inlineTextBox.constructTextRun(style); |
1314 | 1314 |
1315 Color textColor = | 1315 Color textColor = |
1316 LayoutTheme::theme().platformTextSearchColor(marker.activeMatch()); | 1316 LayoutTheme::theme().platformTextSearchColor(marker.IsActiveMatch()); |
1317 if (style.visitedDependentColor(CSSPropertyColor) == textColor) | 1317 if (style.visitedDependentColor(CSSPropertyColor) == textColor) |
1318 return; | 1318 return; |
1319 | 1319 |
1320 const SimpleFontData* fontData = font.primaryFont(); | 1320 const SimpleFontData* fontData = font.primaryFont(); |
1321 DCHECK(fontData); | 1321 DCHECK(fontData); |
1322 if (!fontData) | 1322 if (!fontData) |
1323 return; | 1323 return; |
1324 | 1324 |
1325 TextPainter::Style textStyle; | 1325 TextPainter::Style textStyle; |
1326 textStyle.currentColor = textStyle.fillColor = textStyle.strokeColor = | 1326 textStyle.currentColor = textStyle.fillColor = textStyle.strokeColor = |
(...skipping 21 matching lines...) Expand all Loading... |
1348 if (!LineLayoutAPIShim::layoutObjectFrom(m_inlineTextBox.getLineLayoutItem()) | 1348 if (!LineLayoutAPIShim::layoutObjectFrom(m_inlineTextBox.getLineLayoutItem()) |
1349 ->frame() | 1349 ->frame() |
1350 ->editor() | 1350 ->editor() |
1351 .markedTextMatchesAreHighlighted()) | 1351 .markedTextMatchesAreHighlighted()) |
1352 return; | 1352 return; |
1353 | 1353 |
1354 const auto paintOffsets = GetMarkerPaintOffsets(marker, m_inlineTextBox); | 1354 const auto paintOffsets = GetMarkerPaintOffsets(marker, m_inlineTextBox); |
1355 TextRun run = m_inlineTextBox.constructTextRun(style); | 1355 TextRun run = m_inlineTextBox.constructTextRun(style); |
1356 | 1356 |
1357 Color color = LayoutTheme::theme().platformTextSearchHighlightColor( | 1357 Color color = LayoutTheme::theme().platformTextSearchHighlightColor( |
1358 marker.activeMatch()); | 1358 marker.IsActiveMatch()); |
1359 GraphicsContext& context = paintInfo.context; | 1359 GraphicsContext& context = paintInfo.context; |
1360 GraphicsContextStateSaver stateSaver(context); | 1360 GraphicsContextStateSaver stateSaver(context); |
1361 | 1361 |
1362 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), | 1362 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), |
1363 m_inlineTextBox.logicalHeight())); | 1363 m_inlineTextBox.logicalHeight())); |
1364 context.clip(FloatRect(boxRect)); | 1364 context.clip(FloatRect(boxRect)); |
1365 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), | 1365 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), |
1366 boxRect.height().toInt(), color, | 1366 boxRect.height().toInt(), color, |
1367 paintOffsets.first, paintOffsets.second); | 1367 paintOffsets.first, paintOffsets.second); |
1368 } | 1368 } |
1369 | 1369 |
1370 } // namespace blink | 1370 } // namespace blink |
OLD | NEW |