WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
132348
NeverDestroyed objects should be constructable through std::initializer_list
https://bugs.webkit.org/show_bug.cgi?id=132348
Summary
NeverDestroyed objects should be constructable through std::initializer_list
Zan Dobersek
Reported
2014-04-29 12:28:29 PDT
NeverDestroyed objects should be constructable through std::initializer_list
Attachments
Patch
(9.73 KB, patch)
2014-04-29 12:35 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(9.92 KB, patch)
2014-04-29 23:45 PDT
,
Zan Dobersek
darin
: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2014-04-29 12:35:57 PDT
Created
attachment 230401
[details]
Patch
Darin Adler
Comment 2
2014-04-29 15:08:32 PDT
Comment on
attachment 230401
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=230401&action=review
> Source/WTF/wtf/NeverDestroyed.h:57 > + template<typename U> > + NeverDestroyed(std::initializer_list<U> list)
This header needs to include <initializer_list>.
Darin Adler
Comment 3
2014-04-29 16:02:46 PDT
Comment on
attachment 230401
[details]
Patch Need the include.
Zan Dobersek
Comment 4
2014-04-29 23:45:06 PDT
Created
attachment 230463
[details]
Patch Still relies on the patch in
bug #132345
.
Darin Adler
Comment 5
2014-04-30 09:20:27 PDT
Comment on
attachment 230463
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=230463&action=review
> Source/WebCore/editing/EditingStyle.cpp:754 > + static NeverDestroyed<Vector<std::unique_ptr<HTMLElementEquivalent>>> equivalents = { > + std::make_unique<HTMLElementEquivalent>(CSSPropertyFontWeight, CSSValueBold, HTMLNames::bTag), > + std::make_unique<HTMLElementEquivalent>(CSSPropertyFontWeight, CSSValueBold, HTMLNames::strongTag), > + std::make_unique<HTMLElementEquivalent>(CSSPropertyVerticalAlign, CSSValueSub, HTMLNames::subTag), > + std::make_unique<HTMLElementEquivalent>(CSSPropertyVerticalAlign, CSSValueSuper, HTMLNames::supTag), > + std::make_unique<HTMLElementEquivalent>(CSSPropertyFontStyle, CSSValueItalic, HTMLNames::iTag), > + std::make_unique<HTMLElementEquivalent>(CSSPropertyFontStyle, CSSValueItalic, HTMLNames::emTag), > + std::unique_ptr<HTMLElementEquivalent>(std::make_unique<HTMLTextDecorationEquivalent>(CSSValueUnderline, HTMLNames::uTag)), > + std::unique_ptr<HTMLElementEquivalent>(std::make_unique<HTMLTextDecorationEquivalent>(CSSValueLineThrough, HTMLNames::sTag)), > + std::unique_ptr<HTMLElementEquivalent>(std::make_unique<HTMLTextDecorationEquivalent>(CSSValueLineThrough, HTMLNames::strikeTag)), > + };
Anders has suggested that we not make initializer lists support move semantics--I think he’s right and so we should not make this change here. The explicit cast to a different type of unique_ptr is also quite ugly. Maybe there’s some other improvement we can make here, but we shouldn’t do exactly this.
> Source/WebCore/editing/EditingStyle.cpp:787 > + std::make_unique<HTMLAttributeEquivalent>(CSSPropertyColor, HTMLNames::fontTag, HTMLNames::colorAttr), > + std::make_unique<HTMLAttributeEquivalent>(CSSPropertyFontFamily, HTMLNames::fontTag, HTMLNames::faceAttr), > + std::unique_ptr<HTMLAttributeEquivalent>(std::make_unique<HTMLFontSizeEquivalent>()), > + std::unique_ptr<HTMLAttributeEquivalent>(std::make_unique<HTMLAttributeEquivalent>(CSSPropertyDirection, HTMLNames::dirAttr)), > + std::unique_ptr<HTMLAttributeEquivalent>(std::make_unique<HTMLAttributeEquivalent>(CSSPropertyUnicodeBidi, HTMLNames::dirAttr)),
Ditto.
Darin Adler
Comment 6
2017-07-21 20:23:35 PDT
***
Bug 157452
has been marked as a duplicate of this bug. ***
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