WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
157706
Update the list of elements attachShadow is allowed
https://bugs.webkit.org/show_bug.cgi?id=157706
Summary
Update the list of elements attachShadow is allowed
Ryosuke Niwa
Reported
2016-05-13 22:11:16 PDT
The spec has updated the list of element on which attachShadow is allowed. We should update our implementation accordingly to avoid the future compatibility issues.
Attachments
Patch
(28.11 KB, patch)
2016-06-02 01:50 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed GTK/Windows builds
(28.84 KB, patch)
2016-06-03 21:26 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Another build fix attempt
(28.62 KB, patch)
2016-06-03 22:59 PDT
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2016-05-20 02:02:44 PDT
***
Bug 157928
has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 2
2016-06-02 01:50:36 PDT
Created
attachment 280320
[details]
Patch
WebKit Commit Bot
Comment 3
2016-06-02 01:52:30 PDT
Attachment 280320
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/Document.cpp:1129: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 4
2016-06-03 21:26:58 PDT
Created
attachment 280507
[details]
Fixed GTK/Windows builds
WebKit Commit Bot
Comment 5
2016-06-03 21:29:56 PDT
Attachment 280507
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/Document.cpp:1129: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 6
2016-06-03 22:59:33 PDT
Created
attachment 280509
[details]
Another build fix attempt
WebKit Commit Bot
Comment 7
2016-06-03 23:02:04 PDT
Attachment 280509
[details]
did not pass style-queue: ERROR: Source/WebCore/dom/Document.cpp:1129: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 8
2016-06-04 12:34:57 PDT
Comment on
attachment 280509
[details]
Another build fix attempt View in context:
https://bugs.webkit.org/attachment.cgi?id=280509&action=review
Did you change all the headers that you touched to pragma once? Would be nice to do that.
> Source/WebCore/dom/Document.cpp:1124 > + for (unsigned i = 0; i < localName.length(); i++) { > + if (isASCIIUpper(localName[i])) > + return CustomElementNameValidationStatus::ContainsUpperCase; > + if (localName[i] == '-') > + containsHyphen = true; > + }
More efficient not to call length() over and over again and index into the string over and over again. Could use a couple local variables, or alternatively something like the StringView::codeUnits() iterator.
> Source/WebCore/dom/Document.cpp:1138 > +#if ENABLE(MATHML) > + || localName == MathMLNames::annotation_xmlTag.localName() > +#endif
Seems like we might want to check this even if MathML was not turned on.
> Source/WebCore/dom/Element.cpp:1714 > + static NeverDestroyed<HashSet<AtomicString>> tagNames; > + if (tagNames.get().isEmpty()) { > + const AtomicString nameList[] = { > + articleTag.localName(), > + asideTag.localName(), > + blockquoteTag.localName(), > + bodyTag.localName(), > + divTag.localName(), > + footerTag.localName(), > + h1Tag.localName(), > + h2Tag.localName(), > + h3Tag.localName(), > + h4Tag.localName(), > + h5Tag.localName(), > + h6Tag.localName(), > + headerTag.localName(), > + navTag.localName(), > + pTag.localName(), > + sectionTag.localName(), > + spanTag.localName() > + }; > + for (auto& name : nameList) > + tagNames.get().add(name); > + }
This is not the best idiom, because we end up checking if the set is empty every time. Also, we don’t want an array of reference counted local names. Instead we want an array of tags, ideally something that can be initialized without any code running. Something like this: static NeverDestroyed<HashSet<AtomicString>> tagNames = [] { HashSet<AtomicString> set; const HTMLQualifiedName& const tagList[] = { articleTag, ... }; for (auto& tag : tagList) set.add(tag()); return set; };
> Source/WebCore/dom/Element.cpp:1717 > + if (element.namespaceURI() != xhtmlNamespaceURI) > + return false;
I believe it’s more efficient to just check is<HTMLElement>, and I am pretty sure it accomplishes the same thing.
> Source/WebCore/dom/Element.cpp:1719 > + return tagNames.get().contains(element.localName()) || Document::validateCustomElementName(element.localName()) == CustomElementNameValidationStatus::Valid;
I suggest putting element.localName() into a local variable.
Darin Adler
Comment 9
2016-06-04 12:35:44 PDT
(In reply to
comment #8
)
> const HTMLQualifiedName& const tagList[] = {
Actually I think this: static const HTMLQualifiedName& const tagList[] = {
Ryosuke Niwa
Comment 10
2016-06-06 21:00:44 PDT
Committed
r201739
: <
http://trac.webkit.org/changeset/201739
>
Radar WebKit Bug Importer
Comment 11
2016-06-06 21:10:30 PDT
<
rdar://problem/26666315
>
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