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

Side by Side Diff: Source/core/editing/htmlediting.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 | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/frame/UseCounter.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) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 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 26 matching lines...) Expand all
37 #include "core/dom/Text.h" 37 #include "core/dom/Text.h"
38 #include "core/dom/shadow/ShadowRoot.h" 38 #include "core/dom/shadow/ShadowRoot.h"
39 #include "core/editing/Editor.h" 39 #include "core/editing/Editor.h"
40 #include "core/editing/HTMLInterchange.h" 40 #include "core/editing/HTMLInterchange.h"
41 #include "core/editing/PlainTextRange.h" 41 #include "core/editing/PlainTextRange.h"
42 #include "core/editing/TextIterator.h" 42 #include "core/editing/TextIterator.h"
43 #include "core/editing/VisiblePosition.h" 43 #include "core/editing/VisiblePosition.h"
44 #include "core/editing/VisibleSelection.h" 44 #include "core/editing/VisibleSelection.h"
45 #include "core/editing/VisibleUnits.h" 45 #include "core/editing/VisibleUnits.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/UseCounter.h"
47 #include "core/html/HTMLBRElement.h" 48 #include "core/html/HTMLBRElement.h"
48 #include "core/html/HTMLDivElement.h" 49 #include "core/html/HTMLDivElement.h"
49 #include "core/html/HTMLLIElement.h" 50 #include "core/html/HTMLLIElement.h"
50 #include "core/html/HTMLOListElement.h" 51 #include "core/html/HTMLOListElement.h"
51 #include "core/html/HTMLParagraphElement.h" 52 #include "core/html/HTMLParagraphElement.h"
52 #include "core/html/HTMLTableCellElement.h" 53 #include "core/html/HTMLTableCellElement.h"
53 #include "core/html/HTMLUListElement.h" 54 #include "core/html/HTMLUListElement.h"
54 #include "core/rendering/RenderObject.h" 55 #include "core/rendering/RenderObject.h"
55 #include "core/rendering/RenderTableCell.h" 56 #include "core/rendering/RenderTableCell.h"
56 #include "wtf/Assertions.h" 57 #include "wtf/Assertions.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 return createHTMLElement(document, name.localName()); 818 return createHTMLElement(document, name.localName());
818 } 819 }
819 820
820 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(Document& document, const AtomicString& tagName) 821 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(Document& document, const AtomicString& tagName)
821 { 822 {
822 return HTMLElementFactory::createHTMLElement(tagName, document, 0, false); 823 return HTMLElementFactory::createHTMLElement(tagName, document, 0, false);
823 } 824 }
824 825
825 bool isTabSpanNode(const Node* node) 826 bool isTabSpanNode(const Node* node)
826 { 827 {
827 return isHTMLSpanElement(node) && toElement(node)->getAttribute(classAttr) = = AppleTabSpanClass; 828 if (!isHTMLSpanElement(node) || toElement(node)->getAttribute(classAttr) != AppleTabSpanClass)
829 return false;
830 UseCounter::count(node->document(), UseCounter::EditingAppleTabSpanClass);
831 return true;
828 } 832 }
829 833
830 bool isTabSpanTextNode(const Node* node) 834 bool isTabSpanTextNode(const Node* node)
831 { 835 {
832 return node && node->isTextNode() && node->parentNode() && isTabSpanNode(nod e->parentNode()); 836 return node && node->isTextNode() && node->parentNode() && isTabSpanNode(nod e->parentNode());
833 } 837 }
834 838
835 Node* tabSpanNode(const Node* node) 839 Node* tabSpanNode(const Node* node)
836 { 840 {
837 return isTabSpanTextNode(node) ? node->parentNode() : 0; 841 return isTabSpanTextNode(node) ? node->parentNode() : 0;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 // if the selection starts just before a paragraph break, skip over it 1117 // if the selection starts just before a paragraph break, skip over it
1114 if (isEndOfParagraph(visiblePosition)) 1118 if (isEndOfParagraph(visiblePosition))
1115 return visiblePosition.next().deepEquivalent().downstream(); 1119 return visiblePosition.next().deepEquivalent().downstream();
1116 1120
1117 // otherwise, make sure to be at the start of the first selected node, 1121 // otherwise, make sure to be at the start of the first selected node,
1118 // instead of possibly at the end of the last node before the selection 1122 // instead of possibly at the end of the last node before the selection
1119 return visiblePosition.deepEquivalent().downstream(); 1123 return visiblePosition.deepEquivalent().downstream();
1120 } 1124 }
1121 1125
1122 } // namespace WebCore 1126 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/ReplaceSelectionCommand.cpp ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698