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

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

Issue 1355913004: Disable newline selection highlighting for vertical and RTL text. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@474759_invalidate_br_and_horiz_only
Patch Set: Merge changes. Created 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/layout/line/InlineTextBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/paint/InlineTextBoxPainter.h" 6 #include "core/paint/InlineTextBoxPainter.h"
7 7
8 #include "core/editing/CompositionUnderline.h" 8 #include "core/editing/CompositionUnderline.h"
9 #include "core/editing/Editor.h" 9 #include "core/editing/Editor.h"
10 #include "core/editing/markers/DocumentMarkerController.h" 10 #include "core/editing/markers/DocumentMarkerController.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool InlineTextBoxPainter::shouldPaintTextBox(const PaintInfo& paintInfo) 246 bool InlineTextBoxPainter::shouldPaintTextBox(const PaintInfo& paintInfo)
247 { 247 {
248 // When painting selection, we want to include a highlight when the 248 // When painting selection, we want to include a highlight when the
249 // selection spans line breaks. In other cases such as invisible elements 249 // selection spans line breaks. In other cases such as invisible elements
250 // or those with no text that are not line breaks, we can skip painting 250 // or those with no text that are not line breaks, we can skip painting
251 // wholesale. 251 // wholesale.
252 // TODO(wkorman): Constrain line break painting to appropriate paint phase. 252 // TODO(wkorman): Constrain line break painting to appropriate paint phase.
253 // This code path is only called in PaintPhaseForeground whereas we would 253 // This code path is only called in PaintPhaseForeground whereas we would
254 // expect PaintPhaseSelection. The existing haveSelection logic in paint() 254 // expect PaintPhaseSelection. The existing haveSelection logic in paint()
255 // tests for != PaintPhaseTextClip. 255 // tests for != PaintPhaseTextClip.
256 bool paintLineBreaks = RuntimeEnabledFeatures::selectionPaintingWithoutSelec tionGapsEnabled(); 256 bool paintLineBreaks = RuntimeEnabledFeatures::selectionPaintingWithoutSelec tionGapsEnabled()
257 // TODO(wkorman): Remove horizontal and RTL restrictions once operationa l.
258 && m_inlineTextBox.isHorizontal()
259 && m_inlineTextBox.isLeftToRightDirection();
257 if ((!paintLineBreaks && m_inlineTextBox.isLineBreak()) 260 if ((!paintLineBreaks && m_inlineTextBox.isLineBreak())
258 || !paintInfo.shouldPaintWithinRoot(&m_inlineTextBox.layoutObject()) 261 || !paintInfo.shouldPaintWithinRoot(&m_inlineTextBox.layoutObject())
259 || m_inlineTextBox.layoutObject().style()->visibility() != VISIBLE 262 || m_inlineTextBox.layoutObject().style()->visibility() != VISIBLE
260 || m_inlineTextBox.truncation() == cFullTruncation 263 || m_inlineTextBox.truncation() == cFullTruncation
261 || !m_inlineTextBox.len()) 264 || !m_inlineTextBox.len())
262 return false; 265 return false;
263 return true; 266 return true;
264 } 267 }
265 268
266 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline) 269 unsigned InlineTextBoxPainter::underlinePaintStart(const CompositionUnderline& u nderline)
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent()); 845 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent());
843 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal()); 846 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal());
844 847
845 textPainter.paint(sPos, ePos, length, textStyle, 0); 848 textPainter.paint(sPos, ePos, length, textStyle, 0);
846 } 849 }
847 } 850 }
848 } 851 }
849 852
850 853
851 } // namespace blink 854 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineTextBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698