I implement a CSS3 flexible box layout module as defined by the W3C, which is similar to the Mozilla Mosaic Model for xul . Although these standards determine how the model should behave, they do not provide any details on how they should be implemented.
Parts of the model that interests me:
- Boxes have a width and a height.
- Boxes may contain other fields.
- Container boxes (parent boxes) are responsible for sizing and placing the boxes they contain (child boxes).
- Boxes have an orientation, which can be horizontal or vertical. Orientation determines how child boxes are arranged and resized.
- Children's boxes can be flexible or inflexible. If the child drawer is not flexible, it is drawn with the size specified in the width and height options. If it is flexible, then it changes according to the available space in the parent container.
- Flexibility compared to other child drawers in one container, boxes with more flexibility change more than boxes with less flexibility.
- Children's drawers may be limited to a minimum or maximum size. If the child box is flexible, the parent field will never resize below the minimum size or above the maximum size.
Features 1-5 can be implemented quite effectively. Feature 6 is problematic since the most efficient algorithm I can come up with is quite naive. The algorithm works as follows:
3 - . , , , , , , . , .
, , , (XUL,.Net, Flex ..).