Diff
Modified: trunk/Source/WebCore/ChangeLog (269329 => 269330)
--- trunk/Source/WebCore/ChangeLog 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/ChangeLog 2020-11-03 21:08:38 UTC (rev 269330)
@@ -1,3 +1,51 @@
+2020-11-03 Wenson Hsieh <[email protected]>
+
+ Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType
+ https://bugs.webkit.org/show_bug.cgi?id=218518
+
+ Reviewed by Simon Fraser.
+
+ In preparation for larger changes to display lists and display list items in <webkit.org/b/218406>, replace
+ `DisplayList::Recorder::Delegate`'s `willAppendItem` and `didAppendItem` client hooks with
+ `willAppendItemOfType` and `didAppendItemOfType` instead. Once all display list items are no longer ref-counted
+ objects that inherit from `DisplayList::Item`, plumbing these items through virtual client hooks will introduce
+ unnecessary complexity and runtime overhead.
+
+ Instead, we can refactor these methods to only pass the type of the display list item being appended; this is
+ because all extant clients that implement these hooks only require the item for its `ItemType`.
+
+ * Headers.cmake:
+
+ Pull `DisplayList::ItemType` out into a separate header: `DisplayListItemType.h`. This header additionally
+ contains several helper functions (`sizeOfItemInBytes`, `isInlineItem`, and `isDrawingItem`) that operate only
+ on `ItemType`s, rather than items themselves.
+
+ We will use these helper functions as we work towards <webkit.org/b/218406>.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/displaylists/DisplayList.h:
+ * platform/graphics/displaylists/DisplayListItemType.cpp: Added.
+ (WebCore::DisplayList::sizeOfItemInBytes):
+ (WebCore::DisplayList::isDrawingItem):
+ (WebCore::DisplayList::isInlineItem):
+ * platform/graphics/displaylists/DisplayListItemType.h: Added.
+ * platform/graphics/displaylists/DisplayListRecorder.cpp:
+ (WebCore::DisplayList::Recorder::willAppendItemOfType):
+
+ Use the new `DisplayList::isDrawingItem(ItemType)` function here, instead of checking whether the item is a
+ subclass of `DrawingItem`.
+
+ (WebCore::DisplayList::Recorder::didAppendItemOfType):
+ (WebCore::DisplayList::Recorder::appendItem):
+ (WebCore::DisplayList::Recorder::willAppendItem): Deleted.
+ (WebCore::DisplayList::Recorder::didAppendItem): Deleted.
+ * platform/graphics/displaylists/DisplayListRecorder.h:
+ (WebCore::DisplayList::Recorder::Delegate::willAppendItemOfType):
+ (WebCore::DisplayList::Recorder::Delegate::didAppendItemOfType):
+ (WebCore::DisplayList::Recorder::Delegate::willAppendItem): Deleted.
+ (WebCore::DisplayList::Recorder::Delegate::didAppendItem): Deleted.
+
2020-11-03 Fujii Hironori <[email protected]>
[TextureMapper] Crashed in TextureMapperLayer::paintUsingOverlapRegions
Modified: trunk/Source/WebCore/Headers.cmake (269329 => 269330)
--- trunk/Source/WebCore/Headers.cmake 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/Headers.cmake 2020-11-03 21:08:38 UTC (rev 269330)
@@ -1242,6 +1242,7 @@
platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h
platform/graphics/displaylists/DisplayListDrawingContext.h
platform/graphics/displaylists/DisplayListImageBuffer.h
+ platform/graphics/displaylists/DisplayListItemType.h
platform/graphics/displaylists/DisplayListItems.h
platform/graphics/displaylists/DisplayListRecorder.h
platform/graphics/displaylists/DisplayListReplayer.h
Modified: trunk/Source/WebCore/Sources.txt (269329 => 269330)
--- trunk/Source/WebCore/Sources.txt 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/Sources.txt 2020-11-03 21:08:38 UTC (rev 269330)
@@ -1961,6 +1961,7 @@
platform/graphics/displaylists/DisplayList.cpp
platform/graphics/displaylists/DisplayListDrawingContext.cpp
platform/graphics/displaylists/DisplayListItems.cpp
+platform/graphics/displaylists/DisplayListItemType.cpp
platform/graphics/displaylists/DisplayListRecorder.cpp
platform/graphics/displaylists/DisplayListReplayer.cpp
platform/graphics/filters/DistantLightSource.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (269329 => 269330)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-11-03 21:08:38 UTC (rev 269330)
@@ -5163,6 +5163,7 @@
F403E7872363B58C00044550 /* EnterKeyHint.h in Headers */ = {isa = PBXBuildFile; fileRef = F403E7852363B58C00044550 /* EnterKeyHint.h */; settings = {ATTRIBUTES = (Private, ); }; };
F429261825264D4400007898 /* MediaPlayerIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = F429261725264D4400007898 /* MediaPlayerIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
F433E9031DBBDBA200EF0D14 /* StaticPasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F4377D572551C9C60080ABFE /* DisplayListItemType.h in Headers */ = {isa = PBXBuildFile; fileRef = F4377D552551C9C60080ABFE /* DisplayListItemType.h */; settings = {ATTRIBUTES = (Private, ); }; };
F440E77A233D94D70063F9AB /* NavigatorClipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F440E76F233D94D30063F9AB /* NavigatorClipboard.h */; };
F440E77B233D94D70063F9AB /* ClipboardItem.h in Headers */ = {isa = PBXBuildFile; fileRef = F440E770233D94D40063F9AB /* ClipboardItem.h */; };
F440E77D233D94D70063F9AB /* Clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = F440E772233D94D50063F9AB /* Clipboard.h */; };
@@ -16318,6 +16319,8 @@
F42CEB54214031EE002DCA72 /* FontAttributeChangesCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontAttributeChangesCocoa.mm; sourceTree = "<group>"; };
F433E9021DBBDBA200EF0D14 /* StaticPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticPasteboard.h; sourceTree = "<group>"; };
F433E9041DBBDBC200EF0D14 /* StaticPasteboard.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StaticPasteboard.cpp; sourceTree = "<group>"; };
+ F4377D552551C9C60080ABFE /* DisplayListItemType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayListItemType.h; sourceTree = "<group>"; };
+ F4377D562551C9C60080ABFE /* DisplayListItemType.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayListItemType.cpp; sourceTree = "<group>"; };
F440E76E233D94D30063F9AB /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; };
F440E76F233D94D30063F9AB /* NavigatorClipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorClipboard.h; sourceTree = "<group>"; };
F440E770233D94D40063F9AB /* ClipboardItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardItem.h; sourceTree = "<group>"; };
@@ -17624,6 +17627,8 @@
72EA09F723FCCB3D008504A5 /* DisplayListImageBuffer.h */,
0FE5FBCC1C3DD51E0007A2CA /* DisplayListItems.cpp */,
0FE5FBCD1C3DD51E0007A2CA /* DisplayListItems.h */,
+ F4377D562551C9C60080ABFE /* DisplayListItemType.cpp */,
+ F4377D552551C9C60080ABFE /* DisplayListItemType.h */,
0FE5FBCE1C3DD51E0007A2CA /* DisplayListRecorder.cpp */,
0FE5FBCF1C3DD51E0007A2CA /* DisplayListRecorder.h */,
0FE5FBD01C3DD51E0007A2CA /* DisplayListReplayer.cpp */,
@@ -31448,6 +31453,7 @@
55AD09402408964000DE4D2F /* DisplayListDrawingContext.h in Headers */,
55AD093E2408963500DE4D2F /* DisplayListImageBuffer.h in Headers */,
0FE5FBD51C3DD51E0007A2CA /* DisplayListItems.h in Headers */,
+ F4377D572551C9C60080ABFE /* DisplayListItemType.h in Headers */,
0FE5FBD71C3DD51E0007A2CA /* DisplayListRecorder.h in Headers */,
0FE5FBD91C3DD51E0007A2CA /* DisplayListReplayer.h in Headers */,
49AF2D6914435D050016A784 /* DisplayRefreshMonitor.h in Headers */,
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h (269329 => 269330)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2020-11-03 21:08:38 UTC (rev 269330)
@@ -25,6 +25,7 @@
#pragma once
+#include "DisplayListItemType.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include <wtf/FastMalloc.h>
@@ -39,73 +40,6 @@
namespace DisplayList {
-enum class ItemType : uint8_t {
- Save,
- Restore,
- Translate,
- Rotate,
- Scale,
- ConcatenateCTM,
- SetCTM,
- SetInlineFillGradient,
- SetInlineFillColor,
- SetInlineStrokeColor,
- SetStrokeThickness,
- SetState,
- SetLineCap,
- SetLineDash,
- SetLineJoin,
- SetMiterLimit,
- ClearShadow,
- Clip,
- ClipOut,
- ClipOutToPath,
- ClipPath,
- ClipToDrawingCommands,
- DrawGlyphs,
- DrawImage,
- DrawTiledImage,
- DrawTiledScaledImage,
- DrawImageBuffer,
- DrawNativeImage,
- DrawPattern,
- DrawRect,
- DrawLine,
- DrawLinesForText,
- DrawDotsForDocumentMarker,
- DrawEllipse,
- DrawPath,
- DrawFocusRingPath,
- DrawFocusRingRects,
- FillRect,
- FillRectWithColor,
- FillRectWithGradient,
- FillCompositedRect,
- FillRoundedRect,
- FillRectWithRoundedHole,
-#if ENABLE(INLINE_PATH_DATA)
- FillInlinePath,
-#endif
- FillPath,
- FillEllipse,
- PutImageData,
- PaintFrameForMedia,
- StrokeRect,
-#if ENABLE(INLINE_PATH_DATA)
- StrokeInlinePath,
-#endif
- StrokePath,
- StrokeEllipse,
- ClearRect,
- BeginTransparencyLayer,
- EndTransparencyLayer,
-#if USE(CG)
- ApplyStrokePattern, // FIXME: should not be a recorded item.
- ApplyFillPattern, // FIXME: should not be a recorded item.
-#endif
- ApplyDeviceScaleFactor,
-};
-
class Item : public RefCounted<Item> {
public:
Item() = delete;
Added: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (0 => 269330)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp 2020-11-03 21:08:38 UTC (rev 269330)
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2020 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 "DisplayListItemType.h"
+
+#include "DisplayListItems.h"
+
+namespace WebCore {
+namespace DisplayList {
+
+size_t sizeOfItemInBytes(ItemType type)
+{
+ switch (type) {
+ case ItemType::Save:
+ return sizeof(Save);
+ case ItemType::Restore:
+ return sizeof(Restore);
+ case ItemType::Translate:
+ return sizeof(Translate);
+ case ItemType::Rotate:
+ return sizeof(Rotate);
+ case ItemType::Scale:
+ return sizeof(Scale);
+ case ItemType::ConcatenateCTM:
+ return sizeof(ConcatenateCTM);
+ case ItemType::SetCTM:
+ return sizeof(SetCTM);
+ case ItemType::SetInlineFillGradient:
+ return sizeof(SetInlineFillGradient);
+ case ItemType::SetInlineFillColor:
+ return sizeof(SetInlineFillColor);
+ case ItemType::SetInlineStrokeColor:
+ return sizeof(SetInlineStrokeColor);
+ case ItemType::SetStrokeThickness:
+ return sizeof(SetStrokeThickness);
+ case ItemType::SetState:
+ return sizeof(SetState);
+ case ItemType::SetLineCap:
+ return sizeof(SetLineCap);
+ case ItemType::SetLineDash:
+ return sizeof(SetLineDash);
+ case ItemType::SetLineJoin:
+ return sizeof(SetLineJoin);
+ case ItemType::SetMiterLimit:
+ return sizeof(SetMiterLimit);
+ case ItemType::ClearShadow:
+ return sizeof(ClearShadow);
+ case ItemType::Clip:
+ return sizeof(Clip);
+ case ItemType::ClipOut:
+ return sizeof(ClipOut);
+ case ItemType::ClipOutToPath:
+ return sizeof(ClipOutToPath);
+ case ItemType::ClipPath:
+ return sizeof(ClipPath);
+ case ItemType::ClipToDrawingCommands:
+ return sizeof(ClipToDrawingCommands);
+ case ItemType::DrawGlyphs:
+ return sizeof(DrawGlyphs);
+ case ItemType::DrawImage:
+ return sizeof(DrawImage);
+ case ItemType::DrawTiledImage:
+ return sizeof(DrawTiledImage);
+ case ItemType::DrawTiledScaledImage:
+ return sizeof(DrawTiledScaledImage);
+ case ItemType::DrawImageBuffer:
+ return sizeof(DrawImageBuffer);
+ case ItemType::DrawNativeImage:
+ return sizeof(DrawNativeImage);
+ case ItemType::DrawPattern:
+ return sizeof(DrawPattern);
+ case ItemType::DrawRect:
+ return sizeof(DrawRect);
+ case ItemType::DrawLine:
+ return sizeof(DrawLine);
+ case ItemType::DrawLinesForText:
+ return sizeof(DrawLinesForText);
+ case ItemType::DrawDotsForDocumentMarker:
+ return sizeof(DrawDotsForDocumentMarker);
+ case ItemType::DrawEllipse:
+ return sizeof(DrawEllipse);
+ case ItemType::DrawPath:
+ return sizeof(DrawPath);
+ case ItemType::DrawFocusRingPath:
+ return sizeof(DrawFocusRingPath);
+ case ItemType::DrawFocusRingRects:
+ return sizeof(DrawFocusRingRects);
+ case ItemType::FillRect:
+ return sizeof(FillRect);
+ case ItemType::FillRectWithColor:
+ return sizeof(FillRectWithColor);
+ case ItemType::FillRectWithGradient:
+ return sizeof(FillRectWithGradient);
+ case ItemType::FillCompositedRect:
+ return sizeof(FillCompositedRect);
+ case ItemType::FillRoundedRect:
+ return sizeof(FillRoundedRect);
+ case ItemType::FillRectWithRoundedHole:
+ return sizeof(FillRectWithRoundedHole);
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::FillInlinePath:
+ return sizeof(FillInlinePath);
+#endif
+ case ItemType::FillPath:
+ return sizeof(FillPath);
+ case ItemType::FillEllipse:
+ return sizeof(FillEllipse);
+ case ItemType::PutImageData:
+ return sizeof(PutImageData);
+ case ItemType::PaintFrameForMedia:
+ return sizeof(PaintFrameForMedia);
+ case ItemType::StrokeRect:
+ return sizeof(StrokeRect);
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::StrokeInlinePath:
+ return sizeof(StrokeInlinePath);
+#endif
+ case ItemType::StrokePath:
+ return sizeof(StrokePath);
+ case ItemType::StrokeEllipse:
+ return sizeof(StrokeEllipse);
+ case ItemType::ClearRect:
+ return sizeof(ClearRect);
+ case ItemType::BeginTransparencyLayer:
+ return sizeof(BeginTransparencyLayer);
+ case ItemType::EndTransparencyLayer:
+ return sizeof(EndTransparencyLayer);
+#if USE(CG)
+ case ItemType::ApplyStrokePattern:
+ return sizeof(ApplyStrokePattern);
+ case ItemType::ApplyFillPattern:
+ return sizeof(ApplyFillPattern);
+#endif
+ case ItemType::ApplyDeviceScaleFactor:
+ return sizeof(ApplyDeviceScaleFactor);
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool isDrawingItem(ItemType type)
+{
+ switch (type) {
+ case ItemType::ApplyDeviceScaleFactor:
+#if USE(CG)
+ case ItemType::ApplyFillPattern:
+ case ItemType::ApplyStrokePattern:
+#endif
+ case ItemType::ClearShadow:
+ case ItemType::Clip:
+ case ItemType::ClipOut:
+ case ItemType::ClipOutToPath:
+ case ItemType::ClipPath:
+ case ItemType::ClipToDrawingCommands:
+ case ItemType::ConcatenateCTM:
+ case ItemType::Restore:
+ case ItemType::Rotate:
+ case ItemType::Save:
+ case ItemType::Scale:
+ case ItemType::SetCTM:
+ case ItemType::SetInlineFillColor:
+ case ItemType::SetInlineFillGradient:
+ case ItemType::SetInlineStrokeColor:
+ case ItemType::SetLineCap:
+ case ItemType::SetLineDash:
+ case ItemType::SetLineJoin:
+ case ItemType::SetMiterLimit:
+ case ItemType::SetState:
+ case ItemType::SetStrokeThickness:
+ case ItemType::Translate:
+ return false;
+ case ItemType::BeginTransparencyLayer:
+ case ItemType::ClearRect:
+ case ItemType::DrawDotsForDocumentMarker:
+ case ItemType::DrawEllipse:
+ case ItemType::DrawFocusRingPath:
+ case ItemType::DrawFocusRingRects:
+ case ItemType::DrawGlyphs:
+ case ItemType::DrawImage:
+ case ItemType::DrawImageBuffer:
+ case ItemType::DrawLine:
+ case ItemType::DrawLinesForText:
+ case ItemType::DrawNativeImage:
+ case ItemType::DrawPath:
+ case ItemType::DrawPattern:
+ case ItemType::DrawRect:
+ case ItemType::DrawTiledImage:
+ case ItemType::DrawTiledScaledImage:
+ case ItemType::EndTransparencyLayer:
+ case ItemType::FillCompositedRect:
+ case ItemType::FillEllipse:
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::FillInlinePath:
+#endif
+ case ItemType::FillPath:
+ case ItemType::FillRect:
+ case ItemType::FillRectWithColor:
+ case ItemType::FillRectWithGradient:
+ case ItemType::FillRectWithRoundedHole:
+ case ItemType::FillRoundedRect:
+ case ItemType::PaintFrameForMedia:
+ case ItemType::PutImageData:
+ case ItemType::StrokeEllipse:
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::StrokeInlinePath:
+#endif
+ case ItemType::StrokePath:
+ case ItemType::StrokeRect:
+ return true;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+bool isInlineItem(ItemType type)
+{
+ switch (type) {
+ case ItemType::ClipOutToPath:
+ case ItemType::ClipPath:
+ case ItemType::ClipToDrawingCommands:
+ case ItemType::DrawFocusRingPath:
+ case ItemType::DrawFocusRingRects:
+ case ItemType::DrawGlyphs:
+ case ItemType::DrawImage:
+ case ItemType::DrawImageBuffer:
+ case ItemType::DrawLinesForText:
+ case ItemType::DrawNativeImage:
+ case ItemType::DrawPath:
+ case ItemType::DrawPattern:
+ case ItemType::DrawTiledImage:
+ case ItemType::DrawTiledScaledImage:
+ case ItemType::FillCompositedRect:
+ case ItemType::FillPath:
+ case ItemType::FillRectWithColor:
+ case ItemType::FillRectWithGradient:
+ case ItemType::FillRectWithRoundedHole:
+ case ItemType::FillRoundedRect:
+ case ItemType::PutImageData:
+ case ItemType::SetLineDash:
+ case ItemType::SetState:
+ case ItemType::StrokePath:
+ return false;
+ case ItemType::ApplyDeviceScaleFactor:
+#if USE(CG)
+ case ItemType::ApplyFillPattern:
+ case ItemType::ApplyStrokePattern:
+#endif
+ case ItemType::BeginTransparencyLayer:
+ case ItemType::ClearRect:
+ case ItemType::ClearShadow:
+ case ItemType::Clip:
+ case ItemType::ClipOut:
+ case ItemType::ConcatenateCTM:
+ case ItemType::DrawDotsForDocumentMarker:
+ case ItemType::DrawEllipse:
+ case ItemType::DrawLine:
+ case ItemType::DrawRect:
+ case ItemType::EndTransparencyLayer:
+ case ItemType::FillEllipse:
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::FillInlinePath:
+#endif
+ case ItemType::FillRect:
+ case ItemType::PaintFrameForMedia:
+ case ItemType::Restore:
+ case ItemType::Rotate:
+ case ItemType::Save:
+ case ItemType::Scale:
+ case ItemType::SetCTM:
+ case ItemType::SetInlineFillColor:
+ case ItemType::SetInlineFillGradient:
+ case ItemType::SetInlineStrokeColor:
+ case ItemType::SetLineCap:
+ case ItemType::SetLineJoin:
+ case ItemType::SetMiterLimit:
+ case ItemType::SetStrokeThickness:
+ case ItemType::StrokeEllipse:
+#if ENABLE(INLINE_PATH_DATA)
+ case ItemType::StrokeInlinePath:
+#endif
+ case ItemType::StrokeRect:
+ case ItemType::Translate:
+ return true;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
+} // namespace DisplayList
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (0 => 269330)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h 2020-11-03 21:08:38 UTC (rev 269330)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#pragma once
+
+namespace WebCore {
+namespace DisplayList {
+
+enum class ItemType : uint8_t {
+ Save,
+ Restore,
+ Translate,
+ Rotate,
+ Scale,
+ ConcatenateCTM,
+ SetCTM,
+ SetInlineFillGradient,
+ SetInlineFillColor,
+ SetInlineStrokeColor,
+ SetStrokeThickness,
+ SetState,
+ SetLineCap,
+ SetLineDash,
+ SetLineJoin,
+ SetMiterLimit,
+ ClearShadow,
+ Clip,
+ ClipOut,
+ ClipOutToPath,
+ ClipPath,
+ ClipToDrawingCommands,
+ DrawGlyphs,
+ DrawImage,
+ DrawTiledImage,
+ DrawTiledScaledImage,
+ DrawImageBuffer,
+ DrawNativeImage,
+ DrawPattern,
+ DrawRect,
+ DrawLine,
+ DrawLinesForText,
+ DrawDotsForDocumentMarker,
+ DrawEllipse,
+ DrawPath,
+ DrawFocusRingPath,
+ DrawFocusRingRects,
+ FillRect,
+ FillRectWithColor,
+ FillRectWithGradient,
+ FillCompositedRect,
+ FillRoundedRect,
+ FillRectWithRoundedHole,
+#if ENABLE(INLINE_PATH_DATA)
+ FillInlinePath,
+#endif
+ FillPath,
+ FillEllipse,
+ PutImageData,
+ PaintFrameForMedia,
+ StrokeRect,
+#if ENABLE(INLINE_PATH_DATA)
+ StrokeInlinePath,
+#endif
+ StrokePath,
+ StrokeEllipse,
+ ClearRect,
+ BeginTransparencyLayer,
+ EndTransparencyLayer,
+#if USE(CG)
+ ApplyStrokePattern, // FIXME: should not be a recorded item.
+ ApplyFillPattern, // FIXME: should not be a recorded item.
+#endif
+ ApplyDeviceScaleFactor,
+};
+
+WEBCORE_EXPORT size_t sizeOfItemInBytes(ItemType);
+WEBCORE_EXPORT bool isInlineItem(ItemType);
+WEBCORE_EXPORT bool isDrawingItem(ItemType);
+
+} // namespace DisplayList
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (269329 => 269330)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2020-11-03 21:08:38 UTC (rev 269330)
@@ -104,14 +104,14 @@
m_displayList.appendItem(SetInlineFillGradient::create(*changes.m_state.fillGradient));
}
-void Recorder::willAppendItem(const Item& item)
+void Recorder::willAppendItemOfType(ItemType type)
{
if (m_delegate)
- m_delegate->willAppendItem(item);
+ m_delegate->willAppendItemOfType(type);
- if (item.isDrawingItem()
+ if (isDrawingItem(type)
#if USE(CG)
- || item.type() == ItemType::ApplyStrokePattern || item.type() == ItemType::ApplyStrokePattern
+ || type == ItemType::ApplyStrokePattern || type == ItemType::ApplyStrokePattern
#endif
) {
GraphicsContextStateChange& stateChanges = currentState().stateChange;
@@ -126,10 +126,10 @@
}
}
-void Recorder::didAppendItem(const Item& item)
+void Recorder::didAppendItemOfType(ItemType type)
{
if (m_delegate)
- m_delegate->didAppendItem(item);
+ m_delegate->didAppendItemOfType(type);
}
void Recorder::updateState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
@@ -475,9 +475,10 @@
void Recorder::appendItem(Ref<Item>&& item)
{
Item& newItem = item.get();
- willAppendItem(item.get());
+ auto type = newItem.type();
+ willAppendItemOfType(type);
m_displayList.append(WTFMove(item));
- didAppendItem(newItem);
+ didAppendItemOfType(type);
}
void Recorder::updateItemExtent(DrawingItem& item) const
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (269329 => 269330)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2020-11-03 21:08:38 UTC (rev 269330)
@@ -66,8 +66,8 @@
public:
virtual ~Delegate() { }
virtual bool lockRemoteImageBuffer(WebCore::ImageBuffer&) { return false; }
- virtual void willAppendItem(const Item&) { };
- virtual void didAppendItem(const Item&) { };
+ virtual void willAppendItemOfType(ItemType) { }
+ virtual void didAppendItemOfType(ItemType) { }
};
private:
@@ -149,8 +149,8 @@
FloatRect roundToDevicePixels(const FloatRect&, GraphicsContext::RoundingMode) override;
void appendItem(Ref<Item>&&);
- void willAppendItem(const Item&);
- void didAppendItem(const Item&);
+ void willAppendItemOfType(ItemType);
+ void didAppendItemOfType(ItemType);
void appendItemAndUpdateExtent(Ref<DrawingItem>&&);
void appendStateChangeItem(const GraphicsContextStateChange&, GraphicsContextState::StateChangeFlags);
Modified: trunk/Source/WebKit/ChangeLog (269329 => 269330)
--- trunk/Source/WebKit/ChangeLog 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebKit/ChangeLog 2020-11-03 21:08:38 UTC (rev 269330)
@@ -1,5 +1,16 @@
2020-11-03 Wenson Hsieh <[email protected]>
+ Replace DisplayList::Recorder::Delegate::(will|did)AppendItem with (will|did)AppendItemOfType
+ https://bugs.webkit.org/show_bug.cgi?id=218518
+
+ Reviewed by Simon Fraser.
+
+ See WebCore ChangeLog for more information.
+
+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+
+2020-11-03 Wenson Hsieh <[email protected]>
+
Add helper methods to encode and decode IPC arguments as raw data
https://bugs.webkit.org/show_bug.cgi?id=218516
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (269329 => 269330)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2020-11-03 20:51:38 UTC (rev 269329)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h 2020-11-03 21:08:38 UTC (rev 269330)
@@ -173,7 +173,7 @@
return true;
}
- void willAppendItem(const WebCore::DisplayList::Item&) override
+ void willAppendItemOfType(WebCore::DisplayList::ItemType) override
{
constexpr size_t DisplayListBatchSize = 512;
auto& displayList = m_drawingContext.displayList();
@@ -185,9 +185,9 @@
displayList.clear();
}
- void didAppendItem(const WebCore::DisplayList::Item& item) override
+ void didAppendItemOfType(WebCore::DisplayList::ItemType type) override
{
- if (item.type() == WebCore::DisplayList::ItemType::DrawImageBuffer)
+ if (type == WebCore::DisplayList::ItemType::DrawImageBuffer)
flushDrawingContext();
}