Title: [238472] trunk/Source/WebCore
Revision
238472
Author
[email protected]
Date
2018-11-24 16:37:06 -0800 (Sat, 24 Nov 2018)

Log Message

Remove now unnecessary specialized ListHashSet from InlineItem.h
https://bugs.webkit.org/show_bug.cgi?id=191946

Patch by Sam Weinig <[email protected]> on 2018-11-24
Reviewed by Zalan Bujtas.

Now that ListHashSet supports raw pointer overloads for smart pointers,
we can fix the FIXME in InlineItem.h and remove the specialized ListHashSet
and ListHashSet::find calls.

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
(WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::InlineFormattingContext::Geometry::runWidth):
* layout/inlineformatting/InlineItem.h:
(WebCore::Layout::InlineItemHashFunctions::hash): Deleted.
(WebCore::Layout::InlineItemHashFunctions::equal): Deleted.
(WebCore::Layout::InlineItemHashTranslator::hash): Deleted.
(WebCore::Layout::InlineItemHashTranslator::equal): Deleted.
* layout/inlineformatting/InlineLineBreaker.cpp:
(WebCore::Layout::InlineLineBreaker::textWidth const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238471 => 238472)


--- trunk/Source/WebCore/ChangeLog	2018-11-24 21:06:09 UTC (rev 238471)
+++ trunk/Source/WebCore/ChangeLog	2018-11-25 00:37:06 UTC (rev 238472)
@@ -1,3 +1,27 @@
+2018-11-24  Sam Weinig  <[email protected]>
+
+        Remove now unnecessary specialized ListHashSet from InlineItem.h
+        https://bugs.webkit.org/show_bug.cgi?id=191946
+
+        Reviewed by Zalan Bujtas.
+
+        Now that ListHashSet supports raw pointer overloads for smart pointers,
+        we can fix the FIXME in InlineItem.h and remove the specialized ListHashSet
+        and ListHashSet::find calls.
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::splitInlineRunIfNeeded const):
+        (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::InlineFormattingContext::Geometry::runWidth):
+        * layout/inlineformatting/InlineItem.h:
+        (WebCore::Layout::InlineItemHashFunctions::hash): Deleted.
+        (WebCore::Layout::InlineItemHashFunctions::equal): Deleted.
+        (WebCore::Layout::InlineItemHashTranslator::hash): Deleted.
+        (WebCore::Layout::InlineItemHashTranslator::equal): Deleted.
+        * layout/inlineformatting/InlineLineBreaker.cpp:
+        (WebCore::Layout::InlineLineBreaker::textWidth const):
+
 2018-11-24  Wenson Hsieh  <[email protected]>
 
         [Cocoa] Add WKWebView SPI to trigger and remove data detection

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (238471 => 238472)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-24 21:06:09 UTC (rev 238471)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-25 00:37:06 UTC (rev 238472)
@@ -162,7 +162,7 @@
         uncommitted = { };
     };
 
-    for (auto iterator = inlineContent.find<const InlineItem&, InlineItemHashTranslator>(inlineRun.inlineItem()); iterator != inlineContent.end() && remaningLength > 0; ++iterator) {
+    for (auto iterator = inlineContent.find(&inlineRun.inlineItem()); iterator != inlineContent.end() && remaningLength > 0; ++iterator) {
         auto& inlineItem = **iterator;
 
         // Skip all non-inflow boxes (floats, out-of-flow positioned elements). They don't participate in the inline run context.
@@ -489,7 +489,7 @@
         auto& inlineContent = inlineFormattingState.inlineContent();
 
         if (lastInlineBoxBeforeContainer) {
-            auto iterator = inlineContent.find<const InlineItem&, InlineItemHashTranslator>(*lastInlineBoxBeforeContainer);
+            auto iterator = inlineContent.find(lastInlineBoxBeforeContainer);
             firstDescendantInlineBox = (*++iterator).get();
         } else
             firstDescendantInlineBox = inlineContent.first().get();

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (238471 => 238472)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-24 21:06:09 UTC (rev 238471)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2018-11-25 00:37:06 UTC (rev 238472)
@@ -180,7 +180,7 @@
 {
     LayoutUnit width;
     auto startPosition = from;
-    auto iterator = inlineContent.find<const InlineItem&, InlineItemHashTranslator>(inlineItem);
+    auto iterator = inlineContent.find(&inlineItem);
     auto inlineItemEnd = inlineContent.end();
     while (length) {
         ASSERT(iterator != inlineItemEnd);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineItem.h (238471 => 238472)


--- trunk/Source/WebCore/layout/inlineformatting/InlineItem.h	2018-11-24 21:06:09 UTC (rev 238471)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineItem.h	2018-11-25 00:37:06 UTC (rev 238472)
@@ -83,18 +83,8 @@
     LayoutUnit m_nonBreakableEnd;
 };
 
-// FIXME: Fix HashSet/ListHashSet to support smart pointer types.
-struct InlineItemHashFunctions {
-    static unsigned hash(const std::unique_ptr<InlineItem>& key) { return PtrHash<InlineItem*>::hash(key.get()); }
-    static bool equal(const std::unique_ptr<InlineItem>& a, const std::unique_ptr<InlineItem>& b) { return a.get() == b.get(); }
-};
+using InlineContent = ListHashSet<std::unique_ptr<InlineItem>>;
 
-struct InlineItemHashTranslator {
-    static unsigned hash(const InlineItem& key) { return PtrHash<const InlineItem*>::hash(&key); }
-    static bool equal(const std::unique_ptr<InlineItem>& a, const InlineItem& b) { return a.get() == &b; }
-};
-using InlineContent = ListHashSet<std::unique_ptr<InlineItem>, InlineItemHashFunctions>;
-
 inline InlineItem::InlineItem(const Box& layoutBox)
     : m_layoutBox(layoutBox)
 {

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (238471 => 238472)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2018-11-24 21:06:09 UTC (rev 238471)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp	2018-11-25 00:37:06 UTC (rev 238472)
@@ -161,7 +161,7 @@
 
     // FIXME: It does not do proper kerning/ligature handling.
     LayoutUnit width;
-    auto iterator = m_inlineContent.find<const InlineItem&, InlineItemHashTranslator>(inlineItem);
+    auto iterator = m_inlineContent.find(&inlineItem);
     auto inlineItemEnd = m_inlineContent.end();
     while (length) {
         ASSERT(iterator != inlineItemEnd);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to