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