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

Side by Side Diff: Source/core/dom/Text.cpp

Issue 699213003: RenderTreeBuilder => RenderTreeBuilderForElement and RenderTreeBuilderForText (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 1 month 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/dom/RenderTreeBuilder.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return TEXT_NODE; 232 return TEXT_NODE;
233 } 233 }
234 234
235 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/) 235 PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/)
236 { 236 {
237 return cloneWithData(data()); 237 return cloneWithData(data());
238 } 238 }
239 239
240 bool Text::textRendererIsNeeded(const RenderStyle& style, const RenderObject& pa rent) 240 bool Text::textRendererIsNeeded(const RenderStyle& style, const RenderObject& pa rent)
241 { 241 {
242 if (!parent.canHaveChildren())
243 return false;
244
242 if (isEditingText()) 245 if (isEditingText())
243 return true; 246 return true;
244 247
245 if (!length()) 248 if (!length())
246 return false; 249 return false;
247 250
248 if (style.display() == NONE) 251 if (style.display() == NONE)
249 return false; 252 return false;
250 253
251 if (!containsOnlyWhitespace()) 254 if (!containsOnlyWhitespace())
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return new RenderSVGInlineText(this, dataImpl()); 300 return new RenderSVGInlineText(this, dataImpl());
298 301
299 if (style->hasTextCombine()) 302 if (style->hasTextCombine())
300 return new RenderCombineText(this, dataImpl()); 303 return new RenderCombineText(this, dataImpl());
301 304
302 return new RenderText(this, dataImpl()); 305 return new RenderText(this, dataImpl());
303 } 306 }
304 307
305 void Text::attach(const AttachContext& context) 308 void Text::attach(const AttachContext& context)
306 { 309 {
307 RenderTreeBuilder(this, context.resolvedStyle).createRendererForTextIfNeeded (); 310 if (ContainerNode* renderingParent = NodeRenderingTraversal::parent(this)) {
311 if (RenderObject* parentRenderer = renderingParent->renderer()) {
312 if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer))
313 RenderTreeBuilderForText(this, parentRenderer).createRenderer();
314 }
315 }
308 CharacterData::attach(context); 316 CharacterData::attach(context);
309 } 317 }
310 318
311 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) 319 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling)
312 { 320 {
313 if (RenderText* renderer = this->renderer()) { 321 if (RenderText* renderer = this->renderer()) {
314 if (change != NoChange || needsStyleRecalc()) 322 if (change != NoChange || needsStyleRecalc())
315 renderer->setStyle(document().ensureStyleResolver().styleForText(thi s)); 323 renderer->setStyle(document().ensureStyleResolver().styleForText(thi s));
316 if (needsStyleRecalc()) 324 if (needsStyleRecalc())
317 renderer->setText(dataImpl()); 325 renderer->setText(dataImpl());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 result.appendLiteral("; "); 375 result.appendLiteral("; ");
368 result.appendLiteral("value="); 376 result.appendLiteral("value=");
369 result.append(s); 377 result.append(s);
370 } 378 }
371 379
372 strncpy(buffer, result.toString().utf8().data(), length - 1); 380 strncpy(buffer, result.toString().utf8().data(), length - 1);
373 } 381 }
374 #endif 382 #endif
375 383
376 } // namespace blink 384 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/RenderTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698