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