Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec5bee2d9c22a92e4db7ddfaecec2f1c5958c4b0
      
https://github.com/WebKit/WebKit/commit/ec5bee2d9c22a92e4db7ddfaecec2f1c5958c4b0
  Author: Antti Koivisto <[email protected]>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M Source/WTF/wtf/HashMap.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationPagination.cpp
    M Source/WebCore/style/RuleSet.cpp
    M Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp

  Log Message:
  -----------
  Add HashMap::getOptional
https://bugs.webkit.org/show_bug.cgi?id=261800
rdar://problem/115764318

Reviewed by Kimmo Kinnunen.

Add a version of get() that returns std::optional for convenience.

* Source/WTF/wtf/HashMap.h:
(WTF::Y>::getOptional const):

Note that this returns std::optional<MappedType> instead of 
std::optional<MappedPeakType>,
making it safer to use with reference counting smart pointers. This mean it is 
not usable with
maps containing std::unique_ptr and similar values but for those it would not 
add anything over
plain get() anyway.

* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateRenderTreePositions):

Also use it in a few places.

* Source/WebCore/layout/integration/inline/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::computeAdjustmentsForPagination):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::evaluateDynamicMediaQueryRules):
* Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/268207@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to