Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-05  Zalan Bujtas  <zalan@apple.com>
2
3         Simple line layout: Bail out from Simple Line Layout on surrogate pairs.
4         https://bugs.webkit.org/show_bug.cgi?id=167840
5         <rdar://problem/30364784>
6
7         Reviewed by Myles C. Maxfield.
8
9         Surrogate pairs require special line breaking logic. 
10
11         Test: fast/text/simple-line-layout-no-surrogate-pairs.html
12
13         * rendering/SimpleLineLayout.cpp:
14         (WebCore::SimpleLineLayout::canUseForCharacter):
15         (WebCore::SimpleLineLayout::canUseForText): Checking against special characters is faster than
16         checking against glyphs. Reverse their order. 
17         (WebCore::SimpleLineLayout::printReason):
18
19 2017-02-04  Joseph Pecoraro  <pecoraro@apple.com>
20
21         Static Analyzer: WebCoreNSURLExtras.mm: Potential leak of memory pointed to by 'allBytesBuffer'
22         https://bugs.webkit.org/show_bug.cgi?id=167849
23
24         Reviewed by Sam Weinig.
25
26         Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:883:20: warning: Potential leak of memory pointed to by 'allBytesBuffer'
27                     return nil;
28                            ^~~
29
30         * platform/mac/WebCoreNSURLExtras.mm:
31         (WebCore::dataForURLComponentType):
32         Free the potentially malloc'd buffer before the early return.
33
34 2017-02-04  Chris Dumez  <cdumez@apple.com>
35
36         Unreviewed, fix mistake in comment added in r211569.
37
38         * history/PageCache.cpp:
39         (WebCore::PageCache::removeAllItemsForPage):
40
41 2017-02-04  Yoav Weiss  <yoav@yoav.ws>
42
43         Fix memory issues related to preload eviction.
44         https://bugs.webkit.org/show_bug.cgi?id=167838
45
46         Reviewed by Andreas Kling.
47
48         This avoids removing resources from m_preloads during the iteration
49         by creating a second HashSetList containing the remaining link preloads.
50
51         No new tests but this will fix crashes on the leak bots.
52
53         * loader/cache/CachedResourceLoader.cpp:
54         (WebCore::CachedResourceLoader::clearPreloads):
55
56 2017-02-04  Zalan Bujtas  <zalan@apple.com>
57
58         Simple line layout: Skip 16bit specific checks on 8bit content.
59         https://bugs.webkit.org/show_bug.cgi?id=167831
60         <rdar://problem/30361948>
61
62         Reviewed by Antti Koivisto and Myles C. Maxfield.
63
64         Skip various checks on 8bit content.
65
66         Covered by existing tests.
67
68         * rendering/SimpleLineLayout.cpp:
69         (WebCore::SimpleLineLayout::canUseForCharacter):
70         (WebCore::SimpleLineLayout::canUseForText):
71         (WebCore::SimpleLineLayout::canUseForFontAndText):
72
73 2017-02-03  Zalan Bujtas  <zalan@apple.com>
74
75         Simple line layout: Remove redundant codepath check.
76         https://bugs.webkit.org/show_bug.cgi?id=167827
77         <rdar://problem/30361850>
78
79         Reviewed by Myles C. Maxfield.
80
81         FontCascade::codePath() iterates through the entire text. It's rather wasteful to do twice.
82
83         No change in functionality.
84
85         * rendering/SimpleLineLayout.cpp:
86         (WebCore::SimpleLineLayout::canUseForFontAndText):
87         (WebCore::SimpleLineLayout::printReason):
88
89 2017-02-03  Myles C. Maxfield  <mmaxfield@apple.com>
90
91         REGRESSION(r204858): Synthetic bold text in vertical writing mode is rotated away from original text
92         https://bugs.webkit.org/show_bug.cgi?id=167826
93         <rdar://problem/28193222>
94
95         Reviewed by Zalan Bujtas.
96
97         When drawing vertical text, the rotation is not reset between successive paint calls. We implement
98         synthetic bold by drawing text twice, which means that the second draw call was getting rotated
99         twice. This was an oversight in r204858.
100
101         Test: fast/text/synthetic-bold-vertical-text.html
102
103         * platform/graphics/cocoa/FontCascadeCocoa.mm:
104         (WebCore::showGlyphsWithAdvances):
105
106 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
107
108         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
109         https://bugs.webkit.org/show_bug.cgi?id=167768
110
111         Reviewed by Geoffrey Garen.
112
113         The public APIs still return double (DOMHighResTimeStamp), which
114         is milliseconds since a time origin:
115         https://w3c.github.io/hr-time/#dom-domhighrestimestamp
116
117         * loader/LoadTiming.cpp:
118         (WebCore::LoadTiming::secondsSinceStartTime):
119         (WebCore::LoadTiming::monotonicTimeToPseudoWallTime):
120         (WebCore::LoadTiming::markStartTime):
121         (WebCore::LoadTiming::addRedirect):
122         (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime): Deleted.
123         * loader/LoadTiming.h:
124         (WebCore::LoadTiming::markUnloadEventStart):
125         (WebCore::LoadTiming::markUnloadEventEnd):
126         (WebCore::LoadTiming::markRedirectStart):
127         (WebCore::LoadTiming::markRedirectEnd):
128         (WebCore::LoadTiming::markFetchStart):
129         (WebCore::LoadTiming::setResponseEnd):
130         (WebCore::LoadTiming::markLoadEventStart):
131         (WebCore::LoadTiming::markLoadEventEnd):
132         (WebCore::LoadTiming::startTime):
133         (WebCore::LoadTiming::unloadEventStart):
134         (WebCore::LoadTiming::unloadEventEnd):
135         (WebCore::LoadTiming::redirectStart):
136         (WebCore::LoadTiming::redirectEnd):
137         (WebCore::LoadTiming::fetchStart):
138         (WebCore::LoadTiming::responseEnd):
139         (WebCore::LoadTiming::loadEventStart):
140         (WebCore::LoadTiming::loadEventEnd):
141         (WebCore::LoadTiming::redirectCount):
142         (WebCore::LoadTiming::referenceMonotonicTime):
143         (WebCore::LoadTiming::referenceWallTime):
144         Use MonotonicTime and WallTime for timestamps and references.
145
146         * dom/Document.cpp:
147         (WebCore::Document::setReadyState):
148         (WebCore::Document::finishedParsing):
149         (WebCore::Document::monotonicTimestamp):
150         * dom/DocumentTiming.h:
151         (WebCore::DocumentTiming::DocumentTiming): Deleted.
152         * dom/ScriptedAnimationController.cpp:
153         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
154         * inspector/InspectorNetworkAgent.cpp:
155         (WebCore::InspectorNetworkAgent::buildObjectForTiming):
156         (WebCore::InspectorNetworkAgent::didFinishLoading):
157         * loader/DocumentLoader.cpp:
158         (WebCore::DocumentLoader::finishedLoading):
159         (WebCore::DocumentLoader::dataReceived):
160         * loader/DocumentLoader.h:
161         * loader/SubresourceLoader.cpp:
162         (WebCore::SubresourceLoader::didFinishLoading):
163         * loader/cache/CachedResourceLoader.cpp:
164         (WebCore::CachedResourceLoader::requestResource):
165         * page/DOMWindow.cpp:
166         (WebCore::DOMWindow::performance):
167         Use new types instead of raw doubles.
168
169         * page/Performance.cpp:
170         (WebCore::Performance::Performance):
171         (WebCore::Performance::now):
172         (WebCore::Performance::reduceTimeResolution):
173         (WebCore::Performance::addResourceTiming):
174         * page/Performance.h:
175         Do time arithmatic with WTF::Time classes.
176         This clarifies that we reduce our timestamps to 100us
177         resolution instead of the maximum 5us allowed by the spec.
178
179         * page/PerformanceResourceTiming.cpp:
180         (WebCore::monotonicTimeToDOMHighResTimeStamp):
181         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
182         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
183         * page/PerformanceResourceTiming.h:
184         * page/PerformanceTiming.cpp:
185         (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart):
186         (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
187         (WebCore::toIntegerMilliseconds): Deleted.
188         * page/PerformanceTiming.h:
189         Do time arithmatic with WTF::Time classes.
190
191         * workers/DedicatedWorkerGlobalScope.cpp:
192         (WebCore::DedicatedWorkerGlobalScope::create):
193         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
194         * workers/DedicatedWorkerGlobalScope.h:
195         * workers/DedicatedWorkerThread.cpp:
196         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
197         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
198         * workers/DedicatedWorkerThread.h:
199         * workers/WorkerGlobalScope.cpp:
200         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
201         * workers/WorkerGlobalScope.h:
202         * workers/WorkerGlobalScopeProxy.h:
203         * workers/WorkerMessagingProxy.cpp:
204         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
205         * workers/WorkerMessagingProxy.h:
206         * workers/WorkerThread.cpp:
207         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
208         (WebCore::WorkerThread::WorkerThread):
209         * workers/WorkerThread.h:
210         Pass time origin as MonotonicTime.
211
212         * workers/Worker.cpp:
213         (WebCore::Worker::create):
214         (WebCore::Worker::notifyFinished):
215         * workers/Worker.h:
216         Rename creation timestamp member. This matches Document's m_documentCreationTime.
217
218 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
219
220         WK1 mouse events are missing movementX and movementY for pointerlock.
221         https://bugs.webkit.org/show_bug.cgi?id=167775
222         rdar://problem/30343810
223
224         Reviewed by Alexey Proskuryakov.
225
226         pointer-lock/mouse-event-delivery.html
227
228         Improve mouse-event-delivery.html test to mouse move and check for valid movementX and movementY.
229         
230         * platform/mac/PlatformEventFactoryMac.mm:
231         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): WK1 plumb throuhg movementX and movementY
232
233 2017-02-03  Simon Fraser  <simon.fraser@apple.com>
234
235         Correctly set the "inWindow" flag for TileControllers that aren't the page tiles, and clarify "usingTiledBacking" logic
236         https://bugs.webkit.org/show_bug.cgi?id=167774
237
238         Reviewed by Tim Horton.
239
240         RenderLayerBacking had some very confusing "usingTiledCacheLayer" uses.
241
242         Its member variable, m_usingTiledCacheLayer, really meant "m_isMainFrameLayerWithTiledBacking" so make it so.
243         It had a usingTiledBacking(), which returned the same thing, which this patch replaces with isMainFrameLayerWithTiledBacking().
244
245         The fact that usingTiledBacking() was only true for the page tiled layer tripped up
246         RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants(), which would only ever call setIsInWindow()
247         on the page tiled layer. These changes fix that.
248
249         Also make a way for tests to unparent the web view via UIScriptController, and dump out the "in window"
250         status of TileBackings when dumping tile caches.
251
252         Test: tiled-drawing/tiled-backing-in-window.html
253
254         * platform/graphics/TiledBacking.h:
255         * platform/graphics/ca/GraphicsLayerCA.cpp:
256         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
257         * platform/graphics/ca/TileController.h:
258         * rendering/RenderLayerBacking.cpp:
259         (WebCore::RenderLayerBacking::RenderLayerBacking):
260         (WebCore::computePageTiledBackingCoverage):
261         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
262         (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
263         (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
264         (WebCore::RenderLayerBacking::shouldClipCompositedBounds):
265         (WebCore::RenderLayerBacking::updateDescendantClippingLayer):
266         (WebCore::RenderLayerBacking::updateRootLayerConfiguration):
267         (WebCore::RenderLayerBacking::paintsIntoWindow):
268         (WebCore::computeTileCoverage): Deleted.
269         * rendering/RenderLayerBacking.h:
270         * rendering/RenderLayerCompositor.cpp:
271         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
272         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
273         (WebCore::RenderLayerCompositor::setIsInWindowForLayerIncludingDescendants):
274         (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing):
275         (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
276
277 2017-02-03  Zalan Bujtas  <zalan@apple.com>
278
279         Simple line layout: Bail out from Simple Line Layout when the primary font is insufficient.
280         https://bugs.webkit.org/show_bug.cgi?id=167820
281         <rdar://problem/30359685>
282
283         Reviewed by Myles C. Maxfield.
284
285         Currently simple line layout requires the primary font to have all the glyps for the content.
286
287         Test: fast/text/simple-line-layout-do-not-support-unicode-range.html
288
289         * rendering/SimpleLineLayout.cpp:
290         (WebCore::SimpleLineLayout::canUseForText):
291         (WebCore::SimpleLineLayout::canUseForFontAndText):
292         (WebCore::SimpleLineLayout::printReason):
293
294 2017-02-03  Jer Noble  <jer.noble@apple.com>
295
296         ASSERT in HTMLMediaElement::~HTMLMediaElement
297         https://bugs.webkit.org/show_bug.cgi?id=167818
298
299         Reviewed by Brent Fulgham.
300
301         Test: media/audio-dealloc-crash.html
302
303         HTMLMediaElement's MediaElementSession can nominate the HTMLMediaElement itself
304         to become the playback controls session from inside the HTMLMediaElement destructor. Protect
305         against this by clearing out the session before calling updatePlaybackControlsManager().
306
307         * html/HTMLMediaElement.cpp:
308         (WebCore::HTMLMediaElement::~HTMLMediaElement):
309
310 2017-02-03  Daniel Bates  <dabates@apple.com>
311
312         [Mac][WK2] Add SPI to override the Content Security Policy of a page
313         https://bugs.webkit.org/show_bug.cgi?id=167810
314         <rdar://problem/30102568>
315
316         Reviewed by Anders Carlsson.
317
318         * dom/Document.cpp:
319         (WebCore::Document::initSecurityContext): Apply the embedding client's override Content Security
320         Policy to the document if one exists.
321         * loader/FrameLoaderClient.h: Add function overrideContentSecurityPolicy() that a FrameLoaderClient
322         can override to provide a custom Content Security Policy for a document (defaults: null string - no policy).
323         As its name implies, the policy returned by overrideContentSecurityPolicy() will define the Content
324         Security Policy for the document, overriding any subsequently received Content Security Policy for
325         the document.
326         * page/csp/ContentSecurityPolicy.cpp:
327         (WebCore::ContentSecurityPolicy::copyStateFrom): Only copy policies from the specified ContentSecurityPolicy
328         object if our policy was not specified by the embedding client.
329         (WebCore::ContentSecurityPolicy::didReceiveHeader): Set ContentSecurityPolicy::m_hasAPIPolicy to true
330         when we receive an API policy from the embedding client (ContentSecurityPolicy::PolicyFrom::API). An
331         API policy must be defined before a policy received from a document. Do not process a received header
332         if we already have an API policy as the API policy overrides all other policies.
333         * page/csp/ContentSecurityPolicy.h:
334
335 2017-02-03  Chris Dumez  <cdumez@apple.com>
336
337         Drop Mac App Store workaround for window.getComputedStyle()
338         https://bugs.webkit.org/show_bug.cgi?id=166891
339         <rdar://problem/28282452>
340
341         Reviewed by Sam Weinig.
342
343         Drop Mac App Store workaround for window.getComputedStyle() now that
344         <rdar://problem/28020681> has been fixed.
345
346         * page/DOMWindow.cpp:
347         * page/DOMWindow.h:
348         * page/DOMWindow.idl:
349         * platform/RuntimeApplicationChecks.h:
350         * platform/RuntimeApplicationChecks.mm:
351         (WebCore::MacApplication::isAppStore): Deleted.
352
353 2017-02-03  Chris Dumez  <cdumez@apple.com>
354
355         Dismiss HTML form validation popover when pressing Escape key
356         https://bugs.webkit.org/show_bug.cgi?id=167716
357         <rdar://problem/29872943>
358
359         Reviewed by Simon Fraser.
360
361         Dismiss any visible HTML form validation popover when pressing
362         the Escape key.
363
364         Test: fast/forms/validation-bubble-escape-key-dismiss.html
365
366         * page/EventHandler.cpp:
367         (WebCore::EventHandler::keyEvent):
368         * page/ValidationMessageClient.h:
369
370 2017-02-03  Jeremy Jones  <jeremyj@apple.com>
371
372         Pointer lock events should be delivered directly to the target element
373         https://bugs.webkit.org/show_bug.cgi?id=167134
374         rdar://problem/30268004
375
376         Reviewed by Dean Jackson.
377
378         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
379
380         When pointer is locked on an element, route mouse events directly to the target element, instead of 
381         doing the normal event disptach.
382
383         * page/EventHandler.cpp:
384         (WebCore::EventHandler::handleMousePressEvent):
385         (WebCore::EventHandler::handleMouseDoubleClickEvent):
386         (WebCore::EventHandler::handleMouseMoveEvent):
387         (WebCore::EventHandler::handleMouseReleaseEvent):
388         (WebCore::EventHandler::handleMouseForceEvent):
389         (WebCore::EventHandler::handleWheelEvent):
390         * page/PointerLockController.cpp:
391         (WebCore::PointerLockController::isLocked): Added.
392         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
393         * page/PointerLockController.h:
394
395 2017-02-03  Yoav Weiss  <yoav@yoav.ws>
396
397         Avoid evicting link preload resources when parsing is done.
398         https://bugs.webkit.org/show_bug.cgi?id=167415
399
400         Reviewed by Ryosuke Niwa.
401
402         Currently all preloads (speculative and link preload) are being cleared when the document has finished parsing.
403         When it comes to link preloads, it can result in resources being cleared before the page had a chance to use them. (e.g. resources
404         that are preloaded in order to be loaded through script after DOMContentLoaded)
405
406         This patch fixes that by marking link preload resources as such, so that they can be handled separately inside clearPreloads().
407         As this fix also exposed an issue with load cancelation with invalid hrefs (which tests were passing before due to the preloads
408         being cleared), said issue is also fixed by clearing previousely preloaded resources if an invalid link preload is later detected.
409
410         Test: http/tests/preload/not_evicting_preload_at_onload.html
411
412         * dom/Document.cpp:
413         (WebCore::Document::finishedParsing): Only clear speculative preloads when parsing is finished.
414         * loader/LinkLoader.cpp:
415         (WebCore::LinkLoader::preloadIfNeeded): Set request flag indicating link preload.
416         (WebCore::LinkLoader::loadLink): Clear previousely preloaded resource to cancel their load.
417         * loader/LinkPreloadResourceClients.h:
418         (WebCore::LinkPreloadResourceClient::clearResource): Call cancelLoad() when the client is cleared.
419         * loader/cache/CachedResource.h:
420         (WebCore::CachedResource::isLinkPreload):
421         (WebCore::CachedResource::setLinkPreload):
422         * loader/cache/CachedResource.cpp:
423         (WebCore::CachedResource::CachedResource): Initialize m_isLinkPreload with the request's value.
424         * loader/cache/CachedResourceLoader.cpp:
425         (WebCore::CachedResourceLoader::~CachedResourceLoader):
426         (WebCore::CachedResourceLoader::requestResource): Mirror the request link preload flag to the resource if it's fetched from cache.
427         (WebCore::CachedResourceLoader::clearPreloads): Add a "speculative only" mode, which doesn't clear link preloads.
428         * loader/cache/CachedResourceLoader.h:
429         * loader/cache/CachedResourceRequest.cpp:
430         (WebCore::CachedResourceRequest::CachedResourceRequest):
431         * loader/cache/CachedResourceRequest.h:
432         (WebCore::CachedResourceRequest::isLinkPreload):
433         (WebCore::CachedResourceRequest::setIsLinkPreload):
434
435 2017-02-03  Zalan Bujtas  <zalan@apple.com>
436
437         Simple line layout: Removing adjacent trailing whitespace runs should not crash.
438         https://bugs.webkit.org/show_bug.cgi?id=167803
439         <rdar://problem/30337368>
440
441         Reviewed by Antti Koivisto.
442
443         In case of adjacent collapsed whitespace fragments, the length of these fragments (TextFragmentIterator::TextFragment)
444         do not necessarily equal the length of the final runs (SimpleLineLayout::Run).
445         This patch removes the dependency on the length and switches over to using the position information instead.
446
447         Test: fast/text/simple-line-layout-multiple-trailingwhitespace-crash.html
448
449         * rendering/SimpleLineLayout.cpp:
450         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
451         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
452
453 2017-02-03  Brent Fulgham  <bfulgham@apple.com>
454
455         Correct memory leak in MediaConstraints
456         https://bugs.webkit.org/show_bug.cgi?id=167744
457         <rdar://problem/30331444>
458
459         Reviewed by Anders Carlsson.
460
461         ConstraintHolder returns a reference to an object created by operator new. When the
462         returned value is assigned or stored in Vector or other containers we leak memory.
463         Instead, this value should just be returned as a regular object so that the return
464         value optimization can make sure memory is properly (and efficiently) used.
465
466         Tested by existing mediastream tests.
467
468         * platform/mediastream/MediaConstraints.h:
469         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
470         (WebCore::FlattenedConstraint::ConstraintHolder::~ConstraintHolder): Don't attempt to
471         delete memory that was moved away.
472         (WebCore::FlattenedConstraint::ConstraintHolder::ConstraintHolder): Add Move constructor.
473
474 2017-02-03  Chris Dumez  <cdumez@apple.com>
475
476         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody()
477         https://bugs.webkit.org/show_bug.cgi?id=167799
478         <rdar://problem/30237241>
479
480         Reviewed by Brent Fulgham.
481
482         Fix bad assertion under HTMLTreeBuilder::processStartTagForInBody() that was
483         expecting the root element to be an <html> element when parsing a <frameset>.
484         While this assertion is true in theory and as per the specification, it does
485         not hold in WebKit when parsing a DocumentFragment. This is because WebKit
486         has an optimization causing us to have a DocumentFragment as root element
487         when parsing a fragment. See the following constructor:
488         "HTMLTreeBuilder(HTMLDocumentParser&, DocumentFragment&, Element&, ParserContentPolicy, const HTMLParserOptions&)"
489
490         which has the following code:
491         """
492         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-html-fragments
493         // For efficiency, we skip step 5 ("Let root be a new html element with no attributes") and instead use the DocumentFragment as a root node.
494         m_tree.openElements().pushRootNode(HTMLStackItem::create(fragment));
495         """
496
497         Update the assertion to expect a DocumentFragment as root element when parsing
498         a fragment, and keep expecting an <html> element otherwise.
499
500         Test: fast/parser/fragment-with-frameset-crash.html
501
502         * html/parser/HTMLTreeBuilder.cpp:
503         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
504
505 2017-02-03  Antoine Quint  <graouts@apple.com>
506
507         [Modern Media Controls] Skip back button is visible with a live broadcast video
508         https://bugs.webkit.org/show_bug.cgi?id=167793
509
510         Reviewed by Eric Carlson.
511
512         We shouldn't be showing the skip back button when a live broadcast video is playing.
513         We now listen to the "durationchange" event to determine when we have an inifinite-duration
514         video and disable the skip button in that case.
515
516         Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-live-broadcast.html
517
518         * Modules/modern-media-controls/media/skip-back-support.js:
519         (SkipBackSupport.prototype.get mediaEvents):
520         (SkipBackSupport.prototype.syncControl):
521         (SkipBackSupport):
522
523 2017-02-03  Alex Christensen  <achristensen@webkit.org>
524
525         URLParser: implement forbidden host code points for non-special URLs
526         https://bugs.webkit.org/show_bug.cgi?id=167779
527
528         Reviewed by Chris Dumez.
529
530         Covered by newly passing web platform tests.
531
532         * platform/URLParser.cpp:
533         (WebCore::isC0Control):
534         (WebCore::isForbiddenHostCodePoint):
535         (WebCore::URLParser::parseHostAndPort):
536         In non-special URL hosts such as customprotocol://strange%host
537         don't accept characters that are part of the URL grammar and would be forbidden
538         in a special URL host, like https://not[allowed
539         This was recently added to the spec in https://github.com/whatwg/url/issues/214
540
541 2017-02-03  Per Arne Vollan  <pvollan@apple.com>
542
543         The CSS property -webkit-text-stroke is not applied on captions.
544         https://bugs.webkit.org/show_bug.cgi?id=167687
545
546         Reviewed by Brent Fulgham.
547
548         Add style to list of valid properties for cue.
549
550         Test: media/track/track-css-stroke-cues.html
551
552         * css/StyleResolver.cpp:
553         (WebCore::StyleResolver::isValidCueStyleProperty):
554
555 2017-02-03  Alex Christensen  <achristensen@webkit.org>
556
557         Align URL setters with spec for URLs that cannot be a base URL
558         https://bugs.webkit.org/show_bug.cgi?id=167783
559
560         Reviewed by Chris Dumez.
561
562         Setting things like credentials on mailto URLs doesn't make sense.
563         It's forbidden by the spec.
564
565         Covered by newly passing web platform tests.
566
567         * html/URLUtils.h:
568         (WebCore::URLUtils<T>::setUsername):
569         (WebCore::URLUtils<T>::setPassword):
570         (WebCore::URLUtils<T>::setHost):
571         (WebCore::URLUtils<T>::setHostname):
572         (WebCore::URLUtils<T>::setPort):
573         (WebCore::URLUtils<T>::setPathname):
574         * platform/URL.cpp:
575         (WebCore::URL::serialize):
576         * platform/URL.h:
577         (WebCore::URL::cannotBeABaseURL):
578
579 2017-02-03  Eric Carlson  <eric.carlson@apple.com>
580
581         [Mac] Add classes to manage audio samples
582         https://bugs.webkit.org/show_bug.cgi?id=167739
583
584         Reviewed by Jer Noble.
585
586         No new tests, this code isn't used yet.
587
588         * WebCore.xcodeproj/project.pbxproj:
589         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
590         (WebCore::AudioSampleBufferList::create):
591         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
592         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
593         (WebCore::AudioSampleBufferList::setSampleCount):
594         (WebCore::AudioSampleBufferList::applyGain):
595         (WebCore::AudioSampleBufferList::mixFrom):
596         (WebCore::AudioSampleBufferList::copyFrom):
597         (WebCore::AudioSampleBufferList::copyTo):
598         (WebCore::AudioSampleBufferList::reset):
599         (WebCore::AudioSampleBufferList::zero):
600         (WebCore::AudioSampleBufferList::zeroABL):
601         (WebCore::AudioSampleBufferList::convertInput):
602         (WebCore::AudioSampleBufferList::audioConverterCallback):
603         (WebCore::AudioSampleBufferList::configureBufferListForStream):
604         * platform/audio/mac/AudioSampleBufferList.h: Added.
605         (WebCore::AudioSampleBufferList::streamDescription):
606         (WebCore::AudioSampleBufferList::bufferList):
607         (WebCore::AudioSampleBufferList::sampleCapacity):
608         (WebCore::AudioSampleBufferList::sampleCount):
609         (WebCore::AudioSampleBufferList::timestamp):
610         (WebCore::AudioSampleBufferList::hostTime):
611         (WebCore::AudioSampleBufferList::setTimes):
612         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
613         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
614         (WebCore::AudioSampleDataSource::create):
615         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
616         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
617         (WebCore::AudioSampleDataSource::setPaused):
618         (WebCore::AudioSampleDataSource::setupConverter):
619         (WebCore::AudioSampleDataSource::setInputFormat):
620         (WebCore::AudioSampleDataSource::setOutputFormat):
621         (WebCore::AudioSampleDataSource::hostTime):
622         (WebCore::AudioSampleDataSource::pushSamplesInternal):
623         (WebCore::AudioSampleDataSource::pushSamples):
624         (WebCore::AudioSampleDataSource::pullSamplesInternal):
625         (WebCore::AudioSampleDataSource::pullSamples):
626         * platform/audio/mac/AudioSampleDataSource.h: Added.
627         (WebCore::AudioSampleDataSource::setVolume):
628         (WebCore::AudioSampleDataSource::volume):
629         (WebCore::AudioSampleDataSource::setMuted):
630         (WebCore::AudioSampleDataSource::muted):
631
632 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
633
634         Unreviewed. Fix the buidl after r211631.
635
636         I added the OS(LINUX) ifdef to the wrong file by mistake.
637
638         * page/ResourceUsageThread.h:
639         * page/linux/ResourceUsageThreadLinux.cpp:
640
641 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
642
643         [GTK] Add initial implementation of resource usage overlay
644         https://bugs.webkit.org/show_bug.cgi?id=167731
645
646         Reviewed by Michael Catanzaro.
647
648         Add an implementation of ResourceUsageOverlay and ResourceUsageThread for Linux systems.
649
650         * PlatformGTK.cmake: Add new new files to compilation.
651         * page/Page.cpp:
652         (WebCore::Page::setResourceUsageOverlayVisible): Do not create the page overlay if accelerated compositing is
653         not enabled.
654         * page/ResourceUsageOverlay.h:
655         * page/linux/ResourceUsageOverlayLinux.cpp: Added.
656         (WebCore::cpuUsageString):
657         (WebCore::formatByteNumber):
658         (WebCore::gcTimerString):
659         (WebCore::ResourceUsageOverlay::platformInitialize):
660         (WebCore::ResourceUsageOverlay::platformDestroy):
661         * page/linux/ResourceUsageThreadLinux.cpp: Added.
662         (WebCore::cpuPeriod):
663         (WebCore::cpuUsage):
664         (WebCore::ResourceUsageThread::platformThreadBody):
665
666 2017-02-03  Enrique Ocaña González  <eocanha@igalia.com>
667
668         [GStreamer] Store preloaded media in webkit's cache
669         https://bugs.webkit.org/show_bug.cgi?id=119477
670
671         Reviewed by Xabier Rodriguez-Calvar.
672
673         Files cached on disk by MediaPlayerPrivateGStreamer are deleted only when the player is closed. If the
674         WebProcess crashed, they're just left there in the cache directory. This patch changes the location
675         of those temporary files to a proper temporary directory (/var/tmp, as those files aren't actually
676         reusable, so they don't belong to a cache directory, and /tmp is a bad place because it's RAM-based on
677         some distros), unlinks (deletes) them right after creation and also deletes any other stalled temporary
678         file on the old legacy cache directory.
679
680         There's no API in GstPlaybin to control the temporary file location, so we do it manually by locating
681         the GstDownloadBuffer element in the pipeline as soon as it's created, reconfiguring it with the right
682         temporary file path and deleting the file as soon as it's created.
683
684         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
685         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Stop listening to element-added.
686         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback): Look for GstDownloadBuffer.
687         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Remove the file after creation.
688         (WebCore::MediaPlayerPrivateGStreamer::purgeOldDownloadFiles): Delete legacy files.
689         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged): Listen to element-added signals on GstUriDecodeBin.
690         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: New reference to GstDownloadBuffer.
691
692 2017-02-03  Antti Koivisto  <antti@apple.com>
693
694         WebContent crash when pasting into input fields at com.apple.WebCore: WebCore::ResourceRequestBase::url const + 9
695         https://bugs.webkit.org/show_bug.cgi?id=167787
696         rdar://problem/29168795
697
698         Reviewed by Andreas Kling.
699
700         No test, don't know how to get here.
701
702         * page/animation/CSSPropertyAnimation.cpp:
703         (WebCore::crossfadeBlend): Null check.
704
705 2017-02-03  Alberto Garcia  <berto@igalia.com>
706
707         JSDOMWindowBase.cpp doesn't build if the JIT is disabled
708         https://bugs.webkit.org/show_bug.cgi?id=167785
709
710         Reviewed by Carlos Garcia Campos.
711
712         r211403 moved GetCallerGlobalObjectFunctor from JSDOMBinding.cpp
713         to JSDOMWindowBase.cpp, but forgot to include bytecode/CodeBlock.h
714         in the latter file.
715
716         This breaks the build if the JIT is disabled because the headers
717         that would include ClodeBlock.h indirectly are guarded by
718         ENABLE(JIT).
719
720         * bindings/js/JSDOMWindowBase.cpp:
721
722 2017-02-02  Andreas Kling  <akling@apple.com>
723
724         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
725         <https://webkit.org/b/167491>
726         <rdar://problem/30116072>
727
728         Reviewed by Antti Koivisto.
729
730         Add a new timer-based memory pressure monitor that checks the process memory
731         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
732
733         There are four MemoryUsagePolicy values:
734
735             - Unrestricted (below 1GB)
736             - Conservative (above 1GB)
737             - Strict (above 2GB)
738             - Panic (above 4GB, or 3GB if 32-bit)
739
740         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
741
742         Transitioning to a higher policy will cause memory pressure handlers to run:
743
744         At Strict, we run the "non-critical" memory pressure handler, then carry on.
745
746         At Panic, we run the "critical" memory pressure handler. If that fails to recover
747         enough memory to bring us back below 4GB, we may kill the process:
748
749         A process is eligible to get killed for using too much memory if:
750
751             - It's not visible on screen (i.e it's a background tab.)
752             - It's not playing audio.
753             - It has not performed a main frame navigation in the last hour.
754
755         Before killing the process, an exit-time callback will run. This patch installs such
756         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
757         usage to hopefully help understand what was soaking up all the memory.
758
759         * bindings/js/CommonVM.cpp:
760         (WebCore::commonVMSlow):
761         * loader/FrameLoader.cpp:
762         (WebCore::FrameLoader::setState):
763         * page/MainFrame.cpp:
764         (WebCore::MainFrame::didCompleteLoad):
765         * page/MainFrame.h:
766         * page/MemoryRelease.cpp:
767         (WebCore::pageCount):
768         (WebCore::logMemoryStatisticsAtTimeOfDeath):
769         (WebCore::didExceedMemoryLimitAndFailedToRecover):
770         (WebCore::processIsEligibleForMemoryKill):
771         * page/MemoryRelease.h:
772         * page/ResourceUsageThread.h:
773         * page/cocoa/ResourceUsageThreadCocoa.mm:
774         (WebCore::vmPageSize):
775         * platform/MemoryPressureHandler.cpp:
776         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
777         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
778         (WebCore::toString):
779         (WebCore::thresholdForPolicy):
780         (WebCore::policyForFootprint):
781         (WebCore::MemoryPressureHandler::measurementTimerFired):
782         * platform/MemoryPressureHandler.h:
783         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
784         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
785         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
786
787 2017-02-02  Alex Christensen  <achristensen@webkit.org>
788
789         URLParser: Fix parsing invalid IPv4 addresses with non-ASCII characters
790         https://bugs.webkit.org/show_bug.cgi?id=167773
791         <rdar://problem/30221102>
792
793         Reviewed by Ryosuke Niwa.
794
795         If an invalid IPv4 address contains the first syntaxViolation (difference between input and canonicalized URL),
796         an iterator is used to calculate how far we have parsed in the input string to copy all the syntax-violation-free
797         characters into a Vector. If a URL contains only ASCII that doesn't contain anything percent-encoded in the host,
798         there is a fast path to parse ASCII hosts.  All my existing invalid IPv4 tests followed this path.
799         If there is a non-ASCII character, we need to use an iterator to the original string instead of an iterator
800         to the string after converting the input string's host to ASCII.
801
802         Covered by a new API test which used to RELEASE_ASSERT.
803
804         * platform/URLParser.cpp:
805         (WebCore::URLParser::parseIPv4Host):
806         (WebCore::URLParser::parseIPv6Host):
807         (WebCore::URLParser::parseHostAndPort):
808         * platform/URLParser.h:
809
810 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
811
812         CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::URL::host const + 9
813         https://bugs.webkit.org/show_bug.cgi?id=167766
814         <rdar://problem/30132707>
815
816         Reviewed by Chris Dumez.
817
818         The mainframe's document pointer may be null when tearing down a page upon navigation to a page that is in the
819         page cache. If this triggers a GC sweep, we will attempt to reload touch bar media controls, which (as a part of
820         the media controller heuristic) checks the mainframe's document URL to see if quirks should be enabled. This
821         assumes that the mainframe's document exists, which is not a safe assumption if page navigation is occurring. As
822         such, we need a null check for the mainframe's document in needsPlaybackControlsManagerQuirk().
823
824         No test, as we were unable to reproduce this crash.
825
826         * html/HTMLMediaElement.cpp:
827         (WebCore::needsPlaybackControlsManagerQuirk):
828
829 2017-02-02  Chris Dumez  <cdumez@apple.com>
830
831         Suspend SVG animations in hidden pages
832         https://bugs.webkit.org/show_bug.cgi?id=167763
833         <rdar://problem/29986313>
834
835         Reviewed by Simon Fraser.
836
837         Suspend SVG animations in hidden pages to save power, similarly to what
838         we already do for another types of animations.
839
840         Test: svg/animations/animations-paused-page-non-visible.html
841
842         * page/Page.cpp:
843         (WebCore::setSVGAnimationSuspended):
844         (WebCore::Page::setIsVisibleInternal):
845         * svg/SVGDocumentExtensions.cpp:
846         (WebCore::SVGDocumentExtensions::pauseAnimations):
847         (WebCore::SVGDocumentExtensions::unpauseAnimations):
848         * svg/SVGDocumentExtensions.h:
849         (WebCore::SVGDocumentExtensions::areAnimationsPaused):
850         * testing/Internals.cpp:
851         (WebCore::Internals::areSVGAnimationsPaused):
852         * testing/Internals.h:
853         * testing/Internals.idl:
854
855 2017-02-02  Commit Queue  <commit-queue@webkit.org>
856
857         Unreviewed, rolling out r211596 and r211605.
858         https://bugs.webkit.org/show_bug.cgi?id=167767
859
860         This change broke certain build configurations (Requested by
861         ryanhaddad on #webkit).
862
863         Reverted changesets:
864
865         "[Mac] Add classes to manage audio samples"
866         https://bugs.webkit.org/show_bug.cgi?id=167739
867         http://trac.webkit.org/changeset/211596
868
869         "Unreviewed speculative build fix."
870         http://trac.webkit.org/changeset/211605
871
872 2017-02-02  Ryan Haddad  <ryanhaddad@apple.com>
873
874         Unreviewed speculative build fix.
875
876         * platform/audio/mac/AudioSampleDataSource.cpp:
877         (WebCore::AudioSampleDataSource::setupConverter):
878         (WebCore::AudioSampleDataSource::pushSamples):
879
880 2017-02-02  Alex Christensen  <achristensen@webkit.org>
881
882         Build libwebrtc and dependencies with Xcode
883         https://bugs.webkit.org/show_bug.cgi?id=167758
884
885         Reviewed by Dean Jackson.
886
887         * WebCore.xcodeproj/project.pbxproj:
888
889 2017-02-02  Chris Dumez  <cdumez@apple.com>
890
891         {}.toString.call(crossOriginWindow) should return "[object Object]"
892         https://bugs.webkit.org/show_bug.cgi?id=167701
893         <rdar://problem/30330797>
894
895         Reviewed by Keith Miller.
896
897         {}.toString.call() to should "[object Object] for cross origin
898         Window / Location objects. This new behavior is consistent with
899         Firefox and Chrome.
900
901         No new tests, rebaselined existing tests.
902
903         * bindings/js/JSDOMWindowCustom.cpp:
904         (WebCore::JSDOMWindow::toStringName):
905         * bindings/js/JSLocationCustom.cpp:
906         (WebCore::JSLocation::toStringName):
907         * bindings/scripts/CodeGeneratorJS.pm:
908         (GenerateHeader):
909         * bindings/scripts/IDLAttributes.txt:
910         * page/DOMWindow.idl:
911         * page/Location.idl:
912
913 2017-02-02  Wenson Hsieh  <wenson_hsieh@apple.com>
914
915         Drag images should be anchored to the mouse location
916         https://bugs.webkit.org/show_bug.cgi?id=167690
917         <rdar://problem/30295261>
918
919         Reviewed by Enrica Casucci.
920
921         Adds logic to compute the mouse anchor point. This is a point in the unit square indicating where the drag
922         origin is relative to the bounds of the drag image. There is no behavior change, since this anchor point is not
923         used by any client yet; this patch only computes and vends this information from WebCore.
924
925         * loader/EmptyClients.cpp:
926         * page/DragClient.h:
927         * page/DragController.cpp:
928         (WebCore::DragController::startDrag):
929         (WebCore::DragController::doImageDrag):
930         (WebCore::DragController::doSystemDrag):
931         * page/DragController.h:
932         * platform/DragImage.h:
933
934 2017-02-02  Eric Carlson  <eric.carlson@apple.com>
935
936         [Mac] Add classes to manage audio samples
937         https://bugs.webkit.org/show_bug.cgi?id=167739
938
939         Reviewed by Jer Noble.
940
941         No new tests, this code isn't used yet.
942
943         * WebCore.xcodeproj/project.pbxproj:
944         * platform/audio/mac/AudioSampleBufferList.cpp: Added.
945         (WebCore::AudioSampleBufferList::create):
946         (WebCore::AudioSampleBufferList::AudioSampleBufferList):
947         (WebCore::AudioSampleBufferList::~AudioSampleBufferList):
948         (WebCore::AudioSampleBufferList::setSampleCount):
949         (WebCore::AudioSampleBufferList::applyGain):
950         (WebCore::AudioSampleBufferList::mixFrom):
951         (WebCore::AudioSampleBufferList::copyFrom):
952         (WebCore::AudioSampleBufferList::copyTo):
953         (WebCore::AudioSampleBufferList::reset):
954         (WebCore::AudioSampleBufferList::zero):
955         (WebCore::AudioSampleBufferList::zeroABL):
956         (WebCore::AudioSampleBufferList::convertInput):
957         (WebCore::AudioSampleBufferList::audioConverterCallback):
958         (WebCore::AudioSampleBufferList::configureBufferListForStream):
959         * platform/audio/mac/AudioSampleBufferList.h: Added.
960         (WebCore::AudioSampleBufferList::streamDescription):
961         (WebCore::AudioSampleBufferList::bufferList):
962         (WebCore::AudioSampleBufferList::sampleCapacity):
963         (WebCore::AudioSampleBufferList::sampleCount):
964         (WebCore::AudioSampleBufferList::timestamp):
965         (WebCore::AudioSampleBufferList::hostTime):
966         (WebCore::AudioSampleBufferList::setTimes):
967         (WebCore::AudioSampleBufferList::audioBufferListSizeForStream):
968         * platform/audio/mac/AudioSampleDataSource.cpp: Added.
969         (WebCore::AudioSampleDataSource::create):
970         (WebCore::AudioSampleDataSource::AudioSampleDataSource):
971         (WebCore::AudioSampleDataSource::~AudioSampleDataSource):
972         (WebCore::AudioSampleDataSource::setPaused):
973         (WebCore::AudioSampleDataSource::setupConverter):
974         (WebCore::AudioSampleDataSource::setInputFormat):
975         (WebCore::AudioSampleDataSource::setOutputFormat):
976         (WebCore::AudioSampleDataSource::hostTime):
977         (WebCore::AudioSampleDataSource::pushSamplesInternal):
978         (WebCore::AudioSampleDataSource::pushSamples):
979         (WebCore::AudioSampleDataSource::pullSamplesInternal):
980         (WebCore::AudioSampleDataSource::pullSamples):
981         * platform/audio/mac/AudioSampleDataSource.h: Added.
982         (WebCore::AudioSampleDataSource::setVolume):
983         (WebCore::AudioSampleDataSource::volume):
984         (WebCore::AudioSampleDataSource::setMuted):
985         (WebCore::AudioSampleDataSource::muted):
986
987 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
988
989         Support Performance API (performance.now(), UserTiming) in Workers
990         https://bugs.webkit.org/show_bug.cgi?id=167717
991
992         Reviewed by Ryosuke Niwa.
993
994         Tests: performance-api/performance-mark-name.html
995                performance-api/performance-now-api.html
996                performance-api/performance-now-time-origin-in-worker.html
997                performance-api/user-timing-apis.html
998
999         * CMakeLists.txt:
1000         * DerivedSources.make:
1001         New files.
1002
1003         * page/DOMWindow.idl:
1004         * page/GlobalPerformance.idl:
1005         * workers/WorkerGlobalScope.idl:
1006         Add partial interface for performance attribute.
1007
1008         * page/Performance.idl:
1009         * page/PerformanceEntry.idl:
1010         * page/PerformanceMark.idl:
1011         * page/PerformanceMeasure.idl:
1012         * page/PerformanceObserver.idl:
1013         * page/PerformanceObserverEntryList.idl:
1014         Expose these to Workers.
1015
1016         * page/Performance.cpp:
1017         (WebCore::Performance::Performance):
1018         (WebCore::Performance::contextDestroyed):
1019         * page/Performance.h:
1020         Use the EventQueue variant that works with any ScriptExectionContext.
1021
1022         * page/PerformanceObserver.cpp:
1023         (WebCore::PerformanceObserver::PerformanceObserver):
1024         Get the Performance base in a Worker context.
1025
1026         * page/PerformanceUserTiming.cpp:
1027         (WebCore::UserTiming::mark):
1028         Only reject legacy special mark names in a Window, not a Worker.
1029
1030         (WebCore::UserTiming::findExistingMarkStartTime):
1031         Simple implementation returns 0 as the start time in Workers. The spec
1032         is currently imprecise here, but it does not have the unusual
1033         PerformanceTiming behavior in a Window which is part of User Timing 1.
1034
1035         * workers/Worker.cpp:
1036         (WebCore::Worker::create):
1037         (WebCore::Worker::notifyFinished):
1038         * workers/Worker.h:
1039         Record the moment of Worker creation.
1040
1041         * workers/WorkerGlobalScope.cpp:
1042         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1043         (WebCore::WorkerGlobalScope::performance):
1044         * workers/WorkerGlobalScope.h:
1045         Construct the Performance object with the moment of creation (timeOrigin).
1046
1047         * workers/DedicatedWorkerGlobalScope.cpp:
1048         (WebCore::DedicatedWorkerGlobalScope::create):
1049         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
1050         * workers/DedicatedWorkerGlobalScope.h:
1051         * workers/DedicatedWorkerThread.cpp:
1052         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
1053         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
1054         * workers/DedicatedWorkerThread.h:
1055         * workers/WorkerGlobalScopeProxy.h:
1056         * workers/WorkerMessagingProxy.cpp:
1057         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1058         * workers/WorkerMessagingProxy.h:
1059         * workers/WorkerThread.cpp:
1060         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
1061         (WebCore::WorkerThread::WorkerThread):
1062         (WebCore::WorkerThread::workerThread):
1063         * workers/WorkerThread.h:
1064         Pass the moment of creation (timeOrigin) through to WorkerGlobalScope creation.
1065
1066 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1067
1068         Unreviewed, rolling out r211579.
1069         https://bugs.webkit.org/show_bug.cgi?id=167753
1070
1071         Caused mediastream crashes. (Requested by bfulgham_ on
1072         #webkit).
1073
1074         Reverted changeset:
1075
1076         "Correct memory leak in MediaConstraints"
1077         https://bugs.webkit.org/show_bug.cgi?id=167744
1078         http://trac.webkit.org/changeset/211579
1079
1080 2017-02-02  Chris Dumez  <cdumez@apple.com>
1081
1082         Rename Node::inDocument() to isConnected()
1083         https://bugs.webkit.org/show_bug.cgi?id=167743
1084
1085         Reviewed by Sam Weinig.
1086
1087         Rename Node::inDocument() to isConnected() to match the DOM specification more closely:
1088         - https://dom.spec.whatwg.org/#connected
1089
1090 2017-02-02  Antoine Quint  <graouts@apple.com>
1091
1092         [Modern Media Controls] Provide a compact mode for when the controls are small
1093         https://bugs.webkit.org/show_bug.cgi?id=167746
1094         <rdar://problem/29565842>
1095
1096         Reviewed by Dean Jackson.
1097
1098         When the macOS inline media controls become too narrow to display both the volume and fullscreen
1099         buttons in their right container (width < 242), we switch to a compact mode where the controls bar
1100         is shorter and the buttons smaller.
1101
1102         To facilitate this, we provide a new subclass of MacOSInlineMediaControls called MacOSCompactInlineMediaControls
1103         which changes some of the layout properties of the buttons to have shorter margins around buttons.
1104
1105         We also added a new "Compact" LayoutTrait and improved IconService to provide specific icons
1106         for this mode for the buttons that can exist in compact mode. 
1107
1108         To correctly implement the design, we needed to add a way to provide different margins around the
1109         left and right edges of the container, so the "padding" property is now split between "leftMargin"
1110         and "rightMargin", and to make property naming cleaner, the "margin" property which specifies the
1111         space between each button in a container is now called "buttonMargin". We also set the default
1112         values for those properties to be 24 (instead of 0) which are the most widely used values, requiring
1113         less customization.
1114
1115         Tests: media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-buttons-styles.html
1116                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-constructor.html
1117                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-controls-bar-styles.html
1118                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-layout.html
1119                media/modern-media-controls/macos-compact-inline-media-controls/macos-compact-inline-media-controls-volume-styles.html
1120                media/modern-media-controls/media-controller/media-controller-toggle-compact-mode.html
1121
1122         * Modules/modern-media-controls/controls/buttons-container.js:
1123         (ButtonsContainer.prototype.layout): Refactor the "margin" and "padding" properties into
1124         "leftMargin", "rightMargin" and "buttonMargin".
1125         * Modules/modern-media-controls/controls/icon-button.js:
1126         (IconButton.prototype._updateImage): Fix a small bug that would prevent the image source
1127         change to occur after changing the "iconName" property should the previous and new icons
1128         share the same metrics, which is the case for the "play" and "pause" icons in compact mode.
1129         * Modules/modern-media-controls/controls/icon-service.js: Add support for compact variants.
1130         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
1131         (const.iconService.new.IconService):
1132         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Adopt new margin defaults.
1133         * Modules/modern-media-controls/controls/layout-item.js: Add the new "Compact" LayoutTrait.
1134         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css: Added.
1135         (.media-controls.mac.inline.compact > .controls-bar):
1136         (.media-controls.mac.inline.compact button.play-pause):
1137         (.media-controls.mac.inline.compact button.skip-back):
1138         (.media-controls.mac.inline.compact .scrubber.slider):
1139         (.media-controls.mac.inline.compact button.mute):
1140         (.media-controls.mac.inline.compact button.fullscreen):
1141         (.media-controls.mac.inline.compact .time-label,):
1142         (.media-controls.mac.inline.compact .volume-slider-container):
1143         (.media-controls.mac.inline.compact .volume.slider):
1144         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb):
1145         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.js: Added.
1146         (MacOSCompactInlineMediaControls):
1147         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Adopt new margin defaults.
1148         (MacOSFullscreenMediaControls.prototype.layout):
1149         * Modules/modern-media-controls/controls/macos-inline-media-controls.js: Adopt new margin defaults
1150         and make the _leftContainer and _rightContainer properties public such that the MacOSCompactInlineMediaControls
1151         subclass may customize them without accessing a private property.
1152         (MacOSInlineMediaControls.prototype.layout):
1153         (MacOSInlineMediaControls.prototype.showTracksPanel):
1154         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@1x.png: Added.
1155         * Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@2x.png: Added.
1156         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@1x.png: Added.
1157         * Modules/modern-media-controls/images/macOS/interval-skip-back-compact@2x.png: Added.
1158         * Modules/modern-media-controls/images/macOS/pause-compact@1x.png: Added.
1159         * Modules/modern-media-controls/images/macOS/pause-compact@2x.png: Added.
1160         * Modules/modern-media-controls/images/macOS/play-compact@1x.png: Added.
1161         * Modules/modern-media-controls/images/macOS/play-compact@2x.png: Added.
1162         * Modules/modern-media-controls/images/macOS/volume-compact@1x.png: Added.
1163         * Modules/modern-media-controls/images/macOS/volume-compact@2x.png: Added.
1164         * Modules/modern-media-controls/js-files: Add the new files so they are concatenated by the build script.
1165         * Modules/modern-media-controls/media/media-controller.js: Toggle compact mode if controls
1166         are below the 242px width threshold.
1167         (MediaController.prototype.get layoutTraits):
1168         (MediaController.prototype.handleEvent):
1169         (MediaController.prototype._updateControlsIfNeeded):
1170         (MediaController.prototype._shouldFadeBetweenControls):
1171         (MediaController.prototype._updateControlsSize):
1172         (MediaController.prototype._controlsWidth):
1173         (MediaController.prototype._controlsClass):
1174         (MediaController):
1175         * WebCore.xcodeproj/project.pbxproj: Add new files and perform some cleanup so that the
1176         project accurately lists all the existing project files and remove some older ones.
1177
1178 2017-02-02  Commit Queue  <commit-queue@webkit.org>
1179
1180         Unreviewed, rolling out r211571 and r211582.
1181         https://bugs.webkit.org/show_bug.cgi?id=167751
1182
1183         This change caused API test WebKit1.MemoryPressureHandler to
1184         fail with an assertion. (Requested by ryanhaddad on #webkit).
1185
1186         Reverted changesets:
1187
1188         "[Mac] In-process memory pressure monitor for WebContent
1189         processes."
1190         https://bugs.webkit.org/show_bug.cgi?id=167491
1191         http://trac.webkit.org/changeset/211571
1192
1193         "Unreviewed attempt to fix the Windows build after r211571."
1194         http://trac.webkit.org/changeset/211582
1195
1196 2017-02-02  Chris Dumez  <cdumez@apple.com>
1197
1198         Unreviewed attempt to fix the Windows build after r211571.
1199
1200         * platform/MemoryPressureHandler.cpp:
1201         (WebCore::thresholdForPolicy):
1202         (WebCore::policyForFootprint):
1203
1204 2017-02-02  Brent Fulgham  <bfulgham@apple.com>
1205
1206         Correct memory leak in MediaConstraints
1207         https://bugs.webkit.org/show_bug.cgi?id=167744
1208         <rdar://problem/30331444>
1209
1210         Reviewed by Anders Carlsson.
1211
1212         ConstraintHolder returns a reference to an object created by operator new. When the
1213         returned value is assigned or stored in Vector or other containers we leak memory.
1214         Instead, this value should just be returned as a regular object so that the return
1215         value optimization can make sure memory is properly (and efficiently) used.
1216
1217         * platform/mediastream/MediaConstraints.h:
1218         (WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.
1219
1220 2017-02-02  Andreas Kling  <akling@apple.com>
1221
1222         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
1223         <https://webkit.org/b/167491>
1224         <rdar://problem/30116072>
1225
1226         Reviewed by Antti Koivisto.
1227
1228         Add a new timer-based memory pressure monitor that checks the process memory
1229         footprint every 30 seconds and reacts to changes by setting a MemoryUsagePolicy.
1230
1231         There are four MemoryUsagePolicy values:
1232
1233             - Unrestricted (below 1GB)
1234             - Conservative (above 1GB)
1235             - Strict (above 2GB)
1236             - Panic (above 4GB, or 3GB if 32-bit)
1237
1238         For Strict and above, the old-style "isUnderMemoryPressure()" API will return true.
1239
1240         Transitioning to a higher policy will cause memory pressure handlers to run:
1241
1242         At Strict, we run the "non-critical" memory pressure handler, then carry on.
1243
1244         At Panic, we run the "critical" memory pressure handler. If that fails to recover
1245         enough memory to bring us back below 4GB, we may kill the process:
1246
1247         A process is eligible to get killed for using too much memory if:
1248
1249             - It's not visible on screen (i.e it's a background tab.)
1250             - It's not playing audio.
1251             - It has not performed a main frame navigation in the last hour.
1252
1253         Before killing the process, an exit-time callback will run. This patch installs such
1254         a callback that prints out some time-of-death statistics about C++ and JavaScript memory
1255         usage to hopefully help understand what was soaking up all the memory.
1256
1257         * bindings/js/CommonVM.cpp:
1258         (WebCore::commonVMSlow):
1259         * loader/FrameLoader.cpp:
1260         (WebCore::FrameLoader::setState):
1261         * page/MainFrame.cpp:
1262         (WebCore::MainFrame::didCompleteLoad):
1263         * page/MainFrame.h:
1264         * page/MemoryRelease.cpp:
1265         (WebCore::pageCount):
1266         (WebCore::logMemoryStatisticsAtTimeOfDeath):
1267         (WebCore::didExceedMemoryLimitAndFailedToRecover):
1268         (WebCore::processIsEligibleForMemoryKill):
1269         * page/MemoryRelease.h:
1270         * page/ResourceUsageThread.h:
1271         * page/cocoa/ResourceUsageThreadCocoa.mm:
1272         (WebCore::vmPageSize):
1273         * platform/MemoryPressureHandler.cpp:
1274         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
1275         (WebCore::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
1276         (WebCore::toString):
1277         (WebCore::thresholdForPolicy):
1278         (WebCore::policyForFootprint):
1279         (WebCore::MemoryPressureHandler::measurementTimerFired):
1280         * platform/MemoryPressureHandler.h:
1281         (WebCore::MemoryPressureHandler::setMemoryKillCallback):
1282         (WebCore::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
1283         (WebCore::MemoryPressureHandler::isUnderMemoryPressure):
1284
1285 2017-02-02  Chris Dumez  <cdumez@apple.com>
1286
1287         [Crash] com.apple.WebKit.WebContent at WebKit: WebKit::WebPage::fromCorePage()
1288         https://bugs.webkit.org/show_bug.cgi?id=167738
1289         <rdar://problem/30229990>
1290
1291         Reviewed by Andreas Kling.
1292
1293         Upon destruction of a Page, we destroy the BackForwardClient, which is supposed
1294         to keep track of HistoryItems associated to this particular page and remove them
1295         from the PageCache. Given the crash trace, the issue seems to be that some
1296         HistoryItems associated with the Page sometimes linger in the PageCache *after*
1297         the Page has been destroyed, which leads to crashes later on when pruning the
1298         PageCache.
1299
1300         In order to make the process more robust, this patch refactors the code so that
1301         the Page is now in charge of removing all its associated HistoryItems from the
1302         PageCache instead of relying on the BackForwardClient. Also, instead of having
1303         the Page keep track of which HistoryItems are associated with it (which is
1304         error prone), we now scan all PageCache entries instead to find which ones are
1305         associated with the Page. While this is in theory slower, this is much safer
1306         and in practice not an issue because the PageCache usually has 3-5 entries.
1307
1308         No new tests, could not reproduce.
1309
1310         * history/CachedPage.cpp:
1311         (WebCore::CachedPage::CachedPage):
1312         * history/CachedPage.h:
1313         (WebCore::CachedPage::page):
1314         * history/PageCache.cpp:
1315         (WebCore::PageCache::removeAllItemsForPage):
1316         * history/PageCache.h:
1317         * page/Page.cpp:
1318         (WebCore::Page::~Page):
1319
1320 2017-02-02  Antti Koivisto  <antti@apple.com>
1321
1322         Column progression wrong after enabling pagination on RTL document
1323         https://bugs.webkit.org/show_bug.cgi?id=167733
1324         <rdar://problem/29012252>
1325
1326         Reviewed by Zalan Bujtas.
1327
1328         Column progression depends on document direction but was not updated when direction changed.
1329
1330         Test: fast/multicol/pagination/pagination-dynamic-rtl.html
1331
1332         * rendering/RenderBox.cpp:
1333         (WebCore::RenderBox::styleDidChange):
1334
1335             Update column styles if document direction changes.
1336
1337 2017-02-02  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1338
1339         [EME][GStreamer] Fixed decryptor selection
1340         https://bugs.webkit.org/show_bug.cgi?id=167588
1341
1342         Reviewed by Žan Doberšek.
1343
1344         GStreamer selected a decryptor automatically but we need to be
1345         able to tell it which decryptor we want because one file can be
1346         encrypted with more than one system and the one we want to use can
1347         depend on what the user tells us.
1348
1349         Now when the demuxer is about to select the demuxer, it runs a
1350         GstContext query with the events, which are forwarded through the
1351         EME api to the application, which will answer the the
1352         generateKeyRequest and then we can instruct the demuxer to select
1353         the one we tell it, not the one that is selected automatically. If
1354         the demuxer has already a preferred decryptor, the codepath will
1355         be similar to the older one.
1356
1357         Something that is also fixed is the report of the keyneeded event,
1358         which will contain all pssh boxes as requested by the spec.
1359
1360         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1361         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Intercept
1362         the event and handle it.
1363         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1364         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
1365         Initialize the CDM session.
1366         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1367         Unlock the protection condition just in case and set CDM to null.
1368         (WebCore::extractEventsAndSystemsFromMessage): Access the events
1369         and accepted key systems coming at the message from the demuxer.
1370         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
1371         Handle the protection event not as an element event but as a
1372         context request. It also concatenates all the initdatas in case
1373         there is more than one. The event is sent in the main thread and
1374         the current one blocks until a timeout is hit or the
1375         generateKeyRequest is called.
1376         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
1377         Check if the event was already handled and if not, run the need
1378         key event.
1379         (WebCore::MediaPlayerPrivateGStreamerBase::receivedGenerateKeyRequest):
1380         Notify the that the query arrived so that we can unlock the
1381         demuxer thread.
1382         (WebCore::keySystemIdToUuid): Translates ids to uuids, meaning
1383         the ones coming from JS to the ones coming from the media engine.
1384         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1385         Attributes and methods.
1386         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1387         (webkit_media_clear_key_decrypt_class_init):
1388         (webKitMediaClearKeyDecryptorRequestDecryptionKey): Deleted.
1389         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
1390         Added the ui and uuid.
1391         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1392         (webkitMediaCommonEncryptionDecryptSinkEventHandler): Do not rely
1393         on the subclass, just forward the event to the pipeline inside a message.
1394         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
1395         Remove unused function signature.
1396         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1397         (WebCore::appendPipelineNeedContextMessageCallback): Renamed from
1398         appendPipelineElementMessageCallback.
1399         (WebCore::AppendPipeline::AppendPipeline): Connect to the
1400         need-context message instead of the element one.
1401         (WebCore::AppendPipeline::dispatchPendingDecryptionKey):
1402         Dispatches the drm-cypher message if there is one pending.
1403         (WebCore::AppendPipeline::dispatchDecryptionKey): Dispatches the
1404         drm-cypher.
1405         (WebCore::AppendPipeline::handleNeedContextSyncMessage): Handles
1406         the need-context event instead of the element one.
1407         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1408         Dispatches the key to the pipeline if there's any pending.
1409         (WebCore::appendPipelineElementMessageCallback): Deleted.
1410         (WebCore::AppendPipeline::handleElementMessage): Deleted.
1411         * platform/graphics/gstreamer/mse/AppendPipeline.h: New methods
1412         and attributes.
1413         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1414         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey):
1415         Use the dispatchDecryptionKey method of the AppendPipeline.
1416
1417 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
1418
1419         Removed unused EventHandler members
1420         https://bugs.webkit.org/show_bug.cgi?id=167723
1421
1422         Reviewed by Yusuke Suzuki.
1423
1424         * page/EventHandler.cpp:
1425         (WebCore::EventHandler::clear):
1426         (WebCore::EventHandler::handleWheelEvent):
1427         * page/EventHandler.h:
1428         Remove unused members.
1429
1430         * editing/FrameSelection.cpp:
1431         * html/HTMLTextAreaElement.cpp:
1432         * rendering/RenderObject.cpp:
1433         * rendering/RenderSlider.cpp:
1434         Remove unnecessary includes.
1435
1436 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
1437
1438         Removed unused m_navigationStart from NavigatorGamepad
1439         https://bugs.webkit.org/show_bug.cgi?id=167722
1440
1441         Reviewed by Yusuke Suzuki.
1442
1443         * Modules/gamepad/NavigatorGamepad.cpp:
1444         (WebCore::NavigatorGamepad::NavigatorGamepad):
1445         (WebCore::NavigatorGamepad::from):
1446         * Modules/gamepad/NavigatorGamepad.h:
1447         (WebCore::NavigatorGamepad::navigationStart): Deleted.
1448
1449 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
1450
1451         In iOS, we should take background assertion when accessing localstorage databases.
1452         https://bugs.webkit.org/show_bug.cgi?id=165478
1453
1454         Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from
1455         WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several
1456         global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock,
1457         WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to
1458         move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this
1459         patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background
1460         task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods
1461         in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit. 
1462
1463         Reviewed by Brady Eidson.
1464
1465         No new test since this is code refactoring.
1466
1467         * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move
1468             WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore.
1469         * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks.
1470         * platform/ios/WebBackgroundTaskController.mm:
1471         (+[WebBackgroundTaskController sharedController]):
1472         (-[WebBackgroundTaskController dealloc]):
1473         (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler;
1474             to start the background task, we will use backgroundTaskStartBlock set up by UIKit.
1475         (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task.
1476         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h.
1477         * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm.
1478         (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton.
1479         (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient): 
1480         (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient):
1481         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController
1482             to schedule database transaction background task.
1483         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop
1484             databas transaction background task.
1485         (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm.
1486         (setTransactionBackgroundTaskIdentifier): Ditto.
1487         (getTransactionBackgroundTaskIdentifier): Ditto.
1488         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto.
1489         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto.
1490
1491 2017-02-01  Zan Dobersek  <zdobersek@igalia.com>
1492
1493         [EME] Implement MediaKeySession::update()
1494         https://bugs.webkit.org/show_bug.cgi?id=167636
1495
1496         Reviewed by Xabier Rodriguez-Calvar.
1497
1498         Implement the MediaKeySession::update() method by following the steps as
1499         they are described in the specification.
1500
1501         In order to sanitize the passed-in response data, CDM::sanitizeResponse()
1502         is added. It passes the SharedBuffer object by reference to the CDMPrivate
1503         interface implementor, which returns a SharedBuffer object containing
1504         sanitized response data.
1505
1506         CDMInstance::updateLicense() virtual method is added to perform the license
1507         update for some specific CDMInstance object. After the update the CDMInstance
1508         invokes the callback that's passed to updateLicense(), providing information
1509         about session being closed, changed keys or expiration value, any message
1510         that has to be enqueued, and whether the update was successful.
1511
1512         After that callback is invoked, MediaKeySession::update() goes on to handle
1513         all the provided information in a future task, finally resolving the promise
1514         (or rejecting it beforehand in case of any failure during response handling
1515         or license update).
1516
1517         Three algorithms that can be invoked from MediaKeySession::update() (key
1518         status update, expiration update and session closure) will be implemented
1519         separately. Placeholder methods are provided until then.
1520
1521         MockCDM::sanitizeResponse() and MockCDMInstance::updateLicense() are
1522         implemented for testing purposes. For now only the response sanitization
1523         and sanitized response format are checked there. Key status update,
1524         expiration update and session closure should be tested once the
1525         implementations for those algorithms are added.
1526
1527         Test: media/encrypted-media/mock-MediaKeySession-update.html
1528
1529         * Modules/encryptedmedia/CDM.cpp:
1530         (WebCore::CDM::sanitizeResponse):
1531         * Modules/encryptedmedia/CDM.h:
1532         * Modules/encryptedmedia/CDMInstance.h:
1533         * Modules/encryptedmedia/CDMPrivate.h:
1534         * Modules/encryptedmedia/MediaKeySession.cpp:
1535         (WebCore::MediaKeySession::update):
1536         (WebCore::MediaKeySession::updateKeyStatuses):
1537         (WebCore::MediaKeySession::updateExpiration):
1538         (WebCore::MediaKeySession::sessionClosed):
1539         * Modules/encryptedmedia/MediaKeySession.h:
1540         * testing/MockCDMFactory.cpp:
1541         (WebCore::MockCDM::sanitizeResponse):
1542         (WebCore::MockCDMInstance::updateLicense):
1543         * testing/MockCDMFactory.h:
1544
1545 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1546
1547         [Mac] Update CARingBuffer class
1548         https://bugs.webkit.org/show_bug.cgi?id=167656
1549         <rdar://problem/30318329>
1550
1551         Unreviewed fix the 32-bit build after r211539.
1552
1553         * platform/audio/mac/CAAudioStreamDescription.cpp:
1554         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
1555
1556 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
1557
1558         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
1559         https://bugs.webkit.org/show_bug.cgi?id=167710
1560         rdar://problem/30100286
1561
1562         Reviewed by Wenson Hsieh.
1563         
1564         Add a bit of logging to show when RLC decides to not composite a fixed element which
1565         is out of bounds.
1566
1567         Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html
1568
1569         * rendering/RenderLayerCompositor.cpp:
1570         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
1571
1572 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1573
1574         [Mac] Update CARingBuffer class
1575         https://bugs.webkit.org/show_bug.cgi?id=167656
1576
1577         Unreviewed build fix after r211539.
1578
1579         * platform/audio/mac/CAAudioStreamDescription.cpp:
1580         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription): Initialize a variable to fix
1581         release builds.
1582
1583 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
1584
1585         [Mac] Update CARingBuffer class
1586         https://bugs.webkit.org/show_bug.cgi?id=167656
1587
1588         Reviewed by Jer Noble.
1589
1590         API test CARingBufferTest added.
1591
1592         * WebCore.xcodeproj/project.pbxproj: Add headers to framework so they can be used from the API test.
1593
1594         * platform/audio/AudioStreamDescription.h: Add Int32.
1595
1596         * platform/audio/mac/CAAudioStreamDescription.cpp:
1597         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
1598         (WebCore::CAAudioStreamDescription::~CAAudioStreamDescription):
1599         (WebCore::CAAudioStreamDescription::format): Support Int32.
1600         (WebCore::CAAudioStreamDescription::operator==): Make inline.
1601         * platform/audio/mac/CAAudioStreamDescription.h:
1602
1603         * platform/audio/mac/CARingBuffer.cpp:
1604         (WebCore::CARingBuffer::CARingBuffer): Move initializers into class declaration.
1605         (WebCore::CARingBuffer::allocate): Use flush method, get allocation info from a CAAudioStreamDescription.
1606         (WebCore::FetchABL): Add a mode parameter to allow samples to replace or mix into destination.
1607         (WebCore::CARingBuffer::flush): New.
1608         (WebCore::CARingBuffer::fetch): Add mode parameter.
1609         (WebCore::CARingBuffer::~CARingBuffer): Deleted.
1610         * platform/audio/mac/CARingBuffer.h:
1611         (WebCore::CARingBuffer::~CARingBuffer):
1612
1613         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
1614         (WebCore::AudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor.
1615         (WebCore::operator==): Deleted.
1616         (WebCore::operator!=): Deleted.
1617
1618         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
1619         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor
1620         (WebCore::operator==): Deleted.
1621         (WebCore::operator!=): Deleted.
1622
1623 2017-02-01  Zalan Bujtas  <zalan@apple.com>
1624
1625         Simple line layout: Move TextFragmentIterator::runWidth to ::textWidth.
1626         https://bugs.webkit.org/show_bug.cgi?id=167705
1627         <rdar://problem/30314393>
1628
1629         Reviewed by Antti Koivisto.
1630
1631         We also don't need to compute logicalHeight for logicalLeft/right since the
1632         cases where it matters (floating boxes) are not supported by simple line layout. 
1633
1634         Covered by existing test.
1635
1636         * rendering/SimpleLineLayout.cpp:
1637         (WebCore::SimpleLineLayout::updateLineConstrains):
1638         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1639         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
1640         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1641         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth): Deleted.
1642         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1643
1644 2017-02-01  Jer Noble  <jer.noble@apple.com>
1645
1646         Fix compilation error under recent clang update
1647         https://bugs.webkit.org/show_bug.cgi?id=167707
1648
1649         Reviewed by Eric Carlson.
1650
1651         Include TypedArrayInlines.h to fix a "missing symbol" link error when compiling under a recent clang update.
1652
1653         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1654
1655 2017-02-01  Joseph Pecoraro  <pecoraro@apple.com>
1656
1657         Performance Timeline: Prepare for Worker support
1658         https://bugs.webkit.org/show_bug.cgi?id=167633
1659
1660         Reviewed by Ryosuke Niwa.
1661
1662         Remove references to Document/Frame in Performance. Instead use
1663         ScriptExecutionContext and pass in the time origin / SecurityOrigin
1664         where it is relevant. No tests should change this is just refactoring.
1665
1666         * loader/ResourceTimingInformation.cpp:
1667         (WebCore::ResourceTimingInformation::addResourceTiming):
1668         * page/DOMWindow.cpp:
1669         (WebCore::DOMWindow::performance):
1670         * page/Performance.cpp:
1671         (WebCore::Performance::Performance):
1672         (WebCore::Performance::now):
1673         (WebCore::Performance::reduceTimeResolution):
1674         (WebCore::Performance::navigation):
1675         (WebCore::Performance::timing):
1676         (WebCore::Performance::addResourceTiming):
1677         (WebCore::Performance::scriptExecutionContext): Deleted.
1678         * page/Performance.h:
1679         * page/Performance.idl:
1680         * page/PerformanceResourceTiming.cpp:
1681         (WebCore::monotonicTimeToDOMHighResTimeStamp):
1682         (WebCore::passesTimingAllowCheck):
1683         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1684         (WebCore::PerformanceResourceTiming::redirectStart):
1685         (WebCore::PerformanceResourceTiming::redirectEnd):
1686         (WebCore::PerformanceResourceTiming::fetchStart):
1687         (WebCore::PerformanceResourceTiming::domainLookupStart):
1688         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1689         (WebCore::PerformanceResourceTiming::connectStart):
1690         (WebCore::PerformanceResourceTiming::connectEnd):
1691         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1692         (WebCore::PerformanceResourceTiming::requestStart):
1693         (WebCore::PerformanceResourceTiming::responseStart):
1694         (WebCore::PerformanceResourceTiming::responseEnd):
1695         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1696         (WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
1697         (WebCore::PerformanceResourceTiming::initiatorType): Deleted.
1698         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
1699         * page/PerformanceResourceTiming.h:
1700         * page/PerformanceUserTiming.cpp:
1701         (WebCore::UserTiming::findExistingMarkStartTime):
1702
1703 2017-02-01  Chris Dumez  <cdumez@apple.com>
1704
1705         REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
1706         https://bugs.webkit.org/show_bug.cgi?id=167681
1707         <rdar://problem/30301117>
1708
1709         Reviewed by Mark Lam.
1710
1711         As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-):
1712         """
1713         If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return
1714         PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
1715         """
1716
1717         We now implement this behavior instead of throwing.
1718
1719         Test: http/tests/security/symbols-cross-origin.html
1720
1721         * bindings/js/JSDOMWindowCustom.cpp:
1722         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1723         * bindings/js/JSLocationCustom.cpp:
1724         (WebCore::JSLocation::getOwnPropertySlotDelegate):
1725
1726 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
1727
1728         Correct "filesHaveSameVolume" predicate
1729         https://bugs.webkit.org/show_bug.cgi?id=167696
1730         <rdar://problem/30298722>
1731
1732         Reviewed by David Kilzer.
1733
1734         We are passing %-encoded strings to the underlying operating system's file system APIs.
1735         This doesn't work. Instead, we need to present a decoded version of the file path
1736         that matches what the system APIs expect.
1737
1738         Tested by new TestWebKitAPI Test.
1739
1740         * platform/FileSystem.cpp:
1741         (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
1742         operating system are not percent encoded.
1743         * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
1744
1745 2017-02-01  Antoine Quint  <graouts@apple.com>
1746
1747         [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
1748         https://bugs.webkit.org/show_bug.cgi?id=165319
1749         <rdar://problem/30284104>
1750
1751         Reviewed by Dean Jackson.
1752
1753         Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
1754         support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
1755         is that animations are suspended by media/controls/track-menu.html with a call to
1756         internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
1757         Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
1758         the selection animation for the tracks panel menu item that is clicked never completes and the delegate
1759         to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
1760
1761         We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
1762         document, rather than calling into AnimationController::suspendAnimations() which would do just that,
1763         but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
1764         document load.
1765
1766         * dom/Document.cpp:
1767         (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
1768         associated with an AnimationController.
1769         * page/animation/AnimationController.cpp:
1770         (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
1771         the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
1772         would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
1773         document to use as a basis to query its suspended state in that constructor.
1774         (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
1775         (WebCore::AnimationControllerPrivate::detachFromDocument):
1776         (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
1777         (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
1778         (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
1779         (WebCore::AnimationController::animationsAreSuspendedForDocument):
1780         (WebCore::AnimationController::detachFromDocument):
1781         * page/animation/AnimationController.h:
1782         * page/animation/AnimationControllerPrivate.h:
1783         * testing/Internals.cpp:
1784         (WebCore::Internals::animationsAreSuspended):
1785         (WebCore::Internals::suspendAnimations):
1786         (WebCore::Internals::resumeAnimations):
1787
1788 2017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
1789
1790         Unreviewed build fix after r211488.
1791
1792         * accessibility/AXObjectCache.h: Removed property svn:executable.
1793
1794 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
1795
1796         Unreviewed build fix.
1797
1798         * html/HTMLMediaElement.h: Removed property svn:executable.
1799
1800 2017-02-01  Jer Noble  <jer.noble@apple.com>
1801
1802         NULL-deref crash in TextTrack::removeCue()
1803         https://bugs.webkit.org/show_bug.cgi?id=167615
1804
1805         Reviewed by Eric Carlson.
1806
1807         Test: http/tests/media/track-in-band-hls-metadata-crash.html
1808
1809         Follow-up to r211401. When passing around a reference to an object, the assumption is that
1810         the caller is retaining the underlying object. This breaks down for
1811         InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object,
1812         then passes the reference to that object to its superclass to do further remove steps. The
1813         retain count of the cue can thus drop to zero within the scope of
1814         InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the
1815         m_incompleteCueMap without releasing ownership, and pass a reference to that retained object
1816         on to removeCue(), guaranteeing that the cue will not be destroyed until after the
1817         romeveDataCue() method returns.
1818
1819         * html/track/InbandDataTextTrack.cpp:
1820         (WebCore::InbandDataTextTrack::removeDataCue):
1821
1822 2017-02-01  Nan Wang  <n_wang@apple.com>
1823
1824         AX: Incorrect range from index and length in text controls when there are newlines
1825         https://bugs.webkit.org/show_bug.cgi?id=167677
1826         <rdar://problem/30300099>
1827
1828         Reviewed by Chris Fleizach.
1829
1830         When there are newlines in text controls, the VisiblePosition that is created
1831         from the index could be wrong. Because the index doesn't include the information 
1832         regarding a position's affinity. Fixed it by using CharacterOffset instead, since
1833         it doesn't require that information.
1834
1835         Test: accessibility/mac/range-for-contenteditable-newline.html
1836
1837         * accessibility/AXObjectCache.cpp:
1838         (WebCore::AXObjectCache::traverseToOffsetInRange):
1839         (WebCore::AXObjectCache::nextCharacterOffset):
1840         (WebCore::AXObjectCache::characterOffsetForIndex):
1841
1842 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
1843
1844         AXObjectCache is missing two functions at link time when !HAVE(ACCESSIBILITY)
1845         https://bugs.webkit.org/show_bug.cgi?id=167691
1846
1847         Reviewed by Chris Fleizach.
1848
1849         * accessibility/AXObjectCache.h:
1850         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Added empty stub.
1851         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Added empty stub.
1852
1853 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
1854
1855         HTMLMediaElement.h fails to build when ENABLE(MEDIA_CONTROLS_SCRIPT) is false
1856         https://bugs.webkit.org/show_bug.cgi?id=167689
1857
1858         Reviewed by Joseph Pecoraro.
1859
1860         * html/HTMLMediaElement.h: Move mediaControlsHost() into the ENABLE(MEDIA_CONTROLS_SCRIPT)
1861         block that is just above it to match m_mediaControlsHost.
1862
1863 2017-02-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1864
1865         [Readable Streams API] Implement ReadableByteStreamController pull()
1866         https://bugs.webkit.org/show_bug.cgi?id=167593
1867
1868         Reviewed by Youenn Fablet.
1869
1870         Implemented pull() method for ReadableByteStreamController. Also updated
1871         pendingPullIntos attribute, which was a more complex object than necessary
1872         (an array is enough).
1873
1874         Added 2 tests that allow covering most of new code. Code not yet tested will
1875         become reachable as the rest of the spec is implemented (new tests will then
1876         be added).
1877
1878         * Modules/streams/ReadableByteStreamInternals.js:
1879         (privateInitializeReadableByteStreamController): Updated pendingPullIntos.
1880         (readableByteStreamControllerCancel): Updated pendingPullIntos.
1881         (readableByteStreamControllerClose): Updated pendingPullIntos.
1882         (readableByteStreamControllerHandleQueueDrain): Added.
1883         (readableByteStreamControllerPull): Added.
1884
1885 2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
1886
1887         [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
1888         https://bugs.webkit.org/show_bug.cgi?id=166529
1889
1890         Reviewed by Xabier Rodriguez-Calvar.
1891
1892         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1893         (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
1894         in qtdemux anymore.
1895
1896 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1897
1898         Unreviewed, build fix for macOS and iOS ports, part 2
1899
1900         Annotate the function with static.
1901
1902         * bindings/js/ScriptModuleLoader.cpp:
1903         (WebCore::rejectToPropagateNetworkError):
1904
1905 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1906
1907         Unreviewed, build fix for macOS and iOS ports
1908
1909         * bindings/js/ModuleFetchFailureKind.h: Renamed from Source/ModuleFetchFailureKind.h.
1910
1911 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1912
1913         Propagate networking errors correctly for import() operator
1914         https://bugs.webkit.org/show_bug.cgi?id=167501
1915
1916         Reviewed by Ryosuke Niwa.
1917
1918         We use the promise chain inside the module loader pipeline.
1919         The problem is that,
1920
1921         1. The errors of loading module scripts are propagated through the promise's rejection.
1922         2. Some module related errors like syntax error (when scanning module dependencies) are
1923            reported at loading time (evaluating time). These errors are propagated through the
1924            promise rejections and dumped to the console. LoadableModuleScript set catch handler
1925            for that and print these errors to the console for ScriptElement.
1926         3. Some of errors are already reported to the console. For example, networking errors
1927            are reported by the CachedModuleLoader.
1928         4. But there is no way to distinguish between (2) and (3) at the catch handler.
1929
1930         Previously, we propagate the special symbol for the already reported errors to distinguish
1931         that. This was OK because these errors cannot be catched by the user code. However,
1932         recent `import()` call needs to expose these errors to the user code. So now, accidentally,
1933         the special purpose symbol is exposed.
1934
1935         Instead of propagating the special symbol, this patch just propagates the errors. But these
1936         error objects are annotated with the private symbol. So these errors can be distinguished
1937         from the other ones.
1938
1939         Currently, we do not have the way to expose the error details to the client of the
1940         CachedScript. So we just report the error with the failed / canceled. This should be
1941         more descriptive error messages in the separate patch[1].
1942
1943         [1]: https://bugs.webkit.org/show_bug.cgi?id=167553
1944
1945         Tests: http/tests/security/mixedContent/import-insecure-script-in-iframe.html
1946                js/dom/modules/import-not-found-error.html
1947
1948         * WebCore.xcodeproj/project.pbxproj:
1949         * bindings/js/JSDOMPromise.h:
1950         (WebCore::DeferredPromise::resolveWithCallback):
1951         (WebCore::DeferredPromise::rejectWithCallback):
1952         * bindings/js/ScriptController.cpp:
1953         (WebCore::ScriptController::setupModuleScriptHandlers):
1954         * bindings/js/ScriptController.h:
1955         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): Deleted.
1956         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): Deleted.
1957         * bindings/js/ScriptModuleLoader.cpp:
1958         (WebCore::rejectToPropagateNetworkError):
1959         (WebCore::ScriptModuleLoader::fetch):
1960         (WebCore::ScriptModuleLoader::notifyFinished):
1961         * bindings/js/WebCoreBuiltinNames.h:
1962
1963 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1964
1965         Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
1966         https://bugs.webkit.org/show_bug.cgi?id=167525
1967         <rdar://problem/30270210>
1968
1969         Reviewed by Ryosuke Niwa.
1970
1971         Test: fast/events/input-events-insert-newlines-after-mutation.html
1972
1973         Reverts an unintended change made while refactoring code for input events that caused input events to be
1974         dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
1975         CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
1976         the scope by calling typingAddedToOpenCommand.
1977
1978         Instead, TypingCommands should always dispatch events
1979         synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
1980         than we should currently allow, so we should revert to our old behavior for the time being.
1981
1982         * editing/Editor.cpp:
1983
1984 2017-01-31  Zalan Bujtas  <zalan@apple.com>
1985
1986         Simple line layout: Do not assert on zero length/width trailing whitespace.
1987         https://bugs.webkit.org/show_bug.cgi?id=167679
1988
1989         Reviewed by Simon Fraser.
1990
1991         It's valid to have an zero length/width trailing whitespace.
1992
1993         Covered by existing tests.
1994
1995         * rendering/SimpleLineLayout.cpp:
1996         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): Zero length -> nothing to do.
1997         Zero width with length > 0 (font-size: 0) -> remove trailing run.
1998
1999 2017-01-31  Alex Christensen  <achristensen@webkit.org>
2000
2001         Fix debug libwebrtc build after r211439
2002         https://bugs.webkit.org/show_bug.cgi?id=167572
2003
2004         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
2005         (WebCore::LibWebRTCAudioModule::OnMessage):
2006
2007 2017-01-31  Zalan Bujtas  <zalan@apple.com>
2008
2009         Simple line layout: Collect fragments in LineState only when needed for post-processing.
2010         https://bugs.webkit.org/show_bug.cgi?id=167655
2011         <rdar://problem/30290592>
2012
2013         Reviewed by Antti Koivisto.
2014
2015         The fragments we need to keep around for basic line breaking are the last and last non-whitespace fragments.
2016         However in certain cases such as text-align: justify, we have to traverse the entire line
2017         at post-processing which requires all the fragments on the current line.
2018         This patch speeds up the basic line handling by using m_fragment list only for the special cases.
2019         It improves PerformanceTests/Layout/simple-line-layout-non-repeating-text.html by ~7% (local measurement)
2020         median: 114.25 runs/s -> median: 122.16 runs
2021
2022         Covered by existing tests.
2023
2024         * rendering/SimpleLineLayout.cpp:
2025         (WebCore::SimpleLineLayout::LineState::setNeedsAllFragments):
2026         (WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace):
2027         (WebCore::SimpleLineLayout::LineState::lastFragment):
2028         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
2029         (WebCore::SimpleLineLayout::LineState::isEmpty):
2030         (WebCore::SimpleLineLayout::LineState::endPositionForCollapsedFragment):
2031         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Track uncompleted width.
2032         (WebCore::SimpleLineLayout::LineState::revertToLastCompleteFragment):
2033         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
2034         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
2035         (WebCore::SimpleLineLayout::updateLineConstrains): Set the slow path for text-align: justify.
2036         (WebCore::SimpleLineLayout::createLineRuns):
2037         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
2038         (WebCore::SimpleLineLayout::createTextRuns):
2039         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2040         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isValid):
2041         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::length):
2042
2043 2017-01-31  Chris Dumez  <cdumez@apple.com>
2044
2045         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree
2046         https://bugs.webkit.org/show_bug.cgi?id=167665
2047         <rdar://problem/30241193>
2048
2049         Reviewed by Andreas Kling.
2050
2051         When destroying a PageCache entry, we would call Document::prepareFromDestruction()
2052         which would destroy the render tree and then call FrameView::didDestroyRenderTree().
2053         We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in
2054         didDestroyRenderTree(). This indicates that there are still RenderWidgets associated
2055         with the FrameView even though we claim we already destroyed the render tree.
2056
2057         The reason for this is that, in the PageCache context, the top document's frame is
2058         reused on navigation and may not be associated with a new document that is currently
2059         displayed, has a render tree (and possible RenderWidgets). The solution proposed is
2060         to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction()
2061         if the frame's document is not |this|. This happens when the document is destroyed
2062         while in PageCache. We do not want to mess with the frame / frameview in this case
2063         since they are no longer associated to the present document anymore.
2064
2065         No new tests, already covered by existing tests which currently crash flakily.
2066
2067         * dom/Document.cpp:
2068         (WebCore::Document::destroyRenderTree):
2069
2070 2017-01-31  Sam Weinig  <sam@webkit.org>
2071
2072         Remove unused/rarely used bindings helpers
2073         https://bugs.webkit.org/show_bug.cgi?id=167648
2074
2075         Reviewed by Anders Carlsson.
2076
2077         * bindings/js/JSDOMBinding.cpp:
2078         * bindings/js/JSDOMBinding.h:
2079         (WebCore::jsString): Deleted.
2080         (WebCore::jsStringOrUndefined): Deleted.
2081         (WebCore::finiteInt32Value): Deleted.
2082         (WebCore::toJS): Deleted.
2083         Remove unused functions. The toJS overrides can be replaced with their
2084         modern JSDOMConvert counterparts.
2085         
2086         * bindings/js/JSDOMExceptionHandling.h:
2087         (WebCore::toJS): Deleted.
2088         (WebCore::toJSNewlyCreated): Deleted.
2089         Remove unused functions.
2090
2091         * bindings/js/JSDOMIterator.h:
2092         Add more specific include of JSDOMConvert.h to fix compile.
2093
2094         * bindings/js/JSDOMPromise.cpp:
2095         (WebCore::DeferredPromise::reject):
2096         Create the Symbol directly, instead of using the toJS override.
2097
2098         * bindings/js/JSWorkerCustom.cpp:
2099         (WebCore::constructJSWorker):
2100         Use JSDOMConvert toJS function.
2101
2102         * bindings/js/JSXMLHttpRequestCustom.cpp:
2103         (WebCore::JSXMLHttpRequest::retrieveResponse):
2104         Use JSDOMConvert toJS functions.
2105
2106         * bindings/js/ScriptController.h:
2107         Add missing forward declaration of URL.
2108
2109         * bindings/js/ScriptModuleLoader.cpp:
2110         (WebCore::ScriptModuleLoader::resolve):
2111         Create the Symbol directly, instead of using the toJS override.
2112
2113         * html/HTMLPlugInImageElement.cpp:
2114         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
2115         Use JSDOMConvert toJS functions.
2116
2117 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2118
2119         WebItemProviderPasteboard should be robust when UIItemProvider fails to initialize an object
2120         https://bugs.webkit.org/show_bug.cgi?id=167663
2121         <rdar://problem/30294240>
2122
2123         Reviewed by Tim Horton.
2124
2125         Adds a nil check for the result of -createObjectOfClass:error:.
2126
2127         * platform/ios/WebItemProviderPasteboard.mm:
2128         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2129         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
2130
2131 2017-01-31  Keith Rollin  <krollin@apple.com>
2132
2133         Variable used after it's been WTFMove'd
2134         https://bugs.webkit.org/show_bug.cgi?id=167658
2135
2136         Reviewed by Chris Dumez.
2137
2138         Rather than WTFMoving the variable as part of passing it to a function
2139         that takes an RValue-ref, call copyRef to provide the RValue-ref. This
2140         preserves the original variable for later use in the function.
2141
2142         No new tests -- this issue was found by inspection. It's not apparent
2143         what the side-effect of this bug is or how a test would verify it.
2144
2145         * loader/SubresourceLoader.cpp:
2146         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
2147
2148 2017-01-31  Anders Carlsson  <andersca@apple.com>
2149
2150         Apple Pay button does nothing on nytimes.com
2151         https://bugs.webkit.org/show_bug.cgi?id=167664
2152         rdar://problem/30273885
2153
2154         Reviewed by Sam Weinig.
2155
2156         Separate line item validation into convertAndValidateTotal and convertAndValidate. The former
2157         works on totals (which require an amount), and the latter works on regular line items that do not require an amount
2158         if the item type is "pending".
2159
2160         * Modules/applepay/ApplePaySession.cpp:
2161         (WebCore::convertAndValidateTotal):
2162         (WebCore::convertAndValidate):
2163         Only check the amount if the type is not pending.
2164
2165         (WebCore::ApplePaySession::completeShippingMethodSelection):
2166         (WebCore::ApplePaySession::completeShippingContactSelection):
2167         (WebCore::ApplePaySession::completePaymentMethodSelection):
2168         Call convertAndValidateTotal for totals.
2169
2170 2017-01-31  Youenn Fablet  <youenn@apple.com>
2171
2172         [WebRTC] Add a libwebrtc AudioModule specific to WebKit
2173         https://bugs.webkit.org/show_bug.cgi?id=167572
2174
2175         Reviewed by Alex Christensen.
2176
2177         To be covered by webrtc audio tests.
2178         Adding an AudioModule to circumvent the default LibWebRTC Audio Module which does the audio directly.
2179         The implementation of the AudioModule is restricted to enable fueling the incoming audio tracks with incoming data.
2180         Code inspired from https://chromium.googlesource.com/chromium/src/+/master/remoting/protocol/webrtc_audio_module.h
2181
2182         * WebCore.xcodeproj/project.pbxproj:
2183         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: Added.
2184         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
2185         (WebCore::LibWebRTCAudioModule::RegisterAudioCallback):
2186         (WebCore::LibWebRTCAudioModule::OnMessage):
2187         (WebCore::LibWebRTCAudioModule::StartPlayout):
2188         (WebCore::LibWebRTCAudioModule::StopPlayout):
2189         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
2190         (WebCore::LibWebRTCAudioModule::PollFromSource):
2191         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Added.
2192         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2193         (WebCore::ThreadMessageData::ThreadMessageData):
2194         (WebCore::initializePeerConnectionFactoryAndThreads):
2195
2196 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
2197
2198         Build fix.
2199
2200         * editing/mac/EditorMac.mm:
2201         (WebCore::Editor::pasteWithPasteboard):
2202         (WebCore::Editor::takeFindStringFromSelection):
2203         (WebCore::Editor::replaceNodeFromPasteboard):
2204         * page/mac/EventHandlerMac.mm:
2205         (WebCore::EventHandler::createDraggingDataTransfer):
2206         * platform/mac/PasteboardMac.mm:
2207         (WebCore::Pasteboard::createForCopyAndPaste):
2208         (WebCore::Pasteboard::createForDragAndDrop):
2209
2210 2017-01-31  Eric Carlson  <eric.carlson@apple.com>
2211
2212         [Mac] Add an audio stream description class
2213         https://bugs.webkit.org/show_bug.cgi?id=167639
2214
2215         Reviewed by Youenn Fablet.
2216
2217         No new tests, the new class is not used yet.
2218
2219         * WebCore.xcodeproj/project.pbxproj:
2220         * platform/audio/AudioStreamDescription.h: Added.
2221         (WebCore::AudioStreamDescription::isPCM):
2222         * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
2223         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
2224         (WebCore::CAAudioStreamDescription::platformDescription):
2225         (WebCore::CAAudioStreamDescription::format):
2226         (WebCore::toCAAudioStreamDescription):
2227         (WebCore::CAAudioStreamDescription::operator==):
2228         (WebCore::operator==):
2229         * platform/audio/mac/CAAudioStreamDescription.h: Added.
2230         (WebCore::operator!=):
2231         (WebCore::CAAudioStreamDescription::bytesPerFrame):
2232         (WebCore::CAAudioStreamDescription::bytesPerPacket):
2233         (WebCore::CAAudioStreamDescription::formatFlags):
2234         (WebCore::CAAudioStreamDescription::operator==):
2235         (WebCore::CAAudioStreamDescription::operator!=):
2236         (WebCore::CAAudioStreamDescription::streamDescription):
2237
2238 2017-01-31  Youenn Fablet  <youenn@apple.com>
2239
2240         RTCPeerConnection methods can take dictionaries as input
2241         https://bugs.webkit.org/show_bug.cgi?id=167590
2242
2243         Reviewed by Alex Christensen.
2244
2245         Test: webrtc/rtcpeerconnection-error-messages.html
2246
2247         Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
2248         Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.
2249
2250         Updated RTCPeerConnection methods error messages.
2251
2252         * Modules/mediastream/RTCPeerConnection.js:
2253         (getLocalStreams):
2254         (getStreamById):
2255         (addStream):
2256         (createOffer):
2257         (createAnswer):
2258         (setLocalDescription):
2259         (setRemoteDescription):
2260         (addIceCandidate):
2261         (getStats):
2262         * Modules/mediastream/RTCPeerConnectionInternals.js:
2263
2264 2017-01-31  Simon Fraser  <simon.fraser@apple.com>
2265
2266         REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
2267         https://bugs.webkit.org/show_bug.cgi?id=167630
2268         rdar://problem/30091558
2269
2270         Reviewed by Zalan Bujtas.
2271         
2272         r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
2273         overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to 
2274         the root layer, which is where we scroll the document.
2275
2276         Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html
2277
2278         * rendering/RenderLayer.cpp:
2279         (WebCore::RenderLayer::getRectToExpose):
2280
2281 2017-01-31  Zan Dobersek  <zdobersek@igalia.com>
2282
2283         [EME] InitDataRegistry should use base64url encoding and decoding for keyids
2284         https://bugs.webkit.org/show_bug.cgi?id=167592
2285
2286         Reviewed by Jer Noble.
2287
2288         In InitDataRegistry, WTF::base64URLEncode() and WTF::base64URLDecode() should
2289         be used to encode and decode the 'keyids' initialization data format, as
2290         required by the relevant specification.
2291         https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format
2292
2293         Relevant test case was added to media/encrypted-media/mock-MediaKeySession-generateRequest.html.
2294
2295         * Modules/encryptedmedia/InitDataRegistry.cpp:
2296         (WebCore::extractKeyIDsKeyids):
2297         (WebCore::sanitizeKeyids):
2298
2299 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
2300
2301         Performance Timeline: Add serializer to PerformanceEntry
2302         https://bugs.webkit.org/show_bug.cgi?id=167632
2303
2304         Reviewed by Ryosuke Niwa.
2305
2306         Test: performance-api/performance-timeline-serializers.html
2307
2308         * page/PerformanceEntry.idl:
2309
2310 2017-01-31  Chris Fleizach  <cfleizach@apple.com>
2311
2312         AX: enable search predication for iOS
2313         https://bugs.webkit.org/show_bug.cgi?id=167558
2314         <rdar://problem/30251367>
2315
2316         Reviewed by Joanmarie Diggs.
2317
2318         Move the code to support accessibility searching into a shared place so it can be used by iOS.
2319
2320         Test: accessibility/ios-simulator/ios-search-predicate.html
2321
2322         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2323         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
2324         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
2325         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2326         (convertToNSArray):
2327         (createAccessibilitySearchKeyMap):
2328         (accessibilitySearchKeyForString):
2329         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
2330         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2331         (createAccessibilitySearchKeyMap): Deleted.
2332         (accessibilitySearchKeyForString): Deleted.
2333         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
2334         (convertToNSArray): Deleted.
2335
2336 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
2337
2338         [WebIDL] Add support for inherit serializer attribute
2339         https://bugs.webkit.org/show_bug.cgi?id=167274
2340
2341         Reviewed by Darin Adler.
2342
2343         Support for serializer { inherit }, which will be used by Resource Timing.
2344         https://heycam.github.io/webidl/#idl-serializers
2345
2346         * bindings/scripts/CodeGenerator.pm:
2347         (GetInterfaceForAttribute):
2348         (IsSerializableAttribute):
2349         Determine if an attribute is serializable at generation time so we can
2350         verify types. This allows us to support typedefs. We don't yet support
2351         serializing an attribute that is itself a serializable interface.
2352
2353         * bindings/scripts/CodeGeneratorJS.pm:
2354         (GenerateSerializerFunction):
2355         (GenerateSerializerAttributesForInterface):
2356         Generate inherited attributes first, then generate our own list.
2357         Explicitly provided attribute names are expected to be serializable,
2358         so produce an error if they are not.
2359
2360         * bindings/scripts/IDLParser.pm:
2361         (parseSerializationAttributes):
2362         Update parsing of serializer attributes to allow for multiple
2363         special strings. The spec does not precisely define where the
2364         special "attribute" keyword is allowed.
2365
2366         (applyMemberList):
2367         (isSerializableAttribute): Deleted.
2368         Move serializable attribute checking to generation.
2369
2370         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2371         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: Added.
2372         * bindings/scripts/test/JS/JSTestSerializationInherit.h: Added.
2373         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: Added.
2374         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h: Added.
2375         The toJSON implementations are the most interesting.
2376
2377         * bindings/scripts/test/TestSerialization.idl:
2378         Extend this test for typedefed attributes that are serializable.
2379         Change TestNode (a serializable Interface) to TestException (an
2380         unserializable Interface) for expected behavior of an
2381         unserializable attribute.
2382
2383         * bindings/scripts/test/TestSerializationInherit.idl:
2384         Test for { inherit, attribute }.
2385
2386         * bindings/scripts/test/TestSerializationInheritFinal.idl:
2387         Test for { inherit, attribute_names... }, and multi-level inherit.
2388
2389 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
2390
2391         Implement PerformanceObserver
2392         https://bugs.webkit.org/show_bug.cgi?id=167546
2393         <rdar://problem/30247959>
2394
2395         Reviewed by Ryosuke Niwa.
2396
2397         This implements PerformanceObserver from Performance Timeline Level 2:
2398         https://w3c.github.io/performance-timeline/
2399
2400         Tests: performance-api/performance-observer-api.html
2401                performance-api/performance-observer-basic.html
2402                performance-api/performance-observer-callback-mutate.html
2403                performance-api/performance-observer-callback-task.html
2404                performance-api/performance-observer-entry-sort.html
2405                performance-api/performance-observer-exception.html
2406                performance-api/performance-observer-nested.html
2407                performance-api/performance-observer-order.html
2408                performance-api/performance-observer-periodic.html
2409                performance-api/performance-timeline-api.html
2410
2411         * CMakeLists.txt:
2412         * DerivedSources.make:
2413         * WebCore.xcodeproj/project.pbxproj:
2414         New files.
2415
2416         * page/Performance.h:
2417         * page/Performance.cpp:
2418         (WebCore::Performance::mark):
2419         (WebCore::Performance::measure):
2420         (WebCore::Performance::registerPerformanceObserver):
2421         (WebCore::Performance::unregisterPerformanceObserver):
2422         (WebCore::Performance::queueEntry):
2423         Register PerformanceObservers with the Performance object.
2424         When new PerformanceEntries are created (Mark and Measure
2425         right now) check them against observers.
2426
2427         * page/PerformanceEntry.cpp:
2428         (WebCore::PerformanceEntry::PerformanceEntry):
2429         (WebCore::PerformanceEntry::typeForEntryTypeString):
2430         * page/PerformanceEntry.h:
2431         (WebCore::PerformanceEntry::type):
2432         Give PerformanceEntry a convenience enum for easy comparison
2433         and to know if it is one of the built-in known types (which the
2434         PerformanceObserver API takes into account).
2435
2436         * page/PerformanceObserver.cpp: Added.
2437         (WebCore::PerformanceObserver::PerformanceObserver):
2438         (WebCore::PerformanceObserver::observe):
2439         (WebCore::PerformanceObserver::disconnect):
2440         (WebCore::PerformanceObserver::queueEntry):
2441         (WebCore::PerformanceObserver::deliver):
2442         * page/PerformanceObserver.h:
2443         (WebCore::PerformanceObserver::create):
2444         (WebCore::PerformanceObserver::typeFilter):
2445         - TypeErrors on observe bad behavior
2446         - Completely replace types filter on observe
2447         - Handle register and unregister
2448         - Handle calling the callback
2449
2450         * page/PerformanceObserverCallback.idl: Added.
2451         * page/PerformanceObserverEntryList.cpp: Added.
2452         (WebCore::PerformanceObserverEntryList::PerformanceObserverEntryList):
2453         (WebCore::PerformanceObserverEntryList::getEntries):
2454         (WebCore::PerformanceObserverEntryList::getEntriesByType):
2455         (WebCore::PerformanceObserverEntryList::getEntriesByName):
2456         * page/PerformanceObserverEntryList.h:
2457         (WebCore::PerformanceObserverEntryList::create):
2458         * page/PerformanceObserverEntryList.idl: Added.
2459         Implement sorting and filtering of entries.
2460
2461         * page/PerformanceObserver.idl: Added.
2462         * page/PerformanceObserverCallback.h:
2463         (WebCore::PerformanceObserverCallback::~PerformanceObserverCallback):
2464         Mostly autogenerated.
2465
2466         * page/PerformanceUserTiming.cpp:
2467         (WebCore::UserTiming::mark):
2468         (WebCore::UserTiming::measure):
2469         * page/PerformanceUserTiming.h:
2470         Update these to return the entry so it can be passed on to
2471         any interested PerformanceObservers.
2472
2473 2017-01-30  Youenn Fablet  <youenn@apple.com>
2474
2475         [WebRTC] getStats does not support legacy callback
2476         https://bugs.webkit.org/show_bug.cgi?id=167617
2477
2478         Reviewed by Alex Christensen.
2479
2480         Covered by updated tests.
2481
2482         * Modules/mediastream/RTCPeerConnection.cpp:
2483         (WebCore::RTCPeerConnection::getStats):
2484         (WebCore::RTCPeerConnection::privateGetStats): Deleted.
2485         * Modules/mediastream/RTCPeerConnection.h:
2486         * Modules/mediastream/RTCPeerConnection.idl:
2487         * Modules/mediastream/RTCPeerConnection.js:
2488         (addIceCandidate):
2489         (getStats): Deleted.
2490
2491 2017-01-30  Sam Weinig  <sam@webkit.org>
2492
2493         JSDOMBinding is too big. Split it up!
2494         https://bugs.webkit.org/show_bug.cgi?id=167601
2495
2496         Reviewed by Darin Adler.
2497
2498         Splits JSDOMBinding.h/cpp up a bit by splitting out:
2499         - JSDOMBindingCaller.h
2500         - JSDOMBindingSecurity.h/cpp
2501         - JSDOMExceptionHandling.h/cpp
2502         - JSDOMWrapperCache.h/cpp
2503
2504         Also:
2505         - Moves all constructor objects to JSDOMConstructor.h/cpp,  
2506         - Moves special DOMWindow accessors to JSDOMWindowBase.
2507         - Deletes unused CallbackFunction.h/cpp
2508
2509         * CMakeLists.txt:
2510         * Modules/webdatabase/Database.cpp:
2511         * WebCore.xcodeproj/project.pbxproj:
2512         * bindings/js/CallbackFunction.cpp: Removed.
2513         * bindings/js/CallbackFunction.h: Removed.
2514         * bindings/js/DOMConstructorWithDocument.h: Removed.
2515         * bindings/js/JSCryptoCustom.cpp:
2516         * bindings/js/JSCustomXPathNSResolver.cpp:
2517         * bindings/js/JSDOMBinding.cpp:
2518         * bindings/js/JSDOMBinding.h:
2519         * bindings/js/JSDOMBindingCaller.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2520         * bindings/js/JSDOMBindingSecurity.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2521         * bindings/js/JSDOMBindingSecurity.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2522         * bindings/js/JSDOMConstructor.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2523         * bindings/js/JSDOMConstructor.h:
2524         * bindings/js/JSDOMConvert.h:
2525         * bindings/js/JSDOMExceptionHandling.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2526         * bindings/js/JSDOMExceptionHandling.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2527         * bindings/js/JSDOMWindowBase.cpp:
2528         (WebCore::callerDOMWindow): Moved from JSDOMBinding.h
2529         (WebCore::activeDOMWindow): Moved from JSDOMBinding.h
2530         (WebCore::firstDOMWindow): Moved from JSDOMBinding.h
2531         * bindings/js/JSDOMWindowBase.h:
2532         * bindings/js/JSDOMWindowCustom.cpp:
2533         * bindings/js/JSDOMWindowProperties.cpp:
2534         * bindings/js/JSDOMWrapperCache.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
2535         * bindings/js/JSDOMWrapperCache.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
2536         * bindings/js/JSEventTargetCustom.h:
2537         * bindings/js/JSHTMLElementCustom.cpp:
2538         * bindings/js/JSLocationCustom.cpp:
2539         * bindings/js/JSMutationObserverCustom.cpp:
2540         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
2541         * bindings/js/JSStorageCustom.cpp:
2542         * bindings/js/JSWorkerCustom.cpp:
2543         * bindings/js/JSXPathNSResolverCustom.cpp:
2544         * bindings/js/ScheduledAction.cpp:
2545         * bindings/js/ScriptController.cpp:
2546         * bindings/js/ScriptController.h:
2547         * bindings/js/ScriptGlobalObject.cpp:
2548         (WebCore::ScriptGlobalObject::set):
2549         * bindings/js/StructuredClone.cpp:
2550         * bindings/scripts/CodeGeneratorJS.pm:
2551         (GenerateImplementation):
2552         (GenerateCallWith):
2553         (GenerateParametersCheck):
2554         (GenerateCallbackImplementationContent):
2555         (NativeToJSValue):
2556         * bridge/objc/WebScriptObject.mm:
2557         * html/HTMLFrameElementBase.cpp:
2558         * html/HTMLVideoElement.cpp:
2559         * inspector/InspectorController.cpp:
2560         * inspector/InspectorDOMAgent.cpp:
2561         * inspector/PageScriptDebugServer.cpp:
2562         * inspector/WorkerScriptDebugServer.cpp:
2563
2564 2017-01-30  Andy Estes  <aestes@apple.com>
2565
2566         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
2567         https://bugs.webkit.org/show_bug.cgi?id=167625
2568
2569         Reviewed by Andreas Kling.
2570
2571         QuickLookHandleClients were being created by QuickLookHandle calling
2572         FrameLoaderClient::didCreateQuickLookHandle() then having the FrameLoaderClient create a new
2573         QuickLookHandleClient and set it using QuickLookHandle::setClient().
2574
2575         Since all FrameLoaderClient::didCreateQuickLookHandle() does is create a new
2576         QuickLookHandleClient, this patch changes the FrameLoaderClient function to return the new
2577         QuickLookHandleClient directly and removes the API from QuickLookHandle to set a client.
2578         This also removes previewFileName() and previewUTI() from QuickLookHandle and instead passes
2579         these as arguments to the FrameLoaderClient.
2580
2581         No change in behavior. Covered by existing tests.
2582
2583         * loader/EmptyClients.cpp: Added an implementation of createQuickLookHandleClient() that
2584         returns nullptr.
2585         * loader/FrameLoaderClient.h: Declared createQuickLookHandleClient() and removed
2586         didCreateQuickLookHandle().
2587         * loader/ios/QuickLook.h: Removed setClient(), previewFileName(), and previewUTI().
2588         * loader/ios/QuickLook.mm: Removed testingOrEmptyClient().
2589         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Set _client
2590         to testingClient() if it exists, otherwise set it to the client returned by
2591         FrameLoaderClient::createQuickLookHandleClient() it non-null, otherwise set it to
2592         emptyClient().
2593         (testingOrEmptyClient): Deleted.
2594         (-[WebPreviewLoader setClient:]): Deleted.
2595         (-[WebPreviewLoader converter]): Deleted.
2596         (WebCore::QuickLookHandle::setClient): Deleted.
2597         (WebCore::QuickLookHandle::previewFileName): Deleted.
2598         (WebCore::QuickLookHandle::previewUTI): Deleted.
2599
2600 2017-01-30  Jer Noble  <jer.noble@apple.com>
2601
2602         NULL-deref crash in TextTrack::removeCue()
2603         https://bugs.webkit.org/show_bug.cgi?id=167615
2604
2605         Reviewed by Eric Carlson.
2606
2607         It's possible for a track to be removed which was never actually added to the cue list.
2608         Specifically, if an in-band track with a negative start or end time was parsed, it would
2609         have been rejected by TextTrack::addCue(). When it comes time to flush those in-band cues,
2610         TextTrack::m_cues will still be NULL. Rather than ASSERT in this case, we should revert the
2611         behavior added in r210319 and throw an exception.
2612
2613         * html/track/TextTrack.cpp:
2614         (WebCore::TextTrack::removeCue):
2615
2616 2017-01-30  Andreas Kling  <akling@apple.com>
2617
2618         Fix CMSampleBuffer leak in MediaSampleAVFObjC::createNonDisplayingCopy().
2619         <https://webkit.org/b/167621>
2620
2621         Reviewed by Andy Estes.
2622
2623         We were failing to adopt the CMSampleBuffer after copying it. Seen on leaks bot.
2624
2625         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2626         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
2627
2628 2017-01-30  Andy Estes  <aestes@apple.com>
2629
2630         [QuickLook] QLPreviewConverter and QuickLookHandle have different lifetime requirements
2631         https://bugs.webkit.org/show_bug.cgi?id=167609
2632
2633         Reviewed by Andreas Kling.
2634         
2635         Currently, QuickLookHandles are owned by DocumentLoader so that the underlying
2636         QLPreviewConverter stays alive to service subresource requests. However, the QuickLookHandle
2637         itself only needs to live long enough to handle the main resource load. And in a follow-on
2638         patch we will need to create QLPreviewConverters independent of QuickLookHandle.
2639
2640         This patch moves ownership of QuickLookHandle from DocumentLoader to ResourceLoader. It also
2641         creates a C++ wrapper around QLPreviewConverter and teaches QuickLookHandle to transfer
2642         ownership of the wrapper to DocumentLoader once the main resource conversion is complete.
2643
2644         No change in behavior. Covered by existing tests.
2645
2646         * WebCore.xcodeproj/project.pbxproj: Added PreviewConverter.{h,mm}.
2647         * loader/DocumentLoader.cpp:
2648         (WebCore::DocumentLoader::setPreviewConverter): Renamed from setQuickLookHandle().
2649         (WebCore::DocumentLoader::previewConverter): Renamed from quickLookHandle().
2650         (WebCore::DocumentLoader::setQuickLookHandle): Renamed to setPreviewConverter().
2651         * loader/DocumentLoader.h:
2652         (WebCore::DocumentLoader::quickLookHandle): Renamed to quickLookHandle().
2653         * loader/ResourceLoader.cpp:
2654         (WebCore::ResourceLoader::willSendRequestInternal): Changed to call PreviewConverter::safeRequest().
2655         (WebCore::ResourceLoader::isQuickLookResource): Changed to check if m_quickLookHandle is null.
2656         (WebCore::ResourceLoader::didCreateQuickLookHandle): Deleted.
2657         * loader/ResourceLoader.h:
2658         * loader/SubresourceLoader.cpp:
2659         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Changed to access m_quickLookHandle.
2660         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
2661         (WebCore::SubresourceLoader::didReceiveData): Ditto.
2662         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto.
2663         (WebCore::SubresourceLoader::didFinishLoading): Ditto.
2664         (WebCore::SubresourceLoader::didFail): Ditto.
2665         * loader/cache/CachedRawResource.cpp:
2666         (WebCore::CachedRawResource::finishLoading): Wrapped the call to ResourceLoader::isQuickLookResource() in USE(QUICK_LOOK).
2667         * loader/ios/QuickLook.h: Renamed m_converter to m_previewLoader.
2668         * loader/ios/QuickLook.mm: Renamed WebPreviewConverter to WebPreviewLoader.
2669         (WebCore::registerQLPreviewConverterIfNeeded): Created a PreviewConverter instead of a QLPreviewConverter.
2670         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Ditto.
2671         (-[WebPreviewLoader appendDataArray:]): Accessed the QLPreviewConverter from the PreviewConverter.
2672         (-[WebPreviewLoader finishedAppending]): Ditto.
2673         (-[WebPreviewLoader failed]): Ditto.
2674         (-[WebPreviewLoader converter]): Renamed from platformConverter. Returns a pointer to the PreviewConverter.
2675         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Moved _converter to DocumentLoader.
2676         (-[WebPreviewLoader connection:didFailWithError:]): Created a PreviewConverter instead of a QLPreviewConverter.
2677         (WebCore::QuickLookHandle::QuickLookHandle): Called FrameLoaderClient::didCreateQuickLookHandle() instead of going through FrameLoader.
2678         (WebCore::QuickLookHandle::didReceiveData): Renamed m_converter to m_previewLoader.
2679         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
2680         (WebCore::QuickLookHandle::didFinishLoading): Ditto.
2681         (WebCore::QuickLookHandle::didFail): Ditto.
2682         (WebCore::QuickLookHandle::setClient): Ditto.
2683         (WebCore::QuickLookHandle::previewFileName): Ditto.
2684         (WebCore::QuickLookHandle::previewUTI): Ditto.
2685         (WebCore::QuickLookHandle::willSendRequest): Deleted.
2686         * platform/ios/QuickLookSoftLink.h: Removed soft-linking of QLPreviewConverter and kQLPreviewOptionPasswordKey.
2687         * platform/ios/QuickLookSoftLink.mm: Ditto.
2688         * platform/network/ios/PreviewConverter.h: Added.
2689         (WebCore::PreviewConverter::platformConverter): Added. Returns the underlying QLPreviewConverter.
2690         * platform/network/ios/PreviewConverter.mm: Added.
2691         (WebCore::optionsWithPassword): Creates a dictionary with the kQLPreviewOptionPasswordKey option set if password is non-null.
2692         (WebCore::PreviewConverter::PreviewConverter): Added constructors for the delegate/response and data/uti cases.
2693         (WebCore::PreviewConverter::safeRequest): Wraps -[QLPreviewConverter safeRequestForRequest:].
2694         (WebCore::PreviewConverter::previewRequest): Wraps -[QLPreviewConverter previewRequest].
2695         (WebCore::PreviewConverter::previewResponse): Wraps -[QLPreviewConverter previewResponse].
2696         (WebCore::PreviewConverter::previewFileName): Wraps -[QLPreviewConverter previewFileName].
2697         (WebCore::PreviewConverter::previewUTI): Wraps -[QLPreviewConverter previewUTI].
2698
2699 2017-01-30  Chris Dumez  <cdumez@apple.com>
2700
2701         Drop legacy Attributes.isId attribute
2702         https://bugs.webkit.org/show_bug.cgi?id=167603
2703
2704         Reviewed by Ryosuke Niwa.
2705
2706         Drop legacy Attributes.isId attribute.
2707
2708         This attribute is not in the specification:
2709         - https://dom.spec.whatwg.org/#interface-attr
2710
2711         Both Firefox and Chrome currently do not expose this attribute.
2712
2713         No new tests, rebaselined existing test.
2714
2715         * dom/Attr.cpp:
2716         * dom/Attr.h:
2717         * dom/Attr.idl:
2718
2719 2017-01-30  Zalan Bujtas  <zalan@apple.com>
2720
2721         Simple line layout: Small tweaks to improve performance.
2722         https://bugs.webkit.org/show_bug.cgi?id=167611
2723         <rdar://problem/30274294>
2724
2725         Reviewed by Simon Fraser.
2726
2727         This is ~10% progression on the attached test case (paragraphs with non-redundant content).
2728         median: 102.08 runs/s -> median: 114.25 runs/s
2729
2730         * rendering/SimpleLineLayout.cpp:
2731         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
2732         * rendering/SimpleLineLayoutFlowContents.cpp:
2733         (WebCore::SimpleLineLayout::initializeSegments):
2734         (WebCore::SimpleLineLayout::FlowContents::FlowContents):
2735         * rendering/SimpleLineLayoutFlowContents.h:
2736         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2737         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
2738         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
2739         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2740
2741 2017-01-30  Chris Dumez  <cdumez@apple.com>
2742
2743         Drop legacy constants on Event interface
2744         https://bugs.webkit.org/show_bug.cgi?id=167602
2745
2746         Reviewed by Sam Weinig.
2747
2748         Drop legacy constants on Event interface:
2749         MOUSEDOWN, MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, MOUSEDRAG,
2750         CLICK, DBLCLICK, KEYDOWN, KEYUP, KEYPRESS, DRAGDROP, FOCUS,
2751         BLUR, SELECT, and CHANGE.
2752
2753         Those constants are not used for anything, they are not in the
2754         specification and Chrome / Firefox do not have them.
2755
2756         No new tests, rebaselined existing test.
2757
2758         * dom/Event.idl:
2759
2760 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
2761
2762         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
2763         https://bugs.webkit.org/show_bug.cgi?id=167604
2764         rdar://problem/29500273
2765
2766         Reviewed by Zalan Bujtas.
2767         
2768         For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs
2769         to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with
2770         box-shadow, for example.
2771         
2772         Also make the compositing log output a little easier to read.
2773
2774         Test: compositing/scrolling/fixed-inside-scroll.html
2775
2776         * rendering/RenderLayerBacking.cpp:
2777         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
2778         * rendering/RenderLayerCompositor.cpp:
2779         (WebCore::RenderLayerCompositor::logLayerInfo):
2780
2781 2017-01-30  Jer Noble  <jer.noble@apple.com>
2782
2783         NULL-deref crash at PlatformMediaSession::endInterruption
2784         https://bugs.webkit.org/show_bug.cgi?id=167595
2785
2786         Reviewed by Eric Carlson.
2787
2788         Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly.
2789
2790         * platform/audio/PlatformMediaSessionManager.cpp:
2791         (WebCore::PlatformMediaSessionManager::beginInterruption):
2792         (WebCore::PlatformMediaSessionManager::endInterruption):
2793
2794 2017-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
2795
2796         Correct spacing regression on inter-element complex path shaping on some fonts
2797         https://bugs.webkit.org/show_bug.cgi?id=166013
2798
2799         Reviewed by Simon Fraser.
2800
2801         This patch brings the implementation of ComplexTextController in-line with the
2802         design at https://trac.webkit.org/wiki/ComplexTextController. Previously,
2803         ComplexTextController had a few problems:
2804         - The total width computed by ComplexTextController didn't match the width if
2805         you iterated over the entire string and added up the advances
2806         - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for
2807         the above by construing the concepts of paint advances as distinct from layout
2808         advances
2809         - Initial advances were considered part of layout sometimes and part of painting
2810         other times, depending on which function reports the information
2811         - For RTL runs, the wrong origin was added to the initial advance, and the origin
2812         should have been subtracted instead of added
2813
2814         This patch exhaustively updates every function in ComplexTextController to be
2815         consistent with the design linked to above. This design solves all of these
2816         problems.
2817
2818         Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL
2819                ComplexTextControllerTest.InitialAdvanceInRTL
2820                ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR
2821                ComplexTextControllerTest.InitialAdvanceInLTR
2822                ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins
2823                ComplexTextControllerTest.LeadingExpansion
2824                ComplexTextControllerTest.VerticalAdvances
2825
2826         * platform/graphics/GlyphBuffer.h:
2827         (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary.
2828         (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto.
2829         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2830         (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of
2831         unnecessary leadingExpansion().
2832         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs
2833         to compute paint advances, which means that it can't base this information off
2834         of layout advances. This function uses the trick mentioned at the end of the
2835         above link to compute the paint offset of an arbitrary glyph in the middle of
2836         an RTL run.
2837         * platform/graphics/mac/ComplexTextController.cpp:
2838         (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for
2839         testing.
2840         (WebCore::ComplexTextController::ComplexTextController): Ditto.
2841         (WebCore::ComplexTextController::finishConstruction): Ditto.
2842         (WebCore::ComplexTextController::offsetForPosition): This function operates on
2843         layout advances, and the initial layout advance is already added into the
2844         m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is
2845         no need to add it again here.
2846         (WebCore::ComplexTextController::advance): This function had completely busted
2847         logic about the relationship between initial advances and the first origin in
2848         each run. Because of the fortunate choice of only representing layout advances 
2849         in m_adjustedBaseAdvances, this entire block can be removed and the raw paint
2850         initial advance can be reported to the GlyphBuffer. Later in the function, we
2851         have to update the logic about how to compute a paint advance given a layout
2852         advance and some origins. In particular, there are two tricky pieces here: 1.
2853         The layout advance for the first glyph is equal to (initial advance - first
2854         origin + first Core Text advance, so computing the paint offset must cancel out
2855         the initial layout offset, and 2. the last paint advance in a run must actually
2856         end up at the position of the first glyph in the next run, so the next run's
2857         initial advance must be queried.
2858         (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we
2859         represented an initial advance of a successive run by just adding it to the
2860         previous run's last advance. However, this is incompatible with the new model
2861         presented in the link above, so we remove this section. We also have to add in
2862         the logic that the layout advance for the first glyph is equal to the formula
2863         presented above.
2864         * platform/graphics/mac/ComplexTextController.h:
2865         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment
2866         to reflect reality.
2867         (WebCore::ComplexTextController::leadingExpansion): Deleted.
2868
2869 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
2870
2871         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
2872         https://bugs.webkit.org/show_bug.cgi?id=167484
2873         rdar://problem/29453068
2874
2875         Reviewed by Dean Jackson.
2876
2877         There were various problems with the layout rect computation:
2878         1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed
2879            elements in WK2, but allow in WK1, so make use of that.
2880         2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to
2881            AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to
2882            copy the layoutViewportOrigin to the scheduled update.
2883         3. The layout viewport could be left with a negative top/left after rubber-banding.
2884         
2885         Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to
2886         simulate rubberbanding.
2887
2888         Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html
2889                fast/visual-viewport/rubberbanding-viewport-rects.html
2890
2891         * page/FrameView.cpp:
2892         (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it
2893         into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress.
2894         (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements().
2895         (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from
2896         escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping,
2897         and fix the logic to allow rubber-banding while taking headers and footers into account.
2898         * page/FrameView.h:
2899         * page/scrolling/AsyncScrollingCoordinator.cpp:
2900         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to
2901         be pushed onto the scheduled update, just like scroll position.
2902         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2903         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed.
2904         * platform/ScrollView.cpp:
2905         (WebCore::ScrollView::ScrollView):
2906         (WebCore::ScrollView::adjustScrollPositionWithinRange):
2907         (WebCore::ScrollView::setScrollOffset):
2908         * platform/ScrollView.h:
2909         (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting):
2910         (WebCore::ScrollView::allowsUnclampedScrollPosition):
2911         * testing/InternalSettings.cpp:
2912         (WebCore::InternalSettings::setAllowUnclampedScrollPosition):
2913         * testing/InternalSettings.h:
2914         * testing/InternalSettings.idl:
2915
2916 2017-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2917
2918         Web content process crashes when initiating a drag on a very large image
2919         https://bugs.webkit.org/show_bug.cgi?id=167564
2920
2921         Reviewed by Beth Dakin.
2922
2923         If we begin dragging an image element that is too large to show the cached image for, we will show an image file
2924         icon instead of the cached image. This may return null if createDragImageIconForCachedImageFilename is
2925         unimplemented, so in the meantime, we should not assume that dragImage will always exist before calling into
2926         doSystemDrag in doImageDrag and bail from the drag operation if that is the case.
2927
2928         * page/DragController.cpp:
2929         (WebCore::DragController::doImageDrag):
2930
2931 2017-01-30  Chris Dumez  <cdumez@apple.com>
2932
2933         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2934         https://bugs.webkit.org/show_bug.cgi?id=167536
2935
2936         Reviewed by Darin Adler.
2937
2938         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
2939         instead of a string. The value needs to be numeric and the current API is error-prone.
2940
2941         * html/HTMLMediaElement.cpp:
2942         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
2943         * loader/EmptyClients.cpp:
2944         * page/DiagnosticLoggingClient.h:
2945
2946 2017-01-30  Ryan Haddad  <ryanhaddad@apple.com>
2947
2948         Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element.
2949
2950         The LayoutTest for this change is frequently failing.
2951
2952         * page/EventHandler.cpp:
2953         (WebCore::EventHandler::handleMousePressEvent):
2954         (WebCore::EventHandler::handleMouseDoubleClickEvent):
2955         (WebCore::EventHandler::handleMouseMoveEvent):
2956         (WebCore::EventHandler::handleMouseReleaseEvent):
2957         (WebCore::EventHandler::handleMouseForceEvent):
2958         (WebCore::EventHandler::handleWheelEvent):
2959         * page/PointerLockController.cpp:
2960         (WebCore::PointerLockController::isLocked): Deleted.
2961         (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted.
2962         * page/PointerLockController.h:
2963
2964 2017-01-30  Antoine Quint  <graouts@apple.com>
2965
2966         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky
2967         https://bugs.webkit.org/show_bug.cgi?id=167254
2968         <rdar://problem/30259293>
2969
2970         Reviewed by Dean Jackson.
2971
2972         When we would identify that we need to prolong an existing auto-hide timer, when the previous
2973         auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually
2974         cancel the previous timer, which would let it fire and hide the controls bar. We now have two
2975         methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and
2976         _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only
2977         cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in
2978         the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide-
2979         mouse-leave-after-play.html a lot more reliable.
2980
2981         We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so
2982         that setting other members which may set a timer do not used an undefined value for the auto-hide
2983         timer delay.
2984
2985         * Modules/modern-media-controls/controls/controls-bar.js:
2986         (ControlsBar.prototype.set visible):
2987         (ControlsBar.prototype.handleEvent):
2988         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer):
2989         (ControlsBar.prototype._cancelAutoHideTimer):
2990
2991 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
2992
2993         REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
2994         https://bugs.webkit.org/show_bug.cgi?id=167003
2995
2996         Reviewed by Michael Catanzaro.
2997
2998         Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
2999         to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
3000         avoid using the default session for downloading HLS fragments.
3001
3002         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3003         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
3004         * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
3005         * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
3006         * platform/network/soup/ResourceHandleSoup.cpp:
3007         (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
3008         (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
3009         using the given SoupNetworkSession.
3010         (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
3011
3012 2017-01-30  Youenn Fablet  <youennf@gmail.com>
3013
3014         [WebRTC] Add support for libwebrtc data channel
3015         https://bugs.webkit.org/show_bug.cgi?id=167489
3016
3017         Reviewed by Alex Christensen.
3018
3019         Partially covered by webrtc/datachannel/basic.html but not yet enabled on bots.
3020
3021         Introducing LibWebRTCDataChannelHandler as the integration layer between WebCore (RTCDataChannel)
3022         and libwebrtc (DataChannelObserver).
3023
3024         * Modules/mediastream/RTCDataChannel.cpp:
3025         (WebCore::RTCDataChannel::create):
3026         (WebCore::RTCDataChannel::RTCDataChannel):
3027         (WebCore::RTCDataChannel::bufferedAmount):
3028         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
3029         * Modules/mediastream/RTCDataChannel.h:
3030         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: Added.
3031         (WebCore::LibWebRTCDataChannelHandler::~LibWebRTCDataChannelHandler):
3032         (WebCore::LibWebRTCDataChannelHandler::setClient):
3033         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
3034         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
3035         (WebCore::LibWebRTCDataChannelHandler::close):
3036         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
3037         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
3038         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3039         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3040         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
3041         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
3042         (): Deleted.
3043         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3044         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
3045         * dom/EventNames.h:
3046         * platform/mediastream/RTCDataChannelHandler.h:
3047         * platform/mediastream/RTCDataChannelHandlerClient.h:
3048         * platform/mock/RTCDataChannelHandlerMock.h:
3049
3050 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3051
3052         Several web timing tests crash in GTK+ and AppleWin bots
3053         https://bugs.webkit.org/show_bug.cgi?id=167577
3054
3055         Reviewed by Ryosuke Niwa.
3056
3057         The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
3058         invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
3059         that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
3060         insertPerformanceEntry().
3061
3062         Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
3063
3064         * page/PerformanceUserTiming.cpp:
3065         (WebCore::UserTiming::mark):
3066         (WebCore::UserTiming::measure):
3067         (WebCore::insertPerformanceEntry): Deleted.
3068
3069 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3070
3071         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
3072         https://bugs.webkit.org/show_bug.cgi?id=167575
3073
3074         Reviewed by Žan Doberšek.
3075
3076         We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources().
3077
3078         Fix crash in media/video-poster-background.html.
3079
3080         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3081         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers.
3082
3083 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
3084
3085         [Threaded Compositor] Crash on WebCore::GLContext::version()
3086         https://bugs.webkit.org/show_bug.cgi?id=167559
3087
3088         Reviewed by Michael Catanzaro.
3089
3090         Fixes crashes in several media tests.
3091
3092         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3093         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function.
3094
3095 2017-01-29  Nan Wang  <n_wang@apple.com>
3096
3097         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
3098         https://bugs.webkit.org/show_bug.cgi?id=166955
3099
3100         Reviewed by Ryosuke Niwa.
3101
3102         Created a new version of Range::collectSelectionRect() that returns rects for each
3103         line, so that Speak Selection doesn't need to handle searching for soft line breaks.
3104         Also added a variant of findPlainText to search for the closest matched range to the given position.
3105
3106         Test: editing/text-iterator/range-of-string-closest-to-position.html
3107
3108         * dom/Range.cpp:
3109         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
3110         (WebCore::Range::collectSelectionRects):
3111         * dom/Range.h:
3112         * editing/TextIterator.cpp:
3113         (WebCore::findPlainTextMatches):
3114         (WebCore::updateSearchBuffer):
3115         (WebCore::findIteratorOptions):
3116         (WebCore::rangeMatches):
3117         (WebCore::findClosestPlainText):
3118         (WebCore::findPlainText):
3119         (WebCore::findPlainTextOffset): Deleted.
3120         * editing/TextIterator.h:
3121         * editing/htmlediting.h:
3122         * testing/Internals.cpp:
3123         (WebCore::Internals::rangeOfStringNearLocation):
3124         * testing/Internals.h:
3125         * testing/Internals.idl:
3126
3127 2017-01-29  Andy Estes  <aestes@apple.com>
3128
3129         [QuickLook] Add a WebPreference to enable saving QuickLook documents in WebKitLegacy
3130         https://bugs.webkit.org/show_bug.cgi?id=167563
3131         <rdar://problem/30253207>
3132
3133         Reviewed by Andreas Kling.
3134
3135         * loader/ios/QuickLook.h: Removed unused declarations.
3136         (WebCore::QuickLookHandle::firstRequestURL): Deleted.
3137         * loader/ios/QuickLook.mm:
3138         (WebCore::removeQLPreviewConverterForURL): Stopped deleting the temporary file here; that's
3139         now done in QuickLookDocumentWriter.
3140         (addQLPreviewConverterWithFileForURL): Changed from an exported function to a static
3141         function since it's now only called inside QuickLook.mm.
3142         (WebCore::QuickLookHandle::QuickLookHandle): Stopped initializing m_firstRequestURL.
3143         (WebCore::addQLPreviewConverterWithFileForURL): Deleted.
3144         (WebCore::qlPreviewConverterFileNameForURL): Deleted.
3145         (WebCore::qlPreviewConverterUTIForURL): Deleted.
3146         (WebCore::QuickLookHandle::previewRequestURL): Deleted.
3147         (WebCore::QuickLookHandle::converter): Deleted.
3148
3149 2017-01-29  Zalan Bujtas  <zalan@apple.com>
3150
3151         Simple line layout: PerformanceTests/Layout/simple-line-layout-innertext.html regressed at r211108
3152         https://bugs.webkit.org/show_bug.cgi?id=167562
3153
3154         Reviewed by Antti Koivisto.
3155
3156         Apparently RunResolver::Run::constructStringForHyphenIfNeeded() is in a superhot codepath.
3157         The Run should not have any additional members anyway, so let's construct the hyphenated
3158         string on demand.
3159         Progression on simple-line-layout-innertext.html is from ~34runs/sec back to ~50runs/sec.
3160
3161         Covered by existing text.
3162
3163         * rendering/RenderTreeAsText.cpp:
3164         (WebCore::writeSimpleLine):
3165         * rendering/SimpleLineLayoutFunctions.cpp:
3166         (WebCore::SimpleLineLayout::paintFlow):
3167         * rendering/SimpleLineLayoutResolver.cpp:
3168         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
3169         (WebCore::SimpleLineLayout::RunResolver::Run::textWithHyphen):
3170         (WebCore::SimpleLineLayout::RunResolver::Run::text):
3171         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded): Deleted.
3172         * rendering/SimpleLineLayoutResolver.h:
3173
3174 2017-01-28  Tim Horton  <timothy_horton@apple.com>
3175
3176         Don't flash a tap highlight for the entirety of an editable WKWebView
3177         https://bugs.webkit.org/show_bug.cgi?id=167486
3178         <rdar://problem/30193996>
3179
3180         Reviewed by Dan Bernstein.
3181
3182         * dom/Document.h:
3183         Export.
3184
3185 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3186
3187         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
3188         https://bugs.webkit.org/show_bug.cgi?id=167555
3189
3190         Reviewed by Dan Bernstein.
3191
3192         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
3193         USE(APPLE_INTERNAL_SDK) instead.
3194
3195         * page/ios/EventHandlerIOS.mm:
3196         * platform/ios/DragImageIOS.mm:
3197         * platform/ios/PasteboardIOS.mm:
3198         * platform/mac/DragDataMac.mm:
3199
3200 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
3201
3202         Add Link Preload as an off-by-default experimental feature menu item.
3203         https://bugs.webkit.org/show_bug.cgi?id=167201
3204
3205         Reviewed by Ryosuke Niwa.
3206
3207         Removed the explicit setting of the Link Preload experimental feature,
3208         as it is now on by default for testing.
3209
3210         No new tests as this just removes methods from settings.
3211
3212         * testing/InternalSettings.cpp:
3213         (WebCore::InternalSettings::Backup::Backup):
3214         (WebCore::InternalSettings::Backup::restoreTo):
3215         * testing/InternalSettings.h:
3216         * testing/InternalSettings.idl:
3217
3218 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
3219
3220         Fix typo in error message
3221         https://bugs.webkit.org/show_bug.cgi?id=167554
3222
3223         Reviewed by Sam Weinig.
3224
3225         * bindings/scripts/CodeGenerator.pm:
3226         (GetEnumByType):
3227
3228 2017-01-28  Antoine Quint  <graouts@apple.com>
3229
3230         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
3231         https://bugs.webkit.org/show_bug.cgi?id=167552
3232         <rdar://problem/29601646>
3233
3234         Reviewed by Eric Carlson.
3235
3236         In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
3237         that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a "click" event
3238         handler on the entire media shadow root and calling "preventDefault()".
3239
3240         Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
3241
3242         * Modules/modern-media-controls/media/media-controller.js:
3243         (MediaController):
3244         (MediaController.prototype.handleEvent):
3245         (MediaController.prototype._containerWasClicked):
3246
3247 2017-01-28  Dan Bernstein  <mitz@apple.com>
3248
3249         [Xcode] Clean up PAL and WebCore’s build settings a little
3250         https://bugs.webkit.org/show_bug.cgi?id=167292
3251
3252         Reviewed by Sam Weinig.
3253
3254         * Configurations/Base.xcconfig: Simplified the definition of
3255           GCC_WARN_64_TO_32_BIT_CONVERSION, removed the unused build setting PREBINDING, removed
3256           a duplicate definition of GCC_GENERATE_DEBUGGING_SYMBOLS, and removed definitions specific
3257           to OS X versions that are no longer supported.
3258
3259         * Configurations/DebugRelease.xcconfig: Removed definitions specific to OS X versions
3260           that are no longer supported.
3261
3262 2017-01-28  Zalan Bujtas  <zalan@apple.com>
3263
3264         Resolve beforeChild's render tree position before calling addChildIgnoringContinuation.
3265         https://bugs.webkit.org/show_bug.cgi?id=167540
3266         <rdar://problem/30126535>
3267
3268         Reviewed by Simon Fraser.
3269
3270         Use the actual render tree position for the beforeChild when inside a flow thread.
3271
3272         Test: fast/multicol/assert-on-continuation-with-spanner.html
3273
3274         * rendering/RenderBlockFlow.cpp:
3275         (WebCore::RenderBlockFlow::addChild):
3276         * rendering/RenderInline.cpp:
3277         (WebCore::RenderInline::addChild):
3278         * rendering/RenderMultiColumnFlowThread.cpp:
3279         (WebCore::RenderMultiColumnFlowThread::resolveMovedChild):
3280
3281 2017-01-28  Andreas Kling  <akling@apple.com>
3282
3283         Avoid synchronous style recalc in dispatchUnloadEvents().
3284         <https://webkit.org/b/167551>
3285
3286         Reviewed by Antti Koivisto.
3287
3288         It shouldn't be necessary to force a synchronous style resolution in an unloading document.
3289         This call has been here since the import of KHTMLPart.
3290
3291         * loader/FrameLoader.cpp:
3292         (WebCore::FrameLoader::dispatchUnloadEvents):
3293
3294 2017-01-28  Andreas Kling  <akling@apple.com>
3295
3296         REGRESSION(r196383): Automatic shrink-to-fit of RuleSet no longer works.
3297         <https://webkit.org/b/167543>
3298
3299         Reviewed by Antti Koivisto.
3300
3301         Re-enable the automatic shrink-to-fit optimization in RuleSet.
3302         This was disabled accidentally, which I discovered while investigating
3303         the memory footprint of extension stylesheets.
3304
3305         * css/RuleSet.h:
3306
3307 2017-01-28  Antti Koivisto  <antti@apple.com>
3308
3309         Give scripts 'high' load priority
3310         https://bugs.webkit.org/show_bug.cgi?id=167550
3311
3312         Reviewed by Andreas Kling.
3313
3314         For historical reasons it is currently 'medium', same as web fonts and some other non-parsing blocking things.
3315
3316         * loader/cache/CachedResource.cpp:
3317         (WebCore::CachedResource::defaultPriorityForResourceType):
3318
3319 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
3320
3321         Add User Timing Experimental Feature
3322         https://bugs.webkit.org/show_bug.cgi?id=167542
3323         <rdar://problem/22746307>
3324
3325         Reviewed by Ryosuke Niwa.
3326
3327         * page/RuntimeEnabledFeatures.h:
3328         (WebCore::RuntimeEnabledFeatures::performanceTimelineEnabled):
3329         * page/Performance.idl:
3330         * page/PerformanceEntry.idl:
3331         Make a better RuntimeEnabledFeature named "PerformanceTiming" which
3332         is enabled if either UserTiming or ResourceTiming is enabled. This
3333         will then expose the APIs that are only useful when at least one of
3334         the APIs are available.
3335
3336         * page/PerformanceEntry.cpp:
3337         (WebCore::PerformanceEntry::name): Deleted.
3338         (WebCore::PerformanceEntry::entryType): Deleted.
3339         (WebCore::PerformanceEntry::startTime): Deleted.
3340         (WebCore::PerformanceEntry::duration): Deleted.
3341         * page/PerformanceEntry.h:
3342         (WebCore::PerformanceEntry::name):
3343         (WebCore::PerformanceEntry::entryType):
3344         (WebCore::PerformanceEntry::startTime):
3345         (WebCore::PerformanceEntry::duration):
3346         Inline simple accessors.
3347
3348         * page/PerformanceUserTiming.cpp:
3349         (WebCore::UserTiming::measure):
3350         Fix a bug introduced by ExceptionOr refactoring.
3351
3352         (WebCore::UserTiming::clearMarks):
3353         (WebCore::UserTiming::clearMeasures):
3354         (WebCore::clearPerformanceEntries):
3355         (WebCore::clearPeformanceEntries): Deleted.
3356         Fix method name typo.
3357
3358 2017-01-27  Dan Bernstein  <mitz@apple.com>
3359
3360         Ignore Xcode’s project.xcworkspace and userdata directories in this new project like we do
3361         in other projects.
3362
3363         * PAL/PAL.xcodeproj: Added property svn:ignore.
3364
3365 2017-01-27  Andy Estes  <aestes@apple.com>
3366
3367         Fix the iOS build when USE(QUICK_LOOK) is disabled.
3368
3369         * testing/Internals.cpp:
3370         (WebCore::Internals::setQuickLookPassword):
3371         * testing/Internals.h:
3372
3373 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3374
3375         setTimeout / setInterval's string execution should inherit SourceOrigin correctly
3376         https://bugs.webkit.org/show_bug.cgi?id=167097
3377
3378         Reviewed by Darin Adler.
3379
3380         Tests: js/dom/modules/import-from-set-interval.html
3381                js/dom/modules/import-from-set-timeout.html
3382
3383         * bindings/js/ScriptController.cpp:
3384         (WebCore::ScriptController::executeScriptInWorld):
3385
3386 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3387
3388         Merge CachedModuleScript and LoadableModuleScript
3389         https://bugs.webkit.org/show_bug.cgi?id=167500
3390
3391         Reviewed by Darin Adler.
3392
3393         CachedModuleScript becomes duplicate with LoadableModuleScript.
3394         And CachedModuleScript does not offer any meaningful functionality
3395         to LoadableModuleScript.
3396         This patch merges CachedModuleScript to LoadableModuleScript.
3397
3398         No behavior change.
3399
3400         * CMakeLists.txt:
3401         * WebCore.xcodeproj/project.pbxproj:
3402         * bindings/js/CachedModuleScript.cpp: Removed.
3403         * bindings/js/CachedModuleScript.h: Removed.
3404         * bindings/js/CachedModuleScriptClient.h: Removed.
3405         * bindings/js/JSBindingsAllInOne.cpp:
3406         * bindings/js/ScriptController.cpp:
3407         (WebCore::ScriptController::loadModuleScriptInWorld):
3408         (WebCore::ScriptController::loadModuleScript):