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

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

Issue 420193007: Use new Traversal<> API more in the code base (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::firstChild(*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 RefPtrWillBeRawPtr<ClientRect> clientRect = child->getBoundingClientRect ();
378 float childBottom = toHTMLDivElement(child)->getBoundingClientRect()->bo ttom(); 378 float childTop = clientRect->top();
379 float childBottom = clientRect->bottom();
379 380
380 if (regionBottom >= childBottom) 381 if (regionBottom >= childBottom)
381 continue; 382 continue;
382 383
383 float height = childBottom - childTop; 384 float height = childBottom - childTop;
384 385
385 m_currentTop -= std::min(height, childBottom - regionBottom); 386 m_currentTop -= std::min(height, childBottom - regionBottom);
386 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS PrimitiveValue::CSS_PX); 387 m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSS PrimitiveValue::CSS_PX);
387 388
388 startTimer(); 389 startTimer();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 471 }
471 472
472 void VTTRegion::trace(Visitor* visitor) 473 void VTTRegion::trace(Visitor* visitor)
473 { 474 {
474 visitor->trace(m_cueContainer); 475 visitor->trace(m_cueContainer);
475 visitor->trace(m_regionDisplayTree); 476 visitor->trace(m_regionDisplayTree);
476 visitor->trace(m_track); 477 visitor->trace(m_track);
477 } 478 }
478 479
479 } // namespace blink 480 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLLabelElement.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698