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

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

Issue 327323005: Introduce use counters for Blink specific CSS classes for editing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-16T12:34:11 Created 6 years, 6 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 | « no previous file | Source/core/editing/ReplaceSelectionCommand.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) 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 25 matching lines...) Expand all
36 #include "core/dom/NodeList.h" 36 #include "core/dom/NodeList.h"
37 #include "core/dom/NodeTraversal.h" 37 #include "core/dom/NodeTraversal.h"
38 #include "core/dom/Range.h" 38 #include "core/dom/Range.h"
39 #include "core/dom/Text.h" 39 #include "core/dom/Text.h"
40 #include "core/editing/EditingStyle.h" 40 #include "core/editing/EditingStyle.h"
41 #include "core/editing/HTMLInterchange.h" 41 #include "core/editing/HTMLInterchange.h"
42 #include "core/editing/PlainTextRange.h" 42 #include "core/editing/PlainTextRange.h"
43 #include "core/editing/TextIterator.h" 43 #include "core/editing/TextIterator.h"
44 #include "core/editing/VisibleUnits.h" 44 #include "core/editing/VisibleUnits.h"
45 #include "core/editing/htmlediting.h" 45 #include "core/editing/htmlediting.h"
46 #include "core/frame/UseCounter.h"
46 #include "core/rendering/RenderObject.h" 47 #include "core/rendering/RenderObject.h"
47 #include "core/rendering/RenderText.h" 48 #include "core/rendering/RenderText.h"
48 #include "platform/heap/Handle.h" 49 #include "platform/heap/Handle.h"
49 #include "wtf/StdLibExtras.h" 50 #include "wtf/StdLibExtras.h"
50 #include "wtf/text/StringBuilder.h" 51 #include "wtf/text/StringBuilder.h"
51 52
52 namespace WebCore { 53 namespace WebCore {
53 54
54 using namespace HTMLNames; 55 using namespace HTMLNames;
55 56
56 static String& styleSpanClassString() 57 static String& styleSpanClassString()
57 { 58 {
58 DEFINE_STATIC_LOCAL(String, styleSpanClassString, ((AppleStyleSpanClass))); 59 DEFINE_STATIC_LOCAL(String, styleSpanClassString, ((AppleStyleSpanClass)));
59 return styleSpanClassString; 60 return styleSpanClassString;
60 } 61 }
61 62
62 bool isLegacyAppleStyleSpan(const Node *node) 63 bool isLegacyAppleStyleSpan(const Node *node)
63 { 64 {
64 if (!node || !node->isHTMLElement()) 65 if (!node || !node->isHTMLElement())
65 return false; 66 return false;
66 67
67 const HTMLElement* elem = toHTMLElement(node); 68 const HTMLElement* elem = toHTMLElement(node);
68 return elem->hasLocalName(spanAttr) && elem->getAttribute(classAttr) == styl eSpanClassString(); 69 if (!elem->hasLocalName(spanAttr) || elem->getAttribute(classAttr) != styleS panClassString())
70 return false;
71 UseCounter::count(elem->document(), UseCounter::EditingAppleStyleSpanClass);
72 return true;
69 } 73 }
70 74
71 static bool hasNoAttributeOrOnlyStyleAttribute(const Element* element, ShouldSty leAttributeBeEmpty shouldStyleAttributeBeEmpty) 75 static bool hasNoAttributeOrOnlyStyleAttribute(const Element* element, ShouldSty leAttributeBeEmpty shouldStyleAttributeBeEmpty)
72 { 76 {
73 if (!element->hasAttributes()) 77 if (!element->hasAttributes())
74 return true; 78 return true;
75 79
76 unsigned matchedAttributes = 0; 80 unsigned matchedAttributes = 0;
77 if (element->getAttribute(classAttr) == styleSpanClassString()) 81 if (element->getAttribute(classAttr) == styleSpanClassString())
78 matchedAttributes++; 82 matchedAttributes++;
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 void ApplyStyleCommand::trace(Visitor* visitor) 1571 void ApplyStyleCommand::trace(Visitor* visitor)
1568 { 1572 {
1569 visitor->trace(m_style); 1573 visitor->trace(m_style);
1570 visitor->trace(m_start); 1574 visitor->trace(m_start);
1571 visitor->trace(m_end); 1575 visitor->trace(m_end);
1572 visitor->trace(m_styledInlineElement); 1576 visitor->trace(m_styledInlineElement);
1573 CompositeEditCommand::trace(visitor); 1577 CompositeEditCommand::trace(visitor);
1574 } 1578 }
1575 1579
1576 } 1580 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698