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

Unified Diff: Source/core/editing/iterators/TextIterator.cpp

Issue 1213213004: Introduce use counters for shadow DOM handling in plainText() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-07-03T14:40:27 Rebase Created 5 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/iterators/TextIterator.h ('k') | Source/core/editing/iterators/TextIteratorFlags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/iterators/TextIterator.cpp
diff --git a/Source/core/editing/iterators/TextIterator.cpp b/Source/core/editing/iterators/TextIterator.cpp
index 712b154bb315954e4f15eab2f8ae8e3bb0c42f27..a93c52aac90d69f872a07648f693ab6bfabf3f52 100644
--- a/Source/core/editing/iterators/TextIterator.cpp
+++ b/Source/core/editing/iterators/TextIterator.cpp
@@ -39,6 +39,7 @@
#include "core/editing/iterators/CharacterIterator.h"
#include "core/editing/iterators/WordAwareIterator.h"
#include "core/frame/FrameView.h"
+#include "core/frame/UseCounter.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLInputElement.h"
@@ -133,6 +134,7 @@ TextIteratorAlgorithm<Strategy>::TextIteratorAlgorithm(const typename Strategy::
, m_behavior(adjustBehaviorFlags<Strategy>(behavior))
, m_handledFirstLetter(false)
, m_shouldStop(false)
+ , m_handleShadowRoot(false)
// The call to emitsOriginalText() must occur after m_behavior is initialized.
, m_textState(emitsOriginalText())
{
@@ -188,6 +190,17 @@ void TextIteratorAlgorithm<Strategy>::initialize(Node* startContainer, int start
template<typename Strategy>
TextIteratorAlgorithm<Strategy>::~TextIteratorAlgorithm()
{
+ if (!m_handleShadowRoot)
+ return;
+ Document* document = ownerDocument();
+ if (!document)
+ return;
+ if (m_behavior & TextIteratorForInnerText)
+ UseCounter::count(document, UseCounter::InnerTextWithShadowTree);
+ if (m_behavior & TextIteratorForSelectionToString)
+ UseCounter::count(document, UseCounter::SelectionToStringWithShadowTree);
+ if (m_behavior & TextIteratorForWindowFind)
+ UseCounter::count(document, UseCounter::WindowFindWithShadowTree);
}
template<typename Strategy>
@@ -257,6 +270,7 @@ void TextIteratorAlgorithm<Strategy>::advance()
if (m_node->isShadowRoot()) {
// A shadow root doesn't have a layoutObject, but we want to visit children anyway.
m_iterationProgress = m_iterationProgress < HandledNode ? HandledNode : m_iterationProgress;
+ m_handleShadowRoot = true;
} else {
m_iterationProgress = HandledChildren;
}
« no previous file with comments | « Source/core/editing/iterators/TextIterator.h ('k') | Source/core/editing/iterators/TextIteratorFlags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698