本文整理汇总了C++中LayoutBoxModelObject::document方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBoxModelObject::document方法的具体用法?C++ LayoutBoxModelObject::document怎么用?C++ LayoutBoxModelObject::document使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBoxModelObject
的用法示例。
在下文中一共展示了LayoutBoxModelObject::document方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculate
void BackgroundImageGeometry::calculate(
const LayoutBoxModelObject& obj,
const LayoutBoxModelObject* paintContainer,
const GlobalPaintFlags globalPaintFlags,
const FillLayer& fillLayer,
const LayoutRect& paintRect) {
LayoutUnit left;
LayoutUnit top;
LayoutSize positioningAreaSize;
bool isLayoutView = obj.isLayoutView();
const LayoutBox* rootBox = nullptr;
if (isLayoutView) {
// It is only possible reach here when root element has a box.
Element* documentElement = obj.document().documentElement();
DCHECK(documentElement);
DCHECK(documentElement->layoutObject());
DCHECK(documentElement->layoutObject()->isBox());
rootBox = toLayoutBox(documentElement->layoutObject());
}
const LayoutBoxModelObject& positioningBox =
isLayoutView ? static_cast<const LayoutBoxModelObject&>(*rootBox) : obj;
// Determine the background positioning area and set destRect to the
// background painting area. destRect will be adjusted later if the
// background is non-repeating.
// FIXME: transforms spec says that fixed backgrounds behave like scroll
// inside transforms.
bool fixedAttachment = fillLayer.attachment() == FixedBackgroundAttachment;
if (RuntimeEnabledFeatures::fastMobileScrollingEnabled()) {
// As a side effect of an optimization to blit on scroll, we do not honor
// the CSS property "background-attachment: fixed" because it may result in
// rendering artifacts. Note, these artifacts only appear if we are blitting
// on scroll of a page that has fixed background images.
fixedAttachment = false;
}
if (!fixedAttachment) {
setDestRect(paintRect);
LayoutUnit right;
LayoutUnit bottom;
// Scroll and Local.
if (fillLayer.origin() != BorderFillBox) {
left = LayoutUnit(positioningBox.borderLeft());
right = LayoutUnit(positioningBox.borderRight());
top = LayoutUnit(positioningBox.borderTop());
bottom = LayoutUnit(positioningBox.borderBottom());
if (fillLayer.origin() == ContentFillBox) {
left += positioningBox.paddingLeft();
right += positioningBox.paddingRight();
top += positioningBox.paddingTop();
bottom += positioningBox.paddingBottom();
}
}
if (isLayoutView) {
// The background of the box generated by the root element covers the
// entire canvas and will be painted by the view object, but the we should
// still use the root element box for positioning.
positioningAreaSize =
rootBox->size() - LayoutSize(left + right, top + bottom),
rootBox->location();
// The input paint rect is specified in root element local coordinate
// (i.e. a transform is applied on the context for painting), and is
// expanded to cover the whole canvas. Since left/top is relative to the
// paint rect, we need to offset them back.
left -= paintRect.x();
top -= paintRect.y();
} else {
positioningAreaSize =
paintRect.size() - LayoutSize(left + right, top + bottom);
}
} else {
setHasNonLocalGeometry();
LayoutRect viewportRect = obj.viewRect();
if (fixedBackgroundPaintsInLocalCoordinates(obj, globalPaintFlags)) {
viewportRect.setLocation(LayoutPoint());
} else {
if (FrameView* frameView = obj.view()->frameView())
viewportRect.setLocation(IntPoint(frameView->scrollOffsetInt()));
// Compensate the translations created by ScrollRecorders.
// TODO(trchen): Fix this for SP phase 2. crbug.com/529963.
viewportRect.moveBy(
accumulatedScrollOffsetForFixedBackground(obj, paintContainer));
}
if (paintContainer)
viewportRect.moveBy(
LayoutPoint(-paintContainer->localToAbsolute(FloatPoint())));
setDestRect(viewportRect);
positioningAreaSize = destRect().size();
}
LayoutSize fillTileSize(
calculateFillTileSize(positioningBox, fillLayer, positioningAreaSize));
// It's necessary to apply the heuristic here prior to any further
// calculations to avoid incorrectly using sub-pixel values that won't be
//.........这里部分代码省略.........