Bug 184336 - When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext
Summary: When recording the drawing, the DisplayList should be initialized with the Gr...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
Keywords: InRadar
Depends on:
Blocks: 178750
  Show dependency treegraph
Reported: 2018-04-05 11:26 PDT by Said Abou-Hallawa
Modified: 2018-04-06 12:20 PDT (History)
12 users (show)

See Also:

Patch (8.14 KB, patch)
2018-04-05 11:36 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (8.14 KB, patch)
2018-04-05 11:43 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2018-04-05 11:26:16 PDT
The state of the drawing context has to be transfered to the recording DisplayList before recording. Many recording GraphicsContext functions will behave wrongly if get the default state. Here is a scenario of the bug:

-- context.m_state.fillColor = RED (context is the underlying GraphicsContext for the recorded DisplayList)
-- displayListRecorder is created to start recording.
-- displayListRecorder.m_stateStack[0].lastDrawingState.fillColor = BALCK (Because lastDrawingState was initialized by the default GraphicsContextState)
-- displayListContext is created which encapsulates the displayListRecorder
-- displayListContext.setFillColor(BALCK) is called
-- displayListContext.fillRect(rect) is called
-- displayListRecorder is replayed back into context

-- displayListContext.fillRect() will end up calling Recorder::willAppendItem() which will call GraphicsContextStateChange::changesFromState()
-- GraphicsContextStateChange::changesFromState() will not find a change in the fillColor. The recording GraphicsContext has it BALCK and it was BALCK. So there is no change here and the flag FillColorChange will not be returned
-- Recorder::willAppendItem() will not append a new SetState item in the DisplayList
-- The rectangle is filled with the current fillColor which is RED instead of BALCK as the caller wanted
Comment 1 Said Abou-Hallawa 2018-04-05 11:36:09 PDT
Created attachment 337281 [details]
Comment 2 Said Abou-Hallawa 2018-04-05 11:43:21 PDT
Created attachment 337282 [details]
Comment 3 WebKit Commit Bot 2018-04-06 12:19:46 PDT
Comment on attachment 337282 [details]

Clearing flags on attachment: 337282

Committed r230347: <https://trac.webkit.org/changeset/230347>
Comment 4 WebKit Commit Bot 2018-04-06 12:19:48 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Radar WebKit Bug Importer 2018-04-06 12:20:33 PDT