Diff
Modified: trunk/Source/WebCore/ChangeLog (251206 => 251207)
--- trunk/Source/WebCore/ChangeLog 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/ChangeLog 2019-10-16 21:24:58 UTC (rev 251207)
@@ -1,3 +1,31 @@
+2019-10-16 Simon Fraser <simon.fra...@apple.com>
+
+ Add dumping for BorderData and StyleBackgroundData
+ https://bugs.webkit.org/show_bug.cgi?id=203038
+
+ Reviewed by Zalan Bujtas.
+
+ As part of adding dumping for all RenderStyle data, add dumping support for
+ BorderData and StyleBackgroundData.
+
+ For large classes it's beneficial to avoid dumping default values; those classes
+ get a dump() function that can take an argument to say whether values which are default
+ should be printed.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/LengthSize.h:
+ (WebCore::LengthSize::isZero const):
+ * rendering/style/BorderData.cpp: Added.
+ (WebCore::operator<<):
+ (WebCore::BorderData::dump const):
+ * rendering/style/BorderData.h:
+ * rendering/style/RenderStyleConstants.h:
+ * rendering/style/StyleBackgroundData.cpp:
+ (WebCore::StyleBackgroundData::dump const):
+ (WebCore::operator<<):
+ * rendering/style/StyleBackgroundData.h:
+
2019-10-16 Chris Dumez <cdu...@apple.com>
[WK2] Handle back/forward cache entry expiration in the UIProcess instead of the WebProcess
Modified: trunk/Source/WebCore/Sources.txt (251206 => 251207)
--- trunk/Source/WebCore/Sources.txt 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/Sources.txt 2019-10-16 21:24:58 UTC (rev 251207)
@@ -2219,6 +2219,7 @@
rendering/shapes/ShapeOutsideInfo.cpp
rendering/style/BasicShapes.cpp
+rendering/style/BorderData.cpp
rendering/style/ContentData.cpp
rendering/style/FillLayer.cpp
rendering/style/GapLength.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (251206 => 251207)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-10-16 21:24:58 UTC (rev 251207)
@@ -5632,6 +5632,7 @@
0F26A7AC2055C8D70090A141 /* XMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLDocument.cpp; sourceTree = "<group>"; };
0F26A7AD205626100090A141 /* SVGUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGUnknownElement.cpp; sourceTree = "<group>"; };
0F283A8D235582F8004794CA /* ThemeTypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ThemeTypes.cpp; sourceTree = "<group>"; };
+ 0F283A9123563126004794CA /* BorderData.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BorderData.cpp; sourceTree = "<group>"; };
0F36E7361BD1837A002DB891 /* LayoutPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPoint.cpp; sourceTree = "<group>"; };
0F36E7381BD184B9002DB891 /* LayoutSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutSize.cpp; sourceTree = "<group>"; };
0F37F0832202AC8F00A89C0B /* ScrollingTreeScrollingNodeDelegateMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreeScrollingNodeDelegateMac.mm; sourceTree = "<group>"; };
@@ -25170,6 +25171,7 @@
children = (
FBD6AF8215EF21A3008B7110 /* BasicShapes.cpp */,
FBD6AF8315EF21A3008B7110 /* BasicShapes.h */,
+ 0F283A9123563126004794CA /* BorderData.cpp */,
BC5EB5E00E81BE8700B25965 /* BorderData.h */,
BC5EB5DA0E81B7EA00B25965 /* BorderValue.h */,
BC5EB5DE0E81B9AB00B25965 /* CollapsedBorderValue.h */,
Modified: trunk/Source/WebCore/platform/LengthSize.h (251206 => 251207)
--- trunk/Source/WebCore/platform/LengthSize.h 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/platform/LengthSize.h 2019-10-16 21:24:58 UTC (rev 251207)
@@ -28,6 +28,7 @@
Length height;
bool isEmpty() const { return width.isZero() || height.isZero(); }
+ bool isZero() const { return width.isZero() && height.isZero(); }
};
ALWAYS_INLINE bool operator==(const LengthSize& a, const LengthSize& b)
Added: trunk/Source/WebCore/rendering/style/BorderData.cpp (0 => 251207)
--- trunk/Source/WebCore/rendering/style/BorderData.cpp (rev 0)
+++ trunk/Source/WebCore/rendering/style/BorderData.cpp 2019-10-16 21:24:58 UTC (rev 251207)
@@ -0,0 +1,76 @@
+/*
+* 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS CONTRIBUTORS
+* 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.
+*/
+
+#include "config.h"
+#include "BorderData.h"
+
+#include "OutlineValue.h"
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, const BorderValue& borderValue)
+{
+ ts << borderValue.width() << " " << borderValue.style() << " " << borderValue.color();
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const OutlineValue& outlineValue)
+{
+ ts << static_cast<const BorderValue&>(outlineValue);
+ ts.dumpProperty("outline-offset", outlineValue.offset());
+ return ts;
+}
+
+void BorderData::dump(TextStream& ts, DumpStyleValues behavior) const
+{
+ if (behavior == DumpStyleValues::All || left() != BorderValue())
+ ts.dumpProperty("left", left());
+ if (behavior == DumpStyleValues::All || right() != BorderValue())
+ ts.dumpProperty("right", right());
+ if (behavior == DumpStyleValues::All || top() != BorderValue())
+ ts.dumpProperty("top", top());
+ if (behavior == DumpStyleValues::All || bottom() != BorderValue())
+ ts.dumpProperty("bottom", bottom());
+
+ ts.dumpProperty("image", image());
+
+ if (behavior == DumpStyleValues::All || !topLeftRadius().isZero())
+ ts.dumpProperty("top-left", topLeftRadius());
+ if (behavior == DumpStyleValues::All || !topRightRadius().isZero())
+ ts.dumpProperty("top-right", topRightRadius());
+ if (behavior == DumpStyleValues::All || !bottomLeftRadius().isZero())
+ ts.dumpProperty("bottom-left", bottomLeftRadius());
+ if (behavior == DumpStyleValues::All || !bottomRightRadius().isZero())
+ ts.dumpProperty("bottom-right", bottomRightRadius());
+}
+
+TextStream& operator<<(TextStream& ts, const BorderData& borderData)
+{
+ borderData.dump(ts);
+ return ts;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/BorderData.h (251206 => 251207)
--- trunk/Source/WebCore/rendering/style/BorderData.h 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/rendering/style/BorderData.h 2019-10-16 21:24:58 UTC (rev 251207)
@@ -30,6 +30,8 @@
namespace WebCore {
+class OutlineValue;
+
class BorderData {
friend class RenderStyle;
public:
@@ -122,6 +124,8 @@
const LengthSize& bottomLeftRadius() const { return m_bottomLeftRadius; }
const LengthSize& bottomRightRadius() const { return m_bottomRightRadius; }
+ void dump(TextStream&, DumpStyleValues = DumpStyleValues::All) const;
+
private:
BorderValue m_left;
BorderValue m_right;
@@ -136,4 +140,8 @@
LengthSize m_bottomRightRadius;
};
+WTF::TextStream& operator<<(WTF::TextStream&, const BorderValue&);
+WTF::TextStream& operator<<(WTF::TextStream&, const OutlineValue&);
+WTF::TextStream& operator<<(WTF::TextStream&, const BorderData&);
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (251206 => 251207)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2019-10-16 21:24:58 UTC (rev 251207)
@@ -33,6 +33,11 @@
namespace WebCore {
+enum class DumpStyleValues {
+ All,
+ NonInitial,
+};
+
static const size_t PrintColorAdjustBits = 1;
enum class PrintColorAdjust : uint8_t {
Economy,
Modified: trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp (251206 => 251207)
--- trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/rendering/style/StyleBackgroundData.cpp 2019-10-16 21:24:58 UTC (rev 251207)
@@ -60,4 +60,20 @@
return outline == other.outline;
}
+void StyleBackgroundData::dump(TextStream& ts, DumpStyleValues behavior) const
+{
+ if (behavior == DumpStyleValues::All || background != FillLayer(FillLayerType::Background))
+ ts.dumpProperty("background-image", background);
+ if (behavior == DumpStyleValues::All || color != RenderStyle::initialBackgroundColor())
+ ts.dumpProperty("background-color", color);
+ if (behavior == DumpStyleValues::All || outline != OutlineValue())
+ ts.dumpProperty("outline", outline);
+}
+
+TextStream& operator<<(TextStream& ts, const StyleBackgroundData& backgroundData)
+{
+ backgroundData.dump(ts);
+ return ts;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/StyleBackgroundData.h (251206 => 251207)
--- trunk/Source/WebCore/rendering/style/StyleBackgroundData.h 2019-10-16 21:14:31 UTC (rev 251206)
+++ trunk/Source/WebCore/rendering/style/StyleBackgroundData.h 2019-10-16 21:24:58 UTC (rev 251207)
@@ -46,9 +46,13 @@
Color color;
OutlineValue outline;
+ void dump(TextStream&, DumpStyleValues = DumpStyleValues::All) const;
+
private:
StyleBackgroundData();
StyleBackgroundData(const StyleBackgroundData&);
};
+WTF::TextStream& operator<<(WTF::TextStream&, const StyleBackgroundData&);
+
} // namespace WebCore