本文整理汇总了C++中LayoutObject类的典型用法代码示例。如果您正苦于以下问题:C++ LayoutObject类的具体用法?C++ LayoutObject怎么用?C++ LayoutObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayoutObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: headerObjectsForColumn
void AXTableColumn::headerObjectsForColumn(AXObjectVector& headers) {
if (!m_parent)
return;
LayoutObject* layoutObject = m_parent->getLayoutObject();
if (!layoutObject)
return;
if (!m_parent->isAXTable())
return;
if (toAXTable(m_parent)->isAriaTable()) {
for (const auto& cell : children()) {
if (cell->roleValue() == ColumnHeaderRole)
headers.append(cell);
}
return;
}
if (!layoutObject->isTable())
return;
LayoutTable* table = toLayoutTable(layoutObject);
LayoutTableSection* tableSection = table->topSection();
for (; tableSection;
tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
unsigned numCols = tableSection->numEffectiveColumns();
if (m_columnIndex >= numCols)
continue;
unsigned numRows = tableSection->numRows();
for (unsigned r = 0; r < numRows; r++) {
LayoutTableCell* layoutCell =
tableSection->primaryCellAt(r, m_columnIndex);
if (!layoutCell)
continue;
AXObject* cell = axObjectCache().getOrCreate(layoutCell->node());
if (!cell || !cell->isTableCell() || headers.contains(cell))
continue;
if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRole)
headers.append(cell);
}
}
}
示例2: localContext
void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTreeBuilderContext& context)
{
PaintPropertyTreeBuilderContext localContext(context);
deriveBorderBoxFromContainerContext(object, localContext);
RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = createPaintOffsetTranslationIfNeeded(object, localContext);
RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTransformIfNeeded(object, localContext);
RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object, localContext);
RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowClipIfNeeded(object, localContext);
// TODO(trchen): Insert flattening transform here, as specified by
// http://www.w3.org/TR/css3-transforms/#transform-style-property
RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPerspectiveIfNeeded(object, localContext);
RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = createScrollTranslationIfNeeded(object, localContext);
updateOutOfFlowContext(object, newTransformNodeForTransform, localContext);
if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransform || newEffectNode || newClipNodeForOverflowClip || newTransformNodeForPerspective || newTransformNodeForScrollTranslation) {
OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProperties::create(
newTransformNodeForPaintOffsetTranslation.release(),
newTransformNodeForTransform.release(),
newEffectNode.release(),
newClipNodeForOverflowClip.release(),
newTransformNodeForPerspective.release(),
newTransformNodeForScrollTranslation.release());
object.setObjectPaintProperties(updatedPaintProperties.release());
} else {
object.clearObjectPaintProperties();
}
for (LayoutObject* child = object.slowFirstChild(); child; child = child->nextSibling()) {
if (child->isBoxModelObject() || child->isSVG())
walk(*child, localContext);
}
}
示例3: ASSERT
void PseudoElement::attach(const AttachContext& context)
{
ASSERT(!layoutObject());
Element::attach(context);
LayoutObject* layoutObject = this->layoutObject();
if (!layoutObject)
return;
ComputedStyle& style = layoutObject->mutableStyleRef();
if (style.styleType() != BEFORE && style.styleType() != AFTER)
return;
ASSERT(style.contentData());
for (const ContentData* content = style.contentData(); content; content = content->next()) {
LayoutObject* child = content->createLayoutObject(document(), style);
if (layoutObject->isChildAllowed(child, style)) {
layoutObject->addChild(child);
if (child->isQuote())
toLayoutQuote(child)->attachQuote();
} else {
child->destroy();
}
}
}
示例4: paintMediaSliderThumb
bool MediaControlsPainter::paintMediaSliderThumb(const LayoutObject& object, const PaintInfo& paintInfo, const IntRect& rect)
{
if (!object.node())
return false;
const HTMLMediaElement* mediaElement = toParentMediaElement(object.node()->shadowHost());
if (!mediaElement)
return false;
if (!hasSource(mediaElement))
return true;
Image* mediaSliderThumb = getMediaSliderThumb();
IntRect paintRect;
const ComputedStyle& style = object.styleRef();
adjustMediaSliderThumbPaintSize(rect, style, paintRect);
return paintMediaButton(paintInfo.context, paintRect, mediaSliderThumb);
}
示例5: createEffectIfNeeded
static PassRefPtr<EffectPaintPropertyNode> createEffectIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
const ComputedStyle& style = object.styleRef();
if (!style.hasOpacity())
return nullptr;
RefPtr<EffectPaintPropertyNode> newEffectNode = EffectPaintPropertyNode::create(style.opacity(), context.currentEffect);
context.currentEffect = newEffectNode.get();
return newEffectNode.release();
}
示例6: isSpinUpButtonPartPressed
bool LayoutTheme::isSpinUpButtonPartPressed(const LayoutObject& o)
{
Node* node = o.node();
if (!node || !node->active() || !node->isElementNode()
|| !toElement(node)->isSpinButtonElement())
return false;
SpinButtonElement* element = toSpinButtonElement(node);
return element->upDownState() == SpinButtonElement::Up;
}
示例7: OS
void AutoscrollController::updateAutoscrollLayoutObject()
{
if (!m_autoscrollLayoutObject)
return;
LayoutObject* layoutObject = m_autoscrollLayoutObject;
#if OS(WIN)
HitTestResult hitTest = layoutObject->frame()->eventHandler().hitTestResultAtPoint(m_panScrollStartPos, HitTestRequest::ReadOnly | HitTestRequest::Active);
if (Node* nodeAtPoint = hitTest.innerNode())
layoutObject = nodeAtPoint->layoutObject();
#endif
while (layoutObject && !(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll()))
layoutObject = layoutObject->parent();
m_autoscrollLayoutObject = layoutObject && layoutObject->isBox() ? toLayoutBox(layoutObject) : nullptr;
}
示例8: controlStateChanged
bool LayoutTheme::controlStateChanged(LayoutObject& o, ControlState state) const
{
if (!o.styleRef().hasAppearance())
return false;
// Default implementation assumes the controls don't respond to changes in :hover state
if (state == HoverControlState && !supportsHover(o.styleRef()))
return false;
// Assume pressed state is only responded to if the control is enabled.
if (state == PressedControlState && !isEnabled(&o))
return false;
o.setShouldDoFullPaintInvalidation();
if (RuntimeEnabledFeatures::slimmingPaintEnabled())
o.invalidateDisplayItemClientForNonCompositingDescendants();
return true;
}
示例9: mapLocalToAncestor
void SVGLayoutSupport::mapLocalToAncestor(const LayoutObject* object,
const LayoutBoxModelObject* ancestor,
TransformState& transformState,
MapCoordinatesFlags flags) {
transformState.applyTransform(object->localToSVGParentTransform());
LayoutObject* parent = object->parent();
// At the SVG/HTML boundary (aka LayoutSVGRoot), we apply the
// localToBorderBoxTransform to map an element from SVG viewport coordinates
// to CSS box coordinates.
// LayoutSVGRoot's mapLocalToAncestor method expects CSS box coordinates.
if (parent->isSVGRoot())
transformState.applyTransform(
toLayoutSVGRoot(parent)->localToBorderBoxTransform());
parent->mapLocalToAncestor(ancestor, transformState, flags);
}
示例10: toShapeClipPathOperation
bool SVGLayoutSupport::pointInClippingArea(const LayoutObject& object,
const FloatPoint& point) {
ClipPathOperation* clipPathOperation = object.styleRef().clipPath();
if (!clipPathOperation)
return true;
if (clipPathOperation->type() == ClipPathOperation::SHAPE) {
ShapeClipPathOperation& clipPath =
toShapeClipPathOperation(*clipPathOperation);
return clipPath.path(object.objectBoundingBox()).contains(point);
}
DCHECK_EQ(clipPathOperation->type(), ClipPathOperation::REFERENCE);
SVGResources* resources =
SVGResourcesCache::cachedResourcesForLayoutObject(&object);
if (!resources || !resources->clipper())
return true;
return resources->clipper()->hitTestClipContent(object.objectBoundingBox(),
point);
}
示例11: webLayerFromElement
static WebLayer* webLayerFromElement(Element* element)
{
if (!element)
return 0;
LayoutObject* layoutObject = element->layoutObject();
if (!layoutObject || !layoutObject->isBoxModelObject())
return 0;
PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
if (!layer)
return 0;
if (!layer->hasCompositedLayerMapping())
return 0;
CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
if (!graphicsLayer)
return 0;
return graphicsLayer->platformLayer();
}
示例12: updateScrollTranslation
void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.isBoxModelObject() || !object.hasOverflowClip())
return;
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
ASSERT(layer);
DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset();
if (scrollOffset.isZero() && !layer->scrollsOverflow())
return;
RefPtr<TransformPaintPropertyNode> scrollTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height()),
FloatPoint3D(),
context.currentTransform);
context.currentTransform = scrollTranslation.get();
object.getMutableForPainting().ensureObjectPaintProperties().setScrollTranslation(scrollTranslation.release());
}
示例13: updateScrollbarPaintOffset
// TODO(trchen): Remove this once we bake the paint offset into frameRect.
void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& object, const PaintPropertyTreeBuilderContext& context)
{
IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
if (roundedPaintOffset == IntPoint())
return;
if (!object.isBoxModelObject())
return;
PaintLayerScrollableArea* scrollableArea = toLayoutBoxModelObject(object).getScrollableArea();
if (!scrollableArea)
return;
if (!scrollableArea->horizontalScrollbar() && !scrollableArea->verticalScrollbar())
return;
auto paintOffset = TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y());
object.getMutableForPainting().ensureObjectPaintProperties().setScrollbarPaintOffset(
TransformPaintPropertyNode::create(paintOffset, FloatPoint3D(), context.currentTransform));
}
示例14: updateCssClip
void PaintPropertyTreeBuilder::updateCssClip(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (!object.hasClip())
return;
ASSERT(object.canContainAbsolutePositionObjects());
// Create clip node for descendants that are not fixed position.
// We don't have to setup context.clipForAbsolutePosition here because this object must be
// a container for absolute position descendants, and will copy from in-flow context later
// at updateOutOfFlowContext() step.
LayoutRect clipRect = toLayoutBox(object).clipRect(context.paintOffset);
RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create(
context.currentTransform,
FloatRoundedRect(FloatRect(clipRect)),
context.currentClip);
context.currentClip = clipNode.get();
object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clipNode.release());
}
示例15: updateRelativeLengthsInformation
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
{
bool updateRelativeLengthsOrViewBox = false;
bool widthOrHeightChanged = attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr;
if (widthOrHeightChanged
|| attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr) {
updateRelativeLengthsOrViewBox = true;
updateRelativeLengthsInformation();
invalidateRelativeLengthClients();
// At the SVG/HTML boundary (aka LayoutSVGRoot), the width and
// height attributes can affect the replaced size so we need
// to mark it for updating.
if (widthOrHeightChanged) {
LayoutObject* layoutObject = this->layoutObject();
if (layoutObject && layoutObject->isSVGRoot()) {
invalidateSVGPresentationAttributeStyle();
setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::SVGContainerSizeChange));
}
} else {
invalidateSVGPresentationAttributeStyle();
setNeedsStyleRecalc(LocalStyleChange,
StyleChangeReasonForTracing::fromAttribute(attrName));
}
}
if (SVGFitToViewBox::isKnownAttribute(attrName)) {
updateRelativeLengthsOrViewBox = true;
invalidateRelativeLengthClients();
if (LayoutObject* object = layoutObject())
object->setNeedsTransformUpdate();
}
if (updateRelativeLengthsOrViewBox
|| SVGZoomAndPan::isKnownAttribute(attrName)) {
SVGElement::InvalidationGuard invalidationGuard(this);
if (layoutObject())
markForLayoutAndParentResourceInvalidation(layoutObject());
return;
}
SVGGraphicsElement::svgAttributeChanged(attrName);
}