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