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

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed)

Created:
6 years, 4 months ago by Inactive
Modified:
6 years, 4 months ago
Reviewers:
esprehn, adamk
CC:
aandrey+blink_chromium.org, darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, caseq+blink_chromium.org, devtools-reviews_chromium.org, dglazkov+blink, eae+blinkwatch, ed+blinkwatch_opera.com, eseidel, eustas+blink_chromium.org, loislo+blink_chromium.org, lushnikov+blink_chromium.org, malch+blink_chromium.org, paulirish+reviews_chromium.org, pfeldman+blink_chromium.org, rwlbuis, rune+blink, sergeyv+blink_chromium.org, sof, vsevik+blink_chromium.org, yurys+blink_chromium.org
Project:
blink
Visibility:
Public.

Description

Make Element::attributes() less error-prone and simplify call sites Make Element::attributes() less error-prone by: - Having it return an empty AttributeCollection if ElementData() is null so that the callers no longer have to call hasAttributes() to know if they can call Element::attributes(). - Call synchronizeAllAttributes() in attributes() as callers no longer have to call hasAttributes() before calling attributes(). This CL also adds an Element::attributesWithoutUpdate() getter for call sites where we do not want to synchronize all attributes (e.g. no attribute synchronization or single attribute synchronization). This CL also drops the Element::hasAttributesWithoutUpdate() as there are no remaining callers. This simplifies the call sites and makes Element::attributes() less error prone. R=esprehn@chromium.org, adamk@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=179526

Patch Set 1 #

Patch Set 2 : inline hasAttributes() #

Patch Set 3 : Keep synchronizeAllAttributes() in hasAttributes() #

Total comments: 18

Patch Set 4 : Take feedback into consideration #

Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, -195 lines) Patch
M Source/core/css/SelectorChecker.h View 1 chunk +1 line, -3 lines 0 comments Download
M Source/core/css/SelectorChecker.cpp View 1 chunk +1 line, -4 lines 0 comments Download
M Source/core/dom/AttributeCollection.h View 1 chunk +4 lines, -0 lines 0 comments Download
M Source/core/dom/DatasetDOMStringMap.cpp View 3 chunks +0 lines, -9 lines 0 comments Download
M Source/core/dom/Element.h View 1 2 3 4 chunks +21 lines, -11 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 5 chunks +8 lines, -16 lines 0 comments Download
M Source/core/dom/NamedNodeMap.cpp View 4 chunks +2 lines, -6 lines 0 comments Download
M Source/core/dom/Node.cpp View 1 2 3 3 chunks +18 lines, -22 lines 0 comments Download
M Source/core/dom/PresentationAttributeStyle.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/editing/ApplyStyleCommand.cpp View 2 chunks +4 lines, -3 lines 0 comments Download
M Source/core/editing/EditingStyle.cpp View 2 chunks +4 lines, -3 lines 0 comments Download
M Source/core/editing/MarkupAccumulator.cpp View 1 2 3 1 chunk +4 lines, -6 lines 0 comments Download
M Source/core/editing/markup.cpp View 1 2 3 2 chunks +7 lines, -11 lines 0 comments Download
M Source/core/html/HTMLEmbedElement.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M Source/core/html/HTMLInputElement.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLObjectElement.cpp View 1 chunk +7 lines, -9 lines 0 comments Download
M Source/core/html/parser/HTMLConstructionSite.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/inspector/DOMPatchSupport.cpp View 2 chunks +11 lines, -15 lines 0 comments Download
M Source/core/inspector/InspectorDOMAgent.cpp View 3 chunks +2 lines, -7 lines 0 comments Download
M Source/core/page/PageSerializer.cpp View 1 2 3 1 chunk +5 lines, -7 lines 0 comments Download
M Source/core/xml/XPathFunctions.cpp View 1 chunk +1 line, -2 lines 0 comments Download
M Source/core/xml/XPathNodeSet.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M Source/core/xml/XPathStep.cpp View 1 chunk +0 lines, -3 lines 0 comments Download
M Source/core/xml/parser/XMLDocumentParser.cpp View 1 chunk +7 lines, -9 lines 0 comments Download
M Source/web/WebPageSerializerImpl.cpp View 1 chunk +38 lines, -39 lines 0 comments Download

Messages

Total messages: 27 (0 generated)
Inactive
6 years, 4 months ago (2014-08-03 18:31:33 UTC) #1
adamk
From the CL description, I'm wondering how you figured out where to replace calls to ...
6 years, 4 months ago (2014-08-04 18:22:32 UTC) #2
Inactive
On 2014/08/04 18:22:32, adamk wrote: > From the CL description, I'm wondering how you figured ...
6 years, 4 months ago (2014-08-04 18:28:15 UTC) #3
Inactive
Basically, the biggest risk is if I replace hasAttributes()+attributes() or synchronizeAllAttributes()+attributes() by attributesWithoutUpdate() because this ...
6 years, 4 months ago (2014-08-04 18:38:11 UTC) #4
adamk
I like getting rid of the hasAttributes() calls everywhere, but I'm a little worried about ...
6 years, 4 months ago (2014-08-04 18:54:35 UTC) #5
Inactive
https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp File Source/core/dom/Element.cpp (right): https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp#newcode2490 Source/core/dom/Element.cpp:2490: if (!attrNodes || attrNodes->isEmpty()) On 2014/08/04 18:54:34, adamk wrote: ...
6 years, 4 months ago (2014-08-04 19:09:47 UTC) #6
adamk
https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp File Source/core/dom/Element.cpp (right): https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp#newcode2963 Source/core/dom/Element.cpp:2963: AttributeCollection attributes = elementData()->attributes(); The more I think about ...
6 years, 4 months ago (2014-08-04 19:29:52 UTC) #7
Inactive
https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp File Source/core/dom/Element.cpp (right): https://codereview.chromium.org/436603003/diff/40001/Source/core/dom/Element.cpp#newcode2490 Source/core/dom/Element.cpp:2490: if (!attrNodes || attrNodes->isEmpty()) On 2014/08/04 19:09:46, Chris Dumez ...
6 years, 4 months ago (2014-08-04 19:39:52 UTC) #8
adamk
lgtm
6 years, 4 months ago (2014-08-04 19:47:44 UTC) #9
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 4 months ago (2014-08-04 20:00:43 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/436603003/60001
6 years, 4 months ago (2014-08-04 20:01:26 UTC) #11
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink ...
6 years, 4 months ago (2014-08-04 20:44:31 UTC) #12
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-04 21:32:35 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/20627)
6 years, 4 months ago (2014-08-04 21:32:37 UTC) #14
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 4 months ago (2014-08-04 23:30:40 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/436603003/60001
6 years, 4 months ago (2014-08-04 23:31:55 UTC) #16
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink ...
6 years, 4 months ago (2014-08-05 00:13:06 UTC) #17
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-05 00:58:17 UTC) #18
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/20685)
6 years, 4 months ago (2014-08-05 00:58:18 UTC) #19
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 4 months ago (2014-08-05 13:04:37 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/436603003/60001
6 years, 4 months ago (2014-08-05 13:09:36 UTC) #21
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink ...
6 years, 4 months ago (2014-08-05 14:32:03 UTC) #22
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-05 15:57:03 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/20964)
6 years, 4 months ago (2014-08-05 15:57:04 UTC) #24
Inactive
The CQ bit was checked by ch.dumez@samsung.com
6 years, 4 months ago (2014-08-05 19:07:32 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/436603003/60001
6 years, 4 months ago (2014-08-05 19:09:34 UTC) #26
commit-bot: I haz the power
6 years, 4 months ago (2014-08-05 21:10:02 UTC) #27
Message was sent while issue was closed.
Change committed as 179526

Powered by Google App Engine
This is Rietveld 408576698