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); } }
void PaintPropertyTreeBuilder::walk(LayoutBoxModelObject& object, const PaintPropertyTreeBuilderContext& context) { ASSERT(object.isBox() != object.isLayoutInline()); // Either or. 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<TransformPaintPropertyNode> newTransformNodeForPerspective = createPerspectiveIfNeeded(object, localContext); RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = createScrollTranslationIfNeeded(object, localContext); updateOutOfFlowContext(object, localContext); if (newTransformNodeForPaintOffsetTranslation || newTransformNodeForTransform || newEffectNode || newTransformNodeForPerspective || newTransformNodeForScrollTranslation) { OwnPtr<ObjectPaintProperties> updatedPaintProperties = ObjectPaintProperties::create( newTransformNodeForPaintOffsetTranslation.release(), newTransformNodeForTransform.release(), newEffectNode.release(), newTransformNodeForPerspective.release(), newTransformNodeForScrollTranslation.release()); object.setObjectPaintProperties(updatedPaintProperties.release()); } else { object.clearObjectPaintProperties(); } // TODO(trchen): Walk subframes for LayoutFrame. // TODO(trchen): Implement SVG walk. if (object.isSVGRoot()) { return; } for (LayoutObject* child = object.slowFirstChild(); child; child = child->nextSibling()) { if (child->isText()) continue; walk(toLayoutBoxModelObject(*child), localContext); } }