WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
120563
Add element ancestor iterator
https://bugs.webkit.org/show_bug.cgi?id=120563
Summary
Add element ancestor iterator
Antti Koivisto
Reported
2013-08-31 12:00:42 PDT
rniwa wanted one
Attachments
patch
(28.91 KB, patch)
2013-08-31 12:12 PDT
,
Antti Koivisto
kling
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2013-08-31 12:12:02 PDT
Created
attachment 210201
[details]
patch
Andreas Kling
Comment 2
2013-08-31 13:09:39 PDT
Comment on
attachment 210201
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=210201&action=review
> Source/WebCore/ChangeLog:22 > + auto lineage = elementLineage(this); > + for (auto it = lineage.begin(), end = lineage.end(); it != end; ++it) { > + Element& element = *it; > + ...
Poetic.
Ryosuke Niwa
Comment 3
2013-08-31 15:53:03 PDT
Can we add a version that optionally stops when it hits a node with a certain condition? (Let it take a function pointer or node's member function? e.g. A lot of editing code needs to stop ancestor search once it hits an editing boundary.
Antti Koivisto
Comment 4
2013-09-01 00:53:53 PDT
I don't think anything else than actual iteration belong to iterators. They are stl compatible and you can add your own helpers. With stl you can do things like: auto lineage = elementLineage(this); auto nearestEditable = std::find_if(lineage.begin(), lineage.end(), [](Element& e) { return e.rendererIsEditable(); } );
Antti Koivisto
Comment 5
2013-09-01 03:45:38 PDT
You could have *Adapter class that give ancestor ranges the editing code wants, something like: auto editableAncestors = ancestorsWithinEditableBounds(this);
Antti Koivisto
Comment 6
2013-09-01 03:47:56 PDT
https://trac.webkit.org/r154940
Dropped Node* version of the interface functions in favour of Element only. Call sites should be tightened as needed. Added lineageOfType<>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug