TEST_F(LayoutProgressTest, AnimationScheduling) { RenderingTest::setBodyInnerHTML( "<progress id=\"progressElement\" value=0.3 max=1.0></progress>"); document().view()->updateAllLifecyclePhases(); Element* progressElement = document().getElementById(AtomicString("progressElement")); LayoutProgress* layoutProgress = toLayoutProgress(progressElement->layoutObject()); // Verify that we do not schedule a timer for a determinant progress element EXPECT_FALSE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); EXPECT_FALSE(LayoutProgressTest::isAnimatiing(layoutProgress)); progressElement->removeAttribute("value"); document().view()->updateAllLifecyclePhases(); // Verify that we schedule a timer for an indeterminant progress element EXPECT_TRUE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); EXPECT_TRUE(LayoutProgressTest::isAnimatiing(layoutProgress)); progressElement->setAttribute(HTMLNames::valueAttr, "0.7"); document().view()->updateAllLifecyclePhases(); // Verify that we cancel the timer for a determinant progress element EXPECT_FALSE(LayoutProgressTest::isAnimationTimerActive(layoutProgress)); EXPECT_FALSE(LayoutProgressTest::isAnimatiing(layoutProgress)); }
bool ThemePainterDefault::paintProgressBar(const LayoutObject& o, const PaintInfo& i, const IntRect& rect) { if (!o.isProgress()) return true; const LayoutProgress& layoutProgress = toLayoutProgress(o); IntRect valueRect = progressValueRectFor(layoutProgress, rect); WebThemeEngine::ExtraParams extraParams; extraParams.progressBar.determinate = layoutProgress.isDeterminate(); extraParams.progressBar.valueRectX = valueRect.x(); extraParams.progressBar.valueRectY = valueRect.y(); extraParams.progressBar.valueRectWidth = valueRect.width(); extraParams.progressBar.valueRectHeight = valueRect.height(); DirectionFlippingScope scope(o, i, rect); WebCanvas* canvas = i.context.canvas(); Platform::current()->themeEngine()->paint( canvas, WebThemeEngine::PartProgressBar, getWebThemeState(o), WebRect(rect), &extraParams); return false; }