本文整理汇总了C++中LayoutRect::location方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutRect::location方法的具体用法?C++ LayoutRect::location怎么用?C++ LayoutRect::location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutRect
的用法示例。
在下文中一共展示了LayoutRect::location方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visualPointToFlowThreadPoint
LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const
{
unsigned columnIndex = columnIndexAtVisualPoint(visualPoint);
LayoutRect columnRect = columnRectAt(columnIndex);
LayoutPoint localPoint(visualPoint);
localPoint.moveBy(-columnRect.location());
// Before converting to a flow thread position, if the block direction coordinate is outside the
// column, snap to the bounds of the column, and reset the inline direction coordinate to the
// start position in the column. The effect of this is that if the block position is before the
// column rectangle, we'll get to the beginning of this column, while if the block position is
// after the column rectangle, we'll get to the beginning of the next column.
if (!m_columnSet.isHorizontalWritingMode()) {
LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? LayoutUnit() : columnRect.height();
if (localPoint.x() < 0)
localPoint = LayoutPoint(LayoutUnit(), columnStart);
else if (localPoint.x() > logicalHeight())
localPoint = LayoutPoint(logicalHeight(), columnStart);
return LayoutPoint(localPoint.x() + logicalTopInFlowThreadAt(columnIndex), localPoint.y());
}
LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? LayoutUnit() : columnRect.width();
if (localPoint.y() < 0)
localPoint = LayoutPoint(columnStart, LayoutUnit());
else if (localPoint.y() > logicalHeight())
localPoint = LayoutPoint(columnStart, logicalHeight());
return LayoutPoint(localPoint.x(), localPoint.y() + logicalTopInFlowThreadAt(columnIndex));
}
示例2: elementAccessibilityHitTest
AccessibilityObject* AccessibilityListBox::elementAccessibilityHitTest(const LayoutPoint& point) const
{
// the internal HTMLSelectElement methods for returning a listbox option at a point
// ignore optgroup elements.
if (!m_renderer)
return 0;
Node* node = m_renderer->node();
if (!node)
return 0;
LayoutRect parentRect = boundingBoxRect();
AccessibilityObject* listBoxOption = 0;
unsigned length = m_children.size();
for (unsigned i = 0; i < length; i++) {
LayoutRect rect = toRenderListBox(m_renderer)->itemBoundingBoxRect(parentRect.location(), i);
// The cast to HTMLElement below is safe because the only other possible listItem type
// would be a WMLElement, but WML builds don't use accessibility features at all.
if (rect.contains(point)) {
listBoxOption = m_children[i].get();
break;
}
}
if (listBoxOption && !listBoxOption->accessibilityIsIgnored())
return listBoxOption;
return axObjectCache()->getOrCreate(m_renderer);
}
示例3: hitTestRegion
bool RenderFlowThread::hitTestRegion(RenderRegion* region, const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
{
LayoutRect regionRect(region->regionRect());
LayoutRect regionOverflowRect = region->regionOverflowRect();
LayoutRect regionClippingRect(accumulatedOffset + (regionOverflowRect.location() - regionRect.location()), regionOverflowRect.size());
if (!regionClippingRect.contains(pointInContainer))
return false;
LayoutPoint renderFlowThreadOffset;
if (style()->isFlippedBlocksWritingMode()) {
LayoutRect flippedRegionRect(regionRect);
flipForWritingMode(flippedRegionRect);
renderFlowThreadOffset = LayoutPoint(accumulatedOffset - flippedRegionRect.location());
} else
renderFlowThreadOffset = LayoutPoint(accumulatedOffset - regionRect.location());
LayoutPoint transformedPoint(pointInContainer.x() - renderFlowThreadOffset.x(), pointInContainer.y() - renderFlowThreadOffset.y());
// Always ignore clipping, since the RenderFlowThread has nothing to do with the bounds of the FrameView.
HitTestRequest newRequest(request.type() | HitTestRequest::IgnoreClipping);
RenderRegion* oldRegion = result.region();
result.setRegion(region);
LayoutPoint oldPoint = result.point();
result.setPoint(transformedPoint);
bool isPointInsideFlowThread = layer()->hitTest(newRequest, result);
result.setPoint(oldPoint);
result.setRegion(oldRegion);
// FIXME: Should we set result.m_localPoint back to the RenderRegion's coordinate space or leave it in the RenderFlowThread's coordinate
// space? Right now it's staying in the RenderFlowThread's coordinate space, which may end up being ok. We will know more when we get around to
// patching positionForPoint.
return isPointInsideFlowThread;
}
示例4: computeRegionClippingRect
LayoutRect RenderFlowThread::computeRegionClippingRect(const LayoutPoint& offset, const LayoutRect& flowThreadPortionRect, const LayoutRect& flowThreadPortionOverflowRect) const
{
LayoutRect regionClippingRect(offset + (flowThreadPortionOverflowRect.location() - flowThreadPortionRect.location()), flowThreadPortionOverflowRect.size());
if (style()->isFlippedBlocksWritingMode())
regionClippingRect.move(flowThreadPortionRect.size() - flowThreadPortionOverflowRect.size());
return regionClippingRect;
}
示例5: lineDirectionPointForBlockDirectionNavigationOf
// Abs x/y position of the caret ignoring transforms.
// TODO(yosin) navigation with transforms should be smarter.
static LayoutUnit lineDirectionPointForBlockDirectionNavigationOf(
const VisiblePosition& visiblePosition) {
if (visiblePosition.isNull())
return LayoutUnit();
LayoutObject* layoutObject;
LayoutRect localRect = localCaretRectOfPosition(
visiblePosition.toPositionWithAffinity(), layoutObject);
if (localRect.isEmpty() || !layoutObject)
return LayoutUnit();
// This ignores transforms on purpose, for now. Vertical navigation is done
// without consulting transforms, so that 'up' in transformed text is 'up'
// relative to the text, not absolute 'up'.
FloatPoint caretPoint =
layoutObject->localToAbsolute(FloatPoint(localRect.location()));
LayoutObject* containingBlock = layoutObject->containingBlock();
if (!containingBlock) {
// Just use ourselves to determine the writing mode if we have no containing
// block.
containingBlock = layoutObject;
}
return LayoutUnit(containingBlock->isHorizontalWritingMode()
? caretPoint.x()
: caretPoint.y());
}
示例6: paintBackgroundsBehindCell
void TableCellPainter::paintBackgroundsBehindCell(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutObject* backgroundObject)
{
if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
return;
if (!backgroundObject)
return;
if (m_layoutTableCell.style()->visibility() != VISIBLE)
return;
LayoutTable* tableElt = m_layoutTableCell.table();
if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
return;
Color c = backgroundObject->resolveColor(CSSPropertyBackgroundColor);
const FillLayer& bgLayer = backgroundObject->style()->backgroundLayers();
LayoutRect paintRect = paintBounds(paintOffset, backgroundObject != &m_layoutTableCell ? AddOffsetFromParent : DoNotAddOffsetFromParent);
if (bgLayer.hasImage() || c.alpha()) {
// We have to clip here because the background would paint
// on top of the borders otherwise. This only matters for cells and rows.
bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == &m_layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && tableElt->collapseBorders();
GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
if (shouldClip) {
LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size());
clipRect.expand(m_layoutTableCell.borderInsets());
paintInfo.context->clip(clipRect);
}
BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, paintRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject);
}
}
示例7: prepareFilterEffect
bool FilterEffectRendererHelper::prepareFilterEffect(RenderLayer* renderLayer, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)
{
ASSERT(m_haveFilterEffect && renderLayer->filterRenderer());
m_renderLayer = renderLayer;
m_repaintRect = dirtyRect;
FilterEffectRenderer* filter = renderLayer->filterRenderer();
LayoutRect filterSourceRect = filter->computeSourceImageRectForDirtyRect(filterBoxRect, dirtyRect);
m_paintOffset = filterSourceRect.location();
if (filterSourceRect.isEmpty()) {
// The dirty rect is not in view, just bail out.
m_haveFilterEffect = false;
return false;
}
bool hasUpdatedBackingStore = filter->updateBackingStoreRect(filterSourceRect);
if (filter->hasFilterThatMovesPixels()) {
if (hasUpdatedBackingStore)
m_repaintRect = filterSourceRect;
else {
m_repaintRect.unite(layerRepaintRect);
m_repaintRect.intersect(filterSourceRect);
}
}
return true;
}
示例8: computePanelWidth
LayoutUnit LayoutMedia::computePanelWidth(const LayoutRect& mediaRect) const {
// TODO(mlamouri): we don't know if the main frame has an horizontal scrollbar
// if it is out of process. See https://crbug.com/662480
if (document().page()->mainFrame()->isRemoteFrame())
return mediaRect.width();
FrameHost* frameHost = document().frameHost();
LocalFrame* mainFrame = document().page()->deprecatedLocalMainFrame();
FrameView* pageView = mainFrame ? mainFrame->view() : nullptr;
if (!frameHost || !mainFrame || !pageView)
return mediaRect.width();
if (pageView->horizontalScrollbarMode() != ScrollbarAlwaysOff)
return mediaRect.width();
// On desktop, this will include scrollbars when they stay visible.
const LayoutUnit visibleWidth(frameHost->visualViewport().visibleWidth());
const LayoutUnit absoluteXOffset(
localToAbsolute(
FloatPoint(mediaRect.location()),
UseTransforms | ApplyContainerFlip | TraverseDocumentBoundaries)
.x());
DCHECK_GE(visibleWidth - absoluteXOffset, 0);
return std::min(mediaRect.width(), visibleWidth - absoluteXOffset);
}
示例9: computeSourceImageRectForDirtyRect
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);
}
示例10: adjustRegionBoundsFromFlowThreadPortionRect
void RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect(const LayoutPoint& layerOffset, LayoutRect& regionBounds)
{
LayoutRect flippedFlowThreadPortionRect = flowThreadPortionRect();
flowThread()->flipForWritingMode(flippedFlowThreadPortionRect);
regionBounds.moveBy(flippedFlowThreadPortionRect.location());
UNUSED_PARAM(layerOffset);
}
示例11: logicalRectToPhysicalRect
LayoutRect InlineBox::logicalRectToPhysicalRect(const LayoutRect& current)
{
LayoutRect retval = current;
if (!isHorizontal()) {
retval = retval.transposedRect();
}
retval.setLocation(logicalPositionToPhysicalPoint(FloatPoint(retval.location()), FloatSize(retval.size())).toLayoutPoint());
return retval;
}
示例12: paintBackgroundsBehindCell
void TableCellPainter::paintBackgroundsBehindCell(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const LayoutObject* backgroundObject, DisplayItem::Type type)
{
if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell))
return;
if (!backgroundObject)
return;
if (m_layoutTableCell.style()->visibility() != VISIBLE)
return;
LayoutTable* tableElt = m_layoutTableCell.table();
if (!tableElt->collapseBorders() && m_layoutTableCell.style()->emptyCells() == HIDE && !m_layoutTableCell.firstChild())
return;
LayoutRect paintRect = paintBounds(paintOffset, backgroundObject != &m_layoutTableCell ? AddOffsetFromParent : DoNotAddOffsetFromParent);
// Record drawing only if the cell is painting background from containers.
Optional<LayoutObjectDrawingRecorder> recorder;
if (backgroundObject != &m_layoutTableCell) {
LayoutPoint adjustedPaintOffset = paintRect.location();
if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutTableCell, type, adjustedPaintOffset))
return;
recorder.emplace(*paintInfo.context, m_layoutTableCell, type, paintRect, adjustedPaintOffset);
} else {
ASSERT(paintRect.location() == paintOffset);
}
Color c = backgroundObject->resolveColor(CSSPropertyBackgroundColor);
const FillLayer& bgLayer = backgroundObject->style()->backgroundLayers();
if (bgLayer.hasImage() || c.alpha()) {
// We have to clip here because the background would paint
// on top of the borders otherwise. This only matters for cells and rows.
bool shouldClip = backgroundObject->hasLayer() && (backgroundObject == &m_layoutTableCell || backgroundObject == m_layoutTableCell.parent()) && tableElt->collapseBorders();
GraphicsContextStateSaver stateSaver(*paintInfo.context, shouldClip);
if (shouldClip) {
LayoutRect clipRect(paintRect.location(), m_layoutTableCell.size());
clipRect.expand(m_layoutTableCell.borderInsets());
paintInfo.context->clip(pixelSnappedIntRect(clipRect));
}
BoxPainter(m_layoutTableCell).paintFillLayers(paintInfo, c, bgLayer, paintRect, BackgroundBleedNone, SkXfermode::kSrcOver_Mode, backgroundObject);
}
}
示例13: logicalRectToPhysicalRect
void InlineBox::logicalRectToPhysicalRect(LayoutRect& current) const
{
if (isHorizontal() && !lineLayoutItem().hasFlippedBlocksWritingMode())
return;
if (!isHorizontal()) {
current = current.transposedRect();
}
current.setLocation(logicalPositionToPhysicalPoint(current.location(), current.size()));
return;
}
示例14: flowThreadPortionLocation
LayoutPoint RenderRegion::flowThreadPortionLocation() const
{
LayoutPoint portionLocation;
LayoutRect portionRect = flowThreadPortionRect();
if (flowThread()->style().isFlippedBlocksWritingMode()) {
LayoutRect flippedFlowThreadPortionRect(portionRect);
flowThread()->flipForWritingMode(flippedFlowThreadPortionRect);
portionLocation = flippedFlowThreadPortionRect.location();
} else
portionLocation = portionRect.location();
return portionLocation;
}
示例15: paintFlowThreadPortionInRegion
void RenderFlowThread::paintFlowThreadPortionInRegion(PaintInfo& paintInfo, RenderRegion* region, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint& paintOffset) const
{
GraphicsContext* context = paintInfo.context;
if (!context)
return;
// RenderFlowThread should start painting its content in a position that is offset
// from the region rect's current position. The amount of offset is equal to the location of
// the flow thread portion in the flow thread's local coordinates.
// Note that we have to pixel snap the location at which we're going to paint, since this is necessary
// to minimize the amount of incorrect snapping that would otherwise occur.
// If we tried to paint by applying a non-integral translation, then all the
// layout code that attempted to pixel snap would be incorrect.
IntPoint adjustedPaintOffset;
LayoutPoint portionLocation;
if (style()->isFlippedBlocksWritingMode()) {
LayoutRect flippedFlowThreadPortionRect(flowThreadPortionRect);
flipForWritingMode(flippedFlowThreadPortionRect);
portionLocation = flippedFlowThreadPortionRect.location();
} else
portionLocation = flowThreadPortionRect.location();
adjustedPaintOffset = roundedIntPoint(paintOffset - portionLocation);
// The clipping rect for the region is set up by assuming the flowThreadPortionRect is going to paint offset from adjustedPaintOffset.
// Remember that we pixel snapped and moved the paintOffset and stored the snapped result in adjustedPaintOffset. Now we add back in
// the flowThreadPortionRect's location to get the spot where we expect the portion to actually paint. This can be non-integral and
// that's ok. We then pixel snap the resulting clipping rect to account for snapping that will occur when the flow thread paints.
IntRect regionClippingRect = pixelSnappedIntRect(computeRegionClippingRect(adjustedPaintOffset + portionLocation, flowThreadPortionRect, flowThreadPortionOverflowRect));
PaintInfo info(paintInfo);
info.rect.intersect(regionClippingRect);
if (!info.rect.isEmpty()) {
context->save();
context->clip(regionClippingRect);
context->translate(adjustedPaintOffset.x(), adjustedPaintOffset.y());
info.rect.moveBy(-adjustedPaintOffset);
layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayerTemporaryClipRects);
context->restore();
}
}