void PaintPropertyTreeBuilder::updatePerspective( const LayoutObject& object, PaintPropertyTreeBuilderContext& context) { const ComputedStyle& style = object.styleRef(); if (object.isBox() && style.hasPerspective()) { // The perspective node must not flatten (else nothing will get // perspective), but it should still extend the rendering context as // most transform nodes do. TransformationMatrix matrix = TransformationMatrix().applyPerspective(style.perspective()); FloatPoint3D origin = perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.current.paintOffset); object.getMutableForPainting().ensurePaintProperties().updatePerspective( context.current.transform, matrix, origin, context.current.shouldFlattenInheritedTransform, context.current.renderingContextID); } else { if (auto* properties = object.getMutableForPainting().paintProperties()) properties->clearPerspective(); } const auto* properties = object.paintProperties(); if (properties && properties->perspective()) { context.current.transform = properties->perspective(); context.current.shouldFlattenInheritedTransform = false; } }
static PassRefPtr<TransformPaintPropertyNode> createPerspectiveIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) { const ComputedStyle& style = object.styleRef(); if (!object.isBox() || !style.hasPerspective()) return nullptr; RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = TransformPaintPropertyNode::create( TransformationMatrix().applyPerspective(style.perspective()), perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.paintOffset), context.currentTransform); context.currentTransform = newTransformNodeForPerspective.get(); return newTransformNodeForPerspective.release(); }
void PaintPropertyTreeBuilder::updatePerspective(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) { const ComputedStyle& style = object.styleRef(); if (!object.isBox() || !style.hasPerspective()) return; RefPtr<TransformPaintPropertyNode> perspective = TransformPaintPropertyNode::create( TransformationMatrix().applyPerspective(style.perspective()), perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.paintOffset), context.currentTransform); context.currentTransform = perspective.get(); object.getMutableForPainting().ensureObjectPaintProperties().setPerspective(perspective.release()); }