Bug 154336

Summary: [css-grid] Avoid duplicated calls to resolution code
Product: WebKit Reporter: Manuel Rego Casasnovas <rego>
Component: Layout and RenderingAssignee: Manuel Rego Casasnovas <rego>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, jfernandez, kondapallykalyan, rego, simon.fraser, svillar
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 153488    
Attachments:
Description Flags
Patch none

Description Manuel Rego Casasnovas 2016-02-17 05:39:53 PST
We're calling several times per item to the same methods in order to resolve the grid positions over an over.

Now that GridSpan doesn't have pointers anymore, we could just call the resolution code once and store it in the GridCoordinates cache.

This is a port from Blink of https://codereview.chromium.org/1465153004/
Comment 1 Manuel Rego Casasnovas 2016-02-17 05:46:51 PST
Created attachment 271550 [details]
Patch
Comment 2 Sergio Villar Senin 2016-02-23 08:58:25 PST
Comment on attachment 271550 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=271550&action=review

Nice change

> Source/WebCore/rendering/RenderGrid.cpp:1184
> +    for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {

Perhaps not for this patch but we should make OrderIterator a stl iterator-like class so that instead of first() and next() we have begin() and end() and we could do things like

for (auto child : m_orderIterator)
Comment 3 Manuel Rego Casasnovas 2016-02-23 09:30:03 PST
(In reply to comment #2)
> Comment on attachment 271550 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271550&action=review
> 
> Nice change

Thanks for the review!

> > Source/WebCore/rendering/RenderGrid.cpp:1184
> > +    for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
> 
> Perhaps not for this patch but we should make OrderIterator a stl
> iterator-like class so that instead of first() and next() we have begin()
> and end() and we could do things like
> 
> for (auto child : m_orderIterator)

Note down in bug #154590.
Comment 4 WebKit Commit Bot 2016-02-23 10:17:12 PST
Comment on attachment 271550 [details]
Patch

Clearing flags on attachment: 271550

Committed r196983: <http://trac.webkit.org/changeset/196983>
Comment 5 WebKit Commit Bot 2016-02-23 10:17:16 PST
All reviewed patches have been landed.  Closing bug.