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