void LinkHighlight::startHighlightAnimationIfNeeded() { if (m_isAnimating) return; m_isAnimating = true; const float startOpacity = 1; // FIXME: Should duration be configurable? const float fadeDuration = 0.1f; const float minPreFadeDuration = 0.1f; m_contentLayer->layer()->setOpacity(startOpacity); WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFloatAnimationCurve()); curve->add(WebFloatKeyframe(0, startOpacity)); // Make sure we have displayed for at least minPreFadeDuration before starting to fade out. float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast<float>(monotonicallyIncreasingTime() - m_startTime)); if (extraDurationRequired) curve->add(WebFloatKeyframe(extraDurationRequired, startOpacity)); // For layout tests we don't fade out. curve->add(WebFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0)); OwnPtr<WebCompositorAnimation> animation = adoptPtr(compositorSupport->createAnimation(*curve, WebCompositorAnimation::TargetPropertyOpacity)); m_contentLayer->layer()->setDrawsContent(true); m_contentLayer->layer()->addAnimation(animation.leakPtr()); invalidate(); m_owningWebViewImpl->scheduleAnimation(); }
bool EditorClientImpl::shouldShowDeleteInterface(HTMLElement* elem) { // Normally, we don't care to show WebCore's deletion UI, so we only enable // it if in testing mode and the test specifically requests it by using this // magic class name. return layoutTestMode() && elem->getAttribute(HTMLNames::classAttr) == "needsDeletionUI"; }
bool ChromeClientImpl::canTakeFocus(FocusType) { // For now the browser can always take focus if we're not running layout // tests. return !layoutTestMode(); }
void LinkHighlightImpl::startHighlightAnimationIfNeeded() { if (m_isAnimating) return; m_isAnimating = true; const float startOpacity = 1; // FIXME: Should duration be configurable? const float fadeDuration = 0.1f; const float minPreFadeDuration = 0.1f; m_contentLayer->layer()->setOpacity(startOpacity); std::unique_ptr<CompositorFloatAnimationCurve> curve = CompositorFloatAnimationCurve::create(); const auto easeType = CubicBezierTimingFunction::EaseType::EASE; curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0, startOpacity), easeType); // Make sure we have displayed for at least minPreFadeDuration before starting to fade out. float extraDurationRequired = std::max(0.f, minPreFadeDuration - static_cast<float>(monotonicallyIncreasingTime() - m_startTime)); if (extraDurationRequired) curve->addCubicBezierKeyframe(CompositorFloatKeyframe(extraDurationRequired, startOpacity), easeType); // For layout tests we don't fade out. curve->addCubicBezierKeyframe(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0), easeType); std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create(*curve, CompositorTargetProperty::OPACITY, 0, 0); m_contentLayer->layer()->setDrawsContent(true); m_compositorPlayer->addAnimation(animation.release()); invalidate(); m_owningWebViewImpl->scheduleAnimation(); }