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

Unified Diff: Source/core/html/track/vtt/VTTRegion.cpp

Issue 171953002: Get rid of inefficient uses of childNodeCount() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use lastChild() Created 6 years, 10 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/markup.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/vtt/VTTRegion.cpp
diff --git a/Source/core/html/track/vtt/VTTRegion.cpp b/Source/core/html/track/vtt/VTTRegion.cpp
index dd7613ecad3d3ac1e5287e3db4aca9773aa86508..07adcabd4d3a838651bc24325679e6ce7eff2f54 100644
--- a/Source/core/html/track/vtt/VTTRegion.cpp
+++ b/Source/core/html/track/vtt/VTTRegion.cpp
@@ -375,9 +375,9 @@ void VTTRegion::displayLastVTTCueBox()
float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
// Find first cue that is not entirely displayed and scroll it upwards.
- for (size_t i = 0; i < m_cueContainer->childNodeCount() && !m_scrollTimer.isActive(); ++i) {
- float childTop = toHTMLDivElement(m_cueContainer->childNode(i))->getBoundingClientRect()->top();
- float childBottom = toHTMLDivElement(m_cueContainer->childNode(i))->getBoundingClientRect()->bottom();
+ for (Element* child = ElementTraversal::firstWithin(*m_cueContainer); child && !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) {
+ float childTop = toHTMLDivElement(child)->getBoundingClientRect()->top();
+ float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bottom();
if (regionBottom >= childBottom)
continue;
« no previous file with comments | « Source/core/editing/markup.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698