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

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

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add is*Element(PassRefPtr) helper Created 6 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 | Annotate | Revision Log
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 18 matching lines...) Expand all
29 #include "core/dom/ExceptionCode.h" 29 #include "core/dom/ExceptionCode.h"
30 #include "core/dom/NodeRenderStyle.h" 30 #include "core/dom/NodeRenderStyle.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/rendering/RenderCombineText.h" 36 #include "core/rendering/RenderCombineText.h"
37 #include "core/rendering/RenderText.h" 37 #include "core/rendering/RenderText.h"
38 #include "core/rendering/svg/RenderSVGInlineText.h" 38 #include "core/rendering/svg/RenderSVGInlineText.h"
39 #include "core/svg/SVGForeignObjectElement.h"
39 #include "wtf/text/CString.h" 40 #include "wtf/text/CString.h"
40 #include "wtf/text/StringBuilder.h" 41 #include "wtf/text/StringBuilder.h"
41 42
42 using namespace std; 43 using namespace std;
43 44
44 namespace WebCore { 45 namespace WebCore {
45 46
46 PassRefPtr<Text> Text::create(Document& document, const String& data) 47 PassRefPtr<Text> Text::create(Document& document, const String& data)
47 { 48 {
48 return adoptRef(new Text(document, data, CreateText)); 49 return adoptRef(new Text(document, data, CreateText));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Whitespace at the start of a block just goes away. Don't even 284 // Whitespace at the start of a block just goes away. Don't even
284 // make a render object for this text. 285 // make a render object for this text.
285 return false; 286 return false;
286 } 287 }
287 return true; 288 return true;
288 } 289 }
289 290
290 static bool isSVGText(Text* text) 291 static bool isSVGText(Text* text)
291 { 292 {
292 Node* parentOrShadowHostNode = text->parentOrShadowHostNode(); 293 Node* parentOrShadowHostNode = text->parentOrShadowHostNode();
293 return parentOrShadowHostNode->isSVGElement() && !parentOrShadowHostNode->ha sTagName(SVGNames::foreignObjectTag); 294 ASSERT(parentOrShadowHostNode);
295 return parentOrShadowHostNode->isSVGElement() && !isSVGForeignObjectElement( *parentOrShadowHostNode);
294 } 296 }
295 297
296 RenderText* Text::createTextRenderer(RenderStyle* style) 298 RenderText* Text::createTextRenderer(RenderStyle* style)
297 { 299 {
298 if (isSVGText(this)) 300 if (isSVGText(this))
299 return new RenderSVGInlineText(this, dataImpl()); 301 return new RenderSVGInlineText(this, dataImpl());
300 302
301 if (style->hasTextCombine()) 303 if (style->hasTextCombine())
302 return new RenderCombineText(this, dataImpl()); 304 return new RenderCombineText(this, dataImpl());
303 305
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 result.appendLiteral("; "); 370 result.appendLiteral("; ");
369 result.appendLiteral("value="); 371 result.appendLiteral("value=");
370 result.append(s); 372 result.append(s);
371 } 373 }
372 374
373 strncpy(buffer, result.toString().utf8().data(), length - 1); 375 strncpy(buffer, result.toString().utf8().data(), length - 1);
374 } 376 }
375 #endif 377 #endif
376 378
377 } // namespace WebCore 379 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698