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

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

Issue 2392443009: reflow comments in core/paint (Closed)
Patch Set: Created 4 years, 2 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/ListMarkerPainter.h" 5 #include "core/paint/ListMarkerPainter.h"
6 6
7 #include "core/layout/LayoutListItem.h" 7 #include "core/layout/LayoutListItem.h"
8 #include "core/layout/LayoutListMarker.h" 8 #include "core/layout/LayoutListMarker.h"
9 #include "core/layout/ListMarkerText.h" 9 #include "core/layout/ListMarkerText.h"
10 #include "core/layout/api/SelectionState.h" 10 #include "core/layout/api/SelectionState.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 context.rotate(static_cast<float>(deg2rad(90.))); 127 context.rotate(static_cast<float>(deg2rad(90.)));
128 context.translate(-marker.x(), -marker.maxY()); 128 context.translate(-marker.x(), -marker.maxY());
129 } 129 }
130 130
131 TextRunPaintInfo textRunPaintInfo(textRun); 131 TextRunPaintInfo textRunPaintInfo(textRun);
132 textRunPaintInfo.bounds = marker; 132 textRunPaintInfo.bounds = marker;
133 IntPoint textOrigin = IntPoint( 133 IntPoint textOrigin = IntPoint(
134 marker.x(), 134 marker.x(),
135 marker.y() + m_layoutListMarker.style()->getFontMetrics().ascent()); 135 marker.y() + m_layoutListMarker.style()->getFontMetrics().ascent());
136 136
137 // Text is not arbitrary. We can judge whether it's RTL from the first charact er, 137 // Text is not arbitrary. We can judge whether it's RTL from the first
138 // and we only need to handle the direction RightToLeft for now. 138 // character, and we only need to handle the direction RightToLeft for now.
139 bool textNeedsReversing = 139 bool textNeedsReversing =
140 WTF::Unicode::direction(m_layoutListMarker.text()[0]) == 140 WTF::Unicode::direction(m_layoutListMarker.text()[0]) ==
141 WTF::Unicode::RightToLeft; 141 WTF::Unicode::RightToLeft;
142 StringBuilder reversedText; 142 StringBuilder reversedText;
143 if (textNeedsReversing) { 143 if (textNeedsReversing) {
144 unsigned length = m_layoutListMarker.text().length(); 144 unsigned length = m_layoutListMarker.text().length();
145 reversedText.reserveCapacity(length); 145 reversedText.reserveCapacity(length);
146 for (int i = length - 1; i >= 0; --i) 146 for (int i = length - 1; i >= 0; --i)
147 reversedText.append(m_layoutListMarker.text()[i]); 147 reversedText.append(m_layoutListMarker.text()[i]);
148 ASSERT(reversedText.length() == length); 148 ASSERT(reversedText.length() == length);
(...skipping 14 matching lines...) Expand all
163 context.drawText(font, suffixRunInfo, 163 context.drawText(font, suffixRunInfo,
164 textOrigin + IntSize(font.width(textRun), 0)); 164 textOrigin + IntSize(font.width(textRun), 0));
165 } else { 165 } else {
166 context.drawText(font, suffixRunInfo, textOrigin); 166 context.drawText(font, suffixRunInfo, textOrigin);
167 context.drawText(font, textRunPaintInfo, 167 context.drawText(font, textRunPaintInfo,
168 textOrigin + IntSize(font.width(suffixRun), 0)); 168 textOrigin + IntSize(font.width(suffixRun), 0));
169 } 169 }
170 } 170 }
171 171
172 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698