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