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

Side by Side Diff: Source/core/rendering/RenderTreeAsText.cpp

Issue 415243003: Drop slower Node::hasID() / Node::hasClass() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
« no previous file with comments | « Source/core/dom/Node.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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 break; 341 break;
342 default: 342 default:
343 text = quoteAndEscapeNonPrintables(text); 343 text = quoteAndEscapeNonPrintables(text);
344 } 344 }
345 } 345 }
346 ts << ": " << text; 346 ts << ": " << text;
347 } 347 }
348 } 348 }
349 349
350 if (behavior & RenderAsTextShowIDAndClass) { 350 if (behavior & RenderAsTextShowIDAndClass) {
351 if (Node* node = o.node()) { 351 Node* node = o.node();
352 if (node->hasID()) 352 if (node && node->isElementNode()) {
353 ts << " id=\"" + toElement(node)->getIdAttribute() + "\""; 353 Element& element = toElement(*node);
354 if (element.hasID())
355 ts << " id=\"" + element.getIdAttribute() + "\"";
354 356
355 if (node->hasClass()) { 357 if (element.hasClass()) {
356 ts << " class=\""; 358 ts << " class=\"";
357 Element* element = toElement(node); 359 for (size_t i = 0; i < element.classNames().size(); ++i) {
358 for (size_t i = 0; i < element->classNames().size(); ++i) {
359 if (i > 0) 360 if (i > 0)
360 ts << " "; 361 ts << " ";
361 ts << element->classNames()[i]; 362 ts << element.classNames()[i];
362 } 363 }
363 ts << "\""; 364 ts << "\"";
364 } 365 }
365 } 366 }
366 } 367 }
367 368
368 if (behavior & RenderAsTextShowLayoutState) { 369 if (behavior & RenderAsTextShowLayoutState) {
369 bool needsLayout = o.selfNeedsLayout() || o.needsPositionedMovementLayou t() || o.posChildNeedsLayout() || o.normalChildNeedsLayout(); 370 bool needsLayout = o.selfNeedsLayout() || o.needsPositionedMovementLayou t() || o.posChildNeedsLayout() || o.normalChildNeedsLayout();
370 if (needsLayout) 371 if (needsLayout)
371 ts << " (needs layout:"; 372 ts << " (needs layout:";
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 element->document().updateLayout(); 771 element->document().updateLayout();
771 772
772 RenderObject* renderer = element->renderer(); 773 RenderObject* renderer = element->renderer();
773 if (!renderer || !renderer->isListItem()) 774 if (!renderer || !renderer->isListItem())
774 return String(); 775 return String();
775 776
776 return toRenderListItem(renderer)->markerText(); 777 return toRenderListItem(renderer)->markerText();
777 } 778 }
778 779
779 } // namespace blink 780 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698