? visualweb/designer/cssengine/lib Index: visualweb/designer/src/org/netbeans/modules/visualweb/css2/CssBox.java =================================================================== RCS file: /cvs/visualweb/designer/src/org/netbeans/modules/visualweb/css2/CssBox.java,v retrieving revision 1.20 diff -u -u -r1.20 CssBox.java --- visualweb/designer/src/org/netbeans/modules/visualweb/css2/CssBox.java 6 Jun 2007 23:08:27 -0000 1.20 +++ visualweb/designer/src/org/netbeans/modules/visualweb/css2/CssBox.java 22 Jun 2007 18:07:10 -0000 @@ -2799,16 +2799,36 @@ // shifted due to floats??? return context.lineBox.getNextX(); } else { + if (boxType == BoxType.FIXED) { + // XXX #99918 For the fixed it is positioned against the viewport, + // so the 0 in current impl doesn't work, + return getStaticLeftForFixed(); + } + // Block boxes are placed exactly at the containing block // boundary so there's no distance return 0; } } + + /** XXX Very hacky way, the parent boxes are not fully initialized yet. */ + private int getStaticLeftForFixed() { + CssBox positionBox = getParent(); + int staticLeft = 0; + while (positionBox != null && positionBox != getPositionedBy()) { + int leftIncrement = positionBox.left; + if (leftIncrement != AUTO && leftIncrement != UNINITIALIZED) { + staticLeft += leftIncrement; + } + positionBox = positionBox.getPositionedBy(); + } + return staticLeft; + } /** Compute position of the current linebox - even if one hasn't * been started yet. */ - private int getLineBoxY(FormatContext context) { + private int getStaticLineBoxY(FormatContext context) { int py; if (context.lineBox != null) { @@ -3065,7 +3085,27 @@ * See also section 10.3.7 and the getStaticLeft() method. */ private int getStaticTop(FormatContext context) { - return getLineBoxY(context); +// if (boxType == BoxType.FIXED) { +// // XXX #99918 For the fixed it is positioned against the viewport, +// // so the 0 in current impl doesn't work, +// return getStaticTopForFixed(); +// } else { + return getStaticLineBoxY(context); +// } + } + + /** XXX Very hacky way, the parent boxes are not fully initialized yet. */ + private int getStaticTopForFixed() { + CssBox positionBox = getParent(); + int staticTop = 0; + while (positionBox != null && positionBox != getPositionedBy()) { + int topIncrement = positionBox.top; + if (topIncrement != AUTO && topIncrement != UNINITIALIZED) { + staticTop += topIncrement; + } + positionBox = positionBox.getPositionedBy(); + } + return staticTop; } protected int shrinkToFit(int availableWidth, FormatContext context) {