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

Side by Side Diff: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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/editing/markers/RenderedDocumentMarker.h" 10 #include "core/editing/markers/RenderedDocumentMarker.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext& context, const L ayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font, bool grammar) 376 void InlineTextBoxPainter::paintDocumentMarker(GraphicsContext& context, const L ayoutPoint& boxOrigin, DocumentMarker* marker, const ComputedStyle& style, const Font& font, bool grammar)
377 { 377 {
378 // Never print spelling/grammar markers (5327887) 378 // Never print spelling/grammar markers (5327887)
379 if (m_inlineTextBox.lineLayoutItem().document().printing()) 379 if (m_inlineTextBox.lineLayoutItem().document().printing())
380 return; 380 return;
381 381
382 if (m_inlineTextBox.truncation() == cFullTruncation) 382 if (m_inlineTextBox.truncation() == cFullTruncation)
383 return; 383 return;
384 384
385 LayoutUnit start = 0; // start of line to draw, relative to tx 385 LayoutUnit start; // start of line to draw, relative to tx
386 LayoutUnit width = m_inlineTextBox.logicalWidth(); // how much line to draw 386 LayoutUnit width = m_inlineTextBox.logicalWidth(); // how much line to draw
387 387
388 // Determine whether we need to measure text 388 // Determine whether we need to measure text
389 bool markerSpansWholeBox = true; 389 bool markerSpansWholeBox = true;
390 if (m_inlineTextBox.start() <= marker->startOffset()) 390 if (m_inlineTextBox.start() <= marker->startOffset())
391 markerSpansWholeBox = false; 391 markerSpansWholeBox = false;
392 if ((m_inlineTextBox.end() + 1) != marker->endOffset()) // end points at the last char, not past it 392 if ((m_inlineTextBox.end() + 1) != marker->endOffset()) // end points at the last char, not past it
393 markerSpansWholeBox = false; 393 markerSpansWholeBox = false;
394 if (m_inlineTextBox.truncation() != cNoTruncation) 394 if (m_inlineTextBox.truncation() != cNoTruncation)
395 markerSpansWholeBox = false; 395 markerSpansWholeBox = false;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 867
868 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker-> activeMatch()); 868 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker-> activeMatch());
869 GraphicsContext& context = paintInfo.context; 869 GraphicsContext& context = paintInfo.context;
870 GraphicsContextStateSaver stateSaver(context); 870 GraphicsContextStateSaver stateSaver(context);
871 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); 871 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight));
872 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); 872 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos);
873 } 873 }
874 874
875 875
876 } // namespace blink 876 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698