Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Issue 201293002: Add Traversal<*Element>::firstAncestor() API (Closed)

Created:
6 years, 9 months ago by Inactive
Modified:
6 years, 9 months ago
Reviewers:
esprehn, eseidel
CC:
blink-reviews, aboxhall, zoltan1, dsinclair, sof, eae+blinkwatch, leviw+renderwatch, dglazkov+blink, dmazzoni, adamk+blink_chromium.org, jchaffraix+rendering, bemjb+rendering_chromium.org, pdr., rwlbuis
Visibility:
Public.

Description

Add Traversal<*Element>::firstAncestor() API Add Traversal<*Element>::firstAncestor() API to traverse elements of a specific type. It is a common pattern in our code base to traverse the ancestors of a Node until we find an Element of a specific type. This new firstAncestor() API makes the code much simpler. This CL already makes use of the new API in several places. R=esprehn, eseidel BUG=346733 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=170211

Patch Set 1 #

Patch Set 2 : Slight clean up #

Total comments: 9

Patch Set 3 : Take feedback into consideration #

Patch Set 4 : Keep rendering change out #

Patch Set 5 : Rebase #

Patch Set 6 : Fix editing failures #

Total comments: 4

Patch Set 7 : Add firstAncestorOrSelf() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+82 lines, -116 lines) Patch
M Source/core/accessibility/AXNodeObject.cpp View 1 2 3 4 5 6 1 chunk +2 lines, -7 lines 0 comments Download
M Source/core/dom/ElementTraversal.h View 1 2 3 4 5 6 3 chunks +25 lines, -0 lines 0 comments Download
M Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 2 chunks +15 lines, -14 lines 0 comments Download
M Source/core/html/HTMLElement.cpp View 1 2 3 4 5 6 2 chunks +6 lines, -12 lines 0 comments Download
M Source/core/html/HTMLEmbedElement.cpp View 1 2 3 4 5 6 2 chunks +4 lines, -7 lines 0 comments Download
M Source/core/html/HTMLFormControlElement.cpp View 1 2 3 4 5 6 4 chunks +8 lines, -13 lines 0 comments Download
M Source/core/html/HTMLFrameElement.cpp View 2 chunks +1 line, -10 lines 0 comments Download
M Source/core/html/HTMLFrameSetElement.cpp View 1 2 3 4 1 chunk +10 lines, -14 lines 0 comments Download
M Source/core/html/HTMLObjectElement.cpp View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/html/HTMLOptGroupElement.cpp View 2 chunks +3 lines, -13 lines 0 comments Download
M Source/core/html/HTMLOptionElement.cpp View 1 chunk +2 lines, -13 lines 0 comments Download
M Source/core/html/parser/HTMLTreeBuilder.cpp View 1 2 3 4 5 6 3 chunks +4 lines, -11 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Inactive
https://codereview.chromium.org/201293002/diff/20001/Source/core/dom/ElementTraversal.h File Source/core/dom/ElementTraversal.h (right): https://codereview.chromium.org/201293002/diff/20001/Source/core/dom/ElementTraversal.h#newcode175 Source/core/dom/ElementTraversal.h:175: ContainerNode* ancestor = current.parentNode(); One idea that came to ...
6 years, 9 months ago (2014-03-15 23:50:18 UTC) #1
Inactive
ping review
6 years, 9 months ago (2014-03-19 13:49:34 UTC) #2
esprehn
https://codereview.chromium.org/201293002/diff/20001/Source/core/accessibility/AXNodeObject.cpp File Source/core/accessibility/AXNodeObject.cpp (right): https://codereview.chromium.org/201293002/diff/20001/Source/core/accessibility/AXNodeObject.cpp#newcode1484 Source/core/accessibility/AXNodeObject.cpp:1484: return isHTMLLabelElement(*node()) ? toHTMLLabelElement(node()) : Traversal<HTMLLabelElement>::firstAncestor(*node()); Can we use ...
6 years, 9 months ago (2014-03-21 07:58:33 UTC) #3
Inactive
PTAL https://codereview.chromium.org/201293002/diff/20001/Source/core/accessibility/AXNodeObject.cpp File Source/core/accessibility/AXNodeObject.cpp (right): https://codereview.chromium.org/201293002/diff/20001/Source/core/accessibility/AXNodeObject.cpp#newcode1484 Source/core/accessibility/AXNodeObject.cpp:1484: return isHTMLLabelElement(*node()) ? toHTMLLabelElement(node()) : Traversal<HTMLLabelElement>::firstAncestor(*node()); On 2014/03/21 ...
6 years, 9 months ago (2014-03-21 14:37:23 UTC) #4
Inactive
esprehn@, is this any better?
6 years, 9 months ago (2014-03-25 16:33:17 UTC) #5
esprehn
lgtm, but I think you want firstAncestorOrSelf() or something, you duplicate the self check so ...
6 years, 9 months ago (2014-03-27 13:28:16 UTC) #6
Inactive
https://codereview.chromium.org/201293002/diff/90002/Source/core/editing/FrameSelection.cpp File Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/201293002/diff/90002/Source/core/editing/FrameSelection.cpp#newcode1767 Source/core/editing/FrameSelection.cpp:1767: for (HTMLElement* element = Traversal<HTMLElement>::firstAncestor(*start); element; element = Traversal<HTMLElement>::firstAncestor(*element)) ...
6 years, 9 months ago (2014-03-27 13:32:05 UTC) #7
Inactive
I introduced an firstAncestorOrSelf() function, as advised. It does look much better. Please take another ...
6 years, 9 months ago (2014-03-27 15:42:37 UTC) #8
esprehn
lgtm
6 years, 9 months ago (2014-03-27 20:06:59 UTC) #9
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 9 months ago (2014-03-27 20:14:57 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/201293002/160001
6 years, 9 months ago (2014-03-27 20:15:04 UTC) #11
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-27 22:32:52 UTC) #12
commit-bot: I haz the power
Commit queue rejected this change because the description was changed between the time the change ...
6 years, 9 months ago (2014-03-27 22:32:52 UTC) #13
esprehn
The CQ bit was checked by esprehn@chromium.org
6 years, 9 months ago (2014-03-27 22:36:55 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/201293002/160001
6 years, 9 months ago (2014-03-27 22:38:10 UTC) #15
commit-bot: I haz the power
6 years, 9 months ago (2014-03-27 22:39:13 UTC) #16
Message was sent while issue was closed.
Change committed as 170211

Powered by Google App Engine
This is Rietveld 408576698