<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 5, 2010, at 7:33 PM, Eric Mader wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 24, 2010, at 8:02 PM, David Hyatt wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>This is a tough problem. &nbsp;It seems like you have to get involved in the line layout code e.g., findNextLineBreak in order to really do the right thing. &nbsp;findNextLineBreak uses an iterator that walks the objects, so it's easier to tell what text came before you and what text comes after you. &nbsp;You can also tell whether or not that text will even fit on the line and possibly do the margin hacking there.</div></span></blockquote><br></div><div>I just did a prototype that checks for a RenderRubyRun in the isReplaced() code inside findNextLineBreak and calls a method on the RenderRubyRun that takes the last and the next object and sets negative margins by calling setMarginLeft() and setMarginRight(). I stepped through this code and it computes the correct margins, but the margins don't seem to take - the ruby doesn't overlap the surrounding text.</div><div><br></div><div>Guessing that some other code is resetting the margins, I modified the code to cache the computed margins in the RenderRubyRun object and return the cached values through subclassed marginLeft() and marginRight() methods. With this change, the ruby displays as I would expect.</div></div></blockquote><br></div><div>It's probably RenderBlockLineLayout line 348 getting you in trouble (<span class="Apple-style-span" style="font-family: Menlo; font-size: 11px; ">computeInlineDirectionPositionsForLine)</span>. &nbsp;computeLogicalWidth is called again, and that will recompute the left/right margins and blow away the changes you made to them. &nbsp;I have no idea why that call is there. &nbsp;It should not be necessary, but maybe there's something subtle I'm missing. &nbsp;You could try removing it, and see if that fixes the problem (it should).</div><div><br></div><div>dave</div><div>(<a href="mailto:hyatt@apple.com">hyatt@apple.com</a>)</div><div><br></div><div><br></div><div><br></div></body></html>