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