static void testQuadValue(RefPtrWillBeRawPtr<CSSValue> value, double left, double right, double top, double bottom, CSSPrimitiveValue::UnitType unitType) { EXPECT_TRUE(value->isQuadValue()); RefPtrWillBeRawPtr<CSSQuadValue> rect = toCSSQuadValue(value.get()); EXPECT_EQ(rect->left()->getDoubleValue(), left); EXPECT_EQ(rect->right()->getDoubleValue(), right); EXPECT_EQ(rect->top()->getDoubleValue(), top); EXPECT_EQ(rect->bottom()->getDoubleValue(), bottom); EXPECT_EQ(unitType, rect->left()->typeWithCalcResolved()); EXPECT_EQ(unitType, rect->right()->typeWithCalcResolved()); EXPECT_EQ(unitType, rect->top()->typeWithCalcResolved()); EXPECT_EQ(unitType, rect->bottom()->typeWithCalcResolved()); }
void VTTRegion::displayLastVTTCueBox() { WTF_LOG(Media, "VTTRegion::displayLastVTTCueBox"); ASSERT(m_cueContainer); // FIXME: This should not be causing recalc styles in a loop to set the "top" css // property to move elements. We should just scroll the text track cues on the // compositor with an animation. if (m_scrollTimer.isActive()) return; // If it's a scrolling region, add the scrolling class. if (isScrollingRegion()) m_cueContainer->classList().add(textTrackCueContainerScrollingClass(), ASSERT_NO_EXCEPTION); float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom(); // Find first cue that is not entirely displayed and scroll it upwards. for (Element* child = ElementTraversal::firstChild(*m_cueContainer); child && !m_scrollTimer.isActive(); child = ElementTraversal::nextSibling(*child)) { RefPtrWillBeRawPtr<ClientRect> clientRect = child->getBoundingClientRect(); float childTop = clientRect->top(); float childBottom = clientRect->bottom(); if (regionBottom >= childBottom) continue; float height = childBottom - childTop; m_currentTop -= std::min(height, childBottom - regionBottom); m_cueContainer->setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrimitiveValue::CSS_PX); startTimer(); } }