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

Unified Diff: Source/core/editing/ReplaceSelectionCommand.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/ReplaceSelectionCommand.cpp
diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp
index 9d21f3f459243a723e2604fbeea8f4b0deb78dfa..aea9badf720e3ab725b6b7018b5983ca5232101e 100644
--- a/Source/core/editing/ReplaceSelectionCommand.cpp
+++ b/Source/core/editing/ReplaceSelectionCommand.cpp
@@ -48,6 +48,7 @@
#include "core/editing/markup.h"
#include "core/events/BeforeTextInsertedEvent.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/UseCounter.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/rendering/RenderObject.h"
@@ -97,13 +98,19 @@ private:
static bool isInterchangeNewlineNode(const Node *node)
{
DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchangeNewline));
- return isHTMLBRElement(node) && toElement(node)->getAttribute(classAttr) == interchangeNewlineClassString;
+ if (!isHTMLBRElement(node) || toElement(node)->getAttribute(classAttr) != interchangeNewlineClassString)
+ return false;
+ UseCounter::count(node->document(), UseCounter::EditingAppleInterchangeNewline);
+ return true;
}
static bool isInterchangeConvertedSpaceSpan(const Node *node)
{
DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSpace));
- return node->isHTMLElement() && toHTMLElement(node)->getAttribute(classAttr) == convertedSpaceSpanClassString;
+ if (!node->isHTMLElement() || toHTMLElement(node)->getAttribute(classAttr) != convertedSpaceSpanClassString)
+ return false;
+ UseCounter::count(node->document(), UseCounter::EditingAppleConvertedSpace);
+ return true;
}
static Position positionAvoidingPrecedingNodes(Position pos)
@@ -418,7 +425,10 @@ bool ReplaceSelectionCommand::shouldMergeEnd(bool selectionEndWasEndOfParagraph)
static bool isMailPasteAsQuotationNode(const Node* node)
{
- return node && node->hasTagName(blockquoteTag) && toElement(node)->getAttribute(classAttr) == ApplePasteAsQuotation;
+ if (!node || !node->hasTagName(blockquoteTag) || toElement(node)->getAttribute(classAttr) != ApplePasteAsQuotation)
+ return false;
+ UseCounter::count(node->document(), UseCounter::EditingApplePasteAsQuotation);
+ return true;
}
static bool isHeaderElement(const Node* a)
@@ -866,10 +876,18 @@ static bool isInlineNodeWithStyle(const Node* node)
// one of our internal classes.
const HTMLElement* element = toHTMLElement(node);
const AtomicString& classAttributeValue = element->getAttribute(classAttr);
- if (classAttributeValue == AppleTabSpanClass
- || classAttributeValue == AppleConvertedSpace
- || classAttributeValue == ApplePasteAsQuotation)
+ if (classAttributeValue == AppleTabSpanClass) {
+ UseCounter::count(node->document(), UseCounter::EditingAppleTabSpanClass);
return true;
+ }
+ if (classAttributeValue == AppleConvertedSpace) {
+ UseCounter::count(node->document(), UseCounter::EditingAppleConvertedSpace);
+ return true;
+ }
+ if (classAttributeValue == ApplePasteAsQuotation) {
+ UseCounter::count(node->document(), UseCounter::EditingApplePasteAsQuotation);
+ return true;
+ }
return EditingStyle::elementIsStyledSpanOrHTMLEquivalent(element);
}
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698