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

Side by Side Diff: Source/core/html/track/vtt/VTTRegion.cpp

Issue 412033004: Use Traversal<>::firstChild() instead of firstWithin() when iterating over children (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 if (m_scrollTimer.isActive()) 366 if (m_scrollTimer.isActive())
367 return; 367 return;
368 368
369 // If it's a scrolling region, add the scrolling class. 369 // If it's a scrolling region, add the scrolling class.
370 if (isScrollingRegion()) 370 if (isScrollingRegion())
371 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), A SSERT_NO_EXCEPTION); 371 m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), A SSERT_NO_EXCEPTION);
372 372
373 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); 373 float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
374 374
375 // Find first cue that is not entirely displayed and scroll it upwards. 375 // Find first cue that is not entirely displayed and scroll it upwards.
376 for (Element* child = ElementTraversal::firstWithin(*m_cueContainer); child && !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) { 376 for (Element* child = ElementTraversal::firstChild(*m_cueContainer); child & & !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) {
377 float childTop = toHTMLDivElement(child)->getBoundingClientRect()->top() ; 377 float childTop = toHTMLDivElement(child)->getBoundingClientRect()->top() ;
378 float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bo ttom(); 378 float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bo ttom();
379 379
380 if (regionBottom >= childBottom) 380 if (regionBottom >= childBottom)
381 continue; 381 continue;
382 382
383 float height = childBottom - childTop; 383 float height = childBottom - childTop;
384 384
385 m_currentTop -= std::min(height, childBottom - regionBottom); 385 m_currentTop -= std::min(height, childBottom - regionBottom);
386 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS PrimitiveValue::CSS_PX); 386 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS PrimitiveValue::CSS_PX);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 470 }
471 471
472 void VTTRegion::trace(Visitor* visitor) 472 void VTTRegion::trace(Visitor* visitor)
473 { 473 {
474 visitor->trace(m_cueContainer); 474 visitor->trace(m_cueContainer);
475 visitor->trace(m_regionDisplayTree); 475 visitor->trace(m_regionDisplayTree);
476 visitor->trace(m_track); 476 visitor->trace(m_track);
477 } 477 }
478 478
479 } // namespace blink 479 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTableRowElement.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698