Diff
Modified: trunk/Source/WebCore/ChangeLog (290871 => 290872)
--- trunk/Source/WebCore/ChangeLog 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/ChangeLog 2022-03-06 06:50:10 UTC (rev 290872)
@@ -1,3 +1,43 @@
+2022-03-05 Simon Fraser <simon.fra...@apple.com>
+
+ Replace IntRectExtent with RectEdges<int>
+ https://bugs.webkit.org/show_bug.cgi?id=237495
+
+ Reviewed by Sam Weinig.
+
+ IntRectExtent was just like RectEdges<int>, so remove it.
+
+ Add operator+= for RectEdges<>, and helpers to convert from RectEdges<int> to RectEdges<LayoutUnit>.
+
+ Code that previously added a IntRectExtent to a rect now uses .expand().
+
+ For some reason initializing a RectEdges<T> with arguments std::max<T> fails to
+ compile, so use intermediate variables in two places.
+
+ * Headers.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/LengthBox.cpp:
+ (WebCore::operator<<):
+ * platform/LengthBox.h:
+ (WebCore::toLayoutBoxExtent):
+ * platform/RectEdges.h:
+ (WebCore::RectEdges::isZero const):
+ (WebCore::operator+=):
+ * platform/graphics/IntRectExtent.h: Removed.
+ * platform/graphics/filters/FEDropShadow.cpp:
+ (WebCore::FEDropShadow::outsets const):
+ * platform/graphics/filters/FilterFunction.h:
+ * platform/graphics/filters/FilterOperations.cpp:
+ (WebCore::FilterOperations::outsets const):
+ * platform/graphics/filters/FilterOperations.h:
+ * rendering/CSSFilter.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
+ (WebCore::transparencyClipBox):
+ (WebCore::RenderLayer::calculateClipRects const):
+ * rendering/RenderLayerFilters.cpp:
+ (WebCore::RenderLayerFilters::beginFilterEffect):
+
2022-03-05 Alan Bujtas <za...@apple.com>
Remove non-standard display:block UA stylesheet rule for <layer>
Modified: trunk/Source/WebCore/Headers.cmake (290871 => 290872)
--- trunk/Source/WebCore/Headers.cmake 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/Headers.cmake 2022-03-06 06:50:10 UTC (rev 290872)
@@ -1518,7 +1518,6 @@
platform/graphics/IntPoint.h
platform/graphics/IntPointHash.h
platform/graphics/IntRect.h
- platform/graphics/IntRectExtent.h
platform/graphics/IntRectHash.h
platform/graphics/IntSize.h
platform/graphics/IntSizeHash.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (290871 => 290872)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-03-06 06:50:10 UTC (rev 290872)
@@ -3474,7 +3474,6 @@
A1F76B4F1F44D2420014C318 /* PaymentDetailsModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B4C1F44D2420014C318 /* PaymentDetailsModifier.h */; };
A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B521F44D2C70014C318 /* PaymentShippingOption.h */; };
A1F76B5B1F44D3B20014C318 /* PaymentComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B581F44D3B20014C318 /* PaymentComplete.h */; };
- A2B9217316C5CC420041DCD9 /* IntRectExtent.h in Headers */ = {isa = PBXBuildFile; fileRef = A2B9217216C5CC420041DCD9 /* IntRectExtent.h */; settings = {ATTRIBUTES = (Private, ); }; };
A31C4E4F16E02AB4002F7957 /* OESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */; };
A31C4E5416E02B40002F7957 /* JSOESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E5316E02B40002F7957 /* JSOESTextureHalfFloat.h */; };
A3AF9D8620326861006CAD06 /* UserAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A3AF9D8220325324006CAD06 /* UserAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -13802,7 +13801,6 @@
A1F76B5A1F44D3B20014C318 /* PaymentComplete.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PaymentComplete.idl; sourceTree = "<group>"; };
A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseCocoa.mm; sourceTree = "<group>"; };
A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLMenclose.h; sourceTree = "<group>"; };
- A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = "<group>"; };
A31AC70A24340984007F00A2 /* MediaStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStrategy.cpp; sourceTree = "<group>"; };
A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESTextureHalfFloat.cpp; sourceTree = "<group>"; };
A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OESTextureHalfFloat.h; sourceTree = "<group>"; };
@@ -29086,7 +29084,6 @@
E462A4A0113E71BE004A4220 /* IntPointHash.h */,
B27535450B053814002CE64F /* IntRect.cpp */,
B27535460B053814002CE64F /* IntRect.h */,
- A2B9217216C5CC420041DCD9 /* IntRectExtent.h */,
E134F5AA12EE343F004EC58D /* IntRectHash.h */,
2D46F04F17B96FD2005647F0 /* IntSize.cpp */,
B27535470B053814002CE64F /* IntSize.h */,
@@ -35197,7 +35194,6 @@
B27535720B053814002CE64F /* IntPoint.h in Headers */,
E462A4A1113E71BE004A4220 /* IntPointHash.h in Headers */,
B27535740B053814002CE64F /* IntRect.h in Headers */,
- A2B9217316C5CC420041DCD9 /* IntRectExtent.h in Headers */,
E134F5AB12EE343F004EC58D /* IntRectHash.h in Headers */,
B27535750B053814002CE64F /* IntSize.h in Headers */,
B27535760B053814002CE64F /* IntSizeHash.h in Headers */,
Modified: trunk/Source/WebCore/platform/LengthBox.cpp (290871 => 290872)
--- trunk/Source/WebCore/platform/LengthBox.cpp 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/LengthBox.cpp 2022-03-06 06:50:10 UTC (rev 290872)
@@ -42,4 +42,10 @@
return ts;
}
+TextStream& operator<<(TextStream& ts, const IntBoxExtent& box)
+{
+ ts << "top: " << box.top() << " right: " << box.right() << " bottom: " << box.bottom() << " left: " << box.left();
+ return ts;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/LengthBox.h (290871 => 290872)
--- trunk/Source/WebCore/platform/LengthBox.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/LengthBox.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -65,8 +65,17 @@
using LayoutBoxExtent = RectEdges<LayoutUnit>;
using FloatBoxExtent = RectEdges<float>;
+using IntBoxExtent = RectEdges<int>;
+using IntOutsets = IntBoxExtent;
+
+inline LayoutBoxExtent toLayoutBoxExtent(const IntBoxExtent& extent)
+{
+ return { extent.top(), extent.right(), extent.bottom(), extent.left() };
+}
+
WTF::TextStream& operator<<(WTF::TextStream&, const LengthBox&);
+WTF::TextStream& operator<<(WTF::TextStream&, const IntBoxExtent&);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const FloatBoxExtent&);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/RectEdges.h (290871 => 290872)
--- trunk/Source/WebCore/platform/RectEdges.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/RectEdges.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -91,12 +91,34 @@
bool operator==(const RectEdges& other) const { return m_sides == other.m_sides; }
bool operator!=(const RectEdges& other) const { return m_sides != other.m_sides; }
+ bool isZero() const
+ {
+ return !top() && !right() && !bottom() && !left();
+ }
+
private:
std::array<T, 4> m_sides { };
};
+template<typename T>
+constexpr RectEdges<T> operator+(const RectEdges<T>& a, const RectEdges<T>& b)
+{
+ return {
+ a.top() + b.top(),
+ a.right() + b.right(),
+ a.bottom() + b.bottom(),
+ a.left() + b.left()
+ };
+}
template<typename T>
+inline RectEdges<T>& operator+=(RectEdges<T>& a, const RectEdges<T>& b)
+{
+ a = a + b;
+ return a;
+}
+
+template<typename T>
TextStream& operator<<(TextStream& ts, const RectEdges<T>& edges)
{
ts << "[top " << edges.top() << " right " << edges.right() << " bottom " << edges.bottom() << " left " << edges.left() << "]";
Deleted: trunk/Source/WebCore/platform/graphics/IntRectExtent.h (290871 => 290872)
--- trunk/Source/WebCore/platform/graphics/IntRectExtent.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/graphics/IntRectExtent.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-namespace WebCore {
-
-class IntRectExtent {
-public:
- IntRectExtent() = default;
-
- IntRectExtent(int top, int right, int bottom, int left)
- : m_top(top)
- , m_right(right)
- , m_bottom(bottom)
- , m_left(left)
- {
- }
-
- int top() const { return m_top; }
- void setTop(int top) { m_top = top; }
-
- int right() const { return m_right; }
- void setRight(int right) { m_right = right; }
-
- int bottom() const { return m_bottom; }
- void setBottom(int bottom) { m_bottom = bottom; }
-
- int left() const { return m_left; }
- void setLeft(int left) { m_left = left; }
-
- bool isZero() const { return !left() && !right() && !top() && !bottom(); }
-
-private:
- int m_top { 0 };
- int m_right { 0 };
- int m_bottom { 0 };
- int m_left { 0 };
-};
-
-inline bool operator==(const IntRectExtent& a, const IntRectExtent& b)
-{
- return a.top() == b.top() && a.right() == b.right() && a.bottom() == b.bottom() && a.left() == b.left();
-}
-
-inline bool operator!=(const IntRectExtent& a, const IntRectExtent& b)
-{
- return !(a == b);
-}
-
-template<typename RectType>
-inline RectType& operator+=(RectType& rect, const IntRectExtent& extent)
-{
- rect.move(-extent.left(), -extent.top());
- rect.expand(extent.left() + extent.right(), extent.top() + extent.bottom());
- return rect;
-}
-
-inline IntRectExtent& operator+=(IntRectExtent& a, const IntRectExtent& b)
-{
- a.setTop(a.top() + b.top());
- a.setRight(a.right() + b.right());
- a.setBottom(a.bottom() + b.bottom());
- a.setLeft(a.left() + b.left());
- return a;
-}
-
-using IntOutsets = IntRectExtent;
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp (290871 => 290872)
--- trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp 2022-03-06 06:50:10 UTC (rev 290872)
@@ -64,12 +64,13 @@
IntOutsets FEDropShadow::outsets(const Filter&) const
{
IntSize outsetSize = FEGaussianBlur::calculateOutsetSize({ m_stdX, m_stdY });
- return {
- std::max<int>(0, outsetSize.height() - m_dy),
- std::max<int>(0, outsetSize.width() + m_dx),
- std::max<int>(0, outsetSize.height() + m_dy),
- std::max<int>(0, outsetSize.width() - m_dx)
- };
+
+ int top = std::max<int>(0, outsetSize.height() - m_dy);
+ int right = std::max<int>(0, outsetSize.width() + m_dx);
+ int bottom = std::max<int>(0, outsetSize.height() + m_dy);
+ int left = std::max<int>(0, outsetSize.width() - m_dx);
+
+ return { top, right, bottom, left };
}
std::unique_ptr<FilterEffectApplier> FEDropShadow::createSoftwareApplier() const
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h (290871 => 290872)
--- trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterFunction.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -29,7 +29,7 @@
#include "FilterImage.h"
#include "FilterImageVector.h"
#include "FloatRect.h"
-#include "IntRectExtent.h"
+#include "LengthBox.h"
#include <wtf/RefCounted.h>
#include <wtf/text/AtomString.h>
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp (290871 => 290872)
--- trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperations.cpp 2022-03-06 06:50:10 UTC (rev 290872)
@@ -84,12 +84,13 @@
auto& dropShadowOperation = downcast<DropShadowFilterOperation>(*operation);
float stdDeviation = dropShadowOperation.stdDeviation();
IntSize outsetSize = FEGaussianBlur::calculateOutsetSize({ stdDeviation, stdDeviation });
- IntOutsets outsets {
- std::max(0, outsetSize.height() - dropShadowOperation.y()),
- std::max(0, outsetSize.width() + dropShadowOperation.x()),
- std::max(0, outsetSize.height() + dropShadowOperation.y()),
- std::max(0, outsetSize.width() - dropShadowOperation.x())
- };
+
+ int top = std::max(0, outsetSize.height() - dropShadowOperation.y());
+ int right = std::max(0, outsetSize.width() + dropShadowOperation.x());
+ int bottom = std::max(0, outsetSize.height() + dropShadowOperation.y());
+ int left = std::max(0, outsetSize.width() - dropShadowOperation.x());
+
+ auto outsets = IntOutsets { top, right, bottom, left };
totalOutsets += outsets;
break;
}
Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperations.h (290871 => 290872)
--- trunk/Source/WebCore/platform/graphics/filters/FilterOperations.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperations.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -26,7 +26,7 @@
#pragma once
#include "FilterOperation.h"
-#include "IntRectExtent.h"
+#include "LengthBox.h"
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
Modified: trunk/Source/WebCore/rendering/CSSFilter.h (290871 => 290872)
--- trunk/Source/WebCore/rendering/CSSFilter.h 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/rendering/CSSFilter.h 2022-03-06 06:50:10 UTC (rev 290872)
@@ -26,7 +26,7 @@
#pragma once
#include "Filter.h"
-#include "IntRectExtent.h"
+#include "LengthBox.h"
namespace WebCore {
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (290871 => 290872)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2022-03-06 06:50:10 UTC (rev 290872)
@@ -2053,7 +2053,7 @@
return;
LayoutRect rectForRepaint = rect;
- rectForRepaint += filterOutsets();
+ rectForRepaint.expand(toLayoutBoxExtent(filterOutsets()));
m_filters->expandDirtySourceRect(rectForRepaint);
@@ -2211,7 +2211,7 @@
// paints unfragmented.
LayoutRect clipRect = layer.boundingBox(&layer);
expandClipRectForDescendantsAndReflection(clipRect, layer, &layer, transparencyBehavior, paintBehavior);
- clipRect += layer.filterOutsets();
+ clipRect.expand(toLayoutBoxExtent(layer.filterOutsets()));
LayoutRect result = transform.mapRect(clipRect);
if (!paginationLayer)
return result;
@@ -2227,7 +2227,7 @@
LayoutRect clipRect = layer.boundingBox(rootLayer, layer.offsetFromAncestor(rootLayer), transparencyBehavior == HitTestingTransparencyClipBox ? RenderLayer::UseFragmentBoxesIncludingCompositing : RenderLayer::UseFragmentBoxesExcludingCompositing);
expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, paintBehavior);
- clipRect += layer.filterOutsets();
+ clipRect.expand(toLayoutBoxExtent(layer.filterOutsets()));
return clipRect;
}
@@ -5105,7 +5105,7 @@
computeLayersUnion(*childLayer);
if (flags.contains(IncludeFilterOutsets) || (flags.contains(IncludePaintedFilterOutsets) && paintsWithFilters()))
- unionBounds += filterOutsets();
+ unionBounds.expand(toLayoutBoxExtent(filterOutsets()));
if ((flags & IncludeSelfTransform) && paintsWithTransform(PaintBehavior::Normal)) {
TransformationMatrix* affineTrans = transform();
Modified: trunk/Source/WebCore/rendering/RenderLayerFilters.cpp (290871 => 290872)
--- trunk/Source/WebCore/rendering/RenderLayerFilters.cpp 2022-03-05 21:55:27 UTC (rev 290871)
+++ trunk/Source/WebCore/rendering/RenderLayerFilters.cpp 2022-03-06 06:50:10 UTC (rev 290872)
@@ -162,7 +162,7 @@
// For CSSFilter, filterRegion = targetBoundingBox + filter->outsets()
auto filterRegion = targetBoundingBox;
if (filter.hasFilterThatMovesPixels())
- filterRegion += filter.outsets();
+ filterRegion.expand(toLayoutBoxExtent(filter.outsets()));
if (filterRegion.isEmpty())
return nullptr;