Bug 57276 - Add an optimization to make line height and box placement calculations faster
Summary: Add an optimization to make line height and box placement calculations faster
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 15:19 PDT by Dave Hyatt
Modified: 2011-06-18 12:34 PDT (History)
4 users (show)

See Also:


Attachments
Patch (17.22 KB, patch)
2011-03-28 15:20 PDT, Dave Hyatt
no flags Details | Formatted Diff | Diff
Patch (20.72 KB, patch)
2011-03-29 10:01 PDT, Dave Hyatt
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hyatt 2011-03-28 15:19:57 PDT
Add an optimization to make line height and box placement calculations faster.  Basically try to avoid spending as much time in computeLogicalBoxHeights and placeBoxesInBlockDirection.
Comment 1 Dave Hyatt 2011-03-28 15:20:17 PDT
Created attachment 87219 [details]
Patch
Comment 2 Dave Hyatt 2011-03-29 10:01:46 PDT
Created attachment 87353 [details]
Patch
Comment 3 Darin Adler 2011-03-29 10:37:34 PDT
Comment on attachment 87353 [details]
Patch

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.