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

Side by Side Diff: Source/core/dom/Text.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/dom/Text.h ('k') | Source/core/editing/ApplyStyleCommand.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) 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 15 matching lines...) Expand all
26 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 26 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
27 #include "core/SVGNames.h" 27 #include "core/SVGNames.h"
28 #include "core/css/resolver/StyleResolver.h" 28 #include "core/css/resolver/StyleResolver.h"
29 #include "core/dom/ExceptionCode.h" 29 #include "core/dom/ExceptionCode.h"
30 #include "core/dom/NodeLayoutStyle.h" 30 #include "core/dom/NodeLayoutStyle.h"
31 #include "core/dom/NodeRenderingTraversal.h" 31 #include "core/dom/NodeRenderingTraversal.h"
32 #include "core/dom/NodeTraversal.h" 32 #include "core/dom/NodeTraversal.h"
33 #include "core/dom/RenderTreeBuilder.h" 33 #include "core/dom/RenderTreeBuilder.h"
34 #include "core/dom/shadow/ShadowRoot.h" 34 #include "core/dom/shadow/ShadowRoot.h"
35 #include "core/events/ScopedEventQueue.h" 35 #include "core/events/ScopedEventQueue.h"
36 #include "core/layout/LayoutText.h"
37 #include "core/layout/LayoutTextCombine.h"
36 #include "core/layout/svg/LayoutSVGInlineText.h" 38 #include "core/layout/svg/LayoutSVGInlineText.h"
37 #include "core/rendering/RenderCombineText.h"
38 #include "core/rendering/RenderText.h"
39 #include "core/svg/SVGForeignObjectElement.h" 39 #include "core/svg/SVGForeignObjectElement.h"
40 #include "wtf/text/CString.h" 40 #include "wtf/text/CString.h"
41 #include "wtf/text/StringBuilder.h" 41 #include "wtf/text/StringBuilder.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 #if ENABLE(OILPAN) 45 #if ENABLE(OILPAN)
46 namespace { 46 namespace {
47 // If the external string kept by a Text node exceed this threshold length, 47 // If the external string kept by a Text node exceed this threshold length,
48 // Oilpan is informed. External allocation amounts owned by heap objects are 48 // Oilpan is informed. External allocation amounts owned by heap objects are
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return true; 343 return true;
344 } 344 }
345 345
346 static bool isSVGText(Text* text) 346 static bool isSVGText(Text* text)
347 { 347 {
348 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); 348 Node* parentOrShadowHostNode = text->parentOrShadowHostNode();
349 ASSERT(parentOrShadowHostNode); 349 ASSERT(parentOrShadowHostNode);
350 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement( *parentOrShadowHostNode); 350 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement( *parentOrShadowHostNode);
351 } 351 }
352 352
353 RenderText* Text::createTextRenderer(LayoutStyle* style) 353 LayoutText* Text::createTextRenderer(LayoutStyle* style)
354 { 354 {
355 if (isSVGText(this)) 355 if (isSVGText(this))
356 return new LayoutSVGInlineText(this, dataImpl()); 356 return new LayoutSVGInlineText(this, dataImpl());
357 357
358 if (style->hasTextCombine()) 358 if (style->hasTextCombine())
359 return new RenderCombineText(this, dataImpl()); 359 return new LayoutTextCombine(this, dataImpl());
360 360
361 return new RenderText(this, dataImpl()); 361 return new LayoutText(this, dataImpl());
362 } 362 }
363 363
364 void Text::attach(const AttachContext& context) 364 void Text::attach(const AttachContext& context)
365 { 365 {
366 if (ContainerNode* renderingParent = NodeRenderingTraversal::parent(*this)) { 366 if (ContainerNode* renderingParent = NodeRenderingTraversal::parent(*this)) {
367 if (LayoutObject* parentRenderer = renderingParent->renderer()) { 367 if (LayoutObject* parentRenderer = renderingParent->renderer()) {
368 if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer)) 368 if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer))
369 RenderTreeBuilderForText(*this, parentRenderer).createRenderer() ; 369 RenderTreeBuilderForText(*this, parentRenderer).createRenderer() ;
370 } 370 }
371 } 371 }
(...skipping 21 matching lines...) Expand all
393 393
394 if (styleChangeType() < NeedsReattachStyleChange) 394 if (styleChangeType() < NeedsReattachStyleChange)
395 detach(reattachContext); 395 detach(reattachContext);
396 if (rendererIsNeeded) 396 if (rendererIsNeeded)
397 RenderTreeBuilderForText(*this, renderingParent->renderer()).createRende rer(); 397 RenderTreeBuilderForText(*this, renderingParent->renderer()).createRende rer();
398 CharacterData::attach(reattachContext); 398 CharacterData::attach(reattachContext);
399 } 399 }
400 400
401 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) 401 void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling)
402 { 402 {
403 if (RenderText* renderer = this->renderer()) { 403 if (LayoutText* renderer = this->renderer()) {
404 if (change != NoChange || needsStyleRecalc()) 404 if (change != NoChange || needsStyleRecalc())
405 renderer->setStyle(document().ensureStyleResolver().styleForText(thi s)); 405 renderer->setStyle(document().ensureStyleResolver().styleForText(thi s));
406 if (needsStyleRecalc()) 406 if (needsStyleRecalc())
407 renderer->setText(dataImpl()); 407 renderer->setText(dataImpl());
408 clearNeedsStyleRecalc(); 408 clearNeedsStyleRecalc();
409 } else if (needsStyleRecalc() || needsWhitespaceRenderer()) { 409 } else if (needsStyleRecalc() || needsWhitespaceRenderer()) {
410 reattach(); 410 reattach();
411 if (this->renderer()) 411 if (this->renderer())
412 reattachWhitespaceSiblingsIfNeeded(nextTextSibling); 412 reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
413 } 413 }
414 } 414 }
415 415
416 // If a whitespace node had no renderer and goes through a recalcStyle it may 416 // If a whitespace node had no renderer and goes through a recalcStyle it may
417 // need to create one if the parent style now has white-space: pre. 417 // need to create one if the parent style now has white-space: pre.
418 bool Text::needsWhitespaceRenderer() 418 bool Text::needsWhitespaceRenderer()
419 { 419 {
420 ASSERT(!renderer()); 420 ASSERT(!renderer());
421 if (LayoutStyle* style = parentLayoutStyle()) 421 if (LayoutStyle* style = parentLayoutStyle())
422 return style->preserveNewline(); 422 return style->preserveNewline();
423 return false; 423 return false;
424 } 424 }
425 425
426 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe placedData, RecalcStyleBehavior recalcStyleBehavior) 426 void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe placedData, RecalcStyleBehavior recalcStyleBehavior)
427 { 427 {
428 if (!inActiveDocument()) 428 if (!inActiveDocument())
429 return; 429 return;
430 RenderText* textRenderer = renderer(); 430 LayoutText* textRenderer = renderer();
431 if (!textRenderer || !textRendererIsNeeded(*textRenderer->style(), *textRend erer->parent())) { 431 if (!textRenderer || !textRendererIsNeeded(*textRenderer->style(), *textRend erer->parent())) {
432 lazyReattachIfAttached(); 432 lazyReattachIfAttached();
433 // FIXME: Editing should be updated so this is not neccesary. 433 // FIXME: Editing should be updated so this is not neccesary.
434 if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing) 434 if (recalcStyleBehavior == DeprecatedRecalcStyleImmediatlelyForEditing)
435 document().updateRenderTreeIfNeeded(); 435 document().updateRenderTreeIfNeeded();
436 return; 436 return;
437 } 437 }
438 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe placedData); 438 textRenderer->setTextWithOffset(dataImpl(), offsetOfReplacedData, lengthOfRe placedData);
439 } 439 }
440 440
(...skipping 24 matching lines...) Expand all
465 result.appendLiteral("; "); 465 result.appendLiteral("; ");
466 result.appendLiteral("value="); 466 result.appendLiteral("value=");
467 result.append(s); 467 result.append(s);
468 } 468 }
469 469
470 strncpy(buffer, result.toString().utf8().data(), length - 1); 470 strncpy(buffer, result.toString().utf8().data(), length - 1);
471 } 471 }
472 #endif 472 #endif
473 473
474 } // namespace blink 474 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Text.h ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698