WebKit Bugzilla
Attachment 360684 Details for
Bug 194073
: Hit testing functions optimizations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194073-20190130204200.patch (text/plain), 7.72 KB, created by
Benjamin Poulain
on 2019-01-30 20:42:00 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Benjamin Poulain
Created:
2019-01-30 20:42:00 PST
Size:
7.72 KB
patch
obsolete
>Subversion Revision: 240595 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index d168918688fb8e37cb3d8683f5cc46c9d187a36f..03e2927f3de31ad103def92081c32ee1fd7f1ab7 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-30 Benjamin Poulain <benjamin@webkit.org> >+ >+ <rdar://problem/47692312> Hit testing functions optimizations >+ https://bugs.webkit.org/show_bug.cgi?id=194073 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/MathExtras.h: >+ (clampTo): >+ (sizeof): >+ > 2019-01-28 Eric Carlson <eric.carlson@apple.com> > > AVStreamSession isn't always available, make a HAVE compile flag for it >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4b1e07aa844b427e5100e8cd1924a37c19482c8d..f8713a2dd368ae6bfb7902c12decd2f86b10eb18 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-30 Benjamin Poulain <benjamin@webkit.org> >+ >+ <rdar://problem/47692312> Hit testing functions optimizations >+ https://bugs.webkit.org/show_bug.cgi?id=194073 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * page/FrameViewLayoutContext.h: >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::mapLocalToContainer const): >+ * rendering/style/RenderStyle.h: >+ (WebCore::RenderStyle::setOpacity): >+ (WebCore::RenderStyle::setShapeImageThreshold): >+ > 2019-01-28 Eric Carlson <eric.carlson@apple.com> > > AVStreamSession isn't always available, make a HAVE compile flag for it >diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h >index 5eef198790cb1ee86490d49ee1e7e69a5c92a32a..c612343d498d7417f0e46783078015301c341abe 100644 >--- a/Source/WTF/wtf/MathExtras.h >+++ b/Source/WTF/wtf/MathExtras.h >@@ -123,15 +123,60 @@ template<> constexpr float defaultMinimumForClamp() { return -std::numeric_limit > template<> constexpr double defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); } > template<typename T> constexpr T defaultMaximumForClamp() { return std::numeric_limits<T>::max(); } > >-template<typename T> inline T clampTo(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) >+// Same type in and out. >+template<typename T> inline T clampTo(T value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) > { >- if (value >= static_cast<double>(max)) >+ if (value >= max) > return max; >- if (value <= static_cast<double>(min)) >+ if (value <= min) > return min; >- return static_cast<T>(value); >+ return value; >+} >+ >+// Floating point source. >+template<typename TargetType, typename SourceType> >+typename std::enable_if<!std::is_same<TargetType, SourceType>::value >+ && std::is_floating_point<SourceType>::value, TargetType>::type >+clampTo(SourceType value, TargetType min = defaultMinimumForClamp<TargetType>(), TargetType max = defaultMaximumForClamp<TargetType>()) >+{ >+ if (value >= static_cast<SourceType>(max)) >+ return max; >+ if (value <= static_cast<SourceType>(min)) >+ return min; >+ return static_cast<TargetType>(value); >+} >+ >+// Source and Target are both signed integer and Source is larger or equal to Target >+template<typename TargetType, typename SourceType> >+typename std::enable_if<!std::is_same<TargetType, SourceType>::value >+ && std::numeric_limits<SourceType>::is_integer >+ && std::numeric_limits<TargetType>::is_integer >+ && std::numeric_limits<TargetType>::is_signed == std::numeric_limits<SourceType>::is_signed >+ && sizeof(SourceType) >= sizeof(TargetType), TargetType>::type >+clampTo(SourceType value, TargetType min = defaultMinimumForClamp<TargetType>(), TargetType max = defaultMaximumForClamp<TargetType>()) >+{ >+ if (value >= static_cast<SourceType>(max)) >+ return max; >+ if (value <= static_cast<SourceType>(min)) >+ return min; >+ return static_cast<TargetType>(value); >+} >+ >+// Clamping a unsigned integer to the max signed value. >+template<typename TargetType, typename SourceType> >+typename std::enable_if<!std::is_same<TargetType, SourceType>::value >+ && std::numeric_limits<SourceType>::is_integer >+ && std::numeric_limits<TargetType>::is_integer >+ && std::numeric_limits<TargetType>::is_signed >+ && !std::numeric_limits<SourceType>::is_signed >+ && sizeof(SourceType) >= sizeof(TargetType), TargetType>::type >+clampTo(SourceType value) >+{ >+ TargetType max = std::numeric_limits<TargetType>::max(); >+ if (value >= static_cast<SourceType>(max)) >+ return max; >+ return static_cast<TargetType>(value); > } >-template<> inline long long int clampTo(double, long long int, long long int); // clampTo does not support long long ints. > > inline int clampToInteger(double value) > { >diff --git a/Source/WebCore/page/FrameViewLayoutContext.h b/Source/WebCore/page/FrameViewLayoutContext.h >index b07cf5a5d9b38ec152273ba84773d3b3d7b1f88a..0fffc36abdd1af1a978474cf072c67836c126b6a 100644 >--- a/Source/WebCore/page/FrameViewLayoutContext.h >+++ b/Source/WebCore/page/FrameViewLayoutContext.h >@@ -93,7 +93,7 @@ public: > > 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 >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index d38720c9159f0be34ee6d2eac6aafe8a25ecbf53..7bd279b06dd0d46e8a2ff91dee68fca3b938cfc4 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -1988,7 +1988,7 @@ void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain > 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()) >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index 324efe58cd09e9e44ac86209c8a3249816d02c43..69650df20f08e9de9325fdff067e477222b1348a 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -1055,7 +1055,7 @@ public: > void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWidth, w); } > void setTextFillColor(const Color& c) { SET_VAR(m_rareInheritedData, textFillColor, c); } > void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); } >- void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(m_rareNonInheritedData, opacity, v); } >+ void setOpacity(float f) { float v = clampTo<float>(f, 0.f, 1.f); SET_VAR(m_rareNonInheritedData, opacity, v); } > void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, appearance, a); } > // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment > void setBoxAlign(BoxAlignment a) { SET_NESTED_VAR(m_rareNonInheritedData, deprecatedFlexibleBox, align, static_cast<unsigned>(a)); } >@@ -2196,7 +2196,7 @@ inline void RenderStyle::setShapeOutside(RefPtr<ShapeValue>&& value) > > inline void RenderStyle::setShapeImageThreshold(float shapeImageThreshold) > { >- float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0, 1); >+ float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0.f, 1.f); > SET_VAR(m_rareNonInheritedData, shapeImageThreshold, clampedShapeImageThreshold); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194073
:
360684
|
360823
|
360945
|
361155