本文整理汇总了C++中RenderElement::element方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderElement::element方法的具体用法?C++ RenderElement::element怎么用?C++ RenderElement::element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderElement
的用法示例。
在下文中一共展示了RenderElement::element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeFromCacheAndInvalidateDependencies
static inline void removeFromCacheAndInvalidateDependencies(RenderElement& renderer, bool needsLayout)
{
if (auto* resources = SVGResourcesCache::cachedResourcesForRenderer(renderer)) {
if (RenderSVGResourceFilter* filter = resources->filter())
filter->removeClientFromCache(renderer);
if (RenderSVGResourceMasker* masker = resources->masker())
masker->removeClientFromCache(renderer);
if (RenderSVGResourceClipper* clipper = resources->clipper())
clipper->removeClientFromCache(renderer);
}
if (!renderer.element() || !renderer.element()->isSVGElement())
return;
HashSet<SVGElement*>* dependencies = renderer.document().accessSVGExtensions().setOfElementsReferencingTarget(downcast<SVGElement>(renderer.element()));
if (!dependencies)
return;
// We allow cycles in SVGDocumentExtensions reference sets in order to avoid expensive
// reference graph adjustments on changes, so we need to break possible cycles here.
static NeverDestroyed<HashSet<SVGElement*>> invalidatingDependencies;
for (auto* element : *dependencies) {
if (auto* renderer = element->renderer()) {
if (UNLIKELY(!invalidatingDependencies.get().add(element).isNewEntry)) {
// Reference cycle: we are in process of invalidating this dependant.
continue;
}
RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer, needsLayout);
invalidatingDependencies.get().remove(element);
}
}
}
示例2: applyStrokeStyleToContext
void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle& style, const RenderElement& renderer)
{
ASSERT(context);
ASSERT(renderer.element());
ASSERT(renderer.element()->isSVGElement());
const SVGRenderStyle& svgStyle = style.svgStyle();
SVGLengthContext lengthContext(toSVGElement(renderer.element()));
context->setStrokeThickness(svgStyle.strokeWidth().value(lengthContext));
context->setLineCap(svgStyle.capStyle());
context->setLineJoin(svgStyle.joinStyle());
if (svgStyle.joinStyle() == MiterJoin)
context->setMiterLimit(svgStyle.strokeMiterLimit());
const Vector<SVGLength>& dashes = svgStyle.strokeDashArray();
if (dashes.isEmpty())
context->setStrokeStyle(SolidStroke);
else {
DashArray dashArray;
dashArray.reserveInitialCapacity(dashes.size());
for (unsigned i = 0, size = dashes.size(); i < size; ++i)
dashArray.uncheckedAppend(dashes[i].value(lengthContext));
context->setLineDash(dashArray, svgStyle.strokeDashOffset().value(lengthContext));
}
}
示例3: shouldCreateRenderer
static bool shouldCreateRenderer(const Element& element, const RenderElement& parentRenderer)
{
if (!parentRenderer.canHaveChildren() && !(element.isPseudoElement() && parentRenderer.canHaveGeneratedChildren()))
return false;
if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(element))
return false;
return true;
}
示例4: styleChanged
void SVGRenderSupport::styleChanged(RenderElement& renderer, const RenderStyle* oldStyle)
{
auto parent = renderer.parent();
SVGRenderSupport::setRendererHasSVGShadow(renderer, (parent && SVGRenderSupport::rendererHasSVGShadow(*parent)) || renderer.style().svgStyle().shadow());
#if ENABLE(CSS_COMPOSITING)
if (renderer.element() && renderer.element()->isSVGElement() && (!oldStyle || renderer.style().hasBlendMode() != oldStyle->hasBlendMode()))
SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending(renderer);
#else
UNUSED_PARAM(oldStyle);
#endif
}
示例5: clear
bool AnimationControllerPrivate::clear(RenderElement& renderer)
{
LOG(Animations, "AnimationControllerPrivate %p clear: %p", this, &renderer);
ASSERT(renderer.isCSSAnimating());
ASSERT(m_compositeAnimations.contains(&renderer));
Element* element = renderer.element();
m_eventsToDispatch.removeAllMatching([element] (const EventToDispatch& info) {
return info.element == element;
});
m_elementChangesToDispatch.removeAllMatching([element](auto& currentElement) {
return currentElement.ptr() == element;
});
// Return false if we didn't do anything OR we are suspended (so we don't try to
// do a setNeedsStyleRecalc() when suspended).
RefPtr<CompositeAnimation> animation = m_compositeAnimations.take(&renderer);
ASSERT(animation);
renderer.setIsCSSAnimating(false);
animation->clearRenderer();
return animation->isSuspended();
}
示例6: 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;
}
示例7: updateMaskedAncestorShouldIsolateBlending
void SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending(const RenderElement& renderer)
{
ASSERT(renderer.element());
ASSERT(renderer.element()->isSVGElement());
bool maskedAncestorShouldIsolateBlending = renderer.style().hasBlendMode();
for (auto* ancestor = renderer.element()->parentElement(); ancestor && ancestor->isSVGElement(); ancestor = ancestor->parentElement()) {
if (!toSVGElement(ancestor)->isSVGGraphicsElement() || !isolatesBlending(*ancestor->computedStyle()))
continue;
if (ancestor->computedStyle()->svgStyle().hasMasker())
toSVGGraphicsElement(ancestor)->setShouldIsolateBlending(maskedAncestorShouldIsolateBlending);
return;
}
}
示例8: planCounter
static bool planCounter(RenderElement& renderer, const AtomicString& identifier, bool& isReset, int& value)
{
// We must have a generating node or else we cannot have a counter.
Element* generatingElement = renderer.generatingElement();
if (!generatingElement)
return false;
const RenderStyle& style = renderer.style();
switch (style.styleType()) {
case NOPSEUDO:
// Sometimes elements have more then one renderer. Only the first one gets the counter
// LayoutTests/http/tests/css/counter-crash.html
if (generatingElement->renderer() != &renderer)
return false;
break;
case BEFORE:
case AFTER:
break;
default:
return false; // Counters are forbidden from all other pseudo elements.
}
const CounterDirectives directives = style.getCounterDirectives(identifier);
if (directives.isDefined()) {
value = directives.combinedValue();
isReset = directives.isReset();
return true;
}
if (identifier == "list-item") {
if (is<RenderListItem>(renderer)) {
if (downcast<RenderListItem>(renderer).hasExplicitValue()) {
value = downcast<RenderListItem>(renderer).explicitValue();
isReset = true;
return true;
}
value = 1;
isReset = false;
return true;
}
if (Element* element = renderer.element()) {
if (is<HTMLOListElement>(*element)) {
value = downcast<HTMLOListElement>(*element).start();
isReset = true;
return true;
}
if (element->hasTagName(ulTag) || element->hasTagName(menuTag) || element->hasTagName(dirTag)) {
value = 0;
isReset = true;
return true;
}
}
}
return false;
}
示例9: ASSERT
std::unique_ptr<RenderStyle> RenderNamedFlowFragment::computeStyleInRegion(RenderElement& renderer, const RenderStyle& parentStyle) const
{
ASSERT(!renderer.isAnonymous());
// FIXME: Region styling fails for pseudo-elements because the renderers don't have a node.
auto renderObjectRegionStyle = renderer.element()->styleResolver().styleForElement(*renderer.element(), &parentStyle, MatchAllRules, this).renderStyle;
return renderObjectRegionStyle;
}
示例10: cancelAnimations
void AnimationController::cancelAnimations(RenderElement& renderer)
{
if (!renderer.isCSSAnimating())
return;
if (!m_data->clear(renderer))
return;
Element* element = renderer.element();
ASSERT(!element || !element->document().inPageCache());
if (element)
element->setNeedsStyleRecalc(SyntheticStyleChange);
}
示例11: clientStyleChanged
void SVGResourcesCache::clientStyleChanged(RenderElement& renderer, StyleDifference diff, const RenderStyle& newStyle)
{
if (diff == StyleDifferenceEqual || !renderer.parent())
return;
// In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint.
if (renderer.isSVGResourceFilterPrimitive() && (diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintIfTextOrBorderOrOutline))
return;
// Dynamic changes of CSS properties like 'clip-path' may require us to recompute the associated resources for a renderer.
// FIXME: Avoid passing in a useless StyleDifference, but instead compare oldStyle/newStyle to see which resources changed
// to be able to selectively rebuild individual resources, instead of all of them.
if (rendererCanHaveResources(renderer)) {
SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer);
cache->removeResourcesFromRenderer(renderer);
cache->addResourcesFromRenderer(renderer, newStyle);
}
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false);
if (renderer.element() && !renderer.element()->isSVGElement())
renderer.element()->setNeedsStyleRecalc(SyntheticStyleChange);
}
示例12: cancelAnimations
void AnimationController::cancelAnimations(RenderElement& renderer)
{
if (!renderer.isCSSAnimating())
return;
if (!m_data->clear(renderer))
return;
Element* element = renderer.element();
if (!element || element->document().renderTreeBeingDestroyed())
return;
ASSERT(element->document().pageCacheState() == Document::NotInPageCache);
element->invalidateStyleAndLayerComposition();
}
示例13: addFlowChild
void RenderNamedFlowThread::addFlowChild(RenderElement& newChild)
{
// The child list is used to sort the flow thread's children render objects
// based on their corresponding nodes DOM order. The list is needed to avoid searching the whole DOM.
if (newChild.isAnonymous())
return;
auto* beforeChild = nextRendererForElement(*newChild.element());
if (beforeChild)
m_flowThreadChildList.insertBefore(beforeChild, &newChild);
else
m_flowThreadChildList.add(&newChild);
}
示例14: platformApplySoftware
void FEImage::platformApplySoftware()
{
RenderElement* renderer = referencedRenderer();
if (!m_image && !renderer)
return;
ImageBuffer* resultImage = createImageBufferResult();
if (!resultImage)
return;
SVGFilter* svgFilter = toSVGFilter(filter());
FloatRect destRect = svgFilter->absoluteTransform().mapRect(filterPrimitiveSubregion());
FloatRect srcRect;
if (renderer)
srcRect = svgFilter->absoluteTransform().mapRect(renderer->repaintRectInLocalCoordinates());
else {
srcRect = FloatRect(FloatPoint(), m_image->size());
m_preserveAspectRatio.transformRect(destRect, srcRect);
}
IntPoint paintLocation = absolutePaintRect().location();
destRect.move(-paintLocation.x(), -paintLocation.y());
// FEImage results are always in ColorSpaceDeviceRGB
setResultColorSpace(ColorSpaceDeviceRGB);
if (renderer) {
const AffineTransform& absoluteTransform = svgFilter->absoluteTransform();
resultImage->context()->concatCTM(absoluteTransform);
SVGElement* contextNode = toSVGElement(renderer->element());
if (contextNode->hasRelativeLengths()) {
SVGLengthContext lengthContext(contextNode);
FloatSize viewportSize;
// If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport.
// Build up a transformation that maps from the viewport space to the filter primitive subregion.
if (lengthContext.determineViewport(viewportSize))
resultImage->context()->concatCTM(makeMapBetweenRects(FloatRect(FloatPoint(), viewportSize), destRect));
}
AffineTransform contentTransformation;
SVGRenderingContext::renderSubtreeToImageBuffer(resultImage, *renderer, contentTransformation);
return;
}
resultImage->context()->drawImage(m_image.get(), ColorSpaceDeviceRGB, destRect, srcRect);
}
示例15: 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));
}
}