本文整理汇总了C++中LayoutRect函数的典型用法代码示例。如果您正苦于以下问题:C++ LayoutRect函数的具体用法?C++ LayoutRect怎么用?C++ LayoutRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LayoutRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
void RenderMultiColumnSet::expandToEncompassFlowThreadContentsIfNeeded()
{
ASSERT(multiColumnFlowThread()->lastMultiColumnSet() == this);
LayoutRect rect(flowThreadPortionRect());
// Get the offset within the flow thread in its block progression direction. Then get the
// flow thread's remaining logical height including its overflow and expand our rect
// to encompass that remaining height and overflow. The idea is that we will generate
// additional columns and pages to hold that overflow, since people do write bad
// content like <body style="height:0px"> in multi-column layouts.
bool isHorizontal = flowThread()->isHorizontalWritingMode();
LayoutUnit logicalTopOffset = isHorizontal ? rect.y() : rect.x();
LayoutRect layoutRect = flowThread()->layoutOverflowRect();
LayoutUnit logicalHeightWithOverflow = (isHorizontal ? layoutRect.maxY() : layoutRect.maxX()) - logicalTopOffset;
setFlowThreadPortionRect(LayoutRect(rect.x(), rect.y(), isHorizontal ? rect.width() : logicalHeightWithOverflow, isHorizontal ? logicalHeightWithOverflow : rect.height()));
}
示例2: localExposeRect
LayoutRect RenderLayerScrollableArea::exposeRect(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
{
LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox());
LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight());
LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, alignX, alignY);
IntSize clampedScrollOffset = clampScrollOffset(adjustedScrollOffset() + toIntSize(roundedIntRect(r).location()));
if (clampedScrollOffset == adjustedScrollOffset())
return rect;
IntSize oldScrollOffset = adjustedScrollOffset();
scrollToOffset(clampedScrollOffset);
IntSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset;
localExposeRect.move(-scrollOffsetDifference);
return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox());
}
示例3: backgroundClipRect
void RenderLayerClipper::calculateRects(const ClipRectsContext& context, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
ClipRect& backgroundRect, const LayoutPoint* offsetFromRoot) const
{
bool isClippingRoot = m_renderer.layer() == context.rootLayer;
if (!isClippingRoot && m_renderer.layer()->parent()) {
backgroundRect = backgroundClipRect(context);
backgroundRect.move(roundedIntSize(context.subPixelAccumulation));
backgroundRect.intersect(paintDirtyRect);
} else {
backgroundRect = paintDirtyRect;
}
LayoutPoint offset;
if (offsetFromRoot)
offset = *offsetFromRoot;
else
m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset);
layerBounds = LayoutRect(offset, m_renderer.layer()->size());
// Update the clip rects that will be passed to child layers.
if (m_renderer.hasOverflowClip()) {
// If we establish an overflow clip at all, then go ahead and make sure our background
// rect is intersected with our layer's bounds including our visual overflow,
// since any visual overflow like box-shadow or border-outset is not clipped by overflow:auto/hidden.
if (m_renderer.hasVisualOverflow()) {
// FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
// we may need to inflate our clip specifically for shadows or outsets.
// FIXME: Does not do the right thing with CSS regions yet, since we don't yet factor in the
// individual region boxes as overflow.
LayoutRect layerBoundsWithVisualOverflow = m_renderer.visualOverflowRect();
layerBoundsWithVisualOverflow.moveBy(offset);
backgroundRect.intersect(layerBoundsWithVisualOverflow);
} else {
LayoutRect bounds = m_renderer.borderBoxRect();
bounds.moveBy(offset);
backgroundRect.intersect(bounds);
}
}
// CSS clip (different than clipping due to overflow) can clip to any box, even if it falls outside of the border box.
if (m_renderer.hasClip()) {
// Clip applies to *us* as well, so go ahead and update the damageRect.
LayoutRect newPosClip = m_renderer.clipRect(offset);
backgroundRect.intersect(newPosClip);
}
}
示例4: LayoutRect
bool AnimationBase::computeTransformedExtentViaMatrix(const FloatRect& rendererBox, const RenderStyle& style, LayoutRect& bounds) const
{
TransformationMatrix transform;
style.applyTransform(transform, rendererBox, RenderStyle::IncludeTransformOrigin);
if (!transform.isAffine())
return false;
TransformationMatrix::Decomposed2Type fromDecomp;
transform.decompose2(fromDecomp);
// Any rotation prevents us from using a simple start/end rect union.
if (fromDecomp.angle)
return false;
bounds = LayoutRect(transform.mapRect(bounds));
return true;
}
示例5: topLeft
bool EllipsisBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
// FIXME: the call to roundedLayoutPoint() below is temporary and should be removed once
// the transition to LayoutUnit-based types is complete (crbug.com/321237)
LayoutPoint adjustedLocation = accumulatedOffset + topLeft();
LayoutPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(accumulatedOffset);
LayoutRect boundsRect(boxOrigin, size());
if (visibleToHitTestRequest(result.hitTestRequest()) && boundsRect.intersects(LayoutRect(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0)))) {
lineLayoutItem().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
if (result.addNodeToListBasedTestResult(lineLayoutItem().node(), locationInContainer, boundsRect) == StopHitTesting)
return true;
}
return false;
}
示例6: layer
void RenderLayerModelObject::addLayerHitTestRects(LayerHitTestRects& rects, const RenderLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
{
if (hasLayer()) {
if (isRenderView()) {
// RenderView is handled with a special fast-path, but it needs to know the current layer.
RenderObject::addLayerHitTestRects(rects, layer(), LayoutPoint(), LayoutRect());
} else {
// Since a RenderObject never lives outside it's container RenderLayer, we can switch
// to marking entire layers instead. This may sometimes mark more than necessary (when
// a layer is made of disjoint objects) but in practice is a significant performance
// savings.
layer()->addLayerHitTestRects(rects);
}
} else {
RenderObject::addLayerHitTestRects(rects, currentLayer, layerOffset, containerRect);
}
}
示例7: FloatRect
LayoutRect FilterEffectRenderer::computeSourceImageRectForDirtyRect(const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect)
{
if (hasCustomShaderFilter()) {
// When we have at least a custom shader in the chain, we need to compute the whole source image, because the shader can
// reference any pixel and we cannot control that.
return filterBoxRect;
}
// The result of this function is the area in the "filterBoxRect" that needs to be repainted, so that we fully cover the "dirtyRect".
FloatRect rectForRepaint = dirtyRect;
rectForRepaint.move(-filterBoxRect.location().x(), -filterBoxRect.location().y());
float inf = std::numeric_limits<float>::infinity();
FloatRect clipRect = FloatRect(FloatPoint(-inf, -inf), FloatSize(inf, inf));
rectForRepaint = lastEffect()->getSourceRect(rectForRepaint, clipRect);
rectForRepaint.move(filterBoxRect.location().x(), filterBoxRect.location().y());
rectForRepaint.intersect(filterBoxRect);
return LayoutRect(rectForRepaint);
}
示例8: containsRotation
bool AnimationBase::computeTransformedExtentViaTransformList(const FloatRect& rendererBox, const RenderStyle& style, LayoutRect& bounds) const
{
FloatRect floatBounds = bounds;
FloatPoint transformOrigin;
bool applyTransformOrigin = containsRotation(style.transform().operations()) || style.transform().affectedByTransformOrigin();
if (applyTransformOrigin) {
float offsetX = style.transformOriginX().isPercent() ? rendererBox.x() : 0;
float offsetY = style.transformOriginY().isPercent() ? rendererBox.y() : 0;
transformOrigin.setX(floatValueForLength(style.transformOriginX(), rendererBox.width()) + offsetX);
transformOrigin.setY(floatValueForLength(style.transformOriginY(), rendererBox.height()) + offsetY);
// Ignore transformOriginZ because we'll bail if we encounter any 3D transforms.
floatBounds.moveBy(-transformOrigin);
}
for (const auto& operation : style.transform().operations()) {
if (operation->type() == TransformOperation::ROTATE) {
// For now, just treat this as a full rotation. This could take angle into account to reduce inflation.
floatBounds = boundsOfRotatingRect(floatBounds);
} else {
TransformationMatrix transform;
operation->apply(transform, rendererBox.size());
if (!transform.isAffine())
return false;
if (operation->type() == TransformOperation::MATRIX || operation->type() == TransformOperation::MATRIX_3D) {
TransformationMatrix::Decomposed2Type toDecomp;
transform.decompose2(toDecomp);
// Any rotation prevents us from using a simple start/end rect union.
if (toDecomp.angle)
return false;
}
floatBounds = transform.mapRect(floatBounds);
}
}
if (applyTransformOrigin)
floatBounds.moveBy(transformOrigin);
bounds = LayoutRect(floatBounds);
return true;
}
示例9: toLayoutBox
void PaintPropertyTreeBuilder::updateOverflowClip(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (!object.isBox())
return;
const LayoutBox& box = toLayoutBox(object);
// The <input> elements can't have contents thus CSS overflow property doesn't
// apply. However for layout purposes we do generate child layout objects for
// them, e.g. button label. We should clip the overflow from those children.
// This is called control clip and we technically treat them like overflow
// clip.
LayoutRect clipRect;
if (box.hasControlClip()) {
clipRect = box.controlClipRect(context.current.paintOffset);
} else if (box.hasOverflowClip() || box.styleRef().containsPaint() ||
(box.isSVGRoot() &&
toLayoutSVGRoot(box).shouldApplyViewportClip())) {
clipRect = box.overflowClipRect(context.current.paintOffset);
} else {
if (auto* properties = object.getMutableForPainting().paintProperties()) {
properties->clearInnerBorderRadiusClip();
properties->clearOverflowClip();
}
return;
}
if (box.styleRef().hasBorderRadius()) {
auto innerBorder = box.styleRef().getRoundedInnerBorderFor(
LayoutRect(context.current.paintOffset, box.size()));
context.current.clip =
object.getMutableForPainting()
.ensurePaintProperties()
.updateInnerBorderRadiusClip(
context.current.clip, context.current.transform, innerBorder);
} else if (auto* properties =
object.getMutableForPainting().paintProperties()) {
properties->clearInnerBorderRadiusClip();
}
context.current.clip =
object.getMutableForPainting().ensurePaintProperties().updateOverflowClip(
context.current.clip, context.current.transform,
FloatRoundedRect(FloatRect(clipRect)));
}
示例10: toRenderInline
LayoutRect RenderRegion::visualOverflowRectForBox(const RenderBoxModelObject* box)
{
if (box->isRenderInline()) {
const RenderInline* inlineBox = toRenderInline(box);
return inlineBox->linesVisualOverflowBoundingBoxInRegion(this);
}
if (box->isBox()) {
RefPtr<RenderOverflow> overflow;
ensureOverflowForBox(toRenderBox(box), overflow, true);
ASSERT(overflow);
return overflow->visualOverflowRect();
}
ASSERT_NOT_REACHED();
return LayoutRect();
}
示例11: ASSERT
LayoutRect LayoutFlowThread::fragmentsBoundingBox(const LayoutRect& layerBoundingBox) const
{
ASSERT(!m_columnSetsInvalidated);
LayoutRect result;
for (auto* columnSet : m_multiColumnSetList) {
DeprecatedPaintLayerFragments fragments;
columnSet->collectLayerFragments(fragments, layerBoundingBox, LayoutRect(LayoutRect::infiniteIntRect()));
for (const auto& fragment : fragments) {
LayoutRect fragmentRect(layerBoundingBox);
fragmentRect.intersect(fragment.paginationClip);
fragmentRect.moveBy(fragment.paginationOffset);
result.unite(fragmentRect);
}
}
return result;
}
示例12: LayoutRect
LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
{
if (style().visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent())
return LayoutRect();
// The selectionRect can project outside of the overflowRect, so take their union
// for repainting to avoid selection painting glitches.
LayoutRect r = unionRect(localSelectionRect(false), visualOverflowRect());
// FIXME: layoutDelta needs to be applied in parts before/after transforms and
// repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
r.move(view().layoutDelta());
r.inflate(style().outlineSize());
computeRectForRepaint(repaintContainer, r);
return r;
}
示例13: flippedBoundingBoxInFlowThread
LayoutRect MultiColumnFragmentainerGroup::fragmentsBoundingBox(
const LayoutRect& boundingBoxInFlowThread) const {
// Find the start and end column intersected by the bounding box.
LayoutRect flippedBoundingBoxInFlowThread(boundingBoxInFlowThread);
LayoutFlowThread* flowThread = m_columnSet.flowThread();
flowThread->flipForWritingMode(flippedBoundingBoxInFlowThread);
bool isHorizontalWritingMode = m_columnSet.isHorizontalWritingMode();
LayoutUnit boundingBoxLogicalTop = isHorizontalWritingMode
? flippedBoundingBoxInFlowThread.y()
: flippedBoundingBoxInFlowThread.x();
LayoutUnit boundingBoxLogicalBottom =
isHorizontalWritingMode ? flippedBoundingBoxInFlowThread.maxY()
: flippedBoundingBoxInFlowThread.maxX();
if (boundingBoxLogicalBottom <= logicalTopInFlowThread() ||
boundingBoxLogicalTop >= logicalBottomInFlowThread()) {
// The bounding box doesn't intersect this fragmentainer group.
return LayoutRect();
}
unsigned startColumn;
unsigned endColumn;
columnIntervalForBlockRangeInFlowThread(
boundingBoxLogicalTop, boundingBoxLogicalBottom, startColumn, endColumn);
LayoutRect startColumnFlowThreadOverflowPortion =
flowThreadPortionOverflowRectAt(startColumn);
flowThread->flipForWritingMode(startColumnFlowThreadOverflowPortion);
LayoutRect startColumnRect(boundingBoxInFlowThread);
startColumnRect.intersect(startColumnFlowThreadOverflowPortion);
startColumnRect.move(flowThreadTranslationAtOffset(
logicalTopInFlowThreadAt(startColumn), LayoutBox::AssociateWithLatterPage,
CoordinateSpaceConversion::Containing));
if (startColumn == endColumn)
return startColumnRect; // It all takes place in one column. We're done.
LayoutRect endColumnFlowThreadOverflowPortion =
flowThreadPortionOverflowRectAt(endColumn);
flowThread->flipForWritingMode(endColumnFlowThreadOverflowPortion);
LayoutRect endColumnRect(boundingBoxInFlowThread);
endColumnRect.intersect(endColumnFlowThreadOverflowPortion);
endColumnRect.move(flowThreadTranslationAtOffset(
logicalTopInFlowThreadAt(endColumn), LayoutBox::AssociateWithLatterPage,
CoordinateSpaceConversion::Containing));
return unionRect(startColumnRect, endColumnRect);
}
示例14: pixelSnappedIntRect
void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutUnit cWidth = m_layoutImage.contentWidth();
LayoutUnit cHeight = m_layoutImage.contentHeight();
GraphicsContext* context = paintInfo.context;
if (!m_layoutImage.imageResource()->hasImage()) {
if (paintInfo.phase == PaintPhaseSelection)
return;
if (cWidth > 2 && cHeight > 2) {
// Draw an outline rect where the image should be.
IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset.x() + m_layoutImage.borderLeft() + m_layoutImage.paddingLeft(), paintOffset.y() + m_layoutImage.borderTop() + m_layoutImage.paddingTop(), cWidth, cHeight));
LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, paintRect);
if (drawingRecorder.canUseCachedDrawing())
return;
context->setStrokeStyle(SolidStroke);
context->setStrokeColor(Color::lightGray);
context->setFillColor(Color::transparent);
context->drawRect(paintRect);
}
} else if (cWidth > 0 && cHeight > 0) {
LayoutRect contentRect = m_layoutImage.contentBoxRect();
contentRect.moveBy(paintOffset);
LayoutRect paintRect = m_layoutImage.replacedContentRect();
paintRect.moveBy(paintOffset);
LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutImage, paintInfo.phase, contentRect);
if (drawingRecorder.canUseCachedDrawing())
return;
bool clip = !contentRect.contains(paintRect);
if (clip) {
context->save();
context->clip(contentRect);
}
paintIntoRect(context, paintRect);
if (clip)
context->restore();
}
}
示例15: getScrollableArea
void ScrollableAreaPainter::paintResizer(GraphicsContext& context,
const IntPoint& paintOffset,
const CullRect& cullRect) {
if (getScrollableArea().box().style()->resize() == RESIZE_NONE)
return;
IntRect absRect = getScrollableArea().resizerCornerRect(
getScrollableArea().box().pixelSnappedBorderBoxRect(), ResizerForPointer);
if (absRect.isEmpty())
return;
absRect.moveBy(paintOffset);
if (getScrollableArea().resizer()) {
if (!cullRect.intersectsCullRect(absRect))
return;
ScrollbarPainter::paintIntoRect(*getScrollableArea().resizer(), context,
paintOffset, LayoutRect(absRect));
return;
}
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, getScrollableArea().box(), DisplayItem::kResizer))
return;
LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(),
DisplayItem::kResizer, absRect);
drawPlatformResizerImage(context, absRect);
// Draw a frame around the resizer (1px grey line) if there are any scrollbars
// present. Clipping will exclude the right and bottom edges of this frame.
if (!getScrollableArea().hasOverlayScrollbars() &&
getScrollableArea().hasScrollbar()) {
GraphicsContextStateSaver stateSaver(context);
context.clip(absRect);
IntRect largerCorner = absRect;
largerCorner.setSize(
IntSize(largerCorner.width() + 1, largerCorner.height() + 1));
context.setStrokeColor(Color(217, 217, 217));
context.setStrokeThickness(1.0f);
context.setFillColor(Color::transparent);
context.drawRect(largerCorner);
}
}