Changeset 234811 in webkit
- Timestamp:
- Aug 13, 2018 12:16:10 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r234810 r234811 1 2018-08-13 Antti Koivisto <antti@apple.com> 2 3 Meaning of OptionSet::contains is unclear when used with OptionSet argument 4 https://bugs.webkit.org/show_bug.cgi?id=188501 5 6 Reviewed by Anders Carlsson. 7 8 The existing behavior is "contains any" but it is not very clear from the name. 9 10 * wtf/OptionSet.h: 11 (WTF::OptionSet::contains const): 12 13 This is now for testing a single option only. 14 15 (WTF::OptionSet::containsAny const): 16 (WTF::OptionSet::containsAll const): 17 18 Add separate functions for OptionSet argument. 19 1 20 2018-08-13 Commit Queue <commit-queue@webkit.org> 2 21 -
trunk/Source/WTF/wtf/OptionSet.h
r234768 r234811 97 97 constexpr explicit operator bool() { return !isEmpty(); } 98 98 99 constexpr bool contains( OptionSet optionSet) const99 constexpr bool contains(T option) const 100 100 { 101 return m_storage & optionSet.m_storage; 101 return containsAny({ option }); 102 } 103 104 constexpr bool containsAny(OptionSet optionSet) const 105 { 106 return !!(*this & optionSet); 107 } 108 109 constexpr bool containsAll(OptionSet optionSet) const 110 { 111 return (*this & optionSet) == optionSet; 102 112 } 103 113 -
trunk/Source/WebCore/ChangeLog
r234810 r234811 1 2018-08-13 Antti Koivisto <antti@apple.com> 2 3 Meaning of OptionSet::contains is unclear when used with OptionSet argument 4 https://bugs.webkit.org/show_bug.cgi?id=188501 5 6 Reviewed by Anders Carlsson. 7 8 * dom/DocumentMarkerController.cpp: 9 (WebCore::DocumentMarkerController::possiblyHasMarkers): 10 * dom/DocumentMarkerController.h: 11 (WebCore::DocumentMarkerController::hasMarkers const): 12 * platform/FileSystem.h: 13 (WebCore::FileSystem::openAndLockFile): 14 * rendering/RenderElement.cpp: 15 (WebCore::RenderElement::selectionColor const): 16 * rendering/RenderLayer.cpp: 17 (WebCore::RenderLayer::paintForegroundForFragments): 18 1 19 2018-08-13 Commit Queue <commit-queue@webkit.org> 2 20 -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r230211 r234811 45 45 inline bool DocumentMarkerController::possiblyHasMarkers(OptionSet<DocumentMarker::MarkerType> types) 46 46 { 47 return m_possiblyExistingMarkerTypes.contains (types);47 return m_possiblyExistingMarkerTypes.containsAny(types); 48 48 } 49 49 -
trunk/Source/WebCore/dom/DocumentMarkerController.h
r219597 r234811 64 64 bool hasMarkers() const 65 65 { 66 ASSERT(m_markers.isEmpty() == !m_possiblyExistingMarkerTypes.contains (DocumentMarker::allMarkers()));66 ASSERT(m_markers.isEmpty() == !m_possiblyExistingMarkerTypes.containsAny(DocumentMarker::allMarkers())); 67 67 return !m_markers.isEmpty(); 68 68 } -
trunk/Source/WebCore/rendering/RenderElement.cpp
r234619 r234811 1362 1362 // don't override the foreground color with the selection foreground color. 1363 1363 if (style().userSelect() == UserSelect::None 1364 || (view().frameView().paintBehavior().contains (OptionSet<PaintBehavior>(PaintBehavior::SelectionOnly) | PaintBehavior::SelectionAndBackgroundsOnly)))1364 || (view().frameView().paintBehavior().containsAny({ PaintBehavior::SelectionOnly, PaintBehavior::SelectionAndBackgroundsOnly }))) 1365 1365 return Color(); 1366 1366 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r234782 r234811 4789 4789 // We have to loop through every fragment multiple times, since we have to repaint in each specific phase in order for 4790 4790 // interleaving of the fragments to work properly. 4791 bool selectionOnly = localPaintingInfo.paintBehavior.contains (OptionSet<PaintBehavior>(PaintBehavior::SelectionAndBackgroundsOnly) | PaintBehavior::SelectionOnly);4791 bool selectionOnly = localPaintingInfo.paintBehavior.containsAny({ PaintBehavior::SelectionAndBackgroundsOnly, PaintBehavior::SelectionOnly }); 4792 4792 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhase::Selection : PaintPhase::ChildBlockBackgrounds, layerFragments, 4793 4793 context, localPaintingInfo, localPaintBehavior, subtreePaintRootForRenderer); -
trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp
r234619 r234811 1848 1848 1849 1849 if (FrameView* frameView = frame()->view()) { 1850 if (frameView->paintBehavior().contains (OptionSet<PaintBehavior>(PaintBehavior::SelectionOnly) | PaintBehavior::SelectionAndBackgroundsOnly | PaintBehavior::ForceBlackText)) {1850 if (frameView->paintBehavior().containsAny({ PaintBehavior::SelectionOnly, PaintBehavior::SelectionAndBackgroundsOnly, PaintBehavior::ForceBlackText})) { 1851 1851 // This paint behavior is used when drawing the find indicator and there's no need to 1852 1852 // snapshot plug-ins, because they can never be painted as part of the find indicator. -
trunk/Tools/ChangeLog
r234810 r234811 1 2018-08-13 Antti Koivisto <antti@apple.com> 2 3 Meaning of OptionSet::contains is unclear when used with OptionSet argument 4 https://bugs.webkit.org/show_bug.cgi?id=188501 5 6 Reviewed by Anders Carlsson. 7 8 * TestWebKitAPI/Tests/WTF/OptionSet.cpp: 9 (TestWebKitAPI::TEST): 10 1 11 2018-08-13 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WTF/OptionSet.cpp
r231548 r234811 380 380 } 381 381 382 TEST(WTF_OptionSet, ContainsAny) 383 { 384 OptionSet<ExampleFlags> set { ExampleFlags::A, ExampleFlags::B }; 385 386 EXPECT_TRUE(set.containsAny({ ExampleFlags::A })); 387 EXPECT_TRUE(set.containsAny({ ExampleFlags::B })); 388 EXPECT_FALSE(set.containsAny({ ExampleFlags::C })); 389 EXPECT_FALSE(set.containsAny({ ExampleFlags::C, ExampleFlags::D })); 390 EXPECT_TRUE(set.containsAny({ ExampleFlags::A, ExampleFlags::B })); 391 EXPECT_TRUE(set.containsAny({ ExampleFlags::B, ExampleFlags::C })); 392 EXPECT_TRUE(set.containsAny({ ExampleFlags::A, ExampleFlags::C })); 393 EXPECT_TRUE(set.containsAny({ ExampleFlags::A, ExampleFlags::B, ExampleFlags::C })); 394 } 395 396 TEST(WTF_OptionSet, ContainsAll) 397 { 398 OptionSet<ExampleFlags> set { ExampleFlags::A, ExampleFlags::B }; 399 400 EXPECT_TRUE(set.containsAll({ ExampleFlags::A })); 401 EXPECT_TRUE(set.containsAll({ ExampleFlags::B })); 402 EXPECT_FALSE(set.containsAll({ ExampleFlags::C })); 403 EXPECT_FALSE(set.containsAll({ ExampleFlags::C, ExampleFlags::D })); 404 EXPECT_TRUE(set.containsAll({ ExampleFlags::A, ExampleFlags::B })); 405 EXPECT_FALSE(set.containsAll({ ExampleFlags::B, ExampleFlags::C })); 406 EXPECT_FALSE(set.containsAll({ ExampleFlags::A, ExampleFlags::C })); 407 EXPECT_FALSE(set.containsAll({ ExampleFlags::A, ExampleFlags::B, ExampleFlags::C })); 408 } 409 382 410 } // namespace TestWebKitAPI
Note: See TracChangeset
for help on using the changeset viewer.