| Summary: | NeverDestroyed objects should be constructable through std::initializer_list | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Zan Dobersek <zan> | ||||||
| Component: | Web Template Framework | Assignee: | Zan Dobersek <zan> | ||||||
| Status: | NEW --- | ||||||||
| Severity: | Normal | CC: | andersca, darin, jer.noble | ||||||
| Priority: | P2 | ||||||||
| Version: | 528+ (Nightly build) | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Bug Depends on: | 132345 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
|
Description
Zan Dobersek
2014-04-29 12:28:29 PDT
Created attachment 230401 [details]
Patch
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>. Comment on attachment 230401 [details]
Patch
Need the include.
Created attachment 230463 [details] Patch Still relies on the patch in bug #132345. 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. *** Bug 157452 has been marked as a duplicate of this bug. *** |