WebCore::URL::hostIsIPAddress needs a Windows implementation
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-24  Ross Kirsling  <ross.kirsling@sony.com>
2
3         WebCore::URL::hostIsIPAddress needs a Windows implementation
4         https://bugs.webkit.org/show_bug.cgi?id=187859
5
6         Reviewed by Fujii Hironori.
7
8         * platform/URL.cpp:
9         (WebCore::isIPv4Address): Added.
10         (WebCore::isIPv6Address): Added.
11         (WebCore::URL::hostIsIPAddress):
12         Turn this stub into a platform-agnostic default implementation.
13
14 2018-07-24  Eric Carlson  <eric.carlson@apple.com>
15
16         [MediaStream] Restructure getDisplayMedia classes
17         https://bugs.webkit.org/show_bug.cgi?id=187905
18
19         Reviewed by Dean Jackson.
20
21         No new tests, no functional changes.
22
23         * platform/mediastream/CaptureDeviceManager.h:
24         (WebCore::CaptureDeviceManager::refreshCaptureDevices): Deleted, no need for it to be a 
25         virtual method.
26         * platform/mediastream/mac/AVCaptureDeviceManager.h:
27
28         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: refreshCaptureDevices is
29         no longer virtual.
30
31         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
32         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
33         (WebCore::DisplayCaptureManagerCocoa::updateDisplayCaptureDevices): Moved functionality 
34         to ScreenDisplayCaptureSourceMac.
35         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Ditto.
36         (WebCore::displayReconfigurationCallBack): Deleted, moved to ScreenDisplayCaptureSourceMac.
37         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Deleted.
38         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Deleted.
39         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
40
41         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
42         (WebCore::roundUpToMacroblockMultiple): Moved from ScreenDisplayCaptureSourceMac.
43         (WebCore::DisplayCaptureSourceCocoa::applySize): Ditto.
44         (WebCore::DisplayCaptureSourceCocoa::sampleBufferFromPixelBuffer): Ditto.
45         (WebCore::DisplayCaptureSourceCocoa::pixelBufferFromIOSurface): Ditto.
46         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
47
48         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
49         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
50         (WebCore::updateDisplayID):
51         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Fix log message.
52         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream): Ditto.
53         (WebCore::ScreenDisplayCaptureSourceMac::applySize): Update for base class changes.
54         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate): Ditto.
55         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): Ditto.
56         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDeviceWithPersistentID): Moved from
57         DisplayCaptureManagerCocoa.
58         (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Ditto.
59         (WebCore::roundUpToMacroblockMultiple): Moved to DisplayCaptureSourceCocoa.
60         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID): Ditto.
61         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): Ditto.
62         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface): Ditto.
63
64 2018-07-24  Zalan Bujtas  <zalan@apple.com>
65
66         [LFC] Move geometry data structures to a dedicated file
67         https://bugs.webkit.org/show_bug.cgi?id=187939
68
69         Reviewed by Antti Koivisto.
70
71         * WebCore.xcodeproj/project.pbxproj:
72         * layout/FormattingContext.h:
73         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const): Deleted.
74         * layout/FormattingContextGeometry.cpp:
75         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
76         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
77         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
78         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
79         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
80         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
81         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
82         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
83         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
84         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
85         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
86         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
87         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
88         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
89         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
90         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
91         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
92         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
93         * layout/blockformatting/BlockFormattingContext.h:
94         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
95         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
96         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
97         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
98         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
99         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
100         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
101         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
102         * layout/displaytree/DisplayBox.h:
103         (WebCore::Display::Box::setHorizontalMargin):
104         (WebCore::Display::Box::setVerticalMargin):
105         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
106         (WebCore::Display::Box::setBorder):
107         (WebCore::Display::Box::setPadding):
108
109 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
110
111         [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
112         https://bugs.webkit.org/show_bug.cgi?id=187643
113
114         Reviewed by Philippe Normand.
115
116         Problem being that we do not have a proper unified encoder API in GStreamer, some work
117         started at https://bugzilla.gnome.org/show_bug.cgi?id=796716 but it is quite controversial
118         and meanwhile we should just move forward working around that limitation.
119
120         Source/WebCore:
121         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
122         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
123         (WebCore::GStreamerVideoEncoder::InitEncode):
124         (WebCore::GStreamerVideoEncoder::getBitrateSetter):
125         (WebCore::GStreamerVideoEncoder::createEncoder):
126         (WebCore::GStreamerVideoEncoder::AddCodecIfSupported):
127         (WebCore::GStreamerVideoEncoder::SetRestrictionCaps):
128         (WebCore::GStreamerVideoEncoder::CreateEncoder): Deleted.
129
130 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
131
132         REGRESSION(r234055): inverted return values in MediaPlayer::wouldTaintOrigin()
133         https://bugs.webkit.org/show_bug.cgi?id=187944
134
135         Reviewed by Carlos Garcia Campos.
136
137         The MediaPlayer::wouldTaintOrigin(), as introduced in r234055, should
138         return false when the URL protocol is `data:`, and should return true
139         when the given SecurityOrigin cannot access the media URL.
140
141         This matches behavior of CanvasRenderingContext::wouldTaintOrigin()
142         which the new method falls back to when the MediaPlayerPrivate
143         implementation doesn't or can't determine the would-taint result.
144
145         This fixes a bunch of failing and timing-out WebGL test cases on ports
146         using GStreamer (on which the MediaPlayerPrivate derivate doesn't
147         implement the wouldTaintOrigin() method).
148
149         * platform/graphics/MediaPlayer.cpp:
150         (WebCore::MediaPlayer::wouldTaintOrigin const):
151
152 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
153
154         [TextureMapper] Separate repaint counter state from debug visuals
155         https://bugs.webkit.org/show_bug.cgi?id=187946
156
157         Reviewed by Carlos Garcia Campos.
158
159         Instead of managing the repaint counter visibility along with the
160         debug border visuals, do that together with the repaint count value.
161
162         TextureMapperLayer::setRepaintCount() is renamed to setRepaintCounter()
163         and now also sets the repaint counter visibility state instead of the
164         setDebugVisuals() method.
165
166         GraphicsLayerTextureMapper implementation is adjusted appropriately.
167         The unused setRepaintCount() method is also removed.
168
169         CoordinatedGraphicsLayerState now holds repaint counter state (both
170         visibility and count value) in a struct that's separate from debug
171         border state. CoordinatedGraphicsLayer implementation now updates
172         that state accordingly.
173
174         No new tests -- no change in behavior.
175
176         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
177         (WebCore::GraphicsLayerTextureMapper::setShowRepaintCounter):
178         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
179         (WebCore::GraphicsLayerTextureMapper::setRepaintCount): Deleted.
180         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
181         * platform/graphics/texmap/TextureMapperLayer.cpp:
182         (WebCore::TextureMapperLayer::setDebugVisuals):
183         (WebCore::TextureMapperLayer::setRepaintCounter):
184         (WebCore::TextureMapperLayer::setRepaintCount): Deleted.
185         * platform/graphics/texmap/TextureMapperLayer.h:
186         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
187         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
188         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
189         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
190         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
191         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
192         (WebCore::DebugVisuals::DebugVisuals): Deleted.
193
194 2018-07-24  Thibault Saunier  <tsaunier@igalia.com>
195
196         [WPE][GTK] Implement PeerConnection API on top of libwebrtc
197         https://bugs.webkit.org/show_bug.cgi?id=186932
198
199         Reviewed by Philippe Normand.
200
201         Enabled many webrtc tests.
202
203         * platform/GStreamer.cmake: Build new files
204         * platform/graphics/gstreamer/GStreamerCommon.cpp: Fix minor style issues
205         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Add a way to give precise name to pipelines
206         and give useful names to pipelines with sources comming from a PeerConnection
207         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
208         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.cpp: Added. Implement a subclass of webrtc::VideoFrame
209         to represent a kNative GStreamer video frame.
210         * platform/mediastream/gstreamer/GStreamerVideoFrameLibWebRTC.h: Added. Ditto.
211         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp: Handle incoming audio samples from libwebrtc.
212         * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.h: Ditto.
213         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.cpp: Handle incoming video frames from libwebrtc.
214         * platform/mediastream/gstreamer/RealtimeIncomingVideoSourceLibWebRTC.h: Ditto.
215         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp: Handle passing locally captured audio sample to libwebrtc.
216         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.h: Ditto.
217         * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.cpp: Handle passing locally captured vidoe frames to libwebrtc.
218         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp: Added. Implement a video decoder factory and LibWebRTC Video decoders based on GStreamer.
219         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.h: Added. Ditto.
220         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp: Added. Implement a video encoder factory and LibWebRTC H264/VP8 Video encoders based on GStreamer.
221         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.h: Added. Ditto.
222         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Add information about signness of the LibWebRTC audio format.
223         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp: Add support for newly added Encoder/Decoder factories.
224         * platform/mediastream/libwebrtc/LibWebRTCProviderGlib.h: Ditto.
225
226 2018-07-24  Dirk Schulze  <krit@webkit.org>
227
228         [css-masking] Black backdrop on -webkit-clip-path on SVG root
229         https://bugs.webkit.org/show_bug.cgi?id=187880
230
231         Reviewed by Simon Fraser.
232
233         For SVG document root elements, we currently clip twice:
234         In RenderLayer and SVGRenderSupport.
235         Avoid clipping in RenderLayer which currently clips before we established a
236         backdrop for an SVG document.
237
238         Tests: svg/clip-path/clip-path-on-svg-005-expected.svg
239                svg/clip-path/clip-path-on-svg-005.svg
240
241         * rendering/RenderLayer.cpp:
242         (WebCore::RenderLayer::setupClipPath): Skip actual clipping.
243
244 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
245
246         [Nicosia] Add TextureMapperAnimations member to CompositingLayer::LayerState
247         https://bugs.webkit.org/show_bug.cgi?id=187941
248
249         Reviewed by Carlos Garcia Campos.
250
251         Nicosia::CompositingLayer::LayerState gains a TextureMapperAnimations
252         member that will be assigned a list of all active animations during each
253         layer flush. Despite the name, TextureMapperAnimations doesn't depend on
254         any other TextureMapper class. It might be renamed and moved in the
255         future, but for now it's used as-is.
256
257         In CoordinatedGraphicsLayer, the syncAnimations() method now flips on
258         the animationsChanged flag in the LayerState::Delta struct. This causes
259         all the active animations to be copied over into the layer state in
260         flushCompositingStateForThisLayerOnly().
261
262         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
263         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
264         (WebCore::CoordinatedGraphicsLayer::syncAnimations):
265         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
266
267 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
268
269         [Nicosia] Add FilterOperations member to CompositionLayer::LayerState
270         https://bugs.webkit.org/show_bug.cgi?id=187901
271
272         Reviewed by Carlos Garcia Campos.
273
274         Nicosia::CompositionLayer::LayerState gains a FilterOperations member
275         that can be assigned the list of filter operations for a given layer.
276         The corresponding filtersChanged boolean is added to LayerState::Delta.
277
278         CoordinatedGraphicsLayer::syncFilters() flips on that delta member,
279         which in turn causes the FilterOperations value to be updated during
280         the layer flush, in flushCompositingStateForThisLayerOnly().
281
282         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
283         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
284         (WebCore::CoordinatedGraphicsLayer::syncFilters):
285         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
286
287 2018-07-24  Zan Dobersek  <zdobersek@igalia.com>
288
289         [CoordGraphics] Use adjusted position, anchor point, size values for Nicosia::CompositionLayer state
290         https://bugs.webkit.org/show_bug.cgi?id=187899
291
292         Reviewed by Carlos Garcia Campos.
293
294         As is done for the CoordinatedGraphicsLayerState, the scale-adjusted
295         position, anchor point and size values should be used when updating the
296         corresponding Nicosia::CompositionLayer::LayerState members.
297
298         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
299         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
300
301 2018-07-23  Manuel Rego Casasnovas  <rego@igalia.com>
302
303         [css-grid] Add support for calc() in gutter properties
304         https://bugs.webkit.org/show_bug.cgi?id=187902
305
306         Reviewed by Simon Fraser.
307
308         The parsing was already accepting calc() in grid row and column gaps,
309         however the code was not taking that into account properly.
310         If the calc() had a percentage it was ignored and that's wrong.
311
312         The fix is just a change in the ceck at RenderGrid::availableSpaceForGutters().
313
314         Tests: imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002-rtl.html
315                imported/w3c/web-platform-tests/css/css-grid/abspos/grid-positioned-items-gaps-002.html
316                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-011.html
317                imported/w3c/web-platform-tests/css/css-grid/alignment/grid-gutters-012.html
318
319         * rendering/RenderGrid.cpp:
320         (WebCore::RenderGrid::availableSpaceForGutters const):
321
322 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
323
324         Remove extraneous #endif in html.css
325         https://bugs.webkit.org/show_bug.cgi?id=187934
326
327         Reviewed by Tim Horton.
328
329         * css/html.css: Remove extraneous #endif.
330
331 2018-07-23  Sihui Liu  <sihui_liu@apple.com>
332
333         CrashTracer: com.apple.WebKit.Storage at WebCore: WebCore::encodeKey
334         https://bugs.webkit.org/show_bug.cgi?id=187927
335
336         Reviewed by Chris Dumez.
337
338         IDBKeyData is valid only when each key of it is valid.
339
340         Test: LayoutTests/storage/indexeddb/index-multientry.html
341
342         * Modules/indexeddb/IDBKeyData.cpp:
343         (WebCore::IDBKeyData::isValid const):
344         * Modules/indexeddb/IDBKeyData.h:
345         (WebCore::IDBKeyData::isValid const): Deleted.
346
347 2018-07-23  Ben Richards  <benton_richards@apple.com>
348
349         We should cache the compiled sandbox profile in a data vault
350         https://bugs.webkit.org/show_bug.cgi?id=184991
351
352         Reviewed by Ryosuke Niwa.
353
354         Added functionality to FileHandle so that it can lock a file while open.
355         Added a function to FileSystem to delete non empty directories.
356
357         * platform/FileHandle.cpp:
358         (WebCore::FileHandle::FileHandle):
359         (WebCore::FileHandle::open):
360         (WebCore::FileHandle::close):
361         * platform/FileHandle.h:
362         * platform/FileSystem.h:
363         * platform/cocoa/FileSystemCocoa.mm:
364         (WebCore::FileSystem::deleteNonEmptyDirectory):
365
366 2018-07-23  Justin Fan  <justin_fan@apple.com>
367
368         [macOS] Ensure that WebGL contexts are always set to an accelerated virtual screen
369         https://bugs.webkit.org/show_bug.cgi?id=187923
370
371         Reviewed by Dean Jackson.
372
373         On eGPU displays, it is possible that CGL does not match the preferred renderer. 
374         In this case, and when the web process is blocked from accessing the window server, 
375         3D contexts *may* default to the software renderer. Ensure that even if this occurs,
376         we set the context to use a hardware-accelerated renderer/virtual screen.
377
378         No new tests. Existing behavior covered by existing tests.
379         Requires multiple screens, at least one attached to an eGPU, to stress. 
380
381         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
382         (WebCore::identifyAndSetCurrentGPU):
383
384 2018-07-23  Sam Weinig  <sam@webkit.org>
385
386         Convert some obvious never-null pointers to references in the editing code
387         https://bugs.webkit.org/show_bug.cgi?id=187914
388
389         Reviewed by Dean Jackson.
390
391         Fixup trivial cases of never-null pointers that really should be references.
392
393         * editing/ApplyStyleCommand.cpp:
394         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
395         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
396         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
397         (WebCore::ApplyStyleCommand::removeCSSStyle):
398         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
399         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
400         * editing/EditingStyle.cpp:
401         (WebCore::EditingStyle::overrideWithStyle):
402         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
403         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement const):
404         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes const):
405         (WebCore::EditingStyle::extractConflictingImplicitStyleOfAttributes const):
406         (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const):
407         (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent):
408         (WebCore::EditingStyle::mergeInlineStyleOfElement):
409         (WebCore::EditingStyle::wrappingStyleForSerialization):
410         (WebCore::EditingStyle::legacyFontSize const):
411         (WebCore::StyleChange::StyleChange):
412         (WebCore::StyleChange::extractTextStyles):
413         (WebCore::legacyFontSizeFromCSSValue):
414         * editing/EditingStyle.h:
415         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
416         * editing/Editor.cpp:
417         (WebCore::Editor::selectionStartCSSPropertyValue):
418         * editing/ReplaceSelectionCommand.cpp:
419         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
420         (WebCore::isInlineNodeWithStyle):
421         * editing/markup.cpp:
422         (WebCore::StyledMarkupAccumulator::appendElement):
423         (WebCore::StyledMarkupAccumulator::serializeNodes):
424
425 2018-07-23  Per Arne Vollan  <pvollan@apple.com>
426
427         WebCore::primaryScreenDisplayID() always return 0
428         https://bugs.webkit.org/show_bug.cgi?id=187922
429         <rdar://problem/42286933>
430
431         Reviewed by Geoffrey Garen.
432
433         This function should return a valid display ID.
434
435         No new tests. Testing this requires a dual monitor setup.
436
437         * platform/mac/PlatformScreenMac.mm:
438         (WebCore::primaryScreenDisplayID):
439
440 2018-07-23  Nan Wang  <n_wang@apple.com>
441
442         AX: Press tab to highlight items on a webpage is not working with voiceover enabled
443         https://bugs.webkit.org/show_bug.cgi?id=187824
444
445         Reviewed by Zalan Bujtas.
446
447         We are deferring posting focused element change notification when the document needs a
448         style recalculation. However, we only perform the cache update after a layout is completed.
449         Added a timer to perform the cache update in the next runloop when non-layout type of mutation
450         happens.
451         
452         Test: accessibility/mac/tab-focus-post-notification.html
453
454         * accessibility/AXObjectCache.cpp:
455         (WebCore::AXObjectCache::AXObjectCache):
456         (WebCore::AXObjectCache::~AXObjectCache):
457         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
458         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
459         * accessibility/AXObjectCache.h:
460         (WebCore::AXObjectCache::AXObjectCache):
461         (WebCore::AXObjectCache::performCacheUpdateTimerFired):
462
463 2018-07-23  Chris Dumez  <cdumez@apple.com>
464
465         WebResourceLoadStatisticsStore fails to unregister itself as a MessageReceiver in its destructor
466         https://bugs.webkit.org/show_bug.cgi?id=187910
467         <rdar://problem/42356526>
468
469         Reviewed by Brent Fulgham.
470
471         Add internals API that causes the ResourceLoadObserver to notify its observer, and avoid waiting
472         for the 5 second delay.
473
474         * testing/Internals.cpp:
475         (WebCore::Internals::notifyResourceLoadObserver):
476         * testing/Internals.h:
477         * testing/Internals.idl:
478
479 2018-07-23  Zalan Bujtas  <zalan@apple.com>
480
481         [LCF][IFC] Add support for hyphenation.
482         https://bugs.webkit.org/show_bug.cgi?id=187913
483
484         Reviewed by Antti Koivisto.
485
486         Move the hyphenation logic over from SimpleLineLayout::TextFragmentIterator.
487
488         * layout/inlineformatting/textlayout/Runs.h:
489         (WebCore::Layout::TextRun::hasHyphen const):
490         (WebCore::Layout::LayoutRun::setHasHyphen):
491         (WebCore::Layout::LayoutRun::hasHyphen const):
492         (WebCore::Layout::LayoutRun::LayoutRun):
493         (WebCore::Layout::TextRun::createNonWhitespaceRunWithHyphen):
494         (WebCore::Layout::TextRun::TextRun):
495         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
496         (WebCore::Layout::TextContentProvider::findTextItemSlow const):
497         (WebCore::Layout::TextContentProvider::width const):
498         (WebCore::Layout::TextContentProvider::hyphenPositionBefore const):
499         * layout/inlineformatting/textlayout/TextContentProvider.h:
500         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
501         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
502         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
503         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
504         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
505         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
506         (WebCore::Layout::SimpleLineBreaker::Line::append):
507         (WebCore::Layout::SimpleLineBreaker::Line::reset):
508         (WebCore::Layout::SimpleLineBreaker::Style::Style):
509         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
510         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
511         (WebCore::Layout::SimpleLineBreaker::hyphenPositionBefore const):
512         (WebCore::Layout::SimpleLineBreaker::adjustSplitPositionWithHyphenation const):
513         (WebCore::Layout::SimpleLineBreaker::split const):
514         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
515
516 2018-07-23  Antoine Quint  <graouts@apple.com>
517
518         [Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash
519         https://bugs.webkit.org/show_bug.cgi?id=187906
520
521         Reviewed by Dean Jackson.
522
523         Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html
524
525         Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime
526         without checking that the effect is non-null, we can crash in the case where the animation is finished and
527         its target element has been removed, which caused the effect to be set to null.
528
529         We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead
530         ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be
531         performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved()
532         which notifies the timeline of an element being removed such that we may stop referencing any animation
533         targeting this element from the various data structures holding strong references to the animation in question,
534         and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or
535         rejected as a result.
536
537         Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has
538         `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`.
539         While it is correct that WebAnimation owns its effect, which is established by the DOM API, the
540         reverse is not correct since we only hold the reverse internally for the benefit of our implementation.
541         As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not
542         calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline
543         is sufficient to guarantee that the document timeline will not leak (and with it the document).
544
545         * animation/AnimationEffectReadOnly.h:
546         (WebCore::AnimationEffectReadOnly::setAnimation):
547         * animation/AnimationTimeline.cpp:
548         (WebCore::AnimationTimeline::elementWasRemoved):
549         * animation/AnimationTimeline.h:
550         * animation/WebAnimation.cpp:
551         (WebCore::WebAnimation::cancel):
552         (WebCore::WebAnimation::resetPendingTasks):
553         * animation/WebAnimation.h:
554         * dom/Element.cpp:
555         (WebCore::Element::removedFromAncestor):
556         * rendering/updating/RenderTreeUpdater.cpp:
557         (WebCore::RenderTreeUpdater::tearDownRenderers):
558
559 2018-07-23  Aditya Keerthi  <akeerthi@apple.com>
560
561         [iOS] Add support for input[type=color]
562         https://bugs.webkit.org/show_bug.cgi?id=187871
563
564         Reviewed by Tim Horton.
565
566         * css/html.css: Remove unwanted styling for color inputs with a list attribute.
567         * html/ColorInputType.cpp: Make the element focusable.
568         (WebCore::ColorInputType::isMouseFocusable const):
569         (WebCore::ColorInputType::isKeyboardFocusable const):
570         * html/ColorInputType.h:
571         * html/HTMLInputElement.h: Expose isColorControl() to WebKit.
572         * page/Chrome.cpp:
573         (WebCore::Chrome::createColorChooser):
574
575 2018-07-22  Dean Jackson  <dino@apple.com>
576
577         fullscreen env() variables should have initial values
578         https://bugs.webkit.org/show_bug.cgi?id=187897
579         <rdar://problem/42485682>
580
581         Reviewed by Sam Weinig.
582
583         The env() values for fullscreen properties need to be
584         initialized, rather than wait for values to be set from WebKit.
585         Without this, feature detection doesn't work, and properties
586         won't parse correctly.
587
588         Test: fullscreen/fullscreen-env-initial.html
589
590         * dom/ConstantPropertyMap.cpp:
591         (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
592         (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
593         also updates the duration value.
594         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
595         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
596         * dom/ConstantPropertyMap.h:
597         * page/Page.cpp:
598         (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
599         * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
600         (WebCore::Page::fullscreenAutoHideDuration const):
601
602 2018-07-22  Zalan Bujtas  <zalan@apple.com>
603
604         [LFC][IFC] Add center/right/justify line alignment support.
605         https://bugs.webkit.org/show_bug.cgi?id=187890
606
607         Reviewed by Antti Koivisto.
608
609         Move over some more code from simple line layout.
610         (though text-align: justify is more preformant as now expansion opportunities are added as we process the text runs
611         -as opposed to iterting through the runs again when we reach the end of the line.) 
612
613         * layout/inlineformatting/textlayout/Runs.h:
614         (WebCore::Layout::LayoutRun::setLeft):
615         (WebCore::Layout::LayoutRun::setExpansion):
616         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp:
617         (WebCore::Layout::SimpleLineBreaker::Line::Line):
618         (WebCore::Layout::SimpleLineBreaker::Line::setTextAlign):
619         (WebCore::Layout::SimpleLineBreaker::Line::adjustedLeftForTextAlign const):
620         (WebCore::Layout::SimpleLineBreaker::Line::justifyRuns):
621         (WebCore::Layout::SimpleLineBreaker::Line::adjustRunsForTextAlign):
622         (WebCore::Layout::expansionOpportunity):
623         (WebCore::Layout::expansionBehavior):
624         (WebCore::Layout::SimpleLineBreaker::Line::collectExpansionOpportunities):
625         (WebCore::Layout::SimpleLineBreaker::Line::closeLastRun):
626         (WebCore::Layout::SimpleLineBreaker::Line::append):
627         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
628         (WebCore::Layout::SimpleLineBreaker::Line::reset):
629         (WebCore::Layout::SimpleLineBreaker::Style::Style):
630         (WebCore::Layout::SimpleLineBreaker::handleLineEnd):
631         (WebCore::Layout::SimpleLineBreaker::handleLineStart):
632         (WebCore::Layout::isTextAlignRight):
633         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
634         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h:
635         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
636         (WebCore::Layout::SimpleLineBreaker::Line::setCollapseWhitespace):
637
638 2018-07-21  Zalan Bujtas  <zalan@apple.com>
639
640         [LFC][IFC] Add verification for inline text runs.
641         https://bugs.webkit.org/show_bug.cgi?id=187879
642
643         Reviewed by Antti Koivisto.
644
645         * layout/Verification.cpp:
646         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
647         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
648         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
649         (WebCore::Layout::verifyAndOutputSubtree):
650         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): Deleted.
651         * layout/inlineformatting/InlineFormattingContext.cpp:
652         (WebCore::Layout::InlineFormattingContext::layout const):
653         * layout/inlineformatting/InlineFormattingState.h:
654         (WebCore::Layout::InlineFormattingState::addLayoutRuns):
655         (WebCore::Layout::InlineFormattingState::layoutRuns const):
656         * layout/layouttree/LayoutTreeBuilder.cpp:
657         (WebCore::Layout::outputLayoutBox):
658         (WebCore::Layout::outputLayoutTree):
659         (WebCore::Layout::TreeBuilder::showLayoutTree):
660
661 2018-07-21  Zalan Bujtas  <zalan@apple.com>
662
663         [LFC] Do not use virtual methods to construct floating/formatting states.
664         https://bugs.webkit.org/show_bug.cgi?id=187875
665
666         Reviewed by Antti Koivisto.
667
668         LayoutContext::establishedFormattingState() does not require FormattingContext anymore only the root of the context.
669
670         * layout/FormattingContext.cpp:
671         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
672         * layout/FormattingContext.h:
673         * layout/LayoutContext.cpp:
674         (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree):
675         (WebCore::Layout::LayoutContext::formattingStateForBox const):
676         (WebCore::Layout::LayoutContext::establishedFormattingState):
677         * layout/LayoutContext.h:
678         * layout/blockformatting/BlockFormattingContext.cpp:
679         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
680         (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
681         (WebCore::Layout::BlockFormattingContext::createFormattingState const): Deleted.
682         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const): Deleted.
683         * layout/blockformatting/BlockFormattingContext.h:
684         * layout/inlineformatting/InlineFormattingContext.cpp:
685         (WebCore::Layout::InlineFormattingContext::createFormattingState const): Deleted.
686         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const): Deleted.
687         * layout/inlineformatting/InlineFormattingContext.h:
688
689 2018-07-21  Zalan Bujtas  <zalan@apple.com>
690
691         [LFC][BFC] Do not collapse top/bottom margin with first/last inflow child from a non-block formatting context.
692         https://bugs.webkit.org/show_bug.cgi?id=187867
693
694         Reviewed by Antti Koivisto.
695
696         The box's top/bottom margin never collapses with a non-block inflow child.
697
698         * layout/blockformatting/BlockMarginCollapse.cpp:
699         (WebCore::Layout::isMarginTopCollapsedWithSibling):
700         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
701         (WebCore::Layout::isMarginTopCollapsedWithParent):
702         (WebCore::Layout::isMarginBottomCollapsedThrough):
703         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
704         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
705         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
706         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
707         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
708         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
709         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
710         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
711         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
712         * layout/layouttree/LayoutBox.cpp:
713         (WebCore::Layout::Box::establishesBlockFormattingContextOnly const): <div style="overflow: hidden">foobar</div> establishes both inline and block formatting context (inline wins though).
714         * layout/layouttree/LayoutBox.h: establishesBlockFormattingContext() does not need to be virtual since we can determine it by looking at the box's style. -while in case
715         of inline formatting context, it is about the content.
716
717 2018-07-20  Jer Noble  <jer.noble@apple.com>
718
719         REGRESSION (r233974): Cannot close pip'd video; pops back into PiP.
720         https://bugs.webkit.org/show_bug.cgi?id=187873
721
722         Reviewed by Jon Lee.
723
724         When the PIP machinery on Mac wants to close the PIP window (due to the close button being clicked), it does
725         not consult our -shouldClosePiP handler; it just tells us that we're going to close. So we never setup the 
726         necessary state on the WebProcess side and still think that our "targetIsFullscreen". When we get the "stop"
727         action, just request exit fullscreen, but set up the _pipState to think we're already exiting (because we are).
728
729         * platform/mac/VideoFullscreenInterfaceMac.mm:
730         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]):
731
732 2018-07-20  Justin Fan  <justin_fan@apple.com>
733
734         Safari WebGL does not consistently provide correct GPU context on eGPU systems
735         https://bugs.webkit.org/show_bug.cgi?id=187750
736         <rdar://problem/39531436>
737
738         Reviewed by Dean Jackson.
739
740         Move GraphicsContext3DManager into its own class, and notify it when page/Chrome receives a 
741         windowScreenDidChange message. Add a private data struct to track which hostWindow created each context.
742         Upon notification, Manager updates the contexts that match the hostWindow with the
743         provided displayID. Each context matches displayID to rendererID (set during process creation 
744         if window server is blocked), which is matched to a virtual screen, and updates its GPU accordingly.
745
746         No new tests. This requires multiple GPUs or eGPUs, each with attached display(s), to test.
747
748         * WebCore.xcodeproj/project.pbxproj:
749         * page/Chrome.cpp:
750         (WebCore::Chrome::windowScreenDidChange): Now calls GraphicsContext3DManager::screenDidChange().
751         * platform/PlatformScreen.h:
752         * platform/ScreenProperties.h: Add rendererID to struct.
753         (WebCore::ScreenData::encode const):
754         (WebCore::ScreenData::decode):
755         * platform/graphics/GraphicsContext3D.h:
756         * platform/graphics/GraphicsContext3DManager.cpp: Added (copied out of GraphicsContext3DCocoa.mm).
757         (WebCore::attachToAppleGraphicsControl):
758         (WebCore::hasMuxCapability):
759         (WebCore::hasMuxableGPU):
760         (WebCore::GraphicsContext3DManager::sharedManager):
761         (WebCore::displayWasReconfigured):
762         (WebCore::GraphicsContext3DManager::updateAllContexts):
763         (WebCore::GraphicsContext3DManager::screenDidChange):
764         (WebCore::GraphicsContext3DManager::addContext):
765         (WebCore::GraphicsContext3DManager::removeContext):
766         (WebCore::GraphicsContext3DManager::hostWindowForContext const):
767         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance):
768         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance):
769         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
770         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired):
771         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary):
772         * platform/graphics/GraphicsContext3DManager.h: Added (copied out of GraphicsContext3DCocoa.mm).
773         (WebCore::GraphicsContext3DManager::hasTooManyContexts const):
774         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager):
775         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
776         (WebCore::GraphicsContext3D::create):
777         (WebCore::GraphicsContext3D::createShared):
778         (WebCore::identifyAndSetCurrentGPU): Now matches rendererIDs to determine virtual screen. 
779         (WebCore::GraphicsContext3D::GraphicsContext3D):
780         (WebCore::GraphicsContext3D::~GraphicsContext3D):
781         (WebCore::GraphicsContext3D::setContextVisibility):
782         (WebCore::GraphicsContext3D::simulateContextChanged):
783         (WebCore::GraphicsContext3D::screenDidChange):
784         (WebCore::attachToAppleGraphicsControl): Deleted.
785         (WebCore::hasMuxCapability): Deleted.
786         (WebCore::hasMuxableGPU): Deleted.
787         (WebCore::GraphicsContext3DManager::GraphicsContext3DManager): Deleted.
788         (WebCore::GraphicsContext3DManager::hasTooManyContexts const): Deleted.
789         (WebCore::manager): Deleted.
790         (WebCore::displayWasReconfigured): Deleted.
791         (WebCore::GraphicsContext3DManager::updateAllContexts): Deleted.
792         (WebCore::GraphicsContext3DManager::addContext): Deleted.
793         (WebCore::GraphicsContext3DManager::removeContext): Deleted.
794         (WebCore::GraphicsContext3DManager::addContextRequiringHighPerformance): Deleted.
795         (WebCore::GraphicsContext3DManager::removeContextRequiringHighPerformance): Deleted.
796         (WebCore::GraphicsContext3DManager::updateHighPerformanceState): Deleted.
797         (WebCore::GraphicsContext3DManager::disableHighPerformanceGPUTimerFired): Deleted.
798         (WebCore::GraphicsContext3DManager::recycleContextIfNecessary): Deleted.
799         * platform/mac/PlatformScreenMac.mm: Provide a display's rendererID.
800         (WebCore::rendererIDForDisplayMask):
801         (WebCore::collectScreenProperties):
802         (WebCore::rendererIDForDisplay):
803         (WebCore::primaryRendererID):
804
805 2018-07-19  Simon Fraser  <simon.fraser@apple.com>
806
807         Remove completed animations from GraphicsLayer, thus avoiding excessive backing store allocation
808         https://bugs.webkit.org/show_bug.cgi?id=187844
809         rdar://problem/40387294
810
811         Reviewed by Dean Jackson.
812         
813         A keyframe animation which animates 3D transforms, and is fill-forwards, currently
814         leaves the GraphicsLayer in a state where it has a "running" animation. However, the
815         logic that computes animation extent in RenderLayerBacking::updateGeometry() only does
816         so for running or paused animations. GraphicsLayer then thinks that it has an active
817         transform animation with unknown extent, and refuses to detach its backing store.
818         
819         This triggers excessive layer creation on some sites (e.g. https://www.kqed.org).
820         
821         Fix by always removing animations from the GraphicsLayer when they finish, whether
822         or not they fill forwards. This is done by having KeyframeAnimation::onAnimationEnd()
823         always call endAnimation().
824         
825         This change only fixes the non-Web Animation code path. webkit.org/b/187845 exists
826         to fix the other code path.
827         
828         Also improve some logging that would have revealed this problem sooner.
829
830         Test: compositing/backing/backing-store-attachment-fill-forwards-animation.html
831
832         * page/animation/AnimationBase.h:
833         (WebCore::AnimationBase::endAnimation):
834         * page/animation/ImplicitAnimation.cpp:
835         (WebCore::ImplicitAnimation::endAnimation):
836         * page/animation/ImplicitAnimation.h:
837         * page/animation/KeyframeAnimation.cpp:
838         (WebCore::KeyframeAnimation::endAnimation):
839         (WebCore::KeyframeAnimation::onAnimationEnd):
840         * page/animation/KeyframeAnimation.h:
841         * platform/graphics/ca/GraphicsLayerCA.cpp:
842         (WebCore::GraphicsLayerCA::addAnimation):
843         (WebCore::GraphicsLayerCA::updateCoverage):
844
845 2018-07-20  Ryosuke Niwa  <rniwa@apple.com>
846
847         Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
848         https://bugs.webkit.org/show_bug.cgi?id=187846
849
850         Reviewed by Simon Fraser.
851
852         This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders
853         can get and set inverted colors using attributed strings for a selected text in an editable region.
854
855         More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's
856         _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting
857         into DOM so that the color visible to the user matches that's given to WebKit. Conversely,
858         [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after
859         the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user.
860
861         Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to
862         StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware
863         of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be
864         applied of the same color filter before being presented to the user).
865
866         Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with
867         the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 
868
869         Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html
870                editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
871                editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
872                editing/style/set-backColor-with-color-filter.html
873                editing/style/set-foreColor-with-color-filter.html
874
875         * editing/EditingStyle.cpp:
876         (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added.
877         (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand
878         which is not desirable, and won't work for background color.
879         (WebCore::StyleChange::extractTextStyles): Ditto.
880         * editing/EditingStyle.h:
881         * editing/Editor.cpp:
882         (WebCore::Editor::applyStyle):
883         (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is
884         set to InvertColor.
885         * editing/Editor.h:
886         * editing/EditorCommand.cpp:
887         (WebCore::applyCommandToFrame): Added the aforementioned testing hook.
888         * editing/cocoa/HTMLConverter.mm:
889         (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this
890         function to compute the font color in the selected text. Note that this function is mostly used for input methods
891         so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter.
892
893 2018-07-19  Jer Noble  <jer.noble@apple.com>
894
895         HLS resources with remote subresources will not taint canvasses.
896         https://bugs.webkit.org/show_bug.cgi?id=187731
897         <rdar://problem/42290703>
898
899         Reviewed by Brady Eidson.
900
901         Test: http/tests/security/canvas-remote-read-remote-video-hls.html
902
903         Most media sources are single-resource; they are accessed from a single origin. HLS manifests can contain many
904         subresources from arbitrary origins, and canvases should be tainted when painted from media elements whose
905         subresources were retrieved from tainting origins.
906
907         Add a new method to HTMLMediaElement, wouldTaintOrigin(), taking a SecurityOrigin, and returning whether the
908         media element would taint that origin. This gets piped all the way down to MediaPlayerPrivateAVFoundationObjC
909         which uses WebCoreNSURLSession to track all the origins of all the responses which resulted from the media
910         element's load.
911
912         Drive-by fix: also fix this issue for media elements which render to an AudioContext.
913
914         Drive-by fix #2: CanvasRenderingContext2DBase::createPattern() needs to check the return value of
915         ImageBuffer::create() before using it.
916
917         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
918         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
919         * html/HTMLMediaElement.cpp:
920         (WebCore::HTMLMediaElement::didAttachRenderers):
921         (WebCore::HTMLMediaElement::didDetachRenderers):
922         (WebCore::HTMLMediaElement::scheduleUpdateShouldAutoplay):
923         * html/HTMLMediaElement.h:
924         (WebCore::HTMLMediaElement::wouldTaintOrigin const):
925         * html/canvas/CanvasRenderingContext.cpp:
926         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
927         * html/canvas/CanvasRenderingContext2DBase.cpp:
928         (WebCore::CanvasRenderingContext2DBase::createPattern):
929         * platform/graphics/MediaPlayer.cpp:
930         (WebCore::MediaPlayer::wouldTaintOrigin const):
931         * platform/graphics/MediaPlayer.h:
932         * platform/graphics/MediaPlayerPrivate.h:
933         (WebCore::MediaPlayerPrivateInterface::hasSingleSecurityOrigin const):
934         (WebCore::MediaPlayerPrivateInterface::wouldTaintOrigin const):
935         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
936         (WebCore::CDMSessionAVContentKeySession::update):
937         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
938         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
939         (WebCore::MediaPlayerPrivateAVFoundationObjC::wouldTaintOrigin const):
940         * platform/network/cocoa/WebCoreNSURLSession.h:
941         * platform/network/cocoa/WebCoreNSURLSession.mm:
942         (-[WebCoreNSURLSession task:didReceiveResponseFromOrigin:]):
943         (-[WebCoreNSURLSession wouldTaintOrigin:]):
944         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
945
946 2018-07-20  Zalan Bujtas  <zalan@apple.com>
947
948         Update FrameView::paintContents to use release logging.
949         https://bugs.webkit.org/show_bug.cgi?id=187854
950         <rdar://problem/42432371>
951
952         Reviewed by Simon Fraser.
953
954         Adding release logging helps identifying blank content cases. 
955
956         * page/FrameView.cpp:
957         (WebCore::FrameView::paintContents):
958
959 2018-07-20  Jer Noble  <jer.noble@apple.com>
960
961         First Auto-PiP from Fullscreen too small & animation blocks
962         https://bugs.webkit.org/show_bug.cgi?id=187745
963         <rdar://problem/42316583>
964
965         Reviewed by Jon Lee.
966
967         1) When Auto-PiPing, we don't have the luxury of setting up the fullscreen state
968         ahead of time; we get notified that PiP has already started. The area of the code
969         which does this just-in-time setup needs to set the video layer's frame so that the
970         transform within the PiP window is correct.
971
972         2) We generate a placeholder image when going into fullscreen, but we need to do
973         so synchronously. Create the AVPlayerItemVideoOutput up front at AVPlayerItem creation
974         time wherever AVPIVO is available.
975
976         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
977         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
978         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
979         (VideoFullscreenInterfaceAVKit::doSetup):
980
981 2018-07-20  Antoine Quint  <graouts@apple.com>
982
983         DeclarativeAnimation should suspend, resume, & stop m_eventQueue
984         https://bugs.webkit.org/show_bug.cgi?id=187216
985         <rdar://problem/41669739>
986
987         Reviewed by Ryosuke Niwa.
988
989         Suspend, resume and close the GenericEventQueue for DeclarativeAnimation as instructed through the DOMActiveObject protocol.
990
991         * animation/DeclarativeAnimation.cpp:
992         (WebCore::DeclarativeAnimation::stop):
993         (WebCore::DeclarativeAnimation::suspend):
994         (WebCore::DeclarativeAnimation::resume):
995         * animation/DeclarativeAnimation.h:
996         * animation/WebAnimation.h:
997
998 2018-07-20  Zalan Bujtas  <zalan@apple.com>
999
1000         [LFC][Inline formatting context] Add basic text content handling.
1001         https://bugs.webkit.org/show_bug.cgi?id=187860
1002
1003         Reviewed by Antti Koivisto.
1004
1005         InlineFormattingContext::layout() walks through the formatting root's descendant list in a post-order fashion and
1006         feeds the TextContentProvider.
1007         Eventually this would turn into a more generic loop where we stop and process the text content when finding a non-text content box (float, inline-box etc), but right now
1008         this is about text content only.
1009
1010         * layout/displaytree/DisplayBox.h:
1011         (WebCore::Display::Box::contentBoxBottom const):
1012         (WebCore::Display::Box::contentBoxRight const):
1013         * layout/inlineformatting/InlineFormattingContext.cpp:
1014         (WebCore::Layout::InlineFormattingContext::layout const):
1015         * layout/inlineformatting/textlayout/TextContentProvider.cpp:
1016         (WebCore::Layout::TextContentProvider::textRuns): Add a helper function to support the case when all we need is just the run list in one go.
1017         * layout/inlineformatting/textlayout/TextContentProvider.h:
1018         * layout/layouttree/LayoutBox.cpp:
1019         (WebCore::Layout::Box::isDescendantOf const):
1020         * layout/layouttree/LayoutBox.h:
1021         * layout/layouttree/LayoutInlineBox.h:
1022         (WebCore::Layout::InlineBox::textContent const):
1023
1024 2018-07-20  Youenn Fablet  <youenn@apple.com>
1025
1026         FetchResponse should close its stream when loading finishes
1027         https://bugs.webkit.org/show_bug.cgi?id=187790
1028
1029         Reviewed by Chris Dumez.
1030
1031         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
1032         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
1033         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
1034         This is consistent to errors sent back through callbacks.
1035
1036         Covered by existing tests.
1037
1038         * Modules/fetch/FetchBodyOwner.cpp:
1039         (WebCore::FetchBodyOwner::~FetchBodyOwner):
1040         * Modules/fetch/FetchBodyOwner.h:
1041         * Modules/fetch/FetchBodySource.cpp:
1042         (WebCore::FetchBodySource::FetchBodySource):
1043         (WebCore::FetchBodySource::setActive):
1044         (WebCore::FetchBodySource::setInactive):
1045         (WebCore::FetchBodySource::doStart):
1046         (WebCore::FetchBodySource::doPull):
1047         (WebCore::FetchBodySource::doCancel):
1048         (WebCore::FetchBodySource::cleanBodyOwner):
1049         * Modules/fetch/FetchBodySource.h:
1050         * Modules/fetch/FetchResponse.cpp:
1051         (WebCore::FetchResponse::BodyLoader::didSucceed):
1052         (WebCore::FetchResponse::BodyLoader::didFail):
1053
1054 2018-07-20  Jer Noble  <jer.noble@apple.com>
1055
1056         REGRESSION(r233969): ASSERT in -[WebAVPlayerLayer setVideoGravity:]
1057         https://bugs.webkit.org/show_bug.cgi?id=187814
1058         <rdar://problem/42391869>
1059
1060         Reviewed by Eric Carlson.
1061
1062         After r233969 caused models to disassociate themselves from interfaces, it is now possible that an
1063         VideoFullscreenInterfaceAVKit can have a nil model. We should null-check, not ASSERT, now that the
1064         assertion no longer holds true.
1065
1066         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1067         (-[WebAVPlayerLayer layoutSublayers]):
1068         (-[WebAVPlayerLayer resolveBounds]):
1069         (-[WebAVPlayerLayer setVideoGravity:]):
1070
1071 2018-07-19  Antoine Quint  <graouts@apple.com>
1072
1073         Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
1074         https://bugs.webkit.org/show_bug.cgi?id=187530
1075         <rdar://problem/42095186>
1076
1077         Reviewed by Dean Jackson.
1078
1079         We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
1080         nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
1081         we would create animations for animation names that may be empty or not match an existing @keyframes rule.
1082         Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
1083         seeing a progression in the CSS Animations WPT tests.
1084
1085         * animation/AnimationTimeline.cpp:
1086         (WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
1087         is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
1088         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
1089         * animation/KeyframeEffectReadOnly.cpp:
1090         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
1091         an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
1092         * css/StyleResolver.cpp:
1093         (WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
1094         a known @keyframes rule.
1095         * css/StyleResolver.h:
1096
1097 2018-07-19  Chris Dumez  <cdumez@apple.com>
1098
1099         Crash under WebCore::DocumentWriter::addData()
1100         https://bugs.webkit.org/show_bug.cgi?id=187819
1101         <rdar://problem/41328743>
1102
1103         Reviewed by Brady Eidson.
1104
1105         When AppCache is used a DocumentLoader may start a NetworkLoad even though it has substitute data.
1106         In DocumentLoader::continueAfterContentPolicy(), if we have substitute data we commit this data
1107         and call finishLoad(). However, if the case where there was a NetworkLoad started, we'll send the
1108         ContinueDidReceiveResponse IPC back to the network process and it will start sending us data for
1109         the load. This could lead to crashes such as <rdar://problem/41328743> since the DocumentLoader
1110         has already committed data and finished loading when it gets the data from the network process.
1111
1112         To address the issue, we now call clearMainResource() in continueAfterContentPolicy(), after we've
1113         decided to commit the substitute data. This effectively removes the DocumentLoader as a client of
1114         the CachedResource so that its will not be notified of following load progress. We do not cancel
1115         the load as other CachedResourceClients may be interested in the load (ApplicationCacheResourceLoader
1116         in particular, in order to update its cached data).
1117
1118         * loader/DocumentLoader.cpp:
1119         (WebCore::DocumentLoader::continueAfterContentPolicy):
1120
1121 2018-07-19  Dean Jackson  <dino@apple.com>
1122
1123         CrashTracer: com.apple.WebKit.WebContent.Development at com.apple.WebCore: std::optional<WTF::Vector<WebCore::PluginInfo, 0ul, WTF::CrashOnOverflow, 16ul> >::operator* & + 73
1124         https://bugs.webkit.org/show_bug.cgi?id=187820
1125         <rdar://problem/42017759>
1126
1127         Reviewed by Antoine Quint.
1128
1129         Speculative fix for this crash, which is accessing an optional without checking
1130         if it exists. The crash logs didn't point to a reproducible test case.
1131
1132         * plugins/PluginData.cpp:
1133         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const): Return false if
1134         the optional doesn't exist.
1135
1136 2018-07-19  Antoine Quint  <graouts@apple.com>
1137
1138         Ensure DocumentTimeline is kept alive until the VM::whenIdle callback is called
1139         https://bugs.webkit.org/show_bug.cgi?id=187692
1140
1141         Reviewed by Ryosuke Niwa.
1142
1143         Ensure we keep the DocumentTimeline alive until the VM::whenIdle callback is called.
1144
1145         * animation/DocumentTimeline.cpp:
1146         (WebCore::DocumentTimeline::currentTime):
1147
1148 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
1149
1150         Setting foreground color when editing should take color-filter into account, and report the correct foreground color for collapsed selections
1151         https://bugs.webkit.org/show_bug.cgi?id=187778
1152
1153         Reviewed by Ryosuke Niwa.
1154         
1155         Fix two aspects of editing with color-filter:
1156
1157         1. When setting foreground color, inverse-transform the color through -apple-color-filter so that the user gets the color
1158            they chose when in Dark Mode. Tested by editing/style/exec-command-foreColor-with-color-filter.html.
1159
1160         2. When retrieving the style of the collapsed selection, take color filter into account so that color picker
1161            reflects the color the users sees, instead of the content color. Tested by editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
1162
1163         Add two additional tests that ensure that -apple-color-filter does not impact the NSAttributedString code
1164         path, since -apple-color-filter should not affect the behavior of Copy.
1165
1166         Tests: editing/mac/attributed-string/attrib-string-colors-with-color-filter.html
1167                editing/mac/attributed-string/attrib-string-range-with-color-filter.html
1168                editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
1169                editing/style/exec-command-foreColor-with-color-filter.html
1170
1171         * editing/EditingStyle.cpp:
1172         (WebCore::StyleChange::StyleChange):
1173         (WebCore::StyleChange::extractTextStyles):
1174         * editing/EditingStyle.h:
1175         * editing/cocoa/EditorCocoa.mm:
1176         (WebCore::Editor::fontAttributesForSelectionStart const):
1177         * platform/graphics/filters/FilterOperation.cpp:
1178         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
1179         * platform/graphics/filters/FilterOperation.h:
1180         (WebCore::FilterOperation::inverseTransformColor const):
1181         * platform/graphics/filters/FilterOperations.cpp:
1182         (WebCore::FilterOperations::transformColor const):
1183         (WebCore::FilterOperations::inverseTransformColor const):
1184         * platform/graphics/filters/FilterOperations.h:
1185
1186 2018-07-19  David Fenton  <david_fenton@apple.com>
1187
1188         Unreviewed, rolling out r233994.
1189
1190         Caused EWS and bot failures due to assertions added
1191
1192         Reverted changeset:
1193
1194         "FetchResponse should close its stream when loading finishes"
1195         https://bugs.webkit.org/show_bug.cgi?id=187790
1196         https://trac.webkit.org/changeset/233994
1197
1198 2018-07-19  Jer Noble  <jer.noble@apple.com>
1199
1200         REGRESSION(r233926): media/modern-media-controls/media-controller/media-controller-inline-to-fullscreen-to-pip-to-inline.html is a TIMEOUT failure
1201         https://bugs.webkit.org/show_bug.cgi?id=187813
1202
1203         Reviewed by Jon Lee.
1204
1205         In r233926, we changed the behavior of entering PiP to exit fullscreen only after entering PiP completes. The
1206         test in question will immediately request "inline" presentation mode once the PiP animation begins, and thus
1207         it's asking to "exit fullscreen" when both in standard fullscreen and also in PiP. The fix is not to bail out
1208         early if we're in standard (element) fullscreen, but to allow the remaining steps to complete and exit PiP as
1209         well.
1210
1211         * html/HTMLMediaElement.cpp:
1212         (WebCore::HTMLMediaElement::exitFullscreen):
1213
1214 2018-07-19  Zalan Bujtas  <zalan@apple.com>
1215
1216         [LFC] Introduce simple line breaker.
1217         https://bugs.webkit.org/show_bug.cgi?id=187688
1218
1219         Reviewed by Antti Koivisto.
1220
1221         This patch takes the simple line layout implementation and refactors it in a way it is no longer requires a RenderBlockFlow object to run on.
1222         Also this patch decouples text run generation and line breaking (and this implementation is going to replace the current simple line layout codebase)
1223
1224         TextContentProvider: Acts both as the container for all the text content (including hard line breaks) and as an iterator for the generated text runs.
1225         SimpleTextRunGenerator: TextContentProvider uses it as the text run generator for simple content (in the future we'll have a ComplexTextRunGenerator).
1226         SimpleLineBreaker: Input -> text runs + line constraints; Output -> layout runs after line breaking.
1227
1228         * Sources.txt:
1229         * WebCore.xcodeproj/project.pbxproj:
1230         * layout/inlineformatting/textlayout/ContentProvider.cpp: Added.
1231         (WebCore::Layout::TextContentProvider::TextItem::Style::Style):
1232         (WebCore::Layout::TextContentProvider::ContentProvider):
1233         (WebCore::Layout::TextContentProvider::~ContentProvider):
1234         (WebCore::Layout::TextContentProvider::appendText):
1235         (WebCore::Layout::TextContentProvider::appendLineBreak):
1236         (WebCore::Layout::TextContentProvider::width const):
1237         (WebCore::Layout::TextContentProvider::textWidth const):
1238         (WebCore::Layout::TextContentProvider::fixedPitchWidth const):
1239         (WebCore::Layout::TextContentProvider::toTextItemIndex const):
1240         (WebCore::Layout::TextContentProvider::length const):
1241         (WebCore::Layout::TextContentProvider::iterator):
1242         (WebCore::Layout::TextContentProvider::findNextRun):
1243         (WebCore::Layout::TextContentProvider::current const):
1244         * layout/inlineformatting/textlayout/ContentProvider.h: Added.
1245         (WebCore::Layout::TextContentProvider::textContent const):
1246         (WebCore::Layout::TextContentProvider::hardLineBreaks const):
1247         (WebCore::Layout::TextContentProvider::Iterator::current const):
1248         (WebCore::Layout::TextContentProvider::contains const):
1249         (WebCore::Layout::TextContentProvider::Iterator::Iterator):
1250         (WebCore::Layout::TextContentProvider::Iterator::operator++):
1251         * layout/inlineformatting/textlayout/Runs.h: Added.
1252         (WebCore::Layout::TextRun::isWhitespace const):
1253         (WebCore::Layout::TextRun::isNonWhitespace const):
1254         (WebCore::Layout::TextRun::isLineBreak const):
1255         (WebCore::Layout::TextRun::isSoftLineBreak const):
1256         (WebCore::Layout::TextRun::isHardLineBreak const):
1257         (WebCore::Layout::TextRun::isValid const):
1258         (WebCore::Layout::TextRun::isCollapsed const):
1259         (WebCore::Layout::TextRun::type const):
1260         (WebCore::Layout::TextRun::setIsCollapsed):
1261         (WebCore::Layout::TextRun::setWidth):
1262         (WebCore::Layout::LayoutRun::start const):
1263         (WebCore::Layout::LayoutRun::end const):
1264         (WebCore::Layout::LayoutRun::length const):
1265         (WebCore::Layout::LayoutRun::left const):
1266         (WebCore::Layout::LayoutRun::right const):
1267         (WebCore::Layout::LayoutRun::width const):
1268         (WebCore::Layout::LayoutRun::isEndOfLine const):
1269         (WebCore::Layout::LayoutRun::setEnd):
1270         (WebCore::Layout::LayoutRun::setRight):
1271         (WebCore::Layout::LayoutRun::setIsEndOfLine):
1272         (WebCore::Layout::LayoutRun::LayoutRun):
1273         (WebCore::Layout::TextRun::createWhitespaceRun):
1274         (WebCore::Layout::TextRun::createNonWhitespaceRun):
1275         (WebCore::Layout::TextRun::createSoftLineBreakRun):
1276         (WebCore::Layout::TextRun::createHardLineBreakRun):
1277         (WebCore::Layout::TextRun::TextRun):
1278         (WebCore::Layout::TextRun::start const):
1279         (WebCore::Layout::TextRun::end const):
1280         (WebCore::Layout::TextRun::length const):
1281         (WebCore::Layout::TextRun::width const):
1282         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.cpp: Added.
1283         (WebCore::Layout::SimpleContentProvider::SimpleContentProvider):
1284         (WebCore::Layout::SimpleContentProvider::current const):
1285         (WebCore::Layout::SimpleContentProvider::reset):
1286         (WebCore::Layout::SimpleContentProvider::findNextRun):
1287         (WebCore::Layout::SimpleContentProvider::moveToNextBreakablePosition):
1288         (WebCore::Layout::SimpleContentProvider::moveToNextNonWhitespacePosition):
1289         (WebCore::Layout::SimpleContentProvider::isAtLineBreak const):
1290         (WebCore::Layout::SimpleContentProvider::isAtSoftLineBreak const):
1291         * layout/inlineformatting/textlayout/simple/SimpleContentProvider.h: Added.
1292         (WebCore::Layout::SimpleContentProvider::Iterator::reset):
1293         (WebCore::Layout::SimpleContentProvider::Position::operator== const):
1294         (WebCore::Layout::SimpleContentProvider::Position::operator< const):
1295         (WebCore::Layout::SimpleContentProvider::Position::operator ContentPosition const):
1296         (WebCore::Layout::SimpleContentProvider::Position::resetItemPosition):
1297         (WebCore::Layout::SimpleContentProvider::Position::contentPosition const):
1298         (WebCore::Layout::SimpleContentProvider::Position::itemPosition const):
1299         (WebCore::Layout::SimpleContentProvider::Iterator<T>::Iterator):
1300         (WebCore::Layout::SimpleContentProvider::Iterator<T>::current const):
1301         (WebCore::Layout::SimpleContentProvider::Iterator<T>::operator):
1302         (WebCore::Layout::SimpleContentProvider::Position::operator++):
1303         (WebCore::Layout::SimpleContentProvider::Position::operator+=):
1304         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp: Added.
1305         (WebCore::Layout::SimpleLineBreaker::TextRunList::TextRunList):
1306         (WebCore::Layout::SimpleLineBreaker::Line::Line):
1307         (WebCore::Layout::adjustedEndPosition):
1308         (WebCore::Layout::SimpleLineBreaker::Line::append):
1309         (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace):
1310         (WebCore::Layout::SimpleLineBreaker::Line::reset):
1311         (WebCore::Layout::SimpleLineBreaker::Style::Style):
1312         (WebCore::Layout::SimpleLineBreaker::SimpleLineBreaker):
1313         (WebCore::Layout::SimpleLineBreaker::runs):
1314         (WebCore::Layout::SimpleLineBreaker::createRunsForLine):
1315         (WebCore::Layout::SimpleLineBreaker::handleOverflownRun):
1316         (WebCore::Layout::SimpleLineBreaker::collapseLeadingWhitespace):
1317         (WebCore::Layout::SimpleLineBreaker::collapseTrailingWhitespace):
1318         (WebCore::Layout::SimpleLineBreaker::splitTextRun):
1319         (WebCore::Layout::SimpleLineBreaker::split const):
1320         (WebCore::Layout::SimpleLineBreaker::availableWidth const):
1321         (WebCore::Layout::SimpleLineBreaker::verticalPosition const):
1322         * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h: Added.
1323         (WebCore::Layout::SimpleLineBreaker::TextRunList::overrideCurrent):
1324         (WebCore::Layout::SimpleLineBreaker::TextRunList::isCurrentOverridden const):
1325         (WebCore::Layout::SimpleLineBreaker::Line::availableWidth const):
1326         (WebCore::Layout::SimpleLineBreaker::Line::hasContent const):
1327         (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth):
1328         (WebCore::Layout::SimpleLineBreaker::Line::hasTrailingWhitespace const):
1329         (WebCore::Layout::SimpleLineBreaker::Line::isWhitespaceOnly const):
1330         (WebCore::Layout::SimpleLineBreaker::wrapContentOnOverflow const):
1331         (WebCore::Layout::SimpleLineBreaker::TextRunList::current const):
1332         (WebCore::Layout::SimpleLineBreaker::TextRunList::operator++):
1333
1334 2018-07-19  Keith Rollin  <krollin@apple.com>
1335
1336         Remove duplicate compilation of WebKitNSImageExtras.mm
1337         https://bugs.webkit.org/show_bug.cgi?id=187782
1338
1339         Reviewed by Alex Christensen.
1340
1341         WebKitNSImageExtras.mm gets compiled twice, once because it's in
1342         WebCore.xcodeproj/project.pbxproj and once because it's in
1343         Webcore/SourcesCocoa.txt. This can lead to duplicate definition
1344         errors, particularly when building with LTO enabled. Fix this by
1345         removing the entry from the Xcode project.
1346
1347         No new tests -- no change in WebKit functionality.
1348
1349         * WebCore.xcodeproj/project.pbxproj:
1350
1351 2018-07-19  Youenn Fablet  <youenn@apple.com>
1352
1353         FetchResponse should close its stream when loading finishes
1354         https://bugs.webkit.org/show_bug.cgi?id=187790
1355
1356         Reviewed by Chris Dumez.
1357
1358         It simplifies for a FetchResponse to push all its data into its stream if already created at end of load time.
1359         Did some refactoring in FetchBodyOwner to have a cleaner relationship with the stream source.
1360         Did a minor refactoring to expose the error description when loading fails as part of the rejected promise.
1361         This is consistent to errors sent back through callbacks.
1362
1363         Covered by existing tests.
1364
1365         * Modules/fetch/FetchBodyOwner.cpp:
1366         (WebCore::FetchBodyOwner::~FetchBodyOwner):
1367         * Modules/fetch/FetchBodyOwner.h:
1368         * Modules/fetch/FetchBodySource.cpp:
1369         (WebCore::FetchBodySource::FetchBodySource):
1370         (WebCore::FetchBodySource::setActive):
1371         (WebCore::FetchBodySource::setInactive):
1372         (WebCore::FetchBodySource::doStart):
1373         (WebCore::FetchBodySource::doPull):
1374         (WebCore::FetchBodySource::doCancel):
1375         (WebCore::FetchBodySource::cleanBodyOwner):
1376         * Modules/fetch/FetchBodySource.h:
1377         * Modules/fetch/FetchResponse.cpp:
1378         (WebCore::FetchResponse::BodyLoader::didSucceed):
1379         (WebCore::FetchResponse::BodyLoader::didFail):
1380
1381 2018-07-19  Jon Lee  <jonlee@apple.com>
1382
1383         Update iOS fullscreen alert text again
1384         https://bugs.webkit.org/show_bug.cgi?id=187797
1385         rdar://problem/42373783
1386
1387         Reviewed by Jer Noble.
1388
1389         * English.lproj/Localizable.strings:
1390
1391 2018-07-19  Keith Rollin  <krollin@apple.com>
1392
1393         Adjust WEBCORE_EXPORT annotations for LTO
1394         https://bugs.webkit.org/show_bug.cgi?id=187781
1395         <rdar://problem/42351124>
1396
1397         Reviewed by Alex Christensen.
1398
1399         Continuation of Bug 186944. This bug addresses issues not caught
1400         during the first pass of adjustments. The initial work focussed on
1401         macOS; this one addresses issues found when building for iOS. From
1402         186944:
1403
1404         Adjust a number of places that result in WebKit's
1405         'check-for-weak-vtables-and-externals' script reporting weak external
1406         symbols:
1407
1408             ERROR: WebCore has a weak external symbol in it (/Volumes/Data/dev/webkit/OpenSource/WebKitBuild/Release/WebCore.framework/Versions/A/WebCore)
1409             ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.
1410             ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.
1411             ...
1412
1413         These cases are caused by inline methods being marked with WTF_EXPORT
1414         (or related macro) or with an inline function being in a class marked
1415         as such, and when enabling LTO builds.
1416
1417         For the most part, address these by removing the WEBCORE_EXPORT
1418         annotation from inline methods. In some cases, move the implementation
1419         out-of-line because it's the class that has the WEBCORE_EXPORT on it
1420         and removing the annotation from the class would be too disruptive.
1421         Finally, in other cases, move the implementation out-of-line because
1422         check-for-weak-vtables-and-externals still complains when keeping the
1423         implementation inline and removing the annotation; this seems to
1424         typically (but not always) happen with destructors.
1425
1426         No new tests. There is no changed functionality. Only the annotation
1427         and treatment of inline methods are altered.
1428
1429         * platform/graphics/FourCC.h:
1430         (WebCore::FourCC::FourCC):
1431         * platform/graphics/IntPoint.h:
1432         (WebCore::IntPoint::IntPoint):
1433         * platform/mediastream/RealtimeMediaSource.cpp:
1434         (WebCore::RealtimeMediaSource::Observer::~Observer):
1435         (WebCore::RealtimeMediaSource::AudioCaptureFactory::~AudioCaptureFactory):
1436         (WebCore::RealtimeMediaSource::VideoCaptureFactory::~VideoCaptureFactory):
1437         * platform/mediastream/RealtimeMediaSource.h:
1438         * workers/service/ServiceWorkerProvider.cpp:
1439         (WebCore::ServiceWorkerProvider::~ServiceWorkerProvider):
1440         * workers/service/ServiceWorkerProvider.h:
1441
1442 2018-07-19  Charlie Turner  <cturner@igalia.com>
1443
1444         [GStreamer] Return a valid time values in unprerolled states
1445         https://bugs.webkit.org/show_bug.cgi?id=187111
1446
1447         Reviewed by Xabier Rodriguez-Calvar.
1448
1449         After r230584 in bug 180253, asserts were added in
1450         PlatformTimeRanges::add to check that both ends of the range were
1451         valid times. In the non-MSE GStreamer player, this assert was
1452         firing on https://www.w3.org/2010/05/video/mediaevents.html due to
1453         seekable being called in nonprerolled states. In this case
1454         MediaPlayerPrivateInterface::seekable was calling GStreamer's
1455         maxTimeSeekable, which calls in durationMediaTime. The guard
1456         against calling gst_element_query_duration when not prerolled was
1457         returning a different time value than when the duration query
1458         itself failed. Hence the assert firing.
1459
1460         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1461         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
1462
1463 2018-07-19  Antoine Quint  <graouts@apple.com>
1464
1465         Hitting RELEASE_ASSERT(!m_activeDOMObjectAdditionForbidden) under HTMLMediaElement::resume()
1466         https://bugs.webkit.org/show_bug.cgi?id=187793
1467         <rdar://problem/42308469>
1468
1469         Reviewed by Chris Dumez.
1470
1471         Ensure we do not call JS under resume(), which would happen as a result of calling configureMediaControls() in prepareForLoad().
1472
1473         * html/HTMLMediaElement.cpp:
1474         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1475         (WebCore::HTMLMediaElement::contextDestroyed):
1476         (WebCore::HTMLMediaElement::stop):
1477         (WebCore::HTMLMediaElement::suspend):
1478         (WebCore::HTMLMediaElement::resume):
1479         * html/HTMLMediaElement.h:
1480
1481 2018-07-19  Philippe Normand  <pnormand@igalia.com>
1482
1483         [GStreamer][MSE] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html crashes
1484         https://bugs.webkit.org/show_bug.cgi?id=187469
1485
1486         Reviewed by Žan Doberšek.
1487
1488         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1489         (webKitMediaSrcFreeStream): Fix critical warning. The appsrc
1490         element is created only when a valid sourcebuffer is in use.
1491
1492 2018-07-19  Frederic Wang  <fwang@igalia.com>
1493
1494         Fix message of NotSupportedError exception thrown during custom element creation
1495         https://bugs.webkit.org/show_bug.cgi?id=187757
1496
1497         Reviewed by Yusuke Suzuki.
1498
1499         In bug 161528, some new exceptions were introduced for custom element creation [1] but the
1500         actual text has some issues. This patch fixes one typo and one wrong message.
1501
1502         [1] https://dom.spec.whatwg.org/#concept-create-element
1503
1504         Test: fast/custom-elements/exceptions-for-synchronous-custom-element-creation.html
1505
1506         * bindings/js/JSCustomElementInterface.cpp:
1507         (WebCore::constructCustomElementSynchronously):
1508
1509 2018-07-18  Jer Noble  <jer.noble@apple.com>
1510
1511         Unreviewed API Test fix; restored a line inadventantly removed in r233926.
1512
1513         * platform/mac/VideoFullscreenInterfaceMac.mm:
1514         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1515
1516 2018-07-18  Antoine Quint  <graouts@apple.com>
1517
1518         [Web Animations] Interpolation between font-styles with a keyword value should be discrete
1519         https://bugs.webkit.org/show_bug.cgi?id=187722
1520
1521         Reviewed by Myles Maxfield.
1522
1523         Animating between "font-style: normal" or "font-style: oblique" and any another value should yield a discrete
1524         interpolation where the from-value is used from 0 and up to (but excluding) 0.5, and the to-value from 0.5 to 1.
1525
1526         In order to be able to detect the "normal" value, we make the "slope" of a FontSelectionRequest an optional type
1527         where the std::nullopt value indicates "normal" and other values an "oblique" value. Since we also need to
1528         distinguish the "italic" value from an "oblique" value, we implement a custom PropertyWrapper for the "font-style"
1529         property where we ensure the fontStyleAxis property of the font description matches the value we're blending to.
1530         Indeed, in the case where we may animate from "normal" to "italic", the fontStyleAxis on the blended style would
1531         remain "slnt" since it is the base value for "normal".
1532
1533         * accessibility/AccessibilityRenderObject.cpp:
1534         (WebCore::AccessibilityRenderObject::hasPlainText const):
1535         * css/CSSComputedStyleDeclaration.cpp:
1536         (WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
1537         * css/CSSComputedStyleDeclaration.h:
1538         * css/CSSFontFace.cpp:
1539         (WebCore::calculateItalicRange):
1540         * css/CSSFontFaceSet.cpp:
1541         (WebCore::computeFontSelectionRequest):
1542         * css/FontSelectionValueInlines.h:
1543         (WebCore::fontStyleKeyword):
1544         (WebCore::fontStyleValue): Deleted.
1545         * css/StyleBuilderConverter.h:
1546         (WebCore::StyleBuilderConverter::convertFontStyleFromValue):
1547         * page/animation/CSSPropertyAnimation.cpp:
1548         (WebCore::blendFunc):
1549         (WebCore::PropertyWrapperFontStyle::PropertyWrapperFontStyle):
1550         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
1551         * platform/graphics/FontCache.h:
1552         (WebCore::FontDescriptionKey::computeHash const):
1553         * platform/graphics/FontCascade.h:
1554         (WebCore::FontCascade::italic const):
1555         * platform/graphics/FontDescription.h:
1556         (WebCore::FontDescription::italic const):
1557         (WebCore::FontDescription::setItalic):
1558         (WebCore::FontDescription::setIsItalic):
1559         (WebCore::FontCascadeDescription::initialItalic):
1560         * platform/graphics/FontSelectionAlgorithm.cpp:
1561         (WebCore::FontSelectionAlgorithm::styleDistance const):
1562         * platform/graphics/FontSelectionAlgorithm.h:
1563         (WebCore::isItalic):
1564         (WebCore::FontSelectionRequest::tied const):
1565         (WebCore::operator<<): Implement the required stream operator.
1566         (WebCore::operator==): Mark this function as inline instead of constexpr since tied() is no longer constexpr
1567         due to taking an std::optional<>.
1568         (WebCore::operator!=):
1569         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1570         (WebCore::preparePlatformFont):
1571         * platform/graphics/win/FontCacheWin.cpp:
1572         (WebCore::FontCache::createFontPlatformData):
1573         * rendering/style/RenderStyle.cpp:
1574         (WebCore::RenderStyle::setFontItalic):
1575         * rendering/style/RenderStyle.h:
1576         (WebCore::RenderStyle::fontItalic const):
1577
1578 2018-07-18  Jer Noble  <jer.noble@apple.com>
1579
1580         Unreviewed build fix after r233926; BOOL !== bool.
1581
1582         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1583         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
1584
1585 2018-07-18  Jer Noble  <jer.noble@apple.com>
1586
1587         PiP from Element Fullscreen should match AVKit's behavior
1588         https://bugs.webkit.org/show_bug.cgi?id=187623
1589
1590         Reviewed by Jon Lee.
1591
1592         PiP behavior should be defined at the WebKit2 level, and not in HTMLMediaElement:
1593
1594         * html/HTMLMediaElement.cpp:
1595         (WebCore::HTMLMediaElement::enterFullscreen):
1596
1597         Add an accessor for pictureInPictureWasStartedWhenEnteringBackground():
1598
1599         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1600         (VideoFullscreenInterfaceAVKit::pictureInPictureWasStartedWhenEnteringBackground const):
1601
1602         Add VideoFullscreenModelClient virutal methods for PiP change notifications:
1603
1604         * platform/cocoa/VideoFullscreenModel.h:
1605         (WebCore::VideoFullscreenModelClient::hasVideoChanged):
1606         (WebCore::VideoFullscreenModelClient::videoDimensionsChanged):
1607         (WebCore::VideoFullscreenModelClient::willEnterPictureInPicture):
1608         (WebCore::VideoFullscreenModelClient::didEnterPictureInPicture):
1609         (WebCore::VideoFullscreenModelClient::failedToEnterPictureInPicture):
1610         (WebCore::VideoFullscreenModelClient::willExitPictureInPicture):
1611         (WebCore::VideoFullscreenModelClient::didExitPictureInPicture):
1612         (WebCore::VideoFullscreenModelClient::failedToExitPictureInPicture):
1613         * platform/cocoa/VideoFullscreenModelVideoElement.h:
1614         * platform/cocoa/VideoFullscreenModelVideoElement.mm:
1615         (VideoFullscreenModelVideoElement::willEnterPictureInPicture):
1616         (VideoFullscreenModelVideoElement::didEnterPictureInPicture):
1617         (VideoFullscreenModelVideoElement::failedToEnterPictureInPicture):
1618         (VideoFullscreenModelVideoElement::willExitPictureInPicture):
1619         (VideoFullscreenModelVideoElement::didExitPictureInPicture):
1620         (VideoFullscreenModelVideoElement::failedToExitPictureInPicture):
1621         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1622         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1623         (-[WebAVPlayerLayer layoutSublayers]):
1624         (-[WebAVPlayerLayer resolveBounds]):
1625         (-[WebAVPlayerLayer setVideoGravity:]):
1626         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1627         (VideoFullscreenInterfaceAVKit::presentingViewController):
1628         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
1629         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1630         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
1631         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
1632         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
1633         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1634         (VideoFullscreenInterfaceAVKit::doSetup):
1635         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1636         (VideoFullscreenControllerContext::willEnterPictureInPicture):
1637         (VideoFullscreenControllerContext::didEnterPictureInPicture):
1638         (VideoFullscreenControllerContext::failedToEnterPictureInPicture):
1639         (VideoFullscreenControllerContext::willExitPictureInPicture):
1640         (VideoFullscreenControllerContext::didExitPictureInPicture):
1641         (VideoFullscreenControllerContext::failedToExitPictureInPicture):
1642         * platform/mac/VideoFullscreenInterfaceMac.h:
1643         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
1644         * platform/mac/VideoFullscreenInterfaceMac.mm:
1645         (-[WebVideoFullscreenInterfaceMacObjC invalidateFullscreenState]):
1646         (-[WebVideoFullscreenInterfaceMacObjC exitPIP]):
1647         (-[WebVideoFullscreenInterfaceMacObjC exitPIPAnimatingToRect:inWindow:]):
1648         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]):
1649         (-[WebVideoFullscreenInterfaceMacObjC pipDidClose:]):
1650         (WebCore::VideoFullscreenInterfaceMac::enterFullscreen):
1651         (WebCore::VideoFullscreenInterfaceMac::exitFullscreen):
1652         (WebCore::VideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode):
1653         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
1654
1655 2018-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1656
1657         [Curl] Disable CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST specified by setAllowsAnyHTTPSCertificate.
1658         https://bugs.webkit.org/show_bug.cgi?id=187611
1659
1660         Reviewed by Fujii Hironori.
1661
1662         Current interface for TLS certificate validation for Curl port are as follows:
1663
1664         - WEBCORE_EXPORT void setHostAllowsAnyHTTPSCertificate(const String&);
1665         - bool isAllowedHTTPSCertificateHost(const String&);
1666         - bool canIgnoredHTTPSCertificate(const String&, const Vector<CertificateInfo::Certificate>&);
1667
1668         First one registers a host to be ignored for any certificate check. Once it is registered, no
1669         further certificate validation check is executed.
1670         Second one checks the host is registered in the list above.
1671         Third one is weird. The method signature implies it checks the certificate for the host and detect
1672         whether we can ignore this certificate for the host, but actually it  just check only the host and
1673         register the certificate into the vector. Then in the next request for the host, the certificate
1674         will be checked with the previously stored certificate.
1675
1676         It's hard to understand, but in short,
1677         - We can register a host as an exception for any TLS certificate validation.
1678         - But only certificate arrived first is ignored, not any certificates for the host
1679           (which is rare, but possible for mis configured web cluster).
1680
1681         This behavior is incomplete. To ignore any certificates of the host, these two methods are enough:
1682
1683         - void allowAnyHTTPSCertificatesForHost(const String&)
1684         - bool canIgnoreAnyHTTPSCertificatesForHost(const String&)
1685
1686         No new tests. Covered by existing tests.
1687
1688         * platform/network/curl/CertificateInfo.h:
1689         * platform/network/curl/CurlContext.cpp:
1690         (WebCore::CurlHandle::enableSSLForHost): Ignore TLS verification for registered host.
1691         * platform/network/curl/CurlSSLHandle.cpp:
1692         (WebCore::CurlSSLHandle::allowAnyHTTPSCertificatesForHost): Added.
1693         (WebCore::CurlSSLHandle::canIgnoreAnyHTTPSCertificatesForHost const): Ditto.
1694         (WebCore::CurlSSLHandle::setClientCertificateInfo): Separate lock.
1695         (WebCore::CurlSSLHandle::getSSLClientCertificate const): Ditto and add const.
1696         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate): Deleted.
1697         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost): Deleted.
1698         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate): Deleted.
1699         (WebCore::CurlSSLHandle::getSSLClientCertificate): Deleted.
1700         * platform/network/curl/CurlSSLHandle.h:
1701         * platform/network/curl/CurlSSLVerifier.cpp:
1702         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
1703         (WebCore::CurlSSLVerifier::collectInfo): Renamed from verify.
1704         (WebCore::CurlSSLVerifier::verifyCallback):
1705         (WebCore::CurlSSLVerifier::verify): Renamed to collectInfo.
1706         * platform/network/curl/CurlSSLVerifier.h:
1707         * platform/network/curl/ResourceHandleCurl.cpp:
1708         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate): Rename calling method.
1709
1710 2018-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
1711
1712         Rename WordBreak::Break to WordBreak::BreakWord
1713         https://bugs.webkit.org/show_bug.cgi?id=187767
1714
1715         Reviewed by Simon Fraser.
1716
1717         These breaking properties are very confusing. There are:
1718
1719         1. word-break: break-all, a standard value that allows breaking after every
1720         character.
1721         2. word-break: break-word, a non-standard value which allows for breaking after
1722         every character, but only if the word is too long for the available width (otherwise
1723         it works the same as word-break: normal). This affects the min-content-size of the
1724         text (and makes it equal to what it would be if word-break: break-all was
1725         specified).
1726         3. word-wrap: break-word, which is the same as word-break: break-word, but doesn't
1727         affect the min-content-size of the text.
1728         4. overflow-wrap: break-word, which is the same as word-wrap: break-word.
1729
1730         Because this is so confusing it's valuable for our internal enums to match the names
1731         of the official CSS properties/values.
1732
1733         No new tests because there is no behavior change.
1734
1735         * css/CSSPrimitiveValueMappings.h:
1736         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1737         (WebCore::CSSPrimitiveValue::operator WordBreak const):
1738         * rendering/RenderText.cpp:
1739         (WebCore::RenderText::computePreferredLogicalWidths):
1740         * rendering/style/RenderStyle.h:
1741         (WebCore::RenderStyle::breakWords const):
1742         * rendering/style/RenderStyleConstants.h:
1743
1744 2018-07-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1745
1746         Add SPI to defer running async script until after document load
1747         https://bugs.webkit.org/show_bug.cgi?id=187748
1748         <rdar://problem/42317378>
1749
1750         Reviewed by Ryosuke Niwa and Tim Horton.
1751
1752         On watchOS, we currently observe that time-consuming async scripts can block the first paint of Reader, leaving
1753         the user with a blank screen for tens of seconds. One way to mitigate this is to defer async script execution
1754         until after document load (i.e. the same timing as DOMContentLoaded).
1755
1756         This patch introduces an SPI configuration allowing internal clients to defer execution of asynchronous script
1757         until after document load; this, in combination with the parser yielding token introduced in r233891, allows
1758         Safari on watchOS to avoid being blocked on slow script execution before the first paint of the Reader page on
1759         most article-like pages. See below for more details.
1760
1761         Test: RunScriptAfterDocumentLoad.ExecutionOrderOfScriptsInDocument
1762
1763         * dom/Document.cpp:
1764         (WebCore::Document::shouldDeferAsynchronousScriptsUntilParsingFinishes const):
1765         (WebCore::Document::finishedParsing):
1766
1767         Notify ScriptRunner when the Document has finished parsing, and is about to fire DOMContentLoaded.
1768
1769         * dom/Document.h:
1770         * dom/ScriptRunner.cpp:
1771         (WebCore::ScriptRunner::documentFinishedParsing):
1772
1773         When the document is finished parsing, kick off the script execution timer if needed to run any async script
1774         that has been deferred.
1775
1776         (WebCore::ScriptRunner::notifyFinished):
1777         (WebCore::ScriptRunner::timerFired):
1778
1779         Instead of always taking from the list of async scripts to execute, check our document to see whether we should
1780         defer this until after document load. If so, ignore `m_scriptsToExecuteSoon`.
1781
1782         * dom/ScriptRunner.h:
1783         * page/Settings.yaml:
1784
1785         Add a WebCore setting for this behavior.
1786
1787 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
1788
1789         [Nicosia] Add debug border, repaint counter state tracking to Nicosia::CompositionLayer
1790         https://bugs.webkit.org/show_bug.cgi?id=187749
1791
1792         Reviewed by Carlos Garcia Campos.
1793
1794         Add the RepaintCounter and DebugBorder structs to
1795         Nicosia::CompositionLayer::LayerState, tracking visibility as well as
1796         repaint count or debug color and width.
1797
1798         Instances of RepaintCounter and DebugBorder types are kept in each
1799         CoordinatedGraphicsLayer object, updating the relevant data as it is
1800         changed (since the GraphicsLayer object isn't tracking these values on
1801         its own). During layer flush these values (if changed) are then copied
1802         over into the CompositionLayer state.
1803
1804         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
1805         Also fix the year in the license header.
1806         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
1807         Also fix the year in the license header.
1808         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1809         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
1810         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
1811         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
1812         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
1813         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1814         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1815
1816 2018-07-18  Zan Dobersek  <zdobersek@igalia.com>
1817
1818         [CoordGraphics] Start tracking Nicosia layers in CoordinatedGraphicsState
1819         https://bugs.webkit.org/show_bug.cgi?id=187751
1820
1821         Reviewed by Carlos Garcia Campos.
1822
1823         Start including the Nicosia::CompositionLayer objects in the
1824         CoordinatedGraphicsState struct, under a separate NicosiaState struct.
1825         References to all the layers in a given scene are kept in a HashSet,
1826         and a separate reference to the root layer kept in a separate member
1827         variable.
1828
1829         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1830         (WebCore::CoordinatedGraphicsLayer::compositionLayer const):
1831         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1832         Add the getter method that returns internal Nicosia::CompositionLayer
1833         object. This can't be defined in the class definition because of
1834         WEBCORE_EXPORT used on the CoordinatedGraphicsLayer class.
1835         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1836
1837 2018-07-18  Simon Fraser  <simon.fraser@apple.com>
1838
1839         Shrink CompositeAnimation and AnimationBase
1840         https://bugs.webkit.org/show_bug.cgi?id=187683
1841
1842         Reviewed by Daniel Bates.
1843
1844         Reduce the size of CompositeAnimation and AnimationBase.
1845
1846         * page/animation/AnimationBase.h:
1847         * page/animation/CompositeAnimation.h:
1848
1849 2018-07-17  Antoine Quint  <graouts@apple.com>
1850
1851         Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle().
1852         https://bugs.webkit.org/show_bug.cgi?id=187637
1853         <rdar://problem/42157915>
1854
1855         Reviewed by Dean Jackson.
1856
1857         Test: webanimations/empty-keyframes-crash.html
1858
1859         Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes.
1860         This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null
1861         value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle()
1862         which is the only place where we didn't check for a null value and didn't know for sure that there would
1863         be parsed keyframes to rely on in the case of a WebAnimation instance.
1864
1865         * animation/KeyframeEffectReadOnly.cpp:
1866         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
1867         (WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
1868
1869 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
1870
1871         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
1872         https://bugs.webkit.org/show_bug.cgi?id=187501
1873         <rdar://problem/41438160>
1874
1875         Reviewed by Youenn Fablet.
1876
1877         This patch aims at making all captured variables in all crypto lambdas that need to be passed
1878         to a worker thread thread safe, which includes:
1879         1) changing ref counted objects to thread safe ref counted object.
1880         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
1881
1882         In addition to above changes, this patch also does the following things:
1883         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
1884         to make it clear that lambdas will be passed to a secondary thread.
1885         2) make CryptoAlgorithmParameters as const parameters for all methods.
1886         3) add null checks on BufferSource.length() and .data().
1887
1888         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
1889                http/wpt/crypto/aes-cbc-crash.any.html
1890                http/wpt/crypto/aes-cbc-crash.any.worker.html
1891                http/wpt/crypto/aes-ctr-crash.any.html
1892                http/wpt/crypto/aes-ctr-crash.any.worker.html
1893                http/wpt/crypto/aes-gcm-crash.any.html
1894                http/wpt/crypto/aes-gcm-crash.any.worker.html
1895                http/wpt/crypto/derive-hmac-key-crash.any.html
1896                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
1897                http/wpt/crypto/ecdsa-crash.any.html
1898                http/wpt/crypto/ecdsa-crash.any.worker.html
1899                http/wpt/crypto/hkdf-crash.any.html
1900                http/wpt/crypto/hkdf-crash.any.worker.html
1901                http/wpt/crypto/pbkdf2-crash.any.html
1902                http/wpt/crypto/pbkdf2-crash.any.worker.html
1903                http/wpt/crypto/rsa-oaep-crash.any.html
1904                http/wpt/crypto/rsa-oaep-crash.any.worker.html
1905                http/wpt/crypto/rsa-pss-crash.any.html
1906                http/wpt/crypto/rsa-pss-crash.any.worker.html
1907                http/wpt/crypto/unwrap-ec-key-crash.any.html
1908                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
1909                http/wpt/crypto/unwrap-rsa-key-crash.any.html
1910                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
1911
1912         * bindings/js/BufferSource.h:
1913         (WebCore::BufferSource::data const):
1914         (WebCore::BufferSource::length const):
1915         * crypto/CryptoAlgorithm.cpp:
1916         (WebCore::CryptoAlgorithm::encrypt):
1917         (WebCore::CryptoAlgorithm::decrypt):
1918         (WebCore::CryptoAlgorithm::sign):
1919         (WebCore::CryptoAlgorithm::verify):
1920         (WebCore::CryptoAlgorithm::deriveBits):
1921         (WebCore::CryptoAlgorithm::importKey):
1922         (WebCore::dispatchAlgorithmOperation):
1923         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
1924         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
1925         * crypto/CryptoAlgorithm.h:
1926         * crypto/SubtleCrypto.cpp:
1927         (WebCore::crossThreadCopyImportParams):
1928         (WebCore::SubtleCrypto::encrypt):
1929         (WebCore::SubtleCrypto::decrypt):
1930         (WebCore::SubtleCrypto::sign):
1931         (WebCore::SubtleCrypto::verify):
1932         (WebCore::SubtleCrypto::deriveKey):
1933         (WebCore::SubtleCrypto::deriveBits):
1934         (WebCore::SubtleCrypto::importKey):
1935         (WebCore::SubtleCrypto::wrapKey):
1936         (WebCore::SubtleCrypto::unwrapKey):
1937         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1938         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
1939         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
1940         (WebCore::CryptoAlgorithmAES_CBC::importKey):
1941         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1942         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
1943         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
1944         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
1945         (WebCore::CryptoAlgorithmAES_CFB::importKey):
1946         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
1947         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
1948         (WebCore::parametersAreValid):
1949         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
1950         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
1951         (WebCore::CryptoAlgorithmAES_CTR::importKey):
1952         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
1953         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
1954         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
1955         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
1956         (WebCore::CryptoAlgorithmAES_GCM::importKey):
1957         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
1958         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1959         (WebCore::CryptoAlgorithmAES_KW::importKey):
1960         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1961         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1962         (WebCore::CryptoAlgorithmECDH::deriveBits):
1963         (WebCore::CryptoAlgorithmECDH::importKey):
1964         * crypto/algorithms/CryptoAlgorithmECDH.h:
1965         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
1966         (WebCore::CryptoAlgorithmECDSA::sign):
1967         (WebCore::CryptoAlgorithmECDSA::verify):
1968         (WebCore::CryptoAlgorithmECDSA::importKey):
1969         * crypto/algorithms/CryptoAlgorithmECDSA.h:
1970         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
1971         (WebCore::CryptoAlgorithmHKDF::deriveBits):
1972         (WebCore::CryptoAlgorithmHKDF::importKey):
1973         * crypto/algorithms/CryptoAlgorithmHKDF.h:
1974         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1975         (WebCore::CryptoAlgorithmHMAC::sign):
1976         (WebCore::CryptoAlgorithmHMAC::verify):
1977         (WebCore::CryptoAlgorithmHMAC::importKey):
1978         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1979         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
1980         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
1981         (WebCore::CryptoAlgorithmPBKDF2::importKey):
1982         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
1983         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1984         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
1985         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
1986         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
1987         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1988         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1989         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
1990         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
1991         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
1992         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1993         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1994         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
1995         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
1996         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
1997         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1998         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1999         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2000         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2001         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2002         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2003         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2004         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2005         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2006         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2007         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2008         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2009         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2010         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2011         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2012         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2013         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2014         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2015         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2016         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2017         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2018         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2019         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2020         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2021         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2022         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2023         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2024         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2025         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2026         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2027         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2028         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2029         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2030         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2031         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2032         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2033         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2034         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2035         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2036         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2037         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2038         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2039         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2040         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2041         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2042         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2043         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2044         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2045         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2046         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2047         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2048         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2049         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2050         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2051         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2052         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2053         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2054         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2055         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2056         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2057         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2058
2059 2018-07-17  Antoine Quint  <graouts@apple.com>
2060
2061         [Web Animations] Interpolation between lengths with an "auto" value should be discrete
2062         https://bugs.webkit.org/show_bug.cgi?id=187721
2063
2064         Reviewed by Dean Jackson.
2065
2066         When interpolating between two Length values, if one is "auto", we should use the from-value
2067         from 0 and up to (but excluding) 0.5, and use the to-value from 0.5 to 1.
2068
2069         This change caused a regression in the legacy animation engine since it would create a CSS
2070         transition even when the underlying and target values were non-interpolable. As such, the
2071         underlying value would be used until the transition's mid-point and the tests at 
2072         legacy-animation-engine/imported/blink/transitions/transition-not-interpolable.html and
2073         legacy-animation-engine/fast/animation/height-auto-transition-computed-value.html would fail
2074         expecting the target value to be used immediately. We now ensure that no transition is actually
2075         started if two values for a given property cannot be interpolated.
2076
2077         * page/animation/CompositeAnimation.cpp:
2078         (WebCore::CompositeAnimation::updateTransitions):
2079         * platform/Length.cpp:
2080         (WebCore::blend):
2081
2082 2018-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2083
2084         Add an SPI hook to allow clients to yield document parsing and script execution
2085         https://bugs.webkit.org/show_bug.cgi?id=187682
2086         <rdar://problem/42207453>
2087
2088         Reviewed by Ryosuke Niwa.
2089
2090         Using a single web process for both the Reader page and original web page on watchOS has multiple benefits,
2091         including: (1) allowing the user to bail out of Reader and view the original web page without having to load it
2092         again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process
2093         and we don't eat the additional cost of a web process launch if prewarming fails.
2094
2095         However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the
2096         original page may contend with work being done to load and render the Reader page. This is especially bad when
2097         the page is in the middle of executing heavy script after Safari has already detected that the Reader version of
2098         the page is available, but before it has finished loading the Reader page. The result is that script on the
2099         original page may block the first paint of the Reader page (on New York Times articles, this often leads to an
2100         apparent page load time of 25-35 seconds before the user sees anything besides a blank screen).
2101
2102         To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on
2103         a document. This capability is surfaced in the form of an opaque token which clients may request from a
2104         WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously
2105         scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all
2106         active tokens on the document causes it to stop yielding and resume execution of scripts if needed.
2107
2108         Tests:  ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken
2109                 ParserYieldTokenTests.TakeMultipleParserYieldTokens
2110                 ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken
2111                 ParserYieldTokenTests.AsyncScriptRunsWhenFetched
2112
2113         * dom/Document.cpp:
2114         (WebCore::Document::implicitOpen):
2115
2116         If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to
2117         start yielding immediately after creation.
2118
2119         (WebCore::DocumentParserYieldToken::DocumentParserYieldToken):
2120         (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken):
2121         * dom/Document.h:
2122
2123         Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to
2124         have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the
2125         parser yield count (respectively).
2126
2127         (WebCore::Document::createParserYieldToken):
2128         (WebCore::Document::hasActiveParserYieldToken const):
2129         * dom/DocumentParser.h:
2130         (WebCore::DocumentParser::didBeginYieldingParser):
2131         (WebCore::DocumentParser::didEndYieldingParser):
2132
2133         Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the
2134         parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing
2135         script.
2136
2137         * dom/ScriptRunner.cpp:
2138         (WebCore::ScriptRunner::resume):
2139         (WebCore::ScriptRunner::notifyFinished):
2140         * dom/ScriptRunner.h:
2141         (WebCore::ScriptRunner::didBeginYieldingParser):
2142         (WebCore::ScriptRunner::didEndYieldingParser):
2143
2144         Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend
2145         and resume.
2146
2147         * html/parser/HTMLDocumentParser.cpp:
2148         (WebCore::HTMLDocumentParser::didBeginYieldingParser):
2149         (WebCore::HTMLDocumentParser::didEndYieldingParser):
2150
2151         Plumb to didBegin/didEnd calls to the HTMLParserScheduler.
2152
2153         * html/parser/HTMLDocumentParser.h:
2154         * html/parser/HTMLParserScheduler.cpp:
2155         (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
2156         * html/parser/HTMLParserScheduler.h:
2157         (WebCore::HTMLParserScheduler::shouldYieldBeforeToken):
2158
2159         Consult a flag when determining whether to yield. This flag is set to true only while the document has an active
2160         parser yield token.
2161
2162         (WebCore::HTMLParserScheduler::isScheduledForResume const):
2163
2164         Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we
2165         incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the
2166         parser is no longer scheduled to pump its tokenizer.
2167
2168         (WebCore::HTMLParserScheduler::didBeginYieldingParser):
2169         (WebCore::HTMLParserScheduler::didEndYieldingParser):
2170
2171         When the Document begins yielding due to the documet having active tokens or ends yielding after the document
2172         loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally
2173         reschedule the parser if needed to ensure that we continue parsing the document; without this additional change
2174         to resume, we'll never get the document load or load events after relinquishing the yield token.
2175
2176 2018-07-17  Dirk Schulze  <krit@webkit.org>
2177
2178         [clip-path] Implement support for margin-box as reference box and box shape
2179         https://bugs.webkit.org/show_bug.cgi?id=127984
2180
2181         Reviewed by Simon Fraser.
2182
2183         Compute the margin-box rectangle as needed for clip-path based on the actual
2184         computed values for the margin-top, *-left, *-bottom, *-right properties.
2185
2186         Test: css3/masking/clip-path-margin-box.html
2187
2188         * rendering/RenderBox.h:
2189         (WebCore::RenderBox::marginBoxRect const):
2190         * rendering/RenderBoxModelObject.h:
2191         * rendering/RenderLayer.cpp:
2192         (WebCore::computeReferenceBox):
2193
2194 2018-07-17  Javier Fernandez  <jfernandez@igalia.com>
2195
2196         Delete content of a single cell table should not delete the whole table
2197         https://bugs.webkit.org/show_bug.cgi?id=173117
2198
2199         Reviewed by Ryosuke Niwa.
2200
2201         We should not extend selection looking for special elements if the
2202         delete operation has been triggered by a caret based selection.
2203
2204         This change is based on a recent [1] resolution of the Editing TF,
2205         which acknowledges that behavior of single-cell tables must be the
2206         same that multi-cell tables and even if the last character is
2207         deleted, we should not delete the whole table structure.
2208
2209         A different case would be when the user actively selects the whole
2210         content of a table; in this case, as we do in multi-cell tables,
2211         the structure of single-cell tables should be deleted together
2212         with the content.
2213
2214         [1] https://github.com/w3c/editing/issues/163
2215
2216         Tests: editing/deleting/backspace-delete-last-char-in-table.html
2217                editing/deleting/forward-delete-last-char-in-table.html
2218                editing/deleting/select-and-delete-last-char-in-table.html
2219
2220         * editing/TypingCommand.cpp:
2221         (WebCore::TypingCommand::deleteKeyPressed):
2222         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2223
2224 2018-07-16  Megan Gardner  <megan_gardner@apple.com>
2225
2226         Correctly adjust scroll offsets when a page is zoomed
2227         https://bugs.webkit.org/show_bug.cgi?id=187673
2228         <rdar://problem/41712829>
2229
2230         Reviewed by Wenson Hsieh.
2231
2232         Will add test later.
2233
2234         Make sure that distance is scaled by the pageScaleFactor, to 
2235         make sure that we scroll correctly when we are zoomed in.
2236
2237         * page/ios/EventHandlerIOS.mm:
2238         (WebCore::autoscrollAdjustmentFactorForScreenBoundaries):
2239         
2240 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
2241
2242         Roll out r233873 and r233875 since they caused 8 new layout test crashes.
2243
2244         * crypto/CryptoAlgorithm.cpp:
2245         (WebCore::CryptoAlgorithm::encrypt):
2246         (WebCore::CryptoAlgorithm::decrypt):
2247         (WebCore::CryptoAlgorithm::sign):
2248         (WebCore::CryptoAlgorithm::verify):
2249         (WebCore::CryptoAlgorithm::deriveBits):
2250         (WebCore::CryptoAlgorithm::importKey):
2251         (WebCore::dispatchAlgorithmOperation):
2252         (WebCore::CryptoAlgorithm::dispatchOperation):
2253         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue): Deleted.
2254         * crypto/CryptoAlgorithm.h:
2255         * crypto/SubtleCrypto.cpp:
2256         (WebCore::SubtleCrypto::encrypt):
2257         (WebCore::SubtleCrypto::decrypt):
2258         (WebCore::SubtleCrypto::sign):
2259         (WebCore::SubtleCrypto::verify):
2260         (WebCore::SubtleCrypto::deriveKey):
2261         (WebCore::SubtleCrypto::deriveBits):
2262         (WebCore::SubtleCrypto::importKey):
2263         (WebCore::SubtleCrypto::wrapKey):
2264         (WebCore::SubtleCrypto::unwrapKey):
2265         (WebCore::crossThreadCopyImportParams): Deleted.
2266         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2267         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2268         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2269         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2270         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2271         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2272         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2273         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2274         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2275         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2276         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2277         (WebCore::parametersAreValid):
2278         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2279         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2280         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2281         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2282         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2283         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2284         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2285         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2286         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2287         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2288         (WebCore::CryptoAlgorithmAES_KW::importKey):
2289         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2290         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2291         (WebCore::CryptoAlgorithmECDH::deriveBits):
2292         (WebCore::CryptoAlgorithmECDH::importKey):
2293         * crypto/algorithms/CryptoAlgorithmECDH.h:
2294         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2295         (WebCore::CryptoAlgorithmECDSA::sign):
2296         (WebCore::CryptoAlgorithmECDSA::verify):
2297         (WebCore::CryptoAlgorithmECDSA::importKey):
2298         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2299         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2300         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2301         (WebCore::CryptoAlgorithmHKDF::importKey):
2302         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2303         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2304         (WebCore::CryptoAlgorithmHMAC::sign):
2305         (WebCore::CryptoAlgorithmHMAC::verify):
2306         (WebCore::CryptoAlgorithmHMAC::importKey):
2307         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2308         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2309         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2310         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2311         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2312         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2313         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2314         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2315         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2316         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2317         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2318         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2319         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2320         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2321         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2322         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2323         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2324         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2325         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2326         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2327         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2328         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2329         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2330         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2331         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2332         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2333         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2334         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2335         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2336         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2337         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2338         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2339         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2340         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2341         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2342         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2343         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2344         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2345         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2346         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2347         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2348         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2349         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2350         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2351         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2352         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2353         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2354         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2355         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2356         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2357         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2358         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2359         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2360         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2361         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2362         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2363         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2364         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2365         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2366         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2367         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2368         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2369         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2370         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2371         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2372         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2373         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2374         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2375         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2376         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2377         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2378         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2379         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2380         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2381         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2382         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2383         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2384         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2385         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2386         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2387
2388 2018-07-16  Ryosuke Niwa  <rniwa@webkit.org>
2389
2390         Release assert in ~TimerBase is getting hit in WK1 apps which uses JSC API directly
2391         https://bugs.webkit.org/show_bug.cgi?id=187713
2392         <rdar://problem/41759548>
2393
2394         Reviewed by Simon Fraser.
2395
2396         Turn this into a debug assertion in WebKit1 on iOS since JSC API doesn't grab the web thread lock,
2397         which means that Timer can get destroyed without the web thread lock in the main thread.
2398
2399         * platform/Timer.cpp:
2400         (WebCore::TimerBase::~TimerBase):
2401         (WebCore::TimerBase::setNextFireTime):
2402
2403 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
2404
2405         Add color filter for transforming colors in Dark Mode
2406         https://bugs.webkit.org/show_bug.cgi?id=187717
2407         rdar://problem/41146650
2408
2409         Reviewed by Dean Jackson.
2410         
2411         Add a new filter function for use in -apple-color-filter for transforming colors
2412         when in Dark Mode. The filter is called apple-invert-lightness(), and takes no parameters.
2413         It's based on a lightness invert in HSL space, with some adjustments to improve the contrast
2414         of some colors on dark backgrounds, so does a much better job that using invert() with hue-rotate().
2415
2416         Test: css3/color-filters/color-filter-apple-invert-lightness.html
2417
2418         * css/CSSComputedStyleDeclaration.cpp:
2419         (WebCore::ComputedStyleExtractor::valueForFilter):
2420         * css/CSSValueKeywords.in:
2421         * css/StyleResolver.cpp:
2422         (WebCore::filterOperationForType):
2423         (WebCore::StyleResolver::createFilterOperations):
2424         * css/parser/CSSPropertyParser.cpp:
2425         (WebCore::CSSPropertyParser::parseSingleValue):
2426         * css/parser/CSSPropertyParserHelpers.cpp:
2427         (WebCore::CSSPropertyParserHelpers::consumeFilterImage):
2428         (WebCore::CSSPropertyParserHelpers::isPixelFilterFunction):
2429         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
2430         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
2431         (WebCore::CSSPropertyParserHelpers::consumeFilter):
2432         (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction): Deleted.
2433         * css/parser/CSSPropertyParserHelpers.h:
2434         * page/FrameView.cpp:
2435         (WebCore::FrameView::paintContents):
2436         * platform/graphics/Color.cpp:
2437         * platform/graphics/ColorUtilities.cpp:
2438         (WebCore::sRGBToLinearComponents):
2439         (WebCore::linearToSRGBComponents):
2440         (WebCore::sRGBToLinearColorComponentForLuminance):
2441         (WebCore::luminance):
2442         (WebCore::sRGBToHSL):
2443         (WebCore::calcHue):
2444         (WebCore::HSLToSRGB):
2445         (WebCore::ColorMatrix::ColorMatrix):
2446         * platform/graphics/ColorUtilities.h:
2447         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2448         (PlatformCAFilters::filterValueForOperation):
2449         (PlatformCAFilters::colorMatrixValueForFilter):
2450         * platform/graphics/filters/FEColorMatrix.cpp:
2451         * platform/graphics/filters/FilterOperation.cpp:
2452         (WebCore::InvertLightnessFilterOperation::operator== const):
2453         (WebCore::InvertLightnessFilterOperation::blend):
2454         (WebCore::InvertLightnessFilterOperation::transformColor const):
2455         (WebCore::operator<<):
2456         * platform/graphics/filters/FilterOperation.h:
2457         * rendering/FilterEffectRenderer.cpp:
2458         (WebCore::FilterEffectRenderer::build):
2459
2460 2018-07-16  Jiewen Tan  <jiewen_tan@apple.com>
2461
2462         Unreviewed, build fix for r233873.
2463
2464         * crypto/SubtleCrypto.cpp:
2465         (WebCore::crossThreadCopyImportParams):
2466
2467 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2468
2469         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
2470         https://bugs.webkit.org/show_bug.cgi?id=187501
2471         <rdar://problem/41438160>
2472
2473         Reviewed by Youenn Fablet.
2474
2475         This patch aims at making all captured variables in all crypto lambdas that need to be passed
2476         to a worker thread thread safe, which includes:
2477         1) changing ref counted objects to thread safe ref counted object.
2478         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
2479
2480         In addition to above changes, this patch also does the following things:
2481         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
2482         to make it clear that lambdas will be passed to a secondary thread.
2483         2) make CryptoAlgorithmParameters as const parameters for all methods.
2484
2485         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
2486                http/wpt/crypto/aes-cbc-crash.any.html
2487                http/wpt/crypto/aes-cbc-crash.any.worker.html
2488                http/wpt/crypto/aes-ctr-crash.any.html
2489                http/wpt/crypto/aes-ctr-crash.any.worker.html
2490                http/wpt/crypto/aes-gcm-crash.any.html
2491                http/wpt/crypto/aes-gcm-crash.any.worker.html
2492                http/wpt/crypto/derive-hmac-key-crash.any.html
2493                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
2494                http/wpt/crypto/ecdsa-crash.any.html
2495                http/wpt/crypto/ecdsa-crash.any.worker.html
2496                http/wpt/crypto/hkdf-crash.any.html
2497                http/wpt/crypto/hkdf-crash.any.worker.html
2498                http/wpt/crypto/pbkdf2-crash.any.html
2499                http/wpt/crypto/pbkdf2-crash.any.worker.html
2500                http/wpt/crypto/rsa-oaep-crash.any.html
2501                http/wpt/crypto/rsa-oaep-crash.any.worker.html
2502                http/wpt/crypto/rsa-pss-crash.any.html
2503                http/wpt/crypto/rsa-pss-crash.any.worker.html
2504                http/wpt/crypto/unwrap-ec-key-crash.any.html
2505                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
2506                http/wpt/crypto/unwrap-rsa-key-crash.any.html
2507                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
2508
2509         * crypto/CryptoAlgorithm.cpp:
2510         (WebCore::CryptoAlgorithm::encrypt):
2511         (WebCore::CryptoAlgorithm::decrypt):
2512         (WebCore::CryptoAlgorithm::sign):
2513         (WebCore::CryptoAlgorithm::verify):
2514         (WebCore::CryptoAlgorithm::deriveBits):
2515         (WebCore::CryptoAlgorithm::importKey):
2516         (WebCore::dispatchAlgorithmOperation):
2517         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
2518         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
2519         * crypto/CryptoAlgorithm.h:
2520         * crypto/SubtleCrypto.cpp:
2521         (WebCore::crossThreadCopyImportParams):
2522         (WebCore::SubtleCrypto::encrypt):
2523         (WebCore::SubtleCrypto::decrypt):
2524         (WebCore::SubtleCrypto::sign):
2525         (WebCore::SubtleCrypto::verify):
2526         (WebCore::SubtleCrypto::deriveKey):
2527         (WebCore::SubtleCrypto::deriveBits):
2528         (WebCore::SubtleCrypto::importKey):
2529         (WebCore::SubtleCrypto::wrapKey):
2530         (WebCore::SubtleCrypto::unwrapKey):
2531         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2532         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2533         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2534         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2535         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2536         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2537         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2538         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2539         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2540         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2541         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2542         (WebCore::parametersAreValid):
2543         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2544         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2545         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2546         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2547         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2548         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2549         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2550         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2551         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2552         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2553         (WebCore::CryptoAlgorithmAES_KW::importKey):
2554         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2555         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2556         (WebCore::CryptoAlgorithmECDH::deriveBits):
2557         (WebCore::CryptoAlgorithmECDH::importKey):
2558         * crypto/algorithms/CryptoAlgorithmECDH.h:
2559         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2560         (WebCore::CryptoAlgorithmECDSA::sign):
2561         (WebCore::CryptoAlgorithmECDSA::verify):
2562         (WebCore::CryptoAlgorithmECDSA::importKey):
2563         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2564         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2565         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2566         (WebCore::CryptoAlgorithmHKDF::importKey):
2567         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2568         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2569         (WebCore::CryptoAlgorithmHMAC::sign):
2570         (WebCore::CryptoAlgorithmHMAC::verify):
2571         (WebCore::CryptoAlgorithmHMAC::importKey):
2572         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2573         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2574         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2575         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2576         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2577         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2578         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2579         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2580         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2581         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2582         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2583         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2584         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2585         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2586         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2587         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2588         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2589         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2590         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2591         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2592         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2593         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2594         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2595         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2596         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2597         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2598         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2599         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2600         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2601         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2602         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2603         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2604         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2605         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2606         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2607         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2608         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2609         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2610         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2611         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2612         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2613         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2614         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2615         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2616         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2617         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2618         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2619         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2620         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2621         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2622         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2623         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2624         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2625         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2626         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2627         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2628         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2629         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2630         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2631         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2632         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2633         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2634         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2635         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2636         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2637         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2638         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2639         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2640         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2641         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2642         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2643         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2644         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2645         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2646         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2647         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2648         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2649         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2650         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2651         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2652
2653 2018-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2654
2655         [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
2656         https://bugs.webkit.org/show_bug.cgi?id=187375
2657
2658         Reviewed by Simon Fraser.
2659
2660         An immediate-paint transaction should force all the images which are pending
2661         decoding to be repainted.
2662
2663         To do that, FrameView::paintControlTints() will be re-factored to a new
2664         generic function such that it takes PaintInvalidationReasons. The new function
2665         which is named 'traverseForPaintInvalidation' will traverse the render tree
2666         for a specific PaintInvalidationReasons.
2667
2668         invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
2669         the underlying image and repaint all the clients which are waiting for the
2670         decoding to finish.
2671
2672         * loader/cache/CachedImage.cpp:
2673         (WebCore::CachedImage::didRemoveClient):
2674         (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
2675         (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
2676         (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
2677         (WebCore::CachedImage::allClientsRemoved):
2678         (WebCore::CachedImage::clear):
2679         (WebCore::CachedImage::createImage):
2680         (WebCore::CachedImage::imageFrameAvailable):
2681         (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
2682         * loader/cache/CachedImage.h:
2683         * page/FrameView.cpp:
2684         (WebCore::FrameView::paintScrollCorner):
2685         (WebCore::FrameView::updateControlTints):
2686         (WebCore::FrameView::traverseForPaintInvalidation):
2687         (WebCore::FrameView::adjustPageHeightDeprecated):
2688         (WebCore::FrameView::paintControlTints): Deleted.
2689         * page/FrameView.h:
2690         * platform/ScrollView.cpp:
2691         (WebCore::ScrollView::paint):
2692         * platform/Scrollbar.cpp:
2693         (WebCore::Scrollbar::paint):
2694         * platform/graphics/BitmapImage.h:
2695         * platform/graphics/GraphicsContext.cpp:
2696         (WebCore::GraphicsContext::GraphicsContext):
2697         * platform/graphics/GraphicsContext.h:
2698         (WebCore::GraphicsContext::performingPaintInvalidation const):
2699         (WebCore::GraphicsContext::invalidatingControlTints const):
2700         (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
2701         (WebCore::GraphicsContext::updatingControlTints const): Deleted.
2702         * rendering/RenderBoxModelObject.cpp:
2703         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2704         * rendering/RenderImage.cpp:
2705         (WebCore::RenderImage::paintReplaced):
2706         (WebCore::RenderImage::paintAreaElementFocusRing):
2707         (WebCore::RenderImage::paintIntoRect):
2708         * rendering/RenderLayer.cpp:
2709         (WebCore::RenderLayer::paintScrollCorner):
2710         (WebCore::RenderLayer::paintResizer):
2711         (WebCore::RenderLayer::paintLayer):
2712         * rendering/RenderScrollbar.cpp:
2713         (WebCore::RenderScrollbar::paint):
2714         * rendering/RenderTheme.cpp:
2715         (WebCore::RenderTheme::paint):
2716         * testing/Internals.cpp:
2717         (WebCore::Internals::invalidateControlTints):
2718         (WebCore::Internals::paintControlTints): Deleted.
2719         * testing/Internals.h:
2720         * testing/Internals.idl:
2721
2722 2018-07-16  Ryan Haddad  <ryanhaddad@apple.com>
2723
2724         Unreviewed attempt to fix the build.
2725
2726         * rendering/RenderThemeMac.mm:
2727
2728 2018-07-11  Dean Jackson  <dino@apple.com>
2729
2730         Allow removal of white backgrounds
2731         https://bugs.webkit.org/show_bug.cgi?id=187574
2732         <rdar://problem/41146792>
2733
2734         Reviewed by Simon Fraser.
2735
2736         Add a drawing mode that turns white backgrounds into transparent
2737         regions, such that a hosting app can see through to its window.
2738
2739         Test: css3/color-filters/punch-out-white-backgrounds.html
2740
2741         * page/Settings.yaml: New Setting.
2742
2743         * rendering/InlineFlowBox.cpp: Draw with a destination out blend mode
2744         if the background is white and we are punching out backgrounds, which means
2745         that it will erase the destination.
2746         (WebCore::InlineFlowBox::paintBoxDecorations):
2747         * rendering/RenderBox.cpp:
2748         (WebCore::RenderBox::paintBackground): Ditto.
2749         * rendering/RenderTableCell.cpp:
2750         (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto.
2751
2752         * rendering/RenderBoxModelObject.cpp:
2753         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Save and restore
2754         the composition mode if necessary.
2755
2756 2018-07-16  David Fenton  <david_fenton@apple.com>
2757
2758         Unreviewed, rolling out r233867.
2759
2760         caused build failures on High Sierra, Sierra and iOS
2761
2762         Reverted changeset:
2763
2764         "[WebCrypto] Crypto operations should copy their parameters
2765         before hoping to another thread"
2766         https://bugs.webkit.org/show_bug.cgi?id=187501
2767         https://trac.webkit.org/changeset/233867
2768
2769 2018-07-15  Jiewen Tan  <jiewen_tan@apple.com>
2770
2771         [WebCrypto] Crypto operations should copy their parameters before hoping to another thread
2772         https://bugs.webkit.org/show_bug.cgi?id=187501
2773         <rdar://problem/41438160>
2774
2775         Reviewed by Youenn Fablet.
2776
2777         This patch aims at making all captured variables in all crypto lambdas that need to be passed
2778         to a worker thread thread safe, which includes:
2779         1) changing ref counted objects to thread safe ref counted object.
2780         2) adding isolatedCopy methods to non ref counted classes, so they can be called by CrossThreadCopy().
2781
2782         In addition to above changes, this patch also does the following things:
2783         1) change the name CryptoAlgorithm::dispatchOperation => CryptoAlgorithm::dispatchOperationInWorkQueue
2784         to make it clear that lambdas will be passed to a secondary thread.
2785         2) make CryptoAlgorithmParameters as const parameters for all methods.
2786
2787         Tests: crypto/subtle/aes-gcm-import-key-unwrap-ec-raw-key.html
2788                http/wpt/crypto/aes-cbc-crash.any.html
2789                http/wpt/crypto/aes-cbc-crash.any.worker.html
2790                http/wpt/crypto/aes-ctr-crash.any.html
2791                http/wpt/crypto/aes-ctr-crash.any.worker.html
2792                http/wpt/crypto/aes-gcm-crash.any.html
2793                http/wpt/crypto/aes-gcm-crash.any.worker.html
2794                http/wpt/crypto/derive-hmac-key-crash.any.html
2795                http/wpt/crypto/derive-hmac-key-crash.any.worker.html
2796                http/wpt/crypto/ecdsa-crash.any.html
2797                http/wpt/crypto/ecdsa-crash.any.worker.html
2798                http/wpt/crypto/hkdf-crash.any.html
2799                http/wpt/crypto/hkdf-crash.any.worker.html
2800                http/wpt/crypto/pbkdf2-crash.any.html
2801                http/wpt/crypto/pbkdf2-crash.any.worker.html
2802                http/wpt/crypto/rsa-oaep-crash.any.html
2803                http/wpt/crypto/rsa-oaep-crash.any.worker.html
2804                http/wpt/crypto/rsa-pss-crash.any.html
2805                http/wpt/crypto/rsa-pss-crash.any.worker.html
2806                http/wpt/crypto/unwrap-ec-key-crash.any.html
2807                http/wpt/crypto/unwrap-ec-key-crash.any.worker.html
2808                http/wpt/crypto/unwrap-rsa-key-crash.any.html
2809                http/wpt/crypto/unwrap-rsa-key-crash.any.worker.html
2810
2811         * crypto/CryptoAlgorithm.cpp:
2812         (WebCore::CryptoAlgorithm::encrypt):
2813         (WebCore::CryptoAlgorithm::decrypt):
2814         (WebCore::CryptoAlgorithm::sign):
2815         (WebCore::CryptoAlgorithm::verify):
2816         (WebCore::CryptoAlgorithm::deriveBits):
2817         (WebCore::CryptoAlgorithm::importKey):
2818         (WebCore::dispatchAlgorithmOperation):
2819         (WebCore::CryptoAlgorithm::dispatchOperationInWorkQueue):
2820         (WebCore::CryptoAlgorithm::dispatchOperation): Deleted.
2821         * crypto/CryptoAlgorithm.h:
2822         * crypto/SubtleCrypto.cpp:
2823         (WebCore::crossThreadCopyImportParams):
2824         (WebCore::SubtleCrypto::encrypt):
2825         (WebCore::SubtleCrypto::decrypt):
2826         (WebCore::SubtleCrypto::sign):
2827         (WebCore::SubtleCrypto::verify):
2828         (WebCore::SubtleCrypto::deriveKey):
2829         (WebCore::SubtleCrypto::deriveBits):
2830         (WebCore::SubtleCrypto::importKey):
2831         (WebCore::SubtleCrypto::wrapKey):
2832         (WebCore::SubtleCrypto::unwrapKey):
2833         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2834         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2835         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2836         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2837         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2838         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2839         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2840         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2841         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2842         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
2843         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2844         (WebCore::parametersAreValid):
2845         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
2846         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
2847         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2848         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
2849         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2850         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2851         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2852         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2853         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
2854         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2855         (WebCore::CryptoAlgorithmAES_KW::importKey):
2856         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2857         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2858         (WebCore::CryptoAlgorithmECDH::deriveBits):
2859         (WebCore::CryptoAlgorithmECDH::importKey):
2860         * crypto/algorithms/CryptoAlgorithmECDH.h:
2861         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2862         (WebCore::CryptoAlgorithmECDSA::sign):
2863         (WebCore::CryptoAlgorithmECDSA::verify):
2864         (WebCore::CryptoAlgorithmECDSA::importKey):
2865         * crypto/algorithms/CryptoAlgorithmECDSA.h:
2866         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
2867         (WebCore::CryptoAlgorithmHKDF::deriveBits):
2868         (WebCore::CryptoAlgorithmHKDF::importKey):
2869         * crypto/algorithms/CryptoAlgorithmHKDF.h:
2870         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2871         (WebCore::CryptoAlgorithmHMAC::sign):
2872         (WebCore::CryptoAlgorithmHMAC::verify):
2873         (WebCore::CryptoAlgorithmHMAC::importKey):
2874         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2875         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
2876         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
2877         (WebCore::CryptoAlgorithmPBKDF2::importKey):
2878         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
2879         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2880         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
2881         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
2882         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
2883         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2884         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2885         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
2886         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
2887         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2888         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2889         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2890         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
2891         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
2892         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2893         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2894         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2895         (WebCore::CryptoAlgorithmRSA_PSS::sign):
2896         (WebCore::CryptoAlgorithmRSA_PSS::verify):
2897         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2898         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
2899         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
2900         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2901         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2902         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
2903         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2904         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2905         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
2906         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2907         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2908         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
2909         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2910         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2911         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
2912         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2913         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
2914         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2915         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
2916         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2917         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2918         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
2919         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2920         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2921         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
2922         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
2923         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
2924         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
2925         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
2926         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
2927         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
2928         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
2929         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
2930         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
2931         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
2932         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
2933         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
2934         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
2935         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2936         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2937         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
2938         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
2939         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
2940         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
2941         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
2942         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
2943         * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h:
2944         * crypto/parameters/CryptoAlgorithmAesCtrParams.h:
2945         * crypto/parameters/CryptoAlgorithmAesGcmParams.h:
2946         * crypto/parameters/CryptoAlgorithmEcKeyParams.h:
2947         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
2948         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
2949         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
2950         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
2951         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
2952         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h:
2953         * crypto/parameters/CryptoAlgorithmRsaPssParams.h:
2954
2955 2018-07-16  Aditya Keerthi  <akeerthi@apple.com>
2956
2957         [Datalist][macOS] Add suggestions UI for TextFieldInputTypes
2958         https://bugs.webkit.org/show_bug.cgi?id=186531
2959
2960         Reviewed by Tim Horton.
2961
2962         Tests: fast/forms/datalist/datalist-show-hide.html
2963                fast/forms/datalist/datalist-textinput-keydown.html
2964
2965         * html/TextFieldInputType.cpp:
2966         (WebCore::TextFieldInputType::handleKeydownEvent):
2967         (WebCore::TextFieldInputType::handleKeydownEventForSpinButton): The suggestions view takes precedence when handling arrow key events.
2968
2969 2018-07-16  Jeremy Jones  <jeremyj@apple.com>
2970
2971         Fullscreen requires active document.
2972         https://bugs.webkit.org/show_bug.cgi?id=186226
2973         rdar://problem/36187413
2974
2975         Reviewed by Jer Noble.
2976
2977         Test: media/no-fullscreen-when-hidden.html
2978
2979         This change guarantees the document to be visible for both element fullscreen and video fullscreen.
2980
2981         User gesture is not enough to guarantee that the document is visible when fullscreen is initiated
2982         because JavaScript can spin wait before initiating fullscreen. During that spin the page or window might
2983         be hidden.
2984
2985         Document::hidden() can't be relied upon because it won't update while JavaScript spins.
2986
2987         This change adds a sync call to the UI process to get the current UI visibility state.
2988
2989         * dom/Document.cpp:
2990         (WebCore::Document::requestFullScreenForElement):
2991         * html/HTMLMediaElement.cpp:
2992         (WebCore::HTMLMediaElement::enterFullscreen):
2993         * page/ChromeClient.h:
2994
2995 2018-07-16  Alex Christensen  <achristensen@webkit.org>
2996
2997         Reduce size of NetworkLoadMetrics and therefore ResourceResponse
2998         https://bugs.webkit.org/show_bug.cgi?id=187671
2999
3000         Reviewed by Darin Adler.
3001
3002         * inspector/agents/InspectorNetworkAgent.cpp:
3003         (WebCore::toProtocol):
3004         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
3005         * platform/network/NetworkLoadMetrics.h:
3006         (WebCore::NetworkLoadMetrics::isolatedCopy const):
3007         (WebCore::NetworkLoadMetrics::reset):
3008         (WebCore::NetworkLoadMetrics::clearNonTimingData):
3009
3010 2018-07-16  Chris Dumez  <cdumez@apple.com>
3011
3012         Make sure LibWebRTCMediaEndpoint is always destroyed on the main thread
3013         https://bugs.webkit.org/show_bug.cgi?id=187702
3014
3015         Reviewed by Youenn Fablet.
3016
3017         Make sure LibWebRTCMediaEndpoint is always constructed and destructed on the main thread since
3018         it has a Timer data member and it would not be safe otherwise. LibWebRTCMediaEndpoint is
3019         ThreadSafeRefCounted and frequently passed to other threads.
3020
3021         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3022         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
3023         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3024
3025 2018-07-16  Sihui Liu  <sihui_liu@apple.com>
3026
3027         IndexedDB: closeAndDeleteDatabasesForOrigins should remove all databases for those origins
3028         https://bugs.webkit.org/show_bug.cgi?id=187631
3029         <rdar://problem/42164227>
3030
3031         Reviewed by Brady Eidson.
3032
3033         When asked to delete database for an origin, we deleted the databases whose mainFrameOrigin 
3034         is that origin. Given that the origin may create IndexedDB from subframes, we should delete 
3035         databases whose openingOrigin is that origin too.
3036
3037         Covered by modified API test: WebKit.WebsiteDataStoreCustomPaths. 
3038
3039         * Modules/indexeddb/server/IDBServer.cpp:
3040         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
3041
3042 2018-07-16  Simon Fraser  <simon.fraser@apple.com>
3043
3044         Shrink some font-related classes and enums
3045         https://bugs.webkit.org/show_bug.cgi?id=187686
3046
3047         Reviewed by Myles Maxfield.
3048         
3049         Use enum class for enums in TextFlags.h and make them one byte big.
3050
3051         Re-order members of Font to shrink it from 360 to 328 bytes.
3052
3053         * css/CSSPrimitiveValueMappings.h:
3054         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3055         (WebCore::CSSPrimitiveValue::operator FontSmoothingMode const):
3056         (WebCore::CSSPrimitiveValue::operator FontSmallCaps const):
3057         (WebCore::CSSPrimitiveValue::operator TextRenderingMode const):
3058         * platform/graphics/Font.cpp:
3059         (WebCore::Font::Font):
3060         (WebCore::Font::verticalRightOrientationFont const):
3061         * platform/graphics/Font.h:
3062         * platform/graphics/FontCascade.cpp:
3063         (WebCore::offsetToMiddleOfGlyph):
3064         * platform/graphics/FontCascade.h:
3065         (WebCore::FontCascade::advancedTextRenderingMode const):
3066         * platform/graphics/FontCascadeFonts.cpp:
3067         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
3068         (WebCore::FontCascadeFonts::glyphDataForVariant):
3069         (WebCore::glyphPageFromFontRanges):
3070         * platform/graphics/FontDescription.cpp:
3071         (WebCore::FontCascadeDescription::FontCascadeDescription):
3072         * platform/graphics/FontDescription.h:
3073         (WebCore::FontDescription::setTextRenderingMode):
3074         (WebCore::FontDescription::setOrientation):
3075         (WebCore::FontDescription::setWidthVariant):
3076         (WebCore::FontCascadeDescription::setFontSmoothing):
3077         (WebCore::FontCascadeDescription::initialSmallCaps):
3078         (WebCore::FontCascadeDescription::initialFontSmoothing):
3079         (WebCore::FontCascadeDescription::initialTextRenderingMode):
3080         * platform/graphics/FontPlatformData.h:
3081         (WebCore::FontPlatformData::isForTextCombine const):
3082         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3083         (WebCore::preparePlatformFont):
3084         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3085         (WebCore::showLetterpressedGlyphsWithAdvances):
3086         (WebCore::showGlyphsWithAdvances):
3087         (WebCore::FontCascade::drawGlyphs):
3088         (WebCore::FontCascade::fontForCombiningCharacterSequence const):
3089         * platform/graphics/cocoa/FontCocoa.mm:
3090         (WebCore::Font::platformInit):
3091         (WebCore::Font::platformBoundsForGlyph const):
3092         (WebCore::Font::platformWidthForGlyph const):
3093         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3094         (WebCore::FontPlatformData::hash const):
3095         (WebCore::mapFontWidthVariantToCTFeatureSelector):
3096         (WebCore::FontPlatformData::ctFont const):
3097         (WebCore::FontPlatformData::description const):
3098         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
3099         (WebCore::FontPlatformData::buildScaledFont):
3100         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3101         (WebCore::Font::platformInit):
3102         (WebCore::Font::platformWidthForGlyph const):
3103         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
3104         (WebCore::fontFeatures):
3105         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3106         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
3107         (WebCore::Font::getCFStringAttributes const):
3108         * platform/graphics/win/FontCGWin.cpp:
3109         (WebCore::FontCascade::drawGlyphs):
3110         * platform/graphics/win/FontCascadeDirect2D.cpp:
3111         (WebCore::FontCascade::drawGlyphs):
3112         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
3113         (WebCore::GlyphPage::fill):
3114         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
3115         (WebCore::Font::platformInit):
3116         (WebCore::Font::platformBoundsForGlyph const):
3117         (WebCore::Font::platformWidthForGlyph const):
3118         * platform/text/TextFlags.h:
3119         * rendering/RenderCombineText.cpp:
3120         (WebCore::RenderCombineText::combineTextIfNeeded):
3121         * rendering/RenderLayer.cpp:
3122         (WebCore::RenderLayer::calculateClipRects const):
3123         * rendering/TextPainter.cpp:
3124         (WebCore::TextPainter::paintTextWithShadows):
3125         * rendering/TextPainter.h:
3126         * rendering/style/RenderStyle.cpp:
3127         (WebCore::RenderStyle::fontAndGlyphOrientation):
3128         * rendering/svg/RenderSVGInlineText.cpp:
3129         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
3130
3131 2018-07-16  Sergio Villar Senin  <svillar@igalia.com>
3132
3133         [WebVR] Add support for connect/disconnect and mount/unmount device events
3134         https://bugs.webkit.org/show_bug.cgi?id=187343
3135
3136         Reviewed by Žan Doberšek.
3137
3138         WebVR specs define a series of events as part of the Window Interface Extension. We're
3139         adding support for the connect/disconnect and mount/unmount events both at the module level
3140         and the platform level using OpenVR.
3141
3142         In order to do that we need to keep lists of VRPlatformDisplays at platform level and
3143         VRDisplays at bindings level. We then update those lists accordingly to detect potential
3144         additions/removals, and emit the corresponding signals. A new client interface
3145         VRPlatformDisplayClient was also defined so that VRPlatformDisplay implementations could
3146         notify their clients (typically a VRDisplay).
3147
3148         Last but not least, NavigatorWebVR was updated so it supplements Navigator instead of
3149         supplementing Page.
3150
3151         * Modules/webvr/NavigatorWebVR.cpp: Supplement Navigator not Page.
3152         (WebCore::NavigatorWebVR::getVRDisplays): Keep a list of VRDisplays and update them
3153         conveniently, also emitting the required events under certain conditions (like device
3154         disconnection).
3155         (WebCore::NavigatorWebVR::supplementName): New method.
3156         (WebCore::NavigatorWebVR::from): Ditto.
3157         * Modules/webvr/NavigatorWebVR.h: Supplement Navigator not Page.
3158         * Modules/webvr/VRDisplay.cpp:
3159         (WebCore::VRDisplay::create): Moved suspendIfNeeded() to constructor.
3160         (WebCore::VRDisplay::VRDisplay): Set itself as VRPlatformDisplay client.
3161         (WebCore::VRDisplay::~VRDisplay): Unset as  VRPlatformDisplay client.
3162         (WebCore::VRDisplay::VRPlatformDisplayConnected): Dispatch event on DOM window.
3163         (WebCore::VRDisplay::VRPlatformDisplayDisconnected): Ditto.
3164         (WebCore::VRDisplay::VRPlatformDisplayMounted): Ditto.
3165         (WebCore::VRDisplay::VRPlatformDisplayUnmounted): Ditto.
3166         * Modules/webvr/VRDisplay.h: Extend from VRPlatformDisplayClient.
3167         (WebCore::VRDisplay::document):
3168         * Modules/webvr/VRDisplayEvent.cpp: Updated Copyright.
3169         * Modules/webvr/VRDisplayEvent.h: Ditto.
3170         * Sources.txt: Added the two new files.
3171         * WebCore.xcodeproj/project.pbxproj: Ditto.
3172         * platform/vr/VRManager.cpp:
3173         (WebCore::VRManager::getVRDisplays): Keep a list of VRPlatformDisplays and update them conveniently,
3174         also emitting the required events under certain conditions (like device disconnection).
3175         * platform/vr/VRManager.h:
3176         * platform/vr/VRPlatformDisplay.cpp: New file with common implementations for VRPlatformDisplays.
3177         (WebCore::VRPlatformDisplay::setClient):
3178         (WebCore::VRPlatformDisplay::notifyVRPlatformDisplayEvent):
3179         * platform/vr/VRPlatformDisplay.h: Added a generic method to notify about different
3180         events. Added the client pointer.
3181         * platform/vr/VRPlatformDisplayClient.h: New file. VRPlatformDisplay implementations will
3182         call the client methods in the event of some circumstances happening.
3183         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayConnected):
3184         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayDisconnected):
3185         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayMounted):
3186         (WebCore::VRPlatformDisplayClient::VRPlatformDisplayUnmounted):
3187         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3188         (WebCore::VRPlatformDisplayOpenVR::updateDisplayInfo): Poll the device for new events to
3189         detect connection/disconnections or device activations/deactivations (HMD
3190         mounted/unmounted).
3191         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3192
3193 2018-07-16  Zan Dobersek  <zdobersek@igalia.com>
3194
3195         [Nicosia] Add Nicosia::PlatformLayer, Nicosia::CompositionLayer classes
3196         https://bugs.webkit.org/show_bug.cgi?id=187693
3197
3198         Reviewed by Carlos Garcia Campos.
3199
3200         Add the Nicosia::PlatformLayer class. This will be the base platform
3201         layer class from which different derivatives will be created, addressing
3202         different use cases. The generic PlatformLayer type alias will point to
3203         this class in the future.
3204
3205         First class deriving from Nicosia::PlatformLayer is
3206         Nicosia::CompositionLayer, purpose of which will be to mirror the state
3207         that's stored in the platform-specific GraphicsLayer derivative. It will
3208         also allow making thread-safe updates to that state.
3209
3210         CoordinatedGraphicsLayer implementation now spawns a CompositionLayer
3211         object and tracks state changes in a separate
3212         CompositionLayer::LayerState::Delta object. During flushing, the changed
3213         state is applied to the layer's pending state before the delta is nulled
3214         out. The updated state isn't used anywhere yet, but future changes will
3215         implement committing this state into the rendering pipeline.
3216
3217         There's bits of state not yet being managed by CompositionLayer, e.g.
3218         debug visuals, filters and animations. These will be addressed later.
3219
3220         The m_solidColor member variable is added to CoordinatedGraphicsLayer in
3221         order to properly store the solid color value. Normally this would be
3222         contained by the parent GraphicsLayer class, but no such member variable
3223         exists there.
3224
3225         * platform/TextureMapper.cmake:
3226         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp: Added.
3227         (Nicosia::PlatformLayer::PlatformLayer):
3228         (Nicosia::CompositionLayer::CompositionLayer):
3229         * platform/graphics/nicosia/NicosiaPlatformLayer.h: Added.
3230         (Nicosia::PlatformLayer::isCompositionLayer const):
3231         (Nicosia::PlatformLayer::id const):
3232         (Nicosia::CompositionLayer::create):
3233         (Nicosia::CompositionLayer::LayerState::Flags::Flags):
3234         (Nicosia::CompositionLayer::updateState):
3235         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3236         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
3237         (WebCore::CoordinatedGraphicsLayer::setPosition):
3238         (WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
3239         (WebCore::CoordinatedGraphicsLayer::setSize):
3240         (WebCore::CoordinatedGraphicsLayer::setTransform):
3241         (WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
3242         (WebCore::CoordinatedGraphicsLayer::setPreserves3D):
3243         (WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
3244         (WebCore::CoordinatedGraphicsLayer::setDrawsContent):
3245         (WebCore::CoordinatedGraphicsLayer::setContentsVisible):
3246         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
3247         (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
3248         (WebCore::CoordinatedGraphicsLayer::setOpacity):
3249         (WebCore::CoordinatedGraphicsLayer::setContentsRect):
3250         (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
3251         (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
3252         (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
3253         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
3254         (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
3255         (WebCore::CoordinatedGraphicsLayer::syncChildren):
3256         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3257         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3258
3259 2018-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3260
3261         [iOS apps on macOS] Playing embedded Twitter videos in the News app crashes the web process
3262         https://bugs.webkit.org/show_bug.cgi?id=187690
3263         <rdar://problem/41869703>
3264
3265         Reviewed by Tim Horton.
3266
3267         Work around unexpected behavior when soft-linking AVFoundation. After using `dlopen_preflight` to check for the
3268         existence of a library prior to loading the library using `dlopen`, `dlsym` subsequently returns null for some
3269         symbols that would otherwise be available. This causes us to RELEASE_ASSERT later down the road when we try to
3270         load AVAudioSessionModeDefault in AudioSessionIOS.mm.
3271
3272         To fix this for now, simply check for the library directly instead of using the more lightweight preflight
3273         check. See clone: <rdar://problem/42224780> for more detail.
3274
3275         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm:
3276         (WebCore::AVFoundationMIMETypeCache::isAvailable const):
3277
3278 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
3279
3280         Shrink StyleFillData, StyleStrokeData and StyleMiscData
3281         https://bugs.webkit.org/show_bug.cgi?id=187681
3282
3283         Reviewed by Anders Carlsson.
3284
3285         Shrink these data structures by making more enum classes one byte in size, and
3286         re-ordering. StyleFillData goes from 56 to 48, StyleStrokeData from 80 to 72,
3287         StyleMiscData from 40 to 32 bytes.
3288
3289         * rendering/style/SVGRenderStyleDefs.cpp:
3290         (WebCore::StyleFillData::StyleFillData):
3291         (WebCore::StyleFillData::operator== const):
3292         (WebCore::StyleStrokeData::StyleStrokeData):
3293         (WebCore::StyleStrokeData::operator== const):
3294         (WebCore::StyleStopData::operator== const):
3295         (WebCore::StyleMiscData::StyleMiscData):
3296         * rendering/style/SVGRenderStyleDefs.h:
3297
3298 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
3299
3300         Shrink CachedResource and subclasses
3301         https://bugs.webkit.org/show_bug.cgi?id=187546
3302
3303         Reviewed by Daniel Bates.
3304
3305         Shrink CachedResource down from 1384 to 1336 bytes, CachedImage from 1480 to
3306         1424 bytes, and CachedFont a little.
3307         
3308         This saves about 23KB on cnn.com.
3309
3310         * loader/ResourceLoaderOptions.h:
3311         * loader/cache/CachedFont.h:
3312         * loader/cache/CachedImage.h:
3313         * loader/cache/CachedResource.cpp:
3314         (WebCore::CachedResource::CachedResource):
3315         * loader/cache/CachedResource.h:
3316         * platform/network/CacheValidation.h:
3317         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
3318         * platform/network/NetworkLoadMetrics.h:
3319         * platform/network/ParsedContentRange.h:
3320         * platform/network/ResourceRequestBase.h:
3321         * platform/network/ResourceResponseBase.h:
3322
3323 2018-07-14  Simon Fraser  <simon.fraser@apple.com>
3324
3325         Shrink some style-related classes and enums
3326         https://bugs.webkit.org/show_bug.cgi?id=187680
3327
3328         Reviewed by Antti Koivisto.
3329         
3330         Make all the enum classes in RenderStyleConstants be one byte big (all have less
3331         than 256 values).
3332         
3333         Shrink DocumentRuleSet from 384 to 368 bytes by re-ordering, which also helps shrink
3334         StyleResolver from 1024 to 952 bytes.
3335         
3336         Shrink BorderValue by re-ordering (now that the layout of Color has changed) which