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

Side by Side Diff: Source/core/rendering/AbstractInlineTextBox.cpp

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 8 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 /* 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 String AbstractInlineTextBox::text() const 144 String AbstractInlineTextBox::text() const
145 { 145 {
146 if (!m_inlineTextBox || !m_renderText) 146 if (!m_inlineTextBox || !m_renderText)
147 return String(); 147 return String();
148 148
149 unsigned start = m_inlineTextBox->start(); 149 unsigned start = m_inlineTextBox->start();
150 unsigned len = m_inlineTextBox->len(); 150 unsigned len = m_inlineTextBox->len();
151 if (Node* node = m_renderText->node()) { 151 if (Node* node = m_renderText->node()) {
152 RefPtr<Range> range = Range::create(node->document()); 152 RefPtrWillBeRawPtr<Range> range = Range::create(node->document());
153 range->setStart(node, start, IGNORE_EXCEPTION); 153 range->setStart(node, start, IGNORE_EXCEPTION);
154 range->setEnd(node, start + len, IGNORE_EXCEPTION); 154 range->setEnd(node, start + len, IGNORE_EXCEPTION);
155 return plainText(range.get(), TextIteratorIgnoresStyleVisibility); 155 return plainText(range.get(), TextIteratorIgnoresStyleVisibility);
156 } 156 }
157 157
158 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac e(WTF::DoNotStripWhiteSpace); 158 String result = m_renderText->text().substring(start, len).simplifyWhiteSpac e(WTF::DoNotStripWhiteSpace);
159 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start( ) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh itespace()) 159 if (m_inlineTextBox->nextTextBox() && m_inlineTextBox->nextTextBox()->start( ) > m_inlineTextBox->end() && result.length() && !result.right(1).containsOnlyWh itespace())
160 return result + " "; 160 return result + " ";
161 return result; 161 return result;
162 } 162 }
163 163
164 } // namespace WebCore 164 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698