Follow-up fix for Soup platform.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-04-07  John Wilander  <wilander@apple.com>
2
3         Follow-up fix for Soup platform.
4         https://bugs.webkit.org/show_bug.cgi?id=170322
5
6         Unreviewed build fix. Error introduced by me in
7         https://trac.webkit.org/changeset/215104/webkit.
8
9         No new tests.
10
11         * platform/network/soup/SocketStreamHandleImpl.h:
12             Move parameter change to the right
13             SocketStreamHandleImpl::create() function.
14
15 2017-04-07  John Wilander  <wilander@apple.com>
16
17         WebSocket streams should have network usage attributed to correct process
18         https://bugs.webkit.org/show_bug.cgi?id=170322
19         <rdar://problem/26413551>
20
21         Reviewed by Alex Christensen.
22
23         Tested manually since it requires a per-app VPN.
24
25         * page/SocketProvider.cpp:
26         (WebCore::SocketProvider::createSocketStreamHandle):
27             Sends in an empty struct since it doesn't have access to
28             platform dependent sourceApplicationAuditData.
29         * platform/network/SocketStreamHandle.h:
30             Declaration of a per-platform struct to hold CF data for
31             Cocoa platforms.
32         * platform/network/cf/SocketStreamHandleImpl.h:
33         (WebCore::SocketStreamHandleImpl::create):
34             Now takes WebCore::SourceApplicationAuditToken which is
35             passed on to the constructor.
36         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
37         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
38             Now takes WebCore::SourceApplicationAuditToken which is
39             passed on to the streams once created.
40         (WebCore::SocketStreamHandleImpl::createStreams):
41             Now sets kCFStreamPropertySourceApplication for the two
42             streams.
43         * platform/network/curl/SocketStreamHandleImpl.h:
44         (WebCore::SocketStreamHandleImpl::create):
45             Added unused WebCore::SourceApplicationAuditToken parameter.
46         * platform/network/soup/SocketStreamHandleImpl.h:
47         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
48         (WebCore::SocketStreamHandleImpl::create):
49             Added unused WebCore::SourceApplicationAuditToken parameter.
50
51 2017-04-07  Alex Christensen  <achristensen@webkit.org>
52
53         REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame."  if too much data is sent
54         https://bugs.webkit.org/show_bug.cgi?id=170463
55
56         Reviewed by Michael Catanzaro.
57
58         This only reproduces when using WebSockets to communicate with an external server.
59         When communicating with a local server, CFWriteStreamWrite succeeds too reliably, so
60         CFWriteStreamCanAcceptBytes returns true, when sometimes it doesn't when communicating
61         across the real internet.
62
63         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
64         (WebCore::SocketStreamHandleImpl::platformSendInternal):
65         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
66         (WebCore::SocketStreamHandleImpl::platformSendInternal):
67         Returning std::nullopt means there was an error, which is not true when the socket stream
68         is in a state where it cannot be written to because it is actively communicating.
69         Returning 0 means 0 new bytes were sent, so we will try again later.
70
71 2017-04-07  Eric Carlson  <eric.carlson@apple.com>
72
73         MediaSample should store video sample rotation instead of orientation
74         https://bugs.webkit.org/show_bug.cgi?id=170598
75
76         Reviewed by Youenn Fablet.
77
78         No new tests, no functional change.
79
80         * platform/MediaSample.h:
81         (WebCore::MediaSample::videoRotation):
82         (WebCore::MediaSample::videoOrientation): Deleted.
83         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
84         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
85         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
86         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
87         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
88         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayLayer):
89
90         * platform/mediastream/mac/AVVideoCaptureSource.mm:
91         (WebCore::AVVideoCaptureSource::processNewFrame):
92
93         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
94         (WebCore::RealtimeIncomingVideoSource::OnFrame):
95         (WebCore::RealtimeIncomingVideoSource::processNewSample):
96         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
97
98         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
99         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
100
101 2017-04-07  Brent Fulgham  <bfulgham@apple.com>
102
103         WebKit should percent encode single quotes in query strings
104         https://bugs.webkit.org/show_bug.cgi?id=170561
105         <rdar://problem/7415154>
106
107         Reviewed by Alex Christensen.
108
109         Modify the characterClassTable to instruct the URLParser to convert
110         the single-quote character ' to %27 in URL query strings.
111
112         Tests: URLParserTest in TestWebKitAPI.
113             fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html
114             fast/frames/xss-auditor-handles-file-urls.html
115             http/tests/security/xssAuditor
116
117         * platform/URLParser.cpp:
118
119 2017-04-07  Zalan Bujtas  <zalan@apple.com>
120
121         Text insertion cursor disappears after pressing enter
122         https://bugs.webkit.org/show_bug.cgi?id=169291
123         <rdar://problem/30899611>
124
125         Reviewed by Tim Horton.
126
127         Positon upstream/downstream (as the result of VisiblePosition -> canonicalPosition) require
128         linebox tree. In addition to regular text, we need to bail out of simple line layout on line breaks too.
129
130         Test: editing/simple-line-layout-caret-is-gone.html
131
132         * dom/Position.cpp:
133         (WebCore::ensureLineBoxesIfNeeded):
134         (WebCore::Position::upstream):
135         (WebCore::Position::downstream):
136         (WebCore::Position::getInlineBoxAndOffset):
137         * rendering/RenderLineBreak.cpp:
138         (WebCore::RenderLineBreak::ensureLineBoxes):
139         (WebCore::RenderLineBreak::positionForPoint):
140         (WebCore::RenderLineBreak::setSelectionState):
141         (WebCore::RenderLineBreak::collectSelectionRects):
142         (WebCore::ensureLineBoxes): Deleted.
143         * rendering/RenderLineBreak.h:
144
145 2017-04-07  Xan Lopez  <xlopez@igalia.com>
146
147         [GTK] Fix codec name in OWR ASSERT
148         https://bugs.webkit.org/show_bug.cgi?id=170600
149
150         Reviewed by Carlos Garcia Campos.
151
152         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
153         (WebCore::MediaEndpointOwr::prepareMediaSession): uppercase the
154         codec name we are looking for, that's how they appear in the
155         vector.
156
157 2017-04-07  Per Arne Vollan  <pvollan@apple.com>
158
159         Add hasVideo property to WebAVPlayerController.
160         https://bugs.webkit.org/show_bug.cgi?id=170545
161         rdar://problem/31325182
162
163         Reviewed by Eric Carlson.
164
165         Add a new "hasVideo" property which can be used to discover if any video content is present in the playback item,
166         whether video content is currently enabled or not.
167
168         * platform/ios/WebAVPlayerController.h:
169         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
170         (WebVideoFullscreenInterfaceAVKit::hasVideoChanged):
171
172 2017-04-07  Miguel Gomez  <magomez@igalia.com>
173
174         [GTK+] Animations not played properly when using synchronous decoding
175         https://bugs.webkit.org/show_bug.cgi?id=170591
176
177         Reviewed by Carlos Garcia Campos.
178
179         Fix an index error when destroying decoded frames that was sometimes deleting the frame we wanted
180         to keep.
181
182         Covered by exitent tests.
183
184         * platform/graphics/ImageFrameCache.cpp:
185         (WebCore::ImageFrameCache::destroyDecodedData):
186
187 2017-04-07  Xan Lopez  <xan@igalia.com>
188
189         [GTK] Add message about missing codecs to ASSERT in OWR
190         https://bugs.webkit.org/show_bug.cgi?id=170596
191
192         Reviewed by Carlos Garcia Campos.
193
194         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
195         (WebCore::MediaEndpointOwr::prepareMediaSession): add a message
196         about the missing coded to the ASSERT.
197
198 2017-04-07  Tomas Popela  <tpopela@redhat.com>
199
200         AX: Don't crash if no renderer is available for AccessibilityRenderObject
201         https://bugs.webkit.org/show_bug.cgi?id=170448
202
203         Reviewed by Chris Fleizach.
204
205         Don't crash or assert if no renderer is available, but early return
206         gracefully (as in other places in the AccessibilityRenderObject.cpp).
207         Spotted by running some tests through dogtail.
208
209         * accessibility/AccessibilityRenderObject.cpp:
210         (WebCore::AccessibilityRenderObject::isOffScreen):
211         (WebCore::AccessibilityRenderObject::isUnvisited):
212         (WebCore::AccessibilityRenderObject::isVisited):
213
214 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
215
216         [GTK] Update the priorities used in glib main loop sources
217         https://bugs.webkit.org/show_bug.cgi?id=170457
218
219         Reviewed by Žan Doberšek.
220
221         * platform/glib/MainThreadSharedTimerGLib.cpp:
222         (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
223         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
224         (WebCore::TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy):
225         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
226
227 2017-04-07  Zan Dobersek  <zdobersek@igalia.com>
228
229         [GCrypt] Implement AES_CBC support
230         https://bugs.webkit.org/show_bug.cgi?id=170550
231
232         Reviewed by Michael Catanzaro.
233
234         Implement the CryptoAlgorithmAES_CBC::platform{Encrypt,Decrypt}
235         functionality for configurations that use libgcrypt. This is done
236         by leveraging the gcry_cipher_* APIs for the AES algorithm that's
237         deduced appropriately from the key size and the CBC cipher mode.
238         Additionally, the PKCS#7 padding is implemented for each operation,
239         as demanded by the Web Crypto specification.
240
241         No new tests -- current ones cover this sufficiently, but are not yet
242         enabled due to missing platform-specific SUBTLE_CRYPTO implementations.
243
244         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
245         (WebCore::gcryptEncrypt):
246         (WebCore::gcryptDecrypt):
247         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
248         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
249
250 2017-04-07  Zan Dobersek  <zdobersek@igalia.com>
251
252         [GCrypt] Implement raw and JWK imports and exports for EC keys
253         https://bugs.webkit.org/show_bug.cgi?id=170546
254
255         Reviewed by Michael Catanzaro.
256
257         Implement import and export operations for EC keys, covering the raw
258         and JWK import/export types.
259
260         CryptoKeyEC::platformImportRaw() builds a public-key s-expression,
261         providing the curve name and the key data, and yields the gcry_sexp_t
262         object to the new CryptoKeyEC.
263
264         CryptoKeyEC::platformImportJWKPublic() first constructs a Vector<uint8_t>
265         object that contains the EC point in the uncompressed format. It then
266         puts that data into a newly-constructed public-key s-expression that is
267         then used to construct the new CryptoKeyEC object.
268
269         CryptoKeyEC::platformImportJWKPrivate() constructs the EC point data just
270         the same, but it also lays out the private key field element data into
271         the private-key s-expression that's then handed off to the CryptoKeyEC
272         object.
273
274         CryptoKeyEC::platformExportRaw() constructs a new EC operations context
275         and then uses it to retrieve the q parameter as an MPI. A Vector<uint8_t>
276         is retrieved from the MPI data through the extractMPIData() helper
277         function.
278
279         CryptoKeyEC::platformAddFieldElements() similarly uses the EC operations
280         context to retrieve the q parameter data, which it then splits into the
281         x and y field elements and Base64 URL-encodes them into a form that can
282         be placed in a JsonWebKey. If the key is private, the d parameter is
283         retrieved in the same fashion and again Base64 URL-encoded and stored
284         in the JsonWebKey object.
285
286         No new tests -- current ones cover this sufficiently, but are not yet
287         enabled due to other missing platform-specific SUBTLE_CRYPTO
288         implementations.
289
290         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
291         (WebCore::uncompressedPointSizeForCurve):
292         (WebCore::uncompressedFieldElementSizeForCurve):
293         (WebCore::extractMPIData):
294         (WebCore::CryptoKeyEC::platformImportRaw):
295         (WebCore::CryptoKeyEC::platformImportJWKPublic):
296         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
297         (WebCore::CryptoKeyEC::platformExportRaw):
298         (WebCore::CryptoKeyEC::platformAddFieldElements):
299
300 2017-04-07  Zan Dobersek  <zdobersek@igalia.com>
301
302         [GCrypt] Implement CryptoKeyRSA::generatePair()
303         https://bugs.webkit.org/show_bug.cgi?id=170350
304
305         Reviewed by Michael Catanzaro.
306
307         Start implementing the libgcrypt-based platform bits of CryptoKeyRSA.
308
309         Implement generatePair() by constructing a genkey s-expression
310         that requests a generation of an RSA key that should use a modulus
311         of the specified bit-length and the specified exponent. The exponent
312         is extracted from an uint8_t array through a helper function. The
313         modulus length value is checked to be at least 16, since libgcrypt
314         does not support generating primes of less than that length in bits.
315
316         The returned s-expression upon request will contain the data for
317         both the public and the private key. gcry_sexp_t handles representing
318         those s-expressions are then passed to CryptoKeyRSA::create() before
319         invoking the success callback with a new CryptoKeyPair object in a
320         separate ScriptExecutionContext task.
321
322         The CryptoKeyRSA constructor simply has the notImplemented() call
323         removed. The destructor now invokes the HandleDeleter<gcry_sexp_t>
324         object instance to destroy the object represented by the
325         m_platformKey handle.
326
327         The methods in CryptoKeyRSA.cpp are also reordered to follow the
328         declaration order used in the header.
329
330         No new tests -- current ones cover this sufficiently, but are not yet
331         enabled due to other missing platform-specific SUBTLE_CRYPTO
332         implementations.
333
334         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
335         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
336         (WebCore::CryptoKeyRSA::~CryptoKeyRSA):
337         (WebCore::exponentVectorToUInt32):
338         (WebCore::CryptoKeyRSA::generatePair):
339         (WebCore::CryptoKeyRSA::importSpki):
340         (WebCore::CryptoKeyRSA::importPkcs8):
341         (WebCore::CryptoKeyRSA::exportPkcs8):
342         (WebCore::CryptoKeyRSA::buildAlgorithm):
343         (WebCore::CryptoKeyRSA::exportData):
344         * crypto/keys/CryptoKeyRSA.h:
345
346 2017-04-06  Youenn Fablet  <youenn@apple.com>
347
348         [Debug] ASSERT(!throwScope.exception()) on imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
349         https://bugs.webkit.org/show_bug.cgi?id=170395
350         <rdar://problem/31394017>
351
352         Reviewed by Mark Lam.
353
354         * bindings/js/JSDOMPromise.cpp:
355         (WebCore::DeferredPromise::reject): Exiting early in case of scope having an exception.
356         Adding an assertion to ensure this is a worker termination exception.
357
358 2017-04-06  Andreas Kling  <akling@apple.com>
359
360         Inaudible background tabs should become eligible for memory kill after 8 minutes
361         https://bugs.webkit.org/show_bug.cgi?id=170574
362         <rdar://problem/31488686>
363
364         Reviewed by Gavin Barraclough.
365
366         Lower the delay for potentially marking background tabs as inactive from 60 minutes to 8 minutes.
367         Letting a tab misbehave in the background for an entire hour was overly charitable.
368
369         * page/PerformanceMonitor.cpp:
370
371 2017-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
372
373         Scroll offset jumps after a programmatic scroll in an overflow container with scroll snapping
374         https://bugs.webkit.org/show_bug.cgi?id=170560
375         <rdar://problem/31484693>
376
377         Reviewed by Tim Horton.
378
379         Test: css3/scroll-snap/scroll-snap-programmatic-overflow-scroll.html
380
381         Logic for maintaining the scroll snap state in ScrollController was previously removed from iOS when refactoring
382         ScrollController. This was done because scroll snapping on iOS is driven not by the ScrollController (as it is
383         on Mac) but rather by sending scroll snap offsets to the UI process and hooking into UIScrollView delegates to
384         handle retargeted scrolling.
385
386         However, on iOS, this ScrollController state is still important for the purposes of keeping the last active
387         snap point index in sync with the UI process when the scroll offset changes outside of a user gesture (i.e.
388         programmatic scrolling). Since the UI process does not get a chance to update the active snap offset during a
389         programmatic scroll, our last active snap offset state was only being updated to the last snap position that the
390         user manually scrolled to, making programmatic scrolling jump to this offset.
391
392         To fix this, we need to update scroll snap state on iOS within ScrollController. Also adds a new Layout test
393         that exercises programmatic scrolling in an overflow scrolling container on all platforms.
394
395         * platform/cocoa/ScrollController.mm:
396         (WebCore::otherScrollEventAxis):
397         (WebCore::ScrollController::updateScrollSnapState):
398         (WebCore::ScrollController::updateScrollSnapPoints):
399
400 2017-04-05  Simon Fraser  <simon.fraser@apple.com>
401
402         Throttle requestAnimationFrame in cross-origin iframes to 30fps
403         https://bugs.webkit.org/show_bug.cgi?id=170534
404
405         Reviewed by Dan Bates.
406
407         Add a throttling reason to ScriptedAnimationController which is NonInteractedCrossOriginFrame,
408         set on cross-origin iframes whose documents have never seen a user interaction. It's cleared
409         as soon as an interaction on this frame or a child frame is detected.
410
411         Move the initialization of the LowPowerMode throttling reason to Document::requestAnimationFrame(),
412         since it's more appropriate to compute NonInteractedCrossOriginFrame here than down in ScriptedAnimationController,
413         and best to do both in the same place.
414
415         Tests: http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html
416
417         * dom/Document.cpp:
418         (WebCore::Document::requestAnimationFrame):
419         (WebCore::Document::updateLastHandledUserGestureTimestamp):
420         * dom/Document.h:
421         (WebCore::Document::hasHadUserInteraction):
422         * dom/ScriptedAnimationController.cpp:
423         (WebCore::ScriptedAnimationController::ScriptedAnimationController):
424         (WebCore::throttlingReasonToString):
425         (WebCore::ScriptedAnimationController::interval):
426         * dom/ScriptedAnimationController.h:
427         * loader/FrameLoader.cpp:
428         (WebCore::shouldAskForNavigationConfirmation):
429
430 2017-04-05  Simon Fraser  <simon.fraser@apple.com>
431
432         Use the Accelerate framework to optimize FEColorMatrix operations
433         https://bugs.webkit.org/show_bug.cgi?id=170518
434
435         Reviewed by Tim Horton.
436
437         On macOS and iOS, we can use the Accelerate framework (vImage) to do color matrix
438         math to optimize color matrix, hue rotate, saturation and luminosity to alpha filters.
439         
440         Change ImageBuffer::getUnmultipliedImageData() and getPremultipliedImageData() to
441         return the size of the returned Uint8ClampedArray in physical pixels, because we
442         need to pass that to vImage.
443
444         * html/canvas/CanvasRenderingContext2D.cpp:
445         (WebCore::CanvasRenderingContext2D::getImageData):
446         * platform/graphics/ImageBuffer.h:
447         * platform/graphics/cairo/ImageBufferCairo.cpp:
448         (WebCore::ImageBuffer::getUnmultipliedImageData):
449         (WebCore::ImageBuffer::getPremultipliedImageData):
450         * platform/graphics/cg/ImageBufferCG.cpp:
451         (WebCore::ImageBuffer::getUnmultipliedImageData):
452         (WebCore::ImageBuffer::getPremultipliedImageData):
453         * platform/graphics/filters/FEColorMatrix.cpp:
454         (WebCore::effectApplyAccelerated):
455         (WebCore::effectType):
456         (WebCore::FEColorMatrix::platformApplySoftware):
457         * platform/graphics/filters/FEDropShadow.cpp:
458         (WebCore::FEDropShadow::platformApplySoftware):
459         * platform/graphics/win/ImageBufferDirect2D.cpp:
460         (WebCore::ImageBuffer::getUnmultipliedImageData):
461         (WebCore::ImageBuffer::getPremultipliedImageData):
462
463 2017-04-04  Simon Fraser  <simon.fraser@apple.com>
464
465         Do some minor FEColorMatrix code cleanup and optimization
466         https://bugs.webkit.org/show_bug.cgi?id=170474
467
468         Reviewed by Dean Jackson.
469
470         Don't switch inside of a pixel processing loop; repeat the loop inside switch (filterType).
471         
472         Change matrix() and saturateAndHueRotate() to dereference the source pixels once, instead
473         of multiple times, which is faster.
474         
475         This kind of code benefits from aligning things with spaces for readability, so do so,
476         violating webkit style.
477         
478         Add some off-by-default performance logging code.
479
480         Increases pixel processing performance from about 86ms per megapixel to 65ms per megapixel.
481
482         * platform/graphics/filters/FEColorMatrix.cpp:
483         (WebCore::matrix):
484         (WebCore::saturateAndHueRotate):
485         (WebCore::effectType):
486         (WebCore::FEColorMatrix::platformApplySoftware):
487
488 2017-04-06  Ryan Haddad  <ryanhaddad@apple.com>
489
490         Unreviewed, rolling out r215041.
491
492         The LayoutTest for this change is failing on ios-simulator.
493
494         Reverted changeset:
495
496         "Rendering flexbox children across columns"
497         https://bugs.webkit.org/show_bug.cgi?id=164166
498         http://trac.webkit.org/changeset/215041
499
500 2017-04-06  Ryan Haddad  <ryanhaddad@apple.com>
501
502         Unreviewed, rolling out r215046.
503
504         This change broke internal builds.
505
506         Reverted changeset:
507
508         "WebRTC tests gardening"
509         https://bugs.webkit.org/show_bug.cgi?id=170508
510         http://trac.webkit.org/changeset/215046
511
512 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
513
514         Web Inspector: Only Capture Extra Network Load Metrics when there is a Web Inspector Frontend
515         https://bugs.webkit.org/show_bug.cgi?id=170525
516
517         Reviewed by Youenn Fablet.
518
519         Covered by existing tests that when Web Inspector is open we enable collecting the extra data.
520
521         * inspector/InspectorInstrumentation.cpp:
522         (WebCore::InspectorInstrumentation::firstFrontendCreated):
523         (WebCore::InspectorInstrumentation::lastFrontendDeleted):
524         * inspector/InspectorInstrumentation.h:
525         (WebCore::InspectorInstrumentation::frontendCreated):
526         (WebCore::InspectorInstrumentation::frontendDeleted):
527         When the first frontend is created enable a new loader strategy to
528         collect extra network load metrics. When the last frontend is closed
529         disable the extra metrics.
530
531         * loader/LoaderStrategy.h:
532         * platform/PlatformStrategies.h:
533         New load strategy to enable/disable new metrics.
534
535 2017-04-06  Joseph Pecoraro  <pecoraro@apple.com>
536
537         Web Inspector: Show all headers in the Request Headers section of the Resource details sidebar
538         https://bugs.webkit.org/show_bug.cgi?id=16531
539         <rdar://problem/5712895>
540
541         Reviewed by Timothy Hatcher.
542
543         Test: http/tests/inspector/network/resource-request-headers.html
544
545         * loader/ResourceTiming.cpp:
546         (WebCore::ResourceTiming::ResourceTiming):
547         Eliminate unnecessary data from the NetworkLoadTiming object
548         when it is used for ResourceTiming. This clears up some memory
549         that will otherwise never be used.
550
551         * platform/network/NetworkLoadMetrics.h:
552         (WebCore::NetworkLoadMetrics::isolatedCopy):
553         (WebCore::NetworkLoadMetrics::reset):
554         (WebCore::NetworkLoadMetrics::clearNonTimingData):
555         (WebCore::NetworkLoadMetrics::operator==):
556         (WebCore::NetworkLoadMetrics::encode):
557         (WebCore::NetworkLoadMetrics::decode):
558         Include an optional HTTPHeaderMap for a refined list of
559         request headers for this network load.
560
561         * inspector/InspectorNetworkAgent.cpp:
562         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
563         Include request headers with other optional metrics data
564         when the load is completed.
565
566 2017-04-06  Tim Horton  <timothy_horton@apple.com>
567
568         Follow up to r209304, remove line numbers from one more StyleRule construction
569         https://bugs.webkit.org/show_bug.cgi?id=170564
570
571         Reviewed by Simon Fraser.
572
573         * css/StyleRule.cpp:
574         (WebCore::StyleRuleViewport::StyleRuleViewport):
575         This one was missed in r209304.
576
577 2017-04-06  Timothy Horton  <timothy_horton@apple.com>
578
579         Remove an unused member and constructor parameter from CSSPropertyParser
580         https://bugs.webkit.org/show_bug.cgi?id=170562
581
582         Reviewed by Simon Fraser.
583
584         * css/parser/CSSParser.cpp:
585         (WebCore::CSSParser::parseSingleValue):
586         (WebCore::CSSParser::parseValueWithVariableReferences):
587         * css/parser/CSSParserImpl.cpp:
588         (WebCore::CSSParserImpl::consumeDeclarationValue):
589         * css/parser/CSSPropertyParser.cpp:
590         (WebCore::CSSPropertyParser::CSSPropertyParser):
591         (WebCore::CSSPropertyParser::parseValue):
592         (WebCore::CSSPropertyParser::parseSingleValue):
593         * css/parser/CSSPropertyParser.h:
594         It is possible to get Clang to complain about the unused member, though
595         I'm not sure why it doesn't in the build today.
596
597 2017-04-06  Zalan Bujtas  <zalan@apple.com>
598
599         Simple line layout: Hittest always returns the first renderer in the block.
600         https://bugs.webkit.org/show_bug.cgi?id=170520
601         <rdar://problem/30979175>
602
603         Reviewed by Antti Koivisto.
604
605         This is incorrect now with <br> support (multiple renderers within the same block flow).
606
607         Test: fast/dom/Document/CaretRangeFromPoint/simple-line-layout-hittest-with-caret-range-from-point.html
608
609         * rendering/RenderText.cpp:
610         (WebCore::RenderText::positionForPoint): Related fix. We don't yet support positionForPoint with multiple renderes. 
611         * rendering/SimpleLineLayoutFlowContents.h:
612         (WebCore::SimpleLineLayout::FlowContents::segmentForRun): Empty runs are all valid.
613         * rendering/SimpleLineLayoutFunctions.cpp:
614         (WebCore::SimpleLineLayout::hitTestFlow):
615         (WebCore::SimpleLineLayout::collectFlowOverflow):
616         * rendering/SimpleLineLayoutResolver.cpp:
617         (WebCore::SimpleLineLayout::LineResolver::Iterator::operator*): This should eventually return a list of renderes.
618         * rendering/SimpleLineLayoutResolver.h:
619         (WebCore::SimpleLineLayout::RunResolver::flowContents):
620
621 2017-04-06  Jon Davis  <jond@apple.com>
622
623         Updates feature status for recently shipped features
624         https://bugs.webkit.org/show_bug.cgi?id=170359
625
626         Reviewed by Brian Burg.
627
628         Added missing Gamepad entry.
629         Changed "Done" status to "Supported".
630         Also changed status from "In Development" to "Supported" for:
631         
632         - CSS Grid Layout Level 1
633         - CSS Inline Layout Module Level 3
634         - CSS Scroll Snap Points Module Level 1
635         - CSS Color Level 4
636         - Fetch API
637         - Indexed Database 2.0
638         - Media Capture and Streams
639         - Pointer Lock
640         - Preload
641         - Input Events
642
643         * features.json:
644
645 2017-03-31  Jiewen Tan  <jiewen_tan@apple.com>
646
647         [WebCrypto] Add support for AES-CTR
648         https://bugs.webkit.org/show_bug.cgi?id=169761
649         <rdar://problem/31331321>
650
651         Reviewed by Brent Fulgham.
652
653         This patch adds support for AES-CTR. Operations of AES-CTR include: encrypt, decrypt, generateKey,
654         importKey, exportKey, wrapKey, and unwrapKey. This implementation follows the latest WebCryptoAPI
655         spec: https://www.w3.org/TR/WebCryptoAPI/#aes-ctr.
656
657         Tests: crypto/subtle/aes-ctr-encrypt-malformed-parameters.html
658                crypto/subtle/aes-ctr-encrypt-overflow.html
659                crypto/subtle/aes-ctr-generate-export-key-jwk-length-128.html
660                crypto/subtle/aes-ctr-generate-export-key-jwk-length-192.html
661                crypto/subtle/aes-ctr-generate-export-key-jwk-length-256.html
662                crypto/subtle/aes-ctr-generate-export-raw-key.html
663                crypto/subtle/aes-ctr-generate-key-encrypt-decrypt.html
664                crypto/subtle/aes-ctr-generate-key.html
665                crypto/subtle/aes-ctr-import-jwk-key-length-128.html
666                crypto/subtle/aes-ctr-import-jwk-key-length-192.html
667                crypto/subtle/aes-ctr-import-jwk-key-length-256.html
668                crypto/subtle/aes-ctr-import-key-decrypt.html
669                crypto/subtle/aes-ctr-import-key-encrypt.html
670                crypto/subtle/aes-ctr-import-key-unwrap-jwk-key.html
671                crypto/subtle/aes-ctr-import-key-unwrap-raw-key.html
672                crypto/subtle/aes-ctr-import-key-wrap-jwk-key.html
673                crypto/subtle/aes-ctr-import-key-wrap-raw-key.html
674                crypto/subtle/aes-ctr-import-raw-key.html
675                crypto/workers/subtle/aes-ctr-import-key-decrypt.html
676                crypto/workers/subtle/aes-ctr-import-key-encrypt.html
677                crypto/workers/subtle/aes-ctr-import-key-unwrap-key.html
678                crypto/workers/subtle/aes-ctr-import-key-wrap-key.html
679
680         * CMakeLists.txt:
681         * DerivedSources.make:
682         * PlatformGTK.cmake:
683         * PlatformMac.cmake:
684         * WebCore.xcodeproj/project.pbxproj:
685         * bindings/js/JSSubtleCryptoCustom.cpp:
686         (WebCore::normalizeCryptoAlgorithmParameters):
687         * crypto/CryptoAlgorithmParameters.h:
688         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: Added.
689         (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CTR):
690         (WebCore::parametersAreValid):
691         (WebCore::CryptoAlgorithmAES_CTR::create):
692         (WebCore::CryptoAlgorithmAES_CTR::identifier):
693         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
694         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
695         (WebCore::CryptoAlgorithmAES_CTR::generateKey):
696         (WebCore::CryptoAlgorithmAES_CTR::importKey):
697         (WebCore::CryptoAlgorithmAES_CTR::exportKey):
698         (WebCore::CryptoAlgorithmAES_CTR::getKeyLength):
699         * crypto/algorithms/CryptoAlgorithmAES_CTR.h: Added.
700         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp: Added.
701         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
702         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
703         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp: Added.
704         (WebCore::bigIntegerToSize):
705         (WebCore::transformAES_CTR):
706         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
707         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
708         * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
709         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
710         * crypto/parameters/AesCtrParams.idl: Added.
711         * crypto/parameters/CryptoAlgorithmAesCtrParams.h: Added.
712
713 2017-04-06  Youenn Fablet  <youenn@apple.com>
714
715         WebRTC tests gardening
716         https://bugs.webkit.org/show_bug.cgi?id=170508
717
718         Reviewed by Eric Carlson.
719
720         * Configurations/FeatureDefines.xcconfig: Changing webrtc enabling for ios.
721
722 2017-04-06  Andreas Kling  <akling@apple.com>
723
724         Stop forcing CA commit when memory pressure changes.
725         https://bugs.webkit.org/show_bug.cgi?id=170522
726         <rdar://problem/31460236>
727
728         Reviewed by Antti Koivisto.
729
730         Don't force a CA commit when reaching critical memory pressure. We're already doing a ton
731         of work in response to the pressure, and this was really a hack to try to react quickly on
732         512 MB devices which we don't support anymore.
733
734         * page/MemoryRelease.cpp:
735         (WebCore::releaseCriticalMemory):
736
737 2017-04-06  Romain Bellessort  <romain.bellessort@crf.canon.fr>
738
739         [Readable Streams API] Implement ReadableStreamBYOBRequest respondWithNewView()
740         https://bugs.webkit.org/show_bug.cgi?id=170339
741
742         Reviewed by Youenn Fablet.
743
744         Implemented ReadableStreamBYOBRequest respondWithNewView().
745
746         Added new tests to check respondWithNewView() behaviour.
747
748         * Modules/streams/ReadableByteStreamInternals.js:
749         (readableByteStreamControllerRespondWithNewView): Added.
750         * Modules/streams/ReadableStreamBYOBRequest.js:
751         (respondWithNewView): Updated.
752
753 2017-04-06  Eric Carlson  <eric.carlson@apple.com>
754
755         [MediaStream] Host application should be able to mute and unmute media streams
756         https://bugs.webkit.org/show_bug.cgi?id=170519
757         <rdar://problem/31174326>
758
759         Unreviewed, fix crash introduced in r214980.
760
761         * Modules/mediastream/MediaStream.cpp:
762         (WebCore::MediaStream::MediaStream): NULL-check page.
763
764 2017-04-06  Dave Hyatt  <hyatt@apple.com>
765
766         Rendering flexbox children across columns
767         https://bugs.webkit.org/show_bug.cgi?id=164166
768         <rdar://problem/29055587>
769
770         Reviewed by Zalan Bujtas.
771
772         Added fast/multicol/flexbox-rows.html.
773
774         * rendering/RenderBlockFlow.cpp:
775         (WebCore::RenderBlockFlow::adjustForUnsplittableChild):
776         Treat block-level flexboxes that occur inside block flows the same as replaced
777         and unsplittable elements and push them to the next page if they don't fit. We don't
778         update the minimum page height though, since the flexbox is not really unsplittable.
779
780 2017-04-05  Simon Fraser  <simon.fraser@apple.com>
781
782         Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
783         https://bugs.webkit.org/show_bug.cgi?id=170479
784
785         Reviewed by Sam Weinig.
786
787         When interacting with a subframe document, set lastHandledUserGestureTimestamp on all ancestor
788         documents up to the root.
789
790         This will be used in future for requestAnimationFrame throttling.
791
792         Test: fast/frames/user-gesture-timestamp-propagation.html
793
794         * dom/Document.cpp:
795         (WebCore::Document::updateLastHandledUserGestureTimestamp):
796         * dom/Document.h:
797         * dom/UserGestureIndicator.cpp:
798         (WebCore::UserGestureIndicator::UserGestureIndicator):
799         * testing/Internals.cpp:
800         (WebCore::Internals::lastHandledUserGestureTimestamp):
801         * testing/Internals.h:
802         * testing/Internals.idl:
803
804 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
805
806         [MediaStream] Host application should be able to mute and unmute media streams
807         https://bugs.webkit.org/show_bug.cgi?id=170519
808         <rdar://problem/31174326>
809
810         Unreviewed, address review comments missed in the initial checkin.
811
812         * Modules/mediastream/MediaStream.cpp:
813         (WebCore::MediaStream::MediaStream): Mute the private stream if the page doesn't allow
814         capture.
815         (WebCore::MediaStream::pageMutedStateDidChange): setMuted -> setCaptureTracksMuted.
816
817         * platform/mediastream/MediaStreamPrivate.cpp:
818         (WebCore::MediaStreamPrivate::addTrack): Don't track muted state, the capture source already does.
819         (WebCore::MediaStreamPrivate::startProducingData):  Ditto.
820         (WebCore::MediaStreamPrivate::setCaptureTracksMuted): Renamed from setMuted.
821         (WebCore::MediaStreamPrivate::setMuted): Deleted.
822         * platform/mediastream/MediaStreamPrivate.h:
823
824 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
825
826         [MediaStream] Host application should be able to mute and unmute media streams
827         https://bugs.webkit.org/show_bug.cgi?id=170519
828         <rdar://problem/31174326>
829
830         Reviewed by Youenn Fablet.
831
832         No new tests, fast/mediastream/MediaStream-page-muted.html was updated.
833
834         * Modules/mediastream/MediaStream.cpp:
835         (WebCore::MediaStream::~MediaStream): Fix a typo.
836         (WebCore::MediaStream::pageMutedStateDidChange): Don't store muted state, let the private
837         stream store it.
838         (WebCore::MediaStream::mediaState): Deal with new muted state flags.
839         * Modules/mediastream/MediaStream.h:
840
841         * dom/Document.cpp:
842         (WebCore::Document::prepareForDestruction): Clear media state before the frame is cleared.
843
844         * page/MediaProducer.h: Add muted flags.
845
846         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
847         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): The display layer
848         should not be visible when the video track is muted.
849
850         * platform/mediastream/MediaStreamPrivate.cpp:
851         (WebCore::MediaStreamPrivate::addTrack): Mute the new track if necessary.
852         (WebCore::MediaStreamPrivate::startProducingData): Do nothing when muted.
853         (WebCore::MediaStreamPrivate::setExternallyMuted): New, mute/unmute tracks.
854         * platform/mediastream/MediaStreamPrivate.h:
855
856         * platform/mediastream/RealtimeMediaSource.cpp:
857         (WebCore::RealtimeMediaSource::setMuted): Start/stop producing data.
858
859         * testing/Internals.cpp:
860         (WebCore::Internals::pageMediaState): Support new media stream muted flags.
861
862 2017-04-05  Andreas Kling  <akling@apple.com>
863
864         Make inactive web processes behave as though under memory pressure.
865         https://bugs.webkit.org/show_bug.cgi?id=170042
866         <rdar://problem/31038445>
867
868         Reviewed by Antti Koivisto.
869
870         Prevent PerformanceMonitor from marking the process as inactive at startup.
871         This fixes the API test failure that caused this patch to get rolled out.
872
873         * page/PerformanceMonitor.h:
874
875 2017-04-05  Youenn Fablet  <youenn@apple.com>
876
877         Switch to kCVPixelFormatType_420YpCbCr8BiPlanarFullRange for Mac video capture format
878         https://bugs.webkit.org/show_bug.cgi?id=170509
879
880         Reviewed by Eric Carlson.
881
882         Covered by existing tests.
883
884         * platform/mediastream/mac/AVVideoCaptureSource.mm:
885
886 2017-04-05  Javier Fernandez  <jfernandez@igalia.com>
887
888         [css-align] Implement the place-items shorthand
889         https://bugs.webkit.org/show_bug.cgi?id=168847
890
891         Reviewed by David Hyatt.
892
893         The CSS Box Alignment specification defines a new shorthand to set the
894         Content Alignment properties (align-items and justify-items) at the
895         same time.
896
897         This patch provides the implementation of the CSS parsing logic and the
898         required regression tests. For the time being, as it happens with the
899         rest of the new alignment properties, the new parsing logic is
900         implemented behind the CSS Grid Layout runtime flag.
901
902         Test: css3/parse-place-items.html
903
904         * css/CSSComputedStyleDeclaration.cpp:
905         (WebCore::ComputedStyleExtractor::propertyValue):
906         * css/CSSProperties.json:
907         * css/StyleProperties.cpp:
908         (WebCore::StyleProperties::getPropertyValue):
909         (WebCore::StyleProperties::getAlignmentShorthandValue):
910         * css/StyleProperties.h:
911         * css/parser/CSSPropertyParser.cpp:
912         (WebCore::isAutoOrNormalOrStretch):
913         (WebCore::consumeSelfPositionOverflowPosition):
914         (WebCore::consumeSimplifiedItemPosition):
915         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand):
916         * css/parser/CSSPropertyParser.h:
917
918 2017-04-05  Ryan Haddad  <ryanhaddad@apple.com>
919
920         Unreviewed, rolling out r214932.
921
922         This change broke an internal build.
923
924         Reverted changeset:
925
926         "[ios-simulator] API test WebKit2.DataDetectionReferenceDate
927         timing out"
928         https://bugs.webkit.org/show_bug.cgi?id=161967
929         http://trac.webkit.org/changeset/214932
930
931 2017-04-05  Ryan Haddad  <ryanhaddad@apple.com>
932
933         Unreviewed, rolling out r214962.
934
935         Roll r214937 back in because it wasn't at fault for the build
936         breakage.
937
938         Reverted changeset:
939
940         "Unreviewed, rolling out r214937."
941         https://bugs.webkit.org/show_bug.cgi?id=170365
942         http://trac.webkit.org/changeset/214962
943
944 2017-04-05  Ryan Haddad  <ryanhaddad@apple.com>
945
946         Unreviewed, rolling out r214937.
947
948         This change broke an internal build.
949
950         Reverted changeset:
951
952         "REGRESSION (r202472): Data Detection overwrites existing
953         links in detected ranges"
954         https://bugs.webkit.org/show_bug.cgi?id=170365
955         http://trac.webkit.org/changeset/214937
956
957 2017-04-05  Carlos Alberto Lopez Perez  <clopez@igalia.com>
958
959         [WebRTC][OpenWebRTC] Add support for SDP BUNDLE ("a:group:BUNDLE" and "a=bundle-only" lines)
960         https://bugs.webkit.org/show_bug.cgi?id=170157
961
962         Reviewed by Alejandro G. Castro.
963
964         This implements support on the SDPProcessor for generating an "a=group:BUNDLE"
965         attribute with the MID identifiers specified in the bundle group in the most
966         recent answer.
967         It also implements support for generating "a=bundle-only" attributes on the
968         "m=" sections of the SDP according to the bundlePolicy defined.
969
970         Test: fast/mediastream/RTCPeerConnection-inspect-offer-bundlePolicy-bundle-only.html
971
972         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
973         (WebCore::MediaEndpointPeerConnection::createOfferTask):
974         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
975         * Modules/mediastream/SDPProcessor.cpp:
976         (WebCore::getBundlePolicyName):
977         (WebCore::configurationToJSON):
978         * Modules/mediastream/sdp.js:
979         (SDP.generate):
980         * platform/mediastream/MediaEndpointSessionConfiguration.h:
981         (WebCore::MediaEndpointSessionConfiguration::bundlePolicy):
982         (WebCore::MediaEndpointSessionConfiguration::setBundlePolicy):
983         (WebCore::MediaEndpointSessionConfiguration::clone):
984
985 2017-04-05  Jer Noble  <jer.noble@apple.com>
986
987         [MSE] Seeks to currentTime=0 will fail if currentTime is already 0.
988         https://bugs.webkit.org/show_bug.cgi?id=170510
989         <rdar://problem/30988403>
990
991         Reviewed by Eric Carlson.
992
993         Test: media/media-source/media-source-unnecessary-seek-seeked.html
994
995         The AVSampleBufferRenderSynchronizer won't fire a time jumped notification if no seek is actully
996         necessary. So short circuit the seek logic if the seek time is identical to the current synchronizer
997         time.
998
999         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1000         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
1001
1002 2017-04-05  Chris Dumez  <cdumez@apple.com>
1003
1004         <input type="range"> changing to disabled while active breaks all pointer events
1005         https://bugs.webkit.org/show_bug.cgi?id=170447
1006         <rdar://problem/31442875>
1007
1008         Reviewed by Geoffrey Garen.
1009
1010         When a range's slider is being moved, we set SliderThumbElement's m_inDragMode flag
1011         to true and mark the range elements as the CapturingMouseEventsElement. When we get
1012         the mouseUp event, we are supposed to exit drag mode. However, when the range element
1013         gets disabled while dragging, we do not get the mouseUp event and we need to make
1014         sure we exit dragging mode anyway. r112547 tried to fix this by calling stopDragging()
1015         in SliderThumbElement::defaultEventHandler() when the input element is disabled.
1016         While this often works, this is fragile and we sometimes fail to exit dragging mode
1017         when we should.
1018
1019         This patch addressed the issue by calling stopDragging() in
1020         SliderThumbElement::disabledAttributeChanged() instead. This is much safer as we
1021         guarantee will exit dragging mode whenever the range element gets disabled, even
1022         if SliderThumbElement::defaultEventHandler() does not get called after that.
1023
1024         Test: fast/forms/range/disabled-while-dragging.html
1025
1026         * html/RangeInputType.cpp:
1027         (WebCore::RangeInputType::disabledAttributeChanged):
1028         * html/RangeInputType.h:
1029         * html/shadow/SliderThumbElement.cpp:
1030         (WebCore::SliderThumbElement::defaultEventHandler):
1031         (WebCore::SliderThumbElement::disabledAttributeChanged):
1032         * html/shadow/SliderThumbElement.h:
1033
1034 2017-04-05  Eric Carlson  <eric.carlson@apple.com>
1035
1036         [MediaStream] Video doesn't render in fullscreen on iOS
1037         https://bugs.webkit.org/show_bug.cgi?id=170404
1038
1039         Reviewed by Youenn Fablet.
1040         
1041         No new tests, filed https://bugs.webkit.org/show_bug.cgi?id=170512.
1042
1043         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1044         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1045         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Include
1046         video fullscreen manager on iOS too.
1047         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix): Add paramater
1048         to force transform recalculation.
1049         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Restructure code since
1050         the display layer resize happens elsewhere.
1051         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Include video fullscreen
1052         manager on iOS too.
1053         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers): Ditto.
1054         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer): Ditto.
1055         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): Ditto.
1056         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayerBoundsChanged): Change the
1057         display layer size and position immediately instead of waiting for the next sample buffer
1058         so the display is correct when fullscreen mode changes when paused.
1059
1060 2017-04-05  Youenn Fablet  <youenn@apple.com>
1061
1062         Deprecate and remove URL.createObjectURL(mediastream)
1063         https://bugs.webkit.org/show_bug.cgi?id=167518
1064         <rdar://problem/31149607>
1065
1066         Reviewed by Eric Carlson.
1067
1068         Covered by updated tests.
1069
1070         * CMakeLists.txt:
1071         * DerivedSources.cpp:
1072         * DerivedSources.make:
1073         * Modules/mediastream/DOMURLMediaStream.cpp: Removed.
1074         * Modules/mediastream/DOMURLMediaStream.h: Removed.
1075         * Modules/mediastream/DOMURLMediaStream.idl: Removed.
1076         * WebCore.xcodeproj/project.pbxproj:
1077         * html/DOMURL.idl:
1078
1079 2017-04-05  Alejandro G. Castro  <alex@igalia.com>
1080
1081         [Webrtc] Mock realtime sources factories should be static after r213941
1082         https://bugs.webkit.org/show_bug.cgi?id=170282
1083
1084         Reviewed by Alex Christensen.
1085
1086         If we don't make the variables static we would be returning a
1087         local variable.
1088
1089         * platform/mock/MockRealtimeAudioSource.cpp:
1090         (WebCore::MockRealtimeAudioSource::factory):
1091         * platform/mock/MockRealtimeVideoSource.cpp:
1092         (WebCore::MockRealtimeVideoSource::factory):
1093
1094 2017-04-05  Alex Christensen  <achristensen@webkit.org>
1095
1096         Fix CMake build.
1097
1098         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1099         Some JavaScript inline functions were not being accessed from this file with different enable flags.
1100         * platform/spi/cf/CFNetworkSPI.h:
1101         * platform/spi/cocoa/NSURLConnectionSPI.h:
1102         Moved NSURLSession-specific SPI from NSURLConnectionSPI.h to CFNetworkSPI.h.
1103
1104 2017-04-05  Chris Dumez  <cdumez@apple.com>
1105
1106         _blank / _self / _parent / _top browsing context names should be case-insensitive
1107         https://bugs.webkit.org/show_bug.cgi?id=169747
1108
1109         Reviewed by Alex Christensen.
1110
1111         _blank / _self / _parent / _top browsing context names should be case-insensitive
1112         as per the HTML specification:
1113         - https://html.spec.whatwg.org/#browsing-context-names
1114
1115         This aligns our behavior with Firefox as well. See discussion at:
1116         - https://github.com/whatwg/html/issues/2443
1117
1118         Tests: imported/w3c/web-platform-tests/html/browsers/windows/browsing-context-names/browsing-context-_blank.html
1119                imported/w3c/web-platform-tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent-001.html
1120                imported/w3c/web-platform-tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent-002.html
1121                imported/w3c/web-platform-tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent-003.html
1122                imported/w3c/web-platform-tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent-004.html
1123
1124         * loader/FrameLoader.cpp:
1125         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
1126         (WebCore::createWindow):
1127         * page/DOMWindow.cpp:
1128         (WebCore::DOMWindow::open):
1129         * page/FrameTree.cpp:
1130         (WebCore::FrameTree::uniqueChildName):
1131         (WebCore::FrameTree::find):
1132
1133 2017-04-05  Miguel Gomez  <magomez@igalia.com>
1134
1135         [GTK+] PNG animations that should run once are not played at all
1136         https://bugs.webkit.org/show_bug.cgi?id=170499
1137
1138         Reviewed by Carlos Garcia Campos.
1139
1140         The repetition count reported bu the PNGImageDecoder is wrong. It's returning m_playCount - 1, which
1141         means 0 for the animations that need to be played once. Change it to return an appropriate value.
1142
1143         Covered by existent tests.
1144
1145         * platform/image-decoders/png/PNGImageDecoder.cpp:
1146         (WebCore::PNGImageDecoder::repetitionCount):
1147         * platform/image-decoders/png/PNGImageDecoder.h:
1148
1149 2017-04-05  Andy Estes  <aestes@apple.com>
1150
1151         REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
1152         https://bugs.webkit.org/show_bug.cgi?id=170365
1153         <rdar://problem/29205721>
1154
1155         Reviewed by Tim Horton.
1156
1157         r202472 changed the node traversal in searchForLinkRemovingExistingDDLinks() to only
1158         consider nodes that are descendants of startNode, but we need to traverse all nodes between
1159         startNode and endNode to find existing non-DD links.
1160
1161         As a result, we'd add a Data Detector link to the following snippet and make the original
1162         links un-clickable:
1163
1164             <a href='#'>tomorrow</a> <a href='#'>night</a>
1165
1166         Fix this by not specifying a stayWithin node when calling NodeTraversal::next(). The loop
1167         will terminate when we reach endNode.
1168
1169         Updated WebKit2.DataDetectionReferenceDate API test.
1170
1171         * editing/cocoa/DataDetection.mm:
1172         (WebCore::searchForLinkRemovingExistingDDLinks):
1173
1174 2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1175
1176         Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
1177         https://bugs.webkit.org/show_bug.cgi?id=156974
1178
1179         Reviewed by Sam Weinig.
1180
1181         Remove ErrorsGtk.
1182
1183         * PlatformGTK.cmake:
1184         * platform/gtk/ErrorsGtk.cpp: Removed.
1185         * platform/gtk/ErrorsGtk.h: Removed.
1186
1187 2017-04-05  Andy Estes  <aestes@apple.com>
1188
1189         [ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
1190         https://bugs.webkit.org/show_bug.cgi?id=161967
1191
1192         Reviewed by Alexey Proskuryakov.
1193
1194         DataDetectorsCoreSPI.h defined DDQueryOffset as a struct of two CFIndexes, which is 16 bytes
1195         on LP64, but the struct is actually defined as two CFIndex-typed 32-bit bitfields, which is
1196         8 bytes on LP64. This breaks the ABI on Public SDK builds when calling functions that take
1197         or return DDQueryOffsets.
1198
1199         * platform/spi/cocoa/DataDetectorsCoreSPI.h: Updated the DDQueryOffset definition for
1200         Public SDK builds, and added a static_assert to detect future size changes at compile time.
1201
1202 2017-04-04  Jer Noble  <jer.noble@apple.com>
1203
1204         Move AVSampleBufferDisplayLayer declarations into AVFoundationSPI.h
1205         https://bugs.webkit.org/show_bug.cgi?id=170471
1206
1207         Reviewed by Eric Carlson.
1208
1209         Move the declaration of AVSampleBufferDisplayLayer (and related classes) into AVFoundationSPI.
1210
1211         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1212         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1213         * platform/spi/mac/AVFoundationSPI.h:
1214
1215 2017-04-04  Youenn Fablet  <youenn@apple.com>
1216
1217         Canvas is tainted when painting a video with MediaStreamTrack
1218         https://bugs.webkit.org/show_bug.cgi?id=170486
1219
1220         Reviewed by Eric Carlson.
1221
1222         Test: http/tests/media/media-stream/getusermedia-with-canvas.html
1223
1224         Adding the notion of isolated source so that we can later on implement WebRTC isolated tracks.
1225         For now, canvas will not be tainted if painted from a MediaStreamTrack.
1226
1227         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1228         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1229         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::didPassCORSAccessCheck):
1230         * platform/mediastream/MediaStreamTrackPrivate.h:
1231         (WebCore::MediaStreamTrackPrivate::isIsolated):
1232         * platform/mediastream/RealtimeMediaSource.h:
1233
1234 2017-04-04  Commit Queue  <commit-queue@webkit.org>
1235
1236         Unreviewed, rolling out r214894, r214895, r214907, r214912,
1237         and r214918.
1238         https://bugs.webkit.org/show_bug.cgi?id=170491
1239
1240         Caused build failures on Mac (Requested by rniwa on #webkit).
1241
1242         Reverted changesets:
1243
1244         "Build fix."
1245         http://trac.webkit.org/changeset/214894
1246
1247         "Rolling back the build fix, as it broke other builds."
1248         http://trac.webkit.org/changeset/214895
1249
1250         "Move AVSampleBufferDisplayLayer declarations into
1251         AVFoundationSPI.h"
1252         https://bugs.webkit.org/show_bug.cgi?id=170471
1253         http://trac.webkit.org/changeset/214907
1254
1255         "Unreviewed build fix: fix compilation error on Sierra."
1256         http://trac.webkit.org/changeset/214912
1257
1258         "More build fixing."
1259         http://trac.webkit.org/changeset/214918
1260
1261 2017-04-04  Youenn Fablet  <youenn@apple.com>
1262
1263         [Mac] Add back web audio support for getUserMedia MediaStreamTrack
1264         https://bugs.webkit.org/show_bug.cgi?id=170482
1265
1266         Reviewed by Eric Carlson.
1267
1268         ´Covered by reenabled test.
1269
1270         Exporting method and class used in WebKit2.
1271
1272         * WebCore.xcodeproj/project.pbxproj:
1273         * platform/audio/mac/CAAudioStreamDescription.h:
1274         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
1275
1276 2017-04-04  Alexey Proskuryakov  <ap@apple.com>
1277
1278         More build fixing.
1279
1280         * platform/spi/mac/AVFoundationSPI.h:
1281
1282 2017-04-04  Simon Fraser  <simon.fraser@apple.com>
1283
1284         Do some minor FEColorMatrix code cleanup and optimization
1285         https://bugs.webkit.org/show_bug.cgi?id=170474
1286
1287         Reviewed by Dean Jackson.
1288
1289         Don't switch inside of a pixel processing loop; repeat the loop inside switch (filterType).
1290         
1291         Change matrix() and saturateAndHueRotate() to dereference the source pixels once, instead
1292         of multiple times, which is faster.
1293         
1294         This kind of code benefits from aligning things with spaces for readability, so do so,
1295         violating webkit style.
1296         
1297         Add some off-by-default performance logging code.
1298
1299         Increases pixel processing performance from about 86ms per megapixel to 65ms per megapixel.
1300
1301         * platform/graphics/filters/FEColorMatrix.cpp:
1302         (WebCore::matrix):
1303         (WebCore::saturateAndHueRotate):
1304         (WebCore::effectType):
1305         (WebCore::FEColorMatrix::platformApplySoftware):
1306
1307 2017-04-04  Brent Fulgham  <bfulgham@apple.com>
1308
1309         Do not assert when CharacterData representing an Attr fires events
1310         https://bugs.webkit.org/show_bug.cgi?id=170454
1311         <rdar://problem/30979320>
1312
1313         Reviewed by Ryosuke Niwa.
1314
1315         Make the NoEventDispatchAssertion in CharacterData::notifyParentAfterChange conditional
1316         since Attr elements should be allowed to fire events.
1317
1318         Tests: fast/dom/no-assert-for-malformed-js-url-attribute.html
1319
1320         * dom/CharacterData.cpp:
1321         (WebCore::CharacterData::notifyParentAfterChange):
1322
1323 2017-04-04  Youenn Fablet  <youenn@apple.com>
1324
1325         LayoutTest webrtc/libwebrtc/descriptionGetters.html is a flaky failure
1326         https://bugs.webkit.org/show_bug.cgi?id=169481
1327
1328         Reviewed by Eric Carlson.
1329
1330         No need to enumerate all network interfaces in most layout tests.
1331         Adding an Internals API for that in case we want to use TCP localhost candidates.
1332
1333         * testing/Internals.cpp:
1334         (WebCore::Internals::Internals):
1335         (WebCore::Internals::setEnumeratingAllNetworkInterfacesEnabled):
1336         * testing/Internals.h:
1337         * testing/Internals.idl:
1338
1339
1340 2017-04-04  Jer Noble  <jer.noble@apple.com>
1341
1342         Unreviewed build fix: fix compilation error on Sierra.
1343
1344         * platform/spi/mac/AVFoundationSPI.h:
1345
1346 2017-04-04  Jer Noble  <jer.noble@apple.com>
1347
1348         Move AVSampleBufferDisplayLayer declarations into AVFoundationSPI.h
1349         https://bugs.webkit.org/show_bug.cgi?id=170471
1350
1351         Reviewed by Eric Carlson.
1352
1353         Move the declaration of AVSampleBufferDisplayLayer (and related classes) into AVFoundationSPI.
1354
1355         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1356         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Deleted.
1357         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer): Deleted.
1358         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1359         * platform/spi/mac/AVFoundationSPI.h:
1360
1361 2017-04-04  Saam Barati  <sbarati@apple.com>
1362
1363         WebAssembly: JSWebAssemblyCallee should not be a JSCell
1364         https://bugs.webkit.org/show_bug.cgi?id=170135
1365
1366         Reviewed by Michael Saboff.
1367
1368         * bindings/js/JSDOMWindowBase.cpp:
1369         (WebCore::callerDOMWindow):
1370
1371 2017-04-04  Simon Fraser  <simon.fraser@apple.com>
1372
1373         Change Document's lastHandledUserGestureTimestamp to be a MonotonicTime
1374         https://bugs.webkit.org/show_bug.cgi?id=170468
1375
1376         Reviewed by Zalan Bujtas.
1377         
1378         Change the double to MonotonicTime. No behavior change.
1379
1380         * dom/Document.cpp:
1381         (WebCore::Document::updateLastHandledUserGestureTimestamp):
1382         * dom/Document.h:
1383         (WebCore::Document::lastHandledUserGestureTimestamp):
1384         * html/HTMLPlugInImageElement.cpp:
1385         (WebCore::documentHadRecentUserGesture):
1386         * loader/FrameLoader.cpp:
1387         (WebCore::shouldAskForNavigationConfirmation):
1388
1389 2017-04-04  Youenn Fablet  <youenn@apple.com>
1390
1391         [Debug] ASSERT(!throwScope.exception()) on imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
1392         https://bugs.webkit.org/show_bug.cgi?id=170395
1393         <rdar://problem/31394017>
1394
1395         Reviewed by Mark Lam.
1396
1397         No change of behavior.
1398
1399         * bindings/js/JSDOMPromise.cpp:
1400         (WebCore::DeferredPromise::reject): Adding early ASSERT that creating an exception is happening correctly.
1401
1402 2017-04-04  Alexey Proskuryakov  <ap@apple.com>
1403
1404         Rolling back the build fix, as it broke other builds.
1405
1406         * platform/spi/mac/AVFoundationSPI.h:
1407
1408 2017-04-04  Alexey Proskuryakov  <ap@apple.com>
1409
1410         Build fix.
1411
1412         Rubber-stamped by Jer Noble.
1413
1414         * platform/spi/mac/AVFoundationSPI.h:
1415
1416 2017-04-04  Tim Horton  <timothy_horton@apple.com>
1417
1418         [Mac] -[WKWebView findMatchesForString:relativeToMatch:findOptions:maxResults:resultCollector:] invokes the resultCollector with didWrap = NO even when it wraps
1419         https://bugs.webkit.org/show_bug.cgi?id=165801
1420         <rdar://problem/29649535>
1421
1422         Reviewed by Wenson Hsieh.
1423
1424         New API tests: WebKit2.FindInPageWrapping*
1425
1426         * page/FrameTree.cpp:
1427         (WebCore::FrameTree::traverseNextWithWrap):
1428         (WebCore::FrameTree::traversePreviousWithWrap):
1429         (WebCore::FrameTree::traverseNextInPostOrderWithWrap):
1430         * page/FrameTree.h:
1431         Add CanWrap and DidWrap boolean enums, and add an optional out argument
1432         to traverse*WithWrap indicating whether a wrap actually occurred.
1433
1434         * history/CachedPage.cpp:
1435         (WebCore::firePageShowAndPopStateEvents):
1436         * history/PageCache.cpp:
1437         (WebCore::destroyRenderTree):
1438         Adjust to the new CanWrap enum.
1439         
1440         * page/Page.cpp:
1441         (WebCore::incrementFrame):
1442         (WebCore::Page::findString):
1443         (WebCore::Page::findStringMatchingRanges):
1444         (WebCore::Page::rangeOfString):
1445         (WebCore::Page::findMatchesForText):
1446         (WebCore::Page::unmarkAllTextMatches):
1447         * page/Page.h:
1448         Adjust to the new CanWrap enum, and optionally plumb DidWrap through
1449         to callers of findString().
1450
1451 2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1452
1453         [GTK] PLATFORM(GTK) && !USE(COORDINATED_GRAPHICS_THREADED) is no longer possible
1454         https://bugs.webkit.org/show_bug.cgi?id=170458
1455
1456         Reviewed by Carlos Alberto Lopez Perez.
1457
1458         That is not supported anymore, so we can remove dead code from VideoSinkGStreamer.cpp
1459
1460         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
1461         (VideoRenderRequestScheduler::VideoRenderRequestScheduler):
1462
1463 2017-04-04  Per Arne Vollan  <pvollan@apple.com>
1464
1465         Unreviewed Windows build fix.
1466
1467         * bindings/js/JSDOMGuardedObject.h:
1468
1469 2017-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1470
1471         Data interaction should register type identifiers in order of priority
1472         https://bugs.webkit.org/show_bug.cgi?id=170428
1473         <rdar://problem/30633296>
1474
1475         Reviewed by Tim Horton.
1476
1477         Currently, due to the shared logic for writing to a UIPasteboard (in the case of copy/paste) and the shared
1478         UIItemProvider-based pasteboard wrapper (in the case of data interaction), we don't enforce any particular
1479         ordering in which type identifiers are registered in the generated item provider. This is because
1480         -[UIPasteboard setItems:] only takes an unordered mapping of type identifiers to objects.
1481
1482         To fix this, we introduce a separate way to set pasteboard data that first writes a list of object
1483         representations in order of priority (which is dependent on the content being interacted with) and then register
1484         individual type-data mappings at the end.
1485
1486         Augmented existing API tests in DataInteractionTests to check for the existence and priority of type identifiers
1487         in the UIItemProviders created upon starting data interaction. Also adds a new unit test:
1488         DataInteractionTests.TextAreaToInput.
1489
1490         * WebCore.xcodeproj/project.pbxproj:
1491         * editing/cocoa/EditorCocoa.mm:
1492         (WebCore::archivedDataForAttributedString):
1493         (WebCore::Editor::writeSelectionToPasteboard):
1494         (WebCore::Editor::writeSelection):
1495         * platform/Pasteboard.h:
1496         * platform/PasteboardWriterData.h:
1497         * platform/PlatformPasteboard.h:
1498         * platform/ios/AbstractPasteboard.h:
1499         * platform/ios/AbstractPasteboard.mm: Copied from Source/WebCore/platform/ios/AbstractPasteboard.h.
1500
1501         Introduce WebPasteboardItemData, a wrapper around a list of objects representating the pasteboard data in order
1502         of priority, and a dictionary containing additional NSData blobs that contain data useful for private clients.
1503
1504         (+[WebPasteboardItemData itemWithRepresentingObjects:additionalData:]):
1505         (-[WebPasteboardItemData initWithRepresentingObjects:additionalData:]):
1506         (-[WebPasteboardItemData representingObjects]):
1507         (-[WebPasteboardItemData additionalData]):
1508         * platform/ios/PlatformPasteboardIOS.mm:
1509         (WebCore::richTextRepresentationsForPasteboardWebContent):
1510         (WebCore::PlatformPasteboard::writeObjectRepresentations):
1511         (WebCore::PlatformPasteboard::write):
1512
1513         Tweaked to check whether the pasteboard responds to -setItemsFromObjectRepresentations:. If so, uses the
1514         PlatformPasteboard::writeObjectRepresentations codepath to write data to the pasteboard, respecting type
1515         priority.
1516
1517         * platform/ios/WebItemProviderPasteboard.mm:
1518         (-[WebItemProviderPasteboard pasteboardTypes]):
1519         (-[WebItemProviderPasteboard setItemProviders:]):
1520         (-[WebItemProviderPasteboard setItemsFromObjectRepresentations:]):
1521
1522         Replaces -setItems: with -setItemsFromObjectRepresentations:, which respects the priority of each object
1523         representation of the data in the pasteboard.
1524
1525         (-[WebItemProviderPasteboard setItems:]): Deleted.
1526
1527 2017-04-03  Javier Fernandez  <jfernandez@igalia.com>
1528
1529         [css-align] Adapt place-content alignment shorthand to the new baseline syntax
1530         https://bugs.webkit.org/show_bug.cgi?id=170340
1531
1532         Reviewed by David Hyatt.
1533
1534         Now that the align-content and justify-content CSS properties are
1535         adapted to the new baseline-position CSS values syntax we can adapt the
1536         shorthand that controls such properties to the new syntax as well.
1537
1538         No new tests, just adding some additional cases to the tests we already have.
1539
1540         * css/StyleProperties.cpp:
1541         (WebCore::StyleProperties::getPropertyValue):
1542         (WebCore::StyleProperties::placeContentPropertyValue):
1543         * css/StyleProperties.h:
1544         * css/parser/CSSPropertyParser.cpp:
1545         (WebCore::isContentDistributionKeyword):
1546         (WebCore::isContentPositionKeyword):
1547         (WebCore::isOverflowKeyword):
1548         (WebCore::getBaselineKeyword):
1549         (WebCore::consumeContentDistributionOverflowPosition):
1550         (WebCore::consumeSimplifiedContentPosition):
1551
1552 2017-04-03  Nan Wang  <n_wang@apple.com>
1553
1554         AX: Expose link children when doing search predication on iOS
1555         https://bugs.webkit.org/show_bug.cgi?id=170424
1556         <rdar://problem/31413335>
1557
1558         The children of links are accessible elements on iOS instead of the link itself, 
1559         so we should expose the children when doing predicated searches as well.
1560
1561         Reviewed by Chris Fleizach.
1562
1563         Test: accessibility/ios-simulator/ios-search-predicate-link-children.html
1564
1565         * accessibility/AccessibilityObject.cpp:
1566         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
1567
1568 2017-04-03  Jer Noble  <jer.noble@apple.com>
1569
1570         No audio output for MediaStream-backed audio elements on iOS
1571         https://bugs.webkit.org/show_bug.cgi?id=170427
1572
1573         Reviewed by Eric Carlson.
1574
1575         The logic for setting the output timestamp offset in AudioSampleDataSource was reversed; instead of
1576         subtracting out the timestamp of the first pull request, it effectively doubled it.
1577
1578         * platform/audio/mac/AudioSampleDataSource.mm:
1579         (WebCore::AudioSampleDataSource::pullSamplesInternal):
1580
1581 2017-04-03  Dave Hyatt  <hyatt@apple.com>
1582
1583         Japanese fonts in vertical text should support synthesized italics
1584         https://bugs.webkit.org/show_bug.cgi?id=169301
1585
1586         Reviewed by Simon Fraser.
1587
1588         Updated test in fast/text/international.
1589
1590         * platform/graphics/Font.cpp:
1591         (WebCore::Font::nonSyntheticItalicFont): Deleted.
1592         * platform/graphics/Font.h:
1593         Removed the non-synthetic italic font member, since it's not used.
1594
1595         * platform/graphics/FontCascadeFonts.cpp:
1596         (WebCore::glyphDataForNonCJKCharacterWithGlyphOrientation):
1597         Patched to ensure that a text-orientation-fallback font data is always
1598         returned in the synthetic oblique case, so that non-CJK and CJK are
1599         guaranteed to be broken up so that their slants can be applied differently.
1600
1601         (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
1602         (WebCore::FontCascadeFonts::glyphDataForNormalVariant):
1603         (WebCore::glyphDataForCJKCharacterWithoutSyntheticItalic): Deleted.
1604         Patched to no longer turn off synthetic oblique for CJK.
1605
1606         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1607         (WebCore::FontCascade::drawGlyphs):
1608         Apply the correct italic transform to CJK when in vertical text.
1609
1610 2017-04-03  Chris Dumez  <cdumez@apple.com>
1611
1612         REGRESSION (r206744): CSS background-image in style attribute ignored when using createHTMLDocument method of DOM parsing
1613         https://bugs.webkit.org/show_bug.cgi?id=170285
1614         <rdar://problem/31378543>
1615
1616         Reviewed by Andy Estes.
1617
1618         r206744 caused up to stop trying to resolve relative URLs when trying to load an image
1619         referred to by CSS. We already try to resolve the relative URL when parsing the CSS
1620         property so this will usually work fine. However, in the case when the CSS property
1621         is parsed in detached document and then moved to another document, we will not have
1622         the complete URL.
1623
1624         Test: fast/images/background-image-relative-url-changes-document.html
1625
1626         * css/CSSImageValue.cpp:
1627         (WebCore::CSSImageValue::loadImage):
1628
1629 2017-04-03  Jeremy Jones  <jeremyj@apple.com>
1630
1631         Do not set WebAVPlayerLayerView background to black in fullscreen.
1632         https://bugs.webkit.org/show_bug.cgi?id=170132
1633         rdar://problem/30839278
1634
1635         Reviewed by Tim Horton.
1636
1637         No new tests because no behavior change.
1638
1639         The black background on WebAVPlayerLayerView interferes with the fullscreen animation
1640         and has been removed.
1641
1642         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1643         (WebVideoFullscreenInterfaceAVKit::enterFullscreen):
1644         (WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard):
1645
1646 2017-04-03  Antti Koivisto  <antti@apple.com>
1647
1648         REGRESSION (r207669): FileMaker Pro Help pages do not render correctly
1649         https://bugs.webkit.org/show_bug.cgi?id=170402
1650         <rdar://problem/31004344>
1651
1652         Reviewed by Simon Fraser.
1653
1654         If a new stylesheet load is started from the load event the document.styleSheets does not
1655         always reflect the already loaded stylesheets.
1656
1657         Test: fast/css/document-stylesheets-dynamic.html
1658
1659         * style/StyleScope.cpp:
1660         (WebCore::Style::Scope::updateActiveStyleSheets):
1661
1662             Remove an old optimization where we would not update active stylesheets if there were pending
1663             (head) stylesheet loads and they had not been updated already.
1664             This is probably not a valuable optimization anymore with the new lazy stylesheet update strategy.
1665
1666         * style/StyleScope.h:
1667
1668 2017-04-03  Anders Carlsson  <andersca@apple.com>
1669
1670         Tweak ApplePaySession API
1671         https://bugs.webkit.org/show_bug.cgi?id=170409
1672         rdar://problem/31405459
1673
1674         Reviewed by Tim Horton.
1675
1676         Rename "address" to "addressLines". Add "postalAddress". Reorder the ApplePayError constructor parameters.
1677
1678         * Modules/applepay/ApplePayError.cpp:
1679         (WebCore::ApplePayError::create):
1680         (WebCore::ApplePayError::ApplePayError):
1681         * Modules/applepay/ApplePayError.h:
1682         * Modules/applepay/ApplePayError.idl:
1683         * Modules/applepay/PaymentRequest.h:
1684
1685 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
1686
1687         [GCrypt] Implement CryptoKeyEC::keySizeInBits(), ::platformGeneratePair()
1688         https://bugs.webkit.org/show_bug.cgi?id=170345
1689
1690         Reviewed by Michael Catanzaro.
1691
1692         Start implementing the libgcrypt-based platform bits of CryptoKeyEC.
1693
1694         Implement keySizeInBits() by returning the appropriate size for this
1695         object's curve type. An assertion is added to ensure that this size
1696         matches the one that's returned by gcry_pk_get_nbits() for this
1697         object's EC key as represented by the m_platformKey gcry_sexp_t object.
1698
1699         Implement platformGeneratePair() by constructing a genkey s-expression
1700         that requests a generation of an EC key for the specified curve type.
1701         The s-expression is then passed to gcry_pk_genkey(), and the public
1702         and private key data is then retrieved from the returned s-expression
1703         upon success and used to create the public and private CryptoKeyEC
1704         objects.
1705
1706         The PlatformECKey type alias is changed to match gcry_sexp_t. The
1707         CryptoKeyEC destructor releases the gcry_sexp_t object through
1708         a PAL::GCrypt::HandleDeleter<gcry_sexp_t> instance.
1709
1710         The method definitions in the CryptoKeyECGCrypt.cpp file are also
1711         sorted to match the declaration order in the header.
1712
1713         No new tests -- current ones cover this sufficiently, but are not yet
1714         enabled due to other missing platform-specific SUBTLE_CRYPTO
1715         implementations.
1716
1717         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1718         (WebCore::curveSize):
1719         (WebCore::curveName):
1720         (WebCore::CryptoKeyEC::~CryptoKeyEC):
1721         (WebCore::CryptoKeyEC::keySizeInBits):
1722         (WebCore::CryptoKeyEC::platformGeneratePair):
1723         (WebCore::CryptoKeyEC::platformImportSpki):
1724         (WebCore::CryptoKeyEC::platformImportPkcs8):
1725         (WebCore::CryptoKeyEC::platformExportRaw):
1726         (WebCore::CryptoKeyEC::platformAddFieldElements):
1727         (WebCore::CryptoKeyEC::platformExportSpki):
1728         * crypto/keys/CryptoKeyEC.h:
1729
1730 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
1731
1732         [GCrypt] Implement AES_KW support
1733         https://bugs.webkit.org/show_bug.cgi?id=170274
1734
1735         Reviewed by Michael Catanzaro.
1736
1737         Implement the CryptoAlgorithmAES_KW::platform{Wrap,Unwrap}Key()
1738         functionality for configurations that use libgcrypt. This is done
1739         by leveraging the gcry_cipher_* APIs for the AES algorithm that's
1740         deducted appropriately from the key size and the AESWRAP cipher mode.
1741
1742         No new tests -- current ones cover this sufficiently, but are not yet
1743         enabled due to other missing platform-specific SUBTLE_CRYPTO
1744         implementations.
1745
1746         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
1747         (WebCore::gcryptWrapKey):
1748         (WebCore::gcryptUnwrapKey):
1749         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
1750         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
1751
1752 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
1753
1754         [GCrypt] Implement AES_GCM support
1755         https://bugs.webkit.org/show_bug.cgi?id=170271
1756
1757         Reviewed by Michael Catanzaro.
1758
1759         Implement the CryptoAlgorithmAES_GCM::platform{Encrypt,Decrypt}
1760         functionality for configurations that use libgcrypt. This is done
1761         by leveraging the gcry_cipher_* APIs for the AES algorithm that's
1762         deducted appropriately from the key size and the GCM cipher mode.
1763
1764         No new tests -- current ones cover this sufficiently, but are not yet
1765         enabled due to other missing platform-specific SUBTLE_CRYPTO
1766         implementations.
1767
1768         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
1769         (WebCore::gcryptEncrypt):
1770         (WebCore::gcryptDecrypt):
1771         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
1772         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
1773
1774 2017-04-03  Zan Dobersek  <zdobersek@igalia.com>
1775
1776         [GCrypt] Implement PBKDF2 support
1777         https://bugs.webkit.org/show_bug.cgi?id=170270
1778
1779         Reviewed by Michael Catanzaro.
1780
1781         Implement the CryptoAlgorithmPBKDF2::platformDeriveBits() functionality
1782         for configurations that use libgcrypt. This is done by leveraging the
1783         gcry_kdf_derive() API, using GCRY_KDF_PBKDF2 as the preferred KDF
1784         along with the properly deducted SHA algorithm.
1785
1786         No new tests -- current ones cover this sufficiently, but are not yet
1787         enabled due to other missing platform-specific SUBTLE_CRYPTO
1788         implementations.
1789
1790         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
1791         (WebCore::gcryptDeriveBits):
1792         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
1793
1794 2017-04-01  Simon Fraser  <simon.fraser@apple.com>
1795
1796         Clean up touch event handler registration when moving nodes between documents
1797         https://bugs.webkit.org/show_bug.cgi?id=170384
1798         rdar://problem/30816694
1799
1800         Reviewed by Chris Dumez.
1801
1802         Make sure that Node::didMoveToNewDocument() does the correct unregistration on the
1803         old document, and registration on the new document for nodes with touch event listeners,
1804         and gesture event listeners. Touch "handler" nodes (those for overflow and sliders) are
1805         already correctly moved via renderer-related teardown.
1806
1807         Add assertions that fire when removal was not complete.
1808
1809         Use references in more places.
1810
1811         Tests: fast/events/touch/ios/gesture-node-move-between-documents.html
1812                fast/events/touch/ios/overflow-node-move-between-documents.html
1813                fast/events/touch/ios/slider-node-move-between-documents.html
1814                fast/events/touch/ios/touch-node-move-between-documents.html
1815
1816         * dom/EventNames.h:
1817         (WebCore::EventNames::gestureEventNames):
1818         * dom/Node.cpp:
1819         (WebCore::Node::willBeDeletedFrom):
1820         (WebCore::Node::didMoveToNewDocument):
1821         (WebCore::tryAddEventListener):
1822         (WebCore::tryRemoveEventListener):
1823         * html/shadow/SliderThumbElement.cpp:
1824         (WebCore::SliderThumbElement::registerForTouchEvents):
1825         (WebCore::SliderThumbElement::unregisterForTouchEvents):
1826         * rendering/RenderLayer.cpp:
1827         (WebCore::RenderLayer::registerAsTouchEventListenerForScrolling):
1828         (WebCore::RenderLayer::unregisterAsTouchEventListenerForScrolling):
1829
1830 2017-04-03  Youenn Fablet  <youenn@apple.com>
1831
1832         captureStream is getting black frames with webgl canvas
1833         https://bugs.webkit.org/show_bug.cgi?id=170325
1834
1835         Reviewed by Dean Jackson.
1836
1837         Test: fast/mediastream/captureStream/canvas3d.html
1838
1839         Changing the webgl context to save buffers in case the canvas is captured.
1840         Adding a canvas changed notification in case of clear.
1841         In the future, we might want to change this notification and do it when endPaint or similar is called.
1842
1843         Adding an Internals API to grab the RGBA equivalent of the next track frame.
1844         For that purpose, adding a bunch of WEBCORE_EXPORT.
1845
1846         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1847         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source): Adding constraints support so that track settings
1848         getter actually transmits the width and height of the source.
1849         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): ensuring webgl canvas context keep their drawing buffer.
1850         * Modules/mediastream/MediaStreamTrack.h:
1851         * bindings/js/JSDOMGuardedObject.h:
1852         * bindings/js/JSDOMPromise.h:
1853         (WebCore::DeferredPromise::resolve):
1854         (WebCore::DeferredPromise::reject):
1855         * dom/ActiveDOMCallback.h:
1856         * html/HTMLCanvasElement.cpp:
1857         (WebCore::HTMLCanvasElement::captureStream):
1858         * html/ImageData.h:
1859         * html/ImageData.idl:
1860         * html/canvas/WebGLRenderingContext.cpp:
1861         (WebCore::WebGLRenderingContext::clear): ensuring canvas observers get notified in case of clear calls.
1862         * html/canvas/WebGLRenderingContextBase.h:
1863         (WebCore::WebGLRenderingContextBase::preserveDrawingBuffer): Added to allow canvas capture to update this property.
1864         * platform/MediaSample.h:
1865         (WebCore::MediaSample::getRGBAImageData): Added for internals API.
1866         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1867         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1868         (WebCore::MediaSampleAVFObjC::getRGBAImageData):
1869         * platform/graphics/cv/PixelBufferConformerCV.cpp:
1870         (WebCore::PixelBufferConformerCV::convert): Helper routine for getRGBAImageData.
1871         * platform/graphics/cv/PixelBufferConformerCV.h:
1872         * platform/mediastream/RealtimeMediaSourceSettings.h:
1873         (WebCore::RealtimeMediaSourceSettings::setSupportedConstraints):
1874         (WebCore::RealtimeMediaSourceSettings::setSupportedConstraits): Deleted.
1875         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1876         (WebCore::AVMediaCaptureSource::initializeSettings):
1877         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h:
1878         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h:
1879         * platform/mock/MockRealtimeMediaSource.cpp:
1880         (WebCore::MockRealtimeMediaSource::initializeSettings):
1881         * testing/Internals.cpp:
1882         (WebCore::Internals::grabNextMediaStreamTrackFrame):
1883         (WebCore::Internals::videoSampleAvailable):
1884         * testing/Internals.h:
1885         * testing/Internals.idl:
1886
1887 2017-04-03  Per Arne Vollan  <pvollan@apple.com>
1888
1889         Implement stroke-miterlimit.
1890         https://bugs.webkit.org/show_bug.cgi?id=169078
1891
1892         Reviewed by Dean Jackson.
1893
1894         Support stroke-miterlimit for text rendering, see https://drafts.fxtf.org/paint/.
1895
1896         Tests: fast/css/stroke-miterlimit-default.html
1897                fast/css/stroke-miterlimit-large.html
1898                fast/css/stroke-miterlimit-zero.html
1899
1900         * css/CSSComputedStyleDeclaration.cpp:
1901         (WebCore::ComputedStyleExtractor::propertyValue):
1902         * css/CSSProperties.json:
1903         * css/SVGCSSComputedStyleDeclaration.cpp:
1904         (WebCore::ComputedStyleExtractor::svgPropertyValue):
1905         * rendering/TextPaintStyle.cpp:
1906         (WebCore::computeTextPaintStyle):
1907         (WebCore::updateGraphicsContext):
1908         * rendering/TextPaintStyle.h:
1909         * rendering/style/RenderStyle.cpp:
1910         (WebCore::RenderStyle::diff):
1911         * rendering/style/RenderStyle.h:
1912         (WebCore::RenderStyle::strokeMiterLimit):
1913         (WebCore::RenderStyle::setStrokeMiterLimit):
1914         (WebCore::RenderStyle::initialStrokeMiterLimit):
1915         (WebCore::RenderStyle::setStrokeDashOffset):
1916         * rendering/style/RenderStyleConstants.cpp:
1917         * rendering/style/RenderStyleConstants.h:
1918         * rendering/style/SVGRenderStyle.cpp:
1919         (WebCore::SVGRenderStyle::diff):
1920         * rendering/style/SVGRenderStyle.h:
1921         (WebCore::SVGRenderStyle::initialStrokeDashArray):
1922         (WebCore::SVGRenderStyle::strokeDashArray):
1923         (WebCore::SVGRenderStyle::initialStrokeMiterLimit): Deleted.
1924         (WebCore::SVGRenderStyle::strokeMiterLimit): Deleted.
1925         (WebCore::SVGRenderStyle::setStrokeMiterLimit): Deleted.
1926         * rendering/style/SVGRenderStyleDefs.cpp:
1927         (WebCore::StyleStrokeData::StyleStrokeData):
1928         (WebCore::StyleStrokeData::operator==):
1929         * rendering/style/SVGRenderStyleDefs.h:
1930         * rendering/style/StyleRareInheritedData.cpp:
1931         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1932         (WebCore::StyleRareInheritedData::operator==):
1933         * rendering/style/StyleRareInheritedData.h:
1934         * rendering/svg/RenderSVGShape.cpp:
1935         (WebCore::RenderSVGShape::hasSmoothStroke):
1936         * rendering/svg/SVGRenderSupport.cpp:
1937         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
1938         * rendering/svg/SVGRenderTreeAsText.cpp:
1939         (WebCore::writeStyle):
1940
1941 2017-04-03  Alejandro G. Castro  <alex@igalia.com>
1942
1943         [OWR] Fix class structure for the OWR mock classes after last modifications
1944         https://bugs.webkit.org/show_bug.cgi?id=170173
1945
1946         Reviewed by Youenn Fablet.
1947
1948         In case of OWR MockRealtimeMediaSource inherits from
1949         RealtimeMediaSourceOwr, so we have to change some of the function
1950         interfaces.
1951
1952         * platform/mock/MockRealtimeMediaSource.h:
1953
1954 2017-04-02  Alexey Proskuryakov  <ap@apple.com>
1955
1956         Build fix for
1957         Add missing text styles
1958         https://bugs.webkit.org/show_bug.cgi?id=170295
1959
1960         * rendering/RenderThemeIOS.mm:
1961         (WebCore::RenderThemeIOS::cachedSystemFontDescription):
1962         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
1963
1964 2017-04-01  Zalan Bujtas  <zalan@apple.com>
1965
1966         Long Arabic text in ContentEditable with css white-space=pre hangs Safari
1967         https://bugs.webkit.org/show_bug.cgi?id=170245
1968
1969         Reviewed by Myles C. Maxfield.
1970
1971         While searching for mid-word break, we measure the text by codepoints in a loop until the accumulated width > available width.
1972         When we see that the accumulated width for the individual codepoints overflows, we join the codepoints and re-measure them.
1973         These 2 widths could be considerably different for number of reasons (ligatures is a prime example). When we figure that
1974         the run still fits, we go back to the main loop (since we are not supposed to wrap the line here) and take the next codepoint.
1975         However this time we start the measurement from the last whitespace, so we end up remeasuring a potentially long chuck of text
1976         until we hit the wrapping point. This is way too expensive.
1977         This patch changes the logic so that we just go back to measuring individual codepoints until we hit the constrain again.  
1978
1979         Covered by existing tests.
1980
1981         * rendering/line/BreakingContext.h:
1982         (WebCore::BreakingContext::handleText): canUseSimpleFontCodePath() is just to mitigate the potential risk of regression and
1983         complex text is more likely to fall into this category. 
1984
1985 2017-04-01  Jon Lee  <jonlee@apple.com>
1986
1987         Add missing text styles
1988         https://bugs.webkit.org/show_bug.cgi?id=170295
1989         rdar://problem/30219503
1990
1991         Reviewed by Dean Jackson.
1992
1993         Updated existing test to include new text styles.
1994
1995         * css/CSSValueKeywords.in: Add title0 and title4.
1996         * platform/spi/cocoa/CoreTextSPI.h:
1997         * rendering/RenderThemeIOS.mm:
1998         (WebCore::RenderThemeIOS::cachedSystemFontDescription):
1999         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
2000
2001 2017-04-01  Dan Bernstein  <mitz@apple.com>
2002
2003         [iOS] <input type=file> label should be specified using plural rules
2004         https://bugs.webkit.org/show_bug.cgi?id=170388
2005
2006         Reviewed by Alexey Proskuryakov.
2007
2008         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
2009
2010         * English.lproj/Localizable.stringsdict: Added an entry for the new key "%lu photo(s) and
2011           %lu video(s)", with plural rules covering all the different combinations in English.
2012           Other localizations may specify additional combinations as needed.
2013
2014 2017-04-01  Alexey Proskuryakov  <ap@apple.com>
2015
2016         Rolling back <https://trac.webkit.org/r214697>, as it made WebKit2.DataDetectionReferenceDate time out.
2017
2018         Was REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
2019         https://bugs.webkit.org/show_bug.cgi?id=170365
2020
2021         * editing/cocoa/DataDetection.mm:
2022         (WebCore::searchForLinkRemovingExistingDDLinks):
2023
2024 2017-04-01  Chris Dumez  <cdumez@apple.com>
2025
2026         We should pause silent WebAudio rendering in background tabs
2027         https://bugs.webkit.org/show_bug.cgi?id=170299
2028         <rdar://problem/31289132>
2029
2030         Reviewed by Eric Carlson.
2031
2032         We should pause silent WebAudio rendering in background tabs since it uses CPU and is
2033         not observable by the user. Such silent WebAudio rendering seems to be used by
2034         doubleclick ads.
2035
2036         Test: webaudio/silent-audio-interrupted-in-background.html
2037
2038         * Modules/webaudio/AudioContext.cpp:
2039         (WebCore::AudioContext::lazyInitialize):
2040         (WebCore::AudioContext::uninitialize):
2041         Have AudioContext register / unregister itself with the Document to get
2042         visibility change notifications, similarly to what HTMLMediaElement was
2043         already doing.
2044
2045         (WebCore::AudioContext::visibilityStateChanged):
2046         Begin / End session interruption whenever the page visiblity changes.
2047
2048         * Modules/webaudio/AudioContext.h:
2049         * WebCore.xcodeproj/project.pbxproj:
2050
2051         * dom/Document.cpp:
2052         (WebCore::Document::registerForVisibilityStateChangedCallbacks):
2053         (WebCore::Document::unregisterForVisibilityStateChangedCallbacks):
2054         (WebCore::Document::visibilityStateChanged):
2055         * dom/Document.h:
2056         * dom/Element.h:
2057         * dom/VisibilityChangeClient.h: Added.
2058         (WebCore::VisibilityChangeClient::~VisibilityChangeClient):
2059         * html/HTMLMediaElement.h:
2060         Introduce a new VisibilityChangeClient interface and have both AudioContext
2061         and HTMLMediaElement subclass it. Previously, the visibilityStateChanged()
2062         function was on Element but this prevented AudioContext from registering
2063         itself since AudioContext is not an Element.
2064
2065 2017-04-01  Dan Bernstein  <mitz@apple.com>
2066
2067         [Cocoa] A couple of UI strings use three periods instead of an ellipsis
2068         https://bugs.webkit.org/show_bug.cgi?id=170386
2069
2070         Reviewed by Tim Horton.
2071
2072         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
2073
2074         * platform/LocalizedStrings.cpp:
2075         (WebCore::mediaElementLoadingStateText): Changed "Loading..." to "Loading…".
2076
2077         * platform/cocoa/LocalizedStringsCocoa.mm:
2078         (WebCore::contextMenuItemTagStyles): Changed "Styles..." to "Styles…".
2079
2080 2017-04-01  Dan Bernstein  <mitz@apple.com>
2081
2082         Localizable strings files are out of date
2083         https://bugs.webkit.org/show_bug.cgi?id=170383
2084
2085         Reviewed by Tim Horton.
2086
2087         Ran update-webkit-localizable-strings.
2088
2089         * English.lproj/Localizable.strings:
2090
2091 2017-04-01  Dan Bernstein  <mitz@apple.com>
2092
2093         [Xcode] In engineering builds, linker warns about libwebrtc.dylib’s install name being invalid
2094         https://bugs.webkit.org/show_bug.cgi?id=170385
2095
2096         Reviewed by Tim Horton.
2097
2098         * Configurations/DebugRelease.xcconfig: Set WK_RELOCATABLE_FRAMEWORKS to YES like we do
2099           in some other projects’ DebugRelease.xcconfig. Engineering builds are always relocatable.
2100         * Configurations/WebCore.xcconfig: When WebCore is relocatable, tell the linker that it’s
2101           not going to be in the shared cache, even if its install name implies that it might be.
2102
2103 2017-04-01  Alexey Proskuryakov  <ap@apple.com>
2104
2105         Rolling back http://trac.webkit.org/r214663 - memory corruption
2106
2107         * Modules/streams/ReadableByteStreamInternals.js:
2108         (cloneArrayBuffer):
2109         * bindings/js/JSDOMGlobalObject.cpp:
2110         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
2111         * bindings/js/StructuredClone.cpp:
2112         (WebCore::structuredCloneArrayBuffer):
2113         (WebCore::cloneArrayBufferImpl): Deleted.
2114         (WebCore::cloneArrayBuffer): Deleted.
2115         * bindings/js/StructuredClone.h:
2116         * bindings/js/WebCoreBuiltinNames.h:
2117         * testing/Internals.cpp:
2118         (WebCore::markerTypeFrom):
2119         (WebCore::Internals::resetToConsistentState):
2120         (WebCore::Internals::isLoadingFromMemoryCache):
2121         (WebCore::Internals::setImageFrameDecodingDuration):
2122         (WebCore::deferredStyleRulesCountForList):
2123         (WebCore::deferredGroupRulesCountForList):
2124         (WebCore::deferredKeyframesRulesCountForList):
2125         (WebCore::Internals::eventThrottlingBehaviorOverride):
2126         (WebCore::Internals::enableMockSpeechSynthesizer):
2127         (WebCore::Internals::rangeForDictionaryLookupAtLocation):
2128         (WebCore::Internals::nodesFromRect):
2129         (WebCore::Internals::layerIDForElement):
2130         (WebCore::Internals::setElementUsesDisplayListDrawing):
2131         (WebCore::Internals::setElementTracksDisplayListReplay):
2132         (WebCore::Internals::styleRecalcCount):
2133         (WebCore::Internals::compositingUpdateCount):
2134         (WebCore::Internals::setCaptionDisplayMode):
2135         (WebCore::Internals::endMediaSessionInterruption):
2136         (WebCore::Internals::postRemoteControlCommand):
2137         (WebCore::appendOffsets):
2138         (WebCore::Internals::scrollSnapOffsets):
2139         (WebCore::Internals::setShowAllPlugins):
2140         (WebCore::Internals::cloneArrayBuffer): Deleted.
2141         * testing/Internals.h:
2142         * testing/Internals.idl:
2143
2144 2017-03-31  Zalan Bujtas  <zalan@apple.com>
2145
2146         <table>: Including <caption>, <thead> or <tbody> causes clipping across page breaks
2147         https://bugs.webkit.org/show_bug.cgi?id=170348
2148         <rdar://problem/24727151>
2149
2150         Reviewed by David Hyatt.
2151
2152         1. In RenderFlowThread::offsetFromLogicalTopOfFirstRegion() we need to take table section offset into account (they are skipped
2153         during the containing block traversal).
2154         2. Trigger paginated relayout when body is moved vertically due to caption/thead etc.
2155
2156         Test: fast/multicol/table-section-page-break.html
2157
2158         * rendering/RenderFlowThread.cpp:
2159         (WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion):
2160         * rendering/RenderTable.cpp:
2161         (WebCore::RenderTable::layout):
2162
2163 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
2164
2165         Rename DOMWindow's m_touchEventListenerCount to m_touchAndGestureEventListenerCount
2166         https://bugs.webkit.org/show_bug.cgi?id=170371
2167
2168         Reviewed by Tim Horton.
2169
2170         This count tracks touch and gesture event listeners, so name it appropriately.
2171
2172         * page/DOMWindow.cpp:
2173         (WebCore::DOMWindow::addEventListener):
2174         (WebCore::DOMWindow::removeEventListener):
2175         (WebCore::DOMWindow::removeAllEventListeners):
2176         * page/DOMWindow.h:
2177
2178 2017-03-31  Simon Fraser  <simon.fraser@apple.com>
2179
2180         When destroying a Node, assert that it's been removed from all the touch handler maps
2181         https://bugs.webkit.org/show_bug.cgi?id=170363
2182         rdar://problem/31377469
2183
2184         Reviewed by Tim Horton.
2185
2186         Assert that the Node has been removed from the touch handler maps in all documents on destruction.
2187
2188         * dom/Document.h:
2189         (WebCore::Document::hasTouchEventHandlers):
2190         (WebCore::Document::touchEventTargetsContain):
2191         * dom/Node.cpp:
2192         (WebCore::Node::~Node):
2193
2194 2017-03-31  Alexey Proskuryakov  <ap@apple.com>
2195
2196         Rolling back https://trac.webkit.org/r214689, as it caused many crashes.
2197
2198         Was:
2199         Fix memory leak in CreateSessionDescriptionObserver::OnSuccess
2200         https://bugs.webkit.org/show_bug.cgi?id=170357
2201
2202         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2203         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
2204
2205 2017-03-31  Youenn Fablet  <youenn@apple.com>
2206
2207         Fix memory leak in RealtimeVideoIncomingSource
2208         https://bugs.webkit.org/show_bug.cgi?id=170356
2209
2210         Reviewed by Eric Carlson.
2211
2212         No change of behavior.
2213
2214         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2215         (WebCore::RealtimeIncomingVideoSource::OnFrame): Adopting the newly created pointer.
2216
2217 2017-03-31  Andy Estes  <aestes@apple.com>
2218
2219         REGRESSION (r202472): Data Detection overwrites existing links in detected ranges
2220         https://bugs.webkit.org/show_bug.cgi?id=170365
2221         <rdar://problem/29205721>
2222
2223         Reviewed by Tim Horton.
2224
2225         r202472 changed the node traversal in searchForLinkRemovingExistingDDLinks() to only
2226         consider nodes that are descendants of startNode, but we need to traverse all nodes between
2227         startNode and endNode to find existing non-DD links.
2228
2229         As a result, we'd add a Data Detector link to the following snippet and make the original
2230         links un-clickable:
2231
2232             <a href='#'>tomorrow</a> <a href='#'>night</a>
2233
2234         Fix this by not specifying a stayWithin node when calling NodeTraversal::next(). The loop
2235         will terminate when we reach endNode.
2236
2237         Updated WebKit2.DataDetectionReferenceDate API test.
2238
2239         * editing/cocoa/DataDetection.mm:
2240         (WebCore::searchForLinkRemovingExistingDDLinks):
2241
2242 2017-03-31  Eric Carlson  <eric.carlson@apple.com>
2243
2244         Incoming video source doesn't propogate frame rotation
2245         https://bugs.webkit.org/show_bug.cgi?id=170364
2246
2247         Reviewed by Youenn Fablet.
2248
2249         No new tests, the mock video source doesn't support rotation. Test will be added when
2250         this is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822. The changes were 
2251         verified manually.
2252
2253         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2254         (WebCore::RealtimeIncomingVideoSource::OnFrame): Convert frame rotation to sample
2255         orientation and swap width and height when necessary.
2256         (WebCore::RealtimeIncomingVideoSource::processNewSample):
2257         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
2258
2259 2017-03-31  Chris Dumez  <cdumez@apple.com>
2260
2261         Possible null dereference under SourceBuffer::sourceBufferPrivateDidReceiveSample()
2262         https://bugs.webkit.org/show_bug.cgi?id=159639
2263
2264         Reviewed by Eric Carlson.
2265
2266         Add a null check for trackBuffer.description before dereferencing as it seems
2267         it can be null.
2268
2269         * Modules/mediasource/SourceBuffer.cpp:
2270         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2271
2272 2017-03-31  Youenn Fablet  <youenn@apple.com>
2273
2274         Fix memory leak in CreateSessionDescriptionObserver::OnSuccess
2275         https://bugs.webkit.org/show_bug.cgi?id=170357
2276
2277         Reviewed by Geoffrey Garen.
2278
2279         No change of behavior.
2280
2281         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2282         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded): Adopting the raw pointer parameter.
2283
2284 2017-03-31  Fujii Hironori  <Hironori.Fujii@sony.com>
2285
2286         [WinCairo] WebCore::PlatformDisplay::terminateEGLDisplay causes a crash in libGLESv2.dll while processing atexit
2287         https://bugs.webkit.org/show_bug.cgi?id=170331
2288
2289         Reviewed by Michael Catanzaro.
2290
2291         WebCore::PlatformDisplay uses atexit to destruct EGL displays
2292         while exiting process. But, when the atexit will be processed,
2293         heap of libGLESv2.dll would be already destructed and causing a
2294         crash on Windows. Do not use atexit for Windows.
2295
2296         AppleWin port does not use PlatformDisplay. Thus, it does not have
2297         this bug.
2298
2299         * platform/graphics/PlatformDisplay.cpp:
2300         (WebCore::PlatformDisplay::initializeEGLDisplay): Do not use atexit for Windows.
2301         (WebCore::PlatformDisplay::shutDownEglDisplays): Added.
2302         * platform/graphics/PlatformDisplay.h: Added a declaration of shutDownEglDisplays.
2303
2304 2017-03-31  Yoav Weiss  <yoav@yoav.ws>
2305
2306         Remove PRELOAD_DEBUG related code.
2307         https://bugs.webkit.org/show_bug.cgi?id=170352
2308
2309         Reviewed by Youenn Fablet.
2310
2311         As the PRELOAD_DEBUG related code stopped building and it seems like no one noticed,
2312         it seems safe to assume that we can remove that code. This patch removes it.
2313
2314         No new tests as there's no functional change.
2315
2316         * loader/cache/CachedResourceLoader.cpp:
2317         (WebCore::CachedResourceLoader::preload):
2318         (WebCore::CachedResourceLoader::clearPreloads):
2319         (WebCore::CachedResourceLoader::printPreloadStats): Deleted.
2320
2321 2017-03-31  Brady Eidson  <beidson@apple.com>
2322
2323         Clean up the "StorageType" enum.
2324         https://bugs.webkit.org/show_bug.cgi?id=170349
2325
2326         Reviewed by Tim Horton.
2327
2328         - Make this `enum` into an `enum class`
2329         - Add a new type specific for "transient local storage"
2330
2331         No new tests (No behavior change).
2332
2333         * WebCore.xcodeproj/project.pbxproj:
2334         
2335         * inspector/InspectorDOMStorageAgent.cpp:
2336         (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
2337         
2338         * inspector/InspectorInstrumentation.h:
2339         
2340         * loader/EmptyClients.cpp:
2341         
2342         * storage/Storage.cpp:
2343         (WebCore::Storage::isDisabledByPrivateBrowsing):
2344         
2345         * storage/StorageArea.h:
2346         (): Deleted.
2347         
2348         * storage/StorageEventDispatcher.cpp:
2349         (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames):
2350         (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames):
2351         
2352         * storage/StorageType.h:
2353         (WebCore::isLocalStorage):
2354
2355 2017-03-31  Chris Dumez  <cdumez@apple.com>
2356
2357         Unreviewed, Mark "HTML interactive form validation" as done.
2358
2359         It is shipping in Safari 10.1.
2360  
2361         * features.json:
2362
2363 2017-03-31  Csaba Osztrogonác  <ossy@webkit.org>
2364
2365         Mac cmake buildfix after r214666
2366         https://bugs.webkit.org/show_bug.cgi?id=170342
2367
2368         Unreviewed buildfix.
2369
2370         * PlatformMac.cmake:
2371         * testing/MockPreviewLoaderClient.h:
2372
2373 2017-03-31  Sam Weinig  <sam@webkit.org>
2374
2375         Remove unneeded custom constructors include.
2376
2377         * WebCore.xcodeproj/project.pbxproj:
2378         * bindings/js/ios: Removed.
2379         * bindings/js/ios/TouchConstructors.cpp: Removed.
2380
2381 2017-03-31  John Wilander  <wilander@apple.com>
2382
2383         Resource Load Statistics: Check if the store exists before clearing it
2384         https://bugs.webkit.org/show_bug.cgi?id=170324
2385         <rdar://problem/31258505>
2386
2387         Reviewed by Brent Fulgham.
2388
2389         No new tests. Added a null check.
2390
2391         * loader/ResourceLoadObserver.cpp:
2392         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
2393             Added a null check.
2394
2395 2017-03-31  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2396
2397         [Readable Streams API] Implement cloneArrayBuffer in WebCore
2398         https://bugs.webkit.org/show_bug.cgi?id=170008
2399
2400         Reviewed by Youenn Fablet.
2401
2402         Implemented cloneArrayBuffer based on existing structuredCloneArrayBuffer
2403         implementation. The code has been factorized so that both cloneArrayBuffer
2404         and structuredCloneArrayBuffer rely on the same code (which is basically
2405         the previous implementation of structuredCloneArrayBuffer + the ability
2406         to clone only a part of considered buffer).
2407
2408         Added test to check cloneArrayBuffer behaviour.
2409
2410         * Modules/streams/ReadableByteStreamInternals.js: Deleted cloneArrayBuffer JS implementation.
2411         * bindings/js/JSDOMGlobalObject.cpp:
2412         (WebCore::JSDOMGlobalObject::addBuiltinGlobals): Add cloneArrayBuffer private declaration.
2413         * bindings/js/StructuredClone.cpp:
2414         (WebCore::cloneArrayBufferImpl): Added (mostly based on previous structuredCloneArrayBuffer).
2415         (WebCore::cloneArrayBuffer): Added.
2416         (WebCore::structuredCloneArrayBuffer): Updated.
2417         * bindings/js/StructuredClone.h: Added cloneArrayBuffer declaration.
2418         * bindings/js/WebCoreBuiltinNames.h: Added cloneArrayBuffer declaration.
2419         * testing/Internals.cpp: Added support for testing cloneArrayBuffer.
2420         * testing/Internals.h: Added support for testing cloneArrayBuffer.
2421         * testing/Internals.idl: Added support for testing cloneArrayBuffer.
2422
2423 2017-03-31  Antoine Quint  <graouts@apple.com>
2424
2425         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
2426         https://bugs.webkit.org/show_bug.cgi?id=168409
2427         <rdar://problem/30799198>
2428
2429         Unreviewed. Yet more logging to determine under what circumstance ScriptedAnimationController gets suspended.
2430
2431         * dom/Document.cpp:
2432         (WebCore::Document::requestAnimationFrame):
2433
2434 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
2435
2436         Unreviewed GTK+ build fix. Add missing ANGLE build targets
2437         to the build.
2438
2439         * CMakeLists.txt:
2440
2441 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
2442
2443         Ensure that Node::willBeDeletedFrom() always removes touch event handlers from the document
2444         https://bugs.webkit.org/show_bug.cgi?id=170323
2445         rdar://problem/23647630
2446
2447         Reviewed by Chris Dumez.
2448
2449         There are two instances where nodes are registered as touch event handlers without
2450         having normal touch event listeners: slider thumb elements, and elements with overflow scrolling,
2451         on iOS.
2452
2453         For such nodes, hasEventTargetData() will be false, but we want to ensure
2454         that they are removed from the Document's touchEventHandler set, so move the
2455         call to document.removeTouchEventHandler() outside of the conditional block.
2456
2457         This should be cheap in most cases when the touchEventHandler is empty.
2458
2459         * dom/Node.cpp:
2460         (WebCore::Node::willBeDeletedFrom):
2461
2462 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
2463
2464         Minor cleanup checking for gesture event names
2465         https://bugs.webkit.org/show_bug.cgi?id=170319
2466
2467         Reviewed by Tim Horton.
2468
2469         Just use isGestureEventType() in a couple of places.
2470
2471         * dom/Node.cpp:
2472         (WebCore::tryAddEventListener):
2473         (WebCore::tryRemoveEventListener):
2474
2475 2017-03-30  Simon Fraser  <simon.fraser@apple.com>
2476
2477         Rename a touch event function, and new touch region test results
2478         https://bugs.webkit.org/show_bug.cgi?id=170309
2479         rdar://problem/31329520
2480
2481         Reviewed by Chris Dumez.
2482
2483         Adapt to a naming change in WebKitAdditions.
2484
2485         * dom/Document.cpp:
2486         (WebCore::Document::removeAllEventListeners):
2487         * page/FrameView.cpp:
2488         (WebCore::FrameView::layout):
2489         * rendering/RenderElement.cpp:
2490         (WebCore::RenderElement::styleWillChange):
2491         * rendering/RenderLayer.cpp:
2492         (WebCore::RenderLayer::scrollTo):
2493         (WebCore::RenderLayer::calculateClipRects):
2494
2495 2017-03-30  Matt Rajca  <mrajca@apple.com>
2496
2497         YouTube sometimes does not respect "user gesture" restriction for videos.
2498         https://bugs.webkit.org/show_bug.cgi?id=170297
2499
2500         I discovered a code path that does not honor the "user gesture" requirement and playback is able to begin
2501         even though we have a restriction in place. When using Media Source Extensions, which YouTube does, we transition
2502         from a "Have Metadata" to a "Future Data" state that causes playback to begin, however, we never check
2503         if we have a playback restriction in place.
2504
2505         Reviewed by Eric Carlson.
2506
2507         * html/HTMLMediaElement.cpp:
2508         (WebCore::HTMLMediaElement::setReadyState):
2509
2510 2017-03-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
2511
2512         REGRESSION (r213764): Background image from sprite sheet incorrectly scaled
2513         https://bugs.webkit.org/show_bug.cgi?id=169547
2514
2515         Reviewed by Simon Fraser.
2516
2517         The bug happens when drawing only a rectangle of an image not the whole
2518         image. In BitmapImage::draw(), sizeForDrawing was calculated as the destRect
2519         scaled by the transformation which is applied to the GraphicsContext. Two
2520         problems with this approach. The first one is destRect can be only part of
2521         the image. The second problem is, the ratio destRect / srcRect is another
2522         scaling that needs to be considered.
2523
2524         To fix this issue, first the base size has to be size of the image and not
2525         destRect.size(). Secondly, we need to scale this base size with the context
2526         transformation multiplied by the ratio destRect / srcRect. This scaling is
2527         exactly the same scaling which is calculated in subsamplingScale(). Finally
2528         we use this scaled size as the sizeForDrawing to send to the ImageDecoder.
2529
2530         Test: fast/images/sprite-sheet-image-draw.html
2531
2532         * platform/graphics/BitmapImage.cpp:
2533         (WebCore::BitmapImage::draw): Fix the bug.
2534         (WebCore::BitmapImage::stopAnimation): Stops the async image decoding for animated images only.
2535         The decoding for large images will be stopped when BitmapImage::newFrameNativeImageAvailableAtIndex()
2536         is called and the decoding queue is idle.
2537         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Add image logging.
2538         * platform/graphics/BitmapImage.h: Move sourceURL() to the Image class.
2539         * platform/graphics/GraphicsContext.cpp: Pass imagePaintingOptions.m_decodingMode to Image::drawTiled().
2540         (WebCore::GraphicsContext::drawTiledImage): Pass imagePaintingOptions.m_decodingMode) to Image::drawTiled().
2541         * platform/graphics/Image.cpp:
2542         (WebCore::Image::sourceURL): Moved from BitmapImage.
2543         (WebCore::Image::drawTiled): Add a DecodingMode argument instead of calling always with DecodingMode::Synchronous.
2544         * platform/graphics/Image.h:
2545         * platform/graphics/ImageFrameCache.cpp:
2546         (WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Add image logging.
2547         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Ditto,
2548         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
2549         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Ditto.
2550         (WebCore::ImageFrameCache::sourceURL): A helper function to avoid checking the value of m_image.
2551         * platform/graphics/ImageFrameCache.h:
2552         * platform/graphics/NativeImage.h: Rename subsamplingScale() to nativeImageDrawingScale() and return image scaling instead.
2553         * platform/graphics/cairo/NativeImageCairo.cpp:
2554         (WebCore::nativeImageDrawingScale): Ditto.
2555         (WebCore::subsamplingScale): Deleted.
2556         * platform/graphics/cg/NativeImageCG.cpp:
2557         (WebCore::nativeImageDrawingScale): Ditto.
2558         (WebCore::subsamplingScale): Deleted.
2559         * platform/graphics/win/NativeImageDirect2D.cpp:
2560         (WebCore::nativeImageDrawingScale): Ditto.
2561         (WebCore::subsamplingScale): Deleted.
2562
2563 2017-03-30  Matt Baker  <mattbaker@apple.com>
2564
2565         Web Inspector: Assertion failure in InspectorStyleProperty::setRawTextFromStyleDeclaration
2566         https://bugs.webkit.org/show_bug.cgi?id=170279
2567         <rdar://problem/30200492>
2568
2569         Reviewed by David Hyatt.
2570
2571         The SourceRange for a CSSPropertySourceData should be relative to the start
2572         of the declaration body, not the start of the StyleSheetHandler’s parsed
2573         text. This only affected the ranges of unparsed (parsedOK == false) properties
2574         lacking a trailing semi-colon.
2575
2576         This patch doesn't change the behavior of InspectorStyleSheet other than
2577         silencing an irksome assert, as String::substring does a safety check on
2578         the passed in length.
2579
2580         * inspector/InspectorStyleSheet.cpp:
2581         (WebCore::fixUnparsedProperties):
2582
2583 2017-03-30  Youenn Fablet  <youenn@apple.com> and Jon Lee <jonlee@apple.com>
2584
2585         Clean up RTCDataChannel
2586         https://bugs.webkit.org/show_bug.cgi?id=169732
2587
2588         Reviewed by Chris Dumez.
2589
2590         Test: webrtc/datachannel/datachannel-event.html
2591               webrtc/datachannel/bufferedAmountLowThreshold.html
2592
2593         Making RTCDataChannel interface closer to the spec updating implementation accordingly.
2594         See https://w3c.github.io/webrtc-pc/#rtcdatachannel.
2595         In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes.
2596         Doing some additional cleaning refactoring.
2597
2598         Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by
2599         libwebrtc without needing to get it from the libwebrtc network thread again.
2600         In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc
2601         OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be
2602         updated to increase in the send method.
2603
2604         Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount.
2605
2606         * Modules/mediastream/RTCDataChannel.cpp:
2607         (WebCore::RTCDataChannel::send):
2608         (WebCore::RTCDataChannel::close):
2609         (WebCore::RTCDataChannel::didChangeReadyState):
2610         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
2611         * Modules/mediastream/RTCDataChannel.h:
2612         * Modules/mediastream/RTCDataChannel.idl:
2613         * Modules/mediastream/RTCDataChannelEvent.cpp:
2614         (WebCore::RTCDataChannelEvent::create):
2615         (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
2616         (WebCore::RTCDataChannelEvent::channel):
2617         * Modules/mediastream/RTCDataChannelEvent.h:
2618         * Modules/mediastream/RTCDataChannelEvent.idl:
2619         * Modules/mediastream/RTCPeerConnection.idl:
2620         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2621         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
2622         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2623         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
2624         * WebCore.xcodeproj/project.pbxproj:
2625         * dom/EventNames.h:
2626         * platform/mediastream/RTCDataChannelHandler.h:
2627         * platform/mediastream/RTCDataChannelHandlerClient.h:
2628         * platform/mediastream/RTCDataChannelState.h: Added.
2629         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
2630         * platform/mock/RTCDataChannelHandlerMock.cpp:
2631         (WebCore::RTCDataChannelHandlerMock::setClient):
2632         (WebCore::RTCDataChannelHandlerMock::close):
2633         * platform/mock/RTCNotifiersMock.cpp:
2634         (WebCore::IceConnectionNotifier::IceConnectionNotifier):
2635         (WebCore::SignalingStateNotifier::SignalingStateNotifier):
2636         (WebCore::DataChannelStateNotifier::DataChannelStateNotifier):
2637         * platform/mock/RTCNotifiersMock.h:
2638
2639 2017-03-30  Javier Fernandez  <jfernandez@igalia.com>
2640
2641         [css-align] Adapt content-alignment properties to the new baseline syntax
2642         https://bugs.webkit.org/show_bug.cgi?id=170262
2643
2644         Reviewed by David Hyatt.
2645
2646         The baseline-position syntax has changed recently, so we need to update
2647         the CSS properties using the old syntax. This patch address only the
2648         content-alignment (align-content and justify-content).
2649
2650         I used this patch to adapt the implementation of the parsing logic for
2651         these properties to the new Blink's CSS Parsing Design.
2652
2653         The new baseline syntax is "[first | last ]? baseline" which implies
2654         modifying the parsing and computed value logic.
2655
2656         There are several layout tests affected by this change, so I'll update
2657         them accordingly.
2658
2659         No new tests, just added/modified some cases to the tests we
2660         already have using the new baseline values.
2661
2662         * css/CSSComputedStyleDeclaration.cpp:
2663         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
2664         * css/CSSContentDistributionValue.cpp:
2665         (WebCore::CSSContentDistributionValue::customCSSText):
2666         * css/CSSPrimitiveValueMappings.h:
2667         (WebCore::CSSPrimitiveValue::operator ItemPosition):
2668         (WebCore::CSSPrimitiveValue::operator ContentPosition):
2669         * css/CSSValueKeywords.in:
2670         * css/parser/CSSPropertyParser.cpp:
2671         (WebCore::isBaselineKeyword):
2672         (WebCore::consumeBaselineKeyword):
2673         (WebCore::consumeContentDistributionOverflowPosition):
2674         (WebCore::consumeSelfPositionOverflowPosition):
2675
2676 2017-03-30  James Craig  <jcraig@apple.com>
2677
2678         AX: Expose a new AXSubrole for explicit ARIA "group" role
2679         https://bugs.webkit.org/show_bug.cgi?id=169810
2680         <rdar://problem/31039693>
2681
2682         Reviewed by Chris Fleizach.
2683
2684         Split GroupRole into generics (GroupRole) and explicit groups 
2685         (ApplicationGroupRole) so we can expose a subrole on the explicit 
2686         groups. Account for the change in ARIA Tree and Menu hierachies. 
2687         Update the computedRoleValue for WebKit Inspector usage, too.
2688
2689         Updated existing tests.
2690
2691         Test: accessibility/list-detection2.html:
2692         Test: accessibility/roles-computedRoleString.html:
2693         Test: inspector/dom/getAccessibilityPropertiesForNode.html:
2694         Test: inspector/dom/highlightFrame.html:
2695         Test: inspector/dom/highlightSelector.html:
2696
2697         * accessibility/AccessibilityNodeObject.cpp:
2698         (WebCore::AccessibilityNodeObject::helpText):
2699         (WebCore::AccessibilityNodeObject::hierarchicalLevel):
2700         (WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent):
2701         * accessibility/AccessibilityObject.cpp:
2702         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent):
2703         (WebCore::AccessibilityObject::ariaTreeItemContent):
2704         (WebCore::initializeRoleMap):
2705         (WebCore::AccessibilityObject::computedRoleString):
2706         * accessibility/AccessibilityObject.h:
2707         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2708         (atkRole):
2709         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2710         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2711         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2712         (createAccessibilityRoleMap):
2713         (-[WebAccessibilityObjectWrapper subrole]):
2714
2715 2017-03-30  Chris Dumez  <cdumez@apple.com>
2716
2717         We are spending a lot of time bzero'ing AudioChannel buffers on uni-watch.com
2718         https://bugs.webkit.org/show_bug.cgi?id=170288
2719         <rdar://problem/31289132>
2720
2721         Reviewed by Eric Carlson.
2722
2723         We are spending a lot of time bzero'ing AudioChannel buffers on uni-watch.com due
2724         to doubleclick ads using WebAudio with a 0-gain GainNode. We should optimize the
2725         0-gain case as much as possible.
2726
2727         No new tests, only an optimization.
2728
2729         * Modules/webaudio/AudioNode.cpp:
2730         (WebCore::AudioNode::processIfNecessary):
2731         Drop call to unsilenceOutputs() before calling AudioNode::process(). The AudioChannel
2732         API already takes care of clearing its 'silent' flag whenever its buffer changes so
2733         there should be no need to explicitly clearing the 'silent' flag before calling
2734         process(). This was causing us to zero out buffers that were already filled with
2735         zeros because AudioChannel::zero() would no longer return early, not knowing the
2736         channel is already silent. This reduces the number of bzero() calls by ~3.5x on
2737         uni-watch.com (from 100 calls every ~20ms to 100 calls every ~70ms.
2738
2739         * Modules/webaudio/AudioNode.h:
2740         * platform/audio/mac/AudioDestinationMac.cpp:
2741         (WebCore::AudioDestinationMac::render):
2742         Avoid clamping the values in the channel buffer if the channel is silent since this
2743         will have no effect (given that the buffer only contains zeros).
2744
2745 2017-03-30  Eric Carlson  <eric.carlson@apple.com>
2746
2747         [Crash] WebCore::AudioBuffer::AudioBuffer don't checking illegal value
2748         https://bugs.webkit.org/show_bug.cgi?id=169956
2749
2750         Reviewed by Youenn Fablet.
2751
2752         Test: webaudio/audiobuffer-crash.html
2753
2754         * Modules/webaudio/AudioBuffer.cpp:
2755         (WebCore::AudioBuffer::AudioBuffer): Invalidate the object and return early if the channel 
2756         array allocation fails.
2757         (WebCore::AudioBuffer::AudioBuffer): Ditto.
2758         (WebCore::AudioBuffer::invalidate): Invalidate the object.
2759         * Modules/webaudio/AudioBuffer.h:
2760
2761 2017-03-30  Antoine Quint  <graouts@apple.com>
2762
2763         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
2764         https://bugs.webkit.org/show_bug.cgi?id=168409
2765         <rdar://problem/30799198>
2766
2767         Unreview. Print the backtrace when we suspend scripted animations.
2768
2769         * page/Page.cpp:
2770         (WebCore::Page::suspendScriptedAnimations):
2771
2772 2017-03-30  Antoine Quint  <graouts@apple.com>
2773
2774         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
2775         https://bugs.webkit.org/show_bug.cgi?id=168409
2776         <rdar://problem/30799198>
2777
2778         Unreview. Pring the backtrace when we suspend ScriptedAnimationController.
2779
2780         * dom/ScriptedAnimationController.cpp:
2781         (WebCore::ScriptedAnimationController::suspend):
2782
2783 2017-03-30  Antoine Quint  <graouts@apple.com>
2784
2785         [Modern Media Controls] Invalid placard icon is not visible for short video
2786         https://bugs.webkit.org/show_bug.cgi?id=170277
2787         <rdar://problem/31327955>
2788
2789         Reviewed by Eric Carlson.
2790
2791         Make the minimum dimension needed to display a placard icon configurable and let the
2792         invalid placard use a 50pt dimension. We also make a drive-by fix to reset "text-align"
2793         for media controls as having a "text-align: center" inherited value would mess up
2794         positioning of the placard icon and make it flush to the right of the placard.
2795
2796         Test: media/modern-media-controls/invalid-placard/invalid-placard-constrained-metrics.html
2797
2798         * Modules/modern-media-controls/controls/invalid-placard.js:
2799         (InvalidPlacard):
2800         * Modules/modern-media-controls/controls/media-controls.css:
2801         (.media-controls):
2802         * Modules/modern-media-controls/controls/placard.js:
2803         (Placard.prototype.layout):
2804
2805 2017-03-30  Zan Dobersek  <zdobersek@igalia.com>
2806
2807         [GCrypt] Register missing algorithms in CryptoAlgorithmRegistry::platformRegisterAlgoritmhs()
2808         https://bugs.webkit.org/show_bug.cgi?id=170273
2809
2810         Reviewed by Michael Catanzaro.
2811
2812         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp:
2813         (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
2814         Add registerAlgorithm<> calls for AES_CFB, AES_GCM, ECDH and
2815         PBKDF2 algorithms.
2816
2817 2017-03-30  Brent Fulgham  <bfulgham@apple.com>
2818
2819         Remove unused MediaControlsApple implementation
2820         https://bugs.webkit.org/show_bug.cgi?id=170258
2821         <rdar://problem/31331056>
2822
2823         Reviewed by Eric Carlson.
2824
2825         Remove dead code related to old media controls. We switched to HTML5-based media controls
2826         several years ago.
2827
2828         No new tests. Removing this dead code should have no change in behavior.
2829
2830         * WebCore.xcodeproj/project.pbxproj: Remove unused files.
2831         * dom/EventListener.h: Remove unused event type.
2832         * html/shadow/MediaControlsApple.cpp: Removed.
2833         * html/shadow/MediaControlsApple.h: Removed.
2834
2835 2017-03-30  Fujii Hironori  <Hironori.Fujii@sony.com>
2836
2837         [WinCairo] ImageCairoWin.cpp: error C2660: 'WebCore::BitmapImage::draw': function does not take 6 arguments
2838         https://bugs.webkit.org/show_bug.cgi?id=170275
2839
2840         Reviewed by Said Abou-Hallawa.
2841
2842         Apply the similar change of ImageCGWin.cpp of r214450 to ImageCairoWin.cpp.
2843
2844         * platform/graphics/win/ImageCairoWin.cpp:
2845         (WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
2846         (WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
2847
2848 2017-03-27  Sergio Villar Senin  <svillar@igalia.com>
2849
2850         [css-grid] Clamp the number of autorepeat tracks
2851         https://bugs.webkit.org/show_bug.cgi?id=170120
2852
2853         Reviewed by Manuel Rego Casasnovas.
2854
2855         As suggested by the specs we do clamp the maximum number of tracks per grid in order to
2856         minimize potential OOM situations. However we were not considering the case of the recently
2857         added auto repeat syntax. Abnormally huge values for the width/height on the grid container
2858         could lead to a number of auto repeat tracks higher than the maximum.
2859
2860         A new API was added to Internals in order to test limits without having to create huge
2861         grids. This new API allows clients to set an arbitrary limit to the number of tracks. The
2862         addition of this new API forced us to add GridPosition.cpp to the project to define the
2863         global variable we use for testing. We took the chance to move part of the implementation
2864         from the header file to the source file.
2865
2866         Last but not least, several new ASSERTs were added to Grid.cpp implementation to ensure that
2867         we do not surpass the grid track limits.
2868
2869         Test: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
2870
2871         * CMakeLists.txt:
2872         * WebCore.xcodeproj/project.pbxproj:
2873         * css/parser/CSSPropertyParser.cpp:
2874         (WebCore::consumeGridTrackRepeatFunction):
2875         * rendering/Grid.cpp:
2876         (WebCore::Grid::ensureGridSize): Added ASSERT.
2877         (WebCore::Grid::setSmallestTracksStart): Ditto.
2878         (WebCore::Grid::setAutoRepeatTracks): Ditto.
2879         (WebCore::Grid::setAutoRepeatEmptyColumns): Ditto.
2880         (WebCore::Grid::setAutoRepeatEmptyRows): Ditto.
2881         * rendering/RenderGrid.cpp:
2882         (WebCore::RenderGrid::clampAutoRepeatTracks): New method.
2883         (WebCore::RenderGrid::placeItemsOnGrid): Clamp the number of auto repeat tracks before
2884         passing them to the Grid.
2885         * rendering/RenderGrid.h:
2886         * rendering/style/GridArea.h:
2887         (WebCore::GridSpan::GridSpan):
2888         * rendering/style/GridPosition.cpp: Added.
2889         (WebCore::GridPosition::setExplicitPosition):
2890         (WebCore::GridPosition::setAutoPosition):
2891         (WebCore::GridPosition::setSpanPosition):
2892         (WebCore::GridPosition::setNamedGridArea):
2893         (WebCore::GridPosition::integerPosition):
2894         (WebCore::GridPosition::namedGridLine):
2895         (WebCore::GridPosition::spanPosition):
2896         (WebCore::GridPosition::operator==):
2897         * rendering/style/GridPosition.h:
2898         (WebCore::GridPosition::shouldBeResolvedAgainstOppositePosition):
2899         (WebCore::GridPosition::max):
2900         (WebCore::GridPosition::min):
2901         (WebCore::GridPosition::setMaxPositionForTesting):
2902         (WebCore::GridPosition::setExplicitPosition): Deleted.
2903         (WebCore::GridPosition::setAutoPosition): Deleted.
2904         (WebCore::GridPosition::setSpanPosition): Deleted.
2905         (WebCore::GridPosition::setNamedGridArea): Deleted.
2906         (WebCore::GridPosition::integerPosition): Deleted.
2907         (WebCore::GridPosition::namedGridLine): Deleted.
2908         (WebCore::GridPosition::spanPosition): Deleted.
2909         (WebCore::GridPosition::operator==): Deleted.
2910         * rendering/style/GridPositionsResolver.cpp:
2911         (WebCore::GridPositionsResolver::explicitGridColumnCount):
2912         (WebCore::GridPositionsResolver::explicitGridRowCount):
2913         * testing/Internals.cpp:
2914         (WebCore::Internals::setGridMaxTracksLimit):
2915         * testing/Internals.h:
2916         * testing/Internals.idl:
2917
2918 2017-03-29  Ryosuke Niwa  <rniwa@webkit.org>
2919
2920         Disconnecting a HTMLObjectElement does not always unload its content document
2921         https://bugs.webkit.org/show_bug.cgi?id=169606
2922
2923         Reviewed by Andy Estes.
2924
2925         When removing a node, we first disconnect all subframes then update the focused element as we remove each child.
2926         However, when the removed element is a focused object element with a content document, removeFocusedNodeOfSubtree
2927         can update the style tree synchronously inside Document::setFocusedElement, and reload the document.
2928
2929         Avoid this by instantiating a SubframeLoadingDisabler on the parent of the focused element.
2930
2931         Test: fast/dom/removing-focused-object-element.html
2932
2933         * dom/Document.cpp:
2934         (WebCore::Document::removeFocusedNodeOfSubtree):
2935
2936 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
2937
2938         Migrate to kCTFontCSSWidthAttribute
2939         https://bugs.webkit.org/show_bug.cgi?id=170265
2940
2941         Reviewed by Darin Adler.
2942
2943         Previously, we were mapping from Core Text widths to CSS widths in WebKit.
2944         However, on some OSes, Core Text can directly tell us what the CSS width
2945         value is.
2946
2947         No new tests because there is no behavior change.
2948
2949         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2950         (WebCore::getCSSAttribute):
2951         (WebCore::capabilitiesForFontDescriptor):
2952         * platform/spi/cocoa/CoreTextSPI.h:
2953
2954 2017-03-28  Simon Fraser  <simon.fraser@apple.com>
2955
2956         Make it possible to dump touch event regions for testing
2957         https://bugs.webkit.org/show_bug.cgi?id=170209
2958         <rdar://problem/31309258>
2959
2960         Reviewed by Tim Horton.
2961
2962         Expose internals.touchEventRectsForEvent() and internals.passiveTouchEventListenerRects(), which
2963         fetch data via Page.
2964
2965         Because the regions are normally updated on a timer, we have to force an eager update via Document::updateTouchEventRegions().
2966
2967         Test: fast/events/touch/ios/touch-event-regions.html
2968
2969         * page/Page.cpp:
2970         (WebCore::Page::nonFastScrollableRects):
2971         (WebCore::Page::touchEventRectsForEvent):
2972         (WebCore::Page::passiveTouchEventListenerRects):
2973         * page/Page.h:
2974         * testing/Internals.cpp:
2975         (WebCore::Internals::touchEventRectsForEvent):
2976         (WebCore::Internals::passiveTouchEventListenerRects):
2977         * testing/Internals.h:
2978         * testing/Internals.idl:
2979
2980 2017-03-29  Zalan Bujtas  <zalan@apple.com>
2981
2982         RenderBlockFlow::addFloatsToNewParent should check if float is already added to the object list.
2983         https://bugs.webkit.org/show_bug.cgi?id=170259
2984         <rdar://problem/31300584>
2985
2986         Reviewed by Simon Fraser.
2987
2988         r210145 assumed that m_floatingObjects would simply ignore the floating box if it was already in the list.  
2989
2990         Test: fast/block/float/placing-multiple-floats-crash.html
2991
2992         * rendering/RenderBlockFlow.cpp:
2993         (WebCore::RenderBlockFlow::addFloatsToNewParent):
2994
2995 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
2996
2997         Try to normalize variation ranges
2998         https://bugs.webkit.org/show_bug.cgi?id=170119
2999
3000         Unreviewed.
3001
3002         Addressing post-review comment.
3003
3004         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3005         (WebCore::isGXVariableFont):
3006
3007 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
3008
3009         Try to normalize variation ranges
3010         https://bugs.webkit.org/show_bug.cgi?id=170119
3011
3012         Reviewed by Simon Fraser.
3013
3014         TrueType GX-style variation fonts use one particular scale for values on their
3015         weight/width/slope axes - usually the values lie between -1 and 1 on that scale.
3016         However, OpenType 1.8-style fonts use the CSS scale for values on these axes.
3017         For the purposes of font selection, these values need to lie on the same scale.
3018         However, when font selection is completed and the variation values are actually
3019         being applied to the fonts, values which lie on the font's actual scale need to
3020         be applied. This patch adds normalize*() and denormalize*() functions to perform
3021         both of these operations. 
3022
3023         The conversion itself between the two scales isn't an exact mapping. Mapping
3024         slope is just a linear relationship with 0deg <=> 0 and 20deg <=> 1 (as per the
3025         CSS Fonts spec). Mapping widths is similar, it uses a 2-component piecewise
3026         linear relationship which includes the values given in the Microsoft OpenType
3027         spec for the OS/2 table's usWidthClass field. Weights are more difficult, so I
3028         plotted the CSS weights and the GX-style weights for every style of San
3029         Francisco, saw that the relationship appears to be linear, and ran a linear
3030         regression to compute the line equation.
3031
3032         As for the actual discrimination of determining whether a font is a GX-style
3033         font or not, we can use the presence of the 'STAT' table. This table didn't
3034         exist when GX fonts were being created, and OpenType 1.8 variable fonts are
3035         required to have this table.
3036
3037         Facebook uses the string ".SFNSText" in their @font-face blocks. This font is
3038         a variation font, but uses the GX-style values. Facebook asks us to create
3039         this font with a weight of 700, and because the values in the font are around
3040         1.0, we were erroneously thinking that the font wasn't bold, so we were then
3041         applying synthetic bold. This was causing text on facebook to look fuzzy and
3042         ugly.
3043
3044         Test: fast/text/variations/font-selection-properties-expected.html
3045
3046         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3047         (WebCore::isGXVariableFont):
3048         (WebCore::normalizeWeight):
3049         (WebCore::normalizeSlope):
3050         (WebCore::denormalizeWeight):
3051         (WebCore::denormalizeWidth):
3052         (WebCore::denormalizeSlope):
3053         (WebCore::normalizeWidth):
3054         (WebCore::preparePlatformFont): Instead of using FontSelectionValues for the
3055         intermediate values, we should use floats instead. This is because
3056         FontSelectionValues are fixed-point numbers with the denominator having 2 bits.
3057         When using this data type to represent values on the GX scale, which are usually
3058         between 0 and 1, you lose a lot of fidelity. Instead, our intermediate
3059         calculations should be done with floats, and converted to FontSelectionValues at
3060         the end when they are representative of values on the CSS scale.
3061         (WebCore::stretchFromCoreTextTraits):
3062         (WebCore::fontWeightFromCoreText):
3063         (WebCore::extractVariationBounds):
3064         (WebCore::variationCapabilitiesForFontDescriptor):
3065         (WebCore::capabilitiesForFontDescriptor):
3066
3067 2017-03-29  Saam Barati  <sbarati@apple.com>
3068
3069         LinkBuffer and ExecutableAllocator shouldn't have anything to do with VM
3070         https://bugs.webkit.org/show_bug.cgi?id=170210
3071
3072         Reviewed by Mark Lam.
3073
3074         * cssjit/SelectorCompiler.cpp:
3075         (WebCore::SelectorCompiler::compileSelector):
3076         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
3077
3078 2017-03-29  Javier Fernandez  <jfernandez@igalia.com>
3079
3080         [css-align] Adapt self-alignment properties to the new baseline syntax
3081         https://bugs.webkit.org/show_bug.cgi?id=170235
3082
3083         Reviewed by David Hyatt.
3084
3085         The baseline-position syntax has changed recently, so we need to update
3086         the CSS properties using the old syntax. This patch address only the
3087         self-alignment (align-self and justify-self) and default-alignment
3088         (align-items and justify-items).
3089
3090         The content-distribution properties (align-content and justify-content)
3091         will be updated in a follow up patch.
3092
3093         The new baseline syntax is "[first | last ]? baseline" which implies
3094         modifying the parsing and computed value logic.
3095
3096         There are several layout tests affected by this change, so I'll update
3097         them accordingly.
3098
3099         No new tests, just added/modified some cases to the tests we already have using the new baseline values.
3100
3101         * css/CSSComputedStyleDeclaration.cpp:
3102         (WebCore::valueForItemPositionWithOverflowAlignment):
3103         * css/CSSValueKeywords.in:
3104         * css/StyleBuilderConverter.h:
3105         (WebCore::StyleBuilderConverter::convertSelfOrDefaultAlignmentData):
3106         * css/parser/CSSPropertyParser.cpp:
3107         (WebCore::consumeBaselineKeyword):
3108         (WebCore::consumeSelfPositionOverflowPosition):
3109
3110 2017-03-29  Chris Dumez  <cdumez@apple.com>
3111
3112         Animated SVG images are not paused in pages loaded in the background
3113         https://bugs.webkit.org/show_bug.cgi?id=170043
3114         <rdar://problem/31234412>
3115
3116         Reviewed by Simon Fraser.
3117
3118         Animated SVG images are not paused in pages loaded in the background. We rely
3119         on FrameView::isOffscreen() to stop images animations in background tab (See
3120         logic in RenderElement's shouldRepaintForImageAnimation()). This works fine
3121         if a tab is visble and then becomes hidden (i.e. by switching to another
3122         tab). However, in the case where the tab gets loaded while in the background
3123         (e.g. opening link in new background tab, or session restore), then the
3124         animations would not be paused, due to FrameView::isOffscreen() erroneously
3125         returning false in this case.
3126
3127         Normally, the following chain of events happens:
3128         - Page is visible, we construct a main frame and its FrameView for loading
3129           the page. When a FrameView is constructed, we call FrameView::show() to
3130           make it visible. Then, if the page becomes non-visible, we call
3131           Page::setIsVisibleInternal(false) which calls FrameView::hide(). After
3132           that, FrameView::isOffscreen() correctly returns true because we properly
3133           called FrameView::hide().
3134
3135         However, when doing a load while the Page is hidden, the following was
3136         happening:
3137         - Page is not visible, we call Page::setIsVisibleInternal(false) which tries
3138           to call FrameView::hide() for the main frame but it does not have a FrameView
3139           yet (because the load has not started). We start the load and end up creating
3140           a FrameView. The FrameView constructor was calling FrameView::show()
3141           unconditionally, thus making the FrameView think is visible, even though its
3142           page isn't. At this point, FrameView::isOffscreen() was returning false
3143           and animations would keep running, even though the page is not visible.
3144
3145         To address the issue, we now call FrameView::show() in FrameView::create() only
3146         if the Page is actually visible, instead of calling it unconditionally. If the
3147         page ever becomes visible, Page::setIsVisibleInternal(true) will be called and
3148         it will take care of calling FrameView::show() then.
3149
3150         Tests: svg/animations/animations-paused-in-background-page-iframe.html
3151                svg/animations/animations-paused-in-background-page.html
3152
3153         * page/FrameView.cpp:
3154         (WebCore::FrameView::create):
3155
3156 2017-03-29  Wenson Hsieh  <wenson_hsieh@apple.com>
3157
3158         Links with empty hrefs should not be drag sources
3159         https://bugs.webkit.org/show_bug.cgi?id=170241
3160         <rdar://problem/31305505>
3161
3162         Reviewed by Tim Horton.
3163
3164         The m_dragSouceAction member of DragController represents the drag source actions that are available to the
3165         document, rather than the available actions given the dragging element. Thus, it is not correct to only check
3166         that (m_dragSourceAction & DragSourceActionAttachment) before proceeding down the attachment dragging codepath.
3167         This should be additionally guarded with a check that the element being dragged is, in fact, an attachment
3168         element.
3169
3170         New API test (see Tools/ChangeLog).
3171
3172         * page/DragController.cpp:
3173         (WebCore::DragController::startDrag):
3174
3175 2017-03-29  Jeremy Jones  <jeremyj@apple.com>
3176
3177         WebVideoFullscreenInterfaceAVKit needs a strong self ref before dispatching to the main thread.
3178         https://bugs.webkit.org/show_bug.cgi?id=170129
3179
3180         Reviewed by David Kilzer.
3181
3182         No new tests becuase no new behavior.
3183
3184         Hold a strong reference to WebVideoFullscreenInterfaceAVKit when dispatching to the main thread.
3185         Make WebVideoFullscreenInterfaceAVKit safe to retain from non-main thread.
3186
3187         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
3188         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3189         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
3190
3191 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
3192
3193         [GCrypt] Add a Handle<> class to help with GCrypt object lifetime control
3194         https://bugs.webkit.org/show_bug.cgi?id=170238
3195
3196         Reviewed by Michael Catanzaro.
3197
3198         The platform-specific CryptoAlgorithmHMAC implementation is modified
3199         to showcase the GCrypt::Handle<> use. HandleDeleter<gcry_mac_hd_t>
3200         is added accordingly.
3201
3202         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
3203         (WebCore::calculateSignature):
3204
3205 2017-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
3206
3207         Variation fonts: Make sure that feature detection and preprocessor macros are right
3208         https://bugs.webkit.org/show_bug.cgi?id=169518
3209
3210         Reviewed by Simon Fraser.
3211
3212         When I added variable fonts support, I made all OSes parse the newly accepted values,
3213         instead of just the OSes which support variable fonts.
3214
3215         Test: fast/text/font-variations-feature-detection.html
3216
3217         * css/parser/CSSPropertyParser.cpp:
3218         (WebCore::consumeFontStretch):
3219         (WebCore::consumeFontStyle):
3220         * css/parser/CSSPropertyParserHelpers.cpp:
3221         (WebCore::CSSPropertyParserHelpers::divisibleBy100):
3222         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
3223
3224 2017-03-29  Antoine Quint  <graouts@apple.com>
3225
3226         [Modern Media Controls] Controls bar may disappear while captions menu is visible (redux)
3227         https://bugs.webkit.org/show_bug.cgi?id=170239
3228         <rdar://problem/31320685>
3229
3230         Reviewed by Dean Jackson.
3231
3232         We did some work in webkit.org/b/168751 to prevent the controls bar from disappearing while the
3233         captions menu is visible. But there were two cases where the behavior was not as intended:
3234
3235             1. the controls bar would hide upon exiting the video.
3236             2. clicking on the controls bar while the caption panel is up would hide the controls bar
3237                as well as the captions panel.
3238
3239         Instead of determining that the "userInteractionEnabled" property being set to "false" is indicative
3240         of secondary UI, such as the tracks panel, being attached to the controls bar, we now have an
3241         explicit property to specify this. Now, when "hasSecondaryUIAttached" is "true", we prevent the
3242         controls bar from fading when exiting the media.
3243
3244         Additionally, when dismissing the tracks panel, we check whether a mouse event lead to this and check
3245         if the mouse was positioned over the controls bar. If that is the case, we no longer hide the controls
3246         bar and only dismiss the tracks panel.
3247
3248         Test: media/modern-media-controls/tracks-panel/tracks-panel-controls-bar-remains-visible-after-clicking-over-it.html
3249
3250         * Modules/modern-media-controls/controls/controls-bar.js:
3251         (ControlsBar.prototype.set userInteractionEnabled):
3252         (ControlsBar.prototype.handleEvent):
3253         (ControlsBar.prototype._autoHideTimerFired):
3254         * Modules/modern-media-controls/controls/macos-media-controls.js:
3255         (MacOSMediaControls.prototype.showTracksPanel):
3256         (MacOSMediaControls.prototype.hideTracksPanel):
3257
3258 2017-03-29  Antoine Quint  <graouts@apple.com>
3259
3260         [Modern Media Controls] Volume slider is initially empty
3261         https://bugs.webkit.org/show_bug.cgi?id=170237
3262         <rdar://problem/31319077>
3263
3264         Reviewed by Dean Jackson.
3265
3266         Fixing fallout from https://bugs.webkit.org/show_bug.cgi?id=167935 where we changed the behavior
3267         of layout() to happen prior to a commit. In this one instance, we were overriding layout() to run
3268         after a commit, so we now override commit(). Otherwise, the <canvas> that we draw the volume slider
3269         into would have its "width" and "height" properties set after we drew, which would clear the <canvas>.
3270
3271         * Modules/modern-media-controls/controls/slider.js:
3272         (Slider.prototype.commit):
3273         (Slider.prototype.layout): Deleted.
3274
3275 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
3276
3277         [GCrypt] Move over empty GnuTLS-based SUBTLE_CRYPTO implementation files
3278         https://bugs.webkit.org/show_bug.cgi?id=170232
3279
3280         Reviewed by Michael Catanzaro.
3281
3282         Migrate the GnuTLS SUBTLE_CRYPTO implementation files to the gcrypt/
3283         directory. The implementation files themselves are no-op, so this is
3284         a simple move-and-rename operation that will enable proceeding with
3285         the libgcrypt-based implementation of SUBTLE_CRYPTO functionality.
3286
3287         No change in behavior. The SUBTLE_CRYPTO feature should build as it
3288         did before, and the implementations are empty anyway.
3289
3290         * PlatformGTK.cmake:
3291         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp.
3292         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp.
3293         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp.
3294         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp.
3295         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp.
3296         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp.
3297         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp.
3298         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp: This one already exists.
3299         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp.
3300         * crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp.
3301         * crypto/gcrypt/CryptoKeyECGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp.
3302         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp.
3303         * crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp: Renamed from Source/WebCore/crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp.
3304         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp: Removed.
3305
3306 2017-03-29  Zan Dobersek  <zdobersek@igalia.com>
3307
3308         [GnuTLS] Remove unused CryptoDigestGnuTLS, CryptoAlgorithmHMACGnuTLS implementation files
3309         https://bugs.webkit.org/show_bug.cgi?id=170231
3310
3311         Reviewed by Michael Catanzaro.
3312
3313         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp: Removed. The GCrypt counterpart
3314         is already in use, and this file wasn't even being built.
3315
3316 2017-03-29  Youenn Fablet  <youenn@apple.com>
3317
3318         Move DTMF WebRTC extension behind its own compile flag
3319         https://bugs.webkit.org/show_bug.cgi?id=170226
3320
3321         Reviewed by Eric Carlson.
3322
3323         Moving RTCDTMFSender and RTCDTMFToneChangeEvent behinf a WEB_RTC_DTMF compile flag.
3324         This compile flag is not set on any supported platform yet.
3325         Disabling related test and updated test expectations.
3326
3327         * Modules/mediastream/RTCDTMFSender.cpp:
3328         * Modules/mediastream/RTCDTMFSender.h:
3329         * Modules/mediastream/RTCDTMFSender.idl:
3330         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
3331         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
3332         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
3333         * dom/EventNames.in:
3334         * dom/EventTargetFactory.in:
3335         * platform/mediastream/RTCDTMFSenderHandler.h:
3336         * platform/mediastream/RTCDTMFSenderHandlerClient.h:
3337
3338 2017-03-29  Antoine Quint  <graouts@apple.com>
3339
3340         [mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
3341         https://bugs.webkit.org/show_bug.cgi?id=168409
3342         <rdar://problem/30799198>
3343
3344         Reviewed by Dean Jackson.
3345
3346         Add a new internals setting to opt into ScriptedAnimationController logging through DOM events dispatched
3347         through the document. This should allow this flaky test to get information as to why the frame isn't
3348         firing when it times out.
3349
3350         * dom/ScriptedAnimationController.cpp:
3351         (WebCore::ScriptedAnimationController::suspend):
3352         (WebCore::ScriptedAnimationController::resume):
3353         (WebCore::ScriptedAnimationController::addThrottlingReason):
3354         (WebCore::ScriptedAnimationController::removeThrottlingReason):
3355         (WebCore::ScriptedAnimationController::registerCallback):
3356         (WebCore::ScriptedAnimationController::cancelCallback):
3357         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
3358         (WebCore::ScriptedAnimationController::scheduleAnimation):
3359         (WebCore::ScriptedAnimationController::dispatchLoggingEventIfRequired):
3360         * dom/ScriptedAnimationController.h:
3361         * page/Settings.in:
3362         * testing/InternalSettings.cpp:
3363         (WebCore::InternalSettings::resetToConsistentState):
3364         (WebCore::InternalSettings::shouldDispatchRequestAnimationFrameEvents):
3365         (WebCore::InternalSettings::setShouldDispatchRequestAnimationFrameEvents):
3366         * testing/InternalSettings.h:
3367         * testing/InternalSettings.idl:
3368
3369 2017-03-28  Youenn Fablet  <youenn@apple.com>
3370
3371         [WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
3372         https://bugs.webkit.org/show_bug.cgi?id=170192
3373
3374         Reviewed by Jon Lee.
3375
3376         Covered by updated tests.
3377
3378         * Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
3379         * Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.
3380
3381 2017-03-28  Youenn Fablet  <youenn@apple.com>
3382
3383         LibWebRTCProvider should allow setting encoder and decoder factories
3384         https://bugs.webkit.org/show_bug.cgi?id=170212
3385
3386         Reviewed by Eric Carlson.
3387
3388         No change of behavior.
3389         Adding the ability to set encoder/decoder libwebrtc factory getters.
3390         Setting default cocoa factory getters.
3391
3392         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3393         (WebCore::staticFactoryAndThreads):
3394         (WebCore::initializePeerConnectionFactoryAndThreads):
3395         (WebCore::LibWebRTCProvider::setDecoderFactoryGetter):
3396         (WebCore::LibWebRTCProvider::setEncoderFactoryGetter):
3397         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
3398         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3399
3400 2017-03-27  Brent Fulgham  <bfulgham@apple.com>
3401
3402         Only attach Attributes to a given element one time
3403         https://bugs.webkit.org/show_bug.cgi?id=170125
3404         <rdar://problem/31279676>
3405
3406         Reviewed by Chris Dumez.
3407
3408         Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause
3409         arbitrary JavaScript events to fire. 
3410
3411         Test: fast/dom/Attr/only-attach-attr-once.html
3412
3413         * dom/Element.cpp:
3414         (WebCore::Element::attachAttributeNodeIfNeeded): Added.
3415         (WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'. 
3416         (WebCore::Element::setAttributeNodeNS): Ditto.
3417         * dom/Element.h:
3418
3419 2017-03-28  Youenn Fablet  <youenn@apple.com>
3420
3421         Stop RTCDataChannel when closing page
3422         https://bugs.webkit.org/show_bug.cgi?id=170166
3423
3424         Reviewed by Eric Carlson.
3425
3426         Test: webrtc/datachannel/datachannel-gc.html
3427
3428         Making RTCDataChannel an ActiveDOMObject.
3429         Closing the data channel backend and freeing upon close and stop.
3430
3431         * Modules/mediastream/RTCDataChannel.cpp:
3432         (WebCore::RTCDataChannel::create):
3433         (WebCore::RTCDataChannel::RTCDataChannel):
3434         (WebCore::RTCDataChannel::close):
3435         (WebCore::RTCDataChannel::stop):
3436         * Modules/mediastream/RTCDataChannel.h:
3437         * Modules/mediastream/RTCDataChannel.idl:
3438         * Modules/mediastream/RTCPeerConnection.h:
3439
3440 2017-03-28  Myles C. Maxfield  <mmaxfield@apple.com>
3441
3442         Ranges for variation font properties are not enforced
3443         https://bugs.webkit.org/show_bug.cgi?id=169979
3444
3445         Reviewed by David Hyatt.
3446
3447         The spec specifies that:
3448         - Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
3449         - Font stretch values less than or equal to 0% are parse errors
3450         - Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors
3451
3452         Test: fast/text/variations/out-of-bounds-selection-properties.html
3453
3454         * css/parser/CSSPropertyParser.cpp:
3455         (WebCore::consumeFontWeightRange):
3456         (WebCore::fontStretchIsWithinRange):
3457         (WebCore::consumeFontStretch):
3458         (WebCore::consumeFontStretchRange):
3459         (WebCore::fontStyleIsWithinRange):
3460         (WebCore::consumeFontStyle):
3461         (WebCore::consumeFontStyleRange):
3462
3463 2017-03-28  Andy Estes  <aestes@apple.com>