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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 406843002: Optimize hasTagName when called on an HTMLElement / SVGElement (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.h ('k') | Source/core/editing/InsertListCommand.h » ('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) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 { 58 {
59 DEFINE_STATIC_LOCAL(String, styleSpanClassString, ((AppleStyleSpanClass))); 59 DEFINE_STATIC_LOCAL(String, styleSpanClassString, ((AppleStyleSpanClass)));
60 return styleSpanClassString; 60 return styleSpanClassString;
61 } 61 }
62 62
63 bool isLegacyAppleStyleSpan(const Node *node) 63 bool isLegacyAppleStyleSpan(const Node *node)
64 { 64 {
65 if (!node || !node->isHTMLElement()) 65 if (!node || !node->isHTMLElement())
66 return false; 66 return false;
67 67
68 const HTMLElement* elem = toHTMLElement(node); 68 const HTMLElement& element = toHTMLElement(*node);
69 if (!elem->hasLocalName(spanAttr) || elem->getAttribute(classAttr) != styleS panClassString()) 69 if (!isHTMLSpanElement(element) || element.getAttribute(classAttr) != styleS panClassString())
70 return false; 70 return false;
71 UseCounter::count(elem->document(), UseCounter::EditingAppleStyleSpanClass); 71 UseCounter::count(element.document(), UseCounter::EditingAppleStyleSpanClass );
72 return true; 72 return true;
73 } 73 }
74 74
75 static bool hasNoAttributeOrOnlyStyleAttribute(const Element* element, ShouldSty leAttributeBeEmpty shouldStyleAttributeBeEmpty) 75 static bool hasNoAttributeOrOnlyStyleAttribute(const Element* element, ShouldSty leAttributeBeEmpty shouldStyleAttributeBeEmpty)
76 { 76 {
77 if (!element->hasAttributes()) 77 if (!element->hasAttributes())
78 return true; 78 return true;
79 79
80 unsigned matchedAttributes = 0; 80 unsigned matchedAttributes = 0;
81 if (element->getAttribute(classAttr) == styleSpanClassString()) 81 if (element->getAttribute(classAttr) == styleSpanClassString())
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 void ApplyStyleCommand::trace(Visitor* visitor) 1572 void ApplyStyleCommand::trace(Visitor* visitor)
1573 { 1573 {
1574 visitor->trace(m_style); 1574 visitor->trace(m_style);
1575 visitor->trace(m_start); 1575 visitor->trace(m_start);
1576 visitor->trace(m_end); 1576 visitor->trace(m_end);
1577 visitor->trace(m_styledInlineElement); 1577 visitor->trace(m_styledInlineElement);
1578 CompositeEditCommand::trace(visitor); 1578 CompositeEditCommand::trace(visitor);
1579 } 1579 }
1580 1580
1581 } 1581 }
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/editing/InsertListCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698