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