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

Side by Side Diff: Source/core/layout/LayoutQuote.cpp

Issue 940373003: Rename RenderText to LayoutText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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/LayoutQuote.h ('k') | Source/core/layout/LayoutRubyRun.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 /** 1 /**
2 * Copyright (C) 2011 Nokia Inc. All rights reserved. 2 * Copyright (C) 2011 Nokia Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/layout/LayoutQuote.h" 23 #include "core/layout/LayoutQuote.h"
24 24
25 #include "core/layout/LayoutTextFragment.h"
25 #include "core/layout/LayoutView.h" 26 #include "core/layout/LayoutView.h"
26 #include "core/rendering/RenderTextFragment.h"
27 #include "wtf/StdLibExtras.h" 27 #include "wtf/StdLibExtras.h"
28 #include "wtf/text/AtomicString.h" 28 #include "wtf/text/AtomicString.h"
29 29
30 #include <algorithm> 30 #include <algorithm>
31 31
32 namespace blink { 32 namespace blink {
33 33
34 LayoutQuote::LayoutQuote(Document* node, QuoteType quote) 34 LayoutQuote::LayoutQuote(Document* node, QuoteType quote)
35 : LayoutInline(0) 35 : LayoutInline(0)
36 , m_type(quote) 36 , m_type(quote)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 256 }
257 257
258 void LayoutQuote::updateText() 258 void LayoutQuote::updateText()
259 { 259 {
260 String text = computeText(); 260 String text = computeText();
261 if (m_text == text) 261 if (m_text == text)
262 return; 262 return;
263 263
264 m_text = text; 264 m_text = text;
265 265
266 RenderTextFragment* fragment = findFragmentChild(); 266 LayoutTextFragment* fragment = findFragmentChild();
267 if (fragment) { 267 if (fragment) {
268 fragment->setStyle(style()); 268 fragment->setStyle(style());
269 fragment->setContentString(m_text.impl()); 269 fragment->setContentString(m_text.impl());
270 } else { 270 } else {
271 fragment = new RenderTextFragment(&document(), m_text.impl()); 271 fragment = new LayoutTextFragment(&document(), m_text.impl());
272 fragment->setStyle(style()); 272 fragment->setStyle(style());
273 addChild(fragment); 273 addChild(fragment);
274 } 274 }
275 } 275 }
276 276
277 RenderTextFragment* LayoutQuote::findFragmentChild() const 277 LayoutTextFragment* LayoutQuote::findFragmentChild() const
278 { 278 {
279 // We walk from the end of the child list because, if we've had a first-lett er 279 // We walk from the end of the child list because, if we've had a first-lett er
280 // renderer inserted then the remaining text will be at the end. 280 // renderer inserted then the remaining text will be at the end.
281 while (LayoutObject* child = lastChild()) { 281 while (LayoutObject* child = lastChild()) {
282 if (child->isText() && toRenderText(child)->isTextFragment()) 282 if (child->isText() && toLayoutText(child)->isTextFragment())
283 return toRenderTextFragment(child); 283 return toLayoutTextFragment(child);
284 } 284 }
285 285
286 return nullptr; 286 return nullptr;
287 } 287 }
288 288
289 String LayoutQuote::computeText() const 289 String LayoutQuote::computeText() const
290 { 290 {
291 switch (m_type) { 291 switch (m_type) {
292 case NO_OPEN_QUOTE: 292 case NO_OPEN_QUOTE:
293 case NO_CLOSE_QUOTE: 293 case NO_CLOSE_QUOTE:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (m_depth) 399 if (m_depth)
400 m_depth--; 400 m_depth--;
401 break; 401 break;
402 } 402 }
403 } 403 }
404 if (oldDepth != m_depth) 404 if (oldDepth != m_depth)
405 updateText(); 405 updateText();
406 } 406 }
407 407
408 } // namespace blink 408 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutQuote.h ('k') | Source/core/layout/LayoutRubyRun.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698