Cleanup: Dereference value of optional directly instead of using checked value in...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2017 20:04:54 +0000 (20:04 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Dec 2017 20:04:54 +0000 (20:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181050

Reviewed by Simon Fraser.

It is sufficient and more efficient to dereference a std::optional directly when we know that it has
a value as opposed to using the checked dereference member function std::optional<>::value().

No functionality changed. So, no new tests.

* rendering/MarkerSubrange.cpp:
(WebCore::subdivide):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226195 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/MarkerSubrange.cpp

index 0dc995b..dfb8342 100644 (file)
@@ -1,5 +1,20 @@
 2017-12-20  Daniel Bates  <dabates@apple.com>
 
+        Cleanup: Dereference value of optional directly instead of using checked value in WebCore::subdivide()
+        https://bugs.webkit.org/show_bug.cgi?id=181050
+
+        Reviewed by Simon Fraser.
+
+        It is sufficient and more efficient to dereference a std::optional directly when we know that it has
+        a value as opposed to using the checked dereference member function std::optional<>::value().
+
+        No functionality changed. So, no new tests.
+
+        * rendering/MarkerSubrange.cpp:
+        (WebCore::subdivide):
+
+2017-12-20  Daniel Bates  <dabates@apple.com>
+
         MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing
         https://bugs.webkit.org/show_bug.cgi?id=181014
 
index d5781eb..5b48073 100644 (file)
@@ -76,12 +76,12 @@ Vector<MarkerSubrange> subdivide(const Vector<MarkerSubrange>& subranges, Overla
                 if (frontmost) {
                     if (overlapStrategy == OverlapStrategy::FrontmostWithLongestEffectiveRange && !result.isEmpty()) {
                         auto& previous = result.last();
-                        if (previous.endOffset == offsetSoFar && previous.type == offsets[frontmost.value()].subrange->type && previous.marker == offsets[frontmost.value()].subrange->marker)
+                        if (previous.endOffset == offsetSoFar && previous.type == offsets[*frontmost].subrange->type && previous.marker == offsets[*frontmost].subrange->marker)
                             previous.endOffset = offsets[i].value;
                         else
-                            result.append({ offsetSoFar, offsets[i].value, offsets[frontmost.value()].subrange->type, offsets[frontmost.value()].subrange->marker });
+                            result.append({ offsetSoFar, offsets[i].value, offsets[*frontmost].subrange->type, offsets[*frontmost].subrange->marker });
                     } else
-                        result.append({ offsetSoFar, offsets[i].value, offsets[frontmost.value()].subrange->type, offsets[frontmost.value()].subrange->marker });
+                        result.append({ offsetSoFar, offsets[i].value, offsets[*frontmost].subrange->type, offsets[*frontmost].subrange->marker });
                 }
             } else {
                 // The appended subranges may not be in paint order. We will fix this up at the end of this function.