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

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

Issue 1224933002: Combine outline and focus ring code paths (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix empty focus ring on Mac 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/InlinePainter.cpp ('k') | Source/core/paint/LineBoxListPainter.cpp » ('j') | 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/CompositionUnderlineRangeFilter.h" 9 #include "core/editing/CompositionUnderlineRangeFilter.h"
10 #include "core/editing/Editor.h" 10 #include "core/editing/Editor.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value; 43 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value;
44 } 44 }
45 45
46 static bool paintsMarkerHighlights(const LayoutObject& layoutObject) 46 static bool paintsMarkerHighlights(const LayoutObject& layoutObject)
47 { 47 {
48 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l ayoutObject.node()); 48 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l ayoutObject.node());
49 } 49 }
50 50
51 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 51 void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
52 { 52 {
53 if (m_inlineTextBox.isLineBreak() || !paintInfo.shouldPaintWithinRoot(&m_inl ineTextBox.layoutObject()) || m_inlineTextBox.layoutObject().style()->visibility () != VISIBLE 53 if (m_inlineTextBox.isLineBreak() || !paintInfo.shouldPaintWithinRoot(&m_inl ineTextBox.layoutObject()) || m_inlineTextBox.layoutObject().style()->visibility () != VISIBLE || m_inlineTextBox.truncation() == cFullTruncation || !m_inlineTex tBox.len())
54 || m_inlineTextBox.truncation() == cFullTruncation || paintInfo.phase == PaintPhaseOutline || !m_inlineTextBox.len())
55 return; 54 return;
56 55
57 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines); 56 ASSERT(paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhase SelfOutline && paintInfo.phase != PaintPhaseChildOutlines);
58 57
59 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect(); 58 LayoutRect logicalVisualOverflow = m_inlineTextBox.logicalOverflowRect();
60 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y()); 59 LayoutUnit logicalStart = logicalVisualOverflow.x() + (m_inlineTextBox.isHor izontal() ? paintOffset.x() : paintOffset.y());
61 LayoutUnit logicalExtent = logicalVisualOverflow.width(); 60 LayoutUnit logicalExtent = logicalVisualOverflow.width();
62 61
63 LayoutUnit paintEnd = m_inlineTextBox.isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rect.maxY(); 62 LayoutUnit paintEnd = m_inlineTextBox.isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rect.maxY();
64 LayoutUnit paintStart = m_inlineTextBox.isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y(); 63 LayoutUnit paintStart = m_inlineTextBox.isHorizontal() ? paintInfo.rect.x() : paintInfo.rect.y();
65 64
66 // We round the y-axis to ensure consistent line heights. 65 // We round the y-axis to ensure consistent line heights.
67 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round()); 66 LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y ().round());
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent()); 828 LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetri cs().ascent());
830 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal()); 829 TextPainter textPainter(pt, font, run, textOrigin, boxRect, m_inline TextBox.isHorizontal());
831 830
832 textPainter.paint(sPos, ePos, length, textStyle, 0); 831 textPainter.paint(sPos, ePos, length, textStyle, 0);
833 } 832 }
834 } 833 }
835 } 834 }
836 835
837 836
838 } // namespace blink 837 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/InlinePainter.cpp ('k') | Source/core/paint/LineBoxListPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698