# o-content-size

Copyright © 1995-2007 Opera Software AS. All rights reserved. This file is part of the Opera web browser. It may not be distributed under any circumstances.

## About this document

Like the flexroot document in the same directory, this document aims for specifying how things should work. We try not to deal with implementation details or bugs in Opera more than necessary here.

## Introduction

`o-content-size` is a opera extension to with width and height properties. It is primarily aimed at iframes and the gist of it is to make the size iframes adapt the size to its embedded document.

## Related works

Mozilla has patches that does something similar.

## Behavior

### Propagation of information between documents

The only information propagated from the parent document to the embedded document in the initial width, if set in the parent document. The default width is zero.

The width and height of the embedded document is propagated to the element that embeds the document.

## Behavior

The size of the initial containing block of an embedded document is times 0. By having the height set to 0 initially, we avoid any dual dependencies between parent document and embedded document.

When the layout of the embedded document has been completed, the parent document should adjust the size of the element that referenced the embedded document. It should use the overflow bounding box of the root element in the embedded document to determine the size. This means that floats, fixed and absolute positioned elements, and other overflowing children, are included.

## Application to non-documents

The `o-content-size` property value only gives special behavior to object and iframe elements that link to document content (e.g. html or text files). For other content, like images, `o-content-size` behaves as the value 'auto'.

For embedded SVG documents, `o-content-size` is redundant since 'auto' for width and height is defined to take the SVG size into account when deciding the size.

## Discussion

### Alternative to `o-content-size`

It has been raised by Morten (mstensho@opera.com) that it would probably be logical to move the -`o-content-size` values out of the width and height properties. Instead, let them be values of a special property whose sole purpose is to let iframes take their default from their embedded document instead of defaulting to the standard 300x150 size.

### Security issue

There is also some discussion about security implications of adjusting the size of an iframe according to its content since information (the height) leaks from one document to the other.