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