Web Inspector: expose system user interface layout direction through InspectorFronten...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-12  Brian Burg  <bburg@apple.com>
2
3         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
4         https://bugs.webkit.org/show_bug.cgi?id=168209
5         <rdar://problem/11573736>
6
7         Reviewed by Joseph Pecoraro.
8
9         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
10         properly set the UI directionality from system settings in PageClient, this will get inherited
11         automatically by the Inspector's WebPage instance.
12
13         * inspector/InspectorFrontendClient.h:
14         * inspector/InspectorFrontendClientLocal.cpp:
15         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
16         * inspector/InspectorFrontendClientLocal.h:
17
18         * inspector/InspectorFrontendHost.h:
19         * inspector/InspectorFrontendHost.idl:
20         * inspector/InspectorFrontendHost.cpp:
21         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
22         Expose the directionality to the frontend as "ltr" or "rtl" strings.
23
24 2017-02-13  Zalan Bujtas  <zalan@apple.com>
25
26         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
27         https://bugs.webkit.org/show_bug.cgi?id=168247
28         <rdar://problem/30497288>
29
30         Reviewed by Antti Koivisto.
31
32         The width of the run is supposed to be the same with or without the trailing whitespace.
33
34         Covered by performance test.
35
36         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
37         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
38         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
39         * rendering/SimpleLineLayoutTextFragmentIterator.h:
40
41 2017-02-13  Karim H  <karim@karhm.com>
42
43         Added the other missing BSTR roles tag names.
44         https://bugs.webkit.org/show_bug.cgi?id=165545
45
46         Reviewed by Chris Fleizach.
47
48         Test: accessibility/win/bstr-elements-role.html
49
50         * accessibility/AccessibilityRenderObject.cpp:
51         (WebCore::shouldReturnTagNameAsRoleForMSAA):
52
53 2017-02-13  Youenn Fablet  <youennf@gmail.com>
54
55         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
56         https://bugs.webkit.org/show_bug.cgi?id=168250
57
58         Reviewed by Alex Christensen.
59
60         Covered by webrtc tests in LayoutTests and in web-platform-tests.
61         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
62         That way, it can create real libwebrtc backends whenever requested by tests.
63
64         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
65         In the future, we should make them no longer static.
66
67         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
68         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
69         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
70         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
71         * WebCore.xcodeproj/project.pbxproj:
72         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
73         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
74         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
75         (WebCore::LibWebRTCProvider::factory):
76         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
77         (WebCore::createActualPeerConnection):
78         (WebCore::LibWebRTCProvider::createPeerConnection):
79         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
80         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
81         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
82         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
83         * testing/Internals.cpp:
84         * testing/MockLibWebRTCPeerConnection.cpp:
85         (WebCore::useMockRTCPeerConnectionFactory):
86         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
87         (WebCore::releaseInNetworkThread):
88         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
89         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
90         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
91         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
92
93 2017-02-13  Anders Carlsson  <andersca@apple.com>
94
95         Simplify DragController::startDrag
96         https://bugs.webkit.org/show_bug.cgi?id=168240
97
98         Reviewed by Tim Horton.
99
100         Use early returns instead of assigning to a variable that's returned at the end of the function.
101
102         * page/DragController.cpp:
103         (WebCore::DragController::startDrag):
104
105 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
106
107         The current frame of an image should not deleted if another frame is asynchronously being decoded
108         https://bugs.webkit.org/show_bug.cgi?id=167618
109
110         Reviewed by Simon Fraser.
111
112         Test: fast/images/animated-image-draw-while-decode.html
113
114         If the memory cache asks the BitmapImage to destroy all its frames while
115         the next frame is being decoded, a thread contention may happen. This can
116         happen when BitmapImage::draw() is called and the next frame is not ready
117         yet for drawing, so the current frame has to be drawn. This will invoke
118         a frame decoding in the same image from the drawing committing thread.
119
120         We can avoid that by destroying all the frames except the current frame if
121         the image is asynchronously decoding its frames. This should not add extra
122         memory overhead because building the image frame cache and then destroying
123         it, when needed, is an on-going process. The frames will be allocated and
124         decoded all the time and all of them can be destroyed except the current one.
125         
126         * platform/graphics/BitmapImage.cpp:
127         (WebCore::BitmapImage::destroyDecodedData):
128         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
129         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
130         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
131         be responsible only for destroying a range of ImageFrames.
132
133         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
134         is ready to be rendered if the next frame is being decoded.
135         
136         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
137
138         * platform/graphics/ImageFrameCache.cpp:
139         (WebCore::ImageFrameCache::destroyDecodedData):
140         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
141         * platform/graphics/ImageFrameCache.h:
142         (WebCore::ImageFrameCache::destroyAllDecodedData):
143         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
144         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
145         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
146         This range might include all the frames, all the frames but up to a specific
147         frame, or all the frames but exclude one frame in the middle.
148         
149         * platform/graphics/ImageSource.cpp:
150         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
151         The decision to call clearFrameBufferCache() or clear() is moved to
152         BitmapImage::destroyDecodedData().
153          
154         (WebCore::ImageSource::destroyDecodedData): Deleted.
155         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
156         These functions are replaced by another set of functions in ImageSource.h.
157         
158         * platform/graphics/ImageSource.h:
159         (WebCore::ImageSource::destroyAllDecodedData):
160         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
161         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
162         (WebCore::ImageSource::hasDecodingQueue):
163         These are new wrappers which call the corresponding ImageFrameCache functions.
164
165 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
166
167         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
168         https://bugs.webkit.org/show_bug.cgi?id=168256
169
170         Reviewed by Alex Christensen.
171
172         Use of this function is already behind a platform guard.
173
174         No new tests because there is no behavior change.
175
176         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
177         (SOFT_LINK): Deleted.
178
179 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
180
181         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
182         https://bugs.webkit.org/show_bug.cgi?id=165913
183         <rdar://problem/30477222>
184
185         Reviewed by Joseph Pecoraro.
186
187         Covered by existing tests.
188
189         * page/Crypto.cpp:
190         (WebCore::Crypto::webkitSubtle):
191
192 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
193
194         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
195         https://bugs.webkit.org/show_bug.cgi?id=168261
196         rdar://problem/30481079
197
198         Reviewed by Tim Horton.
199
200         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
201         that do a framework include.
202
203         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
204         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
205         * platform/spi/cocoa/QuartzCoreSPI.h:
206         * platform/spi/mac/NSViewSPI.h:
207
208 2017-02-13  Youenn Fablet  <youenn@apple.com>
209
210         ASSERTION FAILED: !m_bodyLoader
211         https://bugs.webkit.org/show_bug.cgi?id=166986
212
213         Reviewed by Sam Weinig.
214
215         Refactoring to make the unset/set pending activity part of body loader.
216         This allows ensuring to not forget to do that by simply deleting the body loader.
217
218         * Modules/fetch/FetchResponse.cpp:
219         (WebCore::FetchResponse::fetch):
220         (WebCore::FetchResponse::BodyLoader::didSucceed):
221         (WebCore::FetchResponse::BodyLoader::didFail):
222         (WebCore::FetchResponse::BodyLoader::BodyLoader):
223         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
224         (WebCore::FetchResponse::stop):
225         * Modules/fetch/FetchResponse.h:
226
227 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
228
229         Remove unused WebCoreThreadSafe.h
230         https://bugs.webkit.org/show_bug.cgi?id=168236
231
232         Reviewed by Dan Bernstein.
233
234         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
235         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
236         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
237
238 2017-02-13  Anders Carlsson  <andersca@apple.com>
239
240         Fix iOS build.
241
242         * platform/ios/DragImageIOS.mm:
243         (WebCore::deleteDragImage):
244
245 2017-02-13  Sam Weinig  <sam@webkit.org>
246
247         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
248         https://bugs.webkit.org/show_bug.cgi?id=168249
249
250         Reviewed by Dean Jackson.
251
252         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
253
254         * CMakeLists.txt:
255         * WebCore.xcodeproj/project.pbxproj:
256         * css/CSSAllInOne.cpp:
257         * css/MediaQuery.h:
258         * css/MediaQueryEvaluator.h:
259         * css/MediaQueryExp.cpp: Removed.
260         * css/MediaQueryExp.h: Removed.
261         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
262         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
263         * css/parser/MediaQueryParser.h:
264
265 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
266
267         WAKResponder should be exported from WebCore
268         https://bugs.webkit.org/show_bug.cgi?id=168245
269
270         Reviewed by Dan Bernstein.
271
272         * platform/ios/wak/WAKResponder.h:
273
274 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
275
276         Log to the History Channel in a few more places
277         https://bugs.webkit.org/show_bug.cgi?id=168252
278
279         Reviewed by Brady Eidson.
280
281         *** Aliens ***
282
283         * loader/HistoryController.cpp:
284         (WebCore::HistoryController::restoreScrollPositionAndViewState):
285         (WebCore::HistoryController::updateForReload):
286         * loader/NavigationScheduler.cpp:
287         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
288         (WebCore::NavigationScheduler::timerFired):
289         (WebCore::NavigationScheduler::cancel):
290         * page/History.cpp:
291         (WebCore::History::go):
292
293 2017-02-13  Alex Christensen  <achristensen@webkit.org>
294
295         Percent should be allowed in non-special URL hosts
296         https://bugs.webkit.org/show_bug.cgi?id=168255
297
298         Reviewed by Tim Horton.
299
300         In the last few weeks, the spec has consolidated its sets of code points.
301         Now forbidden host code points replace the old invalid host code points with
302         the modification that percents are allowed in non-special hosts because we
303         percent-encode non-ascii code points in non-special hosts.
304         See https://url.spec.whatwg.org/#concept-opaque-host-parser
305
306         Covered by newly passing web platform tests.
307
308         * platform/URLParser.cpp:
309         (WebCore::isC0Control):
310         (WebCore::isInUserInfoEncodeSet):
311         (WebCore::URLParser::hasForbiddenHostCodePoint):
312         (WebCore::URLParser::parseHostAndPort):
313         (WebCore::isInvalidDomainCharacter): Deleted.
314         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
315         * platform/URLParser.h:
316
317 2017-02-13  Anders Carlsson  <andersca@apple.com>
318
319         Fix Windows build.
320
321         * platform/win/PasteboardWin.cpp:
322         (WebCore::Pasteboard::setDragImage):
323
324 2017-02-13  Alex Christensen  <achristensen@webkit.org>
325
326         Fix Yosemite build after r211765
327         https://bugs.webkit.org/show_bug.cgi?id=168246
328         <rdar://problem/30494174>
329
330         Reviewed by Brady Eidson.
331
332         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
333         (SOFT_LINK):
334
335 2017-02-13  Anders Carlsson  <andersca@apple.com>
336
337         Add a DragImage class that wraps a DragImageRef
338         https://bugs.webkit.org/show_bug.cgi?id=168131
339
340         Reviewed by Beth Dakin.
341
342         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
343         various drag code paths possible. No functionality change.
344
345         * dom/DataTransfer.cpp:
346         (WebCore::DataTransfer::updateDragImage):
347         * page/DragController.cpp:
348         (WebCore::DragController::startDrag):
349         (WebCore::DragController::doImageDrag):
350         (WebCore::DragController::doSystemDrag):
351         * page/DragController.h:
352         * platform/DragImage.cpp:
353         (WebCore::DragImage::DragImage):
354         (WebCore::DragImage::operator=):
355         (WebCore::DragImage::~DragImage):
356         * platform/DragImage.h:
357         * platform/Pasteboard.h:
358         * platform/StaticPasteboard.h:
359         * platform/mac/PasteboardMac.mm:
360         (WebCore::Pasteboard::setDragImage):
361
362 2017-02-13  Chris Dumez  <cdumez@apple.com>
363
364         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
365         https://bugs.webkit.org/show_bug.cgi?id=168237
366         <rdar://problem/30494165>
367
368         Reviewed by Gavin Barraclough.
369
370         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
371         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
372         reset's the document's pageCacheState before calling Document::prepareForDestruction().
373
374         No new tests, this fixes assertion hits on our bots.
375
376         * dom/Document.cpp:
377         (WebCore::Document::destroyRenderTree):
378
379 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
380
381         Update custom line breaking iterators to the latest version of Unicode
382         https://bugs.webkit.org/show_bug.cgi?id=168182
383
384         Reviewed by Zalan Bujtas.
385
386         Clean up our breaking code to be more descriptive about the difference between
387         line-break: auto vs line-break: loose | normal | strict. The only difference is
388         that we have some hardcoded tables to speed up character iteration for
389         line-break: auto.
390
391         Tests: TestWebKitAPI WebKit2.LineBreaking
392
393         * rendering/BreakLines.h:
394         (WebCore::nextBreakablePosition):
395         (WebCore::nextBreakablePositionIgnoringNBSP):
396         (WebCore::nextBreakablePositionWithoutShortcut):
397         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
398         (WebCore::isBreakable):
399         (WebCore::nextBreakablePositionNonLoosely): Deleted.
400         (WebCore::nextBreakablePositionLoosely): Deleted.
401         (WebCore::nextBreakablePositionLoose): Deleted.
402         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
403         * rendering/RenderText.cpp:
404         (WebCore::RenderText::computePreferredLogicalWidths):
405         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
406         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
407         * rendering/line/BreakingContext.h:
408         (WebCore::BreakingContext::handleText):
409         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
410
411 2017-02-13  Youenn Fablet  <youenn@apple.com>
412
413         Remove @getUserMedia identifier
414         https://bugs.webkit.org/show_bug.cgi?id=168216
415
416         Reviewed by Sam Weinig.
417
418         No change of behavior.
419
420         * Modules/mediastream/MediaDevices.idl:
421         * bindings/js/WebCoreBuiltinNames.h:
422
423 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
424
425         [GTK] Non-accelerated drawing is broken with HiDPI
426         https://bugs.webkit.org/show_bug.cgi?id=168128
427
428         Reviewed by Michael Catanzaro.
429
430         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
431         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
432         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
433         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
434         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
435         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
436         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
437         installed, layers will be created with the current device scale factor anyway.
438
439         * page/PageOverlayController.cpp:
440         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
441
442 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
443
444         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
445         https://bugs.webkit.org/show_bug.cgi?id=167771
446
447         Reviewed by Daniel Bates.
448
449         * loader/DocumentLoader.cpp:
450         (WebCore::DocumentLoader::commitData):
451
452 2017-02-12  Dan Bernstein  <mitz@apple.com>
453
454         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
455
456         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
457
458 2017-02-12  Dan Bernstein  <mitz@apple.com>
459
460         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
461
462         * platform/spi/mac/TUCallSPI.h:
463
464 2017-02-12  Dan Bernstein  <mitz@apple.com>
465
466         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
467
468         * platform/spi/mac/TUCallSPI.h:
469
470 2017-02-12  Dan Bernstein  <mitz@apple.com>
471
472         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
473
474         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
475           equivalent.
476
477 2017-02-12  Dan Bernstein  <mitz@apple.com>
478
479         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
480
481         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
482
483 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
484
485         parserRemoveChild should unload subframes
486         https://bugs.webkit.org/show_bug.cgi?id=168151
487
488         Reviewed by Darin Adler.
489
490         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
491
492         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
493
494         Tests: fast/parser/adoption-agency-clear-focus-range.html
495                fast/parser/adoption-agency-unload-iframe-1.html
496                fast/parser/adoption-agency-unload-iframe-2.html
497
498         * dom/ContainerNode.cpp:
499         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
500
501         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
502         the focused element, and other states in the document.
503
504         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
505         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
506         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
507         response to the unload event we just dispatched.
508
509         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
510
511         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
512         in each call site of willRemoveChild and willRemoveChildren.
513         (WebCore::willRemoveChildren): Ditto.
514         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
515         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
516         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
517
518         * html/parser/HTMLConstructionSite.cpp:
519         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
520
521 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
522
523         REGRESSION (r179497): Crash inside setAttributeNode
524         https://bugs.webkit.org/show_bug.cgi?id=168161
525         <rdar://problem/30451581>
526
527         Reviewed by Andreas Kling.
528
529         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
530         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
531         and mutated element's m_elementData.
532
533         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
534
535         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
536
537         * dom/Element.cpp:
538         (WebCore::Element::setAttributeNode):
539
540 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
541
542         Rebaseline bindings tests after r212207.
543
544         * bindings/scripts/test/JS/JSTestObj.cpp:
545         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
546
547 2017-02-12  Dan Bernstein  <mitz@apple.com>
548
549         [Cocoa] Some -respondsToSelector: checks are unnecessary
550         https://bugs.webkit.org/show_bug.cgi?id=168183
551
552         Reviewed by Tim Horton.
553
554         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
555           change to WebKit2/Platform/mac/MenuUtilities.mm.
556
557         * editing/mac/DictionaryLookup.mm:
558         (WebCore::showPopupOrCreateAnimationController): Removed check whether
559           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
560
561         * platform/cocoa/NetworkExtensionContentFilter.mm:
562         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
563           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
564           -setSourceAppBundleID:, which does not exist.
565
566         * platform/cocoa/ScrollController.mm:
567         (systemUptime): Deleted.
568         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
569
570         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
571         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
572
573         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
574         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
575         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
576         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
577           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
578         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
579           check.
580
581         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
582         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
583
584         * platform/graphics/mac/WebGLLayer.mm:
585         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
586
587         * platform/mac/PlatformEventFactoryMac.mm:
588         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
589           all code to handle that case that it doesn’t.
590
591         * platform/mac/WebVideoFullscreenController.mm:
592         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
593           NSWindow responds to -isOnActiveSpace.
594         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
595           NSApplication responds to -setPresentationOptions:
596
597         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
598         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
599           unnecessary -respondsToSelector: check.
600         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
601         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
602
603         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
604           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
605           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
606
607         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
608           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
609           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
610
611         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
612
613         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
614           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
615           Removed an unused declaration.
616
617         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
618           !USE(APPLE_INTERNAL_SDK) section.
619
620         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
621           Apple internal SDK. Cleaned up the declarations for the other case.
622
623         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
624           internal SDK.
625
626 2017-02-11  Sam Weinig  <sam@webkit.org>
627
628         Remove the remaining functions out of JSDOMBinding
629         https://bugs.webkit.org/show_bug.cgi?id=168179
630
631         Reviewed by Darin Adler.
632
633         Move utility functions into more appropriate locations.
634         - Move hasIteratorMethod to runtime/IteratorOperations.h
635         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
636         - Move addImpureProperty to CommonVM
637
638         Remove toJS overload that took a Vector<T>. Replace it's usage
639         with toJS<IDLSequence<T>> usage. To make this work, added two
640         new types, IDLIDBKeyData and IDLIDBValue.
641
642         * Modules/indexeddb/IDBCursor.cpp:
643         (WebCore::IDBCursor::setGetResult):
644         * Modules/indexeddb/IDBRequest.cpp:
645         (WebCore::IDBRequest::setResult):
646         (WebCore::IDBRequest::setResultToStructuredClone):
647         Adopt JSDOMConvert infrastructure for conversions using new types.
648
649         * bindings/IDLTypes.h:
650         * bindings/js/JSDOMConvertIndexedDB.h:
651         (WebCore::JSConverter<IDLIDBKeyData>::convert):
652         (WebCore::JSConverter<IDLIDBValue>::convert):
653         Add new types for IDBKeyData and IDBValue.
654
655         * bindings/js/CommonVM.cpp:
656         (WebCore::addImpureProperty):
657         * bindings/js/CommonVM.h:
658         Move addImpureProperty here from JSDOMBinding.
659
660         * bindings/js/IDBBindingUtilities.cpp:
661         (WebCore::idbKeyDataToScriptValue): Deleted.
662         * bindings/js/IDBBindingUtilities.h:
663         Remove unused idbKeyDataToScriptValue, and group like functions
664         together.
665
666         * bindings/js/JSDOMBinding.cpp: Removed.
667         * bindings/js/JSDOMBinding.h:
668         (WebCore::nonCachingStaticFunctionGetter): Deleted.
669         (WebCore::toJS): Deleted.
670         Move/remove functions.
671
672         * bindings/js/JSDOMConvertUnion.h:
673         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
674
675         * bindings/js/JSDOMWindowCustom.cpp:
676         * bindings/js/JSHTMLDocumentCustom.cpp:
677         * bindings/js/JSLocationCustom.cpp:
678         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
679
680         * bindings/js/JSSubtleCryptoCustom.cpp:
681         Remove unneeded include of runtime/IteratorOperations.h
682
683         * bindings/scripts/CodeGeneratorJS.pm:
684         (GenerateOverloadedFunctionOrConstructor):
685         Include runtime/IteratorOperations when needing to distinguish a sequence.
686
687         * html/HTMLDocument.cpp:
688         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
689
690 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
691
692         [GTK] Handle caps lock indicator in event modifiers
693         https://bugs.webkit.org/show_bug.cgi?id=168186
694
695         Reviewed by Michael Catanzaro.
696
697         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
698         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
699         implementations to add the appropriate modifiers.
700
701         Fixes: fast/events/special-key-events-in-input-text.html
702
703         * platform/PlatformKeyboardEvent.h:
704         * platform/gtk/PlatformKeyboardEventGtk.cpp:
705         (WebCore::modifiersForGdkKeyEvent):
706         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
707         * platform/gtk/PlatformMouseEventGtk.cpp:
708         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
709         * platform/gtk/PlatformWheelEventGtk.cpp:
710         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
711
712 2017-02-11  Sam Weinig  <sam@webkit.org>
713
714         Remove custom bindings for XSLTProcessor.idl
715         https://bugs.webkit.org/show_bug.cgi?id=168174
716
717         Reviewed by Andreas Kling.
718
719         * CMakeLists.txt:
720         * WebCore.xcodeproj/project.pbxproj:
721         * bindings/js/JSBindingsAllInOne.cpp:
722         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
723         Remove file.
724  
725         * bindings/js/JSDOMBinding.cpp:
726         (WebCore::jsStringOrUndefined): Deleted.
727         * bindings/js/JSDOMBinding.h:
728         Remove now unused jsStringOrUndefined.
729
730         * xml/XSLTProcessor.cpp:
731         (WebCore::XSLTProcessor::setParameter):
732         (WebCore::XSLTProcessor::getParameter):
733         (WebCore::XSLTProcessor::removeParameter):
734         * xml/XSLTProcessor.idl:
735         Replace custom bindings bindings with early returns. One subtle difference
736         between the custom bindings and this, is that getParameter will return 
737         jsNull() rather than jsUndefined() for null String returns. This matches
738         all other bindings.
739
740 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
741
742         [GStreamer][MSE][EME] Fix decryptor assignment
743         https://bugs.webkit.org/show_bug.cgi?id=168122
744
745         Reviewed by Michael Catanzaro.
746
747         The new decryptor is a floating reference so we should not use the
748         adopt GRefPtr constructor, but use the regular assignment operator
749         that will sink the object (clear the floating flag).
750
751         This fixes assertions in debug build.
752
753         See previous pipeline fix in r210851 and WPE commit
754         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
755
756         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
757         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
758         Do not use adoptGRef(), it prevented the object from being sunk.
759
760 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
761
762         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
763         https://bugs.webkit.org/show_bug.cgi?id=168177
764
765         Reviewed by Sam Weinig.
766
767         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
768         when navigating within the page. If the URL had no fragment identifier, this code would
769         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
770         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
771         the restores the scroll position from history.
772         
773         This scroll to 0,0 happened to be not visible to the page because of scroll event
774         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
775         by just returning early from FrameView::scrollToFragment() if there is no fragment,
776         making sure to clear the document's CSSTarget.
777
778         * dom/Document.cpp:
779         (WebCore::Document::setCSSTarget):
780         * page/FrameView.cpp:
781         (WebCore::FrameView::scrollToFragment):
782         (WebCore::FrameView::scrollToAnchor):
783
784 2017-02-11  Chris Dumez  <cdumez@apple.com>
785
786         Implement URL's toJSON()
787         https://bugs.webkit.org/show_bug.cgi?id=167979
788
789         Reviewed by Sam Weinig.
790
791         Implement URL's toJSON() as per:
792         - https://url.spec.whatwg.org/#dom-url-tojson
793
794         This is already supported by Firefox.
795
796         Also, drop URLUtils.idl as it is no longer in the specification.
797         Merge its content to DOMURL.idl as per the URL specification.
798
799         Finally, mark href attribute as stringifier and drop the toString()
800         operation to match the specification. This fixes a bug where our
801         toString property was not enumerable but should have been.
802
803         Tests: fast/url/url-tojson.html
804                imported/w3c/web-platform-tests/url/url-tojson.html
805
806         * CMakeLists.txt:
807         * DerivedSources.make:
808         * WebCore.xcodeproj/project.pbxproj:
809         * html/DOMURL.idl:
810         * html/URLUtils.h:
811         (WebCore::URLUtils<T>::toJSON):
812         * html/URLUtils.idl: Removed.
813
814 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
815
816         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
817         https://bugs.webkit.org/show_bug.cgi?id=168163
818
819         Reviewed by Michael Catanzaro.
820
821         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
822         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
823         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
824         what platforms should implement.
825
826         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
827                fast/dom/HTMLAnchorElement/anchor-download.html
828                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
829                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
830
831         * platform/MIMETypeRegistry.cpp:
832         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
833         * platform/cocoa/MIMETypeRegistryCocoa.mm:
834         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
835         * platform/efl/MIMETypeRegistryEfl.cpp:
836         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
837         * platform/gtk/MIMETypeRegistryGtk.cpp:
838         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
839
840 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
841
842         Unreviewed. Update imageTitle translatable string.
843
844         To match mac port. Fixes fast/images/imageDocument-title.html.
845
846         * platform/gtk/LocalizedStringsGtk.cpp:
847         (WebCore::imageTitle):
848
849 2017-02-10  John Wilander  <wilander@apple.com>
850
851         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
852         https://bugs.webkit.org/show_bug.cgi?id=167474
853         <rdar://problem/24681808>
854         <rdar://problem/24703286>
855         <rdar://problem/30290270>
856
857         This patch does the following:
858         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
859             does not provide the right data store.
860         2. Introduces timeout for user interaction. A domain needs interaction every 30
861             days to stay in that category.
862         3. Adds grandfathered to the statistics model in preparation for grandfathering of
863             existing data records.
864         4. Adds test infrastructure to allow testing of the various rules in place for
865             data records removal.
866         5. Fixes various smaller bugs that were found as part of setting up the tests.
867         6. Regresses the data records removal counting. We need to come up with a thread
868             safe way of gathering removal statistics from more than one data store now
869             that we potentially interact with multiple stores.
870         7. Adds a first set of layout tests for resource load statistics.
871
872         Reviewed by Andy Estes.
873
874         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
875                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
876                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
877                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
878                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
879
880         * dom/Document.cpp:
881         (WebCore::Document::updateLastHandledUserGestureTimestamp):
882             This now calls ResourceLoadObserver::logUserInteraction() every time since
883             we want to keep track of the most recent user interaction.
884         * loader/ResourceLoadObserver.cpp:
885         (WebCore::ResourceLoadObserver::statisticsStore):
886             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
887         (WebCore::reduceTimeResolutionToOneDay):
888             Convenience function.
889         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
890             Reduces time resolution for privacy reasons.
891         (WebCore::ResourceLoadObserver::logUserInteraction):
892         (WebCore::ResourceLoadObserver::clearUserInteraction):
893         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
894         (WebCore::ResourceLoadObserver::setPrevalentResource):
895         (WebCore::ResourceLoadObserver::isPrevalentResource):
896         (WebCore::ResourceLoadObserver::clearPrevalentResource):
897         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
898         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
899             New functions that allow WebKitTestRunner to stage exact
900             statistics, fire the handler, and test the outcome.
901         * loader/ResourceLoadObserver.h:
902         * loader/ResourceLoadStatistics.cpp:
903         (WebCore::ResourceLoadStatistics::encode):
904         (WebCore::ResourceLoadStatistics::decode):
905         (WebCore::ResourceLoadStatistics::toString):
906         (WebCore::ResourceLoadStatistics::merge):
907             Support for statistics mostRecentUserInteraction, grandfathered, and
908             dataRecordsRemoved.
909         * loader/ResourceLoadStatistics.h:
910         * loader/ResourceLoadStatisticsStore.cpp:
911         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
912             New function that allows WebKitTestRunner to test 
913             aging out of user interaction.
914         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
915             Now takes into account the timestamp and ages
916             out user interaction.
917         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
918             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
919         * loader/ResourceLoadStatisticsStore.h:
920
921 2017-02-10  Sam Weinig  <sam@webkit.org>
922
923         [WebIDL] Cleanup XMLHttpRequest's bindings
924         https://bugs.webkit.org/show_bug.cgi?id=168067
925
926         Reviewed by Chris Dumez.
927
928         * bindings/js/JSDOMBinding.cpp:
929         (WebCore::jsOwnedStringOrNull): Deleted.
930         * bindings/js/JSDOMBinding.h:
931         Remove jsOwnedStringOrNull and inline it into it's one use
932         in JSXMLHttpRequestCustom.
933
934         * bindings/js/JSXMLHttpRequestCustom.cpp:
935         (WebCore::JSXMLHttpRequest::responseText):
936         (WebCore::SendFunctor::SendFunctor): Deleted.
937         (WebCore::SendFunctor::line): Deleted.
938         (WebCore::SendFunctor::column): Deleted.
939         (WebCore::SendFunctor::url): Deleted.
940         (WebCore::SendFunctor::operator()): Deleted.
941         (WebCore::JSXMLHttpRequest::send): Deleted.
942         * xml/XMLHttpRequest.cpp:
943         (WebCore::XMLHttpRequest::send):
944         * xml/XMLHttpRequest.h:
945         Remove custom send, replacing it with a single send implementation that
946         takes a variant.
947
948         * xml/XMLHttpRequest.idl:
949         Cleanup the IDL to better match the spec. Update correct types where trivial.
950
951 2017-02-10  Chris Dumez  <cdumez@apple.com>
952
953         document.origin doesn't match spec
954         https://bugs.webkit.org/show_bug.cgi?id=168022
955
956         Reviewed by Sam Weinig.
957
958         Update document.origin to return the origin in the expected format:
959         - https://dom.spec.whatwg.org/#dom-document-origin
960
961         Change: "https_webkit.org_0 -> "https://webkit.org".
962
963         The new behavior matches Firefox and Chrome.
964
965         No new tests, updated existing tests.
966
967         * dom/Document.cpp:
968         (WebCore::Document::origin):
969
970 2017-02-10  Daniel Bates  <dabates@apple.com>
971
972         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
973         (https://bugs.webkit.org/show_bug.cgi?id=166774)
974
975         * dom/Document.cpp:
976         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
977         the parameter cachedFrame is unused in non-debug build.
978
979 2017-02-10  Daniel Bates  <dabates@apple.com>
980
981         Detach frame from document when entering page cache
982         https://bugs.webkit.org/show_bug.cgi?id=166774
983         <rdar://problem/29904368>
984
985         Reviewed by Chris Dumez.
986
987         When a page enters the page cache it is unnecessary for it to hold a reference to its
988         associated frame because subsequent interactions with the page do not need to make use
989         of it. Once a page exits the page cache we associate it with its frame.
990
991         * dom/Document.cpp:
992         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
993         (WebCore::Document::attachToCachedFrame): Added.
994         (WebCore::Document::detachFromCachedFrame): Added.
995         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
996         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
997         the former.
998         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
999         (WebCore::Document::markHasCalledWindowOpen): Deleted.
1000         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
1001         * dom/Document.h:
1002         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
1003         visibility from public to private and made this function inline.
1004         * history/CachedFrame.cpp:
1005         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
1006         removed from the page when it was in the page cache as there is no need to restore such frames.
1007         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
1008         frame tree.
1009         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
1010         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
1011         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
1012         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
1013         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
1014         detach the animation controller from the document as it is being destroyed. We have to do this here
1015         because the document does not have a frame. And Document::prepareForDestruction() only calls
1016         CSSAnimationController::detachFromDocument() if the document has a frame.
1017         * history/CachedFrame.h:
1018         * history/PageCache.cpp:
1019         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
1020         or has an opener as it is feasible to keep such pages in the page cache.
1021         * html/HTMLFrameElementBase.cpp:
1022         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
1023         * loader/FrameLoader.cpp:
1024         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
1025         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
1026         and its active DOM objects are suspended. Also fix style nit in comment.
1027         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
1028         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
1029         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
1030         * page/DOMWindow.cpp:
1031         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
1032         function will be removed.
1033         * page/DiagnosticLoggingKeys.cpp:
1034         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
1035         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
1036         * page/DiagnosticLoggingKeys.h:
1037         * page/Page.cpp:
1038         (WebCore::Page::openedByWindowOpen): Deleted.
1039         * page/Page.h:
1040         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
1041
1042 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
1043
1044         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
1045         https://bugs.webkit.org/show_bug.cgi?id=168054
1046
1047         Reviewed by Tim Horton.
1048
1049         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
1050         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
1051         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
1052
1053         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
1054         viewport-constrained state as for its host layer (we already assume that their geometry matches).
1055
1056         Tested by compositing/masks/solid-color-masked.html
1057
1058         * platform/graphics/ca/GraphicsLayerCA.cpp:
1059         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
1060         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1061
1062 2017-02-10  Commit Queue  <commit-queue@webkit.org>
1063
1064         Unreviewed, rolling out r212154, r212154, and r212156.
1065         https://bugs.webkit.org/show_bug.cgi?id=168156
1066
1067         broke internal builds (Requested by smfr on #webkit).
1068
1069         Reverted changesets:
1070
1071         "Add a DragImage class that wraps a DragImageRef"
1072         https://bugs.webkit.org/show_bug.cgi?id=168131
1073         http://trac.webkit.org/changeset/212154
1074
1075         "Add a DragImage class that wraps a DragImageRef"
1076         https://bugs.webkit.org/show_bug.cgi?id=168131
1077         http://trac.webkit.org/changeset/212154
1078
1079         "Try to fix the iOS and Windows builds."
1080         http://trac.webkit.org/changeset/212156
1081
1082 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
1083
1084         Fix the !ENABLE(WEBGL) build
1085         https://bugs.webkit.org/show_bug.cgi?id=168112
1086
1087         Reviewed by Alex Christensen.
1088
1089         * html/canvas/WebGLRenderingContextBase.h:
1090
1091 2017-02-10  Youenn Fablet  <youenn@apple.com>
1092
1093         [Fetch API] fetch fails when undefined is passed as headers
1094         https://bugs.webkit.org/show_bug.cgi?id=168043
1095
1096         Reviewed by Geoffrey Garen.
1097
1098         Covered by updated test.
1099
1100         * Modules/fetch/FetchInternals.js:
1101         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
1102
1103 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
1104
1105         Fix the !ENABLE(WEB_TIMING) build
1106         https://bugs.webkit.org/show_bug.cgi?id=168113
1107
1108         Reviewed by Alex Christensen.
1109
1110         * workers/WorkerGlobalScope.cpp:
1111         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1112
1113 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
1114
1115         Update features.json for Performance Timing APIs
1116         https://bugs.webkit.org/show_bug.cgi?id=168148
1117
1118         Reviewed by Simon Fraser.
1119
1120         * features.json:
1121
1122 2017-02-10  Anders Carlsson  <andersca@apple.com>
1123
1124         Try to fix the iOS and Windows builds.
1125
1126         * platform/ios/DragImageIOS.mm:
1127         (WebCore::deleteDragImage):
1128         * platform/win/PasteboardWin.cpp:
1129         (WebCore::Pasteboard::setDragImage):
1130
1131 2017-02-10  Anders Carlsson  <andersca@apple.com>
1132
1133         Add a DragImage class that wraps a DragImageRef
1134         https://bugs.webkit.org/show_bug.cgi?id=168131
1135
1136         Reviewed by Beth Dakin.
1137
1138         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
1139         various drag code paths possible. No functionality change.
1140
1141         * dom/DataTransfer.cpp:
1142         (WebCore::DataTransfer::updateDragImage):
1143         * page/DragController.cpp:
1144         (WebCore::DragController::startDrag):
1145         (WebCore::DragController::doImageDrag):
1146         (WebCore::DragController::doSystemDrag):
1147         * page/DragController.h:
1148         * platform/DragImage.cpp:
1149         (WebCore::DragImage::DragImage):
1150         (WebCore::DragImage::operator=):
1151         (WebCore::DragImage::~DragImage):
1152         * platform/DragImage.h:
1153         * platform/Pasteboard.h:
1154         * platform/StaticPasteboard.h:
1155         * platform/mac/PasteboardMac.mm:
1156         (WebCore::Pasteboard::setDragImage):
1157
1158 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
1159
1160         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
1161         https://bugs.webkit.org/show_bug.cgi?id=168127
1162         rdar://problem/30467120
1163
1164         Reviewed by Tim Horton.
1165         
1166         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
1167         which forgot to hit masks and replica layers with a generic traverse() function, which
1168         is then used for setting 'inWindow' as well as resetting tracked repaints.
1169
1170         Tests: compositing/tiling/tiled-mask-inwindow.html
1171                compositing/tiling/tiled-reflection-inwindow.html
1172
1173         * page/PageOverlayController.cpp:
1174         (WebCore::PageOverlayController::layerWithDocumentOverlays):
1175         (WebCore::PageOverlayController::layerWithViewOverlays):
1176         * platform/graphics/GraphicsLayer.cpp:
1177         (WebCore::GraphicsLayer::setIsInWindow):
1178         (WebCore::GraphicsLayer::setReplicatedByLayer):
1179         (WebCore::GraphicsLayer::traverse):
1180         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
1181         * platform/graphics/GraphicsLayer.h:
1182         * rendering/RenderLayerCompositor.cpp:
1183         (WebCore::RenderLayerCompositor::setIsInWindow):
1184         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
1185         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
1186
1187 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
1188
1189         Tiled layers are sometimes left with some tiles when outside the viewport
1190         https://bugs.webkit.org/show_bug.cgi?id=168104
1191         rdar://problem/30459055
1192
1193         Reviewed by Tim Horton.
1194
1195         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
1196         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
1197         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
1198         
1199         Minor logging changes.
1200
1201         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
1202
1203         * platform/graphics/ca/TileGrid.cpp:
1204         (WebCore::TileGrid::revalidateTiles):
1205
1206 2017-02-10  Zalan Bujtas  <zalan@apple.com>
1207
1208         Mail hangs when removing multiple rows from large table.
1209         https://bugs.webkit.org/show_bug.cgi?id=168103
1210         <rdar://problem/30090186>
1211
1212         Reviewed by Ryosuke Niwa.
1213
1214         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
1215         but instead it removes their content. In order to be able to continue editing the table after
1216         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
1217         each table item recursively.
1218         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
1219
1220         Performance test added.
1221
1222         * editing/DeleteSelectionCommand.cpp:
1223         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
1224         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
1225         (WebCore::shouldRemoveContentOnly):
1226         (WebCore::DeleteSelectionCommand::removeNode):
1227         * editing/DeleteSelectionCommand.h:
1228
1229 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
1230
1231         [Resource Timing] Enable Resource Timing by default in Tests
1232         https://bugs.webkit.org/show_bug.cgi?id=168145
1233
1234         Reviewed by Ryosuke Niwa.
1235
1236         * loader/ResourceTimingInformation.cpp:
1237         (WebCore::ResourceTimingInformation::addResourceTiming):
1238         * testing/InternalSettings.cpp:
1239         (WebCore::InternalSettings::Backup::Backup):
1240         (WebCore::InternalSettings::Backup::restoreTo):
1241         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
1242         * testing/InternalSettings.h:
1243         * testing/InternalSettings.idl:
1244         No longer needed for tests.
1245
1246 2017-02-10  Dan Bernstein  <mitz@apple.com>
1247
1248         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
1249         https://bugs.webkit.org/show_bug.cgi?id=168097
1250
1251         Reviewed by Tim Horton.
1252
1253         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
1254         indicate that changes should be agreed to by the delegate.
1255
1256         * editing/FrameSelection.cpp:
1257         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
1258           shouldChangeSelection.
1259         * editing/FrameSelection.h:
1260
1261 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
1262
1263         Removing LayoutTestRelay
1264         https://bugs.webkit.org/show_bug.cgi?id=165927
1265
1266         Reviewed by Daniel Bates.
1267         Part 2
1268
1269         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
1270         simulators through simctl (iOS 10 and later), use this functionality instead.
1271
1272         * platform/RuntimeApplicationChecks.mm:
1273         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
1274
1275 2017-02-10  Youenn Fablet  <youenn@apple.com>
1276
1277         [WebRTC] Implement Outgoing libwebrtc audio source support
1278         https://bugs.webkit.org/show_bug.cgi?id=168118
1279
1280         Reviewed by Eric Carlson.
1281
1282         No new automated tests as we need the audio rendering to work to test the whole loop.
1283
1284         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
1285         Capturing and pushing data happens in the capture thread.
1286         Pulling of converted data happens in libwebrtc thread.
1287
1288         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
1289
1290         * WebCore.xcodeproj/project.pbxproj:
1291         * platform/audio/WebAudioBufferList.cpp:
1292         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
1293         * platform/audio/mac/AudioSampleBufferList.cpp:
1294         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
1295         * platform/audio/mac/AudioSampleDataSource.cpp:
1296         (WebCore::AudioSampleDataSource::pushSamples):
1297         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
1298         * platform/audio/mac/AudioSampleDataSource.h:
1299         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
1300         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1301         (WebCore::libwebrtcAudioFormat):
1302         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1303         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1304         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1305         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1306         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1307
1308 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
1309
1310         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
1311         https://bugs.webkit.org/show_bug.cgi?id=168099
1312
1313         Reviewed by Sam Weinig.
1314
1315         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
1316         of using HTMLConstructionSiteTask::Insert when fostering a child.
1317
1318         Also combine the step to take all children and re-parenting into a single task instead of
1319         separately issuing TakeAllChildren and Reparent tasks.
1320
1321         No new tests since this is a refactoring.
1322
1323         * html/parser/HTMLConstructionSite.cpp:
1324         (WebCore::insert): Now asserts that the child node never have a parent.
1325         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
1326         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
1327         now that this function also does the reparenting.
1328         (WebCore::executeTask):
1329         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
1330         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
1331         instead of calling fosterParent which uses Insert when fostering parents.
1332         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
1333         * html/parser/HTMLConstructionSite.h:
1334         (WebCore::HTMLConstructionSiteTask:Operation):
1335         * html/parser/HTMLTreeBuilder.cpp:
1336         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
1337
1338 2017-02-10  Dave Hyatt  <hyatt@apple.com>
1339
1340         [CSS Parser] Make intercap property values serialize correctly
1341         https://bugs.webkit.org/show_bug.cgi?id=168073
1342
1343         Reviewed by Zalan Bujtas.
1344
1345         Fix CSS value keywords to preserve case when the value contains capital
1346         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
1347
1348         * css/CSSPrimitiveValueMappings.h:
1349         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1350         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
1351         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
1352         (WebCore::CSSPrimitiveValue::operator EImageRendering):
1353         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
1354         (WebCore::CSSPrimitiveValue::operator EColorRendering):
1355         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
1356         * css/MediaQueryEvaluator.cpp:
1357         (WebCore::colorGamutEvaluate):
1358         * css/SVGCSSValueKeywords.in:
1359         * css/TransformFunctions.cpp:
1360         (WebCore::transformOperationType):
1361         (WebCore::transformsForValue):
1362         * css/makevalues.pl:
1363         * css/parser/CSSParserFastPaths.cpp:
1364         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1365         (WebCore::parseTransformTranslateArguments):
1366         (WebCore::parseSimpleTransformValue):
1367         * css/parser/CSSPropertyParser.cpp:
1368         (WebCore::consumeTransformValue):
1369         * css/parser/CSSPropertyParserHelpers.cpp:
1370         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
1371
1372 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1373
1374         [EME] Implement MediaKeySession::load()
1375         https://bugs.webkit.org/show_bug.cgi?id=168041
1376
1377         Reviewed by Xabier Rodriguez-Calvar.
1378
1379         Implement the MediaKeySession::load() method, tracing the steps as they
1380         are defined in the EME specification. The only exception is step 8.3,
1381         which requires additional facility that tracks currently open sessions
1382         and provides information whether for a given session ID there's already
1383         a MediaKeySession that's not yet been closed.
1384
1385         Session ID sanitization is done through the CDM::sanitizeSessionId()
1386         method, which relays the task to the CDMPrivate implementation.
1387
1388         The CDMInstance::loadSession() virtual method is called with the session
1389         type, sanitized ID, the Document's origin (in string form) and the
1390         callback that's invoked upon completion of the task. The callback
1391         checks whether the operation was successful, or examines the reason for
1392         the load failure in case it wasn't, rejecting the promise in the latter
1393         case either immediately or in the following task at the latest.
1394
1395         When the load was successful, the optional known keys, expiration time
1396         and message are handled appropriately, and the promise is resolved.
1397
1398         MockCDM::sanitizeSessionId() implementation only treats
1399         'valid-loaded-session' as a valid session ID.
1400         MockCDMInstance::loadSession() implementation is kept slim for now, only
1401         providing the 'license-renewal' message when invoking the passed-in
1402         callback. Known keys and expiration time will also be tested once the
1403         relevant MediaKeySession algorithms are implemented.
1404
1405         Test: media/encrypted-media/mock-MediaKeySession-load.html
1406
1407         * Modules/encryptedmedia/CDM.cpp:
1408         (WebCore::CDM::sanitizeSessionId):
1409         * Modules/encryptedmedia/CDM.h:
1410         * Modules/encryptedmedia/CDMInstance.h:
1411         * Modules/encryptedmedia/CDMPrivate.h:
1412         * Modules/encryptedmedia/MediaKeySession.cpp:
1413         (WebCore::MediaKeySession::load):
1414         * testing/MockCDMFactory.cpp:
1415         (WebCore::MockCDM::sanitizeSessionId):
1416         (WebCore::MockCDMInstance::loadSession):
1417         * testing/MockCDMFactory.h:
1418
1419 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1420
1421         [EME] Implement MediaKeySession::sessionClosed()
1422         https://bugs.webkit.org/show_bug.cgi?id=168039
1423
1424         Reviewed by Xabier Rodriguez-Calvar.
1425
1426         Implement the 'session closed' algorithm for MediaKeySession by
1427         following the specified steps. After this algorithm is run, the
1428         session should be considered closed, which we track via the m_closed
1429         member variable on the class. This is set to true before the promise
1430         that's accessible through the 'closed' attribute is resolved.
1431
1432         Because the algorithm requires the CDM instance to store any record
1433         of key usage when the session's type is 'persistent-usage-record', the
1434         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
1435         interface. MockCDMInstance implementation is left unimplemented for now.
1436
1437         JSMediaKeySession::closed() accessor now has a custom implementation
1438         that creates a deferred promise for that object if there's none yet, and
1439         shares it with the wrapped class through the registerClosedPromise()
1440         method, storing a reference to the promise in the m_closedPromise
1441         member variable, or resolving the promise immediately if the session was
1442         already closed.
1443
1444         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
1445
1446         * Modules/encryptedmedia/CDMInstance.h:
1447         * Modules/encryptedmedia/MediaKeySession.cpp:
1448         (WebCore::MediaKeySession::registerClosedPromise):
1449         (WebCore::MediaKeySession::sessionClosed):
1450         * Modules/encryptedmedia/MediaKeySession.h:
1451         * bindings/js/JSMediaKeySessionCustom.cpp:
1452         (WebCore::JSMediaKeySession::closed):
1453         * testing/MockCDMFactory.cpp:
1454         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
1455         * testing/MockCDMFactory.h:
1456
1457 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
1458
1459         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
1460         https://bugs.webkit.org/show_bug.cgi?id=167888
1461
1462         Reviewed by Xabier Rodriguez-Calvar.
1463
1464         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
1465         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
1466         A keystatuseschange event is fired on the MediaKeySession object afterwards.
1467         The queueing of the task that runs the 'attemp to resume playback' on the
1468         related HTMLMediaElement objects isn't done yet since that algorithm isn't
1469         implemented yet.
1470
1471         The statuses Vector is stored on the MediaKeySession object. That Vector is
1472         then exposed through the MediaKeyStatusMap object, each such object being
1473         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
1474         thus keeps a reference to the session object as long as that object is alive,
1475         and queries the MediaKeySession::statuses() getter to access the Vector that
1476         contains status information for all the key IDs.
1477
1478         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
1479         object and accesses the statuses by indexing into the status Vector of the
1480         related MediaKeySession object.
1481
1482         CDMInstance::updateLicense() now accepts the session ID string as the first
1483         argument, making it possible to specify which session should be updated.
1484
1485         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
1486         Vector value in the session map that lists all the key IDs that are being
1487         stored for that session.
1488
1489         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
1490         passed-in response data, and upon detecting that constructs a KeyStatusVector
1491         object containing all the keys for that session. KeyStatus::Usable is returned
1492         for each object at the moment, but this should be adjustable in the future
1493         through additional parameters passed through the response data. The Vector
1494         object is then passed to the callback and is then passed to the 'update key
1495         statuses' algorithm in MediaKeySession.
1496
1497         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
1498
1499         * Modules/encryptedmedia/CDMInstance.h:
1500         * Modules/encryptedmedia/MediaKeySession.cpp:
1501         (WebCore::MediaKeySession::MediaKeySession):
1502         (WebCore::MediaKeySession::~MediaKeySession):
1503         (WebCore::MediaKeySession::update):
1504         (WebCore::MediaKeySession::updateKeyStatuses):
1505         * Modules/encryptedmedia/MediaKeySession.h:
1506         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
1507         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
1508         (WebCore::MediaKeyStatusMap::detachSession):
1509         (WebCore::MediaKeyStatusMap::size):
1510         (WebCore::keyIdsMatch):
1511         (WebCore::MediaKeyStatusMap::has):
1512         (WebCore::MediaKeyStatusMap::get):
1513         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
1514         (WebCore::MediaKeyStatusMap::Iterator::next):
1515         * Modules/encryptedmedia/MediaKeyStatusMap.h:
1516         (WebCore::MediaKeyStatusMap::create):
1517         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
1518         * testing/MockCDMFactory.cpp:
1519         (WebCore::MockCDMFactory::keysForSessionWithID):
1520         (WebCore::MockCDMInstance::updateLicense):
1521         * testing/MockCDMFactory.h:
1522
1523 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
1524
1525         Improve IOSurfacePool logging
1526         https://bugs.webkit.org/show_bug.cgi?id=168098
1527
1528         Reviewed by Tim Horton.
1529
1530         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
1531         logging.
1532
1533         * platform/graphics/cg/IOSurfacePool.cpp:
1534         (WebCore::IOSurfacePool::takeSurface):
1535         (WebCore::IOSurfacePool::addSurface):
1536         (WebCore::IOSurfacePool::evict):
1537         (WebCore::IOSurfacePool::collectionTimerFired):
1538         (WebCore::IOSurfacePool::showPoolStatistics):
1539         * platform/graphics/cg/IOSurfacePool.h:
1540
1541 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1542
1543         Unreviewed, rolling out r212040.
1544
1545         Broke build.  I'm not surprised
1546
1547         Reverted changeset:
1548
1549         "[WebRTC][Mac] Activate libwebrtc"
1550         https://bugs.webkit.org/show_bug.cgi?id=167293
1551         http://trac.webkit.org/changeset/212040
1552
1553 2017-02-09  Chris Dumez  <cdumez@apple.com>
1554
1555         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
1556         https://bugs.webkit.org/show_bug.cgi?id=168077
1557         <rdar://problem/30412595>
1558
1559         Reviewed by Alex Christensen.
1560
1561         Add utility function to MIMETypeRegistry that appends an extension to
1562         a filename if necessary, based on a provided MIME type.
1563
1564         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
1565                http/tests/download/anchor-download-no-extension.html
1566
1567         * platform/MIMETypeRegistry.cpp:
1568         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1569         * platform/MIMETypeRegistry.h:
1570         * platform/cocoa/MIMETypeRegistryCocoa.mm:
1571         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
1572
1573 2017-02-09  Youenn Fablet  <youenn@apple.com>
1574
1575         [WebRTC][Mac] Activate libwebrtc
1576         https://bugs.webkit.org/show_bug.cgi?id=167293
1577
1578         Reviewed by Alex Christensen.
1579
1580         * Configurations/WebCore.xcconfig:
1581         * Configurations/WebCoreTestSupport.xcconfig:
1582
1583 2017-02-09  Philip Rogers  <pdr@google.com>
1584
1585         SVG clip-path references can clip out later content
1586         https://bugs.webkit.org/show_bug.cgi?id=164181
1587
1588         Reviewed by Said Abou-Hallawa.
1589
1590         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
1591         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
1592         and its caller restores it back so later content is not clipped as well.
1593
1594         This patch is based on a chromium patch by fs@opera.com:
1595         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
1596
1597         Test: css3/masking/clip-path-reference-restore.html
1598
1599         * rendering/RenderLayer.cpp:
1600         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
1601
1602 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
1603
1604         SharedArrayBuffer does not need to be in the transfer list
1605         https://bugs.webkit.org/show_bug.cgi?id=168079
1606
1607         Reviewed by Geoffrey Garen and Keith Miller.
1608
1609         Tests: workers/sab/multi-memory-multi-buffer.html
1610                workers/sab/multi-memory.html
1611                workers/sab/no-transfer.html
1612                workers/sab/postMessage-clones.html
1613                workers/sab/sent-from-worker-no-transfer.html
1614                workers/sab/sent-from-worker-transfer.html
1615
1616         The SAB API that we originally implemented required that SABs get put in transfer lists
1617         when they are sent to workers.
1618         
1619         The new SAB API that everyone is converging towards requires that you do not put the
1620         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
1621         is part of any message to or from a dedicated worker then it is automatically shared.
1622         
1623         The new API provides a lot more clarity about what is supposed to happen in contexts
1624         that support transfering but don't support sharing.
1625         
1626         Right now this patch allows both styles to work, but I hope we can disable the transfer
1627         list capability soon.
1628
1629         * bindings/js/IDBBindingUtilities.cpp:
1630         (WebCore::deserializeIDBValueToJSValue):
1631         * bindings/js/JSMessageEventCustom.cpp:
1632         (WebCore::JSMessageEvent::data):
1633         * bindings/js/SerializedScriptValue.cpp:
1634         (WebCore::CloneSerializer::serialize):
1635         (WebCore::CloneSerializer::CloneSerializer):
1636         (WebCore::CloneSerializer::dumpIfTerminal):
1637         (WebCore::CloneDeserializer::deserialize):
1638         (WebCore::CloneDeserializer::CloneDeserializer):
1639         (WebCore::CloneDeserializer::readTerminal):
1640         (WebCore::SerializedScriptValue::SerializedScriptValue):
1641         (WebCore::SerializedScriptValue::create):
1642         (WebCore::SerializedScriptValue::deserialize):
1643         * bindings/js/SerializedScriptValue.h:
1644         (): Deleted.
1645         * dom/CustomEvent.cpp:
1646         (WebCore::CustomEvent::trySerializeDetail):
1647         * dom/ErrorEvent.cpp:
1648         (WebCore::ErrorEvent::trySerializeError):
1649         * dom/MessageEvent.cpp:
1650         (WebCore::MessageEvent::trySerializeData):
1651         * dom/PopStateEvent.cpp:
1652         (WebCore::PopStateEvent::trySerializeState):
1653         * workers/DedicatedWorkerGlobalScope.cpp:
1654         (WebCore::DedicatedWorkerGlobalScope::postMessage):
1655         * workers/Worker.cpp:
1656         (WebCore::Worker::postMessage):
1657
1658 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1659
1660         Unreviewed build fix after r212025.
1661
1662         inDocument -> isConnected
1663
1664         * html/FormAssociatedElement.cpp:
1665         (WebCore::FormAssociatedElement::didMoveToNewDocument):
1666         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
1667         * html/HTMLFormElement.cpp:
1668         (WebCore::HTMLFormElement::formElementIndex):
1669
1670 2017-02-09  Chris Dumez  <cdumez@apple.com>
1671
1672         Make sure Event keeps its current target element alive
1673         https://bugs.webkit.org/show_bug.cgi?id=167885
1674         <rdar://problem/30376972>
1675
1676         Reviewed by Brent Fulgham.
1677
1678         Make sure Event keeps its current target element alive to avoid
1679         crashes if it is accessed by JS after it has been garbage collected.
1680
1681         Test: fast/events/currentTarget-gc-crash.html
1682
1683         * dom/Event.cpp:
1684         (WebCore::Event::setCurrentTarget):
1685         * dom/Event.h:
1686         (WebCore::Event::currentTarget):
1687
1688 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
1689
1690         Crash in render tree after dynamically mutating the slot value
1691         https://bugs.webkit.org/show_bug.cgi?id=167502
1692
1693         Reviewed by Antti Koivisto.
1694
1695         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
1696         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
1697         delete its render object as if the element had been removed from the DOM tree.
1698
1699         Tests: fast/html/details-summary-slot.html
1700                fast/shadow-dom/shadow-slot-attribute-change-crash.html
1701
1702         * dom/Element.cpp:
1703         (WebCore::Element::attributeChanged):
1704         * html/HTMLSummaryElement.cpp:
1705         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
1706         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
1707
1708 2017-02-09  Antti Koivisto  <antti@apple.com>
1709
1710         Details element doesn't work correctly when mutating content between closing and opening
1711         https://bugs.webkit.org/show_bug.cgi?id=167310
1712
1713         Reviewed by Ryosuke Niwa.
1714
1715         Tests: fast/html/details-close-modify-open.html
1716                fast/shadow-dom/slot-remove-mutate-add.html
1717
1718         * dom/SlotAssignment.cpp:
1719         (WebCore::SlotAssignment::didChangeSlot):
1720
1721             Always reset the slot assignment when content is mutated.
1722
1723 2017-02-09  Chris Dumez  <cdumez@apple.com>
1724
1725         Crash under FormSubmission::create()
1726         https://bugs.webkit.org/show_bug.cgi?id=167200
1727         <rdar://problem/30096323>
1728
1729         Reviewed by Darin Adler.
1730
1731         The issue is that FormSubmission::create() was iterating over
1732         form.associatedElements() as was calling Element::appendFormData()
1733         in the loop. HTMLObjectElement::appendFormData() was calling
1734         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
1735         layout and can fire events (such as focus event) synchronously.
1736         Firing those events synchronously allows the JS to modify the
1737         form.associatedElements() vector we are currently iterating on.
1738
1739         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
1740         in HTMLObjectElement::appendFormData() as we are not allowed to fire
1741         synchronous events at this point. I also added a security assertion
1742         in FormSubmission::create() to catch cases where we fire JS events
1743         while iterating over the form associated elements to more easily
1744         notice these things in the future.
1745
1746         Test: fast/forms/formsubmission-appendFormData-crash.html
1747
1748         * html/HTMLObjectElement.cpp:
1749         (WebCore::HTMLObjectElement::appendFormData):
1750         * loader/FormSubmission.cpp:
1751         (WebCore::FormSubmission::create):
1752
1753 2017-02-09  Chris Dumez  <cdumez@apple.com>
1754
1755         Crash under HTMLFormElement::registerFormElement()
1756         https://bugs.webkit.org/show_bug.cgi?id=167162
1757
1758         Reviewed by Ryosuke Niwa.
1759
1760         didMoveToNewDocument() was re-registering FormAttributeTargetObserver
1761         even if the element's inDocument was not set yet. As a result, it was
1762         possible for FormAssociatedElement::resetFormOwner() to be called
1763         when the element was in the tree but with its inDocument still being
1764         false (because insertedInto() has not been called yet). This could
1765         end up calling HTMLFormElement::registerFormElement() even though
1766         the element is still recognized as detached. This is an issue because
1767         HTMLFormElement::m_associatedElements's order and its corresponding
1768         indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex)
1769         rely on the position of the element with regards to the form element
1770         (before / inside / after).
1771
1772         To address the issue, we now only register the FormAttributeTargetObserver
1773         in didMoveToNewDocument() if the inDocument flag is set to true. This
1774         is similar to what is done at other call sites of
1775         resetFormAttributeTargetObserver(). We also ignore the form content
1776         attribute in HTMLFormElement::formElementIndex() if the element is
1777         not connected.
1778
1779         As per the HTML specification [1], the form content attribute is only
1780         taken if the element is connected (i.e. inDocument flag is true).
1781
1782         Note that FormAssociatedElement::findAssociatedForm() was already
1783         ignoring the form content attribute if the element is disconnected.
1784
1785         [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3)
1786
1787         Test: fast/forms/registerFormElement-crash.html
1788
1789         * html/FormAssociatedElement.cpp:
1790         (WebCore::FormAssociatedElement::didMoveToNewDocument):
1791         Only call resetFormAttributeTargetObserver() if inDocument flag is set,
1792         similarly to what is done at other call sites.
1793
1794         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
1795         Add an assertion to make sure no one call this method on an element that
1796         is not connected.
1797
1798         * html/HTMLFormElement.cpp:
1799         (WebCore::HTMLFormElement::formElementIndex):
1800         Ignore the form content attribute if the element is not connected, as
1801         per the HTML specification [1].
1802
1803 2017-02-09  Antti Koivisto  <antti@apple.com>
1804
1805         Tear down existing renderers when adding a shadow root.
1806         https://bugs.webkit.org/show_bug.cgi?id=167117
1807
1808         Reviewed by Andreas Kling.
1809
1810         Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers
1811         tear down code would no longer reach them.
1812
1813         Test: fast/shadow-dom/attach-shadow-teardown.html
1814
1815         * dom/Element.cpp:
1816         (WebCore::Element::addShadowRoot):
1817
1818             Tear down existing render tree when adding a shadow root.
1819
1820 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1821
1822         Handle synchronous layout when setting a selection range
1823         https://bugs.webkit.org/show_bug.cgi?id=167092
1824         <rdar://problem/30041640>
1825
1826         Reviewed by Antti Koivisto.
1827
1828         The 'innerTextElement' of a form control can change during layout due
1829         to arbitrary JavaScript executing. Handle the case where the inner text
1830         element has changed so that current render box height is while setting
1831         a selection range.
1832
1833         Test: fast/forms/input-type-change-during-selection.html
1834
1835         * html/HTMLTextFormControlElement.cpp:
1836         (WebCore::HTMLTextFormControlElement::setSelectionRange):
1837
1838 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1839
1840         Fix CMake build.
1841
1842         * PlatformMac.cmake:
1843
1844 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
1845
1846         Disconnect shadow children of root when detaching a frame
1847         https://bugs.webkit.org/show_bug.cgi?id=166851
1848         <rdar://problem/29930443>
1849
1850         Reviewed by Andy Estes.
1851
1852         If the root of the tree we are disconnecting has a shadow element, include it in the set of
1853         things to disconnect.
1854
1855         Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html
1856
1857         * dom/ContainerNodeAlgorithms.cpp:
1858         (WebCore::disconnectSubframes):
1859
1860 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
1861
1862         Remove unused WebThreadRunSync
1863         https://bugs.webkit.org/show_bug.cgi?id=168024
1864
1865         Reviewed by Tim Horton.
1866
1867         * platform/ios/wak/WebCoreThreadRun.cpp:
1868         * platform/ios/wak/WebCoreThreadRun.h:
1869         * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
1870         (InitWebCoreThreadSystemInterface):
1871
1872 2017-02-09  Ryan Haddad  <ryanhaddad@apple.com>
1873
1874         Unreviewed, rolling out r211802.
1875
1876         This change caused fast/regions/inline-block-inside-anonymous-
1877         overflow-with-covered-controls.html to be a flaky failure.
1878
1879         Reverted changeset:
1880
1881         "[Modern Media Controls] Improve handling of <video> with only
1882         audio tracks"
1883         https://bugs.webkit.org/show_bug.cgi?id=167836
1884         http://trac.webkit.org/changeset/211802
1885
1886 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1887
1888         Fix i386 libwebrtc build
1889         https://bugs.webkit.org/show_bug.cgi?id=168038
1890
1891         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1892         DataChannelInterface::buffered_amount returns a uint64_t, and we want a size_t.
1893         If this overflows, then we've run out of memory and crashed a long time ago.
1894
1895 2017-02-09  Andreas Kling  <akling@apple.com>
1896
1897         Document::settings() should return a const Settings&.
1898         <https://webkit.org/b/168061>
1899
1900         Reviewed by Geoffrey Garen.
1901
1902         - Make Document::settings() return a const reference.
1903         - Added Document::mutableSettings() for all your non-const needs.
1904         - Fixed up settings generator to produce const getters.
1905         - Simplify a few settings() call sites that exposed themselves.
1906
1907         * Modules/applepay/ApplePaySession.cpp:
1908         (WebCore::shouldDiscloseApplePayCapability):
1909         * Modules/mediastream/UserMediaRequest.cpp:
1910         (WebCore::canCallGetUserMedia):
1911         * css/CSSFontFace.cpp:
1912         (WebCore::CSSFontFace::appendSources):
1913         * css/CSSFontSelector.cpp:
1914         (WebCore::resolveGenericFamily):
1915         * css/StyleResolver.h:
1916         (WebCore::StyleResolver::settings):
1917         * dom/Document.h:
1918         (WebCore::Document::settings):
1919         (WebCore::Document::mutableSettings):
1920         * html/FTPDirectoryDocument.cpp:
1921         (WebCore::createTemplateDocumentData):
1922         * html/HTMLCanvasElement.cpp:
1923         (WebCore::shouldEnableWebGL):
1924         * html/HTMLEmbedElement.cpp:
1925         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1926         * html/HTMLSelectElement.cpp:
1927         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
1928         * html/ImageDocument.cpp:
1929         (WebCore::ImageDocument::updateDuringParsing):
1930         * page/csp/ContentSecurityPolicy.cpp:
1931         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
1932         * page/make_settings.pl:
1933         (printGetterAndSetter):
1934         * rendering/SimpleLineLayout.cpp:
1935         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
1936
1937 2017-02-09  Jer Noble  <jer.noble@apple.com>
1938
1939         Make passing PlatformAudioData in audioSamplesAvaliable const-correct.
1940         https://bugs.webkit.org/show_bug.cgi?id=168051
1941
1942         Reviewed by Eric Carlson.
1943
1944         Modify all the functions which take a (conceptually) read-only audio buffer const-correct.
1945
1946         Drive-by fix: AudioSampleBufferList::copyFrom() set a ivar pointer to the passed in
1947         AudioBufferList. Ensure that the ivar is reset when copyFrom() returns by using a
1948         SetForScope.
1949
1950         * platform/audio/mac/AudioSampleBufferList.cpp:
1951         (WebCore::AudioSampleBufferList::copyFrom):
1952         * platform/audio/mac/AudioSampleBufferList.h:
1953         * platform/audio/mac/AudioSampleDataSource.cpp:
1954         (WebCore::AudioSampleDataSource::pushSamplesInternal):
1955         (WebCore::AudioSampleDataSource::pushSamples):
1956         * platform/audio/mac/AudioSampleDataSource.h:
1957         * platform/mediastream/RealtimeMediaSource.cpp:
1958         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
1959         * platform/mediastream/RealtimeMediaSource.h:
1960         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
1961         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1962         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
1963         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1964         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1965         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1966         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1967
1968 2017-02-09  Jer Noble  <jer.noble@apple.com>
1969
1970         Fix some logging statements in MediaPlayerPrivateMediaStreamAVFObjC
1971         https://bugs.webkit.org/show_bug.cgi?id=168063
1972
1973         Reviewed by Eric Carlson.
1974
1975         Make the format string match the types passed in (i.e., floats, not strings).
1976
1977         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1978         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
1979
1980 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
1981
1982         [MediaStream Mac] Handle NULL m_sampleBufferDisplayLayer
1983         https://bugs.webkit.org/show_bug.cgi?id=168060
1984
1985         Reviewed by Jer Noble.
1986
1987         No new tests, this avoids an occasional crash on the bots.
1988
1989         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1990         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Don't assume
1991         m_sampleBufferDisplayLayer is valid.
1992
1993 2017-02-09  Chris Dumez  <cdumez@apple.com>
1994
1995         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
1996         https://bugs.webkit.org/show_bug.cgi?id=167964
1997
1998         Reviewed by Youenn Fablet.
1999
2000         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
2001         after the following WebIDL spec change:
2002         - https://github.com/heycam/webidl/issues/96
2003
2004         This aligns our behavior with other browsers as the spec has been updated to match
2005         the majority.
2006
2007         No new tests, rebaselined existing test.
2008
2009         * bindings/scripts/CodeGeneratorJS.pm:
2010         (GenerateConstructorHelperMethods):
2011         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2012         (WebCore::JSTestCallbackInterfaceConstructor::prototypeForStructure):
2013
2014 2017-02-09  Miguel Gomez  <magomez@igalia.com>
2015
2016         [GTK] scroll with transparent background not repainted after scrollY >= 32768
2017         https://bugs.webkit.org/show_bug.cgi?id=154283
2018
2019         Reviewed by Carlos Garcia Campos.
2020
2021         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
2022         not able to draw anything when using transformation matrices with values bigger than 32768. When
2023         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
2024         draw anything in, which causes the reported transparent backgrounds.
2025
2026         The patch modifies the transformation matrices both from the current context and the pattern we
2027         are painting, to avoid them to hold values that cannot stored in 16 bits.
2028
2029         There's still the possibility that this happens, but it would require using a pattern with a size
2030         bigger than 32768.
2031
2032         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
2033
2034         No new tests.
2035
2036         * platform/graphics/cairo/CairoUtilities.cpp:
2037         (WebCore::drawPatternToCairoContext):
2038
2039 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2040
2041         Unreviewed build fix after r211965.
2042
2043         * dom/Document.cpp:
2044         (WebCore::Document::adoptNode): inDocument -> isConnected
2045
2046 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2047
2048         Adopting a child node of a script element can run script
2049         https://bugs.webkit.org/show_bug.cgi?id=167318
2050
2051         Reviewed by Darin Adler.
2052
2053         The bug was caused by ScriptElement::childrenChanged indiscriminately running the script.
2054         Do this only if some node has been inserted as spec'ed:
2055
2056         https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
2057         "The script element is connected and a node or document fragment is inserted into
2058         the script element, after any script elements inserted at that time."
2059
2060         Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate
2061         non-contents child such as text and element being removed or inserted. New behavior matches that of
2062         Gecko and Chrome as well as the latest HTML5 specification.
2063
2064         Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees
2065         internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII
2066         object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's
2067         ensureCustomFontData used to completely disable this assertion but we no longer have to do this either.
2068
2069         To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with
2070         the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks
2071         isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent
2072         held by EventAllowedScope.
2073
2074         Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed
2075
2076         Tests: fast/html/script-must-not-run-when-child-is-adopted.html
2077                fast/html/script-must-not-run-when-child-is-removed.html
2078
2079         * dom/CharacterData.cpp:
2080         (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion.
2081         * dom/ContainerNode.cpp:
2082         (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded
2083         and insertBeforeCommon as done elsewhere.
2084         (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion.
2085         (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here.
2086         (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion.
2087         (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion.
2088         (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion.
2089         (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion.
2090         (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion.
2091         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into
2092         NoEventDispatchAssertion.
2093         (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely.
2094         (WebCore::dispatchChildRemovalEvents): Ditto.
2095         * dom/ContainerNode.h:
2096         (WebCore::ContainerNode::ChildChange::isInsertion): Added.
2097         * dom/ContainerNodeAlgorithms.cpp:
2098         (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against
2099         insertionPoint since EventAllowedScope checks against the root node.
2100         * dom/Document.cpp:
2101         (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else
2102         remove() had resulted in an exception before calling TreeScope::adoptIfNeeded.
2103         * dom/Element.cpp:
2104         (WebCore::Element::childrenChanged):
2105         * dom/NoEventDispatchAssertion.h:
2106         (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node.
2107         If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider
2108         the event dispatch to be forbidden.
2109         (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted.
2110         (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted.
2111         (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of
2112         a given node as "safe" for the purpose of checking isEventDispatchForbidden.
2113         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain
2114         of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated
2115         RAII object, and each instance remembers prior instance. 
2116         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added.
2117         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given
2118         node is a descendent of any node held by instances of EventAllowedScope.
2119         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function
2120         for isAllowedNode.
2121         * dom/Node.cpp:
2122         (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely.
2123         * dom/ScriptElement.cpp:
2124         (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes.
2125         (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running
2126         arbitrary author scripts can, indeed, result dispatch any events.
2127         * dom/ScriptElement.h:
2128         * html/HTMLElement.cpp:
2129         (WebCore::textToFragment): Made this a static local function and not return an exception since there
2130         is no way appendChild called in this function can throw an exception.
2131         (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by
2132         HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on
2133         a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts.
2134         Because of the precise-ness of this check, this does not disable the assertion for "this" element.
2135         HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark
2136         the shadow tree into which the fragment is inserted safe.
2137         (WebCore::HTMLElement::setOuterText):
2138         * html/HTMLElement.h:
2139         * html/HTMLScriptElement.cpp:
2140         (WebCore::HTMLScriptElement::childrenChanged):
2141         * html/HTMLTextFormControlElement.cpp:
2142         (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText).
2143         * html/track/VTTCue.cpp:
2144         (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since
2145         the VTT tree is never exposed to author scripts.
2146         (WebCore::VTTCue::updateDisplayTree): Ditto.
2147         * loader/cache/CachedSVGFont.cpp:
2148         (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on
2149         the new SVG document we just created instead of disabling for all DOM trees.
2150         * svg/SVGScriptElement.cpp:
2151         (WebCore::SVGScriptElement::childrenChanged):
2152
2153 2017-02-09  Andreas Kling  <akling@apple.com>
2154
2155         Document should always have a Settings.
2156         <https://webkit.org/b/120172>
2157
2158         Reviewed by Antti Koivisto.
2159
2160         Since a Document can't move between Frames, and it's either frameless
2161         or partnered with a Frame provided at construction time, we know that
2162         it will never need to switch between different Settings objects either.
2163
2164         Give Document a Ref<Settings> that contains either the Frame's Settings
2165         or a default-constructed Settings object if frameless.
2166         Document::settings() is promoted to a reference getter.
2167
2168         The bulk of this patch is removing now-unnecessary null checks.
2169
2170         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2171         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2172         * Modules/plugins/PluginReplacement.h:
2173         (WebCore::ReplacementPlugin::isEnabledBySettings):
2174         * Modules/plugins/QuickTimePluginReplacement.h:
2175         * Modules/plugins/QuickTimePluginReplacement.mm:
2176         (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
2177         * Modules/plugins/YouTubePluginReplacement.cpp:
2178         (WebCore::YouTubePluginReplacement::isEnabledBySettings):
2179         * Modules/plugins/YouTubePluginReplacement.h:
2180         * Modules/webaudio/AudioContext.cpp:
2181         (WebCore::AudioContext::constructCommon):
2182         * bindings/js/CachedScriptFetcher.cpp:
2183         (WebCore::CachedScriptFetcher::requestScriptWithCache):
2184         * css/CSSFontFace.cpp:
2185         (WebCore::CSSFontFace::appendSources):
2186         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
2187         * css/CSSFontSelector.cpp:
2188         (WebCore::CSSFontSelector::fallbackFontCount):
2189         (WebCore::CSSFontSelector::fallbackFontAt):
2190         * css/StyleBuilderConverter.h:
2191         (WebCore::StyleBuilderConverter::convertResize):
2192         * css/StyleBuilderCustom.h:
2193         (WebCore::StyleBuilderCustom::applyValueFontFamily):
2194         * css/StyleResolver.cpp:
2195         (WebCore::StyleResolver::StyleResolver):
2196         (WebCore::StyleResolver::defaultStyleForElement):
2197         (WebCore::StyleResolver::adjustRenderStyle):
2198         (WebCore::StyleResolver::checkForGenericFamilyChange):
2199         (WebCore::StyleResolver::initializeFontStyle):
2200         * css/StyleResolver.h:
2201         (WebCore::StyleResolver::settings):
2202         (WebCore::StyleResolver::documentSettings): Deleted.
2203         * css/parser/CSSParser.cpp:
2204         (WebCore::CSSParserContext::CSSParserContext):
2205         * dom/Document.cpp:
2206         (WebCore::Document::Document):
2207         (WebCore::Document::setReadyState):
2208         (WebCore::Document::setVisualUpdatesAllowed):
2209         (WebCore::Document::defaultCharsetForLegacyBindings):
2210         (WebCore::Document::recalcStyle):
2211         (WebCore::Document::implicitClose):
2212         (WebCore::Document::minimumLayoutDelay):
2213         (WebCore::Document::setDomain):
2214         (WebCore::Document::audioPlaybackRequiresUserGesture):
2215         (WebCore::Document::videoPlaybackRequiresUserGesture):
2216         (WebCore::Document::storageBlockingStateDidChange):
2217         (WebCore::Document::isTelephoneNumberParsingEnabled):
2218         (WebCore::Document::initSecurityContext):
2219         (WebCore::Document::initDNSPrefetch):
2220         (WebCore::Document::getCachedLocale):
2221         (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
2222         (WebCore::Document::settings): Deleted.
2223         * dom/Document.h:
2224         (WebCore::Document::settings):
2225         * dom/Element.cpp:
2226         (WebCore::subpixelMetricsEnabled):
2227         * dom/ExtensionStyleSheets.cpp:
2228         (WebCore::ExtensionStyleSheets::pageUserSheet):
2229         * dom/ScriptExecutionContext.cpp:
2230         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
2231         * dom/ScriptableDocumentParser.cpp:
2232         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
2233         * dom/ScriptedAnimationController.cpp:
2234         (WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
2235         * dom/make_names.pl:
2236         (printConstructorInterior):
2237         * editing/Editor.cpp:
2238         * editing/markup.cpp:
2239         (WebCore::createMarkupInternal):
2240         * html/FTPDirectoryDocument.cpp:
2241         (WebCore::createTemplateDocumentData):
2242         * html/HTMLAnchorElement.cpp:
2243         (WebCore::HTMLAnchorElement::setActive):
2244         (WebCore::HTMLAnchorElement::sendPings):
2245         (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
2246         * html/HTMLAppletElement.cpp:
2247         (WebCore::HTMLAppletElement::canEmbedJava):
2248         * html/HTMLCanvasElement.cpp:
2249         (WebCore::HTMLCanvasElement::getContext2d):
2250         (WebCore::shouldEnableWebGL):
2251         (WebCore::HTMLCanvasElement::shouldAccelerate):
2252         * html/HTMLFormElement.cpp:
2253         (WebCore::HTMLFormElement::submitImplicitly):
2254         * html/HTMLFrameElementBase.cpp:
2255         (WebCore::HTMLFrameElementBase::setLocation):
2256         * html/HTMLImageElement.cpp:
2257         (WebCore::HTMLImageElement::updateImageControls):
2258         * html/HTMLImageLoader.cpp:
2259         (WebCore::HTMLImageLoader::sourceURI):
2260         * html/HTMLInputElement.cpp:
2261         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
2262         * html/HTMLLinkElement.cpp:
2263         (WebCore::HTMLLinkElement::process):
2264         * html/HTMLMediaElement.cpp:
2265         (WebCore::HTMLMediaElement::HTMLMediaElement):
2266         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
2267         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
2268         (WebCore::HTMLMediaElement::enterFullscreen):
2269         (WebCore::HTMLMediaElement::exitFullscreen):
2270         (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
2271         (WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
2272         (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
2273         (WebCore::HTMLMediaElement::doesHaveAttribute):
2274         * html/HTMLVideoElement.cpp:
2275         (WebCore::HTMLVideoElement::HTMLVideoElement):
2276         * html/MediaElementSession.cpp:
2277         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
2278         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
2279         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
2280         (WebCore::MediaElementSession::allowsPictureInPicture):
2281         (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
2282         * html/parser/HTMLParserOptions.cpp:
2283         (WebCore::HTMLParserOptions::HTMLParserOptions):
2284         * html/shadow/MediaControlElements.cpp:
2285         (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
2286         * loader/LinkLoader.cpp:
2287         (WebCore::LinkLoader::loadLink):
2288         * page/csp/ContentSecurityPolicy.cpp:
2289         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
2290         * rendering/SimpleLineLayout.cpp:
2291         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
2292         * style/StyleFontSizeFunctions.cpp:
2293         (WebCore::Style::computedFontSizeFromSpecifiedSize):
2294         (WebCore::Style::fontSizeForKeyword):
2295         (WebCore::Style::legacyFontSizeForPixelSize):
2296         * style/StyleScope.cpp:
2297         (WebCore::Style::Scope::collectActiveStyleSheets):
2298         * xml/XMLHttpRequest.cpp:
2299         (WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):
2300
2301 2017-02-09  Antti Koivisto  <antti@apple.com>
2302
2303         Use all cacheable speculatively loaded responses
2304         https://bugs.webkit.org/show_bug.cgi?id=168052
2305
2306         Reviewed by Andreas Kling.
2307
2308         * platform/network/CacheValidation.cpp:
2309         (WebCore::isStatusCodeCacheableByDefault):
2310         (WebCore::isStatusCodePotentiallyCacheable):
2311
2312         Moved here from WebKit2.
2313
2314         * platform/network/CacheValidation.h:
2315
2316 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
2317
2318         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
2319         https://bugs.webkit.org/show_bug.cgi?id=168016
2320
2321         Reviewed by Youenn Fablet.
2322
2323         No new tests, existing tests updated.
2324
2325         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
2326         * DerivedSources.make: Ditto.
2327         * CMakeLists.txt: Ditto.
2328         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
2329         * Modules/mediastream/NavigatorUserMedia.js: Removed.
2330         * WebCore.xcodeproj/project.pbxproj:
2331         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
2332
2333 2017-02-09  Antoine Quint  <graouts@apple.com>
2334
2335         [Modern Media Controls] Tapping the skip back button on iOS inline media controls make the controls disappear
2336         https://bugs.webkit.org/show_bug.cgi?id=168049
2337         <rdar://problem/30442660>
2338
2339         Reviewed by Eric Carlson.
2340
2341         Calling elementAtPoint() on the Document will not return an element in the ShadowRoot,
2342         we need to call it on the ShadowRoot. So we now iterate over ancestors of the controls
2343         bar to find the ShadowRoot, if any, and check whether the tapped element is contained
2344         within the controls bar. We only fade the controls bar out if the tapped element is
2345         outside of the controls bar hierarchy.
2346
2347         Test: media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html
2348
2349         * Modules/modern-media-controls/controls/controls-bar.js:
2350         (ControlsBar.prototype.gestureRecognizerStateDidChange):
2351
2352 2017-02-09  Jer Noble  <jer.noble@apple.com>
2353
2354         Configure MockRealtimeAudioSourceMac to generate stereo audio
2355         https://bugs.webkit.org/show_bug.cgi?id=168027
2356
2357         Reviewed by Eric Carlson.
2358
2359         Update MockRealtimeAudioSourceMac to generate stereo audio.
2360
2361         First, because the pattern of creating a AudioBufferList structure (with all it's quirks and
2362         weird requirements) was repeated multiple places, add a new wrapper around ABL called
2363         WebAudioBufferList which takes care of correctly initializing the ABL structure and manages
2364         the lifetime of its data members.
2365
2366         * WebCore.xcodeproj/project.pbxproj:
2367         * platform/audio/PlatformAudioData.h: Added.
2368         (WebCore::PlatformAudioData::kind):
2369         * platform/audio/WebAudioBufferList.cpp: Added.
2370         (WebCore::WebAudioBufferList::WebAudioBufferList):
2371         (WebCore::WebAudioBufferList::buffers):
2372         (WebCore::WebAudioBufferList::bufferCount):
2373         (WebCore::WebAudioBufferList::buffer):
2374         * platform/audio/WebAudioBufferList.h: Added.
2375         (WebCore::WebAudioBufferList::list):
2376         (WebCore::WebAudioBufferList::operator AudioBufferList&):
2377         (WebCore::WebAudioBufferList::kind):
2378         (isType):
2379
2380         Then update existing code to work in terms of WebAudioBufferList:
2381
2382         * platform/audio/mac/AudioSampleBufferList.cpp:
2383         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
2384         (WebCore::AudioSampleBufferList::mixFrom):
2385         (WebCore::AudioSampleBufferList::copyFrom):
2386         (WebCore::AudioSampleBufferList::copyTo):
2387         (WebCore::AudioSampleBufferList::reset):
2388         (WebCore::AudioSampleBufferList::configureBufferListForStream): Deleted.
2389         * platform/audio/mac/AudioSampleBufferList.h:
2390         (WebCore::AudioSampleBufferList::bufferList):
2391         * platform/audio/mac/AudioSampleDataSource.cpp:
2392         (WebCore::AudioSampleDataSource::pushSamples):
2393         * platform/audio/mac/AudioSampleDataSource.h:
2394         * platform/mediastream/RealtimeMediaSource.cpp:
2395         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
2396         * platform/mediastream/RealtimeMediaSource.h:
2397         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
2398         * platform/mediastream/mac/AVAudioCaptureSource.h:
2399         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2400         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
2401         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2402         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
2403         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
2404         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2405         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2406         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2407
2408         Finally, actually update MockRealtimeAudioSource to emit stereo samples. Importantly, set
2409         the correct values for the m_streamFormat; mBytesPerFrame and mBytesPerPacket are not
2410         multiplied by the channelCount. When generating audio, write to both channels of data.
2411
2412         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
2413         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2414         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
2415         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
2416         (WebCore::MockRealtimeAudioSourceMac::render):
2417
2418 2017-02-09  Antti Koivisto  <antti@apple.com>
2419
2420         Nullptr crash under styleForFirstLetter
2421         https://bugs.webkit.org/show_bug.cgi?id=167756
2422         rdar://problem/30029354
2423
2424         Reviewed by Zalan Bujtas.
2425
2426         Don't know how we get here. Paper over the crash.
2427
2428         * rendering/RenderBlock.cpp:
2429         (WebCore::styleForFirstLetter):
2430
2431             Use parent first line style if we compute null style for the first letter renderer.
2432
2433 2017-02-09  Antoine Quint  <graouts@apple.com>
2434
2435         [Modern Media Controls] Playing an <audio> element on iOS makes the controls disappear
2436         https://bugs.webkit.org/show_bug.cgi?id=168047
2437         <rdar://problem/30441939>
2438
2439         Reviewed by Eric Carlson.
2440
2441         The controls bar auto-hide behavior is disabled for <audio> elements, but on iOS we have
2442         a TapGestureRecognizer to identify when controls are tapped to toggle controls visibility.
2443         This gesture recognizer would be on at all times, but it should only be enabled when
2444         fadesToIdle is set to true.
2445
2446         Test: media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html
2447
2448         * Modules/modern-media-controls/controls/controls-bar.js:
2449         (ControlsBar.prototype.set fadesWhileIdle):
2450
2451 2017-02-09  Antoine Quint  <graouts@apple.com>
2452
2453         [Modern Media Controls] <audio> element does not show any background on iOS
2454         https://bugs.webkit.org/show_bug.cgi?id=168046
2455         <rdar://problem/30441872>
2456
2457         Reviewed by Eric Carlson.
2458
2459         Use a solid gray background for <audio> elements on iOS.
2460
2461         Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-audio-background.html
2462
2463         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2464         (:host(audio) .media-controls.ios.inline > .controls-bar:before):
2465
2466 2017-02-09  Antoine Quint  <graouts@apple.com>
2467
2468         [Modern Media Controls] Controls fail to instantiate in an XHTML document
2469         https://bugs.webkit.org/show_bug.cgi?id=168045
2470         <rdar://problem/30290095>
2471
2472         Reviewed by Eric Carlson.
2473
2474         Always use valid HTML and XHTML strings when creating HTML elements.
2475
2476         Test: media/modern-media-controls/media-controller/media-controller-in-xhtml.xhtml
2477
2478         * Modules/modern-media-controls/controls/button.js:
2479         (Button):
2480         * Modules/modern-media-controls/controls/buttons-container.js:
2481         * Modules/modern-media-controls/controls/controls-bar.js:
2482         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2483         * Modules/modern-media-controls/controls/media-controls.js:
2484         * Modules/modern-media-controls/controls/slider.js:
2485         * Modules/modern-media-controls/controls/status-label.js:
2486         * Modules/modern-media-controls/controls/time-control.js:
2487         * Modules/modern-media-controls/controls/time-label.js:
2488         * Modules/modern-media-controls/controls/tracks-panel.js:
2489
2490 2017-02-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2491
2492         Unreviewed, fix typo in comment
2493
2494         * loader/DocumentWriter.cpp:
2495         (WebCore::DocumentWriter::replaceDocument):
2496
2497 2017-02-09  Andreas Kling  <akling@apple.com>
2498
2499         Disallow accelerated rendering for ginormous 2D canvases.
2500         <https://webkit.org/b/167968>
2501         <rdar://problem/30119483>
2502
2503         Reviewed by Antti Koivisto.
2504
2505         Add a "maximumAccelerated2dCanvasSize" setting that defaults to 5120x2880
2506         which is the 5K resolution for 16:9.
2507
2508         Also added a way to include the "accelerates drawing" flag in layer tree dumps.
2509
2510         Test: compositing/canvas/accelerated-canvas-compositing-size-limit.html
2511
2512         * html/HTMLCanvasElement.cpp:
2513         (WebCore::HTMLCanvasElement::shouldAccelerate):
2514         * page/Frame.h:
2515         * page/Settings.in:
2516         * platform/graphics/GraphicsLayer.cpp:
2517         (WebCore::GraphicsLayer::dumpProperties):
2518         * platform/graphics/GraphicsLayerClient.h:
2519         * rendering/RenderLayerCompositor.cpp:
2520         (WebCore::RenderLayerCompositor::layerTreeAsText):
2521         * testing/Internals.cpp:
2522         (WebCore::toLayerTreeFlags):
2523         * testing/Internals.h:
2524         * testing/Internals.idl:
2525
2526 2017-02-09  Antti Koivisto  <antti@apple.com>
2527
2528         Remove most cases of #if ENABLE(CACHE_PARTITIONING)
2529         https://bugs.webkit.org/show_bug.cgi?id=167990
2530
2531         Reviewed by Sam Weinig.
2532
2533         We'll just return empty string for the partition if partitioning is not enabled.
2534
2535         * html/DOMURL.cpp:
2536         (WebCore::DOMURL::revokeObjectURL):
2537         * inspector/InspectorPageAgent.cpp:
2538         (WebCore::InspectorPageAgent::cachedResource):
2539         * loader/FrameLoader.cpp:
2540         (WebCore::FrameLoader::loadURL):
2541         * loader/archive/cf/LegacyWebArchive.cpp:
2542         (WebCore::LegacyWebArchive::create):
2543         * loader/cache/CachedResource.h:
2544         (WebCore::CachedResource::url):
2545         (WebCore::CachedResource::cachePartition):
2546         * loader/cache/CachedResourceLoader.cpp:
2547         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2548         (WebCore::CachedResourceLoader::requestResource):
2549         * loader/cache/CachedResourceRequest.cpp:
2550         (WebCore::CachedResourceRequest::setDomainForCachePartition):
2551         * loader/cache/CachedResourceRequest.h:
2552         * loader/cache/MemoryCache.cpp:
2553         (WebCore::MemoryCache::add):
2554         (WebCore::MemoryCache::revalidationSucceeded):
2555         (WebCore::MemoryCache::resourceForRequestImpl):
2556         (WebCore::MemoryCache::addImageToCache):
2557         (WebCore::MemoryCache::removeImageFromCache):
2558         (WebCore::MemoryCache::remove):
2559         (WebCore::MemoryCache::removeResourcesWithOrigin):
2560         (WebCore::MemoryCache::removeResourcesWithOrigins):
2561         (WebCore::MemoryCache::getOriginsWithCache):
2562         (WebCore::MemoryCache::originsWithCache):
2563         * loader/cache/MemoryCache.h:
2564         * page/SecurityOrigin.cpp:
2565         (WebCore::SecurityOrigin::domainForCachePartition):
2566         * page/SecurityOrigin.h:
2567         * platform/SchemeRegistry.cpp:
2568         (WebCore::cachePartitioningSchemes):
2569         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
2570         * platform/SchemeRegistry.h:
2571         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2572         * platform/mac/WebCoreSystemInterface.h:
2573         * platform/mac/WebCoreSystemInterface.mm:
2574         * platform/network/ResourceRequestBase.cpp:
2575         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
2576         (WebCore::ResourceRequestBase::setCachePartition):
2577         (WebCore::ResourceRequestBase::partitionName):
2578         * platform/network/ResourceRequestBase.h:
2579         (WebCore::ResourceRequestBase::cachePartition):
2580         (WebCore::ResourceRequestBase::setDomainForCachePartition):
2581         * platform/network/cf/ResourceRequest.h:
2582         (WebCore::ResourceRequest::cachePartition): Deleted.
2583         (WebCore::ResourceRequest::setCachePartition): Deleted.
2584         (WebCore::ResourceRequest::setDomainForCachePartition): Deleted.
2585         * platform/network/cf/ResourceRequestCFNet.cpp:
2586         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2587         (WebCore::ResourceRequest::doUpdateResourceRequest):
2588         (WebCore::ResourceRequest::partitionName): Deleted.
2589         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy): Deleted.
2590         * platform/network/cf/ResourceResponse.h:
2591         * platform/network/cocoa/ResourceRequestCocoa.mm:
2592         (WebCore::ResourceRequest::doUpdateResourceRequest):
2593         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2594         * testing/Internals.cpp:
2595         (WebCore::Internals::isLoadingFromMemoryCache):
2596
2597 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2598
2599         Add Web Bluetooth as Not Considering
2600         https://bugs.webkit.org/show_bug.cgi?id=168042
2601
2602         Reviewed by Yusuke Suzuki.
2603
2604         Add Web Bluetooth as a feature not being considered to be implemented in WebKit.
2605
2606         * features.json:
2607
2608 2017-02-08  Simon Fraser  <simon.fraser@apple.com>
2609
2610         Put names on more UIViews for ease of debugging
2611         https://bugs.webkit.org/show_bug.cgi?id=168035
2612
2613         Reviewed by Tim Horton.
2614
2615         Name the page overlay layers.
2616
2617         * page/PageOverlayController.cpp:
2618         (WebCore::PageOverlayController::createRootLayersIfNeeded):
2619         (WebCore::PageOverlayController::installPageOverlay):
2620
2621 2017-02-08  Commit Queue  <commit-queue@webkit.org>
2622
2623         Unreviewed, rolling out r211912.
2624         https://bugs.webkit.org/show_bug.cgi?id=168034
2625
2626         http/tests/media/media-stream/disconnected-frame-permission-
2627         denied.html should be updated (Requested by youenn on
2628         #webkit).
2629
2630         Reverted changeset:
2631
2632         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
2633         https://bugs.webkit.org/show_bug.cgi?id=168016
2634         http://trac.webkit.org/changeset/211912
2635
2636 2017-02-08  Youenn Fablet  <youennf@gmail.com>
2637
2638         HTML Link elements should load data URLs as same origin
2639         https://bugs.webkit.org/show_bug.cgi?id=168032
2640         <rdar://problem/30275036>
2641
2642         Reviewed by Alex Christensen.
2643
2644         Test: fast/dom/data-url-css-link-element-cors-active.html
2645
2646         Making CSS data URLs resources considered as same origin when loaded through link elements.
2647         In the future, we should consider remove the data URL same origin flag and fully align with the fetch and HTML spec.
2648
2649         * html/HTMLLinkElement.cpp:
2650         (WebCore::HTMLLinkElement::process):
2651
2652 2017-02-08  Sam Weinig  <sam@webkit.org>
2653
2654         REGRESSION (r193286): Promise chain no longer prevent UI refresh
2655         <rdar://problem/28062149>
2656         https://bugs.webkit.org/show_bug.cgi?id=161291
2657
2658         Reviewed by Geoffrey Garen.
2659
2660         Add new subtest to js/dom/Promise.html
2661
2662         * dom/Microtasks.cpp:
2663         (WebCore::MicrotaskQueue::append):
2664         (WebCore::MicrotaskQueue::remove):
2665         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
2666         * dom/Microtasks.h:
2667         The microtask queue needs to be completely drained, even of new microtasks added while
2668         the previous task was run. Remove the m_tasksAppendedDuringMicrotaskCheckpoint as it is
2669         no longer needed.
2670
2671 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
2672
2673         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
2674         https://bugs.webkit.org/show_bug.cgi?id=168016
2675
2676         Reviewed by Youenn Fablet.
2677
2678         No new tests, existing tests updated.
2679
2680         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
2681         * DerivedSources.make: Ditto.
2682         * CMakeLists.txt: Ditto.
2683         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
2684         * Modules/mediastream/NavigatorUserMedia.js: Removed.
2685         * WebCore.xcodeproj/project.pbxproj:
2686         * page/Navigator.idl: Add some whitespace to force derived sources to be rebuild correctly.
2687
2688 2017-02-08  Chris Dumez  <cdumez@apple.com>
2689
2690         Use smaller tiles in windows that are not active to facilitate App Napping
2691         https://bugs.webkit.org/show_bug.cgi?id=167997
2692         <rdar://problem/30358835>
2693
2694         Reviewed by Simon Fraser.
2695
2696         Use smaller / non-adaptative tiles in windows that are not active to facilitate
2697         App Napping after <https://trac.webkit.org/r197594>.
2698
2699         Test: compositing/tiling/non-active-window-tiles-size.html
2700
2701         * page/FrameView.cpp:
2702         (WebCore::FrameView::contentsResized):
2703         (WebCore::FrameView::addedOrRemovedScrollbar):
2704         (WebCore::FrameView::computeScrollability):
2705         (WebCore::FrameView::updateTiledBackingAdaptiveSizing):
2706         (WebCore::FrameView::unobscuredContentSizeChanged):
2707         (WebCore::FrameView::setViewExposedRect):
2708         * page/FrameView.h:
2709         * page/Page.cpp:
2710         (WebCore::Page::setActivityState):
2711         (WebCore::Page::isWindowActive):
2712         * page/Page.h:
2713         * platform/graphics/TiledBacking.h:
2714         * platform/graphics/ca/TileController.cpp:
2715         (WebCore::TileController::setTileSizeUpdateDelayDisabledForTesting):
2716         (WebCore::TileController::notePendingTileSizeChange):
2717         * platform/graphics/ca/TileController.h:
2718         * testing/Internals.cpp:
2719         (WebCore::Internals::resetToConsistentState):
2720         (WebCore::Internals::disableTileSizeUpdateDelay):
2721         * testing/Internals.h:
2722         * testing/Internals.idl:
2723
2724 2017-02-08  Chris Dumez  <cdumez@apple.com>
2725
2726         Unreviewed, rolling out r211907.
2727
2728         Broke the build
2729
2730         Reverted changeset:
2731
2732         "[MediaStream] Remove legacy Navigator.webkitGetUserMedia"
2733         https://bugs.webkit.org/show_bug.cgi?id=168016
2734         http://trac.webkit.org/changeset/211907
2735
2736 2017-02-08  Eric Carlson  <eric.carlson@apple.com>
2737
2738         [MediaStream] Remove legacy Navigator.webkitGetUserMedia
2739         https://bugs.webkit.org/show_bug.cgi?id=168016
2740
2741         Reviewed by Youenn Fablet.
2742
2743         No new tests, existing tests updated.
2744
2745         * WebCore.xcodeproj/project.pbxproj: NavigatorUserMedia.
2746         * DerivedSources.make: Ditto.
2747         * CMakeLists.txt: Ditto.
2748         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
2749         * Modules/mediastream/NavigatorUserMedia.js: Removed.
2750         * WebCore.xcodeproj/project.pbxproj:
2751
2752 2017-02-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2753
2754         Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
2755         https://bugs.webkit.org/show_bug.cgi?id=167942
2756         <rdar://problem/30315079>
2757
2758         Reviewed by Tim Horton.
2759
2760         Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
2761         Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
2762         NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
2763         pasteboard as text and an image, respectively.
2764
2765         New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.
2766
2767         * platform/mac/DragDataMac.mm:
2768         (WebCore::DragData::containsCompatibleContent):
2769         * platform/mac/PasteboardMac.mm:
2770         (WebCore::Pasteboard::read):
2771
2772 2017-02-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2773
2774         getIntersectionList always returns empty NodeList until layout is complete
2775         https://bugs.webkit.org/show_bug.cgi?id=81423
2776
2777         Reviewed by Simon Fraser.
2778
2779         Layout needs to be forced before trying to figure out which SVGElements
2780         intersect with a given SVGRect. We do the same thing in the DOM API
2781         Element::getBoundingClientRect().
2782
2783         Test: svg/custom/intersection-list-before-layout.html
2784
2785         * svg/SVGSVGElement.cpp:
2786         (WebCore::SVGSVGElement::getIntersectionList):
2787
2788 2017-02-08  Antoine Quint  <graouts@apple.com>
2789
2790         [Modern Media Controls] Implement reduced and tight padding modes
2791         https://bugs.webkit.org/show_bug.cgi?id=167933
2792         <rdar://problem/30396994>
2793
2794         Reviewed by Dean Jackson.
2795
2796         The design specs for modern media controls mandate the following for inline media controls:
2797
2798             - controls at or below 300pt width use a 12pt left margin for the left buttons container,
2799             and a 12pt right margin for the right buttons container, and 16pth button margin inside
2800             both containers ("reduced padding mode").
2801
2802             - when dropping at or below 120pt width, controls use an 8pt left margin for
2803             the left buttons container, and an 8pt right margin for the right buttons container, and
2804             12pt button margin inside both containers and a shorter bar (25pt) ("compact mode").
2805
2806             - in the case of audio controls, at 400pt or less, controls switch to 12pt margins and
2807             button margins for both buttons containers ("tight padding mode").
2808
2809         The "compact" mode was already implemented as a dedicated MacOSInlineMediaControls subclass.
2810         Since we now have a more generic need to vary the metrics used for inline media controls on
2811         macOS, we add new features to MacOSInlineMediaControls to support varying metrics based on
2812         the controls' "layoutTraits" property.
2813
2814         So MediaController is changed such that it knows to use the new TightPadding and ReducedPadding
2815         layout traits based on the conditions defined above, and _updateControlsIfNeeded() is changed
2816         to set the "layoutTraits" property on the controls whenever called, which in our case is most
2817         relevantly a "resize" event on the shadow root or a TrackEvent on the video tracks (to determine
2818         when we're possibly changing between a video and audio file).
2819
2820         As a result, the "layoutTraits" setter is called on MacOSInlineMediaControls, which updates
2821         the metrics for the various buttons containers, but also notifies the buttons contained
2822         within that layout traits may have changed, since some buttons support a "compact" appearance
2823         that is shorter and require a different image file. To that end, IconButton has been updated
2824         so that it may be notified of a layout traits change through a new layoutTraitsDidChange()
2825         method, that checks whether the current layout traits differ from those last used when loading
2826         the icon.
2827
2828         Tests: media/modern-media-controls/icon-button/icon-button-change-layout-traits.html
2829                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-buttons-styles.html
2830                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact-controls-bar-styles.html
2831                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-compact.html
2832                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-reduced-padding.html
2833                media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-tight-padding.html
2834                media/modern-media-controls/media-controller/media-controller-compact.html
2835                media/modern-media-controls/media-controller/media-controller-reduced-padding.html
2836                media/modern-media-controls/media-controller/media-controller-tight-padding.html
2837
2838         * Modules/modern-media-controls/controls/icon-button.js:
2839         (IconButton.prototype.set iconName):
2840         (IconButton.prototype.layoutTraitsDidChange):
2841         (IconButton.prototype._loadImage):
2842         * Modules/modern-media-controls/controls/layout-item.js:
2843         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Removed.
2844         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2845         (MacOSInlineMediaControls.prototype.get layoutTraits):
2846         (MacOSInlineMediaControls.prototype.set layoutTraits):
2847         (MacOSInlineMediaControls.prototype._matchLayoutTraits):
2848         * Modules/modern-media-controls/js-files:
2849         * Modules/modern-media-controls/media/media-controller.js:
2850         (MediaController):
2851         (MediaController.prototype.get layoutTraits):
2852         (MediaController.prototype.handleEvent):
2853         (MediaController.prototype._updateControlsIfNeeded):
2854         (MediaController.prototype._controlsClassForLayoutTraits):
2855         (MediaController.prototype._shouldFadeBetweenControls): Deleted.
2856         (MediaController.prototype._controlsClass): Deleted.
2857         * WebCore.xcodeproj/project.pbxproj:
2858
2859 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2860
2861         Move private methods from WKGraphics.h to a separate header file
2862         https://bugs.webkit.org/show_bug.cgi?id=167996
2863
2864         Reviewed by Alexey  Proskuryakov.
2865
2866         * platform/ios/wak/WKGraphicsInternal.h: Added.
2867         * WebCore.xcodeproj/project.pbxproj: Added WKGraphicsInternal.h
2868         * platform/ios/wak/WKGraphics.h: Moved methods to WKGraphicsInternal.h
2869         * platform/graphics/mac/GraphicsContextMac.mm: Included new header file.
2870         * platform/ios/wak/WKGraphics.mm: Same.
2871
2872 2017-02-08  Brady Eidson  <beidson@apple.com>
2873
2874         Opt-out iBooks from synchronous willSendRequest on iOS.
2875         <rdar://problem/30129966> and https://bugs.webkit.org/show_bug.cgi?id=168006
2876
2877         Reviewed by Brent Fulgham.
2878
2879         No new tests (Not a testable behavior change at this time).
2880
2881         * platform/network/mac/ResourceHandleMac.mm:
2882         (WebCore::synchronousWillSendRequestEnabled): iBooks never gets synchronous willSendRequest:
2883
2884 2017-02-08  Sam Weinig  <sam@webkit.org>
2885
2886         Split JSDOMConstructor.h/cpp up by class
2887         https://bugs.webkit.org/show_bug.cgi?id=167958
2888
2889         Reviewed by Tim Horton.
2890
2891         Splits JSDOMConstructor up by class.
2892         - Renames DOMConstructorObject to JSDOMConstructorBase.
2893         - Renames DOMConstructorWithDocument to JSDOMConstructorWithDocument.
2894         - Renames DOMConstructorJSBuiltinObject to JSDOMBuiltinConstructorBase.
2895         - Renames JSBuiltinConstructor to JSDOMBuiltinConstructor.
2896
2897         * CMakeLists.txt:
2898         * WebCore.xcodeproj/project.pbxproj:
2899         * bindings/js/JSBindingsAllInOne.cpp:
2900         Add new files.
2901
2902         * bindings/js/JSDOMBinding.h:
2903         (WebCore::propertyNameToString): Deleted.
2904         (WebCore::propertyNameToAtomicString): Deleted.
2905         * bindings/js/JSDOMBuiltinConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2906         * bindings/js/JSDOMBuiltinConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2907         * bindings/js/JSDOMBuiltinConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2908         * bindings/js/JSDOMConstructor.cpp: Removed.
2909         * bindings/js/JSDOMConstructor.h: Remove all classes other than JSDOMConstructor.
2910         * bindings/js/JSDOMConstructorBase.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2911         * bindings/js/JSDOMConstructorBase.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2912         * bindings/js/JSDOMConstructorNotConstructable.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2913         * bindings/js/JSDOMConstructorWithDocument.cpp: Copied from Source/WebCore/bindings/js/JSDOMConstructor.cpp.
2914         * bindings/js/JSDOMConstructorWithDocument.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2915         * bindings/js/JSDOMNamedConstructor.h: Copied from Source/WebCore/bindings/js/JSDOMConstructor.h.
2916
2917         * bindings/js/JSDOMConvertStrings.h:
2918         (WebCore::propertyNameToString):
2919         (WebCore::propertyNameToAtomicString):
2920         Move these here from JSDOMBinding.
2921
2922         * bindings/js/JSHTMLElementCustom.cpp:
2923         (WebCore::constructJSHTMLElement):
2924         * bindings/js/JSMutationObserverCustom.cpp:
2925         (WebCore::constructJSMutationObserver):
2926         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2927         * bindings/js/JSStorageCustom.cpp:
2928         * bindings/js/JSUserMessageHandlersNamespaceCustom.cpp:
2929         (WebCore::JSUserMessageHandlersNamespace::getOwnPropertySlotDelegate):
2930         * bindings/js/JSWorkerCustom.cpp:
2931         (WebCore::constructJSWorker):
2932         * bindings/scripts/CodeGeneratorJS.pm:
2933         (GetConstructorTemplateClassName):
2934         (GenerateConstructorDeclaration):
2935         Update includes/names.
2936
2937         * dom/StaticRange.cpp:
2938         (WebCore::StaticRange::~StaticRange):
2939         * dom/StaticRange.h:
2940         Add out-of-line destructor, so Node.h does not have to be included.
2941
2942 2017-02-08  Joseph Pecoraro  <pecoraro@apple.com>
2943
2944         Initialize the main RunLoop in iOS WebKitLegacy
2945         https://bugs.webkit.org/show_bug.cgi?id=167953
2946
2947         Reviewed by Alexey Proskuryakov.
2948
2949         * platform/ios/wak/WebCoreThread.mm:
2950         (StartWebThread):
2951         Initialize the main runloop on the main thread during iOS WebKit initialization.
2952
2953 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
2954
2955         Move private methods from WKContentObservation.h to a separate header file
2956         https://bugs.webkit.org/show_bug.cgi?id=167998
2957
2958         Reviewed by Alexey Proskuryakov.
2959
2960         * WebCore.xcodeproj/project.pbxproj: Added WKContentObservationInternal.h
2961         * platform/ios/wak/WKContentObservationInternal.h: Added.
2962         * platform/ios/wak/WKContentObservation.h: Moved methods to WKContentObservationInternal.h
2963         * platform/ios/wak/WKContentObservation.cpp: Included new header file.
2964         * page/DOMTimer.cpp: Same.
2965         * page/DOMWindow.cpp: Same.
2966         * style/RenderTreeUpdater.cpp: Same.
2967
2968 2017-02-08  Youenn Fablet  <youenn@apple.com>
2969
2970         RTCPeerConnection constructor can take null as input
2971         https://bugs.webkit.org/show_bug.cgi?id=167992
2972
2973         Reviewed by Chris Dumez.
2974
2975         Covered by updated test.
2976
2977         RTCPeerConnection takes an optional Dictionary as input.
2978         As per https://heycam.github.io/webidl/#es-dictionary, null is converted to an empty dictionary.
2979
2980         * Modules/mediastream/RTCPeerConnection.js:
2981         (initializeRTCPeerConnection):
2982
2983 2017-02-08  Andreas Kling  <akling@apple.com>
2984
2985         No need for CachedFrame to detach custom scrollbars.
2986         <https://webkit.org/b/167995>
2987
2988         Reviewed by Sam Weinig.
2989
2990         Custom scrollbars have already been torn down with the rest of the render tree
2991         by the time we're creating a CachedFrame.
2992
2993         * history/CachedFrame.cpp:
2994         (WebCore::CachedFrame::CachedFrame):
2995
2996 2017-02-08  Zalan Bujtas  <zalan@apple.com>
2997
2998         Simple line layout: Fix printReason for unsupported overflow values.
2999         https://bugs.webkit.org/show_bug.cgi?id=168000
3000
3001         Reviewed by Simon Fraser.
3002
3003         Not testable.
3004
3005         * rendering/SimpleLineLayout.cpp:
3006         (WebCore::SimpleLineLayout::canUseForStyle):
3007         (WebCore::SimpleLineLayout::printReason):
3008
3009 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3010
3011         Remove WebCoreObjCDeallocWithWebThreadLock from header file
3012         https://bugs.webkit.org/show_bug.cgi?id=167987
3013
3014         Reviewed by Alexey Proskuryakov.
3015
3016         * platform/ios/wak/WebCoreThread.mm: Added WebCoreObjCDeallocWithWebThreadLock.
3017         * platform/ios/wak/WebCoreThreadMessage.h: Removed WebCoreObjCDeallocWithWebThreadLock.
3018
3019 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3020
3021         Move WKMouseInRect to WAKView.mm
3022         https://bugs.webkit.org/show_bug.cgi?id=167989
3023
3024         Reviewed by Alexey Proskuryakov.
3025
3026         * platform/ios/wak/WAKAppKitStubs.h: Removed WKMouseInRect.
3027         * platform/ios/wak/WAKAppKitStubs.m:
3028         (WKMouseInRect): Deleted.
3029         * platform/ios/wak/WAKView.mm: 
3030         (-[WAKView mouse:inRect:]): Added the logic of WKMouseInRect here instead of separate function call.
3031
3032 2017-02-08  Aakash Jain  <aakash_jain@apple.com>
3033
3034         Remove unused method WebCore::PluginData::pluginNameForMimeType
3035         https://bugs.webkit.org/show_bug.cgi?id=167986
3036
3037         Reviewed by Anders Carlsson.
3038
3039         * plugins/PluginData.cpp:
3040         (WebCore::PluginData::pluginNameForWebVisibleMimeType): Deleted.
3041         * plugins/PluginData.h: Removed pluginNameForWebVisibleMimeType.
3042
3043 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
3044
3045         [GTK] Fix translatable form validation messages
3046         https://bugs.webkit.org/show_bug.cgi?id=167984
3047
3048         Reviewed by Michael Catanzaro.
3049
3050         Most of them are just wrong. Use the same mesages than mac, which also makes some tests pass.
3051
3052         Fixes: fast/forms/validation-message-maxLength.html
3053                fast/forms/validationMessage.html
3054
3055         * platform/gtk/LocalizedStringsGtk.cpp:
3056         (WebCore::validationMessageValueMissingText):
3057         (WebCore::validationMessageValueMissingForCheckboxText):
3058         (WebCore::validationMessageValueMissingForFileText):
3059         (WebCore::validationMessageValueMissingForMultipleFileText):
3060         (WebCore::validationMessageValueMissingForRadioText):
3061         (WebCore::validationMessageValueMissingForSelectText):
3062         (WebCore::validationMessageTypeMismatchText):
3063         (WebCore::validationMessageTypeMismatchForEmailText):
3064         (WebCore::validationMessageTypeMismatchForMultipleEmailText):
3065         (WebCore::validationMessageTypeMismatchForURLText):
3066         (WebCore::validationMessagePatternMismatchText):
3067         (WebCore::validationMessageTooShortText):
3068         (WebCore::validationMessageTooLongText):
3069         (WebCore::validationMessageRangeUnderflowText):
3070         (WebCore::validationMessageRangeOverflowText):
3071         (WebCore::validationMessageStepMismatchText):
3072         (WebCore::validationMessageBadInputForNumberText):
3073
3074 2017-02-08  Chris Dumez  <cdumez@apple.com>
3075
3076         Add support for enhanced privacy diagnostic logging
3077         https://bugs.webkit.org/show_bug.cgi?id=167948
3078         <rdar://problem/30385112>
3079
3080         Reviewed by Antti Koivisto.
3081
3082         Add new logDiagnosticMessageWithEnhancedPrivacy() method to DiagnosticLoggingClient
3083         that is used for enhanced privacy logging. Start using this new API to log domains
3084         that are visited.
3085
3086         * loader/EmptyClients.cpp:
3087         * loader/FrameLoader.cpp:
3088         (WebCore::logNavigation):
3089         (WebCore::FrameLoader::loadWithDocumentLoader):
3090         * page/DiagnosticLoggingClient.h:
3091         * page/DiagnosticLoggingKeys.cpp:
3092         (WebCore::DiagnosticLoggingKeys::domainVisitedKey):
3093         * page/DiagnosticLoggingKeys.h:
3094
3095 2017-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
3096
3097         [GStreamer] Critical warnings when media player is destroyed
3098         https://bugs.webkit.org/show_bug.cgi?id=167981
3099
3100         Reviewed by Xabier Rodriguez-Calvar.
3101
3102         It can happen that the source doesn't have a parent when we try to disconnect the element-added signal.
3103
3104         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3105         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
3106         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged):
3107
3108 2017-02-08  Miguel Gomez  <magomez@igalia.com>
3109
3110         [GTK] Reduce TiledBackingStore tile coverage when on memory pressure state
3111         https://bugs.webkit.org/show_bug.cgi?id=167980
3112
3113         Reviewed by Carlos Garcia Campos.
3114
3115         Use a smaller coverAreaMultiplier in the TiledBackingStore when in memory pressure situation, to reduce
3116         the amount of tiles created.
3117
3118         No new tests.
3119
3120         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
3121         (WebCore::TiledBackingStore::createTilesIfNeeded):
3122         (WebCore::TiledBackingStore::createTiles):
3123         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
3124
3125 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
3126
3127         [EME] Implement MediaKeySession::remove()
3128         https://bugs.webkit.org/show_bug.cgi?id=167870
3129
3130         Reviewed by Xabier Rodriguez-Calvar.
3131
3132         Implement MediaKeySession::remove() as outlined in the specification.
3133
3134         The CDMInstance::removeSessionData() virtual method is added. CDMInstance
3135         implementors should remove any session data stored for the session that's
3136         represented by the passed-in session ID and session type.
3137
3138         Once the session data is removed, the passed-in callback should be invoked
3139         by the CDMInstance object so that MediaKeySession can immediately queue a
3140         task in which it updates key statuses and expiration, reject the promise if
3141         the data removal failed, or enqueue any license-release message and finally
3142         successfully resolve the promise.
3143
3144         MockCDMFactory gains the removeKeysFromSessionWithID() method that purges
3145         the keys for a given session ID. The method is called from
3146         MockCDMInstance::removeSessionData() implementation, which passes the
3147         removed keys to the RemoveSessionDataCallback, along with a license-release
3148         message that is checked in the tests. The key removal itself isn't tested
3149         yet because the MediaKeySession's `update key statuses` algorithm isn't
3150         implemented yet.
3151
3152         Test: media/encrypted-media/mock-MediaKeySession-remove.html
3153
3154         * Modules/encryptedmedia/CDMInstance.h:
3155         * Modules/encryptedmedia/MediaKeySession.cpp:
3156         (WebCore::MediaKeySession::remove):
3157         * testing/MockCDMFactory.cpp:
3158         (WebCore::MockCDMFactory::removeKeysFromSessionWithID):
3159         (WebCore::MockCDMInstance::removeSessionData):
3160         * testing/MockCDMFactory.h:
3161
3162 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
3163
3164         [EME] Implement MediaKeySession::close()
3165         https://bugs.webkit.org/show_bug.cgi?id=167869
3166
3167         Reviewed by Xabier Rodriguez-Calvar.
3168
3169         Implement MediaKeySession::close() as outlined in the specification.
3170
3171         The CDMInstance::closeSession() virtual method, when called, should
3172         close the session that's represented by the passed-in session ID on
3173         the CDMInstance implementor object. That's the same session ID that
3174         the CDMInstance object passes to the MediaKeySession class through
3175         the callback that's provided to the updateLicense call.
3176
3177         The CloseSessionCallback, passed to CDMInstance::closeSession(),
3178         should be invoked by the CDMInstance implementor once the session
3179         is closed. When that is invoked, another task is queued for the
3180         MediaKeySession object that runs the `session closed` algorithm
3181         and resolves the promise.
3182
3183         MockCDMInstance::closeSession() is defined to remove the session
3184         from the MockCDMFactory object and invoke the CloseSessionCallback.
3185
3186         Test: media/encrypted-media/mock-MediaKeySession-close.html
3187
3188         * Modules/encryptedmedia/CDMInstance.h:
3189         * Modules/encryptedmedia/MediaKeySession.cpp:
3190         (WebCore::MediaKeySession::close):
3191         * testing/MockCDMFactory.cpp:
3192         (WebCore::MockCDMInstance::closeSession):
3193         * testing/MockCDMFactory.h:
3194
3195 2017-02-08  Zan Dobersek  <zdobersek@igalia.com>
3196
3197         [EME] Alias CDMInstance enums to the specification-defined enums
3198         https://bugs.webkit.org/show_bug.cgi?id=167896
3199
3200         Reviewed by Sam Weinig.
3201
3202         Simplify the enums in the CDMInstance class by simply aliasing them
3203         to the EME specification-defined enums. CDMInstance::KeyStatus and
3204         CDMInstance::MessageType were already direct copies of the
3205         MediaKeyStatus and MediaKeyMessageType enums, while the
3206         CDMInstance::LicenseType had the members as MediaKeySessionType,
3207         but with slightly different names.
3208
3209         No changes in behavior.
3210
3211         * Modules/encryptedmedia/CDMInstance.h:
3212         * Modules/encryptedmedia/MediaKeySession.cpp:
3213         (WebCore::MediaKeySession::generateRequest):
3214         (WebCore::MediaKeySession::update):
3215         * testing/MockCDMFactory.cpp:
3216         (WebCore::MockCDMInstance::requestLicense):
3217
3218 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3219
3220         REGRESSION(r210740): [GTK] 2.15 broke embedded videos in GNOME's yelp app
3221         https://bugs.webkit.org/show_bug.cgi?id=167887
3222
3223         Reviewed by Michael Catanzaro.
3224
3225         Update the m_renderingCanBeAccelerated when accelerated rendering state changes.
3226
3227         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3228         (WebCore::MediaPlayerPrivateGStreamerBase::acceleratedRenderingStateChanged):
3229         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
3230         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3231
3232 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3233
3234         [GTK] Handle extended colors in cairo and texture mapper backends
3235         https://bugs.webkit.org/show_bug.cgi?id=167943
3236
3237         Reviewed by Michael Catanzaro.
3238
3239         Fixes: css3/color/backgrounds-and-borders.html
3240                css3/color/box-shadows.html
3241                css3/color/canvas.html
3242                css3/color/composited-solid-backgrounds.html
3243                css3/color/text.html
3244
3245         * platform/graphics/Color.cpp:
3246         (WebCore::premultipliedARGBFromColor): Handle the case of color being extended.
3247         * platform/graphics/cairo/CairoUtilities.cpp:
3248         (WebCore::setSourceRGBAFromColor): Ditto.
3249         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3250         (WebCore::fillRectWithColor): Use isVisible() instead of alpha().
3251         (WebCore::GraphicsContext::drawEllipse): Ditto.
3252         * platform/graphics/gtk/ColorGtk.cpp:
3253         (WebCore::Color::operator GdkRGBA): Handle the case of color being extended.
3254         * platform/graphics/texmap/TextureMapperGL.cpp:
3255         (WebCore::TextureMapperGL::drawNumber): Ditto.
3256         * platform/graphics/texmap/TextureMapperLayer.cpp:
3257         (WebCore::blendWithOpacity): Ditto.
3258         (WebCore::TextureMapperLayer::paintSelf): Use isVisible() instead of alpha().
3259         (WebCore::TextureMapperLayer::computeOverlapRegions): Ditto.
3260
3261 2017-02-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3262
3263         WebItemProviderPasteboard should use -registerLoadHandlersToItemProvider: when creating a new UIItemProvider
3264         https://bugs.webkit.org/show_bug.cgi?id=167918
3265         <rdar://problem/30382347>
3266
3267         Reviewed by Tim Horton.
3268
3269         Adopts SPI in WebItemProviderPasteboard for object types that the platform knows how to serialize. Since we use
3270         -createObjectOfClass: to initialize data when reading off of the pasteboard, we need to match the format that
3271         objects conforming to UIItemProviderReading will expect. Thus, for all given objects that conform to
3272         UIItemProviderWriting, we have them register themselves to the item provider.
3273
3274         We register other UTI types due to the fact that PlatformPasteboardIOS does not care about the specific
3275         pasteboard used. This should not be necessary, however, since data written to the WebItemProviderPasteboard
3276         should never need to be read by an actual UIPasteboard. This will be refactored in a future patch to add a
3277         special type of WebItemProviderPasteboard-aware PlatformPasteboard.
3278
3279         Also fixes some reference counting issues in WebItemProviderPasteboard by changing the array of _itemProviders
3280         to be a RetainPtr.
3281
3282         * platform/ios/WebItemProviderPasteboard.mm:
3283         (-[WebItemProviderPasteboard init]):
3284         (-[WebItemProviderPasteboard pasteboardTypes]):
3285         (-[WebItemProviderPasteboard itemProviders]):
3286         (-[WebItemProviderPasteboard setItemProviders:]):
3287         (-[WebItemProviderPasteboard numberOfItems]):
3288         (-[WebItemProviderPasteboard setItems:]):
3289         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3290         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
3291         (-[WebItemProviderPasteboard dealloc]): Deleted.
3292
3293 2017-02-06  Ryosuke Niwa  <rniwa@webkit.org>
3294
3295         WebContent process repeatedly jetsams on BuzzFeed's Another Round page
3296         https://bugs.webkit.org/show_bug.cgi?id=167830
3297         <rdar://problem/30187368>
3298
3299         Reviewed by Simon Fraser.
3300
3301         The jetsams on https://www.buzzfeed.com/anotherround were caused by WebKit creating the backing store
3302         for every iframe's layer on the page regardless of whether they're in the viewport or not.
3303
3304         This was caused by GraphicsLayerCA's setVisibleAndCoverageRects not setting CoverageRectChanged on
3305         m_uncommittedChanges on the very first call. Fixed the bug by initializing m_uncommittedChanges
3306         to always have CoverageRectChanged so that the coverage rect would get updated properly.
3307
3308         Unfortunately, no new tests since somehow the backing store doesn't get created inside the test runner.
3309
3310         * platform/graphics/ca/GraphicsLayerCA.h:
3311         (WebCore::GraphicsLayerCA):
3312
3313 2017-02-07  Youenn Fablet  <youennf@gmail.com>
3314
3315         [WebRTC] LibWebRTCEndpoint should not own objects that should be destroyed on the main thread
3316         https://bugs.webkit.org/show_bug.cgi?id=167816
3317
3318         Reviewed by Alex Christensen.
3319
3320         Tests: webrtc/libwebrtc/release-while-creating-offer.html
3321                webrtc/libwebrtc/release-while-getting-stats.html
3322                webrtc/libwebrtc/release-while-setting-local-description.html
3323
3324         Moving AV sources, stats promises, ICE candidates from LibWebRTCEndpoint to LibWebRTCPeerConnectionBackend.
3325         This allows ensuring these are destroyed in the main thread.
3326
3327         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3328         (WebCore::MediaEndpointPeerConnection::getStats):
3329         * Modules/mediastream/MediaEndpointPeerConnection.h:
3330         * Modules/mediastream/PeerConnectionBackend.h:
3331         * Modules/mediastream/RTCPeerConnection.cpp:
3332         (WebCore::RTCPeerConnection::getStats):
3333         * Modules/mediastream/RTCPeerConnection.h:
3334         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3335         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
3336         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
3337         (WebCore::LibWebRTCMediaEndpoint::getStats):
3338         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector):
3339         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
3340         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3341         (WebCore::LibWebRTCMediaEndpoint::addIceCandidate):
3342         (WebCore::LibWebRTCMediaEndpoint::isStopped):
3343         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3344         (WebCore::LibWebRTCPeerConnectionBackend::~LibWebRTCPeerConnectionBackend):
3345         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
3346         (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateSucceeded):
3347         (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateFailed):
3348         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
3349         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
3350         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
3351         (WebCore::LibWebRTCPeerConnectionBackend::addAudioSource):
3352         (WebCore::LibWebRTCPeerConnectionBackend::addVideoSource):
3353         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
3354         * testing/MockLibWebRTCPeerConnection.cpp:
3355         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer):
3356         (WebCore::releaseInNetworkThread):
3357         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::CreateOffer):
3358         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats):
3359         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::GetStats):
3360         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription):
3361         (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::SetLocalDescription):
3362         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
3363         * testing/MockLibWebRTCPeerConnection.h:
3364
3365 2017-02-07  Myles C. Maxfield  <mmaxfield@apple.com>
3366
3367         [Win] [GTK] [EFL] Compile (but don't use, yet) the platform-independent piece of ComplexTextController
3368         https://bugs.webkit.org/show_bug.cgi?id=167927
3369
3370         Reviewed by Brent Fulgham.
3371
3372         This patch simply moves some functions around to enable the Win, GTK, and EFL ports to compile the
3373         platform-independent pieces of ComplexTextController. Those parts of ComplexTextController have
3374         some dependencies which were previously only available on the Cocoa ports; however, those
3375         dependencies are easily created or moved from elsewhere. The next step is to populate the
3376         ComplexTextController::collectComplexTextRunsForCharacters() function for DirectWrite and HarfBuzz.
3377         Once that is done, UniscribeController and HarfBuzzShaper can be deleted.
3378
3379         Adds ComplexTextController TestWebKitAPI tests to the Win and GTK ports.
3380
3381         * CMakeLists.txt: Everyone can compile the platform-independent piece of ComplexTextController.
3382         * PlatformEfl.cmake: Add the HarfBuzz-specific piece.
3383         * PlatformGTK.cmake: Ditto.
3384         * PlatformWin.cmake: Add the DirectWrite-specific piece.
3385         * platform/graphics/ComplexTextController.cpp:
3386         (WebCore::TextLayoutDeleter::operator()): ComplexTextController shouldn't be enabled yet for Win,
3387         GTK, or EFL.
3388         (WebCore::FontCascade::createLayout): Ditto.
3389         (WebCore::FontCascade::width): Ditto.
3390         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Moved shared code to the shared
3391         file.
3392         * platform/graphics/Font.cpp:
3393         (WebCore::Font::noSynthesizableFeaturesFont): Default implementation for other ports.
3394         (WebCore::Font::variantCapsSupportsCharacterForSynthesis): Ditto.
3395         * platform/graphics/FontCascade.cpp:
3396         (WebCore::FontCascade::fontForCombiningCharacterSequence): Ditto.
3397         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Ditto.
3398         (WebCore::FontCascade::createLayout): Deleted. Moved to ComplexTextController.
3399         (WebCore::TextLayoutDeleter::operator()): Deleted. Ditto.
3400         * platform/graphics/FontCascade.h: fontForCombiningCharacterSequence() should exist on all ports.
3401         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
3402         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
3403         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3404         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Ditto.
3405         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Added.
3406         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
3407         HarfBuzz-specific piece of ComplexTextController.
3408         * platform/graphics/mac/ComplexTextControllerCoreText.mm: Moved constructors to shared file.
3409         * platform/graphics/win/ComplexTextControllerDirectWrite.cpp: Added.
3410         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Empty implementation of
3411         Direct Write-specific piece of ComplexTextController.
3412         * platform/graphics/win/FontWin.cpp:
3413         (WebCore::FontCascade::drawEmphasisMarksForComplexText): Deleted. Shared among all ports.
3414
3415 2017-02-07  Alex Christensen  <achristensen@webkit.org>
3416
3417         Revert r166597
3418         https://bugs.webkit.org/show_bug.cgi?id=167951
3419
3420         Reviewed by Andreas Kling.
3421
3422         * platform/spi/cf/CFNetworkSPI.h:
3423         Remove now-unused SPI declaration.
3424
3425 2017-02-07  Sam Weinig  <sam@webkit.org>
3426
3427         Try to fix the windows build.
3428
3429         * bindings/js/ReadableStreamDefaultController.cpp:
3430
3431 2017-02-07  Youenn Fablet  <youennf@gmail.com>
3432
3433         [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
3434         https://bugs.webkit.org/show_bug.cgi?id=167939
3435
3436         Reviewed by Sam Weinig.
3437
3438         Test: webrtc/no-port-zero-in-upd-candidates.html
3439
3440         * testing/MockLibWebRTCPeerConnection.cpp:
3441         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment.
3442
3443 2017-02-07  Sam Weinig  <sam@webkit.org>
3444
3445         Update bindings tests results for additional include.
3446
3447         * bindings/scripts/test/JS/JSTestObj.cpp:
3448         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3449
3450 2017-02-07  Sam Weinig  <sam@webkit.org>
3451
3452         Try to fix the windows build.
3453
3454         * bindings/js/JSDOMConvertNumbers.h:
3455
3456 2017-02-07  Alex Christensen  <achristensen@webkit.org>
3457
3458         Fix libwebrtc build after r211728
3459         https://bugs.webkit.org/show_bug.cgi?id=167821
3460
3461         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3462         (WebCore::RealtimeIncomingVideoSource::processNewSample):
3463         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3464         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3465         (WebCore::RealtimeOutgoingAudioSource::sourceHasMoreMediaData): Deleted.
3466         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3467         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
3468         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
3469         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
3470         (WebCore::RealtimeOutgoingVideoSource::sourceHasMoreMediaData): Deleted.
3471         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
3472
3473 2017-02-07  Tim Horton  <timothy_horton@apple.com>
3474
3475         Remove accidentally-added (in r211409) patch reject file
3476
3477         * bindings/scripts/test/JS/JSTestSerialization.cpp.rej: Removed.
3478
3479 2017-02-07  Sam Weinig  <sam@webkit.org>
3480
3481         JSDOMConvert is too big. Split it up!
3482         https://bugs.webkit.org/show_bug.cgi?id=167806
3483
3484         Rubber-stamped by Geoff Garen.
3485
3486         Split JSDOMConvert up roughly by IDL type. Some are grouped for convenience, e.g. all the
3487         string types are together, all the numeric types are together. Also moved helpers from 
3488         JSDOMBinding to their respective JSDOMConvertFoo header. For now, JSDOMConvert.h as an
3489         umbrella of all the sub headers, but it will be removed, and the code generator taught
3490         to include the right header in a subsequent patch.
3491
3492         * CMakeLists.txt:
3493         * WebCore.xcodeproj/project.pbxproj:
3494         Add new files.
3495
3496         * bindings/js/IDBBindingUtilities.cpp:
3497         * bindings/js/IDBBindingUtilities.h:
3498         Remove toJS that takes a std::optional<IDBKeyPath>, it was unused, and update date code
3499         to only call valueToDate once, and pass things by reference.
3500
3501         * bindings/js/JSDOMBinding.cpp:
3502         * bindings/js/JSDOMBinding.h:
3503         Move most of the conversion helpers into their respective JSDOMConvertFoo header.
3504
3505         * bindings/js/JSDOMConvert.h:
3506         Leave for now, just has includes of all the broken out headers.
3507
3508         * bindings/js/JSDOMConvertAny.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3509         * bindings/js/JSDOMConvertBase.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3510         * bindings/js/JSDOMConvertBoolean.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3511         * bindings/js/JSDOMConvertBufferSource.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3512         * bindings/js/JSDOMConvertCallbacks.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3513         * bindings/js/JSDOMConvertDate.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
3514         * bindings/js/JSDOMConvertDate.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3515         * bindings/js/JSDOMConvertDictionary.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3516         * bindings/js/JSDOMConvertEnumeration.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3517         * bindings/js/JSDOMConvertEventListener.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3518         * bindings/js/JSDOMConvertIndexedDB.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3519         * bindings/js/JSDOMConvertInterface.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3520         * bindings/js/JSDOMConvertJSON.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3521         * bindings/js/JSDOMConvertNull.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3522         * bindings/js/JSDOMConvertNullable.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3523         * bindings/js/JSDOMConvertNumbers.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
3524         * bindings/js/JSDOMConvertNumbers.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3525         * bindings/js/JSDOMConvertObject.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3526         * bindings/js/JSDOMConvertRecord.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3527         * bindings/js/JSDOMConvertSequences.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3528         * bindings/js/JSDOMConvertSerializedScriptValue.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3529         * bindings/js/JSDOMConvertStrings.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
3530         * bindings/js/JSDOMConvertStrings.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3531         * bindings/js/JSDOMConvertUnion.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3532         * bindings/js/JSDOMConvertVariadic.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3533         * bindings/js/JSDOMConvertWebGL.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3534         * bindings/js/JSDOMConvertXPathNSResolver.h: Copied from Source/WebCore/bindings/js/JSDOMConvert.h.
3535
3536         * bindings/scripts/CodeGeneratorJS.pm:
3537         (GenerateParametersCheck):
3538         Add include of JSDOMConvertVariadic.h rather than JSDOMConvert.
3539
3540         * bindings/js/JSCryptoCustom.cpp:
3541         * bindings/js/JSCryptoOperationData.cpp:
3542         * bindings/js/JSImageDataCustom.cpp:
3543         * bindings/js/ReadableStreamDefaultController.h:
3544         * bindings/js/WebCoreTypedArrayController.cpp:
3545         * html/canvas/WebGLAny.cpp:
3546         * platform/mac/SerializedPlatformRepresentationMac.mm:
3547         Add includes for specific JSDOMConvert header now that helpers have 
3548         been moved their from JSDOMBinding.h
3549
3550 2017-02-07  Sam Weinig  <sam@webkit.org>
3551
3552         Remove unnecessary exports on inline functions. They were causing build failures
3553         with some compilers.
3554
3555         * Modules/mediasource/SampleMap.h:
3556         (WebCore::PresentationOrderSampleMap::begin):
3557         (WebCore::PresentationOrderSampleMap::end):
3558         (WebCore::PresentationOrderSampleMap::rbegin):
3559         (WebCore::PresentationOrderSampleMap::rend):
3560         (WebCore::DecodeOrderSampleMap::begin):
3561         (WebCore::DecodeOrderSampleMap::end):
3562         (WebCore::DecodeOrderSampleMap::rbegin):
3563         (WebCore::DecodeOrderSampleMap::rend):
3564         (WebCore::SampleMap::sizeInBytes):
3565         (WebCore::SampleMap::decodeOrder):
3566         (WebCore::SampleMap::presentationOrder):
3567         (WebCore::SampleMap::addRange):
3568         (WebCore::SampleMap::SampleMap): Deleted.
3569
3570 2017-02-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3571
3572         Unreviewed, manual roll out of r211777
3573         https://bugs.webkit.org/show_bug.cgi?id=167457
3574
3575         * bindings/js/ScriptModuleLoader.cpp:
3576         (WebCore::ScriptModuleLoader::importModule):
3577
3578 2017-02-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3579
3580         [GStreamer] Deadlock when media player is destroyed
3581         https://bugs.webkit.org/show_bug.cgi?id=167861
3582
3583         Reviewed by Michael Catanzaro.
3584
3585         The problem is that we are calling notifyOne() for the draw mutex without taking the lock.
3586
3587         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3588         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
3589
3590 2017-02-07  Zan Dobersek  <zdobersek@igalia.com>
3591
3592         MediaSourceClientGStreamerMSE: wrap FastMalloc-ed memory into pipeline-bound GstBuffers
3593         https://bugs.webkit.org/show_bug.cgi?id=167928
3594
3595         Reviewed by Xabier Rodriguez-Calvar.
3596
3597         The buffers created in MediaSourceClientGStreamerMSE can be large enough in size
3598         that repetitive allocations can cause larger heap fragmentation in different libc
3599         allocators. To avoid that occurrence, we should simply use FastMalloc to allocate
3600         memory for these buffers.
3601
3602         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3603         (WebCore::MediaSourceClientGStreamerMSE::append):
3604
3605 2017-02-07  Antoine Quint  <graouts@apple.com>
3606
3607         [Modern Media Controls] Handle media durations of an hour or more gracefully
3608         https://bugs.webkit.org/show_bug.cgi?id=167882
3609         <rdar://problem/29601260>
3610
3611         Reviewed by Eric Carlson.
3612
3613         We add a new "labelsMayDisplayTimesOverAnHour" to TimeControl so that time labels
3614         to the left and right of the scrubber may have extra room to display to account for
3615         the extra "xx:" characters that may appear. We don't lay the time out dynamically
3616         such that we don't see layout jumps as the times shown in the labels go around
3617         the hour mark.
3618
3619         We also refactor the ElapsedTimeSupport and RemainingTimeSupport in a single
3620         TimeLabelsSupport class which updates both elapsed and remaining time labels
3621         and sets the "labelsMayDisplayTimesOverAnHour" on the TimeControl should a
3622         "durationchange" happen to make the media duration reach or go past the hour mark.
3623
3624         Tests: http/tests/media/modern-media-controls/time-labels-support/long-time.html
3625                media/modern-media-controls/time-control/time-control-labels-may-display-times-over-an-hour.html
3626                media/modern-media-controls/time-labels-support/elapsed-time.html
3627                media/modern-media-controls/time-labels-support/remaining-time.html
3628
3629         * Modules/modern-media-controls/controls/time-control.js:
3630         (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour):
3631         (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour):
3632         (TimeControl.prototype.set width):
3633         * Modules/modern-media-controls/controls/time-label.css:
3634         (.time-label):
3635         * Modules/modern-media-controls/js-files:
3636         * Modules/modern-media-controls/media/elapsed-time-support.js: Removed.
3637         * Modules/modern-media-controls/media/media-controller.js:
3638         (MediaController.prototype._updateControlsIfNeeded):
3639         * Modules/modern-media-controls/media/time-labels-support.js: Renamed from Source/WebCore/Modules/modern-media-controls/media/remaining-time-support.js.
3640         (TimeLabelsSupport.prototype.get control):
3641         (TimeLabelsSupport.prototype.syncControl):
3642         (TimeLabelsSupport):
3643         * WebCore.xcodeproj/project.pbxproj:
3644
3645 2017-02-06  Per Arne Vollan  <pvollan@apple.com>
3646
3647         Read stroke width of subtitles from MediaAccessibility framework.
3648         https://bugs.webkit.org/show_bug.cgi?id=167871
3649         <rdar://problem/29265906>
3650
3651         Reviewed by Brent Fulgham.
3652
3653         Read MACaptionFontAttributeStrokeWidth from CTFontDescriptorRef.
3654
3655         * page/CaptionUserPreferencesMediaAF.cpp:
3656         (WebCore::CaptionUserPreferencesMediaAF::strokeWidth):
3657         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
3658         * page/CaptionUserPreferencesMediaAF.h:
3659         * platform/cf/MediaAccessibilitySoftLink.cpp:
3660         * platform/cf/MediaAccessibilitySoftLink.h:
3661
3662 2017-02-07  Antoine Quint  <graouts@apple.com>
3663
3664         [Modern Media Controls] Improve handling of <video> with only audio tracks
3665         https://bugs.webkit.org/show_bug.cgi?id=167836
3666         <rdar://problem/30255812>
3667
3668         Reviewed by Dean Jackson.
3669
3670         We now check for the availability of video tracks before considering a <video>
3671         element is displaying an actual video file and turning auto-hide on. We also
3672         check that we have video tracks before enabling the fullscreen button. This
3673         brings the behavior of a <video> pointing to a resource with no video tracks
3674         to be the same as an <audio> element.
3675
3676         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
3677
3678         * Modules/modern-media-controls/media/controls-visibility-support.js:
3679         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
3680         (ControlsVisibilitySupport.prototype._updateControls):
3681         (ControlsVisibilitySupport):
3682         * Modules/modern-media-controls/media/fullscreen-support.js:
3683         (FullscreenSupport.prototype.syncControl):
3684         (FullscreenSupport):
3685
3686 2017-02-07  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3687
3688         [Readable Streams API] Implement ReadableByteStreamController enqueue()
3689         https://bugs.webkit.org/show_bug.cgi?id=167786
3690
3691         Reviewed by Youenn Fablet.
3692
3693         Implemented ReadableByteStreamController enqueue() method. Also replaced
3694         @queue by an Array instead of a dedicated queue object (said object is
3695         useful for ReadableStreamDefaultController, but not for ReadableByteStreamController).
3696
3697         Added 8 tests to cover newly added code as well as code that was previously unreachable.
3698
3699         * Modules/streams/ReadableByteStreamController.js:
3700         (enqueue): Implemented as defined by spec.
3701         * Modules/streams/ReadableByteStreamInternals.js:
3702         (privateInitializeReadableByteStreamController): Updated @queue.
3703         (readableByteStreamControllerCancel): Updated @queue.
3704         (readableByteStreamControllerError): Updated @queue.
3705         (readableByteStreamControllerPull): Updated @queue.
3706         (readableByteStreamControllerEnqueue): Added.
3707         (readableByteStreamControllerEnqueueChunkToQueue): Added.
3708         * Modules/streams/ReadableStreamInternals.js:
3709         (readableStreamFulfillReadRequest): Added (used at different places).
3710
3711 2017-02-07  Chris Dumez  <cdumez@apple.com>
3712
3713         Object.preventExtensions() on a Location object should throw a TypeError
3714         https://bugs.webkit.org/show_bug.cgi?id=167917
3715
3716         Reviewed by Alex Christensen.
3717
3718         Object.preventExtensions() on a Location object should throw a TypeError:
3719         - https://html.spec.whatwg.org/#location-preventextensions
3720         - https://www.ecma-international.org/ecma-262/7.0/index.html#sec-object.preventextensions
3721
3722         Firefox already implements this.
3723
3724         No new tests, rebaselined existing tests.
3725
3726         * bindings/js/JSLocationCustom.cpp:
3727         (WebCore::JSLocation::preventExtensions):
3728
3729 2017-02-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3730
3731         Web Inspector: allow import() inside the inspector
3732         https://bugs.webkit.org/show_bug.cgi?id=167457
3733
3734         Reviewed by Ryosuke Niwa.
3735
3736         When evaluating `import("...")`, we need the caller's context to resolve
3737         the module specifier correctly. For example, if `import("./cocoa.js")` is
3738         evaluated in the script "drinks/hot.js", this module name is resolved to
3739         "drinks/cocoa.js". If the same import operator is evaluated in the script
3740         "menu/all.js", the module specifier becomes "menu/cocoa.js".
3741
3742         Previously we reject the import operator if the caller does not have such
3743         a context. These context is SourceOrigin and its ScriptFetcher. While they
3744         are offered in the script tag and other code evaluations, the inspector
3745         console does not offer that. These class are offered in the WebCore side
3746         and we should not touch these classes in the JSC's inspector code.
3747
3748         Now we relax the above restriction. If the above caller information is not
3749         offered, we fallback to the default one. In the web page, we use the page's
3750         URL as the caller's source origin. This allows us to evaluate the import
3751         operator in the inspector console.
3752
3753         And as of r167698, the console recognizes `await import("...")` form. We use
3754         this to test this `import()` in the console functionality.
3755
3756         * bindings/js/ScriptModuleLoader.cpp:
3757         (WebCore::ScriptModuleLoader::importModule):
3758
3759 2017-02-07  Myles C. Maxfield  <mmaxfield@apple.com>
3760
3761         Move platform-independent parts of ComplexTextController out of mac/ subfolder
3762         https://bugs.webkit.org/show_bug.cgi?id=167922
3763
3764         Reviewed by Jon Lee.
3765
3766         Just a mechanical git mv, and updating the Xcode projects.
3767
3768         No new tests because there is no behavior change.
3769
3770         * WebCore.xcodeproj/project.pbxproj:
3771         * platform/graphics/ComplexTextController.cpp: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.cpp.
3772         * platform/graphics/ComplexTextController.h: Renamed from Source/WebCore/platform/graphics/mac/ComplexTextController.h.
3773
3774 2017-02-06  Carlos Garcia Campos  <cgarcia@igalia.com>
3775
3776         Overlay scrolling with iframe-s broken
3777         https://bugs.webkit.org/show_bug.cgi?id=165056
3778
3779         Reviewed by Antonio Gomes.
3780
3781         Mouse press events for overlay scrollbars are ignored if there's a subframe under the scrollbar. This doesn't
3782         happen with normal scrollbars, because the subframe is not really under the scrollbar, so events are always
3783         correctly passed to the scrollbar. With overlay scrollbars, the hit test detects the scrollbar, but events are
3784         always passed first to the subframe. Scrollbars are correctly updated on hover though, because
3785         handleMouseMoveEvent checks the presence of scrollbars before checking for subframes and move events are
3786         actually passed to both, the scrollbar and the subframe. Overlay scrollbars should always take precedence over
3787         subframes to handle mouse press events, so we should check first if mouse is over a scrollbar and never pass the
3788         event to a subframe in that case. Another problem is that the cursor is not updated either when the overlay
3789         scrollbar is hovered and there's a subframe. This is because in handleMouseMoveEvent we pass the event to both
3790         the scrollbar and subframe but we never update the cursor when a suframe was found. So, here again we need to make
3791         an exception for scrollbars and upate the cursor when mouse is over the scrollbar even if a subframe was found.
3792
3793         Test: fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html
3794
3795         * page/EventHandler.cpp:
3796         (WebCore::EventHandler::handleMousePressEvent): Move the scrollbar check before the subframe check.
3797         (WebCore::EventHandler::handleMouseMoveEvent): Update the cursor when hovering a scrollbar even if a subframe
3798         was found.
3799         (WebCore::EventHandler::updateLastScrollbarUnderMouse): Use an enum instead of a boolean for setLast parameter.
3800         * page/EventHandler.h:
3801
3802 2017-02-06  Chris Dumez  <cdumez@apple.com>
3803
3804         Symbols exposed on cross-origin Window / Location objects should be configurable
3805         https://bugs.webkit.org/show_bug.cgi?id=167920
3806
3807         Reviewed by Ryosuke Niwa.
3808
3809         Symbols exposed on cross-origin Window / Location objects should be configurable:
3810         - https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-) (Step 1)
3811
3812         Firefox behaves as per specification.
3813
3814         No new tests, rebaselined existing test.
3815
3816         * bindings/js/JSDOMWindowCustom.cpp:
3817         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
3818         * bindings/js/JSLocationCustom.cpp:
3819         (WebCore::JSLocation::getOwnPropertySlotDelegate):
3820
3821 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
3822
3823         Web Inspector: Do not use RunLoop when dispatching inspector GC event
3824         https://bugs.webkit.org/show_bug.cgi?id=167683
3825         <rdar://problem/30167791>
3826
3827         Reviewed by Brian Burg.
3828
3829         Covered by existing tests.
3830
3831         * CMakeLists.txt:
3832         * WebCore.xcodeproj/project.pbxproj:
3833         * inspector/InspectorAllInOne.cpp:
3834         Add new file.
3835
3836         * inspector/PageHeapAgent.cpp:
3837         (WebCore::PageHeapAgent::PageHeapAgent):
3838         (WebCore::PageHeapAgent::enable):
3839         (WebCore::PageHeapAgent::disable):
3840         * inspector/PageHeapAgent.h:
3841         Extend WebHeapAgent.
3842
3843         * inspector/WorkerInspectorController.cpp:
3844         (WebCore::WorkerInspectorController::WorkerInspectorController):
3845         Use WebHeapAgent.
3846
3847         * inspector/WebHeapAgent.cpp: Added.
3848         (WebCore::SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask):
3849         (WebCore::SendGarbageCollectionEventsTask::addGarbageCollection):
3850         (WebCore::SendGarbageCollectionEventsTask::reset):
3851         (WebCore::SendGarbageCollectionEventsTask::timerFired):
3852         (WebCore::WebHeapAgent::WebHeapAgent):
3853         (WebCore::WebHeapAgent::~WebHeapAgent):
3854         (WebCore::WebHeapAgent::disable):
3855         (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent):
3856         (WebCore::WebHeapAgent::dispatchGarbageCollectionEventsAfterDelay):
3857         * inspector/WebHeapAgent.h:
3858         Move the defered event dispatch from InspectorHeapAgent here where a RunLoop is guarenteed.
3859
3860 2017-02-06  Joseph Pecoraro  <pecoraro@apple.com>
3861
3862         ExtendedColor leaks seen on leaks bot
3863         https://bugs.webkit.org/show_bug.cgi?id=167912
3864
3865         Reviewed by Alexey Proskuryakov.
3866
3867         * platform/graphics/Color.cpp:
3868         (WebCore::Color::operator=):
3869         Before overwriting m_colorData, we must deref the extended color inside it.
3870
3871 2017-02-06  Simon Fraser  <simon.fraser@apple.com>
3872
3873         Re-land r210095 (avoid a tile revalidation on scale change)
3874         https://bugs.webkit.org/show_bug.cgi?id=167866
3875
3876         Reviewed by Tim Horton.
3877         
3878         r210095 was rolled out in r211230 but now that all TileControllers unparent
3879         offscreen tiles, we can roll it back it.
3880         
3881         Also add more Tiling logging.
3882
3883         * platform/graphics/ca/TileGrid.cpp:
3884         (WebCore::validationPolicyAsString):
3885         (WebCore::TileGrid::setScale):
3886         (WebCore::TileGrid::prepopulateRect):
3887         (WebCore::TileGrid::revalidateTiles):
3888         (WebCore::TileGrid::ensureTilesForRect):
3889
3890 2017-02-06  Myles C. Maxfield  <mmaxfield@apple.com>
3891
3892         Migrate ComplexTextController to use platform-independent types
3893         https://bugs.webkit.org/show_bug.cgi?id=167833
3894
3895         Reviewed by Brent Fulgham.
3896
3897         ComplexTextController will eventually be used on all ports to perform complex text layout.
3898         This is a mechanical patch which migrates the shared parts of ComplexTextController away from
3899         using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
3900         ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
3901         fix first.
3902
3903         No new tests because there is no behavior change.
3904
3905         * platform/graphics/GlyphBuffer.h:
3906         (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
3907         * platform/graphics/mac/ComplexTextController.cpp:
3908         (WebCore::ComplexTextController::offsetForPosition):
3909         (WebCore::advanceByCombiningCharacterSequence):
3910         (WebCore::ComplexTextController::ComplexTextRun::indexAt):
3911         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
3912         (WebCore::ComplexTextController::advance):
3913         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3914         * platform/graphics/mac/ComplexTextController.h:
3915         (WebCore::ComplexTextController::ComplexTextRun::create):
3916         (WebCore::ComplexTextController::ComplexTextRun::stringLength):
3917         (WebCore::ComplexTextController::ComplexTextRun::indexBegin):
3918         (WebCore::ComplexTextController::ComplexTextRun::indexEnd):
3919         (WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
3920         (WebCore::ComplexTextController::ComplexTextRun::glyphs):
3921         (WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
3922         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
3923         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
3924         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
3925         (WebCore::ComplexTextController::glyphOrigin):
3926         (WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
3927         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3928         (SOFT_LINK):
3929         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
3930         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
3931
3932 2017-02-06  Brent Fulgham  <bfulgham@apple.com>
3933
3934         Correct File Path Handling in SecurityOrigin and FileSystem
3935         https://bugs.webkit.org/show_bug.cgi?id=167894
3936         <rdar://problem/30380080>
3937
3938         Reviewed by Alexey Proskuryakov.
3939
3940         Roll out the URL decoding being done in the FileSystem class (added in Bug 167894), and instead ensure that
3941         SecurityOrigin properly handles file URLs, and only passes valid file strings to the FileSystem interface.
3942
3943         Tested by FileSystemTests and SecurityOriginTests in TestWebKitAPI.
3944
3945         * page/SecurityOrigin.cpp:
3946         (WebCore::SecurityOrigin::SecurityOrigin): Initialize m_filePath using the url's fileSystemPath, not
3947         the %-encoded 'path' property.
3948         (WebCore::SecurityOrigin::canDisplay): Pass the 'fileSystemPath' to 'filesHaveSameVolume', rather than
3949         the %-encoded 'path' property.
3950         * page/SecurityOrigin.h:
3951         * platform/FileSystem.cpp:
3952         (WebCore::filesHaveSameVolume): Do not use 'decodeURLEscapeSequences' in 'filesHaveSameVolume'.
3953
3954 2017-02-06  Andy Estes  <aestes@apple.com>
3955
3956         [Cocoa] Split FileSystemMac.mm into Mac and Cocoa parts
3957         https://bugs.webkit.org/show_bug.cgi?id=167908
3958
3959         Reviewed by Sam Weinig.
3960
3961         Kept the Mac-only functions in FileSystemMac.mm and moved the rest into FileSystemCocoa.mm.
3962
3963         * PlatformMac.cmake:
3964         * WebCore.xcodeproj/project.pbxproj:
3965         * platform/cocoa/FileSystemCocoa.mm: Copied from Source/WebCore/platform/mac/FileSystemMac.mm.
3966         * platform/mac/FileSystemMac.mm:
3967         (-[WebFileManagerDelegate fileManager:shouldProceedAfterError:movingItemAtURL:toURL:]): Moved to FileSystemCocoa.mm.
3968         (WebCore::homeDirectoryPath): Ditto.
3969         (WebCore::openTemporaryFile): Ditto.
3970         (WebCore::moveFile): Ditto.
3971         (WebCore::getVolumeFreeSpace): Ditto.
3972
3973 2017-02-06  Eric Carlson  <eric.carlson@apple.com>
3974
3975         [MediaStream Mac] Remove some unused code
3976         https://bugs.webkit.org/show_bug.cgi?id=167913
3977
3978         Reviewed by Jer Noble.
3979
3980         No new tests, no functional change.
3981
3982         * platform/mediastream/CaptureDeviceManager.h:
3983         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
3984         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
3985         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
3986         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3987         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3988         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList):
3989         (WebCore::AVCaptureSessionInfo::AVCaptureSessionInfo): Deleted.