2017-05-25 02:16:33 +00:00
|
|
|
include(platform/Cairo.cmake)
|
2017-07-05 21:26:23 +00:00
|
|
|
include(platform/Curl.cmake)
|
2016-02-10 22:01:18 +00:00
|
|
|
include(platform/ImageDecoders.cmake)
|
2020-01-23 02:45:17 +00:00
|
|
|
include(platform/OpenSSL.cmake)
|
2016-02-11 19:52:22 +00:00
|
|
|
include(platform/TextureMapper.cmake)
|
2016-02-10 22:01:18 +00:00
|
|
|
|
2020-10-22 16:47:20 +00:00
|
|
|
if (USE_DAWN)
|
|
|
|
include(platform/Dawn.cmake)
|
|
|
|
endif ()
|
|
|
|
|
2019-04-18 23:20:26 +00:00
|
|
|
list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
|
2015-08-18 00:43:55 +00:00
|
|
|
"${WEBKIT_LIBRARIES_DIR}/include"
|
2015-04-01 18:36:43 +00:00
|
|
|
"${WEBCORE_DIR}/loader/archive/cf"
|
|
|
|
"${WEBCORE_DIR}/platform/cf"
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND WebCore_SOURCES
|
|
|
|
page/win/FrameCairoWin.cpp
|
2019-06-04 19:15:21 +00:00
|
|
|
page/win/ResourceUsageOverlayWin.cpp
|
|
|
|
page/win/ResourceUsageThreadWin.cpp
|
2016-03-10 01:09:03 +00:00
|
|
|
|
2015-04-01 18:36:43 +00:00
|
|
|
platform/graphics/GLContext.cpp
|
2015-05-06 22:32:36 +00:00
|
|
|
platform/graphics/PlatformDisplay.cpp
|
2015-04-01 18:36:43 +00:00
|
|
|
|
[Cocoa] [GPU Process] Perform image decoding of color fonts in the Web Process
https://bugs.webkit.org/show_bug.cgi?id=217506
Reviewed by Simon Fraser.
Source/WebCore:
Core Text itself doesn't know how to draw things; it has to rely on Core Graphics to do that.
However, Core Graphics only understands the simplest of text drawing concepts; it doesn't understand
things like color fonts or emoji. Core Text sits between the application and Core Graphics, and is
responsible for splitting up an arbitrary draw command into individual simple pieces which Core
Graphics can understand. For example, when you ask Core Text to draw a string which is of the form
"outlines emoji outlines", Core Text will end up telling Core Graphics to draw the first outlines, then
draw the emoji image (using Core Graphics's normal image drawing routines), then draw the remaining
outlines.
This is exactly the same kind of filtering we want to do for the GPU Process. We want to be able to
separate out the glyphs which are rendered using outlines from the emoji glyphs which are rendered
using images. We want to handle the image glyphs ourself in WebKit using our own image drawing display
list facilities, which will cause images to be decoded in the Web Process, thereby increasing the
security of the GPU Process.
So, this patch implements a custom CGContext, backed by a function table that is populated in WebKit.
We pass this custom CGContext into Core Text, which does its normal splitting up of outlines / images,
and calls glyph / image drawing functions on our CGContext. Because these functions are implemented by
WebKit, this effectively makes WebKit able to intercept the drawing calls, and implement them ourself
by appending items to the current display list. So, when Core Text tells our CGContext to draw an emoji,
our callback runs and we "just" append a DrawImage display list item.
I use scare-quotes around "just" because it is a bit more complicated than that. Core Text internally
can change the fill/stroke color (for COLR glyphs), the text matrix (it should be updated between
adjacent runs), the CTM, and the shadow state (because Core Text sometimes will implement shadows itself
by just drawing the text two times). So, in our CGContext callback, we have to look at the state of
the CGContext, figure out if anything changed (because we're not notified when changes happen), and
if things did change, append additional display list items to make a parallel change happen at draw
time.
Tests added in https://trac.webkit.org/r269177
* Headers.cmake:
* PlatformAppleWin.cmake:
* PlatformWinCairo.cmake:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/FreeType.cmake:
* platform/graphics/cg/ImageBufferCGBackend.cpp:
(WebCore::ImageBufferCGBackend::setupContext):
* platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::fillVectorWithHorizontalGlyphPositions):
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h: Added.
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp: Added.
(WebCore::DisplayList::beginLayer): VTable callback for creating a transparency layer.
(WebCore::DisplayList::endLayer): Ditto for ending a transparency layer.
(WebCore::DisplayList::drawGlyphs): VTable callback for drawing outline glyphs.
(WebCore::DisplayList::drawImage): VTable callback for drawing an image.
(WebCore::DisplayList::DrawGlyphsRecorder::createInternalContext): Set up the custom CGContext
infrastructure. Hook up the VTable callbacks.
(WebCore::DisplayList::DrawGlyphsRecorder::DrawGlyphsRecorder):
(WebCore::DisplayList::DrawGlyphsRecorder::populateInternalState): We need to save the GraphicsContext
state at the beginning of the entry point, so we can restore anything that changed when we're done.
(WebCore::DisplayList::DrawGlyphsRecorder::populateInternalContext): Because Core Text internally
interrogates the CGContext to see if it needs to do things like draw shadows itself, we need to make
sure that the recorder's state is mirrored in our custom CGContext. This applies all the relevant
state to our CGContext so it's ready when Core Text asks for it.
(WebCore::DisplayList::DrawGlyphsRecorder::prepareInternalContext): Call the above two functions.
(WebCore::DisplayList::DrawGlyphsRecorder::concludeInternalContext): Called once when we're done.
This function cleans up, by possibly appending additional display list items to restore the state
back to what it was when we started.
(WebCore::DisplayList::DrawGlyphsRecorder::updateFillColor): Detect a changed fill color, and if it has
changed, append a display list item to make a parallel change at drawing time.
(WebCore::DisplayList::DrawGlyphsRecorder::updateStrokeColor): Ditto for the stroke color.
(WebCore::DisplayList::DrawGlyphsRecorder::updateCTM): Ditto for the CTM.
(WebCore::DisplayList::shadowIsCleared):
(WebCore::DisplayList::DrawGlyphsRecorder::updateShadow): Ditto for the shadow state.
(WebCore::DisplayList::DrawGlyphsRecorder::recordBeginLayer): Hook this up to beginTransparencyLayer().
(WebCore::DisplayList::DrawGlyphsRecorder::recordEndLayer): Hook this up to endTransparencyLayer().
(WebCore::DisplayList::computeAdvancesFromPositions): CGContext gives us positions, but our display list
infrastructure requires advances. Simply subtract to convert between them.
(WebCore::DisplayList::DrawGlyphsRecorder::recordDrawGlyphs): The callback that appends a DrawGlyphs
display list item. Note it has to call the various update() functions to detect changes in the CGContext
state.
(WebCore::DisplayList::DrawGlyphsRecorder::recordDrawImage): Ditto for a DrawImage display list item.
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs): The main entry point. Simply set up, do the work,
then clean up.
* platform/graphics/displaylists/DisplayListDrawGlyphsRecorderHarfBuzz.cpp: Added. Dummy implementation
to make the other ports continue to compile.
(WebCore::DisplayList::DrawGlyphsRecorder::DrawGlyphsRecorder):
(WebCore::DisplayList::DrawGlyphsRecorder::drawGlyphs):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):
(WebCore::DisplayList::Recorder::drawGlyphs): Call m_drawGlyphsRecorder.drawGlyphs() instead of just
appending a DrawGlyphs command.
(WebCore::DisplayList::Recorder::concatCTM): Tiny optimization.
(WebCore::DisplayList::Recorder::clipToDrawingCommands): The current clipToDrawingCommands's context
CTM didn't match the parallel one used during playback. In order to make the CTMs match are recording
and playback time, we have to make sure they start off the same.
* platform/graphics/displaylists/DisplayListRecorder.h: DisplayList::Recorder owns a DrawGlyphsRecorder,
whose lifetime equals that of the DisplayList::Recorder. Rather than destroying / recreating the
DrawGlyphsRecorder, the DrawGlyphsRecorder class is smart enough to clean up after itself so it can be
reused multiple times.
Source/WebCore/PAL:
Add some new entry points, and do some various cleanup.
* pal/spi/cg/CoreGraphicsSPI.h:
Canonical link: https://commits.webkit.org/231072@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-31 00:01:02 +00:00
|
|
|
platform/graphics/displaylists/DisplayListDrawGlyphsRecorderHarfBuzz.cpp
|
|
|
|
|
2015-04-01 18:36:43 +00:00
|
|
|
platform/graphics/win/FontCustomPlatformDataCairo.cpp
|
|
|
|
platform/graphics/win/FontPlatformDataCairoWin.cpp
|
|
|
|
platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
|
|
|
|
platform/graphics/win/GraphicsContextCairoWin.cpp
|
|
|
|
platform/graphics/win/ImageCairoWin.cpp
|
2015-08-11 04:46:28 +00:00
|
|
|
platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
|
2020-12-20 20:09:12 +00:00
|
|
|
platform/graphics/win/PlatformDisplayWin.cpp
|
2015-04-01 18:36:43 +00:00
|
|
|
platform/graphics/win/SimpleFontDataCairoWin.cpp
|
|
|
|
|
2018-10-16 15:21:16 +00:00
|
|
|
platform/network/win/CurlSSLHandleWin.cpp
|
|
|
|
|
2015-04-01 18:36:43 +00:00
|
|
|
platform/text/win/LocaleWin.cpp
|
|
|
|
|
|
|
|
platform/win/DelayLoadedModulesEnumerator.cpp
|
|
|
|
platform/win/DragImageCairoWin.cpp
|
|
|
|
platform/win/ImportedFunctionsEnumerator.cpp
|
|
|
|
platform/win/ImportedModulesEnumerator.cpp
|
|
|
|
platform/win/PEImage.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND WebCore_LIBRARIES
|
|
|
|
comctl32
|
|
|
|
crypt32
|
2020-07-09 19:49:58 +00:00
|
|
|
delayimp
|
2015-04-01 18:36:43 +00:00
|
|
|
iphlpapi
|
|
|
|
rpcrt4
|
|
|
|
shlwapi
|
|
|
|
usp10
|
|
|
|
version
|
|
|
|
winmm
|
|
|
|
ws2_32
|
|
|
|
)
|
|
|
|
|
2020-09-14 20:17:40 +00:00
|
|
|
# Define a INTERFACE library for MediaFoundation and link it
|
|
|
|
# explicitly with direct WebCore consumers because /DELAYLOAD causes
|
|
|
|
# linker warnings for modules not using MediaFoundation.
|
|
|
|
# LINK : warning LNK4199: /DELAYLOAD:mf.dll ignored; no imports found from mf.dll
|
|
|
|
add_library(MediaFoundation INTERFACE)
|
|
|
|
target_link_libraries(MediaFoundation INTERFACE
|
|
|
|
d3d9
|
|
|
|
dxva2
|
|
|
|
evr
|
|
|
|
mf
|
|
|
|
mfplat
|
|
|
|
)
|
|
|
|
target_link_options(MediaFoundation INTERFACE
|
|
|
|
/DELAYLOAD:d3d9.dll
|
|
|
|
/DELAYLOAD:dxva2.dll
|
|
|
|
/DELAYLOAD:evr.dll
|
|
|
|
/DELAYLOAD:mf.dll
|
|
|
|
/DELAYLOAD:mfplat.dll
|
|
|
|
)
|
2020-07-09 19:49:58 +00:00
|
|
|
|
2020-07-10 20:04:20 +00:00
|
|
|
if (USE_WOFF2)
|
|
|
|
# The WOFF2 libraries don't compile as DLLs on Windows, so add in
|
|
|
|
# the additional libraries WOFF2::dec requires
|
|
|
|
list(APPEND WebCore_LIBRARIES
|
|
|
|
WOFF2::common
|
|
|
|
brotlidec
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2015-04-01 18:36:43 +00:00
|
|
|
list(APPEND WebCoreTestSupport_LIBRARIES
|
2020-02-04 13:52:03 +00:00
|
|
|
Cairo::Cairo
|
2015-04-01 18:36:43 +00:00
|
|
|
shlwapi
|
|
|
|
)
|