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