本文整理汇总了C++中RenderObject::absoluteBoundingBoxRectIgnoringTransforms方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderObject::absoluteBoundingBoxRectIgnoringTransforms方法的具体用法?C++ RenderObject::absoluteBoundingBoxRectIgnoringTransforms怎么用?C++ RenderObject::absoluteBoundingBoxRectIgnoringTransforms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderObject
的用法示例。
在下文中一共展示了RenderObject::absoluteBoundingBoxRectIgnoringTransforms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& ec)
{
if (!element) {
ec = INVALID_ACCESS_ERR;
return ClientRect::create();
}
element->document()->updateLayoutIgnorePendingStylesheets();
RenderObject* renderer = element->renderer();
if (!renderer)
return ClientRect::create();
return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms());
}
示例2: paintSearchFieldResultsButton
bool RenderThemeSafari::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect&)
{
ASSERT(SafariThemeLibrary());
Node* input = o->node()->shadowAncestorNode();
ASSERT(input);
RenderObject* renderer = input->renderer();
ASSERT(renderer);
IntRect searchRect = renderer->absoluteBoundingBoxRectIgnoringTransforms();
paintThemePart(SafariTheme::SearchFieldResultsButtonPart, paintInfo.context->platformContext(), searchRect, controlSizeFromRect(searchRect, searchFieldSizes()), determineState(o));
return false;
}
示例3: paintSliderTicks
void RenderTheme::paintSliderTicks(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
{
Node* node = o->node();
if (!node)
return;
HTMLInputElement* input = node->toInputElement();
if (!input)
return;
HTMLDataListElement* dataList = static_cast<HTMLDataListElement*>(input->list());
if (!dataList)
return;
double min = input->minimum();
double max = input->maximum();
ControlPart part = o->style()->appearance();
// We don't support ticks on alternate sliders like MediaVolumeSliders.
if (part != SliderHorizontalPart && part != SliderVerticalPart)
return;
bool isHorizontal = part == SliderHorizontalPart;
IntSize thumbSize;
RenderObject* thumbRenderer = input->sliderThumbElement()->renderer();
if (thumbRenderer) {
RenderStyle* thumbStyle = thumbRenderer->style();
int thumbWidth = thumbStyle->width().intValue();
int thumbHeight = thumbStyle->height().intValue();
thumbSize.setWidth(isHorizontal ? thumbWidth : thumbHeight);
thumbSize.setHeight(isHorizontal ? thumbHeight : thumbWidth);
}
IntSize tickSize = sliderTickSize();
float zoomFactor = o->style()->effectiveZoom();
FloatRect tickRect;
int tickRegionSideMargin = 0;
int tickRegionWidth = 0;
IntRect trackBounds;
RenderObject* trackRenderer = input->sliderTrackElement()->renderer();
// We can ignoring transforms because transform is handled by the graphics context.
if (trackRenderer)
trackBounds = trackRenderer->absoluteBoundingBoxRectIgnoringTransforms();
IntRect sliderBounds = o->absoluteBoundingBoxRectIgnoringTransforms();
// Make position relative to the transformed ancestor element.
trackBounds.setX(trackBounds.x() - sliderBounds.x() + rect.x());
trackBounds.setY(trackBounds.y() - sliderBounds.y() + rect.y());
if (isHorizontal) {
tickRect.setWidth(floor(tickSize.width() * zoomFactor));
tickRect.setHeight(floor(tickSize.height() * zoomFactor));
tickRect.setY(floor(rect.y() + rect.height() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor));
tickRegionSideMargin = trackBounds.x() + (thumbSize.width() - tickSize.width() * zoomFactor) / 2.0;
tickRegionWidth = trackBounds.width() - thumbSize.width();
} else {
tickRect.setWidth(floor(tickSize.height() * zoomFactor));
tickRect.setHeight(floor(tickSize.width() * zoomFactor));
tickRect.setX(floor(rect.x() + rect.width() / 2.0 + sliderTickOffsetFromTrackCenter() * zoomFactor));
tickRegionSideMargin = trackBounds.y() + (thumbSize.width() - tickSize.width() * zoomFactor) / 2.0;
tickRegionWidth = trackBounds.height() - thumbSize.width();
}
RefPtr<HTMLCollection> options = dataList->options();
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), ColorSpaceDeviceRGB);
for (unsigned i = 0; Node* node = options->item(i); i++) {
ASSERT(node->hasTagName(optionTag));
HTMLOptionElement* optionElement = toHTMLOptionElement(node);
String value = optionElement->value();
if (!input->isValidValue(value))
continue;
double parsedValue = parseToDoubleForNumberType(input->sanitizeValue(value));
double tickFraction = (parsedValue - min) / (max - min);
double tickRatio = isHorizontal && o->style()->isLeftToRightDirection() ? tickFraction : 1.0 - tickFraction;
double tickPosition = round(tickRegionSideMargin + tickRegionWidth * tickRatio);
if (isHorizontal)
tickRect.setX(tickPosition);
else
tickRect.setY(tickPosition);
paintInfo.context->fillRect(tickRect);
}
}