REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-19  Chris Dumez  <cdumez@apple.com>
2
3         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
4         https://bugs.webkit.org/show_bug.cgi?id=184209
5         <rdar://problem/39145306>
6
7         Reviewed by Ryosuke Niwa.
8
9         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
10         loads need to happen synchronously for Web-compatibility. However, this regressed loading
11         an HTML string in a WebView because in such cases, the URL is also about:blank with
12         substitute data.
13
14         In this patch, we take a more conservative approach and restore policy checking for
15         'about:blank' but using synchronous IPC.
16
17         * loader/PolicyChecker.cpp:
18         (WebCore::PolicyChecker::checkNavigationPolicy):
19
20 2018-04-19  Chris Nardi  <cnardi@chromium.org>
21
22         Support calc() in webkit-gradient and cross-fade
23         https://bugs.webkit.org/show_bug.cgi?id=182225
24
25         Reviewed by Simon Fraser.
26
27         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
28         Update the code to support calc() values.
29
30         Tests: LayoutTests/css3/calc/cross-fade-calc.html
31                LayoutTests/css3/calc/webkit-gradient-calc.html
32
33         * css/parser/CSSPropertyParserHelpers.cpp:
34         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
35         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
36
37 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
38
39         The InternalFunction hierarchy should be in IsoSubspaces
40         https://bugs.webkit.org/show_bug.cgi?id=184721
41
42         Reviewed by Saam Barati.
43
44         No new tests because no new behavior.
45
46         * bindings/js/WebCoreJSClientData.cpp:
47         (WebCore::JSVMClientData::JSVMClientData):
48         * bindings/js/WebCoreJSClientData.h:
49         (WebCore::JSVMClientData::runtimeMethodSpace):
50         * bridge/runtime_method.cpp:
51         (JSC::RuntimeMethod::subspaceForImpl):
52         * bridge/runtime_method.h:
53
54 2018-04-19  Brady Eidson  <beidson@apple.com>
55
56         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
57         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
58
59         Reviewed by Ryosuke Niwa.
60
61         No new tests (Refactor, no behavior change).
62
63         In WebCore, we:
64         - Add a process-unique "BackForwardItemIdentifier"
65         - Make all HistoryItems have such an identifier as a member
66
67         * WebCore.xcodeproj/project.pbxproj:
68
69         * history/BackForwardItemIdentifier.h: Added.
70         (WebCore::BackForwardItemIdentifier::logString const):
71         (WebCore::operator==):
72         (WebCore::BackForwardItemIdentifier::encode const):
73         (WebCore::BackForwardItemIdentifier::decode):
74         (WebCore::BackForwardItemIdentifier::hash const):
75         (WTF::BackForwardItemIdentifierHash::hash):
76         (WTF::BackForwardItemIdentifierHash::equal):
77         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
78         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
79         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
80
81         * history/HistoryItem.cpp:
82         (WebCore::HistoryItem::generateSequenceNumber):
83         (WebCore::HistoryItem::HistoryItem):
84         (WebCore::generateSequenceNumber): Deleted.
85
86         * history/HistoryItem.h:
87         (WebCore::HistoryItem::create):
88         (WebCore::HistoryItem::identifier const):
89
90 2018-04-19  Nan Wang  <n_wang@apple.com>
91
92         AX: AOM: respect the accessibility setting for dispatching the accessible events
93         https://bugs.webkit.org/show_bug.cgi?id=184619
94
95         Reviewed by Ryosuke Niwa.
96
97         Added accessibilityEventsEnabled as a setting on the page.
98
99         Test: accessibility/ios-simulator/accessibility-events-setting.html
100
101         * accessibility/AccessibilityObject.cpp:
102         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
103         * page/Settings.yaml:
104         * testing/InternalSettings.cpp:
105         (WebCore::InternalSettings::Backup::Backup):
106         (WebCore::InternalSettings::Backup::restoreTo):
107         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
108         * testing/InternalSettings.h:
109         * testing/InternalSettings.idl:
110
111 2018-04-18  Jer Noble  <jer.noble@apple.com>
112
113         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
114         https://bugs.webkit.org/show_bug.cgi?id=184693
115         <rdar://problem/39491884>
116
117         Reviewed by Tim Horton.
118
119         * Configurations/WebCore.xcconfig:
120
121 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
122
123         Change MediaSource WebCore to return NewObject for SourceBuffers
124         https://bugs.webkit.org/show_bug.cgi?id=184642
125
126         Reviewed by Chris Dumez.
127
128         Minor change inline with IDL documentation
129
130         * Modules/mediasource/MediaSource.cpp:
131         (WebCore::MediaSource::addSourceBuffer):
132         (): Deleted.
133         * Modules/mediasource/MediaSource.h:
134         * Modules/mediasource/MediaSource.idl:
135
136 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
137
138         Unreviewed, build fix for Ubuntu LTS GCC
139         https://bugs.webkit.org/show_bug.cgi?id=184756
140
141         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
142
143         * bindings/js/ScriptController.cpp:
144         (WebCore::ScriptController::updateDocument):
145         (WebCore::ScriptController::collectIsolatedContexts):
146
147 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
148
149         Caret rendered at incorrect location inside empty table cell
150         https://bugs.webkit.org/show_bug.cgi?id=85385
151
152         Reviewed by Zalan Bujtas.
153
154         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
155
156         This fixes the position of the caret in empty cells,
157         that was painted lower than expected
158         (and then modified when you start to edit the cell).
159
160         Ensures that editable table cells have at least one line when
161         they are laid out. This ensures that the cell's intrinsic before/after
162         padding is calculated correctly, which results in the caret location
163         being calculated correctly.
164
165         Test: editing/caret/caret-in-empty-cell.html
166
167         * rendering/RenderTableCell.cpp:
168         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
169         that it has an an empty line if the table cell is editable.
170         * rendering/RenderTableCell.h:
171
172 2018-04-18  Daniel Bates  <dabates@apple.com>
173
174         Cleanup TextControlInnerElements
175         https://bugs.webkit.org/show_bug.cgi?id=184475
176
177         Reviewed by Antti Koivisto.
178
179         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
180         TextControlPlaceholderElement::create() from the header to the cpp file, replace
181         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
182         function menu.
183
184         * html/shadow/TextControlInnerElements.cpp:
185         (WebCore::TextControlInnerElement::resolveCustomStyle):
186         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
187         (WebCore::TextControlPlaceholderElement::create):
188         * html/shadow/TextControlInnerElements.h:
189
190 2018-04-18  Chris Dumez  <cdumez@apple.com>
191
192         Rename WindowProxyController to WindowProxy
193         https://bugs.webkit.org/show_bug.cgi?id=184756
194
195         Reviewed by Sam Weinig.
196
197         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
198         needed use WindowProxyController type, which was a bit confusing.
199
200         * Sources.txt:
201         * WebCore.xcodeproj/project.pbxproj:
202         * bindings/js/DOMWrapperWorld.cpp:
203         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
204         (WebCore::DOMWrapperWorld::clearWrappers):
205         * bindings/js/DOMWrapperWorld.h:
206         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
207         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
208         * bindings/js/JSBindingsAllInOne.cpp:
209         * bindings/js/JSDOMWindowBase.cpp:
210         (WebCore::toJS):
211         * bindings/js/JSDOMWindowProxy.cpp:
212         (WebCore::toJS):
213         (WebCore::toJSDOMWindowProxy):
214         * bindings/js/JSDOMWindowProxy.h:
215         (WebCore::toJS):
216         (WebCore::toJSDOMWindowProxy):
217         * bindings/js/ScriptCachedFrameData.cpp:
218         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
219         (WebCore::ScriptCachedFrameData::restore):
220         * bindings/js/ScriptController.cpp:
221         (WebCore::ScriptController::evaluateInWorld):
222         (WebCore::ScriptController::loadModuleScriptInWorld):
223         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
224         (WebCore::ScriptController::evaluateModule):
225         (WebCore::ScriptController::setupModuleScriptHandlers):
226         (WebCore::ScriptController::windowProxy):
227         (WebCore::ScriptController::enableEval):
228         (WebCore::ScriptController::enableWebAssembly):
229         (WebCore::ScriptController::disableEval):
230         (WebCore::ScriptController::disableWebAssembly):
231         (WebCore::ScriptController::updateDocument):
232         (WebCore::ScriptController::collectIsolatedContexts):
233         (WebCore::ScriptController::windowScriptNPObject):
234         (WebCore::ScriptController::executeIfJavaScriptURL):
235         * bindings/js/ScriptController.h:
236         (WebCore::ScriptController::globalObject):
237         * bindings/js/ScriptControllerMac.mm:
238         (WebCore::ScriptController::windowScriptObject):
239         * bindings/js/ScriptState.cpp:
240         (WebCore::mainWorldExecState):
241         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
242         (WebCore::WindowProxy::WindowProxy):
243         (WebCore::WindowProxy::~WindowProxy):
244         (WebCore::WindowProxy::destroyJSWindowProxy):
245         (WebCore::WindowProxy::createJSWindowProxy):
246         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
247         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
248         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
249         (WebCore::WindowProxy::setDOMWindow):
250         (WebCore::WindowProxy::attachDebugger):
251         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
252         (WebCore::WindowProxy::jsWindowProxies const):
253         (WebCore::WindowProxy::releaseJSWindowProxies):
254         (WebCore::WindowProxy::setJSWindowProxies):
255         (WebCore::WindowProxy::jsWindowProxy):
256         (WebCore::WindowProxy::existingJSWindowProxy const):
257         (WebCore::WindowProxy::globalObject):
258         * loader/FrameLoader.cpp:
259         (WebCore::FrameLoader::clear):
260         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
261         * page/AbstractFrame.cpp:
262         (WebCore::AbstractFrame::AbstractFrame):
263         * page/AbstractFrame.h:
264         (WebCore::AbstractFrame::windowProxy):
265         (WebCore::AbstractFrame::windowProxy const):
266         * page/Page.cpp:
267         (WebCore::Page::setDebugger):
268         * page/RemoteDOMWindow.cpp:
269         (WebCore::RemoteDOMWindow::self const):
270         (WebCore::RemoteDOMWindow::top const):
271         (WebCore::RemoteDOMWindow::opener const):
272         (WebCore::RemoteDOMWindow::parent const):
273         * page/RemoteDOMWindow.h:
274
275 2018-04-18  Chris Dumez  <cdumez@apple.com>
276
277         Set RemoteDOMWindow's initial opener
278         https://bugs.webkit.org/show_bug.cgi?id=184716
279
280         Reviewed by Sam Weinig.
281
282         Add support for WindowProxy type in the IDL. The implementation should
283         return a WindowProxyController and toJS() will take care of converting
284         this into a JSValue via JSDOMWindowProxy.
285
286         No new tests, rebaselined existing test.
287
288         * WebCore.xcodeproj/project.pbxproj:
289         * bindings/IDLTypes.h:
290         * bindings/js/JSDOMConvertWindowProxy.h: Added.
291         (WebCore::JSConverter<IDLWindowProxy>::convert):
292         * bindings/js/JSDOMWindowBase.cpp:
293         (WebCore::toJS):
294         * bindings/js/JSDOMWindowBase.h:
295         (WebCore::toJS):
296         * bindings/js/JSDOMWindowProxy.cpp:
297         (WebCore::toJS):
298         (WebCore::toJSDOMWindowProxy):
299         * bindings/js/JSDOMWindowProxy.h:
300         (WebCore::toJS):
301         (WebCore::toJSDOMWindowProxy):
302         * bindings/js/JSRemoteDOMWindowBase.cpp:
303         * bindings/js/JSRemoteDOMWindowBase.h:
304         * bindings/scripts/CodeGenerator.pm:
305         (IsBuiltinType):
306         * bindings/scripts/CodeGeneratorJS.pm:
307         (AddToIncludesForIDLType):
308         (GetBaseIDLType):
309         * page/RemoteDOMWindow.cpp:
310         (WebCore::RemoteDOMWindow::self const):
311         (WebCore::RemoteDOMWindow::top const):
312         (WebCore::RemoteDOMWindow::opener const):
313         (WebCore::RemoteDOMWindow::parent const):
314         * page/RemoteDOMWindow.h:
315         * page/RemoteDOMWindow.idl:
316         * page/RemoteFrame.h:
317
318 2018-04-18  Dean Jackson  <dino@apple.com>
319
320         Detect system preview links
321         https://bugs.webkit.org/show_bug.cgi?id=184753
322         <rdar://problem/39500514>
323
324         Reviewed by Antoine Quint.
325
326         Detect a special type of link anchor, which we're calling System Previews.
327         Ultimately this will allow WebKit to present such links in a special
328         way.
329
330         A System Preview link is an <a> element, with a rel attribute that
331         includes "system-preview". It has a single element child, which is
332         either an <img> or a <picture>.
333
334         Test: system-preview/detection.html
335
336         * html/HTMLAnchorElement.cpp:
337         (WebCore::HTMLAnchorElement::relList): Add braces.
338         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
339         function.
340         * html/HTMLAnchorElement.h:
341
342         * html/HTMLImageElement.cpp:
343         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
344         parent if it is a system preview link.
345         * html/HTMLImageElement.h:
346         * html/HTMLPictureElement.cpp:
347         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
348         * html/HTMLPictureElement.h:
349
350         * testing/Internals.cpp: Testing helpers.
351         (WebCore::Internals::systemPreviewRelType):
352         (WebCore::Internals::isSystemPreviewLink const):
353         (WebCore::Internals::isSystemPreviewImage const):
354         * testing/Internals.h:
355         * testing/Internals.idl:
356
357 2018-04-18  Antti Koivisto  <antti@apple.com>
358
359         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
360         https://bugs.webkit.org/show_bug.cgi?id=181680
361
362         Reviewed by Beth Dakin.
363
364         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
365         activate again.
366
367         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
368         All the tests using it are skipped.
369
370         * page/EventHandler.cpp:
371         (WebCore::EventHandler::handleMouseForceEvent):
372
373         Don't add HitTestRequest::Active if the force of the force event is zero.
374
375 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
376
377         Ensure correct screen sizes
378         https://bugs.webkit.org/show_bug.cgi?id=184757
379         
380         Reviewed by Wenson Hsieh.
381         
382         Make sure that the screen sizes are actually correct.
383
384         Not currently testable, will add tests when it is.
385
386         * platform/ios/PlatformScreenIOS.mm:
387
388 2018-04-18  Nan Wang  <n_wang@apple.com>
389
390         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
391         https://bugs.webkit.org/show_bug.cgi?id=184742
392
393         Reviewed by Chris Fleizach.
394
395         Made increment and decrement actions on the macOS to be async. So that VoiceOver
396         won't hang indefinitely if performing the actions causes an alert or other modal
397         behaviors.
398
399         Test: accessibility/mac/async-increment-decrement-action.html
400
401         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
402         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
403         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
404         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
405         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
406         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
407
408 2018-04-18  Youenn Fablet  <youenn@apple.com>
409
410         MediaResourceLoader should set its fetch destination
411         https://bugs.webkit.org/show_bug.cgi?id=184746
412
413         Reviewed by Eric Carlson.
414
415         Covered by updated test.
416
417         * loader/MediaResourceLoader.cpp:
418         (WebCore::MediaResourceLoader::requestResource):
419
420 2018-04-18  Jer Noble  <jer.noble@apple.com>
421
422         Fix runtime errors in simulator while playing media
423         https://bugs.webkit.org/show_bug.cgi?id=184751
424
425         Reviewed by Eric Carlson.
426
427         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
428
429         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
430         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
431         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
432         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
433         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
434
435 2018-04-18  Jer Noble  <jer.noble@apple.com>
436
437         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
438         https://bugs.webkit.org/show_bug.cgi?id=184698
439
440         Reviewed by Eric Carlson.
441
442         * platform/audio/ios/AudioSessionIOS.mm:
443         * platform/audio/mac/AudioSessionMac.cpp:
444
445 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
446
447         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
448         https://bugs.webkit.org/show_bug.cgi?id=184570
449         <rdar://problem/34807323>
450
451         Reviewed by Chris Dumez.
452
453         Set FrameLoadType properly when error occurs in reload.
454
455         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
456
457         * loader/FrameLoader.cpp:
458         (WebCore::FrameLoader::load):
459
460 2018-04-18  Chris Dumez  <cdumez@apple.com>
461
462         Add support for converting a local window to a remote window
463         https://bugs.webkit.org/show_bug.cgi?id=184515
464         <rdar://problem/39011318>
465
466         Reviewed by Ryosuke Niwa.
467
468         Add initial support for process-swapping when navigating cross-origin as a result
469         of a window.open(). The window object returned by window.open() is initially same
470         origin and is for about:blank. The navigation cross-origin then happens and the
471         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
472         hosted in another WebProcess).
473
474         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
475         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
476         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
477         in a follow-up by relying on IPC.
478
479         Test: http/tests/navigation/process-swap-window-open.html
480
481         * bindings/js/JSDOMGlobalObject.cpp:
482         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
483         * bindings/js/JSDOMPromiseDeferred.h:
484         * bindings/js/JSDOMWindowProperties.cpp:
485         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
486         * bindings/js/JSDOMWindowProxy.cpp:
487         (WebCore::JSDOMWindowProxy::finishCreation):
488         (WebCore::JSDOMWindowProxy::create):
489         * bindings/js/JSDOMWindowProxy.h:
490         * bindings/js/JSDOMWrapper.cpp:
491         (WebCore::JSDOMObject::JSDOMObject):
492         * bindings/js/JSDOMWrapper.h:
493         * bindings/js/WindowProxyController.cpp:
494         (WebCore::WindowProxyController::createWindowProxy):
495         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
496         * bridge/objc/WebScriptObject.mm:
497         (-[WebScriptObject _isSafeScript]):
498         Teach more of our bindings code about RemoteDOMWindows.
499
500         * dom/Document.cpp:
501         (WebCore::Document::createDOMWindow):
502         * loader/FrameLoaderClient.h:
503         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
504         the frame. This is needed for WebKit2 to link the old window to its new representation
505         in the new WebProcess.
506
507 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
508
509         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
510         https://bugs.webkit.org/show_bug.cgi?id=184681
511
512         Reviewed by Carlos Garcia Campos.
513
514         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
515         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
516         build target now that it's built via Sources.txt.
517
518 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
519
520         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
521         https://bugs.webkit.org/show_bug.cgi?id=183986
522
523         Reviewed by Michael Catanzaro.
524
525         In CoordinatedImageBacking::update(), when drawing the image into a
526         freshly-created image backing, we can avoid save-and-restoring the
527         painting context. We also don't have to clip it, since the clipping area
528         is the same as the image (and buffer) bounds. Since the buffer is
529         initialized to transparent color, we can use the CompositeCopy operator
530         to just copy image data into the destination since there's nothing to
531         paint the source over.
532
533         No new tests -- no change in functionality.
534
535         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
536         (WebCore::CoordinatedImageBacking::update):
537
538 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
539
540         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
541         https://bugs.webkit.org/show_bug.cgi?id=184573
542
543         Reviewed by Carlos Alberto Lopez Perez.
544
545         Add quirk for outlook.live.com.
546
547         * platform/UserAgentQuirks.cpp:
548         (WebCore::urlRequiresMacintoshPlatform):
549
550 2018-04-17  Mark Lam  <mark.lam@apple.com>
551
552         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
553         https://bugs.webkit.org/show_bug.cgi?id=184702
554         <rdar://problem/35391681>
555
556         Reviewed by Filip Pizlo and Saam Barati.
557
558         No new tests. This is covered by existing tests.
559
560         * WebCore.xcodeproj/project.pbxproj:
561         * css/ElementRuleCollector.cpp:
562         (WebCore::ElementRuleCollector::ruleMatches):
563         * cssjit/CSSPtrTag.h: Added.
564         * cssjit/CompiledSelector.h:
565         * cssjit/FunctionCall.h:
566         (WebCore::FunctionCall::FunctionCall):
567         (WebCore::FunctionCall::setFunctionAddress):
568         (WebCore::FunctionCall::prepareAndCall):
569         * cssjit/SelectorCompiler.cpp:
570         (WebCore::SelectorCompiler::compileSelector):
571         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
572         (WebCore::SelectorCompiler::addPseudoClassType):
573         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
574         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
575         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
576         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
577         * cssjit/SelectorCompiler.h:
578         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
579         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
580         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
581         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
582         * dom/SelectorQuery.cpp:
583         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
584         (WebCore::SelectorDataList::execute const):
585         * dom/SelectorQuery.h:
586
587 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
588
589         Retain MessagePortChannel for transfer when disentangling ports
590         https://bugs.webkit.org/show_bug.cgi?id=184502
591         <rdar://problem/39372771>
592
593         Reviewed by Geoffrey Garen.
594
595         MessagePortChannels should be retained while ports are being transferred, but that was only
596         happening when sending a port through another port, but not when sending it through a worker.
597
598         Test: workers/worker-to-worker.html
599
600         * dom/messageports/MessagePortChannel.cpp:
601         (WebCore::MessagePortChannel::entanglePortWithProcess):
602         (WebCore::MessagePortChannel::disentanglePort):
603         (WebCore::MessagePortChannel::postMessageToRemote):
604         (WebCore::MessagePortChannel::takeAllMessagesForPort):
605
606 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
607
608         References from CSSStyleDeclaration to CSSValues should be weak
609         https://bugs.webkit.org/show_bug.cgi?id=180280
610         <rdar://problem/35804869>
611
612         Reviewed by Geoffrey Garen.
613
614         No new tests - used the existing test to verify the leak
615
616         * css/DeprecatedCSSOMValue.h:
617         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
618         * css/PropertySetCSSStyleDeclaration.cpp:
619         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
620         * css/PropertySetCSSStyleDeclaration.h:
621
622 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
623
624         Unreviewed rollout of r230632. Regression in memory usage.
625
626         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
627
628         Tests: animations/animation-internals-api-multiple-keyframes.html
629                animations/animation-internals-api.html
630                transitions/transition-drt-api-delay.html
631                transitions/transition-drt-api.html
632
633         * page/RuntimeEnabledFeatures.h:
634         * testing/Internals.cpp:
635         (WebCore::Internals::pseudoElement): Deleted.
636         * testing/Internals.h:
637         * testing/Internals.idl:
638
639 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
640
641         Do not unregister MessagePorts on deallocation if it has been disentangled
642         https://bugs.webkit.org/show_bug.cgi?id=184285
643         <rdar://problem/39256714>
644
645         Reviewed by Darin Adler.
646
647         Test: workers/message-port-gc.html
648
649         * dom/MessagePort.cpp:
650         (WebCore::MessagePort::deref const):
651
652 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
653
654         [Curl] Fix timing of reporting error to the client
655         https://bugs.webkit.org/show_bug.cgi?id=184707
656
657         Before checking the result code, check the status of callback invocation and
658         do the right thing.
659
660         Reviewed by Youenn Fablet.
661
662         No new tests because there's no new behavior.
663
664         * platform/network/curl/CurlRequest.cpp:
665         (WebCore::CurlRequest::didCompleteTransfer):
666         * platform/network/curl/CurlRequest.h:
667         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
668
669 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
670
671         [Curl] Export authentication information to be used by the client.
672         https://bugs.webkit.org/show_bug.cgi?id=184709
673
674         Just added getters for username and password member variables.
675
676         Reviewed by Alex Christensen.
677
678         No new tests because there's no new behavior.
679
680         * platform/network/curl/CurlRequest.h:
681         (WebCore::CurlRequest::user const):
682         (WebCore::CurlRequest::password const):
683
684 2018-04-17  Chris Dumez  <cdumez@apple.com>
685
686         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
687         https://bugs.webkit.org/show_bug.cgi?id=184678
688         <rdar://problem/39422122>
689
690         Reviewed by Alex Christensen.
691
692         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
693         r225657 added code to make sure that if the client does not make the navigation policy
694         decision synchronously for frament navigations, then we'll stop waiting for the client
695         and proceed with the navigation. However, r229831 make the navigation policy decision
696         IPC decision, meaning that even if the client responds synchronously, it would be
697         asynchronously from WebCore's point of view. As a result, we would always ignore the
698         client's policy decision when doing a fragment navigation.
699
700         This is an issue on iclould.com because the web-app links are fragment URLs. When you
701         CMD+click one of these link, we do the navigation policy check. As a result of this
702         check, Safari responds IGNORE to the policy decision and instead decides to load the
703         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
704         would not obey the IGNORE policy decision from Safari and load the link in the current
705         tab, even though Safari would already be loading it in a new tab.
706
707         To address the issue, I reintroduced a synchronous code path for navigation policy
708         decision making, backed by synchronous IPC. This synchronous code path is now used for
709         fragment navigations to restore pre-r229831 behavior. If the client does not answer
710         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
711
712         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
713
714         * loader/EmptyClients.cpp:
715         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
716         * loader/EmptyFrameLoaderClient.h:
717         * loader/FrameLoader.cpp:
718         (WebCore::FrameLoader::loadURL):
719         (WebCore::FrameLoader::loadWithDocumentLoader):
720         * loader/FrameLoaderClient.h:
721         * loader/PolicyChecker.cpp:
722         (WebCore::PolicyChecker::checkNavigationPolicy):
723         * loader/PolicyChecker.h:
724
725 2018-04-17  Matt Lewis  <jlewis3@apple.com>
726
727         Unreviewed, rolling out r230713.
728
729         This caused internal build failures.
730
731         Reverted changeset:
732
733         "Implement checked cast for DDResultRef once
734         DDResultGetTypeID() is available"
735         https://bugs.webkit.org/show_bug.cgi?id=184554
736         https://trac.webkit.org/changeset/230713
737
738 2018-04-17  Chris Dumez  <cdumez@apple.com>
739
740         Add bindings code for RemoteDOMWindow
741         https://bugs.webkit.org/show_bug.cgi?id=184653
742
743         Reviewed by Ryosuke Niwa.
744
745         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
746         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
747         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
748         code is identical to the DOMWindow code paths from cross-origin handling.
749
750         No new tests, this code will be used and tested via Bug 184515.
751
752         * CMakeLists.txt:
753         * DerivedSources.make:
754         * Sources.txt:
755         * WebCore.xcodeproj/project.pbxproj:
756         * bindings/js/JSBindingsAllInOne.cpp:
757         * bindings/js/JSDOMWindowCustom.cpp:
758         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
759         (WebCore::JSDOMWindow::getOwnPropertySlot):
760         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
761         (WebCore::addCrossOriginWindowOwnPropertyNames):
762         * bindings/js/JSDOMWindowCustom.h:
763
764         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
765         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
766         (WebCore::JSRemoteDOMWindowBase::destroy):
767         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
768         (WebCore::toJS):
769         (WebCore::toJSRemoteDOMWindow):
770         * bindings/js/JSRemoteDOMWindowBase.h: Added.
771         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
772         1. a JSProxy's target needs to be a JSGlobalObject currently
773         2. The 'structure()->setGlobalObject(vm, &window);' call in
774            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
775         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
776         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
777         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
778         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
779         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
780         m_wrapped implementation pointer. I followed the same pattern here.
781
782         (WebCore::toJS):
783         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
784         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
785         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
786         (WebCore::JSRemoteDOMWindow::put):
787         (WebCore::JSRemoteDOMWindow::putByIndex):
788         (WebCore::JSRemoteDOMWindow::deleteProperty):
789         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
790         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
791         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
792         (WebCore::JSRemoteDOMWindow::getPrototype):
793         (WebCore::JSRemoteDOMWindow::preventExtensions):
794         (WebCore::JSRemoteDOMWindow::toStringName):
795         * bindings/scripts/CodeGeneratorJS.pm:
796         (IsDOMGlobalObject):
797         (GenerateHeader):
798         (GenerateOverloadDispatcher):
799         (GenerateImplementation):
800         * page/RemoteDOMWindow.idl: Added.
801
802 2018-04-17  David Kilzer  <ddkilzer@apple.com>
803
804         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
805         <https://webkit.org/b/184554>
806         <rdar://problem/36241894>
807
808         Reviewed by Brent Fulgham.
809
810         * editing/cocoa/DataDetection.mm:
811         (WebCore::detectItemAtPositionWithRange): Implement checked cast
812         for DDResultRef.
813
814 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
815
816         Animated GIF imagery with finite looping are falling one loop short
817         https://bugs.webkit.org/show_bug.cgi?id=183153
818
819         Reviewed by Simon Fraser.
820
821         The Netscape Looping Application Extension is a block which may be added
822         to a GIF file to tell the viewer to loop through the entire GIF frames.
823         This is communicated through two bytes designated for the "loopCount" in
824         this block.
825
826         The entire block may not be found in the GIF, in which case the GIF is 
827         supposed to animate its entire frames only once.
828
829         If the block exists and loopCount = 0, this means the image has to loop
830         through its frames indefinitely.
831
832         If the block exist and loopCount > 0, this should mean the image has to
833         loop through its frames loopCount + 1 times. The extra loop seems to be
834         the consensus among most of the GIF generators and viewers. For example,
835         if the image designer wants the image to loop through its frames n times:
836         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
837            will write n - 1 for loopCount. However http://gifmaker.me and 
838            http://gifmaker.org write n for loopCount.
839         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
840            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
841            means loop the GIF n times.
842
843         Because the specs are not really clear about this, we are going to consider
844         the agreed-upon behavior among most of the web browsers the specs here.
845
846         * platform/graphics/cg/ImageDecoderCG.cpp:
847         (WebCore::ImageDecoderCG::repetitionCount const):
848         * platform/image-decoders/gif/GIFImageDecoder.cpp:
849         (WebCore::GIFImageDecoder::repetitionCount const):
850
851 2018-04-17  Saam Barati  <sbarati@apple.com>
852
853         Add system trace points for process launch and for initializeWebProcess
854         https://bugs.webkit.org/show_bug.cgi?id=184669
855
856         Reviewed by Simon Fraser.
857
858         No testing needed because there is no new functionality here.
859
860         * loader/FrameLoader.cpp:
861         (WebCore::FrameLoader::provisionalLoadStarted):
862         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
863         * loader/SubresourceLoader.cpp:
864         (WebCore::SubresourceLoader::willSendRequestInternal):
865         (WebCore::SubresourceLoader::didFinishLoading):
866         (WebCore::SubresourceLoader::didFail):
867         (WebCore::SubresourceLoader::didCancel):
868
869 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
870
871         [iOS] AirPlay device name is sometimes wrong
872         https://bugs.webkit.org/show_bug.cgi?id=184543
873         <rdar://problem/39105498>
874
875         Reviewed by Jer Noble.
876
877         No new tests, this can only be tested with a specific hardware setup.
878
879         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
880         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
881         when possible.
882
883 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
884
885         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
886         https://bugs.webkit.org/show_bug.cgi?id=184406
887
888         Rubber-stamped by Michael Catanzaro.
889
890         Fix build with clang 3.8
891
892         No new tests, it is a build fix.
893
894         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
895         (WebCore::PlatformDisplayWayland::create):
896
897 2018-04-16  Antoine Quint  <graouts@apple.com>
898
899         Layout Test animations/needs-layout.html is a flaky Image Failure.
900         https://bugs.webkit.org/show_bug.cgi?id=172397
901
902         Reviewed by Dean Jackson.
903
904         Animations that animate a transform and uses a relative value for either the x or y components
905         require a layout before starting, which CSSAnimationController would perform in the call to
906         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
907         created.
908
909         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
910         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
911         the first invalidation task, which runs in the next run loop after a change to the timing model has
912         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
913         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
914         we commit animations on the compositor immediately after that too, instead of waiting until the next
915         DisplayRefreshMonitor callback.
916
917         * animation/DocumentTimeline.cpp:
918         (WebCore::DocumentTimeline::performInvalidationTask):
919         (WebCore::DocumentTimeline::updateAnimations):
920         * animation/KeyframeEffectReadOnly.cpp:
921         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
922         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
923         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
924         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
925         * animation/KeyframeEffectReadOnly.h:
926
927 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
928
929         Inconsistent EGL defines in ImageBufferCairo
930         https://bugs.webkit.org/show_bug.cgi?id=184661
931
932         Reviewed by Žan Doberšek.
933
934         On revision r219391 libepoxy is added. The headers in
935         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
936         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
937         the Webkit build:
938
939             ...
940             /usr/include/GLES2/gl2.h:503:82: error: 'voi
941             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
942             of symbol
943             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
944             program, GLuint shader);
945
946         No new tests.
947
948         * platform/graphics/cairo/ImageBufferCairo.cpp:
949
950 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
951
952         MutationObserver should be in an IsoHeap
953         https://bugs.webkit.org/show_bug.cgi?id=184671
954         <rdar://problem/36081981>
955
956         Reviewed by Sam Weinig.
957
958         No new tests because no new behavior.
959
960         * dom/MutationObserver.cpp:
961         * dom/MutationObserver.h:
962
963 2018-04-16  Youenn Fablet  <youenn@apple.com>
964
965         Use NetworkLoadChecker to handle synchronous HTTP loads
966         https://bugs.webkit.org/show_bug.cgi?id=184240
967
968         Reviewed by Chris Dumez.
969
970         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
971         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
972         Add an option to disable security checks if NetworkProcess does it for WebProcess.
973         This option will be also used for regular asynchronous loads in future patches.
974
975         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
976
977         Covered by existing and rebased tests.
978
979         * loader/CrossOriginPreflightChecker.cpp:
980         (WebCore::CrossOriginPreflightChecker::doPreflight):
981         * loader/DocumentThreadableLoader.cpp:
982         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
983         (WebCore::DocumentThreadableLoader::loadRequest):
984         * loader/FrameLoader.cpp:
985         (WebCore::FrameLoader::loadResourceSynchronously):
986         * loader/FrameLoader.h:
987         * loader/LoaderStrategy.h:
988         * xml/XSLTProcessorLibxslt.cpp:
989         (WebCore::docLoaderFunc):
990         * xml/parser/XMLDocumentParserLibxml2.cpp:
991         (WebCore::openFunc):
992
993 2018-04-16  Christopher Reid  <chris.reid@sony.com>
994
995         [WinCairo] Media elements should be enabled by default
996         https://bugs.webkit.org/show_bug.cgi?id=184597
997
998         Reviewed by Per Arne Vollan.
999
1000         Enabling media elements by default with media foundation.
1001
1002         * page/SettingsDefaultValues.h:
1003
1004 2018-04-16  Christopher Reid  <chris.reid@sony.com>
1005
1006         [Curl] Add the Accept-Language field to curl request headers
1007         https://bugs.webkit.org/show_bug.cgi?id=184605
1008
1009         Reviewed by Alex Christensen.
1010
1011         Add Accept-Language field to curl request headers
1012
1013         * platform/network/curl/CurlRequest.cpp:
1014         * platform/network/curl/CurlRequest.h:
1015
1016 2018-04-16  Chris Dumez  <cdumez@apple.com>
1017
1018         Move more WindowProxy-related logic from ScriptController to WindowProxyController
1019         https://bugs.webkit.org/show_bug.cgi?id=184640
1020
1021         Reviewed by Ryosuke Niwa.
1022
1023         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
1024         for clarity.
1025
1026         * bindings/js/JSDOMWindowProxy.cpp:
1027         (WebCore::JSDOMWindowProxy::attachDebugger):
1028         * bindings/js/JSDOMWindowProxy.h:
1029         * bindings/js/ScriptCachedFrameData.cpp:
1030         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1031         (WebCore::ScriptCachedFrameData::restore):
1032         * bindings/js/ScriptController.cpp:
1033         (WebCore::ScriptController::~ScriptController):
1034         (WebCore::ScriptController::initScriptForWindowProxy):
1035         * bindings/js/ScriptController.h:
1036         (WebCore::ScriptController::existingCacheableBindingRootObject const):
1037         * bindings/js/WindowProxyController.cpp:
1038         (WebCore::collectGarbageAfterWindowProxyDestruction):
1039         (WebCore::WindowProxyController::~WindowProxyController):
1040         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
1041         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
1042         (WebCore::WindowProxyController::attachDebugger):
1043         * bindings/js/WindowProxyController.h:
1044         * loader/FrameLoader.cpp:
1045         (WebCore::FrameLoader::clear):
1046         * page/Page.cpp:
1047         (WebCore::Page::setDebugger):
1048
1049 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
1050
1051         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
1052         https://bugs.webkit.org/show_bug.cgi?id=184652
1053
1054         Reviewed by Philippe Normand.
1055
1056         In the constructor we should mark selected streams based on the default values from GstStream,
1057         if the user changes them, they will be updated as required later on.
1058
1059         No new tests are added as we already have a few ones that are currently disabled in
1060         the mediastream testsuite. This patch is part of the work to enable them.
1061
1062         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1063         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
1064         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1065         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
1066
1067 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
1068
1069         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
1070         https://bugs.webkit.org/show_bug.cgi?id=184651
1071
1072         Reviewed by Philippe Normand.
1073
1074         We can't notify the client if none is connected, but still we need to fill our metadatas from
1075         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
1076         at construct time but the metadata might already be preset (and won't be updated later on).
1077
1078         No new tests are added as we already have a few ones that are currently disabled in
1079         the mediastream testsuite. This patch is part of the work to enable them.
1080
1081         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1082         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
1083
1084 2018-04-16  Antoine Quint  <graouts@apple.com>
1085
1086         [Web Animations] Ensure we never return -0 through the API
1087         https://bugs.webkit.org/show_bug.cgi?id=184644
1088
1089         Reviewed by Dean Jackson.
1090
1091         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
1092         This would happen when playbackRate < 0.
1093
1094         * animation/WebAnimationUtilities.h:
1095         (WebCore::secondsToWebAnimationsAPITime):
1096
1097 2018-04-15  Antoine Quint  <graouts@apple.com>
1098
1099         [Web Animations] Animations do not naturally get a finish event
1100         https://bugs.webkit.org/show_bug.cgi?id=184639
1101         <rdar://problem/39397649>
1102
1103         Reviewed by Jon Lee.
1104
1105         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
1106         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
1107         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
1108         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
1109         they will keep being scheduled in a loop.
1110
1111         * animation/WebAnimation.cpp:
1112         (WebCore::WebAnimation::timeToNextRequiredTick const):
1113         (WebCore::WebAnimation::resolve):
1114
1115 2018-04-15  Chris Dumez  <cdumez@apple.com>
1116
1117         Change Event's returnValue so it doesn't expose a new primitive
1118         https://bugs.webkit.org/show_bug.cgi?id=184415
1119
1120         Reviewed by Darin Adler.
1121
1122         Update Event.returnValue setter to match the latest DOM specification after:
1123         - https://github.com/whatwg/dom/pull/626
1124
1125         In particular, the returnValue setter is now a no-op if the new flag value
1126         is true. If the input flag value is false, it only sets the 'canceled' flag
1127         if the event is cancelable and the event’s in passive listener flag is unset.
1128
1129         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
1130
1131         * dom/Event.cpp:
1132         (WebCore::Event::setLegacyReturnValue):
1133         (WebCore::Event::setCanceledFlagIfPossible):
1134         (WebCore::Event::preventDefault):
1135         * dom/Event.h:
1136
1137 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
1138
1139         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
1140         https://bugs.webkit.org/show_bug.cgi?id=184620
1141
1142         Reviewed by Philippe Normand.
1143
1144         This is a minor change, a dedicated test doesn't really make sense here.
1145
1146         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1147         (WebCore::TrackPrivateBaseGStreamer::stream):
1148
1149 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
1150
1151         WebKit crashes when libwebrtc.dylib is missing
1152         https://bugs.webkit.org/show_bug.cgi?id=184607
1153
1154         Rubber-stamped by Jer Noble.
1155
1156         Don't call LibWebRTC related code when libwebrtc is not available.
1157
1158         * dom/Document.cpp:
1159         (WebCore::Document::prepareForDestruction):
1160         (WebCore::Document::suspend):
1161
1162 2018-04-13  Chris Dumez  <cdumez@apple.com>
1163
1164         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
1165         https://bugs.webkit.org/show_bug.cgi?id=184591
1166
1167         Reviewed by Sam Weinig.
1168
1169         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
1170         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
1171         This is work towards fixing Bug 184515.
1172
1173         * Sources.txt:
1174         * WebCore.xcodeproj/project.pbxproj:
1175         * bindings/js/DOMWrapperWorld.cpp:
1176         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1177         (WebCore::DOMWrapperWorld::clearWrappers):
1178         * bindings/js/DOMWrapperWorld.h:
1179         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1180         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1181         * bindings/js/JSBindingsAllInOne.cpp:
1182         * bindings/js/JSDOMWindowBase.cpp:
1183         (WebCore::toJSDOMWindow):
1184         * bindings/js/JSDOMWindowProxy.cpp:
1185         (WebCore::toJS):
1186         (WebCore::toJSDOMWindowProxy):
1187         * bindings/js/ScriptCachedFrameData.cpp:
1188         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1189         (WebCore::ScriptCachedFrameData::restore):
1190         * bindings/js/ScriptController.cpp:
1191         (WebCore::ScriptController::~ScriptController):
1192         (WebCore::ScriptController::evaluateInWorld):
1193         (WebCore::ScriptController::loadModuleScriptInWorld):
1194         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1195         (WebCore::ScriptController::evaluateModule):
1196         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
1197         (WebCore::ScriptController::setDOMWindowForWindowProxy):
1198         (WebCore::ScriptController::initScriptForWindowProxy):
1199         (WebCore::ScriptController::setupModuleScriptHandlers):
1200         (WebCore::ScriptController::windowProxyController):
1201         (WebCore::ScriptController::enableEval):
1202         (WebCore::ScriptController::enableWebAssembly):
1203         (WebCore::ScriptController::disableEval):
1204         (WebCore::ScriptController::disableWebAssembly):
1205         (WebCore::ScriptController::attachDebugger):
1206         (WebCore::ScriptController::updateDocument):
1207         (WebCore::ScriptController::collectIsolatedContexts):
1208         (WebCore::ScriptController::windowScriptNPObject):
1209         (WebCore::ScriptController::executeIfJavaScriptURL):
1210         * bindings/js/ScriptController.h:
1211         (WebCore::ScriptController::globalObject):
1212         * bindings/js/ScriptControllerMac.mm:
1213         (WebCore::ScriptController::windowScriptObject):
1214         * bindings/js/ScriptState.cpp:
1215         (WebCore::mainWorldExecState):
1216         * bindings/js/WindowProxyController.cpp: Added.
1217         (WebCore::WindowProxyController::WindowProxyController):
1218         (WebCore::WindowProxyController::destroyWindowProxy):
1219         (WebCore::WindowProxyController::createWindowProxy):
1220         (WebCore::WindowProxyController::windowProxies):
1221         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
1222         * bindings/js/WindowProxyController.h: Added.
1223         (WebCore::WindowProxyController::releaseWindowProxies):
1224         (WebCore::WindowProxyController::setWindowProxies):
1225         (WebCore::WindowProxyController::windowProxy):
1226         (WebCore::WindowProxyController::existingWindowProxy const):
1227         (WebCore::WindowProxyController::globalObject):
1228         * loader/FrameLoader.cpp:
1229         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1230         * page/AbstractFrame.cpp:
1231         (WebCore::AbstractFrame::AbstractFrame):
1232         * page/AbstractFrame.h:
1233         (WebCore::AbstractFrame::windowProxyController):
1234         (WebCore::AbstractFrame::windowProxyController const):
1235
1236 2018-04-13  Brady Eidson  <beidson@apple.com>
1237
1238         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
1239         https://bugs.webkit.org/show_bug.cgi?id=184559
1240
1241         Reviewed by Alex Christensen.
1242
1243         Covered by new API test.
1244
1245         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
1246
1247         * loader/DocumentLoader.cpp:
1248         (WebCore::DocumentLoader::redirectReceived):
1249         (WebCore::DocumentLoader::willSendRequest):
1250         (WebCore::DocumentLoader::startLoadingMainResource):
1251         * loader/DocumentLoader.h:
1252
1253         * loader/FrameLoader.cpp:
1254         (WebCore::FrameLoader::init):
1255         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1256
1257 2018-04-13  Chris Dumez  <cdumez@apple.com>
1258
1259         input.webkitEntries does not work as expected when folder contains accented chars
1260         https://bugs.webkit.org/show_bug.cgi?id=184517
1261         <rdar://problem/39265537>
1262
1263         Reviewed by Alex Christensen.
1264
1265         Use String::fromUTF8() to construct a WTF String from the char* returned by
1266         dirname() in FileSystem::directoryName(). Previously, we were just calling
1267         the String constructor, which would treat the input as latin 1 instead of
1268         UTF-8.
1269
1270         Change is covered by an API test rather than a layout test due to file versioning
1271         limitations.
1272
1273         * platform/posix/FileSystemPOSIX.cpp:
1274         (WebCore::FileSystem::directoryName):
1275
1276 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1277
1278         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
1279         https://bugs.webkit.org/show_bug.cgi?id=184401
1280
1281         Rubber stamped by Saam Barati.
1282
1283         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
1284         with @getByIdDirectPrivate().
1285
1286         * Modules/mediastream/RTCPeerConnection.js:
1287         (initializeRTCPeerConnection):
1288         (getLocalStreams):
1289         (getStreamById):
1290         (addStream):
1291         * Modules/mediastream/RTCPeerConnectionInternals.js:
1292         (isRTCPeerConnection):
1293         * Modules/streams/ReadableByteStreamController.js:
1294         (enqueue):
1295         (error):
1296         (close):
1297         (getter.byobRequest):
1298         * Modules/streams/ReadableByteStreamInternals.js:
1299         (privateInitializeReadableStreamBYOBReader):
1300         (privateInitializeReadableByteStreamController):
1301         (privateInitializeReadableStreamBYOBRequest):
1302         (isReadableByteStreamController):
1303         (isReadableStreamBYOBRequest):
1304         (isReadableStreamBYOBReader):
1305         (readableByteStreamControllerCancel):
1306         (readableByteStreamControllerError):
1307         (readableByteStreamControllerClose):
1308         (readableByteStreamControllerClearPendingPullIntos):
1309         (readableByteStreamControllerGetDesiredSize):
1310         (readableStreamHasBYOBReader):
1311         (readableStreamHasDefaultReader):
1312         (readableByteStreamControllerHandleQueueDrain):
1313         (readableByteStreamControllerPull):
1314         (readableByteStreamControllerShouldCallPull):
1315         (readableByteStreamControllerCallPullIfNeeded):
1316         (readableByteStreamControllerEnqueue):
1317         (readableByteStreamControllerEnqueueChunk):
1318         (readableByteStreamControllerRespondWithNewView):
1319         (readableByteStreamControllerRespond):
1320         (readableByteStreamControllerRespondInternal):
1321         (readableByteStreamControllerRespondInReadableState):
1322         (readableByteStreamControllerRespondInClosedState):
1323         (readableByteStreamControllerProcessPullDescriptors):
1324         (readableByteStreamControllerFillDescriptorFromQueue):
1325         (readableByteStreamControllerShiftPendingDescriptor):
1326         (readableByteStreamControllerInvalidateBYOBRequest):
1327         (readableByteStreamControllerCommitDescriptor):
1328         (readableStreamFulfillReadIntoRequest):
1329         (readableByteStreamControllerPullInto):
1330         (readableStreamAddReadIntoRequest):
1331         * Modules/streams/ReadableStream.js:
1332         (initializeReadableStream):
1333         (pipeThrough):
1334         * Modules/streams/ReadableStreamBYOBReader.js:
1335         (cancel):
1336         (read):
1337         (releaseLock):
1338         (getter.closed):
1339         * Modules/streams/ReadableStreamBYOBRequest.js:
1340         (respond):
1341         (respondWithNewView):
1342         (getter.view):
1343         * Modules/streams/ReadableStreamDefaultController.js:
1344         (error):
1345         * Modules/streams/ReadableStreamDefaultReader.js:
1346         (cancel):
1347         (read):
1348         (releaseLock):
1349         (getter.closed):
1350         * Modules/streams/ReadableStreamInternals.js:
1351         (privateInitializeReadableStreamDefaultReader):
1352         (readableStreamReaderGenericInitialize):
1353         (readableStreamDefaultControllerError):
1354         (readableStreamPipeTo):
1355         (readableStreamTee):
1356         (isReadableStream):
1357         (isReadableStreamDefaultReader):
1358         (isReadableStreamDefaultController):
1359         (readableStreamError):
1360         (readableStreamDefaultControllerCallPullIfNeeded):
1361         (readableStreamDefaultControllerGetDesiredSize):
1362         (readableStreamReaderGenericCancel):
1363         (readableStreamCancel):
1364         (readableStreamDefaultControllerCancel):
1365         (readableStreamDefaultControllerPull):
1366         (readableStreamDefaultControllerClose):
1367         (readableStreamClose):
1368         (readableStreamFulfillReadRequest):
1369         (readableStreamDefaultReaderRead):
1370         (readableStreamAddReadRequest):
1371         (isReadableStreamDisturbed):
1372         (readableStreamReaderGenericRelease):
1373         (readableStreamDefaultControllerCanCloseOrEnqueue):
1374         (privateInitializeReadableStreamDefaultController): Deleted.
1375         * Modules/streams/StreamInternals.js:
1376         (validateAndNormalizeQueuingStrategy):
1377         * Modules/streams/WritableStream.js:
1378         (initializeWritableStream):
1379         (abort):
1380         (close):
1381         (write):
1382         (getter.closed):
1383         (getter.ready):
1384         (getter.state):
1385         * Modules/streams/WritableStreamInternals.js:
1386         (isWritableStream):
1387         (syncWritableStreamStateWithQueue):
1388         (errorWritableStream):
1389         (callOrScheduleWritableStreamAdvanceQueue):
1390         * bindings/js/JSDOMBindingInternals.js:
1391         (mapLikeForEach):
1392
1393 2018-04-12  Antoine Quint  <graouts@apple.com>
1394
1395         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
1396         https://bugs.webkit.org/show_bug.cgi?id=184569
1397         <rdar://problem/38671301>
1398
1399         Reviewed by Jon Lee.
1400
1401         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
1402         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
1403         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
1404         to now work with the Web Animations API.
1405
1406         * page/RuntimeEnabledFeatures.h:
1407         * testing/Internals.cpp:
1408         (WebCore::Internals::pseudoElement):
1409         * testing/Internals.h:
1410         * testing/Internals.idl:
1411
1412 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
1413
1414         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
1415         https://bugs.webkit.org/show_bug.cgi?id=184530
1416
1417         Reviewed by Žan Doberšek.
1418
1419         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
1420         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
1421         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
1422         presenting we could access the presenting layers (right now just one) with getLayers().
1423
1424         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
1425         up patch.
1426
1427         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
1428         that should be called maxLayers instead of maxLayer.
1429
1430         * Modules/webvr/VRDisplay.cpp:
1431         (WebCore::VRDisplay::requestPresent):
1432         (WebCore::VRDisplay::stopPresenting):
1433         (WebCore::VRDisplay::exitPresent):
1434         (WebCore::VRDisplay::getLayers const):
1435         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
1436         * Modules/webvr/VRDisplay.h:
1437         (WebCore::VRDisplay::isPresenting const):
1438         * Modules/webvr/VRDisplayCapabilities.h:
1439         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
1440         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
1441         * Modules/webvr/VRDisplayCapabilities.idl:
1442
1443 2018-04-13  Miguel Gomez  <magomez@igalia.com>
1444
1445         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
1446         https://bugs.webkit.org/show_bug.cgi?id=184583
1447
1448         Reviewed by Carlos Garcia Campos.
1449
1450         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
1451
1452         Covered by existent tests.
1453
1454         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1455         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1456         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1457         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1458         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1459
1460 2018-04-13  Miguel Gomez  <magomez@igalia.com>
1461
1462         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
1463         https://bugs.webkit.org/show_bug.cgi?id=183362
1464
1465         Reviewed by Carlos Garcia Campos.
1466
1467         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
1468         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
1469         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
1470         has only effect when not in AC mode.
1471
1472         Covered by existent tests.
1473
1474         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1475         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1476         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1477         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1478         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1479
1480 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1481
1482         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
1483         https://bugs.webkit.org/show_bug.cgi?id=184533
1484
1485         Reviewed by Philippe Normand.
1486
1487         Renamed GStreamerUtilities* files into GStreamerCommon* and
1488         modified files including them accordingly. Include
1489         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
1490         to avoid problems destroying objects when those files are
1491         forgotten to be included.
1492
1493         * Modules/webaudio/AudioContext.cpp:
1494         * platform/GStreamer.cmake:
1495         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
1496         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
1497         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
1498         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
1499         * platform/graphics/gstreamer/ImageGStreamer.h:
1500         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
1501         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
1502         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
1503         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1504         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1505         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1506         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1507         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
1508         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
1509         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1510         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1511         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
1512         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
1513         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
1514         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1515         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
1516         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1517         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1518         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1519         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1520         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1521         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
1522         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
1523         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1524         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
1525         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1526         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1527         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1528         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1529         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
1530
1531 2018-04-12  Christopher Reid  <chris.reid@sony.com>
1532
1533         [Curl] Fix clang build error in CurlContext.cpp
1534         https://bugs.webkit.org/show_bug.cgi?id=184561
1535
1536         Reviewed by Darin Adler.
1537
1538         MSVC allows explicit template specialization in classes but gcc/clang do not.
1539
1540         * platform/network/curl/CurlContext.cpp:
1541
1542 2018-04-12  Christopher Reid  <chris.reid@sony.com>
1543
1544         [Curl] Cookie Database on memory path should be :memory:
1545         https://bugs.webkit.org/show_bug.cgi?id=184572
1546
1547         Reviewed by Alex Christensen.
1548
1549         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
1550         For reference, see: https://www.sqlite.org/inmemorydb.html
1551
1552         * platform/network/curl/CookieJarDB.h:
1553
1554 2018-04-12  Daniel Bates  <dabates@apple.com>
1555
1556         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
1557         (https://bugs.webkit.org/show_bug.cgi?id=184386)
1558
1559         Visual Studio cannot prove that all cases in the switch are covered :(
1560         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
1561
1562         * loader/cache/CachedResourceLoader.cpp:
1563         (WebCore::destinationForType):
1564
1565 2018-04-12  Chris Dumez  <cdumez@apple.com>
1566
1567         Introduce remote variants of Frame / DOMWindow classes
1568         https://bugs.webkit.org/show_bug.cgi?id=184467
1569         <rdar://problem/39011267>
1570
1571         Reviewed by Ryosuke Niwa.
1572
1573         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
1574         are hosted on another WebProcess. Those will be used in a follow-up patch.
1575
1576         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
1577         patch size):
1578         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
1579             - Frame: A local frame
1580             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
1581         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
1582             - DOMWindow: A local DOMWindow
1583             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
1584               remote. A RemoteDOMWindow is always cross-origin.
1585
1586         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
1587         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
1588         RemoteDOMWindow is pointing to.
1589
1590         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
1591         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
1592
1593         Other things we'll need to implement in follow-ups:
1594         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
1595           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
1596           returns the current window in the opener frame (which changes upon navigation).
1597         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
1598           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
1599           This happens when either the newly opened window is either closed or navigated.
1600
1601         * Sources.txt:
1602         * WebCore.xcodeproj/project.pbxproj:
1603         * loader/ContentFilter.cpp:
1604         (WebCore::ContentFilter::didDecide):
1605         * page/AbstractDOMWindow.cpp: Added.
1606         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
1607         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
1608         * page/AbstractDOMWindow.h: Added.
1609         (WebCore::AbstractDOMWindow::identifier const):
1610         * page/AbstractFrame.cpp: Added.
1611         (WebCore::AbstractFrame::AbstractFrame):
1612         (WebCore::AbstractFrame::~AbstractFrame):
1613         * page/AbstractFrame.h: Added.
1614         (WebCore::AbstractFrame::window const):
1615         * page/DOMWindow.cpp:
1616         (WebCore::DOMWindow::DOMWindow):
1617         * page/DOMWindow.h:
1618         (isType):
1619         * page/Frame.cpp:
1620         (WebCore::Frame::window const):
1621         (WebCore::Frame::virtualWindow const):
1622         * page/Frame.h:
1623         (isType):
1624         * page/GlobalFrameIdentifier.h: Added.
1625         (WebCore::GlobalFrameIdentifier::encode const):
1626         (WebCore::GlobalFrameIdentifier::decode):
1627         * page/GlobalWindowIdentifier.h: Added.
1628         (WebCore::operator==):
1629         (WebCore::GlobalWindowIdentifier::hash const):
1630         (WebCore::GlobalWindowIdentifier::encode const):
1631         (WebCore::GlobalWindowIdentifier::decode):
1632         (WTF::GlobalWindowIdentifierHash::hash):
1633         (WTF::GlobalWindowIdentifierHash::equal):
1634         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
1635         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
1636         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
1637
1638         * page/RemoteDOMWindow.cpp: Added.
1639         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
1640         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
1641         (WebCore::RemoteDOMWindow::self const):
1642         (WebCore::RemoteDOMWindow::location const):
1643         (WebCore::RemoteDOMWindow::close):
1644         (WebCore::RemoteDOMWindow::closed const):
1645         (WebCore::RemoteDOMWindow::focus):
1646         (WebCore::RemoteDOMWindow::blur):
1647         (WebCore::RemoteDOMWindow::length const):
1648         (WebCore::RemoteDOMWindow::top const):
1649         (WebCore::RemoteDOMWindow::opener const):
1650         (WebCore::RemoteDOMWindow::parent const):
1651         (WebCore::RemoteDOMWindow::postMessage):
1652         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
1653         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
1654         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
1655         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
1656         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
1657
1658         * page/RemoteDOMWindow.h: Added.
1659         (isType):
1660         * page/RemoteFrame.cpp: Added.
1661         (WebCore::RemoteFrame::RemoteFrame):
1662         (WebCore::RemoteFrame::~RemoteFrame):
1663         (WebCore::RemoteFrame::virtualWindow const):
1664         * page/RemoteFrame.h: Added.
1665         (isType):
1666
1667 2018-04-12  Daniel Bates  <dabates@apple.com>
1668
1669         Content-Type not enforced for <script> allows for XSS
1670         https://bugs.webkit.org/show_bug.cgi?id=184386
1671         <rdar://problem/39112268>
1672
1673         Reviewed by Brady Eidson.
1674
1675         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
1676         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
1677         that begins with "audio/", "image/" or "video/".
1678
1679         As a side benefit of this change we now set the destination property [1] on preload requests.
1680
1681         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
1682
1683         Tests: http/tests/security/script-with-banned-mimetype.html
1684                http/tests/workers/worker-importScripts-banned-mimetype.html
1685
1686         * Sources.txt: Add file FetchIdioms.cpp.
1687         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
1688         * dom/LoadableClassicScript.cpp:
1689         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
1690         block the script if applicable.
1691         * dom/LoadableScript.h: Add error type MIMEType.
1692         * loader/FetchIdioms.cpp: Added.
1693         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
1694         due to its MIME type?" algorithm from the Fetch standard.
1695         * loader/FetchIdioms.h: Added.
1696         * loader/FetchOptions.h:
1697         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
1698         * loader/cache/CachedResourceLoader.cpp:
1699         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
1700         CachedResourceLoader::requestResource() is now responsible for doing this.
1701         (WebCore::CachedResourceLoader::requestFont): Ditto.
1702         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
1703         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
1704         (WebCore::CachedResourceLoader::requestScript): Ditto.
1705         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
1706         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
1707         that the destination property is either video or audio.
1708         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
1709         CachedResourceLoader::requestResource() is now responsible for doing this.
1710         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
1711         load many kinds of requests that have different destination properties. The caller is responsible
1712         for setting the appropriate destintion property.
1713         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
1714         as CachedResourceLoader::requestResource() is now responsible for doing this.
1715         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
1716         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
1717         already set.
1718         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
1719         and add a comment to explain what it is used for.
1720         * workers/Worker.cpp:
1721         (WebCore::Worker::create):
1722         * workers/WorkerScriptLoader.cpp:
1723         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
1724         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
1725         Note that this function is only used to support the Web API importScripts().
1726         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
1727         instance as we will need to reference it once we receive the HTTP response.
1728         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
1729         block the script if applicable.
1730         * workers/WorkerScriptLoader.h:
1731         * workers/service/ServiceWorkerJob.cpp:
1732         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker.
1733
1734 2018-04-12  Antoine Quint  <graouts@apple.com>
1735
1736         [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues
1737         https://bugs.webkit.org/show_bug.cgi?id=184555
1738
1739         Reviewed by Dean Jackson.
1740
1741         A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions
1742         tests to fail when expressed as Web Animations.
1743
1744         * animation/AnimationTimeline.cpp:
1745         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create()
1746         since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass
1747         to create them.
1748         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by
1749         a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition.
1750         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property,
1751         once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to
1752         see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also
1753         start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation
1754         for this property already running, use that animation's original unanimated style as the from value.
1755         * animation/AnimationTimeline.h:
1756         * animation/CSSAnimation.cpp:
1757         (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor.
1758         (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can
1759         get it when a CSS Transition is created and takes precedence over this CSS Animation.
1760         (WebCore::CSSAnimation::initialize): Deleted.
1761         * animation/CSSAnimation.h:
1762         * animation/CSSTransition.cpp:
1763         (WebCore::CSSTransition::create):
1764         (WebCore::CSSTransition::initialize):
1765         * animation/CSSTransition.h:
1766         * animation/DeclarativeAnimation.cpp:
1767         (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect
1768         directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created
1769         before timing properties are set based on the backing animation.
1770         * animation/DeclarativeAnimation.h:
1771         * animation/KeyframeEffectReadOnly.cpp:
1772         (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it.
1773         (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes):
1774         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes,
1775         instead of a default RenderStyle which would not use the right values for implicit keyframes.
1776         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create
1777         the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of
1778         "transition: all".
1779         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and
1780         last keyframes to always have the property listed since the underlying style was provided and should be captured.
1781         * animation/KeyframeEffectReadOnly.h:
1782         * style/StyleTreeResolver.cpp:
1783         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence.
1784
1785 2018-04-12  Antoine Quint  <graouts@apple.com>
1786
1787         [Web Animations] Only cancel declarative animations upon element removal
1788         https://bugs.webkit.org/show_bug.cgi?id=184553
1789
1790         Reviewed by Dean Jackson.
1791
1792         Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
1793         the ready promise and produce spurious logging from WPT tests.
1794
1795         * animation/AnimationTimeline.cpp:
1796         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
1797         (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
1798         * animation/AnimationTimeline.h:
1799         * dom/Element.cpp:
1800         (WebCore::Element::removedFromAncestor):
1801         * dom/PseudoElement.cpp:
1802         (WebCore::PseudoElement::clearHostElement):
1803         * rendering/updating/RenderTreeUpdater.cpp:
1804         (WebCore::RenderTreeUpdater::tearDownRenderers):
1805
1806 2018-04-12  Ryan Haddad  <ryanhaddad@apple.com>
1807
1808         Unreviewed, rolling out r230554.
1809
1810         The non-ASCII character in the filename causes issues with SVN
1811
1812         Reverted changeset:
1813
1814         "input.webkitEntries does not work as expected when folder
1815         contains accented chars"
1816         https://bugs.webkit.org/show_bug.cgi?id=184517
1817         https://trac.webkit.org/changeset/230554
1818
1819 2018-04-12  Alicia Boya García  <aboya@igalia.com>
1820
1821         [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends
1822         https://bugs.webkit.org/show_bug.cgi?id=180253
1823
1824         Right now it's checked that start <= end but it's not checked that
1825         neither of them is undefined.
1826
1827         When this happens, the bug can be hard to track down.
1828
1829         The assertion is not enabled for Mac because there is currently a test
1830         that is hitting it.
1831
1832         Reviewed by Jer Noble.
1833
1834         * platform/graphics/PlatformTimeRanges.cpp:
1835         (WebCore::PlatformTimeRanges::add):
1836
1837 2018-04-12  Chris Dumez  <cdumez@apple.com>
1838
1839         Process::setIdentifier() / Process::identifier() do not need a lock
1840         https://bugs.webkit.org/show_bug.cgi?id=184544
1841
1842         Reviewed by Brady Eidson.
1843
1844         Process::setIdentifier() / Process::identifier() do not need a lock.
1845         Process::setIdentifier() gets called in ChildProcess::initialize(),
1846         before we start any background threads. It is then safe to query
1847         this process identifier later on from background threads without
1848         locks.
1849
1850         * platform/Process.cpp:
1851         (WebCore::Process::setIdentifier):
1852         (WebCore::Process::identifier):
1853
1854 2018-04-12  Antoine Quint  <graouts@apple.com>
1855
1856         Unreviewed, fix the Windows build.
1857
1858         * animation/DocumentTimeline.cpp:
1859         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
1860
1861 2018-04-12  Antoine Quint  <graouts@apple.com>
1862
1863         [Web Animations] Suspend animations when required
1864         https://bugs.webkit.org/show_bug.cgi?id=184541
1865
1866         Reviewed by Jon Lee.
1867
1868         Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility
1869         to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions
1870         implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for
1871         Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass.
1872
1873         * animation/DocumentTimeline.cpp:
1874         (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending
1875         invalidation tasks and updates all of the animations it manages, including those running on the compositor.
1876         (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations
1877         it manages and rewinds its invalidation timer.
1878         (WebCore::DocumentTimeline::animationsAreSuspended):
1879         (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(),
1880         this returns the number of animations managed by this timeline that are not suspended.
1881         (WebCore::DocumentTimeline::currentTime):
1882         (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline
1883         is suspended.
1884         * animation/DocumentTimeline.h:
1885         * animation/WebAnimation.cpp:
1886         (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state.
1887         (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when
1888         the suspension state of an animation changes.
1889         * animation/WebAnimation.h:
1890         (WebCore::WebAnimation::isSuspended const):
1891         * dom/Document.cpp:
1892         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1893         (WebCore::Document::resume):
1894         * dom/Document.h:
1895         * history/CachedFrame.cpp:
1896         (WebCore::CachedFrameBase::restore):
1897         * page/Frame.cpp:
1898         (WebCore::Frame::clearTimers):
1899         * page/Page.cpp:
1900         (WebCore::Page::setIsVisibleInternal):
1901         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
1902         * testing/Internals.cpp:
1903         (WebCore::Internals::numberOfActiveAnimations const):
1904         (WebCore::Internals::animationsAreSuspended const):
1905         (WebCore::Internals::suspendAnimations const):
1906         (WebCore::Internals::resumeAnimations const):
1907
1908 2018-04-12  Antoine Quint  <graouts@apple.com>
1909
1910         [Web Animations] Throttle animations when lowPowerMode is on
1911         https://bugs.webkit.org/show_bug.cgi?id=184540
1912
1913         Reviewed by Jon Lee.
1914
1915         Ensure animations are sampled at a lower frequency when lowPowerMode is on.
1916
1917         * animation/DocumentTimeline.cpp:
1918         (WebCore::DocumentTimeline::updateThrottlingState):
1919         (WebCore::DocumentTimeline::animationInterval const):
1920         (WebCore::DocumentTimeline::updateAnimationSchedule):
1921         (WebCore::DocumentTimeline::scheduleAnimationResolution):
1922         * animation/DocumentTimeline.h:
1923         * page/Page.cpp:
1924         (WebCore::Page::handleLowModePowerChange):
1925         * testing/Internals.cpp:
1926         (WebCore::Internals::animationsInterval const):
1927
1928 2018-04-12  Antoine Quint  <graouts@apple.com>
1929
1930         [Web Animations] Ensure elements overlapping with elements animating also get composited
1931         https://bugs.webkit.org/show_bug.cgi?id=184539
1932
1933         Reviewed by Jon Lee.
1934
1935         A number of compositing tests failed because we didn't call into the Web Animations engine while various calls
1936         on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to
1937         DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly.
1938
1939         * animation/AnimationTimeline.cpp:
1940         (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it
1941         should be callable by other const method.
1942         (WebCore::AnimationTimeline::animationsForElement): Deleted.
1943         * animation/AnimationTimeline.h:
1944         * animation/DocumentTimeline.cpp:
1945         (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController.
1946         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController.
1947         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController.
1948         * animation/DocumentTimeline.h:
1949         * animation/KeyframeEffectReadOnly.cpp:
1950         (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation.
1951         (WebCore::containsRotation): Bring this method over from KeyframeAnimation.
1952         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation.
1953         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation.
1954         * animation/KeyframeEffectReadOnly.h:
1955         (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list
1956         of all animated properties to see if a transform is animated, so we now expose such a list.
1957         * rendering/RenderLayer.cpp:
1958         (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations
1959         and CSS Transitions as Web Animations flag is on.
1960         (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations
1961         and CSS Transitions as Web Animations flag is on.
1962         * rendering/RenderLayerBacking.cpp:
1963         (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations
1964         and CSS Transitions as Web Animations flag is on.
1965         * rendering/RenderLayerCompositor.cpp:
1966         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline
1967         if the CSS Animations and CSS Transitions as Web Animations flag is on.
1968         * rendering/RenderObject.h:
1969         (WebCore::RenderObject::documentTimeline const):
1970
1971 2018-04-11  Antoine Quint  <graouts@apple.com>
1972
1973         [Web Animations] Enable seeking for hardware animations
1974         https://bugs.webkit.org/show_bug.cgi?id=184518
1975
1976         Reviewed by Dean Jackson.
1977
1978         Hardware animations had lagged behind software animations in support and this patch bring their respective level
1979         of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA
1980         since many tests pause and seek animations to test their state. Animations may also have their playback state changed
1981         along with their current time in the same run loop, so we now maintain a list of pending processing actions for
1982         hardware animations.
1983
1984         * animation/DocumentTimeline.cpp:
1985         (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated
1986         state we can schedule animation resolution immediately since we've already established we'll have work to do.
1987         (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated
1988         method.
1989         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update
1990         their state.
1991         * animation/KeyframeEffectReadOnly.cpp:
1992         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes.
1993         (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active).
1994         start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that
1995         hit testing will work as expected.
1996         (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated):
1997         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called
1998         with the appropriate flag.
1999         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set.
2000         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated
2001         actions and notify the animation that the accelerated state needs changing.
2002         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply
2003         all pending accelerated actions.
2004         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation,
2005         we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties
2006         for the animation.
2007         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted.
2008         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted.
2009         * animation/WebAnimation.cpp:
2010         (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked.
2011         (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed.
2012         (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused.
2013         (WebCore::WebAnimation::acceleratedStateDidChange): 
2014         (WebCore::WebAnimation::applyPendingAcceleratedActions):
2015         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted.
2016         (WebCore::WebAnimation::startOrStopAccelerated): Deleted.
2017         * platform/graphics/GraphicsLayer.h:
2018         (WebCore::GraphicsLayer::seekAnimation):
2019         * platform/graphics/ca/GraphicsLayerCA.cpp:
2020         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a
2021         given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been
2022         removed by the time we try to apply this processing action.
2023         (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action.
2024         (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action.
2025         (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action.
2026         (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update
2027         all animations based on the actions added through addProcessingActionForAnimation().
2028         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided.
2029         * platform/graphics/ca/GraphicsLayerCA.h:
2030         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
2031         * rendering/RenderBoxModelObject.cpp:
2032         (WebCore::RenderBoxModelObject::animationSeeked):
2033         * rendering/RenderLayerBacking.cpp:
2034         (WebCore::RenderLayerBacking::animationSeeked):
2035         * rendering/RenderLayerCompositor.cpp:
2036         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController
2037         logic even when the legacy animation engine was disabled.
2038
2039 2018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2040
2041         Unreviewed, fix GStreamer builds
2042
2043         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2044         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were
2045         passing a String to a GST_WARNING call.
2046
2047 2018-04-11  Chris Dumez  <cdumez@apple.com>
2048
2049         input.webkitEntries does not work as expected when folder contains accented chars
2050         https://bugs.webkit.org/show_bug.cgi?id=184517
2051         <rdar://problem/39265537>
2052
2053         Reviewed by Ryosuke Niwa.
2054
2055         Use String::fromUTF8() to construct a WTF String from the char* returned by
2056         dirname() in FileSystem::directoryName(). Previously, we were just calling
2057         the String constructor, which would treat the input as latin 1 instead of
2058         UTF-8.
2059
2060         Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html
2061
2062         * platform/posix/FileSystemPOSIX.cpp:
2063         (WebCore::FileSystem::directoryName):
2064
2065 2018-04-11  Youenn Fablet  <youenn@apple.com>
2066
2067         Preventively expect UTF8 strings from libwebrtc SDP and error messages
2068         https://bugs.webkit.org/show_bug.cgi?id=184509
2069
2070         Reviewed by Eric Carlson.
2071
2072         Make WebCore code expect any libwebrtc string to contain UTF-8.
2073         Currently SDPs do not contain any UTF-8 specific character
2074         but https://tools.ietf.org/html/rfc4566 allows it.
2075
2076         Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
2077         Test: webrtc/utf8-sdp.html
2078
2079         * Modules/mediastream/MediaStreamTrack.h:
2080         (WebCore::MediaStreamTrack::setIdForTesting):
2081         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2082         (WebCore::fromStdString):
2083         (WebCore::fromSessionDescription):
2084         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2085         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2086         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
2087         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
2088         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
2089         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2090         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
2091         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
2092         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
2093         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
2094         (WebCore::trackId): Deleted.
2095         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2096         (WebCore::fromStdString):
2097         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2098         (WebCore::createReceiverForSource):
2099         * platform/mediastream/MediaStreamTrackPrivate.h:
2100         (WebCore::MediaStreamTrackPrivate::setIdForTesting):
2101         * testing/Internals.cpp:
2102         (WebCore::Internals::setMediaStreamTrackIdentifier):
2103         * testing/Internals.h:
2104         * testing/Internals.idl:
2105
2106 2018-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2107
2108         Cache glyphs (using display lists) when painting at high frequency
2109         https://bugs.webkit.org/show_bug.cgi?id=178750
2110         <rdar://problem/35201729>
2111
2112         Reviewed by Antti Koivisto.
2113
2114         This patch adds support for caching of glyph drawing commands when painting
2115         at high frequency. Caching the glyph drawing will be done using DisplayLists.
2116
2117         GlyphDisplayListCache is basically a hash map which maps InlineTextBox
2118         or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it
2119         we have to check whether the conditions for caching the glyph DisplayList
2120         are met or not. If no entry is found for a given run, a new DisplayList
2121         is created and a new entry is add to the cache.
2122
2123         * WebCore.xcodeproj/project.pbxproj:
2124         * page/MemoryRelease.cpp:
2125         (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond
2126         to memory pressure.
2127
2128         * platform/graphics/FontCascade.cpp:
2129         (WebCore::FontCascade::displayListForTextRun const):
2130         * platform/graphics/FontCascade.h:
2131         (WebCore::FontCascade::displayListForTextRun):
2132         Record the drawing of a glyph run into a DisplayList.
2133
2134         * rendering/GlyphDisplayListCache.h: Added.
2135         (WebCore::GlyphDisplayListCache::singleton):
2136         (WebCore::GlyphDisplayListCache::get):
2137         (WebCore::GlyphDisplayListCache::remove):
2138         (WebCore::GlyphDisplayListCache::clear):
2139         (WebCore::GlyphDisplayListCache::size const):
2140         (WebCore::GlyphDisplayListCache::sizeInBytes const):
2141         A simple cache for the TextRun DisplayList. Adding a new entry in the
2142         cache happens under restricted conditions. So this cache is not expected
2143         to grow much.
2144
2145         * rendering/InlineTextBox.cpp:
2146         (WebCore::InlineTextBox::~InlineTextBox):
2147         (WebCore::InlineTextBox::paint):
2148         (WebCore::InlineTextBox::paintMarkedTexts):
2149         (WebCore::InlineTextBox::paintMarkedTextBackground):
2150         (WebCore::InlineTextBox::paintMarkedTextForeground):
2151         (WebCore::InlineTextBox::paintMarkedTextDecoration):
2152         (WebCore::InlineTextBox::paintCompositionBackground):
2153         (WebCore::InlineTextBox::paintCompositionUnderlines const):
2154         (WebCore::InlineTextBox::paintCompositionUnderline const):
2155         * rendering/InlineTextBox.h:
2156         (WebCore::InlineTextBox::paintMarkedTexts):
2157         InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know
2158         whether the entry in the GlyphDisplayListCache should be removed or not.
2159         Change all the GraphicsContext arguments to be PaintInfo.
2160
2161         * rendering/SimpleLineLayout.cpp:
2162         (WebCore::SimpleLineLayout::Layout::~Layout):
2163         * rendering/SimpleLineLayout.h:
2164         * rendering/SimpleLineLayoutFunctions.cpp:
2165         (WebCore::SimpleLineLayout::paintFlow):
2166         (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted):
2167         * rendering/SimpleLineLayoutFunctions.h:
2168         * rendering/SimpleLineLayoutResolver.h:
2169         (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const):
2170         Implement the glyph caching for SimpleLineLayout::Run.
2171
2172         * rendering/TextPainter.cpp:
2173         (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is
2174         available, replay it back into the GraphicsContext. Make sure to reset to
2175         the DisplayList pointer to nullptr after painting.
2176
2177         (WebCore::TextPainter::clearGlyphDisplayLists):
2178         (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should
2179         use DisplayList to the draw glyph run.
2180
2181         * rendering/TextPainter.h:
2182         (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should
2183         should use DisplayList to the draw glyph run and if we should, ensure first
2184         the DisplayList is cached and set it in the TextPainter so it uses it when
2185         the run is painted.
2186
2187         (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList
2188         entry for a glyph layout run.
2189
2190 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
2191
2192         GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store
2193         https://bugs.webkit.org/show_bug.cgi?id=184367
2194         <rdar://problem/39249074>
2195
2196         Reviewed by Simon Fraser.
2197
2198         'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor'
2199         with false. Instead, we should just pass the widget (nil or not) to the screen properties methods,
2200         which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return
2201         here if the passed widget is nil.
2202
2203         * platform/mac/PlatformScreenMac.mm:
2204         (WebCore::screenSupportsExtendedColor):
2205
2206 2018-04-11  Youenn Fablet  <youenn@apple.com>
2207
2208         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
2209         https://bugs.webkit.org/show_bug.cgi?id=184374
2210
2211         Reviewed by Chris Dumez.
2212
2213         Add support for SecurityOrigin encode/decode routines.
2214
2215         * page/SecurityOrigin.h:
2216
2217 2018-04-11  Thibault Saunier  <tsaunier@igalia.com>
2218
2219         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
2220         https://bugs.webkit.org/show_bug.cgi?id=184498
2221
2222         Reviewed by Philippe Normand.
2223
2224         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
2225
2226         This is the same behaviour as with playbin itself.
2227
2228         Make sure to keep using "playbin" for MediaSource.
2229
2230         No test added as this is basically a small rework of the way we expose a feature.
2231
2232         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2233         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2234         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2235         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2236         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2237         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2238         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2239         (WebCore::MediaPlayerPrivateGStreamer::load):
2240         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
2241         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2242         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2243         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2244         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2245         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2246         (WebCore::TrackPrivateBaseGStreamer::disconnect):
2247         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
2248         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2249         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2250         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2251
2252 2018-04-10  Alex Christensen  <achristensen@webkit.org>
2253
2254         IDN spoofing with Hebrew combining characters
2255         https://bugs.webkit.org/show_bug.cgi?id=184472
2256         <rdar://problem/39148687>
2257
2258         Reviewed by Brent Fulgham.
2259
2260         Covered by new API tests.
2261
2262         * platform/mac/WebCoreNSURLExtras.mm:
2263         (WebCore::isLookalikeCharacter):
2264         Punycode-encode hosts with Hebrew combining marks that look like dots
2265         and Vav with a combining dot above like we do with dotless i and j.
2266
2267 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
2268
2269         Show punycode if URL contains Latin dum character
2270         https://bugs.webkit.org/show_bug.cgi?id=184477
2271         <rdar://problem/39121999>
2272
2273         Reviewed by David Kilzer.
2274
2275         Revise our "lookalike character" logic to include the small
2276         Latin dum character.
2277
2278         Test: fast/url/host.html
2279
2280         * platform/mac/WebCoreNSURLExtras.mm:
2281         (WebCore::isLookalikeCharacter):
2282
2283 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2284
2285         [GTK] WaylandCompositorDisplay leaks its wl_display
2286         https://bugs.webkit.org/show_bug.cgi?id=184406
2287
2288         Reviewed by Carlos Garcia Campos.
2289
2290         Well, this was harder than expected. We really just want to fix a small leak in the WebKit
2291         layer, but that requires a change in how WaylandCompositorDisplay calls the
2292         PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means
2293         WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default
2294         constructor. Problem is that the normal PlatformDisplayWayland constructor calls
2295         PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal,
2296         which is a virtual function. The WaylandCompositorDisplay portion of the object is not
2297         constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be
2298         called if we do that. I had to revert the previous version of this fix due to this problem.
2299         It had broken accelerated compositing.
2300
2301         I'm reminded of Effective C++ item #9: Never call virtual functions during construction or
2302         destruction ("because such calls will never go to a more derived class than that of the
2303         currently executing constructor or destructor"). This code is fragile and likely to break
2304         again in the future, so let's refactor it a bit. Instead of calling initialize in the
2305         constructor, we'll call it from create functions. We'll have to add a couple create
2306         functions, and make the constructor protected to ensure it's not possible to create a
2307         PlatformDisplayWayland without initializing it. For good parallelism, do the same for the
2308         other PlatformDisplay classes.
2309
2310         This commit additionally removes PlatformDisplayWayland's protected default constructor,
2311         since it's not needed anymore.
2312
2313         The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory,
2314         instead of using NativeDisplayOwned::No as the default value, since that was dangerously
2315         close to being the cause of this leak, and the constructors are now accessed from private
2316         create functions anyway. Some more caution when using default parameter values is warranted
2317         in the future.
2318
2319         Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create
2320         functions, take the opportunity to move things around a bit for clarity. There should be no
2321         change in behavior. I was just disappointed that the PlatformDisplayWPE creation was at the
2322         bottom of the function, after a comment indicating that normal display creation has failed,
2323         which is not the case for WPE.
2324
2325         This all might have been a bit overkill, since the leak could probably have been fixed by
2326         passing nullptr to the PlatformDisplayWayland constructor for the wl_display and not
2327         removing WaylandCompositorDisplay's call to PlatformDisplayWayland::initialize. But the
2328         correctness of that code would then rely on implementation details of initialize, so this
2329         refactor seems better.
2330
2331         No new tests since there *should* be no behavior change. Then again, I'm touching
2332         PlatformDisplay, and history shows we don't have the greatest track record of touching this
2333         code without introducing problems.
2334
2335         * platform/graphics/PlatformDisplay.cpp:
2336         (WebCore::PlatformDisplay::createPlatformDisplay):
2337         * platform/graphics/PlatformDisplay.h:
2338         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2339         (WebCore::PlatformDisplayWayland::create):
2340         (WebCore::PlatformDisplayWayland::create):
2341         (WebCore::PlatformDisplayWayland::createHeadless):
2342         (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
2343         (WebCore::PlatformDisplayWayland::initialize):
2344         * platform/graphics/wayland/PlatformDisplayWayland.h:
2345         * platform/graphics/win/PlatformDisplayWin.h:
2346         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2347         (WebCore::create):
2348         * platform/graphics/wpe/PlatformDisplayWPE.h:
2349         * platform/graphics/x11/PlatformDisplayX11.cpp:
2350         (WebCore::PlatformDisplayX11::create):
2351         (WebCore::PlatformDisplayX11::create):
2352         (WebCore::PlatformDisplayX11::createHeadless):
2353         * platform/graphics/x11/PlatformDisplayX11.h:
2354
2355 2018-04-11  Jianjun Zhu  <jianjun.zhu@intel.com>
2356
2357         Fix a WebRTC data channel issue for non-ASCII characters.
2358
2359         At the sender side, buffer size are calulcated after UTF8 encoding. At the
2360         receiver side, strings are constructed with UTF8 data.
2361
2362         https://bugs.webkit.org/show_bug.cgi?id=184481
2363
2364         Reviewed by Youenn Fablet.
2365
2366         Updated test:
2367         LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt
2368
2369         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2370         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
2371         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
2372
2373 2018-04-11  Antti Koivisto  <antti@apple.com>
2374
2375         ImageFrame type used by non-Cocoa image decoder should not be the same as that used by ImageSource
2376         https://bugs.webkit.org/show_bug.cgi?id=184418
2377
2378         Reviewed by Said Abou-Hallawa.
2379
2380         ScalableImageDecoder uses ImageFrame class which is meant to be an implementation detail of ImageSource.
2381         There are bunch of fields and methods in the type that are only used by one or the other client. For hackability
2382         there should be an unrelated frame type for ScalableImageDecoder.
2383
2384         This patch adds ScalableImageDecoderFrame type used in ScalableImageDecoder only. It then cleans up
2385         unneeded things from both ImageFrame and ScalableImageDecoderFrame.
2386
2387         * platform/ImageDecoders.cmake:
2388         * platform/graphics/ImageFrame.cpp:
2389         (WebCore::ImageFrame::operator=):
2390         (WebCore::ImageFrame::clearImage):
2391         (WebCore::ImageFrame::size const):
2392         (WebCore::ImageFrame::initialize): Deleted.
2393         * platform/graphics/ImageFrame.h:
2394         (WebCore::ImageFrame::setDisposalMethod): Deleted.
2395         (WebCore::ImageFrame::disposalMethod const): Deleted.
2396         (WebCore::ImageFrame::backingStore const): Deleted.
2397         (WebCore::ImageFrame::hasBackingStore const): Deleted.
2398         * platform/image-decoders/ScalableImageDecoder.cpp:
2399         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
2400         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
2401         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
2402         * platform/image-decoders/ScalableImageDecoder.h:
2403         * platform/image-decoders/ScalableImageDecoderFrame.cpp: Copied from Source/WebCore/platform/graphics/ImageFrame.cpp.
2404         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
2405         (WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame):
2406         (WebCore::ScalableImageDecoderFrame::operator=):
2407         (WebCore::ScalableImageDecoderFrame::setDecodingStatus):
2408         (WebCore::ScalableImageDecoderFrame::decodingStatus const):
2409         (WebCore::ScalableImageDecoderFrame::clearImage):
2410         (WebCore::ScalableImageDecoderFrame::clear):
2411         (WebCore::ScalableImageDecoderFrame::initialize):
2412         (WebCore::ScalableImageDecoderFrame::size const):
2413         (WebCore::ImageFrame::ImageFrame): Deleted.
2414         (WebCore::ImageFrame::~ImageFrame): Deleted.
2415         (WebCore::ImageFrame::defaultFrame): Deleted.
2416         (WebCore::ImageFrame::operator=): Deleted.
2417         (WebCore::ImageFrame::setDecodingStatus): Deleted.
2418         (WebCore::ImageFrame::decodingStatus const): Deleted.
2419         (WebCore::ImageFrame::clearImage): Deleted.
2420         (WebCore::ImageFrame::clear): Deleted.
2421         (WebCore::ImageFrame::initialize): Deleted.
2422         (WebCore::ImageFrame::size const): Deleted.
2423         (WebCore::ImageFrame::hasNativeImage const): Deleted.
2424         (WebCore::ImageFrame::hasFullSizeNativeImage const): Deleted.
2425         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions const): Deleted.
2426         (WebCore::ImageFrame::singlePixelSolidColor const): Deleted.
2427         * platform/image-decoders/ScalableImageDecoderFrame.h: Copied from Source/WebCore/platform/graphics/ImageFrame.h.
2428         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
2429         (WebCore::ScalableImageDecoderFrame::disposalMethod const):
2430         (WebCore::ScalableImageDecoderFrame::hasAlpha const):
2431         (WebCore::ScalableImageDecoderFrame::hasBackingStore const):
2432         (WebCore::ImageFrame::ImageFrame): Deleted.
2433         (WebCore::ImageFrame::isInvalid const): Deleted.
2434         (WebCore::ImageFrame::isPartial const): Deleted.
2435         (WebCore::ImageFrame::isComplete const): Deleted.
2436         (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted.
2437         (WebCore::ImageFrame::frameBytes const): Deleted.
2438         (WebCore::ImageFrame::subsamplingLevel const): Deleted.
2439         (WebCore::ImageFrame::setDisposalMethod): Deleted.
2440         (WebCore::ImageFrame::disposalMethod const): Deleted.
2441         (WebCore::ImageFrame::nativeImage const): Deleted.
2442         (WebCore::ImageFrame::setOrientation): Deleted.
2443         (WebCore::ImageFrame::orientation const): Deleted.
2444         (WebCore::ImageFrame::setDuration): Deleted.
2445         (WebCore::ImageFrame::duration const): Deleted.
2446         (WebCore::ImageFrame::setHasAlpha): Deleted.
2447         (WebCore::ImageFrame::hasAlpha const): Deleted.
2448         (WebCore::ImageFrame::hasNativeImage): Deleted.
2449         (WebCore::ImageFrame::hasFullSizeNativeImage): Deleted.
2450         (WebCore::ImageFrame::hasMetadata const): Deleted.
2451         (WebCore::ImageFrame::backingStore const): Deleted.
2452         (WebCore::ImageFrame::hasBackingStore const): Deleted.
2453         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
2454         (WebCore::BMPImageDecoder::frameBufferAtIndex):
2455         * platform/image-decoders/bmp/BMPImageDecoder.h:
2456         * platform/image-decoders/bmp/BMPImageReader.h:
2457         (WebCore::BMPImageReader::setBuffer):
2458         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2459         (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode):
2460         (WebCore::GIFImageDecoder::frameBufferAtIndex):
2461         (WebCore::GIFImageDecoder::clearFrameBufferCache):
2462         (WebCore::GIFImageDecoder::haveDecodedRow):
2463         (WebCore::GIFImageDecoder::frameComplete):
2464         (WebCore::GIFImageDecoder::initFrameBuffer):
2465         * platform/image-decoders/gif/GIFImageDecoder.h:
2466         * platform/image-decoders/gif/GIFImageReader.cpp:
2467         (GIFImageReader::parse):
2468         * platform/image-decoders/gif/GIFImageReader.h:
2469         (GIFFrameContext::GIFFrameContext):
2470         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2471         (WebCore::ICOImageDecoder::frameBufferAtIndex):
2472         * platform/image-decoders/ico/ICOImageDecoder.h:
2473         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2474         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
2475         (WebCore::setPixel):
2476         (WebCore::JPEGImageDecoder::outputScanlines):
2477         (WebCore::JPEGImageDecoder::jpegComplete):
2478         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2479         * platform/image-decoders/png/PNGImageDecoder.cpp:
2480         (WebCore::PNGImageDecoder::frameBufferAtIndex):
2481         (WebCore::PNGImageDecoder::rowAvailable):
2482         (WebCore::PNGImageDecoder::readChunks):
2483         (WebCore::PNGImageDecoder::clearFrameBufferCache):
2484         (WebCore::PNGImageDecoder::initFrameBuffer):
2485         (WebCore::PNGImageDecoder::frameComplete):
2486         * platform/image-decoders/png/PNGImageDecoder.h:
2487         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2488         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
2489         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
2490         (WebCore::WEBPImageDecoder::decodeFrame):
2491         (WebCore::WEBPImageDecoder::initFrameBuffer):
2492         (WebCore::WEBPImageDecoder::applyPostProcessing):
2493         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
2494         * platform/image-decoders/webp/WEBPImageDecoder.h:
2495
2496 2018-04-11  Antoine Quint  <graouts@apple.com>
2497
2498         [Web Animations] Turn Web Animations on by default
2499         https://bugs.webkit.org/show_bug.cgi?id=184491
2500
2501         Reviewed by Simon Fraser.
2502
2503         * page/RuntimeEnabledFeatures.h:
2504
2505 2018-04-11  Ryosuke Niwa  <rniwa@webkit.org>
2506
2507         Fix warning in HashTools.h for newer versions of clang
2508         https://bugs.webkit.org/show_bug.cgi?id=184489
2509
2510         Reviewed by Alexey Proskuryakov.
2511
2512         Removed "register" storage class specififer as it has been deprecated in C++11.
2513
2514         * platform/HashTools.h:
2515
2516 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2517
2518         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
2519         https://bugs.webkit.org/show_bug.cgi?id=183395
2520         <rdar://problem/38055732>
2521
2522         Reviewed by Zalan Bujtas.
2523
2524         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
2525         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
2526         mitigation by wrapping the Frame in a Ref when firing the appearance update timer.
2527
2528         Test: editing/selection/iframe-update-selection-appearance.html
2529
2530         * editing/FrameSelection.cpp:
2531         (WebCore::FrameSelection::appearanceUpdateTimerFired):
2532
2533 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2534
2535         Unreviewed follow-up to r230468.
2536
2537         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
2538
2539         * page/mac/EventHandlerMac.mm:
2540         (WebCore::lastEventIsMouseUp):
2541         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2542         * platform/mac/EventLoopMac.mm:
2543         (WebCore::EventLoop::cycle):
2544
2545 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2546
2547         Unreviewed, fix the iOS build
2548
2549         I accidentally exported an inline function in r230506.
2550
2551         * page/ViewportConfiguration.h:
2552         (WebCore::ViewportConfiguration::viewSize const):
2553
2554 2018-04-10  Nan Wang  <n_wang@apple.com>
2555
2556         AX: Expose strong password fields on iOS
2557         https://bugs.webkit.org/show_bug.cgi?id=184465
2558         <rdar://problem/39325104>
2559
2560         Reviewed by Chris Fleizach.
2561
2562         Exposed the strong password field on iOS. And made sure
2563         we are returning its actual value in accessibilityValue.
2564
2565         Test: accessibility/ios-simulator/strong-password-field.html
2566
2567         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2568         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
2569         (-[WebAccessibilityObjectWrapper accessibilityValue]):
2570
2571 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2572
2573         [Win] Add UserAgentWin.cpp
2574         https://bugs.webkit.org/show_bug.cgi?id=184438
2575
2576         Reviewed by Michael Catanzaro.
2577
2578         No new tests (No behavior change).
2579
2580         * PlatformWin.cmake:
2581         * platform/win/UserAgentWin.cpp: Added.
2582         (WebCore::standardUserAgent):
2583         (WebCore::standardUserAgentForURL):
2584
2585 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2586
2587         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
2588         https://bugs.webkit.org/show_bug.cgi?id=184435
2589         <rdar://problem/38726260>
2590
2591         Reviewed by Dean Jackson.
2592
2593         Expose the size of the platform view. By default, in extra zoom mode, this *not* the same as the minimum layout
2594         size, since we lay out at a large width and then shrink down to real device dimensions when computing the
2595         initial scale (see r229063).
2596
2597         ViewGestureGeometryCollector uses this in the process of computing a target zoom scale when double tapping.
2598
2599         * page/ViewportConfiguration.h:
2600         (WebCore::ViewportConfiguration::viewSize const):
2601
2602 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2603
2604         [Win][WebKit] LibWebRTCProvider::webRTCAvailable is an undefined symbol
2605         https://bugs.webkit.org/show_bug.cgi?id=184437
2606
2607         Reviewed by Michael Catanzaro.
2608
2609         No new tests (No behavior change).
2610
2611         * PlatformWin.cmake: Added LibWebRTCProviderWin.cpp.
2612         * platform/mediastream/libwebrtc/LibWebRTCProviderWin.cpp: Added.
2613         (WebCore::LibWebRTCProvider::webRTCAvailable):
2614
2615 2018-04-10  Chris Dumez  <cdumez@apple.com>
2616
2617         Unreviewed build fix.
2618
2619         Those enum value names were too generic and would cause conflicts.
2620
2621         * Modules/webvr/VRDisplayCapabilities.h:
2622         (WebCore::VRDisplayCapabilities::hasPosition const):
2623         (WebCore::VRDisplayCapabilities::hasOrientation const):
2624         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2625         (WebCore::VRDisplayCapabilities::canPresent const):
2626         * platform/vr/VRPlatformDisplay.h:
2627         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
2628         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2629
2630 2018-04-10  Chris Dumez  <cdumez@apple.com>
2631
2632         Avoid constructing a service worker RegistrationStore for private sessions
2633         https://bugs.webkit.org/show_bug.cgi?id=184463
2634         <rdar://problem/36613948>
2635
2636         Reviewed by Youenn Fablet.
2637
2638         Avoid constructing a service worker RegistrationStore for private sessions since there
2639         is no need for persistence and the registrationDatabaseDirectory is the empty string in
2640         such cases.
2641
2642         * workers/service/server/SWServer.cpp:
2643         (WebCore::SWServer::removeRegistration):
2644         (WebCore::SWServer::clearAll):
2645         (WebCore::SWServer::clear):
2646         (WebCore::SWServer::SWServer):
2647         (WebCore::SWServer::didFinishActivation):
2648         * workers/service/server/SWServer.h:
2649
2650 2018-04-10  Chris Dumez  <cdumez@apple.com>
2651
2652         Unreviewed build fix.
2653
2654         * page/LayoutContext.cpp:
2655         (WebCore::LayoutContext::~LayoutContext):
2656         * page/LayoutContext.h:
2657
2658 2018-04-10  Jeremy Jones  <jeremyj@apple.com>
2659
2660         MediaSessionManageriOS should defer creation of MPVolumeView until it needs to monitor AirPlay routes
2661         https://bugs.webkit.org/show_bug.cgi?id=184373
2662         <rdar://problem/35177606>
2663
2664         Reviewed by Eric Carlson.
2665
2666         No change of behavior.
2667
2668         This delays the creation of MPVolumeView until airplay routes are monitored.
2669         MPVolumeView is now also released when monitoring ends. 
2670         This makes sure the MP* objects are only accessed from a UI safe thread. WebCore's "MainThread" may be different that the UI thread.
2671         Since this state change is necessarily asynchronous, starting and stopping must prevent races to keep state coherent.
2672
2673         * platform/audio/ios/MediaSessionManagerIOS.mm:
2674         (-[WebMediaSessionHelper initWithCallback:]):
2675         (-[WebMediaSessionHelper dealloc]):
2676         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
2677         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
2678         (-[WebMediaSessionHelper allocateVolumeView]): Deleted.
2679         (-[WebMediaSessionHelper setVolumeView:]): Deleted.
2680
2681 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
2682
2683         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
2684         https://bugs.webkit.org/show_bug.cgi?id=184268
2685         <rdar://problem/39144446>
2686
2687         Reviewed by Chris Dumez.
2688
2689         The assertion is no longer true after the change, because multiple resources could have same
2690         url. Used if condition here to make sure we only delete specified resource.
2691
2692         No new tests. Updated an existing test to test the stop loading case by not using injected 
2693         bundle policy: http/tests/multipart/multipart-html.php.
2694
2695         * loader/cache/CachedResourceLoader.cpp:
2696         (WebCore::CachedResourceLoader::removeCachedResource):
2697
2698 2018-04-10  Zalan Bujtas  <zalan@apple.com>
2699
2700         Do not layout images when we only need the overflow information.
2701         https://bugs.webkit.org/show_bug.cgi?id=175331
2702
2703         Reviewed by Simon Fraser.
2704
2705         This improves MotionMark's Simple Leaves by ~10%. 
2706
2707         Covered by existing tests.
2708
2709         * rendering/RenderImage.cpp:
2710         (WebCore::RenderImage::layout):
2711
2712 2018-04-10  Zan Dobersek  <zdobersek@igalia.com>
2713
2714         [TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform
2715         https://bugs.webkit.org/show_bug.cgi?id=183868
2716
2717         Reviewed by Carlos Garcia Campos.
2718
2719         Drop the GraphicsLayerTransform member variable from TextureMapperLayer
2720         and instead compute all the required transform information in the
2721         computeTransformsRecursive() method. These computations are not too
2722         expensive, and in turn we can drop an object from this class' state that
2723         was only duplicating a bunch of state variables.
2724
2725         No new tests -- no change in functionality.
2726
2727         * platform/graphics/texmap/TextureMapperLayer.cpp:
2728         (WebCore::TextureMapperLayer::computeTransformsRecursive):
2729         (WebCore::TextureMapperLayer::paintSelf):
2730         (WebCore::TextureMapperLayer::paintSelfAndChildren):
2731         (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica):
2732         (WebCore::TextureMapperLayer::replicaTransform):
2733         (WebCore::TextureMapperLayer::computeOverlapRegions):
2734         (WebCore::TextureMapperLayer::setPosition):
2735         (WebCore::TextureMapperLayer::setSize):
2736         (WebCore::TextureMapperLayer::setAnchorPoint):
2737         (WebCore::TextureMapperLayer::setPreserves3D):
2738         (WebCore::TextureMapperLayer::setTransform):
2739         (WebCore::TextureMapperLayer::setChildrenTransform):
2740         (WebCore::TextureMapperLayer::syncAnimations):
2741         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded):
2742         * platform/graphics/texmap/TextureMapperLayer.h:
2743
2744 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2745
2746         Add ProcessPrivilege assertions to places that access NSApp
2747         https://bugs.webkit.org/show_bug.cgi?id=184322
2748         <rdar://problem/39194560>
2749
2750         Reviewed by Per Arne Vollan.
2751
2752         Add ProcessPrivilege assertions to places where we interact with NSApp so
2753         that we can prevent accidentally using them in the WebContent process.
2754
2755         * page/mac/EventHandlerMac.mm:
2756         (WebCore::lastEventIsMouseUp):
2757         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2758         * platform/mac/EventLoopMac.mm:
2759         (WebCore::EventLoop::cycle):
2760         * platform/mac/PasteboardMac.mm:
2761         (WebCore::Pasteboard::setDragImage):
2762
2763 2018-04-09  John Wilander  <wilander@apple.com>
2764
2765         Refactor Ignore HSTS code
2766         https://bugs.webkit.org/show_bug.cgi?id=184433
2767         <rdar://problem/39298238>
2768
2769         Reviewed by Darin Adler.
2770
2771         This patch refactors our ignore HSTS code. The convenience functions are moved
2772         out of CFNetwork SPI in PAL, and into where they are used. It also switches
2773         from performSelector: calls to straight function calls, after checking that
2774         there is a responder.
2775
2776         * platform/network/mac/WebCoreURLResponse.mm:
2777         (WebCore::schemeWasUpgradedDueToDynamicHSTS):
2778             Add convenience function here since it was moved out of
2779             CFNetworkSPI.h.
2780
2781 2018-04-09  Brady Eidson  <beidson@apple.com>
2782
2783         Expand WebCore policy concept of "shouldContinue" to allow for more than true/false
2784         https://bugs.webkit.org/show_bug.cgi?id=184424
2785
2786         Reviewed by Alex Christensen.
2787
2788         No new tests (No behavior change, refactor only)
2789
2790         Specifically this expands the "shouldContinue" bool to be an enum class with:
2791         -Yes
2792         -No
2793         -ForSuspension
2794
2795         * loader/DocumentLoader.cpp:
2796         (WebCore::DocumentLoader::willSendRequest):
2797         * loader/FrameLoader.cpp:
2798         (WebCore::FrameLoader::loadURL):
2799         (WebCore::FrameLoader::load):
2800         (WebCore::FrameLoader::loadWithDocumentLoader):
2801         (WebCore::FrameLoader::loadPostRequest):
2802         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2803         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2804         * loader/FrameLoader.h:
2805         * loader/PolicyChecker.cpp:
2806         (WebCore::PolicyChecker::checkNavigationPolicy):
2807         (WebCore::PolicyChecker::checkNewWindowPolicy):
2808         * loader/PolicyChecker.h:
2809
2810 2018-04-09  Sihui Liu  <sihui_liu@apple.com>
2811
2812         REGRESSION(r229929): localStorage is broken for WebInspector
2813         https://bugs.webkit.org/show_bug.cgi?id=184382
2814         <rdar://problem/39257355>
2815
2816         Reviewed by Chris Dumez.
2817
2818         Removed an if condition that caused false positive cases of database error. As per 
2819         https://www.sqlite.org/c3ref/errcode.html, return value of sqlite3_errcode() is undefined
2820         on successful API call, so we should not use the code to check if there is an error. We
2821         should only use it when there is an error.
2822         After moving this condition, LocalStorage might return empty string instead of NULL on
2823         sqlite3_column_blob() error.
2824
2825         Modified a test to cover this case: 
2826         TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm.
2827
2828         * platform/sql/SQLiteStatement.cpp:
2829         (WebCore::SQLiteStatement::getColumnBlobAsString):
2830
2831 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2832
2833         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
2834         https://bugs.webkit.org/show_bug.cgi?id=184344
2835         <rdar://problem/39224969>
2836
2837         Reviewed by Per Arne Vollan.
2838
2839         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
2840         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
2841         we do not want to allow in the WebContent process.
2842
2843         Instead, we should just use the cached screen information the WebContent process already possesses.
2844
2845         This patch makes the following changes:
2846         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
2847            the WindowServer directly.
2848         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
2849            the user space version of the coordinates. A nil Window just means we want to get coordinates in
2850            terms of the primary display.
2851         3. Keep track of the primary display so we can refer to it later.
2852         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
2853         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
2854            than whichever screen happened to hash to the lowest value.
2855
2856         * page/mac/EventHandlerMac.mm:
2857         (WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll const): Use new methods that
2858         don't require WindowServer access.
2859         * platform/PlatformScreen.h:
2860         * platform/mac/PlatformScreenMac.mm:
2861         (WebCore::displayID): Assert if we hit this code in the WebContent process.
2862         (WebCore::firstScreen): Ditto.
2863         (WebCore::window): Ditto.
2864         (WebCore::screen): Ditto.
2865         (WebCore::primaryScreenID): Added.
2866         (WebCore::getScreenProperties): Modify to return a pair consisting of the primary display ID and
2867         the HashSet of screen settings.
2868         (WebCore::setScreenProperties): Update to also track the primary display ID.
2869         (WebCore::screenProperties): Update to use the primary display ID.
2870         (WebCore::screenHasInvertedColors): Ditto.
2871         (WebCore::toUserSpaceForPrimaryScreen): Added.
2872
2873 2018-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2874
2875         Make InlineTextBox::createTextRun() take a const lvalue reference String
2876         https://bugs.webkit.org/show_bug.cgi?id=184182
2877
2878         Reviewed by Zalan Bujtas.
2879
2880         InlineTextBox::createTextRun() takes a non-const lvalue reference String.
2881         It is tempting to change the signature of this method to take a const lvalue 
2882         reference. But this was done intentionally. TextRun is effectively a StringView:
2883         it does not own the passed string. Having the argument a non-const lvalue
2884         reference makes the compiler prevent calls like createTextRun("abc").
2885
2886         To have a better way to express the lifetime of TextRun, this patch does
2887         the following:
2888
2889         -- It makes TextRun::m_text of type String instead of StringView.
2890         -- It adds a new constructor which takes const String&. This constructor
2891            will addRef the underlying StringImpl when assigning it to m_text.
2892         -- It keeps the constructor which takes a StringView. The caller of this
2893            constructor still has to make sure the underlying String outlives the
2894            TextRun. To avoid copying the underlying buffer of the StringView, we
2895            will not use  StringView::toString(). Instead we will use
2896            StringView::toStringWithoutCopying() which makes the returned String 
2897            accesses the same buffer the StringView uses. In this case, the returned
2898            String is effectively a StringView.
2899
2900         * page/DebugPageOverlays.cpp:
2901         (WebCore::drawRightAlignedText):
2902         * platform/graphics/TextRun.cpp:
2903         * platform/graphics/TextRun.h:
2904         (WebCore::TextRun::TextRun):
2905         (WebCore::TextRun::subRun const):
2906         (WebCore::TextRun::length const):
2907         (WebCore::TextRun::setText):
2908         (WebCore::TextRun::string const): Deleted.
2909         * rendering/InlineTextBox.cpp:
2910         (WebCore::InlineTextBox::localSelectionRect const):
2911         (WebCore::InlineTextBox::paint):
2912         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
2913         (WebCore::InlineTextBox::paintMarkedTextBackground):
2914         (WebCore::InlineTextBox::paintMarkedTextForeground):
2915         (WebCore::InlineTextBox::paintMarkedTextDecoration):
2916         (WebCore::InlineTextBox::offsetForPosition const):
2917         (WebCore::InlineTextBox::positionForOffset const):
2918         (WebCore::InlineTextBox::createTextRun const):
2919         There is no need for this function to take a String argument anymore. The
2920         reason for passing the String was to guarantee its lifetime by keeping
2921         a copy of it in the caller side. Now there is no need for that. The TextRun
2922         itself will keep this copy.
2923
2924         * rendering/InlineTextBox.h:
2925         * rendering/RenderText.cpp:
2926         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const):
2927         RenderText::text() returns StringImpl. The compiler wants us to be more
2928         explicit about which constructor of TextRun to call.
2929
2930         * rendering/SimpleLineLayout.cpp:
2931         (WebCore::SimpleLineLayout::canUseForFontAndText):
2932         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2933         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2934         RenderStyle::hyphenString() returns an AtomicString.
2935
2936 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2937
2938         Unreviewed, rolling out r230390.
2939
2940         Broke accelerated compositing
2941
2942         Reverted changeset:
2943
2944         "[GTK] WaylandCompositorDisplay leaks its wl_display"
2945         https://bugs.webkit.org/show_bug.cgi?id=184406
2946         https://trac.webkit.org/changeset/230390
2947
2948 2018-04-03  Sergio Villar Senin  <svillar@igalia.com>
2949
2950         [OpenVR][WebVR] Retrieve FrameData in WebVR's rAF
2951         https://bugs.webkit.org/show_bug.cgi?id=184265
2952
2953         Reviewed by Žan Doberšek.
2954
2955         VRFrameData contains all the required information to properly render a VR scene like view
2956         and projection matrices, pose data (position & orientation) and linear & angular velocity
2957         among others. The getFrameData() call must be issued inside a WebVR's own
2958         requestAnimationFrame.
2959
2960         * Modules/webvr/VRDisplay.cpp:
2961         (WebCore::VRDisplay::getFrameData const):
2962         (WebCore::VRDisplay::getPose const):
2963         (WebCore::VRDisplay::requestAnimationFrame):
2964         (WebCore::VRDisplay::cancelAnimationFrame):
2965         * Modules/webvr/VRDisplay.h:
2966         * Modules/webvr/VREyeParameters.h:
2967         (WebCore::VREyeParameters::rawOffset const): Required to compute view matrices.
2968         * Modules/webvr/VRFrameData.cpp:
2969         (WebCore::matrixToArray):
2970         (WebCore::VRFrameData::leftProjectionMatrix const):
2971         (WebCore::VRFrameData::leftViewMatrix const):
2972         (WebCore::VRFrameData::rightProjectionMatrix const):
2973         (WebCore::VRFrameData::rightViewMatrix const):
2974         (WebCore::projectionMatrixFromFieldOfView):
2975         (WebCore::rotationMatrixFromQuaternion):
2976         (WebCore::applyHeadToEyeTransform):
2977         (WebCore::VRFrameData::update):
2978         (WebCore::VRFrameData::timestamp const): Deleted.
2979         * Modules/webvr/VRFrameData.h:
2980         (WebCore::VRFrameData::timestamp const):
2981         * Modules/webvr/VRPose.cpp:
2982         (WebCore::optionalFloat3ToJSCArray):
2983         (WebCore::VRPose::position const):
2984         (WebCore::VRPose::linearVelocity const):
2985         (WebCore::VRPose::linearAcceleration const):
2986         (WebCore::VRPose::orientation const):
2987         (WebCore::VRPose::angularVelocity const):
2988         (WebCore::VRPose::angularAcceleration const):
2989         * Modules/webvr/VRPose.h:
2990         (WebCore::VRPose::create):
2991         (WebCore::VRPose::update):
2992         (WebCore::VRPose::VRPose):
2993         * platform/vr/VRPlatformDisplay.h:
2994         (WebCore::VRPlatformTrackingInfo::Quaternion::Quaternion):
2995         (WebCore::VRPlatformTrackingInfo::Quaternion::conjugate):
2996         (WebCore::VRPlatformTrackingInfo::Quaternion::operator*):
2997         (WebCore::VRPlatformTrackingInfo::Float3::Float3): Just a group of 3 floats used to store
2998         both velocity and acceleration in a format which is very convenient to later generate JSC
2999         arrays.
3000         (WebCore::VRPlatformTrackingInfo::clear):
3001         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
3002         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
3003         (WebCore::rotationMatrixToQuaternion):
3004         (WebCore::VRPlatformDisplayOpenVR::getTrackingInfo):
3005         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
3006
3007 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3008
3009         [GTK] WaylandCompositorDisplay leaks its wl_display
3010         https://bugs.webkit.org/show_bug.cgi?id=184406
3011
3012         Reviewed by Carlos Garcia Campos.
3013
3014         Remove the protected default constructor, for good measure.
3015
3016         * platform/graphics/wayland/PlatformDisplayWayland.h:
3017
3018 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
3019
3020         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
3021         https://bugs.webkit.org/show_bug.cgi?id=184127
3022
3023         Reviewed by Konstantin Tokarev.
3024
3025         No new tests (No behaviour changes).
3026
3027         * CMakeLists.txt: Added a interface library WebCoreHeaderInterface.
3028
3029 2018-04-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3030
3031         Use alignas instead of compiler-specific attributes
3032         https://bugs.webkit.org/show_bug.cgi?id=183508
3033
3034         Reviewed by Mark Lam.
3035
3036         Use alignas instead of aligned.
3037
3038         * platform/graphics/cpu/arm/filters/FELightingNEON.cpp:
3039         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
3040         (WebCore::FELighting::platformApplyNeon):
3041
3042 2018-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3043
3044         [WPE][GTK] Remove applicationDirectoryPath() and sharedResourcePath()
3045         https://bugs.webkit.org/show_bug.cgi?id=184381
3046
3047         Reviewed by Carlos Garcia Campos.
3048
3049         These are unused.
3050
3051         * platform/FileSystem.h:
3052         * platform/glib/FileSystemGlib.cpp:
3053         (WebCore::FileSystem::applicationDirectoryPath): Deleted.
3054         (WebCore::FileSystem::sharedResourcesPath): Deleted.
3055
3056 2018-04-07  Daniel Bates  <dabates@apple.com>
3057
3058         Have WorkerScriptLoader::loadAsynchronously() take a FetchOptions
3059         https://bugs.webkit.org/show_bug.cgi?id=184385
3060
3061         Reviewed by Youenn Fablet.
3062
3063         Currently we pass various FetchOptions to WorkerScriptLoader::loadAsynchronously()
3064         so that it can build up a ThreadableLoaderOptions structure to pass to the loader.
3065         Each time we want to set another FetchOptions option we need to add a new parameter.
3066         Instead we should have WorkerScriptLoader::loadAsynchronously() take a FetchOptions.
3067         This will make it straightforward for a caller to set new loader options as needed.
3068         In particular, this will make it straightforward to support setting the request's
3069         destination flag (i.e. FetchOptions::destination) to support blocking scripts with
3070         a non-JavaScript MIME type in a subsequent commit.
3071
3072         No functionality changed. So, no new tests.
3073
3074         * loader/ResourceLoaderOptions.h:
3075         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Modified to take a FetchOptions
3076         by value so as to support both move and copy semantics.
3077         * loader/ThreadableLoader.cpp:
3078         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):  Added helper constructor
3079         that takes a FetchOptions.
3080         * loader/ThreadableLoader.h:
3081         * workers/Worker.cpp:
3082         (WebCore::Worker::create): Instantiate and pass a FetchOptions to the loader for the mode,
3083         cache policy, and redirect policy.
3084         * workers/WorkerScriptLoader.cpp:
3085         (WebCore::WorkerScriptLoader::loadAsynchronously): Modified to take a FetchOptions and
3086         instantiate a ThreadableLoaderOptions from it.
3087         * workers/WorkerScriptLoader.h:
3088         * workers/WorkerScriptLoaderClient.h:
3089         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const): Deleted. This function
3090         is no longer needed because the Service Worker client now passes the service worker mode
3091         directly to the loader.
3092         * workers/service/ServiceWorkerJob.cpp:
3093         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Instantiate and pass a FetchOptions
3094         to the loader.
3095         * workers/service/ServiceWorkerJob.h:
3096
3097 2018-04-07  Timothy Hatcher  <timothy@apple.com>
3098
3099         Use the system's link color when system appearance is desired for a WebView.
3100
3101         https://bugs.webkit.org/show_bug.cgi?id=184353
3102         rdar://problem/9420053
3103
3104         Reviewed by Wenson Hsieh.
3105
3106         Have Document consult RenderTheme via StyleColor for the various link colors.
3107         This allows the system to have different colors than the standard hardcoded ones.
3108         This adds StyleColor::Options, to avoid multiple booleans being passed around,
3109         since the "for visited link" state is now needed in RenderTheme.
3110
3111         * WebCore.xcodeproj/project.pbxproj: Made StyleColor.h private, since RenderTheme.h includes it.
3112         * css/StyleColor.cpp:
3113         (WebCore::StyleColor::colorFromKeyword): Use options instead of a bool.
3114         (WebCore::StyleColor::isSystemColor): Consider CSSValueWebkitLink the start of system colors.
3115         * css/StyleColor.h:
3116         * css/StyleResolver.cpp:
3117         (WebCore::StyleResolver::colorFromPrimitiveValue const): Use StyleColor::Options.
3118         * css/parser/CSSParser.cpp:
3119         (WebCore::CSSParser::parseSystemColor): Use StyleColor::Options.
3120         * dom/Document.cpp:
3121         (WebCore::Document::resetLinkColor): Ask StyleColor for the link color instead of hardcoding it.
3122         (WebCore::Document::resetVisitedLinkColor): Ditto.
3123         (WebCore::Document::resetActiveLinkColor): Ditto.
3124         (WebCore::Document::styleColorOptions const): Added. Helper to get the options used.
3125         * dom/Document.h:
3126         * html/canvas/CanvasRenderingContext2D.cpp:
3127         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Use StyleColor::Options.
3128         * rendering/RenderTheme.cpp:
3129         (WebCore::RenderTheme::systemColor const): Add default values here, moved from Document.
3130         (WebCore::RenderTheme::focusRingColor): Use StyleColor::Options.
3131         * rendering/RenderTheme.h:
3132         (WebCore::RenderTheme::platformFocusRingColor const): Use StyleColor::Options.
3133         * rendering/RenderThemeGtk.cpp:
3134         (WebCore::RenderThemeGtk::systemColor const): Use StyleColor::Options.
3135         * rendering/RenderThemeGtk.h:
3136         * rendering/RenderThemeIOS.h:
3137         * rendering/RenderThemeIOS.mm:
3138         (WebCore::RenderThemeIOS::systemColor const): Use StyleColor::Options.
3139         * rendering/RenderThemeMac.h:
3140         * rendering/RenderThemeMac.mm:
3141         (WebCore::RenderThemeMac::platformFocusRingColor const): Use StyleColor::Options.
3142         (WebCore::RenderThemeMac::platformColorsDidChange): Clear m_systemVisitedLinkColor.
3143         (WebCore::RenderThemeMac::systemColor const): Use StyleColor::Options.
3144         (WebCore::RenderThemeMac::adjustMenuListStyle const): Ditto.
3145         * rendering/RenderThemeWin.cpp:
3146         (WebCore::RenderThemeWin::systemColor const): Use StyleColor::Options.
3147         * rendering/RenderThemeWin.h:
3148         * rendering/TextPaintStyle.cpp:
3149         (WebCore::computeTextPaintStyle): Use StyleColor::Options.
3150
3151 2018-04-06  Youenn Fablet  <youenn@apple.com>
3152
3153         Response headers should be filtered when sent from NetworkProcess to WebProcess
3154         https://bugs.webkit.org/show_bug.cgi?id=184310
3155
3156         Reviewed by Ryosuke Niwa.
3157
3158         Did some refactoring to allow ResourceResponse to use header value parsing routines.
3159         We add sanitization levels for regular responses in case responses might be exposed to scripts or not.
3160         If not exposed to scripts, additional filtering is done.
3161
3162         Add internal API to get unfiltered response headers from a fetch response.
3163         Test: http/wpt/service-workers/header-filtering.https.html
3164
3165         * Modules/fetch/FetchResponse.h:
3166         * loader/CrossOriginPreflightResultCache.cpp:
3167         (WebCore::CrossOriginPreflightResultCacheItem::parse):
3168         * platform/network/HTTPParsers.h:
3169         (WebCore::addToAccessControlAllowList):
3170         (WebCore::parseAccessControlAllowList):
3171         * platform/network/ResourceResponseBase.cpp:
3172         (WebCore::isSafeToKeepRedirectionResponseHeader):
3173         (WebCore::isCrossOriginSafeToKeepResponseHeader):
3174         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
3175         * platform/network/ResourceResponseBase.h:
3176         * testing/ServiceWorkerInternals.cpp:
3177         (WebCore::ServiceWorkerInternals::fetchResponseHeaderList):
3178         * testing/ServiceWorkerInternals.h:
3179         * testing/ServiceWorkerInternals.idl:
3180
3181 2018-04-06  Michael Catanzaro  <mcatanzaro@igalia.com>
3182
3183         Unreviewed, fix unused parameter warning when credential storage is disabled
3184
3185         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3186         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
3187
3188 2018-04-06  Eric Carlson  <eric.carlson@apple.com>
3189
3190         [Extra zoom mode] Block playback until fullscreen begins
3191         https://bugs.webkit.org/show_bug.cgi?id=184371
3192         <rdar://problem/39250891>
3193
3194         Reviewed by Youenn Fablet.
3195
3196         * html/HTMLMediaElement.cpp:
3197         (WebCore::HTMLMediaElement::updatePlayState): Return early when waiting to enter fullscreen.
3198         (WebCore::HTMLMediaElement::enterFullscreen): Set m_waitingToEnterFullscreen.
3199         (WebCore::HTMLMediaElement::exitFullscreen): Clear m_waitingToEnterFullscreen.
3200         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Ditto.
3201         * html/HTMLMediaElement.h:
3202
3203 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3204
3205         WebCore::screenSupportsExtendedColor improperly calls NSScreen functions in the WebContent process
3206         https://bugs.webkit.org/show_bug.cgi?id=184364
3207         <rdar://problem/39246314>
3208
3209         Reviewed by Per Arne Vollan.
3210
3211         The WebContent process is interacting directly with NSScreen to determine if the current screen
3212         has extended color support. This should be brokered from the UIProcess.
3213         
3214         Tested by fast/media/mq-color-gamut.html.
3215
3216         * platform/ScreenProperties.h:
3217         (WebCore::ScreenProperties::encode const): Add screenSupportsExtendedColor.
3218         (WebCore::ScreenProperties::decode): Ditto.
3219         * platform/mac/PlatformScreenMac.mm:
3220         (WebCore::getScreenProperties): Retrieve extended color support.
3221         (WebCore::screenSupportsExtendedColor): Retrieve cached version when in the WebContent
3222         process. Assert that NSScreen is not accessed in the WebContent process.
3223
3224 2018-04-06  Fujii Hironori  <Hironori.Fujii@sony.com>
3225
3226         [Win][WebCore] Expose a constant for scrollbar pixels per line (cScrollbarPixelsPerLine)
3227         https://bugs.webkit.org/show_bug.cgi?id=184296
3228
3229         Reviewed by Alex Christensen.
3230
3231         No new tests (No behavior changes).
3232
3233         * platform/PlatformWheelEvent.h: Placed cScrollbarPixelsPerLine definition.
3234         * platform/win/WheelEventWin.cpp:
3235         (WebCore::PlatformWheelEvent::PlatformWheelEvent): Removed cScrollbarPixelsPerLine definition.
3236
3237 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3238
3239         Unreviewed test fix after r230323
3240
3241         * platform/mac/PlatformScreenMac.mm:
3242         (WebCore::screenSupportsExtendedColor): Remove assertion hit during test runs.
3243
3244 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3245
3246         WebCore::screenColorSpace is retrieving CGColorSpace from NSScreen directly
3247         https://bugs.webkit.org/show_bug.cgi?id=184343
3248         <rdar://problem/39224881>
3249
3250         Reviewed by Per Arne Vollan.
3251
3252         Revise ScreenProperties to serialize the screen's color space, and later
3253         retrieve that in the WebContent process. This allows us to close off
3254         the CGSWindowServer connection.
3255
3256         * platform/ScreenProperties.h:
3257         (WebCore::ScreenProperties::encode const): Add CGColorSpaceRef support.
3258         (WebCore::ScreenProperties::decode): Ditto.
3259         * platform/mac/PlatformScreenMac.mm:
3260         (WebCore::displayID): Add assertion to prevent use in WebContent process.
3261         (WebCore::firstScreen): Ditto.
3262         (WebCore::getScreenProperties): Add support for CGColorSpaceRef.
3263         (WebCore::screenColorSpace): Retrieve cached version when in WebContent process.
3264         Assert that NSScreen is not accessed in WebContent process.
3265
3266 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
3267
3268         Implement createImageBitmap(Blob)
3269         https://bugs.webkit.org/show_bug.cgi?id=183247
3270
3271         Reviewed by Dean Jackson.
3272
3273         Tests:
3274             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
3275             - imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
3276
3277         * fileapi/FileReaderLoader.h:
3278         (WebCore::FileReaderLoader::url): expose the Blob's URL.
3279         * html/ImageBitmap.cpp: implement createImageBitmap(Blob).
3280         * html/ImageBitmap.h: allow the BlobImageObserver class access to the creation function.
3281         * loader/cache/CachedImage.cpp: reuse extracted code.
3282         (WebCore::CachedImage::isPDFResource const):
3283         (WebCore::CachedImage::isPostScriptResource const):
3284         (WebCore::CachedImage::createImage):
3285         * platform/graphics/Image.cpp: extract some code from CachedImage to reuse.
3286         (WebCore::Image::create):
3287         (WebCore::Image::isPDFResource):
3288         (WebCore::Image::isPostScriptResource):
3289         * platform/graphics/Image.h: add declarations.
3290
3291 2018-04-06  Zalan Bujtas  <zalan@apple.com>
3292
3293         Flex child does not get repainted when it is inserted back to the render tree.
3294         https://bugs.webkit.org/show_bug.cgi?id=184361
3295         <rdar://problem/34528716>
3296
3297         Reviewed by Antti Koivisto.
3298
3299         As with any regular block children, we should issue full repaint for flexbox items on their
3300         first layout (see RenderBlockFlow::layoutBlockChild()).
3301
3302         Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html
3303
3304         * rendering/RenderFlexibleBox.cpp:
3305         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
3306
3307 2018-04-06  Ms2ger  <Ms2ger@igalia.com>
3308
3309         Support transferring ImageBitmap objects
3310         https://bugs.webkit.org/show_bug.cgi?id=183131
3311
3312         Reviewed by Dean Jackson.
3313
3314         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-transfer.html
3315
3316         * bindings/js/SerializedScriptValue.cpp:
3317         (WebCore::CloneSerializer::serialize): thread through ImageBitmaps.
3318         (WebCore::CloneSerializer::CloneSerializer): thread through ImageBitmaps.
3319         (WebCore::CloneSerializer::fillTransferMap): don't require a mutable reference.
3320         (WebCore::CloneSerializer::dumpImageBitmap): add.
3321         (WebCore::CloneSerializer::dumpIfTerminal): check for ImageBitmap.
3322         (WebCore::CloneDeserializer::deserialize): thread through ImageBitmaps.
3323         (WebCore::CloneDeserializer::CloneDeserializer): thread through ImageBitmaps.
3324         (WebCore::CloneDeserializer::readImageBitmap): add.
3325         (WebCore::CloneDeserializer::readTerminal): check for ImageBitmap.
3326         (WebCore::SerializedScriptValue::SerializedScriptValue): thread through ImageBitmaps.
3327         (WebCore::SerializedScriptValue::create): thread through ImageBitmaps.
3328         (WebCore::containsDuplicates): add.
3329         (WebCore::SerializedScriptValue::deserialize): handle ImageBitmap arguments.
3330         * bindings/js/SerializedScriptValue.h: update signatures, add member.
3331         * html/ImageBitmap.cpp:
3332         (WebCore::ImageBitmap::create): add.
3333         (WebCore::ImageBitmap::detachBitmaps): add.
3334         * html/ImageBitmap.h: add signatures.
3335
3336 2018-04-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
3337
3338         When recording the drawing, the DisplayList should be initialized with the GraphicsContextState of the underlying GraphicsContext
3339         https://bugs.webkit.org/show_bug.cgi?id=184336
3340
3341         Reviewed by Antti Koivisto.
3342
3343         The state of the drawing context has to be transfered to the recording 
3344         DisplayList before recording. Many recording GraphicsContext functions 
3345         will behave wrongly if it gets the default state.
3346
3347         * html/canvas/CanvasRenderingContext2DBase.cpp:
3348         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
3349         (WebCore::CanvasRenderingContext2DBase::drawingContext const):
3350         * platform/graphics/ca/GraphicsLayerCA.cpp:
3351         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3352         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3353         (WebCore::DisplayList::Recorder::Recorder):
3354         * platform/graphics/displaylists/DisplayListRecorder.h:
3355         (WebCore::DisplayList::Recorder::ContextState::ContextState):
3356         (WebCore::DisplayList::Recorder::ContextState::cloneForSave const):
3357         * platform/graphics/displaylists/DisplayListReplayer.cpp:
3358         (WebCore::DisplayList::Replayer::replay):
3359         * platform/graphics/displaylists/DisplayListReplayer.h:
3360         (WebCore::DisplayList::Replayer::replay): If we do not have a clipping
3361         rectangle and we want to record all the drawing, we need a default value
3362         for the clipping rectangle and we want no clipping to happen.
3363
3364 2018-04-06  Daniel Bates  <dabates@apple.com>
3365
3366         Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff"
3367         https://bugs.webkit.org/show_bug.cgi?id=184359
3368
3369         Reviewed by Per Arne Vollan.
3370
3371         Emphasize in the message that the script was blocked from executing.
3372
3373         Test: http/tests/security/contentTypeOptions/nosniff-importScript-blocked.html
3374
3375         * dom/LoadableClassicScript.cpp:
3376         (WebCore::LoadableClassicScript::notifyFinished):
3377         * workers/WorkerScriptLoader.cpp:
3378         (WebCore::WorkerScriptLoader::didReceiveResponse):
3379
3380 2018-04-06  Daniel Bates  <dabates@apple.com>
3381
3382         importScripts() should throw exception with a reason when it fails to load a script from the network
3383         https://bugs.webkit.org/show_bug.cgi?id=184345
3384
3385         Reviewed by Alexey Proskuryakov.
3386
3387         Currently importScripts() throws a NetworkError exception without a reason when
3388         it fails to load a script from the network. It is ambiguous whether the load failed
3389         due to an access control failure or some other error. Instead we should include
3390         the reason the load failed in the thrown exception.
3391
3392         * workers/WorkerGlobalScope.cpp:
3393         (WebCore::WorkerGlobalScope::importScripts):
3394
3395 2018-04-06  Daniel Bates  <dabates@apple.com>
3396
3397         Attempt to fix the build after <https://trac.webkit.org/changeset/230338>
3398         (https://bugs.webkit.org/show_bug.cgi?id=184360)
3399
3400         Make lambdas mutable so that we can WTFMove() their captured arguments.
3401
3402         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3403         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
3404         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
3405         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
3406
3407 2018-04-06  Daniel Bates  <dabates@apple.com>
3408
3409         Have class Exception take String by value instead of a String&&
3410         https://bugs.webkit.org/show_bug.cgi?id=184360
3411
3412         Reviewed by Alexey Proskuryakov.
3413
3414         For convenience support instantiating an Exception with either an lvalue String or
3415         rvalue String.
3416
3417         Although it can be argued that having Exception take a String by value instead of String&&
3418         can lead to missed opportunities to WTFMove() a String object into Exception such mistakes
3419         are just that, missed opportunities. That is, correctness is not affected and we may perform
3420         an unnecessary ref/deref of the underlying StringImpl when instantiating an Exception. If
3421         such missed opportunities show up in profiles and such mistakes happen often then we can
3422         re-evaluate the decision to have Exception take a String by value.
3423
3424         * Modules/cache/DOMCache.cpp:
3425         (WebCore::DOMCache::put): Simplify code now that Exception takes a String by value.
3426         * Modules/fetch/FetchResponse.cpp:
3427         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
3428         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3429         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed): Move String into Exception to avoid an
3430         unnecessary ref/de-ref.
3431         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed): Ditto.
3432         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed): Ditto.
3433         * dom/Exception.h:
3434         (WebCore::Exception::Exception): Take String by value. Also use uniform initializer syntax.
3435
3436 2018-04-06  Antti Koivisto  <antti@apple.com>
3437
3438         Tighten ImageSource to have BitmapImage pointer instead of Image
3439         https://bugs.webkit.org/show_bug.cgi?id=184356
3440
3441         Reviewed by Said Abou-Hallawa.
3442
3443         ImageSource is an implementation detail of BitmapImage, not a generic type.
3444
3445         * loader/ImageLoader.cpp:
3446         (WebCore::ImageLoader::decode):
3447         * platform/graphics/BitmapImage.h:
3448         * platform/graphics/Image.h:
3449         (WebCore::Image::decode): Deleted.
3450         (WebCore::Image::imageFrameAvailableAtIndex): Deleted.
3451
3452         Also make some BitmapImage specific functions non-virtual and remove them from Image.
3453
3454         * platform/graphics/ImageSource.cpp:
3455         (WebCore::ImageSource::ImageSource):
3456         * platform/graphics/ImageSource.h:
3457         (WebCore::ImageSource::create):
3458
3459         Make constructors private.
3460
3461         * platform/graphics/cg/GraphicsContext3DCG.cpp:
3462         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
3463
3464 2018-04-06  Brent Fulgham  <bfulgham@apple.com>
3465
3466         Unreviewed test fix after r230323
3467
3468         * platform/mac/PlatformScreenMac.mm:
3469         (WebCore::screen): Remove assertion we still hit due to event handling code.
3470
3471 2018-04-05  Youenn Fablet  <youenn@apple.com>
3472
3473         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
3474         https://bugs.webkit.org/show_bug.cgi?id=184306
3475
3476         Reviewed by Ryosuke Niwa.
3477
3478         Add an option to not compile CSS rules since they are not useful in NetworkProcess.
3479         Covered by tests no longer crashing in Debug WK2 bots.
3480
3481         * contentextensions/ContentExtension.cpp:
3482         (WebCore::ContentExtensions::ContentExtension::create):
3483         (WebCore::ContentExtensions::ContentExtension::ContentExtension):
3484         * contentextensions/ContentExtension.h:
3485         * contentextensions/ContentExtensionsBackend.cpp:
3486         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
3487         * contentextensions/ContentExtensionsBackend.h:
3488
3489 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
3490
3491         WebContent process is calling CGDisplayUsesInvertedPolarity
3492         https://bugs.webkit.org/show_bug.cgi?id=184337
3493         <rdar://problem/39215702>
3494
3495         Reviewed by Zalan Bujtas.
3496
3497         The PlatformScreenMac code is still calling display-related routines directly, specifically
3498         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
3499         the UIProcess.
3500         
3501         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
3502         the compile guards so all macOS builds use this behavior.
3503         
3504         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
3505         routines in the future.
3506
3507         Tested by existing regression tests.
3508
3509         * platform/PlatformScreen.h:
3510         * platform/ScreenProperties.h:
3511         (WebCore::ScreenProperties::encode const): Add new values.
3512         (WebCore::ScreenProperties::decode):
3513         * platform/mac/PlatformScreenMac.mm:
3514         (WebCore::displayID): Add assertion that this is not calling display-related routines in
3515         the WebContent process.
3516         (WebCore::firstScreen): Ditto.
3517         (WebCore::screenProperties): Moved higher in the file so it can be reused. Add calls to
3518         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray.
3519         (WebCore::getScreenProperties): Moved higher in the file so it can be reused. Stop
3520         double-hashing displayID.
3521         (WebCore::screenIsMonochrome): Use cached values in WebContent process. Assert if this
3522         code attempts a display-related routine in the WebContent process.
3523         (WebCore::screenHasInvertedColors): Ditto.
3524         (WebCore::screenDepth): Add assertion that this is not calling display-related routines in
3525         the WebContent process.
3526         (WebCore::screenDepthPerComponent): Ditto.
3527         (WebCore::screenRect): Ditto.
3528         (WebCore::screenAvailableRect): Ditto.
3529         (WebCore::screen): Ditto.
3530         (WebCore::screenColorSpace): Ditto.
3531         (WebCore::screenSupportsExtendedColor): Ditto.
3532
3533 2018-04-05  John Wilander  <wilander@apple.com>
3534
3535         Resource Load Statistics: Apply cookie blocking to setCookiesFromDOM()
3536         https://bugs.webkit.org/show_bug.cgi?id=184346
3537         <rdar://problem/39226036>
3538
3539         Reviewed by Brent Fulgham.
3540
3541         Since these cookies can't be seen and are not sent in requests, I
3542         can't write an automated test for them. This really should have been
3543         done as part of: https://bugs.webkit.org/show_bug.cgi?id=180682.
3544         That said, I have tested this manually.
3545
3546         * platform/network/mac/CookieJarMac.mm:
3547         (WebCore::setCookiesFromDOM):
3548
3549 2018-04-05  Zalan Bujtas  <zalan@apple.com>
3550
3551         Folding anonymous blocks should not result in deleting content.
3552         https://bugs.webkit.org/show_bug.cgi?id=184339
3553         <rdar://problem/37327428>
3554
3555         Reviewed by Antti Koivisto.
3556
3557         While folding multiple anonymous blocks (moving the children from next sibling over to previous sibling)
3558         we should ensure that the block we are about to destroy does not gain new descendants.
3559         In case of 4 sibling anonymous blocks (A B C D), while destroying B
3560         1. we move C's children to A and destroy C.
3561         2. While destroying C, we notice B and C as sibling anonymous blocks and we move
3562         D's children over to B (even though B is going to be destroyed as we climb back on the stack).
3563         
3564         In this patch, B is detached from the tree before we start moving renderers around so that a subsequent folding won't
3565         find B anymore as a candidate.
3566
3567         Test: fast/block/crash-while-folding-anonymous-blocks.html
3568
3569         * rendering/updating/RenderTreeBuilderBlock.cpp:
3570         (WebCore::RenderTreeBuilder::Block::detach):
3571
3572 2018-04-05  Andy Estes  <aestes@apple.com>
3573
3574         Mark Payment Request as "Supported" in features.json
3575         https://bugs.webkit.org/show_bug.cgi?id=184338
3576
3577         Reviewed by Anders Carlsson.
3578
3579         * features.json:
3580
3581 2018-04-05  Chris Dumez  <cdumez@apple.com>
3582
3583         Unreviewed, rolling out r230042.
3584
3585         It is no longer needed now that it is safe to construct a
3586         SecurityOrigin from an on-main thread
3587
3588         Reverted changeset:
3589
3590         "WebSocket::didReceiveMessage() may construct a SecurityOrigin
3591         object on a non-main thread"
3592         https://bugs.webkit.org/show_bug.cgi?id=184068
3593         https://trac.webkit.org/changeset/230042
3594
3595 2018-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3596
3597         [WTF] Remove StaticLock
3598         https://bugs.webkit.org/show_bug.cgi?id=184332
3599
3600         Reviewed by Mark Lam.
3601
3602         No behavior change.
3603
3604         * Modules/webdatabase/Database.cpp:
3605         (WebCore::Database::Database):
3606         (WebCore::Database::performOpenAndVerify):
3607         (WebCore::Database::closeDatabase):
3608         (WebCore::Database::getCachedVersion const):
3609         (WebCore::Database::setCachedVersion):
3610         * Modules/webdatabase/DatabaseTracker.cpp:
3611         (WebCore::DatabaseTracker::openDatabaseMutex):
3612         * Modules/webdatabase/DatabaseTracker.h:
3613         * Modules/websockets/WebSocket.cpp:
3614         (WebCore::WebSocket::allActiveWebSocketsMutex):
3615         * Modules/websockets/WebSocket.h:
3616         * bridge/objc/WebScriptObject.mm:
3617         * crypto/CryptoAlgorithmRegistry.cpp:
3618         (WebCore::CryptoAlgorithmRegistry::identifier):
3619         (WebCore::CryptoAlgorithmRegistry::name):
3620         (WebCore::CryptoAlgorithmRegistry::create):
3621         (WebCore::CryptoAlgorithmRegistry::registerAlgorithm):
3622         * dom/Node.cpp:
3623         * platform/URL.cpp:
3624         * platform/graphics/FontCache.cpp:
3625         * platform/graphics/MediaPlayer.cpp:
3626         * platform/ios/QuickLook.mm:
3627         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
3628         * platform/ios/wak/WebCoreThread.mm:
3629         * platform/ios/wak/WebCoreThreadRun.cpp:
3630         * platform/network/cf/LoaderRunLoopCF.cpp:
3631         (WebCore::loaderRunLoop):
3632         * platform/network/curl/CurlContext.cpp:
3633         (WebCore::CurlShareHandle::mutexFor):
3634         * platform/network/curl/CurlContext.h:
3635         * platform/sql/SQLiteDatabaseTracker.cpp:
3636         (WebCore::SQLiteDatabaseTracker::incrementTransactionInProgressCount):
3637         (WebCore::SQLiteDatabaseTracker::decrementTransactionInProgressCount):
3638         * platform/text/TextEncodingRegistry.cpp:
3639         (WebCore::buildBaseTextCodecMaps):
3640         (WebCore::newTextCodec):
3641         (WebCore::atomicCanonicalTextEncodingName):
3642         * workers/WorkerThread.cpp:
3643         (WebCore::WorkerThread::workerThreadCount):
3644         (WebCore::WorkerThread::WorkerThread):
3645         (WebCore::WorkerThread::~WorkerThread):
3646         (WebCore::WorkerThread::releaseFastMallocFreeMemoryInAllThreads):
3647
3648 2018-04-04  Youenn Fablet  <youenn@apple.com>
3649
3650         WebRTC data channel only applications require capture permissions for direct connections
3651         https://bugs.webkit.org/show_bug.cgi?id=174500
3652         <rdar://problem/34134281>
3653
3654         Reviewed by Eric Carlson.
3655
3656         Test: webrtc/datachannel/mdns-ice-candidates.html
3657
3658         Add support at PeerConnectionBackend to obfuscate any gathered host candidate
3659         by replacing the IP address with an opaque name that can be resolved by MDNS.
3660         An opaque name is generated for each IP address and is scoped by the document owning the peer connection object.
3661
3662         Add support to resolve any such MDNS ICE candidate.
3663         A limit of 250 ms is fixed for the resolution to happen.
3664         After 250 ms, the candidate is discarded.
3665
3666         Add an experimental flag around this feature, off by default.
3667
3668         * Modules/mediastream/PeerConnectionBackend.cpp:
3669         (WebCore::extractIPAddres):
3670         (WebCore::PeerConnectionBackend::addIceCandidate):
3671         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
3672         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
3673         (WebCore::PeerConnectionBackend::newICECandidate):
3674         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
3675         (WebCore::PeerConnectionBackend::registerMDNSName):
3676         (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName):
3677         * Modules/mediastream/PeerConnectionBackend.h:
3678         * Modules/mediastream/RTCIceCandidate.h:
3679         (WebCore::RTCIceCandidate::setCandidate):
3680         * Modules/mediastream/RTCPeerConnection.h:
3681         * dom/Document.cpp:
3682         (WebCore::Document::prepareForDestruction):
3683         (WebCore::Document::suspend):
3684         * page/RuntimeEnabledFeatures.h:
3685         (WebCore::RuntimeEnabledFeatures::mdnsICECandidatesEnabled const):
3686         (WebCore::RuntimeEnabledFeatures::setMDNSICECandidatesEnabled):
3687         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3688
3689 2018-04-04  Brian Burg  <bburg@apple.com>
3690
3691         [Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails
3692         https://bugs.webkit.org/show_bug.cgi?id=184314
3693         <rdar://problem/39186578>
3694
3695         Reviewed by Timothy Hatcher.
3696
3697         Covered by several tests in add_cookie.py per the bug title.
3698
3699         * platform/network/cocoa/CookieCocoa.mm:
3700         (WebCore::Cookie::operator NSHTTPCookie * const):
3701         By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted
3702         precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that
3703         the truncated value and actual value are the same.
3704
3705 2018-04-04  Alex Christensen  <achristensen@webkit.org>
3706
3707         Move PingHandle to WebKitLegacy
3708         https://bugs.webkit.org/show_bug.cgi?id=184145
3709
3710         Reviewed by Youenn Fablet.
3711
3712         * WebCore.xcodeproj/project.pbxproj:
3713         * platform/network/PingHandle.h: Removed.
3714
3715 2018-04-04  Per Arne Vollan  <pvollan@apple.com>
3716
3717         The layout test fast/canvas/canvas-blending-global-alpha.html is failing when the WebContent process does not have WindowServer access.
3718         https://bugs.webkit.org/show_bug.cgi?id=183752
3719         <rdar://problem/38635731>
3720
3721         The test is failing because the system is only providing software rendering when there is no access
3722         to the WindowServer, and software rendering is producing slightly different results than hardware
3723         rendering. To enable accelerated rendering, the GPU to be used for IOSurface rendering needs to be
3724         selected by handing over the OpenGL display mask to the IOSurface CGContext.
3725
3726         Reviewed by Brent Fulgham.
3727
3728         No new tests, covered by existing tests.
3729
3730         * platform/graphics/GraphicsContext3D.h:
3731         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3732         (WebCore::GraphicsContext3D::getOpenGLDisplayMask):
3733         * platform/graphics/cocoa/IOSurface.mm:
3734         (WebCore::IOSurface::ensurePlatformContext):
3735
3736 2018-04-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
3737
3738         Track the paint frequency through a new class named PaintFrequencyTracker
3739         https://bugs.webkit.org/show_bug.cgi?id=184311
3740
3741         Reviewed by Antti Koivisto.
3742
3743         PaintFrequencyTracker is a class which detects when a layer is painted 
3744         frequently. SinglePaintFrequencyTracking is used in conjunction with
3745         PaintFrequencyTracker to recored a single paint timing.
3746
3747         * rendering/PaintFrequencyTracker.h: Added.
3748         (WebCore::PaintFrequencyTracker::begin):
3749         (WebCore::PaintFrequencyTracker::end):
3750         (WebCore::PaintFrequencyTracker::paintingFrequently const):
3751         Simplify the logic for tracking the paint frequency and move it from
3752         RenderLayer.cpp.
3753
3754         (WebCore::SinglePaintFrequencyTracking::SinglePaintFrequencyTracking):
3755         (WebCore::SinglePaintFrequencyTracking::~SinglePaintFrequencyTracking):
3756         A convenient way to bracket the begin() and the end() methods of
3757         PaintFrequencyTracker.
3758
3759         * rendering/RenderLayer.cpp:
3760         (WebCore::RenderLayer::paintLayerContents):
3761         (WebCore::RenderLayer::calculateClipRects const):
3762         (WebCore::PaintFrequencyInfo::PaintFrequencyInfo): Deleted.
3763         (WebCore::PaintFrequencyInfo::setPaintedCacheableResource): Deleted.
3764         (WebCore::PaintFrequencyInfo::paintingFrequently const): Deleted.
3765         (WebCore::PaintFrequencyInfo::updatePaintFrequency): Deleted.
3766         (WebCore::PaintFrequencyInfo::paintingCacheableResource): Deleted.
3767         * rendering/RenderLayer.h:
3768         Rename PaintFrequencyInfo to PaintFrequencyTracker and move it a separate
3769         header file.
3770
3771 2018-04-04  Jer Noble  <jer.noble@apple.com>
3772
3773         RELEASE_ASSERT in CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF() when MediaToolbox.framework missing
3774         https://bugs.webkit.org/show_bug.cgi?id=184247
3775         <rdar://problem/39007591>
3776
3777         Rubber-stamped by Eric Carlson.
3778
3779         Use SOFT_LINK_FRAMEWORK_OPTIONAL for frameworks which are not guaranteed to be present.
3780
3781         * page/CaptionUserPreferencesMediaAF.cpp:
3782         (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF):
3783
3784 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
3785
3786         Failures from mach port reference handling should be fatal
3787         https://bugs.webkit.org/show_bug.cgi?id=184202
3788         <rdar://problem/37771114>
3789
3790         Reviewed by Anders Carlsson.
3791
3792         We may corrupt the Mach port space by improperly matching the equivalent of reference counting
3793         retains (mach_port_mod_refs) with releases (mach_port_deallocate).
3794
3795         Our current implementation of MachSendRights::create does not grab a reference if the passed
3796         port is MACH_PORT_DEAD, but we unconditionally call mach_port_deallocate on the port, which
3797         could lead to a reference count mismatch.
3798
3799         Likewise, our MachSendRight destructor does not release the port if it has changed to MACH_PORT_DEAD
3800         (e.g., if a child process dies), again leading to a mismatch in retain/releases.
3801
3802         Finally, failures in mach_port_deallocate should be fatal because they indicate that the
3803         application was attempting to remove an unowned right. This is a fatal condition for Mach, and
3804         should lead to an abort. 
3805
3806         This patch does the following:
3807
3808         1. It creates a helper function that does the right thing for safely deallocating a mach port.
3809         2. It uses it in multiple places.
3810         3. It revises 'MachSendRight::create" so that it properly handles the condition of a dead port.
3811         4. It revises the MachSendRight destructor to properly handle the condition of a dead port.
3812
3813         No new tests, no change in behavior expected.
3814
3815         * SourcesCocoa.txt: Update for move of MachSendRight files.
3816         * WebCore.xcodeproj/project.pbxproj: Ditto.
3817         * page/cocoa/ResourceUsageThreadCocoa.mm:
3818         (WebCore::getMachThreads): Added.
3819         (WebCore::cpuUsage): Use the new cleanup helper function.
3820         * platform/cocoa/MachSendRight.cpp: Removed.
3821         * platform/cocoa/MachSendRight.h: Removed.
3822         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
3823         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
3824         * platform/graphics/cocoa/IOSurface.h:
3825         * platform/graphics/cocoa/IOSurface.mm:
3826
3827 2018-04-04  Youenn Fablet  <youenn@apple.com>
3828
3829         Remove unused HTTP header names
3830         https://bugs.webkit.org/show_bug.cgi?id=184272
3831
3832         Reviewed by Alex Christensen.
3833
3834         No change of behavior.
3835         Removed some names that are not used in the code base.
3836         This allows to strengthen filtering of responses sent to WebProcess.
3837         Added two headers used by web inspector.
3838         Updated existing code to use indexed HTTP header names.
3839
3840         * html/parser/XSSAuditor.cpp:
3841         (WebCore::XSSAuditor::init):
3842         * inspector/agents/InspectorPageAgent.cpp:
3843         (WebCore::InspectorPageAgent::sourceMapURLForResource):
3844         * platform/network/HTTPHeaderNames.in:
3845
3846 2018-04-04  Beth Dakin  <bdakin@apple.com>
3847
3848         Fix the !HAVE(AVFOUNDATION_VIDEO_OUTPUT) build
3849         https://bugs.webkit.org/show_bug.cgi?id=184309
3850         -and corresponding-
3851         rdar://problem/39179126
3852
3853         Reviewed by Jer Noble.
3854
3855         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3856         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoFullscreenInlineImage):
3857         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
3858
3859 2018-04-04  Youenn Fablet  <youenn@apple.com>
3860
3861         MockRealtimeVideoSourceMac should produce kCVPixelFormatType_420YpCbCr8Planar buffers
3862         https://bugs.webkit.org/show_bug.cgi?id=184304
3863
3864         Reviewed by Eric Carlson.
3865
3866         Allows covering RealtimeOutgoingVideoSourceMac code path handling native buffers produced by capture video sources.
3867         ARGB buffer coverage is done through canvas capture streams.
3868
3869         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
3870         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3871         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
3872
3873 2018-04-04  Youenn Fablet  <youenn@apple.com>
3874
3875         Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread
3876         https://bugs.webkit.org/show_bug.cgi?id=183988
3877
3878         Reviewed by Darin Adler.
3879
3880         No change of behavior, TrackPrivate remains destroyed on the main thread.
3881
3882         * platform/graphics/TrackPrivateBase.h:
3883         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3884         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3885         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
3886
3887 2018-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3888
3889         Unreviewed. Fix the build with libsoup < 2.49.91 after r230251.
3890
3891         Stop using ResourceHandle in SoupNetworkSession.
3892
3893         * platform/network/soup/SoupNetworkSession.cpp:
3894         (WebCore::SoupNetworkSession::SoupNetworkSession):
3895         (WebCore::authenticateCallback): Deleted.
3896         (WebCore::requestStartedCallback): Deleted.
3897
3898 2018-04-03  Alex Christensen  <achristensen@webkit.org>
3899
3900         Remove unused libsoup ResourceHandle implementation
3901         https://bugs.webkit.org/show_bug.cgi?id=184048
3902
3903         Reviewed by Michael Catanzaro.
3904
3905         This code is unused since r228901 so let's remove it!
3906
3907         * platform/network/ResourceHandle.h:
3908         * platform/network/ResourceHandleInternal.h:
3909         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
3910         * platform/network/soup/ResourceHandleSoup.cpp:
3911         (WebCore::ResourceHandle::~ResourceHandle):
3912         (WebCore::ResourceHandleInternal::soupSession):
3913         (WebCore::ResourceHandle::cancelledOrClientless):
3914         (WebCore::ResourceHandle::ensureReadBuffer):
3915         (WebCore::ResourceHandle::currentStreamPosition const):
3916         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
3917         (WebCore::ResourceHandle::didStartRequest):
3918         (WebCore::ResourceHandle::start):
3919         (WebCore::ResourceHandle::releaseForDownload):
3920         (WebCore::ResourceHandle::sendPendingRequest):
3921         (WebCore::ResourceHandle::cancel):
3922         (WebCore::ResourceHandle::shouldUseCredentialStorage):
3923         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
3924         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
3925         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
3926         (WebCore::ResourceHandle::receivedCredential):
3927         (WebCore::ResourceHandle::receivedCancellation):
3928         (WebCore::ResourceHandle::receivedChallengeRejection):
3929         (WebCore::ResourceHandle::platformSetDefersLoading):
3930         (WebCore::sessionFromContext): Deleted.
3931         (WebCore::ResourceHandle::create): Deleted.
3932         (WebCore::ResourceHandle::ResourceHandle): Deleted.
3933         (WebCore::isAuthenticationFailureStatusCode): Deleted.
3934         (WebCore::tlsErrorsChangedCallback): Deleted.
3935         (WebCore::gotHeadersCallback): Deleted.
3936         (WebCore::applyAuthenticationToRequest): Deleted.
3937         (WebCore::restartedCallback): Deleted.
3938         (WebCore::shouldRedirect): Deleted.
3939         (WebCore::shouldRedirectAsGET): Deleted.
3940         (WebCore::continueAfterWillSendRequest): Deleted.
3941         (WebCore::doRedirect): Deleted.
3942         (WebCore::redirectSkipCallback): Deleted.
3943         (WebCore::wroteBodyDataCallback): Deleted.
3944         (WebCore::cleanupSoupRequestOperation): Deleted.
3945         (WebCore::nextMultipartResponsePartCallback): Deleted.
3946         (WebCore::sendRequestCallback): Deleted.
3947         (WebCore::continueAfterDidReceiveResponse): Deleted.
3948         (WebCore::startingCallback): Deleted.
3949         (WebCore::networkEventCallback): Deleted.
3950         (WebCore::createSoupMessageForHandleAndRequest): Deleted.
3951         (WebCore::createSoupRequestAndMessageForHandle): Deleted.
3952         (WebCore::ResourceHandle::timeoutFired): Deleted.
3953         (WebCore::waitingToSendRequest): Deleted.
3954         (WebCore::readCallback): Deleted.
3955
3956 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
3957
3958         Add missing WEBCORE_EXPORTs (for Windows shared library build)
3959         https://bugs.webkit.org/show_bug.cgi?id=184279
3960
3961         Reviewed by Alex Christensen.
3962
3963         * dom/Element.h:
3964         * dom/Node.h:
3965         * editing/FrameSelection.h: