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

Issue 206743005: Use Traversal<HTMLElement> API in HTMLTableRowsCollection (Closed)

Created:
6 years, 9 months ago by Inactive
Modified:
6 years, 9 months ago
CC:
blink-reviews, dglazkov+blink, adamk+blink_chromium.org
Visibility:
Public.

Description

Use Traversal<HTMLElement> API in HTMLTableRowsCollection Use Traversal<HTMLElement> API in HTMLTableRowsCollection for clarity and performance: - It makes rowAfter() and lastRow() more consistent - It makes it clear we are only interested in HTMLElements - We can use hadLocalName() instead of hasTagName() as we only iterate through HTML elements - We can use the slightly faster lastChild(const ContainerNode&) overload in lastRow() now that we know at compile time the argument is not merely a generic Node. R=esprehn, adamk BUG=346733 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=170120

Patch Set 1 #

Patch Set 2 : Use const HTMLElement in template specialization for consistency #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -30 lines) Patch
M Source/core/html/HTMLElement.h View 1 1 chunk +2 lines, -1 line 1 comment Download
M Source/core/html/HTMLTableRowsCollection.cpp View 3 chunks +23 lines, -29 lines 5 comments Download

Messages

Total messages: 9 (0 generated)
Inactive
https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLElement.h File Source/core/html/HTMLElement.h (right): https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLElement.h#newcode131 Source/core/html/HTMLElement.h:131: template <> inline bool isElementOfType<const HTMLElement>(const Node& node) { ...
6 years, 9 months ago (2014-03-20 22:15:24 UTC) #1
adamk
lgtm
6 years, 9 months ago (2014-03-24 17:40:30 UTC) #2
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 9 months ago (2014-03-27 01:37:21 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/206743005/20001
6 years, 9 months ago (2014-03-27 01:37:26 UTC) #4
commit-bot: I haz the power
Change committed as 170120
6 years, 9 months ago (2014-03-27 02:07:38 UTC) #5
abarth-chromium
neat
6 years, 9 months ago (2014-03-27 03:14:50 UTC) #6
esprehn
https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTableRowsCollection.cpp File Source/core/html/HTMLTableRowsCollection.cpp (right): https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTableRowsCollection.cpp#newcode85 Source/core/html/HTMLTableRowsCollection.cpp:85: for (; child; child = Traversal<HTMLElement>::nextSibling(*child)) { This isn't ...
6 years, 9 months ago (2014-03-27 13:35:49 UTC) #7
Inactive
https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTableRowsCollection.cpp File Source/core/html/HTMLTableRowsCollection.cpp (right): https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTableRowsCollection.cpp#newcode85 Source/core/html/HTMLTableRowsCollection.cpp:85: for (; child; child = Traversal<HTMLElement>::nextSibling(*child)) { On 2014/03/27 ...
6 years, 9 months ago (2014-03-27 13:57:57 UTC) #8
Inactive
6 years, 9 months ago (2014-03-27 14:39:53 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTab...
File Source/core/html/HTMLTableRowsCollection.cpp (right):

https://codereview.chromium.org/206743005/diff/20001/Source/core/html/HTMLTab...
Source/core/html/HTMLTableRowsCollection.cpp:85: for (; child; child =
Traversal<HTMLElement>::nextSibling(*child)) {
On 2014/03/27 13:35:49, esprehn wrote:
> This isn't equivalent to the original code. If you had:
> 
> 
>   <non-html>
>      <span></span>
>      <tr id="1">
>      </tr>
>   </non-html>
>   <tr id="2"></td>
> 
> You return 1, it used to return 2. This might be okay, but you are changing
> behavior.

Actually, the new code returns 2 as well since I am calling
Traversal<HTMLElement>::firstChild(table) and not
Traversal<HTMLElement>::firstWithin(table). The new code will *not* traverse
descendants, only children.

Let me know if this is me misunderstanding your example.

Powered by Google App Engine
This is Rietveld 408576698