[webkit-reviews] review granted: [Bug 57276] Add an optimization to make line height and box placement calculations faster : [Attachment 87353] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 29 10:37:34 PDT 2011


Darin Adler <darin at apple.com> has granted Dave Hyatt <hyatt at apple.com>'s
request for review:
Bug 57276: Add an optimization to make line height and box placement
calculations faster
https://bugs.webkit.org/show_bug.cgi?id=57276

Attachment 87353: Patch
https://bugs.webkit.org/attachment.cgi?id=87353&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=87353&action=review

> Source/WebCore/rendering/InlineFlowBox.cpp:105
> +	   InlineFlowBox* childFlowBox = static_cast<InlineFlowBox*>(child);
> +	   if (childFlowBox->hasTextDescendants())
> +	       m_hasTextDescendants = true;

I don’t think the local variable here is helpful.

> Source/WebCore/rendering/InlineFlowBox.cpp:110
> +	   RenderStyle* parentStyle = renderer()->style(m_firstLine);
> +	   RenderStyle* childStyle = child->renderer()->style(m_firstLine);

Seems a shame to always compute these, since they are not always used.

> Source/WebCore/rendering/InlineFlowBox.cpp:111
> +	   bool changeResult = false;

Not sure what “change result” means in this name. Can you come up with a better
name.

> Source/WebCore/rendering/InlineFlowBox.cpp:521
> -	   if (curr->isInlineFlowBox())
> -	      
static_cast<InlineFlowBox*>(curr)->computeLogicalBoxHeights(rootBox,
maxPositionTop, maxPositionBottom, maxAscent, maxDescent,
> -									  
setMaxAscent, setMaxDescent, strictMode, textBoxDataMap,
> -									  
baselineType, verticalPositionCache);
> +	   if (inlineFlowBox)
> +	       inlineFlowBox->computeLogicalBoxHeights(rootBox, maxPositionTop,
maxPositionBottom, maxAscent, maxDescent,
> +						       setMaxAscent,
setMaxDescent, strictMode, textBoxDataMap,
> +						       baselineType,
verticalPositionCache);

It’s better to not line up the subsequent lines so you don’t have to move them
when making a change like this one. Also, there should be braces in this if
statement.


More information about the webkit-reviews mailing list