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

Side by Side Diff: Source/modules/accessibility/AXInlineTextBox.cpp

Issue 1043643002: Switch line layout to LayoutUnit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TestExpectations tweaks Created 5 years, 6 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/TextPainter.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 /* 1 /*
2 * Copyright (C) 2013, Google Inc. All rights reserved. 2 * Copyright (C) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 13 matching lines...) Expand all
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "modules/accessibility/AXInlineTextBox.h" 30 #include "modules/accessibility/AXInlineTextBox.h"
31 31
32 #include "core/dom/Range.h" 32 #include "core/dom/Range.h"
33 #include "core/layout/LayoutText.h" 33 #include "core/layout/LayoutText.h"
34 #include "core/layout/line/FloatToLayoutUnit.h"
35 #include "modules/accessibility/AXObjectCacheImpl.h" 34 #include "modules/accessibility/AXObjectCacheImpl.h"
36 #include "platform/LayoutUnit.h" 35 #include "platform/LayoutUnit.h"
37 36
38 37
39 namespace blink { 38 namespace blink {
40 39
41 using namespace HTMLNames; 40 using namespace HTMLNames;
42 41
43 AXInlineTextBox::AXInlineTextBox(PassRefPtr<AbstractInlineTextBox> inlineTextBox , AXObjectCacheImpl* axObjectCache) 42 AXInlineTextBox::AXInlineTextBox(PassRefPtr<AbstractInlineTextBox> inlineTextBox , AXObjectCacheImpl* axObjectCache)
44 : AXObject(axObjectCache) 43 : AXObject(axObjectCache)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 89
91 return true; 90 return true;
92 } 91 }
93 92
94 void AXInlineTextBox::textCharacterOffsets(Vector<int>& offsets) const 93 void AXInlineTextBox::textCharacterOffsets(Vector<int>& offsets) const
95 { 94 {
96 if (!m_inlineTextBox) 95 if (!m_inlineTextBox)
97 return; 96 return;
98 97
99 unsigned len = m_inlineTextBox->len(); 98 unsigned len = m_inlineTextBox->len();
100 Vector<FloatWillBeLayoutUnit> widths; 99 Vector<float> widths;
101 m_inlineTextBox->characterWidths(widths); 100 m_inlineTextBox->characterWidths(widths);
102 ASSERT(widths.size() == len); 101 ASSERT(widths.size() == len);
103 offsets.resize(len); 102 offsets.resize(len);
104 103
105 FloatWillBeLayoutUnit widthSoFar = 0; 104 float widthSoFar = 0;
106 for (unsigned i = 0; i < len; i++) { 105 for (unsigned i = 0; i < len; i++) {
107 widthSoFar += widths[i]; 106 widthSoFar += widths[i];
108 offsets[i] = widthSoFar.round(); 107 offsets[i] = roundf(widthSoFar);
109 } 108 }
110 } 109 }
111 110
112 void AXInlineTextBox::wordBoundaries(Vector<PlainTextRange>& words) const 111 void AXInlineTextBox::wordBoundaries(Vector<PlainTextRange>& words) const
113 { 112 {
114 if (!m_inlineTextBox) 113 if (!m_inlineTextBox)
115 return; 114 return;
116 115
117 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries; 116 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries;
118 m_inlineTextBox->wordBoundaries(wordBoundaries); 117 m_inlineTextBox->wordBoundaries(wordBoundaries);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (previousOnLine) 176 if (previousOnLine)
178 return m_axObjectCache->getOrCreate(previousOnLine.get()); 177 return m_axObjectCache->getOrCreate(previousOnLine.get());
179 178
180 if (!m_inlineTextBox->isFirst()) 179 if (!m_inlineTextBox->isFirst())
181 return 0; 180 return 0;
182 181
183 return parentObject()->previousOnLine(); 182 return parentObject()->previousOnLine();
184 } 183 }
185 184
186 } // namespace blink 185 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/TextPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698