本文整理汇总了C++中RenderElement::view方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderElement::view方法的具体用法?C++ RenderElement::view怎么用?C++ RenderElement::view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderElement
的用法示例。
在下文中一共展示了RenderElement::view方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAnimations
bool AnimationController::updateAnimations(RenderElement& renderer, const RenderStyle& newStyle, std::unique_ptr<RenderStyle>& animatedStyle)
{
auto* oldStyle = renderer.hasInitializedStyle() ? &renderer.style() : nullptr;
if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle.animations() && !newStyle.transitions()))
return false;
if (renderer.document().pageCacheState() != Document::NotInPageCache)
return false;
// Don't run transitions when printing.
if (renderer.view().printing())
return false;
// Fetch our current set of implicit animations from a hashtable. We then compare them
// against the animations in the style and make sure we're in sync. If destination values
// have changed, we reset the animation. We then do a blend to get new values and we return
// a new style.
// We don't support anonymous pseudo elements like :first-line or :first-letter.
ASSERT(renderer.element());
CompositeAnimation& rendererAnimations = m_data->ensureCompositeAnimation(renderer);
bool animationStateChanged = rendererAnimations.animate(renderer, oldStyle, newStyle, animatedStyle);
if (renderer.parent() || newStyle.animations() || (oldStyle && oldStyle->animations())) {
m_data->updateAnimationTimerForRenderer(renderer);
#if ENABLE(REQUEST_ANIMATION_FRAME)
renderer.view().frameView().scheduleAnimation();
#endif
}
return animationStateChanged;
}
示例2: appendChildSnapOffsets
static void appendChildSnapOffsets(HTMLElement& parent, bool shouldAddHorizontalChildOffsets, Vector<LayoutUnit>& horizontalSnapOffsetSubsequence, bool shouldAddVerticalChildOffsets, Vector<LayoutUnit>& verticalSnapOffsetSubsequence)
{
RenderElement* scrollContainer = parent.renderer();
ASSERT(scrollContainer);
RenderView& renderView = scrollContainer->view();
Vector<const RenderBox*> elements;
for (auto& element : renderView.boxesWithScrollSnapCoordinates()) {
if (element->findEnclosingScrollableContainer() != scrollContainer)
continue;
elements.append(element);
}
for (auto& box : elements) {
auto& scrollSnapCoordinates = box->style().scrollSnapCoordinates();
if (scrollSnapCoordinates.isEmpty())
continue;
LayoutRect viewSize = box->contentBoxRect();
FloatPoint position = box->localToContainerPoint(FloatPoint(parent.renderBox()->scrollLeft(), parent.renderBox()->scrollTop()), parent.renderBox());
for (auto& coordinate : scrollSnapCoordinates) {
LayoutUnit lastPotentialSnapPositionX = position.x() + valueForLength(coordinate.width(), viewSize.width());
if (shouldAddHorizontalChildOffsets && lastPotentialSnapPositionX > 0)
horizontalSnapOffsetSubsequence.append(lastPotentialSnapPositionX);
LayoutUnit lastPotentialSnapPositionY = position.y() + valueForLength(coordinate.height(), viewSize.height());
if (shouldAddVerticalChildOffsets && lastPotentialSnapPositionY > 0)
verticalSnapOffsetSubsequence.append(lastPotentialSnapPositionY);
}
}
}
示例3: ASSERT
PassRefPtr<RenderStyle> RenderNamedFlowFragment::computeStyleInRegion(RenderElement& renderer, RenderStyle& parentStyle)
{
ASSERT(!renderer.isAnonymous());
// FIXME: Region styling fails for pseudo-elements because the renderers don't have a node.
RefPtr<RenderStyle> renderObjectRegionStyle = renderer.view().document().ensureStyleResolver().styleForElement(renderer.element(), &parentStyle, DisallowStyleSharing, MatchAllRules, this);
return renderObjectRegionStyle.release();
}
示例4: ASSERT
PassRef<RenderStyle> AnimationController::updateAnimations(RenderElement& renderer, PassRef<RenderStyle> newStyle)
{
// Don't do anything if we're in the cache
if (renderer.document().inPageCache())
return newStyle;
RenderStyle* oldStyle = renderer.hasInitializedStyle() ? &renderer.style() : nullptr;
if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle.get().animations() && !newStyle.get().transitions()))
return newStyle;
// Don't run transitions when printing.
if (renderer.view().printing())
return newStyle;
// Fetch our current set of implicit animations from a hashtable. We then compare them
// against the animations in the style and make sure we're in sync. If destination values
// have changed, we reset the animation. We then do a blend to get new values and we return
// a new style.
// We don't support anonymous pseudo elements like :first-line or :first-letter.
ASSERT(renderer.element());
Ref<RenderStyle> newStyleBeforeAnimation(std::move(newStyle));
CompositeAnimation& rendererAnimations = m_data->ensureCompositeAnimation(&renderer);
auto blendedStyle = rendererAnimations.animate(renderer, oldStyle, newStyleBeforeAnimation.get());
if (renderer.parent() || newStyleBeforeAnimation->animations() || (oldStyle && oldStyle->animations())) {
m_data->updateAnimationTimerForRenderer(&renderer);
#if ENABLE(REQUEST_ANIMATION_FRAME)
renderer.view().frameView().scheduleAnimation();
#endif
}
if (&blendedStyle.get() != &newStyleBeforeAnimation.get()) {
// If the animations/transitions change opacity or transform, we need to update
// the style to impose the stacking rules. Note that this is also
// done in StyleResolver::adjustRenderStyle().
if (blendedStyle.get().hasAutoZIndex() && (blendedStyle.get().opacity() < 1.0f || blendedStyle.get().hasTransform()))
blendedStyle.get().setZIndex(0);
}
return blendedStyle;
}
示例5: rendererRemovedFromTree
void RenderCounter::rendererRemovedFromTree(RenderElement& renderer)
{
if (!renderer.view().hasRenderCounters())
return;
RenderObject* currentRenderer = renderer.lastLeafChild();
if (!currentRenderer)
currentRenderer = &renderer;
while (true) {
if (is<RenderElement>(*currentRenderer))
destroyCounterNodes(downcast<RenderElement>(*currentRenderer));
if (currentRenderer == &renderer)
break;
currentRenderer = currentRenderer->previousInPreOrder();
}
}
示例6: rendererSubtreeAttached
void RenderCounter::rendererSubtreeAttached(RenderElement& renderer)
{
if (!renderer.view().hasRenderCounters())
return;
Element* element = renderer.element();
if (element && !element->isPseudoElement())
element = element->parentElement();
else
element = renderer.generatingElement();
if (element && !element->renderer())
return; // No need to update if the parent is not attached yet
for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) {
if (is<RenderElement>(*descendant))
updateCounters(downcast<RenderElement>(*descendant));
}
}