Title: [240968] trunk/Source/WebCore
- Revision
- 240968
- Author
- [email protected]
- Date
- 2019-02-05 00:52:04 -0800 (Tue, 05 Feb 2019)
Log Message
Hit testing functions optimizations
https://bugs.webkit.org/show_bug.cgi?id=194073
<rdar://problem/47692312>
Reviewed by Zalan Bujtas.
This patch implements some easy optimizations that speed up
hit testing without changing the algorithms.
* page/FrameViewLayoutContext.h:
The code for:
view().frameView().layoutContext().isPaintOffsetCacheEnabled()
followed by:
view().frameView().layoutContext().layoutState()
was loading all the intermediate values twice and calling layoutState()
twice.
By marking the function as pure, Clang can CSE the whole thing and
remove the duplicated code.
* platform/graphics/LayoutRect.h:
(WebCore::LayoutRect::isInfinite const):
That one is pretty funny.
Since LayoutRect::isInfinite() was implemented before operator==() is
declared, the compiler was falling back to the implicit convertion to FloatRect()
before doing any comparison.
This explains a bunch of the convertions to float when using LayoutRect.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer const):
Just reoder to make the register nice and clean for the optimization described above.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240967 => 240968)
--- trunk/Source/WebCore/ChangeLog 2019-02-05 07:48:10 UTC (rev 240967)
+++ trunk/Source/WebCore/ChangeLog 2019-02-05 08:52:04 UTC (rev 240968)
@@ -1,3 +1,39 @@
+2019-02-05 Benjamin Poulain <[email protected]>
+
+ Hit testing functions optimizations
+ https://bugs.webkit.org/show_bug.cgi?id=194073
+ <rdar://problem/47692312>
+
+ Reviewed by Zalan Bujtas.
+
+ This patch implements some easy optimizations that speed up
+ hit testing without changing the algorithms.
+
+ * page/FrameViewLayoutContext.h:
+ The code for:
+ view().frameView().layoutContext().isPaintOffsetCacheEnabled()
+ followed by:
+ view().frameView().layoutContext().layoutState()
+ was loading all the intermediate values twice and calling layoutState()
+ twice.
+
+ By marking the function as pure, Clang can CSE the whole thing and
+ remove the duplicated code.
+
+ * platform/graphics/LayoutRect.h:
+ (WebCore::LayoutRect::isInfinite const):
+ That one is pretty funny.
+
+ Since LayoutRect::isInfinite() was implemented before operator==() is
+ declared, the compiler was falling back to the implicit convertion to FloatRect()
+ before doing any comparison.
+
+ This explains a bunch of the convertions to float when using LayoutRect.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::mapLocalToContainer const):
+ Just reoder to make the register nice and clean for the optimization described above.
+
2019-02-04 Yusuke Suzuki <[email protected]>
[JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
Modified: trunk/Source/WebCore/page/FrameViewLayoutContext.h (240967 => 240968)
--- trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-02-05 07:48:10 UTC (rev 240967)
+++ trunk/Source/WebCore/page/FrameViewLayoutContext.h 2019-02-05 08:52:04 UTC (rev 240968)
@@ -95,7 +95,7 @@
void flushAsynchronousTasks();
- RenderLayoutState* layoutState() const;
+ RenderLayoutState* layoutState() const PURE_FUNCTION;
// Returns true if layoutState should be used for its cached offset and clip.
bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && layoutState(); }
#ifndef NDEBUG
Modified: trunk/Source/WebCore/platform/graphics/LayoutRect.h (240967 => 240968)
--- trunk/Source/WebCore/platform/graphics/LayoutRect.h 2019-02-05 07:48:10 UTC (rev 240967)
+++ trunk/Source/WebCore/platform/graphics/LayoutRect.h 2019-02-05 08:52:04 UTC (rev 240968)
@@ -166,7 +166,7 @@
void scale(float xScale, float yScale);
LayoutRect transposedRect() const { return LayoutRect(m_location.transposedPoint(), m_size.transposedSize()); }
- bool isInfinite() const { return *this == LayoutRect::infiniteRect(); }
+ bool isInfinite() const;
static LayoutRect infiniteRect()
{
@@ -207,6 +207,11 @@
return a.location() != b.location() || a.size() != b.size();
}
+inline bool LayoutRect::isInfinite() const
+{
+ return *this == LayoutRect::infiniteRect();
+}
+
// Integral snapping functions.
inline IntRect snappedIntRect(const LayoutRect& rect)
{
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (240967 => 240968)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2019-02-05 07:48:10 UTC (rev 240967)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2019-02-05 08:52:04 UTC (rev 240968)
@@ -1988,7 +1988,7 @@
if (repaintContainer == this)
return;
- if (view().frameView().layoutContext().isPaintOffsetCacheEnabled() && !repaintContainer) {
+ if (!repaintContainer && view().frameView().layoutContext().isPaintOffsetCacheEnabled()) {
auto* layoutState = view().frameView().layoutContext().layoutState();
LayoutSize offset = layoutState->paintOffset() + locationOffset();
if (style().hasInFlowPosition() && layer())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes