本文整理汇总了C++中SliderThumbElement类的典型用法代码示例。如果您正苦于以下问题:C++ SliderThumbElement类的具体用法?C++ SliderThumbElement怎么用?C++ SliderThumbElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SliderThumbElement类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sliderThumbElementOf
void RangeInputType::handleMouseDownEvent(MouseEvent* event)
{
Node* targetNode = event->target()->toNode();
if (event->button() != LeftButton || !targetNode || (targetNode != element() && !targetNode->isDescendantOf(element()->shadowRoot())))
return;
SliderThumbElement* thumb = sliderThumbElementOf(element());
thumb->dragFrom(event->absoluteLocation());
event->setDefaultHandled();
}
示例2: ASSERT
void RenderSlider::layout()
{
ASSERT(needsLayout());
SliderThumbElement* thumbElement = shadowSliderThumb();
RenderBox* thumb = thumbElement ? toRenderBox(thumbElement->renderer()) : 0;
IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight());
if (thumb) {
// Allow the theme to set the size of the thumb.
if (thumb->style()->hasAppearance()) {
// FIXME: This should pass the style, not the renderer, to the theme.
theme()->adjustSliderThumbSize(thumb);
}
baseSize.expand(thumb->style()->width().calcMinValue(0), thumb->style()->height().calcMinValue(0));
}
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
IntSize oldSize = size();
setSize(baseSize);
computeLogicalWidth();
computeLogicalHeight();
updateLayerTransform();
if (thumb) {
if (oldSize != size())
thumb->setChildNeedsLayout(true, false);
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());
IntRect oldThumbRect = thumb->frameRect();
thumb->layoutIfNeeded();
IntRect rect = thumbRect();
thumb->setFrameRect(rect);
if (thumb->checkForRepaintDuringLayout())
thumb->repaintDuringLayoutIfMoved(oldThumbRect);
statePusher.pop();
addOverflowFromChild(thumb);
}
repainter.repaintAfterLayout();
setNeedsLayout(false);
}
示例3: ASSERT
void RangeInputType::handleMouseDownEvent(MouseEvent* event)
{
if (element().isDisabledOrReadOnly())
return;
Node* targetNode = event->target()->toNode();
if (event->button() != LeftButton || !targetNode)
return;
ASSERT(element().shadow());
if (targetNode != element() && !targetNode->isDescendantOf(element().userAgentShadowRoot()))
return;
SliderThumbElement* thumb = sliderThumbElement();
if (targetNode == thumb)
return;
thumb->dragFrom(event->absoluteLocation());
}
示例4: DCHECK
void RangeInputType::handleMouseDownEvent(MouseEvent* event) {
if (element().isDisabledOrReadOnly())
return;
Node* targetNode = event->target()->toNode();
if (event->button() !=
static_cast<short>(WebPointerProperties::Button::Left) ||
!targetNode)
return;
DCHECK(element().shadow());
if (targetNode != element() &&
!targetNode->isDescendantOf(element().userAgentShadowRoot()))
return;
SliderThumbElement* thumb = sliderThumbElement();
if (targetNode == thumb)
return;
thumb->dragFrom(event->absoluteLocation());
}
示例5: sliderThumbElementOf
void RangeInputType::handleTouchEvent(TouchEvent* event)
{
if (element()->isDisabledOrReadOnly())
return;
if (event->type() == eventNames().touchendEvent) {
event->setDefaultHandled();
return;
}
TouchList* touches = event->targetTouches();
if (touches->length() == 1) {
Touch* touch = touches->item(0);
SliderThumbElement* thumb = sliderThumbElementOf(element());
thumb->setPositionFromPoint(touch->absoluteLocation());
event->setDefaultHandled();
}
}
示例6: hostInput
void SliderContainerElement::handleTouchEvent(TouchEvent* event) {
HTMLInputElement* input = hostInput();
if (input->isDisabledOrReadOnly())
return;
if (event->type() == EventTypeNames::touchend) {
input->dispatchFormControlChangeEvent();
event->setDefaultHandled();
m_slidingDirection = NoMove;
m_touchStarted = false;
return;
}
// The direction of this series of touch actions has been determined, which is
// perpendicular to the slider, so no need to adjust the value.
if (!canSlide()) {
return;
}
TouchList* touches = event->targetTouches();
SliderThumbElement* thumb = toSliderThumbElement(
treeScope().getElementById(ShadowElementNames::sliderThumb()));
if (touches->length() == 1) {
if (event->type() == EventTypeNames::touchstart) {
m_startPoint = touches->item(0)->absoluteLocation();
m_slidingDirection = NoMove;
m_touchStarted = true;
thumb->setPositionFromPoint(touches->item(0)->absoluteLocation());
} else if (m_touchStarted) {
LayoutPoint currentPoint = touches->item(0)->absoluteLocation();
if (m_slidingDirection ==
NoMove) { // Still needs to update the direction.
m_slidingDirection = getDirection(currentPoint, m_startPoint);
}
// m_slidingDirection has been updated, so check whether it's okay to
// slide again.
if (canSlide()) {
thumb->setPositionFromPoint(touches->item(0)->absoluteLocation());
event->setDefaultHandled();
}
}
}
}
示例7: shadowSliderThumb
IntRect RenderSlider::thumbRect()
{
SliderThumbElement* thumbElement = shadowSliderThumb();
if (!thumbElement)
return IntRect();
IntRect thumbRect;
RenderBox* thumb = toRenderBox(thumbElement->renderer());
thumbRect.setWidth(thumb->style()->width().calcMinValue(contentWidth()));
thumbRect.setHeight(thumb->style()->height().calcMinValue(contentHeight()));
double fraction = sliderPosition(static_cast<HTMLInputElement*>(node()));
IntRect contentRect = contentBoxRect();
if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) {
thumbRect.setX(contentRect.x() + (contentRect.width() - thumbRect.width()) / 2);
thumbRect.setY(contentRect.y() + static_cast<int>(nextafter((contentRect.height() - thumbRect.height()) + 1, 0) * (1 - fraction)));
} else {
thumbRect.setX(contentRect.x() + static_cast<int>(nextafter((contentRect.width() - thumbRect.width()) + 1, 0) * fraction));
thumbRect.setY(contentRect.y() + (contentRect.height() - thumbRect.height()) / 2);
}
return thumbRect;
}
示例8: SliderThumbElement
SliderThumbElement* SliderThumbElement::create(Document& document) {
SliderThumbElement* element = new SliderThumbElement(document);
element->setAttribute(idAttr, ShadowElementNames::sliderThumb());
return element;
}