Bug 99254 - Make ScrollingTree an actual tree of nodes, and have it reflect the ScrollingStateTree
Summary: Make ScrollingTree an actual tree of nodes, and have it reflect the Scrolling...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Beth Dakin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-13 12:40 PDT by Beth Dakin
Modified: 2012-10-16 13:17 PDT (History)
6 users (show)

See Also:


Attachments
Patch (85.78 KB, patch)
2012-10-13 13:00 PDT, Beth Dakin
no flags Details | Formatted Diff | Diff
Patch (85.85 KB, patch)
2012-10-13 13:13 PDT, Beth Dakin
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Beth Dakin 2012-10-13 12:40:49 PDT
It's time to make the ScrollingTree capable of creating more than one node.
Comment 1 Beth Dakin 2012-10-13 13:00:42 PDT
Created attachment 168563 [details]
Patch
Comment 2 WebKit Review Bot 2012-10-13 13:02:49 PDT
Attachment 168563 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/page/scrolling/ScrollingTree.cpp:167:  Local variables should never be PassOwnPtr (see http://webkit.org/coding/RefPtr.html).  [readability/pass_ptr] [5]
Total errors found: 1 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Beth Dakin 2012-10-13 13:13:50 PDT
Created attachment 168564 [details]
Patch
Comment 4 Simon Fraser (smfr) 2012-10-16 10:33:56 PDT
Comment on attachment 168564 [details]
Patch

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

I'm starting to get nervous that none of this is covered by LayoutTests, and we've already had a couple of crashes in this code. I strongly suggest figuring out how to test this.

> Source/WebCore/page/scrolling/ScrollingTree.cpp:147
> +void ScrollingTree::updateNodesFromStateNode(ScrollingStateNode* stateNode)

I'd call this updateTreeFromStateNode to make it clearer that it consults stateNode and its children.

> Source/WebCore/page/scrolling/ScrollingTree.cpp:151
> +    HashMap<ScrollingNodeID, ScrollingTreeNode*>::const_iterator it = m_nodeMap.find(stateNode->scrollingNodeID());

You should make a typedef for HashMap<ScrollingNodeID, ScrollingTreeNode*>

> Source/WebCore/page/scrolling/ScrollingTree.cpp:175
> +            HashMap<ScrollingNodeID, ScrollingTreeNode*>::const_iterator it = m_nodeMap.find(stateNode->parent()->scrollingNodeID());
> +            if (it != m_nodeMap.end()) {
> +                ScrollingTreeNode* parent = it->value;
> +                newNode->setParent(parent);
> +                parent->appendChild(newNode.release());
> +            }

If we don't find the parent, what then? Is that an error? Should it assert?
Comment 5 Beth Dakin 2012-10-16 11:47:40 PDT
(In reply to comment #4)
> (From update of attachment 168564 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=168564&action=review
> 
> I'm starting to get nervous that none of this is covered by LayoutTests, and we've already had a couple of crashes in this code. I strongly suggest figuring out how to test this.
> 

Yes, I do agree. I know Tim has a goal to get threaded scrolling turned on on a bot, and I have been holding out for that…but I agree, with the crashes, that is turning into a dubious strategy. 

> > Source/WebCore/page/scrolling/ScrollingTree.cpp:147
> > +void ScrollingTree::updateNodesFromStateNode(ScrollingStateNode* stateNode)
> 
> I'd call this updateTreeFromStateNode to make it clearer that it consults stateNode and its children.
> 

Fixed.

> > Source/WebCore/page/scrolling/ScrollingTree.cpp:151
> > +    HashMap<ScrollingNodeID, ScrollingTreeNode*>::const_iterator it = m_nodeMap.find(stateNode->scrollingNodeID());
> 
> You should make a typedef for HashMap<ScrollingNodeID, ScrollingTreeNode*>
> 

Okay!

> > Source/WebCore/page/scrolling/ScrollingTree.cpp:175
> > +            HashMap<ScrollingNodeID, ScrollingTreeNode*>::const_iterator it = m_nodeMap.find(stateNode->parent()->scrollingNodeID());
> > +            if (it != m_nodeMap.end()) {
> > +                ScrollingTreeNode* parent = it->value;
> > +                newNode->setParent(parent);
> > +                parent->appendChild(newNode.release());
> > +            }
> 
> If we don't find the parent, what then? Is that an error? Should it assert?

Yes, I think an assert is appropriate. I will add one.
Comment 6 Beth Dakin 2012-10-16 13:17:10 PDT
Committed change: http://trac.webkit.org/changeset/131490