本文整理汇总了C++中HTMLInputElement::closedShadowRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLInputElement::closedShadowRoot方法的具体用法?C++ HTMLInputElement::closedShadowRoot怎么用?C++ HTMLInputElement::closedShadowRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLInputElement
的用法示例。
在下文中一共展示了HTMLInputElement::closedShadowRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layout
void LayoutSliderContainer::layout()
{
HTMLInputElement* input = toHTMLInputElement(node()->shadowHost());
bool isVertical = hasVerticalAppearance(input);
mutableStyleRef().setFlexDirection(isVertical ? FlowColumn : FlowRow);
TextDirection oldTextDirection = style()->direction();
if (isVertical) {
// FIXME: Work around rounding issues in RTL vertical sliders. We want them to
// render identically to LTR vertical sliders. We can remove this work around when
// subpixel rendering is enabled on all ports.
mutableStyleRef().setDirection(LTR);
}
Element* thumbElement = input->closedShadowRoot()->getElementById(ShadowElementNames::sliderThumb());
Element* trackElement = input->closedShadowRoot()->getElementById(ShadowElementNames::sliderTrack());
LayoutBox* thumb = thumbElement ? thumbElement->layoutBox() : 0;
LayoutBox* track = trackElement ? trackElement->layoutBox() : 0;
SubtreeLayoutScope layoutScope(*this);
// Force a layout to reset the position of the thumb so the code below doesn't move the thumb to the wrong place.
// FIXME: Make a custom Render class for the track and move the thumb positioning code there.
if (track)
layoutScope.setChildNeedsLayout(track);
LayoutFlexibleBox::layout();
mutableStyleRef().setDirection(oldTextDirection);
// These should always exist, unless someone mutates the shadow DOM (e.g., in the inspector).
if (!thumb || !track)
return;
double percentageOffset = sliderPosition(input).toDouble();
LayoutUnit availableExtent = isVertical ? track->contentHeight() : track->contentWidth();
availableExtent -= isVertical ? thumb->size().height() : thumb->size().width();
LayoutUnit offset = percentageOffset * availableExtent;
LayoutPoint thumbLocation = thumb->location();
if (isVertical)
thumbLocation.setY(thumbLocation.y() + track->contentHeight() - thumb->size().height() - offset);
else if (style()->isLeftToRightDirection())
thumbLocation.setX(thumbLocation.x() + offset);
else
thumbLocation.setX(thumbLocation.x() - offset);
thumb->setLocation(thumbLocation);
// We need one-off invalidation code here because painting of the timeline element does not go through style.
// Instead it has a custom implementation in C++ code.
// Therefore the style system cannot understand when it needs to be paint invalidated.
setShouldDoFullPaintInvalidation();
}