Changeset 266980 in webkit
- Timestamp:
- Sep 12, 2020 3:02:54 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r266973 r266980 1 2020-09-12 Simon Fraser <simon.fraser@apple.com> 2 3 Convert TextStream::FormattingFlags to an OptionSet<> 4 https://bugs.webkit.org/show_bug.cgi?id=216443 5 6 Reviewed by Darin Adler. 7 8 Use an OptionSet<> for FormattingFlags. 9 10 * wtf/text/TextStream.h: 11 (WTF::TextStream::TextStream): 12 (WTF::TextStream::formattingFlags const): 13 (WTF::TextStream::setFormattingFlags): 14 (WTF::TextStream::hasFormattingFlag const): 15 1 16 2020-09-11 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/Source/WTF/wtf/text/TextStream.h
r259165 r266980 28 28 #include <wtf/Forward.h> 29 29 #include <wtf/Markable.h> 30 #include <wtf/OptionSet.h> 30 31 #include <wtf/Optional.h> 31 32 #include <wtf/WeakPtr.h> … … 45 46 }; 46 47 47 enum Formatting{48 enum class Formatting : uint8_t { 48 49 SVGStyleRect = 1 << 0, // "at (0,0) size 10x10" 49 50 NumberRespectingIntegers = 1 << 1, 50 51 LayoutUnitsAsIntegers = 1 << 2, 51 52 }; 52 53 using FormattingFlags = unsigned; 54 53 55 54 enum class LineMode { SingleLine, MultipleLine }; 56 TextStream(LineMode lineMode = LineMode::MultipleLine, FormattingFlags formattingFlags = 0)55 TextStream(LineMode lineMode = LineMode::MultipleLine, OptionSet<Formatting> formattingFlags = { }) 57 56 : m_formattingFlags(formattingFlags) 58 57 , m_multiLineMode(lineMode == LineMode::MultipleLine) … … 81 80 #endif 82 81 83 FormattingFlagsformattingFlags() const { return m_formattingFlags; }84 void setFormattingFlags( FormattingFlagsflags) { m_formattingFlags = flags; }85 86 bool hasFormattingFlag(Formatting flag) const { return m_formattingFlags & flag; }82 OptionSet<Formatting> formattingFlags() const { return m_formattingFlags; } 83 void setFormattingFlags(OptionSet<Formatting> flags) { m_formattingFlags = flags; } 84 85 bool hasFormattingFlag(Formatting flag) const { return m_formattingFlags.contains(flag); } 87 86 88 87 template<typename T> … … 167 166 private: 168 167 StringBuilder m_text; 169 FormattingFlags m_formattingFlags { 0 };170 168 int m_indent { 0 }; 169 OptionSet<Formatting> m_formattingFlags; 171 170 bool m_multiLineMode { true }; 172 171 }; -
trunk/Source/WebCore/ChangeLog
r266979 r266980 1 2020-09-12 Simon Fraser <simon.fraser@apple.com> 2 3 Convert TextStream::FormattingFlags to an OptionSet<> 4 https://bugs.webkit.org/show_bug.cgi?id=216443 5 6 Reviewed by Darin Adler. 7 8 Use an OptionSet<> for FormattingFlags. 9 10 * rendering/RenderTreeAsText.cpp: 11 (WebCore::externalRepresentation): 12 (WebCore::counterValueForElement): 13 1 14 2020-09-12 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Source/WebCore/rendering/RenderTreeAsText.cpp
r266691 r266980 806 806 static String externalRepresentation(RenderBox& renderer, OptionSet<RenderAsTextFlag> behavior) 807 807 { 808 TextStream ts(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect | TextStream::Formatting::LayoutUnitsAsIntegers);808 TextStream ts(TextStream::LineMode::MultipleLine, { TextStream::Formatting::SVGStyleRect, TextStream::Formatting::LayoutUnitsAsIntegers }); 809 809 if (!renderer.hasLayer()) 810 810 return ts.release(); … … 882 882 RefPtr<Element> elementRef(element); 883 883 element->document().updateLayout(); 884 TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect | TextStream::Formatting::LayoutUnitsAsIntegers);884 TextStream stream(TextStream::LineMode::MultipleLine, { TextStream::Formatting::SVGStyleRect, TextStream::Formatting::LayoutUnitsAsIntegers }); 885 885 bool isFirstCounter = true; 886 886 // The counter renderers should be children of :before or :after pseudo-elements.
Note: See TracChangeset
for help on using the changeset viewer.