Title: [257502] trunk/Source/WebCore
Revision
257502
Author
[email protected]
Date
2020-02-26 12:05:05 -0800 (Wed, 26 Feb 2020)

Log Message

Clean up HitTestLocation.h
https://bugs.webkit.org/show_bug.cgi?id=208254
<rdar://problem/59815136>

Reviewed by Jer Noble.

Use modern C++ features to remove duplicate code.

* rendering/HitTestLocation.cpp:
(WebCore::HitTestLocation::HitTestLocation):
* rendering/HitTestLocation.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::HitTestResult):
* rendering/HitTestResult.h: Remove unnecessary #includes. This file only needs
to include RoundedRect.h: RoundedRect.h includes FloatQuad.h and LayoutRect.h
and FloatQuad.h will include FloatRect.h. We do not make use of have declarations
in <wtf/Forward.h> so remove that as well.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257501 => 257502)


--- trunk/Source/WebCore/ChangeLog	2020-02-26 19:54:20 UTC (rev 257501)
+++ trunk/Source/WebCore/ChangeLog	2020-02-26 20:05:05 UTC (rev 257502)
@@ -1,3 +1,23 @@
+2020-02-26  Daniel Bates  <[email protected]>
+
+        Clean up HitTestLocation.h
+        https://bugs.webkit.org/show_bug.cgi?id=208254
+        <rdar://problem/59815136>
+
+        Reviewed by Jer Noble.
+
+        Use modern C++ features to remove duplicate code.
+
+        * rendering/HitTestLocation.cpp:
+        (WebCore::HitTestLocation::HitTestLocation):
+        * rendering/HitTestLocation.h:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::HitTestResult):
+        * rendering/HitTestResult.h: Remove unnecessary #includes. This file only needs
+        to include RoundedRect.h: RoundedRect.h includes FloatQuad.h and LayoutRect.h
+        and FloatQuad.h will include FloatRect.h. We do not make use of have declarations
+        in <wtf/Forward.h> so remove that as well.
+
 2020-02-26  Jacob Uphoff  <[email protected]>
 
         Unreviewed, rolling out r257373.

Modified: trunk/Source/WebCore/rendering/HitTestLocation.cpp (257501 => 257502)


--- trunk/Source/WebCore/rendering/HitTestLocation.cpp	2020-02-26 19:54:20 UTC (rev 257501)
+++ trunk/Source/WebCore/rendering/HitTestLocation.cpp	2020-02-26 20:05:05 UTC (rev 257502)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008, 2011, 2020 Apple Inc. All rights reserved.
  * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
  *
  * This library is free software; you can redistribute it and/or
@@ -24,11 +24,7 @@
 
 namespace WebCore {
 
-HitTestLocation::HitTestLocation()
-    : m_isRectBased(false)
-    , m_isRectilinear(true)
-{
-}
+HitTestLocation::HitTestLocation() = default;
 
 HitTestLocation::HitTestLocation(const LayoutPoint& point)
     : m_point(point)
@@ -35,29 +31,21 @@
     , m_boundingBox(rectForPoint(point, 0, 0, 0, 0))
     , m_transformedPoint(point)
     , m_transformedRect(m_boundingBox)
-    , m_isRectBased(false)
-    , m_isRectilinear(true)
 {
 }
 
 HitTestLocation::HitTestLocation(const FloatPoint& point)
-    : m_point(flooredLayoutPoint(point))
-    , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0))
-    , m_transformedPoint(point)
-    , m_transformedRect(m_boundingBox)
-    , m_isRectBased(false)
-    , m_isRectilinear(true)
+    : HitTestLocation::HitTestLocation { flooredLayoutPoint(point) }
 {
 }
 
 HitTestLocation::HitTestLocation(const FloatPoint& point, const FloatQuad& quad)
-    : m_transformedPoint(point)
-    , m_transformedRect(quad)
-    , m_isRectBased(true)
+    : m_point { flooredLayoutPoint(point) }
+    , m_boundingBox { quad.enclosingBoundingBox() }
+    , m_transformedPoint { point }
+    , m_transformedRect { quad }
+    , m_isRectilinear { quad.isRectilinear() }
 {
-    m_point = flooredLayoutPoint(point);
-    m_boundingBox = enclosingIntRect(quad.boundingBox());
-    m_isRectilinear = quad.isRectilinear();
 }
 
 HitTestLocation::HitTestLocation(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
@@ -64,10 +52,9 @@
     : m_point(centerPoint)
     , m_boundingBox(rectForPoint(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding))
     , m_transformedPoint(centerPoint)
+    , m_transformedRect(FloatQuad { m_boundingBox })
     , m_isRectBased(topPadding || rightPadding || bottomPadding || leftPadding)
-    , m_isRectilinear(true)
 {
-    m_transformedRect = FloatQuad(m_boundingBox);
 }
 
 HitTestLocation::HitTestLocation(const HitTestLocation& other, const LayoutSize& offset)

Modified: trunk/Source/WebCore/rendering/HitTestLocation.h (257501 => 257502)


--- trunk/Source/WebCore/rendering/HitTestLocation.h	2020-02-26 19:54:20 UTC (rev 257501)
+++ trunk/Source/WebCore/rendering/HitTestLocation.h	2020-02-26 20:05:05 UTC (rev 257502)
@@ -21,11 +21,7 @@
 
 #pragma once
 
-#include "FloatQuad.h"
-#include "FloatRect.h"
-#include "LayoutRect.h"
 #include "RoundedRect.h"
-#include <wtf/Forward.h>
 
 namespace WebCore {
 
@@ -65,11 +61,11 @@
     const FloatQuad& transformedRect() const { return m_transformedRect; }
 
 private:
-    template<typename RectType>
-    bool intersectsRect(const RectType&) const;
-    void move(const LayoutSize& offset);
+    template<typename RectType> bool intersectsRect(const RectType&) const;
 
-    // This is cached forms of the more accurate point and area below.
+    void move(const LayoutSize&);
+
+    // These are the cached forms of the more accurate point and rect below.
     LayoutPoint m_point;
     IntRect m_boundingBox;
 
@@ -76,8 +72,8 @@
     FloatPoint m_transformedPoint;
     FloatQuad m_transformedRect;
 
-    bool m_isRectBased;
-    bool m_isRectilinear;
+    bool m_isRectBased { false };
+    bool m_isRectilinear { true };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to