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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/RenderTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Text.cpp
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 2426009c6edb92702b679096b4140bc7abb6aa20..63211b8c42749958bac027082893064c5baa02d7 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -239,6 +239,9 @@ PassRefPtrWillBeRawPtr<Node> Text::cloneNode(bool /*deep*/)
bool Text::textRendererIsNeeded(const RenderStyle& style, const RenderObject& parent)
{
+ if (!parent.canHaveChildren())
+ return false;
+
if (isEditingText())
return true;
@@ -304,7 +307,12 @@ RenderText* Text::createTextRenderer(RenderStyle* style)
void Text::attach(const AttachContext& context)
{
- RenderTreeBuilder(this, context.resolvedStyle).createRendererForTextIfNeeded();
+ if (ContainerNode* renderingParent = NodeRenderingTraversal::parent(this)) {
+ if (RenderObject* parentRenderer = renderingParent->renderer()) {
+ if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer))
+ RenderTreeBuilderForText(this, parentRenderer).createRenderer();
+ }
+ }
CharacterData::attach(context);
}
« 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