Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 922c037bca6e8cdf1186b3731e3e91a70372333a
      
https://github.com/WebKit/WebKit/commit/922c037bca6e8cdf1186b3731e3e91a70372333a
  Author: Said Abou-Hallawa <s...@apple.com>
  Date:   2023-10-23 (Mon, 23 Oct 2023)

  Changed paths:
    A 
LayoutTests/fast/canvas/canvas-line-no-change-display-p3-stroke-expected.html
    A LayoutTests/fast/canvas/canvas-line-no-change-display-p3-stroke.html
    M Source/WebCore/platform/graphics/Color.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListItem.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
    M Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp
    M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h
    M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h
    M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h
    M Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp
    M Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp

  Log Message:
  -----------
  [GPU Process] REGRESSION: display-p3 stroke color in canvas crashes the 
webpage
https://bugs.webkit.org/show_bug.cgi?id=263387
rdar://117226767

Reviewed by Simon Fraser.

Recording the inline path data items is enabled only if the state stroke has an
inline color or if the stroke color was not changed since last time the state 
was
committed.

A crash will happen when the current stroke color is not inline (display-p3 for
example) and it has been committed to the destination context in GPUP but the
stroke thickness was changed. The item SetInlineStrokeColor tries to get the
inline data a non inline color although the current stroke color is not inline
and it has not changed. So the crash happens.

The fix is to merge the inline stroke changes into one DisplayList item named
SetInlineStroke. It has two optional members: the inline color data and the
thickness. Each member will be set only if it was changed since last commit.

For representing the color in SetInlineStroke, PackedColor::RGBA will be used
instead of SRGBA<uint8_t> since it is easier to be encoded.

* 
LayoutTests/fast/canvas/canvas-line-no-change-display-p3-stroke-expected.html: 
Added.
* LayoutTests/fast/canvas/canvas-line-no-change-display-p3-stroke.html: Added.
* Source/WebCore/platform/graphics/Color.h:
(WebCore::Color::tryGetAsPackedInline const):
* Source/WebCore/platform/graphics/displaylists/DisplayListItem.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::SetInlineStroke::apply const):
(WebCore::DisplayList::SetInlineStroke::dump const):
(WebCore::DisplayList::SetInlineStrokeColor::apply const): Deleted.
(WebCore::DisplayList::SetInlineStrokeColor::dump const): Deleted.
(WebCore::DisplayList::SetStrokeThickness::apply const): Deleted.
(WebCore::DisplayList::SetStrokeThickness::dump const): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::SetInlineFillColor::SetInlineFillColor):
(WebCore::DisplayList::SetInlineFillColor::color const):
(WebCore::DisplayList::SetInlineFillColor::colorData const):
(WebCore::DisplayList::SetInlineStroke::SetInlineStroke):
(WebCore::DisplayList::SetInlineStroke::color const):
(WebCore::DisplayList::SetInlineStroke::colorData const):
(WebCore::DisplayList::SetInlineStroke::thickness const):
(WebCore::DisplayList::SetInlineStrokeColor::SetInlineStrokeColor): Deleted.
(WebCore::DisplayList::SetInlineStrokeColor::color const): Deleted.
(WebCore::DisplayList::SetInlineStrokeColor::colorData const): Deleted.
(WebCore::DisplayList::SetStrokeThickness::SetStrokeThickness): Deleted.
(WebCore::DisplayList::SetStrokeThickness::thickness const): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::appendStateChangeItem):
(WebCore::DisplayList::Recorder::buildSetInlineStroke):
(WebCore::DisplayList::Recorder::strokePath):
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h:
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::recordSetInlineFillColor):
(WebCore::DisplayList::RecorderImpl::recordSetInlineStroke):
(WebCore::DisplayList::RecorderImpl::recordStrokeLineWithColorAndThickness):
(WebCore::DisplayList::RecorderImpl::recordSetInlineStrokeColor): Deleted.
(WebCore::DisplayList::RecorderImpl::recordSetStrokeThickness): Deleted.
* Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::setInlineFillColor):
(WebKit::RemoteDisplayListRecorder::setInlineStroke):
(WebKit::RemoteDisplayListRecorder::strokeLineWithColorAndThickness):
(WebKit::RemoteDisplayListRecorder::setInlineStrokeColor): Deleted.
(WebKit::RemoteDisplayListRecorder::setStrokeThickness): Deleted.
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h:
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineFillColor):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineStroke):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeLineWithColorAndThickness):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineStrokeColor): Deleted.
(WebKit::RemoteDisplayListRecorderProxy::recordSetStrokeThickness): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
* Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/269664@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to