bool KeyframeAnimation::startAnimation(double timeOffset) { if (m_object && m_object->isComposited()) { return toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes); } return false; }
void ImplicitAnimation::endAnimation() { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->isComposited()) toRenderBoxModelObject(m_object)->transitionFinished(m_animation.get()); // KxDx animationName #endif }
WebRenderObject::WebRenderObject(RenderObject* renderer) { m_name = renderer->renderName(); // FIXME: broken with transforms m_absolutePosition = flooredIntPoint(renderer->localToAbsolute(FloatPoint())); if (renderer->isBox()) m_frameRect = toRenderBox(renderer)->frameRect(); else if (renderer->isText()) { m_frameRect = toRenderText(renderer)->linesBoundingBox(); m_frameRect.setX(toRenderText(renderer)->firstRunX()); m_frameRect.setY(toRenderText(renderer)->firstRunY()); } else if (renderer->isRenderInline()) m_frameRect = toRenderBoxModelObject(renderer)->borderBoundingBox(); m_children = MutableArray::create(); for (RenderObject* coreChild = renderer->firstChild(); coreChild; coreChild = coreChild->nextSibling()) { RefPtr<WebRenderObject> child = adoptRef(new WebRenderObject(coreChild)); m_children->append(child.get()); } if (!renderer->isWidget()) return; Widget* widget = toRenderWidget(renderer)->widget(); if (!widget || !widget->isFrameView()) return; FrameView* frameView = static_cast<FrameView*>(widget); if (RenderView* coreContentRenderer = frameView->frame()->contentRenderer()) { RefPtr<WebRenderObject> contentRenderer = adoptRef(new WebRenderObject(coreContentRenderer)); m_children->append(contentRenderer.get()); } }
LayoutState::LayoutState(RenderObject* root) : m_clipped(false) , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) , m_next(0) #ifndef NDEBUG , m_renderer(root) #endif { RenderObject* container = root->container(); // [SonyEricsson]: Check if container is null and in that case create an empty size // to avoid a crash dereferencing a null pointer. if (container) { FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true); m_paintOffset = IntSize(absContentPoint.x(), absContentPoint.y()); } else { m_paintOffset = IntSize(); } if (container->hasOverflowClip()) { RenderLayer* layer = toRenderBoxModelObject(container)->layer(); m_clipped = true; m_clipRect = IntRect(toPoint(m_paintOffset), layer->size()); m_paintOffset -= layer->scrolledContentOffset(); } }
bool ImplicitAnimation::startAnimation(double timeOffset) { if (m_object && m_object->isComposited()) return toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get()); return false; }
bool CompositorAnimations::startAnimationOnCompositor(const Element& element, const Timing& timing, const AnimationEffect& effect, Vector<int>& startedAnimationIds) { ASSERT(startedAnimationIds.isEmpty()); ASSERT(isCandidateForAnimationOnCompositor(timing, effect)); ASSERT(canStartAnimationOnCompositor(element)); const KeyframeEffectModel& keyframeEffect = *toKeyframeEffectModel(&effect); RenderLayer* layer = toRenderBoxModelObject(element.renderer())->layer(); ASSERT(layer); Vector<OwnPtr<blink::WebAnimation> > animations; CompositorAnimationsImpl::getAnimationOnCompositor(timing, keyframeEffect, animations); ASSERT(!animations.isEmpty()); for (size_t i = 0; i < animations.size(); ++i) { int id = animations[i]->id(); if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(animations[i].release())) { // FIXME: We should know ahead of time whether these animations can be started. for (size_t j = 0; j < startedAnimationIds.size(); ++j) cancelAnimationOnCompositor(element, startedAnimationIds[j]); startedAnimationIds.clear(); return false; } startedAnimationIds.append(id); } ASSERT(!startedAnimationIds.isEmpty()); return true; }
void ImplicitAnimation::endAnimation() { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->isComposited()) toRenderBoxModelObject(m_object)->transitionFinished(m_animatingProperty); #endif }
void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, int id) { if (!canStartAnimationOnCompositor(element)) { ASSERT_NOT_REACHED(); return; } toRenderBoxModelObject(element.renderer())->layer()->compositedLayerMapping()->mainGraphicsLayer()->removeAnimation(id); }
static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object) { while (object && !object->isBoxModelObject()) object = object->parent(); if (!object) return 0; return toRenderBoxModelObject(object); }
RenderBoxModelObject* RenderMathMLRoot::index() const { if (!firstChild()) return 0; RenderObject* index = firstChild()->nextSibling(); if (!index || !index->isBoxModelObject()) return 0; return toRenderBoxModelObject(index); }
bool ImplicitAnimation::startAnimation(double timeOffset) { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->isComposited()) return toRenderBoxModelObject(m_object)->startTransition(timeOffset, m_animatingProperty, m_fromStyle.get(), m_toStyle.get()); #else UNUSED_PARAM(timeOffset); #endif return false; }
void ImplicitAnimation::endAnimation() { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->hasLayer()) { RenderLayer* layer = toRenderBoxModelObject(m_object)->layer(); if (layer->isComposited()) layer->backing()->transitionFinished(m_animatingProperty); } #endif }
bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeRepaint shouldRepaint) { bool layerChanged = false; if (needsToBeComposited(layer)) { enableCompositingMode(); // 3D transforms turn off the testing of overlap. if (requiresCompositingForTransform(layer->renderer())) setCompositingConsultsOverlap(false); if (!layer->backing()) { // If we need to repaint, do so before making backing if (shouldRepaint == CompositingChangeRepaintNow) repaintOnCompositingChange(layer); layer->ensureBacking(); layerChanged = true; } } else { if (layer->backing()) { // If we're removing backing on a reflection, clear the source GraphicsLayer's pointer to // its replica GraphicsLayer. In practice this should never happen because reflectee and reflection // are both either composited, or not composited. if (layer->isReflection()) { RenderLayer* sourceLayer = toRenderBoxModelObject(layer->renderer()->parent())->layer(); if (RenderLayerBacking* backing = sourceLayer->backing()) { ASSERT(backing->graphicsLayer()->replicaLayer() == layer->backing()->graphicsLayer()); backing->graphicsLayer()->setReplicatedByLayer(0); } } layer->clearBacking(); layerChanged = true; // The layer's cached repaints rects are relative to the repaint container, so change when // compositing changes; we need to update them here. layer->computeRepaintRects(); // If we need to repaint, do so now that we've removed the backing if (shouldRepaint == CompositingChangeRepaintNow) repaintOnCompositingChange(layer); } } #if ENABLE(VIDEO) if (layerChanged && layer->renderer()->isVideo()) { // If it's a video, give the media player a chance to hook up to the layer. RenderVideo* video = toRenderVideo(layer->renderer()); video->acceleratedRenderingStateChanged(); } #endif return layerChanged; }
bool KeyframeAnimation::startAnimation(double timeOffset) { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->isComposited()) { return toRenderBoxModelObject(m_object)->startAnimation(timeOffset, m_animation.get(), m_keyframes); } #else UNUSED_PARAM(timeOffset); #endif return false; }
void ImplicitAnimation::pauseAnimation(double timeOffset) { if (!m_object) return; if (m_object->isComposited()) toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty); // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->element()); }
void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& element, int id, double pauseTime) { // FIXME: canStartAnimationOnCompositor queries compositingState, which is not necessarily up to date. DisableCompositingQueryAsserts disabler; if (!canStartAnimationOnCompositor(element)) { ASSERT_NOT_REACHED(); return; } toRenderBoxModelObject(element.renderer())->layer()->compositedLayerMapping()->mainGraphicsLayer()->pauseAnimation(id, pauseTime); }
void KeyframeAnimation::endAnimation() { if (!m_object) return; if (m_object->isComposited()) toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName()); // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->element()); }
void KeyframeAnimation::pauseAnimation(double timeOffset) { if (!m_object) return; if (m_object->isComposited()) toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName()); // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->element()); }
void KeyframeAnimation::endAnimation() { if (!m_object) return; #if USE(ACCELERATED_COMPOSITING) if (m_object->isComposited()) toRenderBoxModelObject(m_object)->animationFinished(m_keyframes.animationName()); #endif // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->styledGeneratingNode()); }
bool KeyframeAnimation::startAnimation(double beginTime) { #if USE(ACCELERATED_COMPOSITING) if (m_object && m_object->hasLayer()) { RenderLayer* layer = toRenderBoxModelObject(m_object)->layer(); if (layer->isComposited()) return layer->backing()->startAnimation(beginTime, m_animation.get(), m_keyframes); } #else UNUSED_PARAM(beginTime); #endif return false; }
void ImplicitAnimation::pauseAnimation(double timeOffset) { if (!m_object) return; #if USE(ACCELERATED_COMPOSITING) if (m_object->isComposited()) toRenderBoxModelObject(m_object)->transitionPaused(timeOffset, m_animatingProperty); #else UNUSED_PARAM(timeOffset); #endif // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->node()); }
void KeyframeAnimation::pauseAnimation(double timeOffset) { if (!m_object) return; #if USE(ACCELERATED_COMPOSITING) if (m_object->isComposited()) toRenderBoxModelObject(m_object)->animationPaused(timeOffset, m_keyframes.animationName()); #else UNUSED_PARAM(timeOffset); #endif // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->styledGeneratingNode()); }
void KeyframeAnimation::endAnimation() { if (!m_object) return; #if USE(ACCELERATED_COMPOSITING) if (m_object->hasLayer()) { RenderLayer* layer = toRenderBoxModelObject(m_object)->layer(); if (layer->isComposited()) layer->backing()->animationFinished(m_keyframes.animationName()); } #endif // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->node()); }
void InspectorOverlay::drawNodeHighlight() { if (!m_highlightNode) return; Highlight highlight; buildNodeHighlight(m_highlightNode.get(), m_nodeHighlightConfig, &highlight); if (m_eventTargetNode) { Highlight eventTargetHighlight; buildNodeHighlight(m_eventTargetNode.get(), m_nodeHighlightConfig, &eventTargetHighlight); highlight.quads.append(eventTargetHighlight.quads[1]); // Add border from eventTargetNode to highlight. } RefPtr<InspectorObject> highlightObject = buildObjectForHighlight(highlight); Node* node = m_highlightNode.get(); if (node->isElementNode() && m_nodeHighlightConfig.showInfo && node->renderer() && node->document()->frame()) { RefPtr<InspectorObject> elementInfo = InspectorObject::create(); Element* element = toElement(node); bool isXHTML = element->document()->isXHTMLDocument(); elementInfo->setString("tagName", isXHTML ? element->nodeName() : element->nodeName().lower()); elementInfo->setString("idValue", element->getIdAttribute()); HashSet<AtomicString> usedClassNames; if (element->hasClass() && element->isStyledElement()) { StringBuilder classNames; const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames(); size_t classNameCount = classNamesString.size(); for (size_t i = 0; i < classNameCount; ++i) { const AtomicString& className = classNamesString[i]; if (!usedClassNames.add(className).isNewEntry) continue; classNames.append('.'); classNames.append(className); } elementInfo->setString("className", classNames.toString()); } RenderObject* renderer = node->renderer(); Frame* containingFrame = node->document()->frame(); FrameView* containingView = containingFrame->view(); IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView(renderer->absoluteBoundingBoxRect())); RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0; elementInfo->setString("nodeWidth", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width())); elementInfo->setString("nodeHeight", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height())); highlightObject->setObject("elementInfo", elementInfo.release()); } evaluateInOverlay("drawNodeHighlight", highlightObject); }
bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(FrameView* frameView) const { const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); if (!viewportConstrainedObjects) return false; for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportConstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; ++it) { RenderObject* viewportConstrainedObject = *it; if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrainedObject->hasLayer()) return true; RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)->layer(); // Any explicit reason that a fixed position element is not composited shouldn't cause slow scrolling. if (!layer->isComposited() && layer->viewportConstrainedNotCompositedReason() == RenderLayer::NoNotCompositedReason) return true; } return false; }
void PluginView::invalidateRect(const IntRect& dirtyRect) { if (!parent() || !m_plugin || !m_isInitialized) return; #if PLATFORM(MAC) if (m_plugin->pluginLayer()) return; #endif RenderBoxModelObject* renderer = toRenderBoxModelObject(m_pluginElement->renderer()); if (!renderer) return; IntRect contentRect(dirtyRect); contentRect.move(renderer->borderLeft() + renderer->paddingLeft(), renderer->borderTop() + renderer->paddingTop()); renderer->repaintRectangle(contentRect); }
LayoutState::LayoutState(RenderObject* root) : m_clipped(false) , m_next(0) #ifndef NDEBUG , m_renderer(root) #endif { RenderObject* container = root->container(); FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true); m_offset = IntSize(absContentPoint.x(), absContentPoint.y()); if (container->hasOverflowClip()) { RenderLayer* layer = toRenderBoxModelObject(container)->layer(); m_clipped = true; m_clipRect = IntRect(toPoint(m_offset), layer->size()); m_offset -= layer->scrolledContentOffset(); } }
void KeyframeAnimation::pauseAnimation(double timeOffset) { if (!m_object) return; #if USE(ACCELERATED_COMPOSITING) if (m_object->hasLayer()) { RenderLayer* layer = toRenderBoxModelObject(m_object)->layer(); if (layer->isComposited()) layer->backing()->animationPaused(timeOffset, m_keyframes.animationName()); } #else UNUSED_PARAM(timeOffset); #endif // Restore the original (unanimated) style if (!paused()) setNeedsStyleRecalc(m_object->node()); }
bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView) const { const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); if (!viewportConstrainedObjects) return false; #if USE(ACCELERATED_COMPOSITING) for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportConstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; ++it) { RenderObject* viewportConstrainedObject = *it; if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrainedObject->hasLayer()) return true; RenderBoxModelObject* viewportConstrainedBoxModelObject = toRenderBoxModelObject(viewportConstrainedObject); if (!viewportConstrainedBoxModelObject->layer()->backing()) return true; } return false; #else return viewportConstrainedObjects->size(); #endif }
void AnimationBase::freezeAtTime(double t) { if (!m_compAnim) return; if (!m_startTime) { // If we haven't started yet, make it as if we started. m_animState = AnimationStateStartWaitResponse; onAnimationStartResponse(beginAnimationUpdateTime()); } ASSERT(m_startTime); // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time. if (t <= m_animation->delay()) m_pauseTime = m_startTime; else m_pauseTime = m_startTime + t - m_animation->delay(); if (m_object && m_object->isComposited()) toRenderBoxModelObject(m_object)->suspendAnimations(m_pauseTime); }