ea430034e7c38e645649ce73c1ef01f6ac2c0300
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
2
3         [GStreamer][MSE] Playback pipeline
4         https://bugs.webkit.org/show_bug.cgi?id=162901
5
6         Reviewed by Xabier Rodriguez-Calvar.
7
8         Encapsulate the responsibility to interact with the GStreamer playback pipeline and the
9         different streams managed by the WebKitMediaSrc element into a new PlaybackPipeline class.
10
11         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added.
12         (getStreamByTrackId):
13         (getStreamBySourceBufferPrivate):
14         (pushSample):
15         (WebCore::PlaybackPipeline::create):
16         (WebCore::PlaybackPipeline::PlaybackPipeline):
17         (WebCore::PlaybackPipeline::~PlaybackPipeline):
18         (WebCore::PlaybackPipeline::setWebKitMediaSrc):
19         (WebCore::PlaybackPipeline::webKitMediaSrc):
20         (WebCore::PlaybackPipeline::addSourceBuffer):
21         (WebCore::PlaybackPipeline::removeSourceBuffer):
22         (WebCore::PlaybackPipeline::attachTrack):
23         (WebCore::PlaybackPipeline::reattachTrack):
24         (WebCore::PlaybackPipeline::notifyDurationChanged):
25         (WebCore::PlaybackPipeline::markEndOfStream):
26         (WebCore::PlaybackPipeline::flushAndEnqueueNonDisplayingSamples):
27         (WebCore::PlaybackPipeline::enqueueSample):
28         (WebCore::PlaybackPipeline::pipeline):
29         * platform/graphics/gstreamer/mse/PlaybackPipeline.h: Added.
30
31 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
32
33         [GStreamer][MSE][EME] MSE specialization of Media Player Private for GStreamer
34         https://bugs.webkit.org/show_bug.cgi?id=162900
35
36         Reviewed by Xabier Rodriguez-Calvar.
37
38         Refactor MSE-specific logic to its own GStreamer player. This new MSE player coordinates
39         data appending, media playback and interaction with MediaSource by delegating to
40         AppendPipeline (one instance per SourceBuffer), PlaybackPipeline and
41         MediaSourceClientGStreamerMSE/MediaSourcePrivateClient respectively.
42
43         This patch is co-authored with Philippe Normand <philn@igalia.com> (EME support).
44
45         * platform/graphics/MediaPlayer.cpp:
46         (WebCore::buildMediaEnginesVector):
47         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Added.
48         (dumpReadyState):
49         (WebCore::MediaPlayerPrivateGStreamerMSE::registerMediaEngine):
50         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement):
51         (WebCore::MediaPlayerPrivateGStreamerMSE::isAvailable):
52         (WebCore::MediaPlayerPrivateGStreamerMSE::MediaPlayerPrivateGStreamerMSE):
53         (WebCore::MediaPlayerPrivateGStreamerMSE::~MediaPlayerPrivateGStreamerMSE):
54         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
55         (WebCore::MediaPlayerPrivateGStreamerMSE::pause):
56         (WebCore::MediaPlayerPrivateGStreamerMSE::durationMediaTime):
57         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
58         (WebCore::MediaPlayerPrivateGStreamerMSE::configurePlaySink):
59         (WebCore::MediaPlayerPrivateGStreamerMSE::changePipelineState):
60         (WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime):
61         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
62         (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
63         (WebCore::MediaPlayerPrivateGStreamerMSE::updatePlaybackRate):
64         (WebCore::MediaPlayerPrivateGStreamerMSE::seeking):
65         (WebCore::MediaPlayerPrivateGStreamerMSE::setReadyState):
66         (WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted):
67         (WebCore::MediaPlayerPrivateGStreamerMSE::seekCompleted):
68         (WebCore::MediaPlayerPrivateGStreamerMSE::setRate):
69         (WebCore::MediaPlayerPrivateGStreamerMSE::buffered):
70         (WebCore::MediaPlayerPrivateGStreamerMSE::sourceChanged):
71         (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
72         (WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
73         (WebCore::MediaPlayerPrivateGStreamerMSE::isTimeBuffered):
74         (WebCore::MediaPlayerPrivateGStreamerMSE::setMediaSourceClient):
75         (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourceClient):
76         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
77         (WebCore::mimeTypeCache):
78         (WebCore::MediaPlayerPrivateGStreamerMSE::getSupportedTypes):
79         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
80         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
81         (WebCore::MediaPlayerPrivateGStreamerMSE::dispatchDecryptionKey):
82         (WebCore::MediaPlayerPrivateGStreamerMSE::markEndOfStream):
83         (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime):
84         (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable):
85         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h: Added.
86         (WebCore::MediaPlayerPrivateGStreamerMSE::mediaSourcePrivateClient):
87
88 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
89
90         [GStreamer][MSE] MediaSourceGStreamer refactoring
91         https://bugs.webkit.org/show_bug.cgi?id=162899
92
93         Reviewed by Žan Doberšek.
94
95         Move MediaSourceGStreamer to the mse directory, manage SourceBufferPrivates and delegate WebKitMediaSrc operations to the MSE private player.
96
97         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.cpp.
98         (WebCore::MediaSourceGStreamer::open):
99         (WebCore::MediaSourceGStreamer::MediaSourceGStreamer):
100         (WebCore::MediaSourceGStreamer::~MediaSourceGStreamer):
101         (WebCore::MediaSourceGStreamer::addSourceBuffer):
102         (WebCore::MediaSourceGStreamer::removeSourceBuffer):
103         (WebCore::MediaSourceGStreamer::durationChanged):
104         (WebCore::MediaSourceGStreamer::markEndOfStream):
105         (WebCore::MediaSourceGStreamer::unmarkEndOfStream):
106         (WebCore::MediaSourceGStreamer::readyState):
107         (WebCore::MediaSourceGStreamer::setReadyState):
108         (WebCore::MediaSourceGStreamer::waitForSeekCompleted):
109         (WebCore::MediaSourceGStreamer::seekCompleted):
110         (WebCore::MediaSourceGStreamer::sourceBufferPrivateDidChangeActiveState):
111         (WebCore::MediaSourceGStreamer::buffered):
112         * platform/graphics/gstreamer/mse/MediaSourceGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/MediaSourceGStreamer.h.
113
114 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
115
116         [GStreamer][MSE] SourceBufferPrivateGStreamer refactoring
117         https://bugs.webkit.org/show_bug.cgi?id=162898
118
119         Reviewed by Xabier Rodriguez-Calvar.
120
121         Moved SourceBufferPrivateGStreamer to an mse directory and added unimplemented features (abort, enqueueing and sample flow control).
122
123         * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp: Removed.
124         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: Added.
125         (WebCore::SourceBufferPrivateGStreamer::create):
126         (WebCore::SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer):
127         (WebCore::SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer):
128         (WebCore::SourceBufferPrivateGStreamer::setClient):
129         (WebCore::SourceBufferPrivateGStreamer::append):
130         (WebCore::SourceBufferPrivateGStreamer::abort):
131         (WebCore::SourceBufferPrivateGStreamer::resetParserState):
132         (WebCore::SourceBufferPrivateGStreamer::removedFromMediaSource):
133         (WebCore::SourceBufferPrivateGStreamer::readyState):
134         (WebCore::SourceBufferPrivateGStreamer::setReadyState):
135         (WebCore::SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples):
136         (WebCore::SourceBufferPrivateGStreamer::enqueueSample):
137         (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples):
138         (WebCore::SourceBufferPrivateGStreamer::setReadyForMoreSamples):
139         (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples):
140         (WebCore::SourceBufferPrivateGStreamer::setActive):
141         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples):
142         (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples):
143         (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment):
144         (WebCore::SourceBufferPrivateGStreamer::didReceiveSample):
145         (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples):
146         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Renamed from Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h.
147
148 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
149
150         [GStreamer][MSE] MediaSourceClientGStreamerMSE
151         https://bugs.webkit.org/show_bug.cgi?id=162896
152
153         Reviewed by Xabier Rodriguez-Calvar.
154
155         This class encapsulates the MediaSource interaction responsibility for the
156         GStreamer platform.
157
158         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp: Added.
159         (WebCore::MediaSourceClientGStreamerMSE::create):
160         (WebCore::MediaSourceClientGStreamerMSE::MediaSourceClientGStreamerMSE):
161         (WebCore::MediaSourceClientGStreamerMSE::~MediaSourceClientGStreamerMSE):
162         (WebCore::MediaSourceClientGStreamerMSE::addSourceBuffer):
163         (WebCore::MediaSourceClientGStreamerMSE::duration):
164         (WebCore::MediaSourceClientGStreamerMSE::durationChanged):
165         (WebCore::MediaSourceClientGStreamerMSE::abort):
166         (WebCore::MediaSourceClientGStreamerMSE::append):
167         (WebCore::MediaSourceClientGStreamerMSE::markEndOfStream):
168         (WebCore::MediaSourceClientGStreamerMSE::removedFromMediaSource):
169         (WebCore::MediaSourceClientGStreamerMSE::flushAndEnqueueNonDisplayingSamples):
170         (WebCore::MediaSourceClientGStreamerMSE::enqueueSample):
171         (WebCore::MediaSourceClientGStreamerMSE::webKitMediaSrc):
172         (WebCore::MediaSourceClientGStreamerMSE::clearPlayerPrivate):
173         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h: Added.
174
175 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
176
177         [GStreamer] GStreamer Media Sample
178         https://bugs.webkit.org/show_bug.cgi?id=162894
179
180         Reviewed by Xabier Rodriguez-Calvar.
181
182         Implement the MediaSample interface for the GStreamer platform.
183
184         * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp: Added.
185         (WebCore::GStreamerMediaSample::GStreamerMediaSample):
186         (WebCore::GStreamerMediaSample::create):
187         (WebCore::GStreamerMediaSample::createFakeSample):
188         (WebCore::GStreamerMediaSample::applyPtsOffset):
189         (WebCore::GStreamerMediaSample::offsetTimestampsBy):
190         (WebCore::GStreamerMediaSample::~GStreamerMediaSample):
191         * platform/graphics/gstreamer/mse/GStreamerMediaSample.h: Added.
192         (WebCore::GStreamerMediaSample::presentationTime):
193         (WebCore::GStreamerMediaSample::decodeTime):
194         (WebCore::GStreamerMediaSample::duration):
195         (WebCore::GStreamerMediaSample::trackID):
196         (WebCore::GStreamerMediaSample::setTrackID):
197         (WebCore::GStreamerMediaSample::sizeInBytes):
198         (WebCore::GStreamerMediaSample::sample):
199         (WebCore::GStreamerMediaSample::presentationSize):
200         (WebCore::GStreamerMediaSample::setTimestamps):
201         (WebCore::GStreamerMediaSample::isDivisable):
202         (WebCore::GStreamerMediaSample::divide):
203         (WebCore::GStreamerMediaSample::flags):
204         (WebCore::GStreamerMediaSample::platformSample):
205         (WebCore::GStreamerMediaSample::dump):
206
207 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
208
209         [GStreamer] GStreamer Media Description
210         https://bugs.webkit.org/show_bug.cgi?id=162893
211
212         Reviewed by Xabier Rodriguez-Calvar.
213
214         Implement the MediaDescription interface for the GStreamer platform.
215
216         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp: Added.
217         (WebCore::GStreamerMediaDescription::codec):
218         (WebCore::GStreamerMediaDescription::isVideo):
219         (WebCore::GStreamerMediaDescription::isAudio):
220         (WebCore::GStreamerMediaDescription::isText):
221         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h: Added.
222         (WebCore::GStreamerMediaDescription::create):
223         (WebCore::GStreamerMediaDescription::~GStreamerMediaDescription):
224         (WebCore::GStreamerMediaDescription::GStreamerMediaDescription):
225
226 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
227
228         [GStreamer][MSE][EME] Append Pipeline
229         https://bugs.webkit.org/show_bug.cgi?id=162874
230
231         Reviewed by Žan Doberšek.
232
233         This patch is co-authored with Xabier Rodriguez-Calvar <calvaris@igalia.com> (data starve
234         and last sample detection, debug features) and Philippe Normand <philn@igalia.com> (EME
235         support).
236
237         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added.
238         (WebCore::dumpAppendState):
239         (WebCore::appendPipelineElementMessageCallback):
240         (WebCore::appendPipelineApplicationMessageCallback):
241         (WebCore::AppendPipeline::AppendPipeline):
242         (WebCore::AppendPipeline::~AppendPipeline):
243         (WebCore::AppendPipeline::clearPlayerPrivate):
244         (WebCore::AppendPipeline::handleElementMessage):
245         (WebCore::AppendPipeline::handleApplicationMessage):
246         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
247         (WebCore::AppendPipeline::handleAppsrcAtLeastABufferLeft):
248         (WebCore::AppendPipeline::id):
249         (WebCore::AppendPipeline::setAppendState):
250         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
251         (WebCore::AppendPipeline::appsinkCapsChanged):
252         (WebCore::AppendPipeline::checkEndOfAppend):
253         (WebCore::AppendPipeline::appsinkNewSample):
254         (WebCore::AppendPipeline::appsinkEOS):
255         (WebCore::AppendPipeline::didReceiveInitializationSegment):
256         (WebCore::AppendPipeline::trackId):
257         (WebCore::AppendPipeline::resetPipeline):
258         (WebCore::AppendPipeline::setAppsrcDataLeavingProbe):
259         (WebCore::AppendPipeline::removeAppsrcDataLeavingProbe):
260         (WebCore::AppendPipeline::abort):
261         (WebCore::AppendPipeline::pushNewBuffer):
262         (WebCore::AppendPipeline::reportAppsrcAtLeastABufferLeft):
263         (WebCore::AppendPipeline::reportAppsrcNeedDataReceived):
264         (WebCore::AppendPipeline::handleNewAppsinkSample):
265         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
266         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
267         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
268         (WebCore::appendPipelineAppsinkCapsChanged):
269         (WebCore::appendPipelineAppsrcDataLeaving):
270         (WebCore::appendPipelinePadProbeDebugInformation):
271         (WebCore::appendPipelineAppsrcNeedData):
272         (WebCore::appendPipelineDemuxerPadAdded):
273         (WebCore::appendPipelineDemuxerPadRemoved):
274         (WebCore::appendPipelineAppsinkNewSample):
275         (WebCore::appendPipelineAppsinkEOS):
276         * platform/graphics/gstreamer/mse/AppendPipeline.h: Added.
277         (WebCore::AppendPipeline::appendState):
278         (WebCore::AppendPipeline::mediaSourceClient):
279         (WebCore::AppendPipeline::sourceBufferPrivate):
280         (WebCore::AppendPipeline::bus):
281         (WebCore::AppendPipeline::pipeline):
282         (WebCore::AppendPipeline::appsrc):
283         (WebCore::AppendPipeline::appsink):
284         (WebCore::AppendPipeline::demuxerSrcPadCaps):
285         (WebCore::AppendPipeline::appsinkCaps):
286         (WebCore::AppendPipeline::track):
287         (WebCore::AppendPipeline::streamType):
288
289 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
290
291         [GStreamer] Drain query support
292         https://bugs.webkit.org/show_bug.cgi?id=162872
293
294         Reviewed by Žan Doberšek.
295
296         Under some circumstances, GStreamer deadlocks completely during MSE seeks on OpenGL ES
297         systems. This is because the video sink still holds samples. Proper DRAIN support
298         fixes this issue and is also good for all the platforms, not only OpenGL ES.
299
300         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
301         (WebCore::MediaPlayerPrivateGStreamerBase::triggerDrain):
302         (WebCore::MediaPlayerPrivateGStreamerBase::drainCallback):
303         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
304         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Deleted.
305         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
306         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
307         (VideoRenderRequestScheduler::drain):
308         (webkitVideoSinkQuery):
309         (webkitVideoSinkEvent):
310         (webkit_video_sink_class_init):
311         (VideoRenderRequestScheduler::stop): Deleted.
312         (webkitVideoSinkProposeAllocation): Deleted.
313
314 2016-10-26  Enrique Ocaña González  <eocanha@igalia.com>
315
316         [GStreamer] Track enhancements for MSE support
317         https://bugs.webkit.org/show_bug.cgi?id=162869
318
319         Reviewed by Xabier Rodriguez-Calvar.
320
321         Add 'id' field to Audio/VideoTrackPrivateGStreamer. Make TrackPrivateBaseGStreamer
322         work anyway in cases where the demuxer isn't contained in a GstPlaybin.
323
324         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
325         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
326         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
327         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
328         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
329         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged):
330         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
331         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
332         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
333
334 2016-10-26  Youenn Fablet  <youenn@apple.com>
335
336         Make CachedResourceLoader originsMatch check more efficient
337         https://bugs.webkit.org/show_bug.cgi?id=163938
338
339         Reviewed by Darin Adler.
340
341         No change of behavior.
342
343         * loader/cache/CachedResourceLoader.cpp:
344         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
345         (WebCore::originsMatch): Moved to SecurityOrigin.cpp.
346         * page/SecurityOrigin.cpp:
347         (WebCore::areOriginsMatching): Helper routine to check whether origins are matching.
348         (WebCore::originsMatch): Ensuring string comparison provides the same result as this function.
349         * page/SecurityOrigin.h:
350         (WebCore::SecurityOrigin::protocol):
351         (WebCore::SecurityOrigin::host):
352         (WebCore::SecurityOrigin::domain):
353
354 2016-10-25  Yusuke Suzuki  <utatane.tea@gmail.com>
355
356         [DOMJIT] Tell IDL result type to DFG to drop type checks in AI
357         https://bugs.webkit.org/show_bug.cgi?id=163900
358
359         Reviewed by Sam Weinig.
360
361         Add TestDOMJIT.idl for bindings generation tests.
362
363         * bindings/scripts/CodeGeneratorJS.pm:
364         (GetResultTypeFilter):
365         (GenerateImplementation):
366         * bindings/scripts/test/JS/JSTestDOMJIT.cpp: Added.
367         (WebCore::JSTestDOMJITPrototype::create):
368         (WebCore::JSTestDOMJITPrototype::createStructure):
369         (WebCore::JSTestDOMJITPrototype::JSTestDOMJITPrototype):
370         (WebCore::JSTestDOMJITConstructor::prototypeForStructure):
371         (WebCore::JSTestDOMJITConstructor::initializeProperties):
372         (WebCore::JSTestDOMJITPrototype::finishCreation):
373         (WebCore::JSTestDOMJIT::JSTestDOMJIT):
374         (WebCore::JSTestDOMJIT::createPrototype):
375         (WebCore::JSTestDOMJIT::prototype):
376         (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute):
377         (WebCore::jsTestDOMJITAnyAttr):
378         (WebCore::jsTestDOMJITAnyAttrGetter):
379         (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT):
380         (WebCore::domJITGetterSetterForTestDOMJITAnyAttr):
381         (WebCore::jsTestDOMJITBooleanAttr):
382         (WebCore::jsTestDOMJITBooleanAttrGetter):
383         (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT):
384         (WebCore::domJITGetterSetterForTestDOMJITBooleanAttr):
385         (WebCore::jsTestDOMJITByteAttr):
386         (WebCore::jsTestDOMJITByteAttrGetter):
387         (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT):
388         (WebCore::domJITGetterSetterForTestDOMJITByteAttr):
389         (WebCore::jsTestDOMJITOctetAttr):
390         (WebCore::jsTestDOMJITOctetAttrGetter):
391         (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT):
392         (WebCore::domJITGetterSetterForTestDOMJITOctetAttr):
393         (WebCore::jsTestDOMJITShortAttr):
394         (WebCore::jsTestDOMJITShortAttrGetter):
395         (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT):
396         (WebCore::domJITGetterSetterForTestDOMJITShortAttr):
397         (WebCore::jsTestDOMJITUnsignedShortAttr):
398         (WebCore::jsTestDOMJITUnsignedShortAttrGetter):
399         (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT):
400         (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortAttr):
401         (WebCore::jsTestDOMJITLongAttr):
402         (WebCore::jsTestDOMJITLongAttrGetter):
403         (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT):
404         (WebCore::domJITGetterSetterForTestDOMJITLongAttr):
405         (WebCore::jsTestDOMJITUnsignedLongAttr):
406         (WebCore::jsTestDOMJITUnsignedLongAttrGetter):
407         (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT):
408         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongAttr):
409         (WebCore::jsTestDOMJITLongLongAttr):
410         (WebCore::jsTestDOMJITLongLongAttrGetter):
411         (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT):
412         (WebCore::domJITGetterSetterForTestDOMJITLongLongAttr):
413         (WebCore::jsTestDOMJITUnsignedLongLongAttr):
414         (WebCore::jsTestDOMJITUnsignedLongLongAttrGetter):
415         (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT):
416         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongAttr):
417         (WebCore::jsTestDOMJITFloatAttr):
418         (WebCore::jsTestDOMJITFloatAttrGetter):
419         (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT):
420         (WebCore::domJITGetterSetterForTestDOMJITFloatAttr):
421         (WebCore::jsTestDOMJITUnrestrictedFloatAttr):
422         (WebCore::jsTestDOMJITUnrestrictedFloatAttrGetter):
423         (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT):
424         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatAttr):
425         (WebCore::jsTestDOMJITDoubleAttr):
426         (WebCore::jsTestDOMJITDoubleAttrGetter):
427         (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT):
428         (WebCore::domJITGetterSetterForTestDOMJITDoubleAttr):
429         (WebCore::jsTestDOMJITUnrestrictedDoubleAttr):
430         (WebCore::jsTestDOMJITUnrestrictedDoubleAttrGetter):
431         (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT):
432         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleAttr):
433         (WebCore::jsTestDOMJITDomStringAttr):
434         (WebCore::jsTestDOMJITDomStringAttrGetter):
435         (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT):
436         (WebCore::domJITGetterSetterForTestDOMJITDomStringAttr):
437         (WebCore::jsTestDOMJITByteStringAttr):
438         (WebCore::jsTestDOMJITByteStringAttrGetter):
439         (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT):
440         (WebCore::domJITGetterSetterForTestDOMJITByteStringAttr):
441         (WebCore::jsTestDOMJITUsvStringAttr):
442         (WebCore::jsTestDOMJITUsvStringAttrGetter):
443         (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT):
444         (WebCore::domJITGetterSetterForTestDOMJITUsvStringAttr):
445         (WebCore::jsTestDOMJITNodeAttr):
446         (WebCore::jsTestDOMJITNodeAttrGetter):
447         (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT):
448         (WebCore::domJITGetterSetterForTestDOMJITNodeAttr):
449         (WebCore::jsTestDOMJITBooleanNullableAttr):
450         (WebCore::jsTestDOMJITBooleanNullableAttrGetter):
451         (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT):
452         (WebCore::domJITGetterSetterForTestDOMJITBooleanNullableAttr):
453         (WebCore::jsTestDOMJITByteNullableAttr):
454         (WebCore::jsTestDOMJITByteNullableAttrGetter):
455         (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT):
456         (WebCore::domJITGetterSetterForTestDOMJITByteNullableAttr):
457         (WebCore::jsTestDOMJITOctetNullableAttr):
458         (WebCore::jsTestDOMJITOctetNullableAttrGetter):
459         (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT):
460         (WebCore::domJITGetterSetterForTestDOMJITOctetNullableAttr):
461         (WebCore::jsTestDOMJITShortNullableAttr):
462         (WebCore::jsTestDOMJITShortNullableAttrGetter):
463         (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT):
464         (WebCore::domJITGetterSetterForTestDOMJITShortNullableAttr):
465         (WebCore::jsTestDOMJITUnsignedShortNullableAttr):
466         (WebCore::jsTestDOMJITUnsignedShortNullableAttrGetter):
467         (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT):
468         (WebCore::domJITGetterSetterForTestDOMJITUnsignedShortNullableAttr):
469         (WebCore::jsTestDOMJITLongNullableAttr):
470         (WebCore::jsTestDOMJITLongNullableAttrGetter):
471         (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT):
472         (WebCore::domJITGetterSetterForTestDOMJITLongNullableAttr):
473         (WebCore::jsTestDOMJITUnsignedLongNullableAttr):
474         (WebCore::jsTestDOMJITUnsignedLongNullableAttrGetter):
475         (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT):
476         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongNullableAttr):
477         (WebCore::jsTestDOMJITLongLongNullableAttr):
478         (WebCore::jsTestDOMJITLongLongNullableAttrGetter):
479         (WebCore::TestDOMJITLongLongNullableAttrDOMJIT::TestDOMJITLongLongNullableAttrDOMJIT):
480         (WebCore::domJITGetterSetterForTestDOMJITLongLongNullableAttr):
481         (WebCore::jsTestDOMJITUnsignedLongLongNullableAttr):
482         (WebCore::jsTestDOMJITUnsignedLongLongNullableAttrGetter):
483         (WebCore::TestDOMJITUnsignedLongLongNullableAttrDOMJIT::TestDOMJITUnsignedLongLongNullableAttrDOMJIT):
484         (WebCore::domJITGetterSetterForTestDOMJITUnsignedLongLongNullableAttr):
485         (WebCore::jsTestDOMJITFloatNullableAttr):
486         (WebCore::jsTestDOMJITFloatNullableAttrGetter):
487         (WebCore::TestDOMJITFloatNullableAttrDOMJIT::TestDOMJITFloatNullableAttrDOMJIT):
488         (WebCore::domJITGetterSetterForTestDOMJITFloatNullableAttr):
489         (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttr):
490         (WebCore::jsTestDOMJITUnrestrictedFloatNullableAttrGetter):
491         (WebCore::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT):
492         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedFloatNullableAttr):
493         (WebCore::jsTestDOMJITDoubleNullableAttr):
494         (WebCore::jsTestDOMJITDoubleNullableAttrGetter):
495         (WebCore::TestDOMJITDoubleNullableAttrDOMJIT::TestDOMJITDoubleNullableAttrDOMJIT):
496         (WebCore::domJITGetterSetterForTestDOMJITDoubleNullableAttr):
497         (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttr):
498         (WebCore::jsTestDOMJITUnrestrictedDoubleNullableAttrGetter):
499         (WebCore::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT):
500         (WebCore::domJITGetterSetterForTestDOMJITUnrestrictedDoubleNullableAttr):
501         (WebCore::jsTestDOMJITDomStringNullableAttr):
502         (WebCore::jsTestDOMJITDomStringNullableAttrGetter):
503         (WebCore::TestDOMJITDomStringNullableAttrDOMJIT::TestDOMJITDomStringNullableAttrDOMJIT):
504         (WebCore::domJITGetterSetterForTestDOMJITDomStringNullableAttr):
505         (WebCore::jsTestDOMJITByteStringNullableAttr):
506         (WebCore::jsTestDOMJITByteStringNullableAttrGetter):
507         (WebCore::TestDOMJITByteStringNullableAttrDOMJIT::TestDOMJITByteStringNullableAttrDOMJIT):
508         (WebCore::domJITGetterSetterForTestDOMJITByteStringNullableAttr):
509         (WebCore::jsTestDOMJITUsvStringNullableAttr):
510         (WebCore::jsTestDOMJITUsvStringNullableAttrGetter):
511         (WebCore::TestDOMJITUsvStringNullableAttrDOMJIT::TestDOMJITUsvStringNullableAttrDOMJIT):
512         (WebCore::domJITGetterSetterForTestDOMJITUsvStringNullableAttr):
513         (WebCore::jsTestDOMJITNodeNullableAttr):
514         (WebCore::jsTestDOMJITNodeNullableAttrGetter):
515         (WebCore::TestDOMJITNodeNullableAttrDOMJIT::TestDOMJITNodeNullableAttrDOMJIT):
516         (WebCore::domJITGetterSetterForTestDOMJITNodeNullableAttr):
517         (WebCore::jsTestDOMJITConstructor):
518         (WebCore::setJSTestDOMJITConstructor):
519         (WebCore::JSTestDOMJIT::getConstructor):
520         (WebCore::JSTestDOMJIT::visitChildren):
521         * bindings/scripts/test/JS/JSTestDOMJIT.h: Added.
522         (WebCore::JSTestDOMJIT::create):
523         (WebCore::JSTestDOMJIT::createStructure):
524         (WebCore::JSTestDOMJIT::wrapped):
525         (WebCore::JSTestDOMJIT::finishCreation):
526         * bindings/scripts/test/TestDOMJIT.idl: Added.
527
528 2016-10-25  Brent Fulgham  <bfulgham@apple.com>
529
530         [Win] Unreviewed build fix.
531
532         * platform/graphics/GraphicsContext.h: Add missing declaration.
533
534 2016-10-25  Ryosuke Niwa  <rniwa@webkit.org>
535
536         Updating attribute by textContent must create a single mutation record and custom element reaction
537         https://bugs.webkit.org/show_bug.cgi?id=164003
538
539         Reviewed by Chris Dumez.
540
541         The bug was caused by setTextContent not invoking setNodeValue for Attr nodes.
542         Use setNodeValue to match the specification: https://dom.spec.whatwg.org/#dom-node-textcontent
543
544         Test: fast/dom/MutationObserver/text-content-on-attr.html
545
546         * dom/Node.cpp:
547         (WebCore::Node::setTextContent):
548
549 2016-10-25  Brent Fulgham  <bfulgham@apple.com>
550
551         [Win][Direct2D] Use smart pointers for Direct2D Path types
552         https://bugs.webkit.org/show_bug.cgi?id=163994
553
554         Reviewed by Alex Christensen.
555
556         Tested by existing path tests.
557
558         * platform/graphics/Path.h:
559         (WebCore::Path::platformPath): Use a COMPtr for m_path.
560         * platform/graphics/win/GraphicsContextDirect2D.cpp:
561         (WebCore::GraphicsContext::systemFactory): Present better D2D debug output
562         when running a debug build.
563         (WebCore::GraphicsContext::platformInit): Initialize a D2D device from a
564         native GDI device context.
565         (WebCore::GraphicsContext::platformStrokeStyle): Added.
566         (WebCore::GraphicsContext::clipBounds): Simplify clip boundary calculations and
567         avoid doing math on infinities.
568         * platform/graphics/win/PathDirect2D.cpp:
569         (WebCore::scratchRenderTarget): Added.
570         (WebCore::Path::~Path): Switch to COMPtr implementation.
571         (WebCore::Path::ensurePlatformPath): Ditto.
572         (WebCore::Path::appendGeometry): Ditto.
573         (WebCore::Path::operator=): Ditto.
574         (WebCore::Path::initializePathState): Ditto.
575         (WebCore::Path::strokeContains): Provide an implementation.
576         (WebCore::Path::transform): Ditto.
577         (WebCore::Path::addEllipse): No need for explicit construction of the
578         D2D1::Point2F object.
579         (WebCore::Path::clear): Switch to COMPtr implementation.
580
581 2016-10-25  Nan Wang  <n_wang@apple.com>
582
583         LayoutTest accessibility/mac/meter-gauge-value-description.html failing
584         https://bugs.webkit.org/show_bug.cgi?id=163997
585         <rdar://problem/28948637>
586
587         Reviewed by Chris Fleizach.
588
589         I hand-edited the Localizable.strings file in a previous patch and my changes
590         were replaced by running update-webkit-localizable-strings script. Changed the
591         key to be the same as the value to keep consistency with other entries.
592
593         Re-enabled the failing test.
594
595         * English.lproj/Localizable.strings:
596         * platform/LocalizedStrings.cpp:
597         (WebCore::AXMeterGaugeRegionOptimumText):
598         (WebCore::AXMeterGaugeRegionSuboptimalText):
599         (WebCore::AXMeterGaugeRegionLessGoodText):
600
601 2016-10-25  Filip Pizlo  <fpizlo@apple.com>
602
603         HeapTimer should not hardcode all of its subclasses and USE(CF) shouldn't be a bizarre special case
604         https://bugs.webkit.org/show_bug.cgi?id=163947
605
606         Reviewed by Geoffrey Garen.
607
608         No new tests because no new behavior.
609
610         * platform/ios/WebSafeGCActivityCallbackIOS.h:
611         * platform/ios/WebSafeIncrementalSweeperIOS.h:
612
613 2016-10-25  Dave Hyatt  <hyatt@apple.com>
614
615         [CSS Parser] Improvements to selector parsing
616         https://bugs.webkit.org/show_bug.cgi?id=163964
617
618         Reviewed by Zalan Bujtas.
619
620         * css/CSSSelector.cpp:
621         (WebCore::CSSSelector::setAttribute):
622         (WebCore::CSSSelector::setNth):
623         * css/CSSSelector.h:
624         (WebCore::CSSSelector::setAttributeValueMatchingIsCaseInsensitive):
625         * css/StyleSheetContents.cpp:
626         (WebCore::StyleSheetContents::StyleSheetContents):
627         (WebCore::StyleSheetContents::parserAppendRule):
628         (WebCore::StyleSheetContents::ruleAt):
629         (WebCore::StyleSheetContents::ruleCount):
630         (WebCore::StyleSheetContents::clearRules):
631         (WebCore::StyleSheetContents::wrapperInsertRule):
632         (WebCore::StyleSheetContents::wrapperDeleteRule):
633         * css/StyleSheetContents.h:
634         * css/parser/CSSParser.cpp:
635         (WebCore::CSSParserContext::CSSParserContext):
636         (WebCore::CSSParser::parseSelector):
637         * css/parser/CSSParserValues.h:
638         (WebCore::CSSParserSelector::setAttribute):
639         (WebCore::CSSParserSelector::setArgument):
640         (WebCore::CSSParserSelector::setNth):
641         * css/parser/CSSSelectorParser.cpp:
642         (WebCore::consumeLangArgumentList):
643         (WebCore::CSSSelectorParser::consumeCompoundSelector):
644         (WebCore::CSSSelectorParser::consumeAttribute):
645         (WebCore::isPseudoClassFunction):
646         (WebCore::isPseudoElementFunction):
647         (WebCore::CSSSelectorParser::consumePseudo):
648         (WebCore::CSSSelectorParser::consumeCombinator):
649
650 2016-10-25  Beth Dakin  <bdakin@apple.com>
651
652         Numbered list should be represented without ‘…’
653         https://bugs.webkit.org/show_bug.cgi?id=163992
654         -and corresponding-
655         rdar://problem/28911337
656
657         Reviewed by Darin Adler.
658
659         * English.lproj/Localizable.strings:
660         * platform/LocalizedStrings.cpp:
661         (WebCore::insertListTypeNumbered):
662
663 2016-10-25  Daniel Bates  <dabates@apple.com>
664
665         REGRESSION (r178265): XSS Auditor fails to block document.write() of incomplete tag
666         https://bugs.webkit.org/show_bug.cgi?id=163978
667         <rdar://problem/25962131>
668
669         Reviewed by Darin Adler.
670
671         During the tokenization process of an HTML tag the start and end positions of each of its
672         attributes is tracked so that the XSS Auditor can request a snippet around a suspected
673         injected attribute. We need to take care to consider document.write() boundaries when
674         tracking the start and end positions of each HTML tag and attribute so that the XSS Auditor
675         receives the correct snippet. Following r178265 we no longer consider document.write()
676         boundaries when tracking the start and end positions of attributes. So, the substring
677         represented by the start and end positions of an attribute may correspond to some other
678         attribute in the tag. Therefore the XSS Auditor may fail to block an injection because the
679         snippet it requested may not be the snippet that it intended to request.
680
681         Tests: http/tests/security/xssAuditor/dom-write-location-dom-write-open-img-onerror.html
682                http/tests/security/xssAuditor/dom-write-location-open-img-onerror.html
683                http/tests/security/xssAuditor/nested-dom-write-location-open-img-onerror.html
684
685         * html/parser/HTMLSourceTracker.cpp:
686         (WebCore::HTMLSourceTracker::startToken): Set the attribute base offset to be the token
687         start position.
688         (WebCore::HTMLSourceTracker::source): Use the specified attribute start position as-is. We no
689         longer adjust it here because it was adjusted with respect to the attribute base offset, which
690         takes into account document.write() boundaries.
691         * html/parser/HTMLToken.h:
692         (WebCore::HTMLToken::setAttributeBaseOffset): Added.
693         (WebCore::HTMLToken::beginAttribute): Subtract attribute base offset from the specified offset.
694         (WebCore::HTMLToken::endAttribute): Ditto.
695         * html/parser/HTMLTokenizer.h:
696         (WebCore::HTMLTokenizer::setTokenAttributeBaseOffset): Added.
697
698 2016-10-25  Chris Dumez  <cdumez@apple.com>
699
700         IDBDatabase.transaction() should take a union in parameter
701         https://bugs.webkit.org/show_bug.cgi?id=163966
702
703         Reviewed by Sam Weinig.
704
705         IDBDatabase.transaction() should take a union in parameter:
706         - https://www.w3.org/TR/IndexedDB/#widl-IDBDatabase-transaction-IDBTransaction-DOMString-sequence-DOMString--storeNames-IDBTransactionMode-mode
707
708         No new tests, no expected Web-exposed behavior change.
709
710         * Modules/indexeddb/IDBDatabase.cpp:
711         (WebCore::IDBDatabase::transaction):
712         * Modules/indexeddb/IDBDatabase.h:
713         * Modules/indexeddb/IDBDatabase.idl:
714
715 2016-10-25  Brady Eidson  <beidson@apple.com>
716
717         IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
718         <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
719
720         Reviewed by Andy Estes.
721
722         No new tests (Covered by changes to existing tests)
723
724         * Modules/indexeddb/IDBCursor.cpp:
725         (WebCore::IDBCursor::create):
726         * Modules/indexeddb/IDBCursor.h:
727
728         * Modules/indexeddb/IDBObjectStore.cpp:
729         (WebCore::IDBObjectStore::openCursor):
730         (WebCore::IDBObjectStore::openKeyCursor):
731         * Modules/indexeddb/IDBObjectStore.h:
732         * Modules/indexeddb/IDBObjectStore.idl:
733
734         * Modules/indexeddb/IDBTransaction.cpp:
735         (WebCore::IDBTransaction::requestOpenCursor):
736
737         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
738         (WebCore::IDBServer::MemoryObjectStoreCursor::currentData): Only grab the current value
739           if the cursor is KeyAndValue.
740
741         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
742         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
743         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Only save off the data for an
744           object store cursor if it's both KeyAndValue.
745         * Modules/indexeddb/server/SQLiteIDBCursor.h:
746
747         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
748         (WebCore::IDBCursorInfo::objectStoreCursor): Allow for a KeyOnly ObjectStoreCursor.
749         * Modules/indexeddb/shared/IDBCursorInfo.h:
750
751 2016-10-25  Wenson Hsieh  <wenson_hsieh@apple.com>
752
753         Support InputEvent.dataTransfer for the InputEvent spec
754         https://bugs.webkit.org/show_bug.cgi?id=163213
755         <rdar://problem/28700407>
756
757         Reviewed by Ryosuke Niwa.
758
759         Adds support for the dataTransfer attribute of InputEvent, which contains both HTML and plain text
760         representations of inserted content corresponding to input types "insertFromPaste", "insertFromDrop" and
761         "insertReplacementText". The specification calls for the data transfer's drag data item list to contain this
762         information via two entries with type strings "text/html" and "text/plain". However, WebKit does not yet support
763         the DataTransfer.items -- in lieu of this, we will provide this information for now via getData("text/plain")
764         and getData("text/html"), respectively.
765
766         To support this attribute, we need a special type of DataTransfer which is readonly and returns canned data
767         given a type string. To implement this, we introduce StaticPasteboard, a type of Pasteboard which is initialized
768         with a map of type string to data. When asked for its data via getData, the StaticPasteboard searches its map
769         for the requested type and returns the result, if any.
770
771         An editing command may now create a new DataTransfer via DataTransfer::createForInputEvent from HTML and
772         plaintext strings, and then vend this information to its dispatched input events by overriding
773         CompositeEditCommand::inputEventDataTransfer.
774
775         Some further work will be needed to ensure that all information exposed via this DataTransfer does not contain
776         hidden content. To do this, we should create a new Document, "paste" the contents of our copied HTML string into
777         it, then simulate selecting the content and generating markup from the selection to create a sanitized
778         DocumentFragment corresponding to the original copied HTML. This will be addressed in a future patch.
779
780         Tests: fast/events/input-events-paste-rich-datatransfer.html
781                fast/events/input-events-spell-checking-datatransfer.html
782
783         * PlatformEfl.cmake:
784         * PlatformGTK.cmake:
785         * PlatformWin.cmake:
786
787         Add StaticPasteboard.cpp.
788
789         * WebCore.xcodeproj/project.pbxproj:
790         * dom/DataTransfer.cpp:
791         (WebCore::DataTransfer::DataTransfer):
792         (WebCore::DataTransfer::createForInputEvent):
793
794         Initializes a new DataTransfer for the purposes of input events. This takes a HTML and plain text
795         representations of the data being inserted and creates a new readonly DataTransfer backed by a StaticPasteboard
796         that only knows how to map the "text/plain" data type to the given plaintext string and "text/html" to the
797         given HTML text.
798
799         * dom/DataTransfer.h:
800         * dom/InputEvent.cpp:
801         (WebCore::InputEvent::create):
802         (WebCore::InputEvent::InputEvent):
803         (WebCore::InputEvent::dataTransfer):
804         * dom/InputEvent.h:
805         * dom/InputEvent.idl:
806
807         Add the InputEvent.dataTransfer attribute.
808
809         * dom/Node.cpp:
810         * editing/CompositeEditCommand.cpp:
811         (WebCore::CompositeEditCommand::inputEventDataTransfer):
812
813         Add a new hook for CompositeEditCommands to vend a DataTransfer for the purposes of input events. By default,
814         this is null.
815
816         * editing/CompositeEditCommand.h:
817         * editing/Editor.cpp:
818         (WebCore::dispatchBeforeInputEvent):
819         (WebCore::dispatchInputEvent):
820         (WebCore::dispatchBeforeInputEvents):
821         (WebCore::dispatchInputEvents):
822         (WebCore::Editor::willApplyEditing):
823         (WebCore::Editor::appliedEditing):
824         * editing/ReplaceRangeWithTextCommand.cpp:
825         (WebCore::ReplaceRangeWithTextCommand::willApplyCommand):
826         (WebCore::ReplaceRangeWithTextCommand::doApply):
827         (WebCore::ReplaceRangeWithTextCommand::inputEventDataTransfer):
828         * editing/ReplaceRangeWithTextCommand.h:
829         * editing/ReplaceSelectionCommand.cpp:
830         (WebCore::ReplaceSelectionCommand::willApplyCommand):
831
832         Initialize the ReplacementFragment here before applying the command, adjusting the DocumentFragment to be
833         inserted in the process.
834
835         (WebCore::ReplaceSelectionCommand::doApply):
836         (WebCore::ReplaceSelectionCommand::inputEventDataTransfer):
837         (WebCore::ReplaceSelectionCommand::ensureReplacementFragment):
838
839         Returns the ReplacementFragment used to apply the command, initializing it if necessary and stripping extraneous
840         nodes off of the document fragment in the process. Since ReplaceSelectionCommand may be used as a top-level
841         editing command or a child of another CompositeEditCommand such as the ReplaceRangeWithTextCommand, the
842         ReplacementFragment may be initialized either in willApplyCommand or in doApply.
843
844         * editing/ReplaceSelectionCommand.h:
845         * editing/SpellingCorrectionCommand.cpp:
846         (WebCore::SpellingCorrectionCommand::willApplyCommand):
847         (WebCore::SpellingCorrectionCommand::doApply):
848         (WebCore::SpellingCorrectionCommand::inputEventDataTransfer):
849         * editing/SpellingCorrectionCommand.h:
850
851         Using the replacement text fragment, create and return a DataTransfer for input events.
852
853         * platform/Pasteboard.h:
854         * platform/StaticPasteboard.cpp: Added.
855         (WebCore::StaticPasteboard::create):
856         (WebCore::StaticPasteboard::StaticPasteboard):
857         (WebCore::StaticPasteboard::hasData):
858         (WebCore::StaticPasteboard::types):
859         (WebCore::StaticPasteboard::readString):
860         * platform/StaticPasteboard.h: Copied from Source/WebCore/dom/InputEvent.cpp.
861         * platform/efl/PasteboardEfl.cpp:
862         (WebCore::Pasteboard::writeMarkup):
863         (WebCore::Pasteboard::write):
864         (WebCore::Pasteboard::read):
865         * platform/gtk/PasteboardGtk.cpp:
866         (WebCore::Pasteboard::writeMarkup):
867         * platform/ios/PasteboardIOS.mm:
868         (WebCore::Pasteboard::writeMarkup):
869         * platform/mac/PasteboardMac.mm:
870         (WebCore::Pasteboard::Pasteboard):
871         (WebCore::Pasteboard::writeMarkup):
872         * platform/win/PasteboardWin.cpp:
873         (WebCore::Pasteboard::write):
874         (WebCore::Pasteboard::read):
875
876         To account for virtual methods on Pasteboard, add implementations for methods that were previously defined but
877         unimplemented on these platforms.
878
879 2016-10-25  Andy Estes  <aestes@apple.com>
880
881         Implement rel=noopener
882         https://bugs.webkit.org/show_bug.cgi?id=155166
883         <rdar://problem/25193787>
884
885         Reviewed by Brent Fulgham.
886
887         Added support for rel=noopener to a and area elements.
888
889         Tests: fast/dom/Window/a-rel-noopener.html
890                fast/dom/Window/area-rel-noopener.html
891
892         * html/HTMLAnchorElement.cpp:
893         (WebCore::HTMLAnchorElement::HTMLAnchorElement): Stopped initializing m_linkRelations to 0.
894         (WebCore::HTMLAnchorElement::parseAttribute): Declared static AtomicStrings for "noreferrer"
895         and "noopener", and created a SpaceSplitString from the rel attribute value to test for these
896         two values.
897         (WebCore::HTMLAnchorElement::hasRel): Updated to use OptionSet::contains().
898         (WebCore::HTMLAnchorElement::relList): Added a check for "noopener".
899         (WebCore::HTMLAnchorElement::handleClick): Passed NewFrameOpenerPolicy::Suppress to
900         FrameLoader::urlSelected() if rel=noopener was specified.
901         * html/HTMLAnchorElement.h: Changed the Relation enum to an enum class, removed unused enum
902         values, and changed m_linkRelations from a 30-bit unsigned integer to an OptionSet<Relation>
903         (HTMLAnchorElement is still 128 bytes on 64-bit).
904         * loader/FrameLoader.cpp:
905         (WebCore::FrameLoader::urlSelected): Changed to only compute a NewFrameOpenerPolicy from the
906         referrer policy if an explicit NewFrameOpenerPolicy isn't specified. Removed the version of
907         urlSelected() that did not take a downloadAttribute parameter.
908         * loader/FrameLoader.h: Added an Optional<NewFrameOpenerPolicy> parameter to urlSelected(),
909         and set a default argument for downloadAttribute instead of having a second version of
910         urlSelected().
911
912 2016-10-25  Eric Carlson  <eric.carlson@apple.com>
913
914         [MediaStream] Add "has capture device" bit to media state flags
915         https://bugs.webkit.org/show_bug.cgi?id=163952
916
917         Reviewed by Jer Noble.
918
919         No new tests, updated fast/mediastream/MediaStream-page-muted.html, media/muted-video-is-playing-audio.html,
920         and webaudio/web-audio-is-playing.html.
921
922         * Modules/mediastream/MediaStream.cpp:
923         (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when
924           actually producing data.
925
926         * page/MediaProducer.h: Add HasMediaCaptureDevice bit.
927
928         * testing/Internals.cpp:
929         (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags.
930         (WebCore::Internals::isPagePlayingAudio): Deleted.
931         * testing/Internals.h:
932         * testing/Internals.idl:
933
934 2016-10-25  Commit Queue  <commit-queue@webkit.org>
935
936         Unreviewed, rolling out r207827 and r207828.
937         https://bugs.webkit.org/show_bug.cgi?id=163965
938
939         Caused LayoutTest webaudio/web-audio-is-playing.html to time
940         out on macOS. (Requested by ryanhaddad on #webkit).
941
942         Reverted changesets:
943
944         "[MediaStream] Add "has capture device" bit to media state
945         flags"
946         https://bugs.webkit.org/show_bug.cgi?id=163952
947         http://trac.webkit.org/changeset/207827
948
949         "[MediaStream] Add "has capture device" bit to media state
950         flags"
951         https://bugs.webkit.org/show_bug.cgi?id=163952
952         http://trac.webkit.org/changeset/207828
953
954 2016-10-25  Antoine Quint  <graouts@apple.com>
955
956         [Modern Media Controls] Media Controller: skip back support
957         https://bugs.webkit.org/show_bug.cgi?id=163725
958         <rdar://problem/27989480>
959
960         Reviewed by Dean Jackson.
961
962         We introduce the SkipBackSupport class which brings support for skipping back
963         30 seconds into the media by clicking on the skip back button in the media controls.
964
965         Test: http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html
966
967         * Modules/modern-media-controls/js-files:
968         * Modules/modern-media-controls/media/media-controller.js:
969         (MediaController):
970         * Modules/modern-media-controls/media/skip-back-support.js: Copied from Source/WebCore/Modules/modern-media-controls/media/media-controller.js.
971         (SkipBackSupport.prototype.get control):
972         (SkipBackSupport.prototype.buttonWasClicked):
973         (SkipBackSupport):
974         * WebCore.xcodeproj/project.pbxproj:
975
976 2016-10-25  Commit Queue  <commit-queue@webkit.org>
977
978         Unreviewed, rolling out r207578.
979         https://bugs.webkit.org/show_bug.cgi?id=163962
980
981         Broke quip.com so that user can no longer type a space
982         (Requested by rniwa on #webkit).
983
984         Reverted changeset:
985
986         "Add a plain space instead of &nbsp; between text nodes"
987         https://bugs.webkit.org/show_bug.cgi?id=123163
988         http://trac.webkit.org/changeset/207578
989
990 2016-10-25  Chris Dumez  <cdumez@apple.com>
991
992         LOG_WITH_STREAM() macro should not have a semi colon at the end
993         https://bugs.webkit.org/show_bug.cgi?id=163951
994
995         Reviewed by Simon Fraser.
996
997         * platform/LogMacros.h:
998
999 2016-10-25  Chris Dumez  <cdumez@apple.com>
1000
1001         IDBObjectStore.createIndex() should take a union in parameter
1002         https://bugs.webkit.org/show_bug.cgi?id=163935
1003
1004         Reviewed by Darin Adler.
1005
1006         IDBObjectStore.createIndex() should take a union in parameter:
1007         - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStore
1008
1009         No new tests, no expected Web-exposed behavior change.
1010
1011         * Modules/indexeddb/IDBDatabase.cpp:
1012         (WebCore::IDBDatabase::createObjectStore):
1013         * Modules/indexeddb/IDBKeyPath.cpp:
1014         (WebCore::isIDBKeyPathValid):
1015         (WebCore::IDBKeyPath::isValid): Deleted.
1016         * Modules/indexeddb/IDBKeyPath.h:
1017         (WebCore::IDBKeyPath::isNull):
1018         * Modules/indexeddb/IDBObjectStore.cpp:
1019         (WebCore::IDBObjectStore::createIndex):
1020         * Modules/indexeddb/IDBObjectStore.h:
1021         * Modules/indexeddb/IDBObjectStore.idl:
1022
1023 2016-10-24  Sam Weinig  <sam@webkit.org>
1024
1025         [WebIDL] Move more types over to the new JSConverter based toJS functions
1026         https://bugs.webkit.org/show_bug.cgi?id=163920
1027
1028         Reviewed by Darin Adler.
1029
1030         - Adds WebIDL-extension type IDLDate, and use it for Date conversions.
1031         - Move JSDOMIterator over to using IDLType based conversions. Make them more
1032           explicit by adding a traits template argument which describes the iterator.
1033         - Add correct parsing for WebIDL iterable, parsing the parameter types into
1034           domTypes.
1035         - Support non-Optional nullable types via trait-like functions on IDLTypes.
1036
1037
1038         * bindings/generic/IDLTypes.h:
1039         (WebCore::IDLType::isNullValue):
1040         (WebCore::IDLType::extractValueFromNullable):
1041         (WebCore::IDLString::isNullValue):
1042         (WebCore::IDLString::extractValueFromNullable):
1043         (WebCore::IDLInterface::isNullValue):
1044         (WebCore::IDLInterface::extractValueFromNullable):
1045         (WebCore::IDLDate::isNullValue):
1046         (WebCore::IDLDate::extractValueFromNullable):
1047         Add isNullValue and extractValueFromNullable functions to allow non-Optional
1048         based nullable types.
1049         
1050         * Modules/plugins/QuickTimePluginReplacement.mm:
1051         (WebCore::QuickTimePluginReplacement::installReplacement):
1052         * bindings/js/IDBBindingUtilities.cpp:
1053         (WebCore::toJS):
1054         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1055         (WebCore::stylePropertyGetter):
1056         * bindings/js/JSCustomElementInterface.cpp:
1057         (WebCore::JSCustomElementInterface::invokeAttributeChangedCallback):
1058         Switch to IDLType based toJS.
1059
1060         * bindings/js/JSDOMBinding.cpp:
1061         (WebCore::jsStringOrNull): Deleted.
1062         (WebCore::jsDateOrNull): Deleted.
1063         * bindings/js/JSDOMBinding.h:
1064         (WebCore::jsPair): Deleted.
1065         (WebCore::toJSNullableString): Deleted.
1066         Remove now unusued toJS functions.
1067
1068         * bindings/js/JSDOMConvert.h:
1069         (WebCore::JSConverter<IDLNullable<T>>::convert):
1070         Use new functions to detect and extract nullable values.
1071
1072         (WebCore::Converter<IDLBufferSource>::convert):
1073         Moved to be with the other converters.
1074
1075         (WebCore::Converter<IDLDate>::convert):
1076         (WebCore::JSConverter<IDLDate>::convert):
1077         Added.
1078
1079         * bindings/js/JSDOMIterator.h:
1080         (WebCore::jsPair):
1081         (WebCore::iteratorCreate):
1082         (WebCore::IteratorTraits>::asJS):
1083         (WebCore::appendForEachArguments):
1084         (WebCore::iteratorForEach):
1085         (WebCore::IteratorTraits>::destroy):
1086         (WebCore::IteratorTraits>::next):
1087         (WebCore::IteratorTraits>::finishCreation):
1088         (WebCore::IteratorInspector::decltype): Deleted.
1089         (WebCore::IteratorInspector::test): Deleted.
1090         (WebCore::JSDOMIterator<JSWrapper>::asJS): Deleted.
1091         (WebCore::JSDOMIterator<JSWrapper>::destroy): Deleted.
1092         (WebCore::JSDOMIterator<JSWrapper>::next): Deleted.
1093         (WebCore::JSDOMIteratorPrototype<JSWrapper>::next): Deleted.
1094         (WebCore::JSDOMIteratorPrototype<JSWrapper>::finishCreation): Deleted.
1095         Switch to new Traits based model, and have the generated code pass in 
1096         the type (map or set) and key/value types. With the explicit types known,
1097         we can use the new toJS functions.
1098         
1099         Also, moved the jsPair functions here from JSDOMBinding.h, since this was
1100         the only place it was used.
1101
1102         * bindings/scripts/CodeGeneratorJS.pm:
1103         (GenerateImplementationIterableFunctions):
1104         Add iterator trait definition and update for new parameters to JSDOMIterator
1105         and JSDOMIteratorPrototype.
1106
1107         (GetBaseIDLType):
1108         Add IDLDate, and move IDLBufferSource up to the simple path.
1109
1110         (JSValueToNativeIsHandledByDOMConvert):
1111         Allow Date.
1112
1113         (JSValueToNative):
1114         Remove special case for Date.
1115
1116         (NativeToJSValueIsHandledByDOMConvert):
1117         Allow Date and remove restriction of nullable string-like types.
1118
1119         (NativeToJSValueDOMConvertNeedsState):
1120         Add Date to list of types needing state.
1121
1122         (NativeToJSValue):
1123         Remove special cases for Date and nullable-strings.
1124
1125         * bindings/scripts/IDLParser.pm:
1126         (parseOptionalIterableInterface):
1127         Add correct parsing of iterable.
1128
1129         * bindings/scripts/test/JS/JSTestIterable.cpp:
1130         * bindings/scripts/test/JS/JSTestNode.cpp:
1131         * bindings/scripts/test/JS/JSTestObj.cpp:
1132         Update test results.
1133
1134 2016-10-25  Eric Carlson  <eric.carlson@apple.com>
1135
1136         [MediaStream] Add "has capture device" bit to media state flags
1137         https://bugs.webkit.org/show_bug.cgi?id=163952
1138
1139         Reviewed by Jer Noble.
1140
1141         No new tests, updated fast/mediastream/MediaStream-page-muted.html and media/muted-video-is-playing-audio.html.
1142
1143         * Modules/mediastream/MediaStream.cpp:
1144         (WebCore::MediaStream::mediaState): Set HasMediaCaptureDevice, only set HasActiveMediaCaptureDevice when
1145           actually producing data.
1146
1147         * page/MediaProducer.h: Add HasMediaCaptureDevice bit.
1148
1149         * testing/Internals.cpp:
1150         (WebCore::Internals::pageMediaState): Return a string representing MediaStateFlags.
1151         (WebCore::Internals::isPagePlayingAudio): Deleted.
1152         * testing/Internals.h:
1153         * testing/Internals.idl:
1154
1155 2016-10-25  Brady Eidson  <beidson@apple.com>
1156
1157         IndexedDB 2.0: Support new IDBTransaction interfaces.
1158         <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
1159
1160         Reviewed by Sam Weinig.
1161
1162         Tests: storage/indexeddb/modern/idbtransaction-objectstores-1-private.html
1163                storage/indexeddb/modern/idbtransaction-objectstores-1.html
1164                At least partially passing results on 5 previously failed W3C tests.
1165
1166         The "new IDBTransaction interfaces" really just means adding the property IDBTransaction.objectStoreNames.
1167
1168         * Modules/indexeddb/IDBTransaction.cpp:
1169         (WebCore::IDBTransaction::objectStoreNames):
1170         * Modules/indexeddb/IDBTransaction.h:
1171         * Modules/indexeddb/IDBTransaction.idl:
1172
1173 2016-10-25  Youenn Fablet  <youenn@apple.com>
1174
1175         MediaEndpointConfiguration does not need to be refcounted
1176         https://bugs.webkit.org/show_bug.cgi?id=163888
1177
1178         Reviewed by Eric Carlson.
1179
1180         No change of behavior.
1181
1182         Updating MediaEndpoint to take a MediaEndpointConfiguration&& instead of a RefPtr<MediaEndpointConfiguration>&&.
1183         This allows ensuring that the configuration is not null and removes the need to ref-count it.
1184
1185         Removing ref-counting from MediaEndpointConfiguration and its related IceServer that is now a struct.
1186         Updated MediaEndpointOwr and mock implementations accordingly.
1187
1188         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1189         (WebCore::MediaEndpointPeerConnection::setConfiguration):
1190         * platform/mediastream/MediaEndpoint.cpp:
1191         * platform/mediastream/MediaEndpoint.h:
1192         * platform/mediastream/MediaEndpointConfiguration.cpp:
1193         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
1194         * platform/mediastream/MediaEndpointConfiguration.h:
1195         (WebCore::MediaEndpointConfiguration::iceServers):
1196         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1197         (WebCore::MediaEndpointOwr::setConfiguration):
1198         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
1199         * platform/mediastream/openwebrtc/MediaEndpointOwr.h:
1200         * platform/mock/MockMediaEndpoint.cpp:
1201         * platform/mock/MockMediaEndpoint.h:
1202
1203 2016-10-25  Youenn Fablet  <youenn@apple.com>
1204
1205         CachedResourceLoader should set headers of the HTTP request prior checking for the cache
1206         https://bugs.webkit.org/show_bug.cgi?id=163103
1207
1208         Reviewed by Darin Adler.
1209
1210         No expected change of behavior.
1211
1212         Moved referrer, user-agent, and origin headers setting to CachedResourceRequest/CachedResourceLoader before checking the cache.
1213         This allows simplifying vary header checks and is more inline with the fetch specification.
1214
1215         To compute the referrer value, we need to know whether the request is cross-origin.
1216         A helper function isRequestCrossOrigin is added for that purpose and is also used in CachedResource to set its initial response tainting.
1217
1218         We should disable setting user-agent and origin headers by FrameLoader for subresources since this is now done in CachedResourceLoader.
1219         This could be done as a follow-up patch.
1220
1221         * loader/cache/CachedResource.cpp:
1222         (WebCore::CachedResource::CachedResource):
1223         (WebCore::CachedResource::load):
1224         (WebCore::CachedResource::varyHeaderValuesMatch):
1225         (WebCore::addAdditionalRequestHeadersToRequest): Deleted.
1226         (WebCore::CachedResource::addAdditionalRequestHeaders): Deleted.
1227         * loader/cache/CachedResource.h:
1228         * loader/cache/CachedResourceLoader.cpp:
1229         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
1230         (WebCore::CachedResourceLoader::requestResource):
1231         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
1232         * loader/cache/CachedResourceLoader.h:
1233         * loader/cache/CachedResourceRequest.cpp:
1234         (WebCore::CachedResourceRequest::updateForAccessControl):
1235         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
1236         (WebCore::isRequestCrossOrigin):
1237         * loader/cache/CachedResourceRequest.h:
1238         (WebCore::CachedResourceRequest::setOrigin):
1239
1240 2016-10-25  Andreas Kling  <akling@apple.com>
1241
1242         More PassRefPtr purging in WebCore.
1243         <https://webkit.org/b/163895>
1244
1245         Reviewed by Antti Koivisto.
1246
1247         Remove PassRefPtr usage in RenderStyle, RenderTheme and Scrollbar, then fix up all the fallout.
1248
1249         * css/CSSComputedStyleDeclaration.cpp:
1250         (WebCore::contentToCSSValue):
1251         (WebCore::shapePropertyValue):
1252         (WebCore::ComputedStyleExtractor::propertyValue):
1253         * css/StyleBuilderConverter.h:
1254         (WebCore::StyleBuilderConverter::convertQuotes):
1255         * html/HTMLSelectElement.cpp:
1256         (WebCore::HTMLSelectElement::usesMenuList):
1257         (WebCore::HTMLSelectElement::platformHandleKeydownEvent):
1258         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
1259         * html/InputType.cpp:
1260         (WebCore::InputType::themeSupportsDataListUI):
1261         * html/TextFieldInputType.cpp:
1262         (WebCore::TextFieldInputType::shouldHaveSpinButton):
1263         (WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
1264         * loader/SubframeLoader.cpp:
1265         (WebCore::SubframeLoader::loadPlugin):
1266         * page/FrameView.cpp:
1267         (WebCore::FrameView::createScrollbar):
1268         * page/FrameView.h:
1269         * page/animation/CSSPropertyAnimation.cpp:
1270         (WebCore::RefCountedPropertyWrapper::RefCountedPropertyWrapper):
1271         (WebCore::PropertyWrapperClipPath::PropertyWrapperClipPath):
1272         (WebCore::PropertyWrapperShape::PropertyWrapperShape):
1273         (WebCore::StyleImagePropertyWrapper::StyleImagePropertyWrapper):
1274         (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
1275         (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
1276         * platform/PopupMenuClient.h:
1277         * platform/ScrollView.cpp:
1278         (WebCore::ScrollView::createScrollbar):
1279         * platform/ScrollView.h:
1280         * platform/Scrollbar.cpp:
1281         (WebCore::Scrollbar::createNativeScrollbar):
1282         * platform/Scrollbar.h:
1283         * rendering/FilterEffectRenderer.cpp:
1284         (WebCore::FilterEffectRenderer::buildReferenceFilter):
1285         * rendering/FilterEffectRenderer.h:
1286         * rendering/RenderLayer.cpp:
1287         (WebCore::RenderLayer::createScrollbar):
1288         (WebCore::RenderLayer::createLocalTransformState):
1289         (WebCore::RenderLayer::hitTestLayerByApplyingTransform):
1290         * rendering/RenderLayer.h:
1291         * rendering/RenderListBox.cpp:
1292         (WebCore::RenderListBox::createScrollbar):
1293         * rendering/RenderListBox.h:
1294         * rendering/RenderMenuList.cpp:
1295         (RenderMenuList::createScrollbar):
1296         * rendering/RenderMenuList.h:
1297         * rendering/RenderScrollbar.cpp:
1298         (WebCore::RenderScrollbar::createCustomScrollbar):
1299         * rendering/RenderScrollbar.h:
1300         * rendering/RenderSearchField.cpp:
1301         (WebCore::RenderSearchField::createScrollbar):
1302         * rendering/RenderSearchField.h:
1303         * rendering/RenderTheme.h:
1304         (WebCore::RenderTheme::defaultTheme):
1305         * rendering/RenderThemeEfl.cpp:
1306         (WebCore::RenderThemeEfl::create):
1307         (WebCore::RenderTheme::themeForPage):
1308         * rendering/RenderThemeEfl.h:
1309         * rendering/RenderThemeGtk.cpp:
1310         (WebCore::RenderTheme::themeForPage):
1311         * rendering/RenderThemeIOS.mm:
1312         (WebCore::RenderTheme::themeForPage):
1313         * rendering/RenderThemeMac.mm:
1314         (WebCore::RenderTheme::themeForPage):
1315         * rendering/RenderThemeWin.cpp:
1316         (WebCore::RenderTheme::themeForPage):
1317         * rendering/RenderWidget.cpp:
1318         (WebCore::RenderWidget::setWidget):
1319         * rendering/RenderWidget.h:
1320         * rendering/style/CursorData.h:
1321         (WebCore::CursorData::CursorData):
1322         (WebCore::CursorData::setImage):
1323         * rendering/style/FillLayer.h:
1324         (WebCore::FillLayer::setImage):
1325         * rendering/style/QuotesData.cpp:
1326         (WebCore::QuotesData::create):
1327         * rendering/style/QuotesData.h:
1328         * rendering/style/RenderStyle.cpp:
1329         (WebCore::RenderStyle::addCursor):
1330         (WebCore::RenderStyle::setCursorList):
1331         (WebCore::RenderStyle::setQuotes):
1332         (WebCore::RenderStyle::setWillChange):
1333         (WebCore::RenderStyle::setContent):
1334         (WebCore::RenderStyle::setListStyleImage):
1335         (WebCore::RenderStyle::setBorderImageSource):
1336         * rendering/style/RenderStyle.h:
1337         (WebCore::RenderStyle::setMaskImage):
1338         (WebCore::RenderStyle::setMaskBoxImageSource):
1339         (WebCore::RenderStyle::setBoxReflect):
1340         (WebCore::RenderStyle::setShapeOutside):
1341         (WebCore::RenderStyle::setClipPath):
1342         * rendering/style/StyleCachedImage.cpp:
1343         (WebCore::StyleCachedImage::cssValue):
1344         * rendering/style/StyleCachedImage.h:
1345         * rendering/style/StyleGeneratedImage.cpp:
1346         (WebCore::StyleGeneratedImage::cssValue):
1347         * rendering/style/StyleGeneratedImage.h:
1348         * rendering/style/StyleImage.h:
1349         * rendering/style/StyleMultiColData.h:
1350         * rendering/style/StyleRareInheritedData.h:
1351
1352 2016-10-24  Ryosuke Niwa  <rniwa@webkit.org>
1353
1354         Custom elements reactions should have a queue per element
1355         https://bugs.webkit.org/show_bug.cgi?id=163878
1356
1357         Reviewed by Antti Koivisto.
1358
1359         This patch splits the custom elements reaction queue into per element to match the latest HTML specifications:
1360         https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue
1361         and introduces the backup element queue:
1362         https://html.spec.whatwg.org/multipage/scripting.html#backup-element-queue
1363
1364         In terms of code changes, CustomElementReactionStack now holds onto ElementQueue, an ordered list of elements,
1365         and make each ElementRareData keep its own CustomElementReactionQueue. CustomElementReactionQueue is created
1366         for each custom element when it is synchronously constructed or enqueued to upgrade.
1367
1368         Because each reaction queue is now specific to each element, CustomElementReactionQueue instead of
1369         CustomElementReactionQueueItem stores JSCustomElementInterface.
1370
1371         The backup element queue is created as a singleton returned by CustomElementReactionStack's backupElementQueue,
1372         and ensureBackupQueue() schedules a new mirotask to process the backup queue when there isn't already one.
1373
1374         ensureCurrentQueue() now returns a reference to CustomElementReactionQueue instead of a pointer since it can
1375         fallback to the backup queue when the stack is empty as specified:
1376         https://html.spec.whatwg.org/multipage/scripting.html#enqueue-an-element-on-the-appropriate-element-queue
1377
1378         Note that ensureCurrentQueue() may insert the same element multiple times into the element queue for now since
1379         avoiding this duplication would require either doing O(n) iteration on m_elements or adding a HashSet.
1380         We can revisit this in the future if the reaction queue is found to grow beyond a few entries since elements in
1381         the element queue will have duplicates only when each reaction queue has more than one item.
1382
1383         Tests: fast/custom-elements/backup-element-queue.html
1384                fast/custom-elements/custom-element-reaction-queue.html
1385
1386         * bindings/js/JSCustomElementInterface.cpp:
1387         (WebCore::JSCustomElementInterface::upgradeElement):
1388         * dom/CustomElementReactionQueue.cpp:
1389         (WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem):
1390         (WebCore::CustomElementReactionQueueItem::invoke): Removed the check for isFailedCustomElement since the queue
1391         is explicitly cleared in Element::setIsFailedCustomElement.
1392         (WebCore::CustomElementReactionQueue::CustomElementReactionQueue): Now takes JSCustomElementInterface since
1393         each item in the queue no longer stores Element or JSCustomElementInterface.
1394         (WebCore::CustomElementReactionQueue::clear):
1395         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
1396         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined):
1397         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
1398         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
1399         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
1400         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
1401         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions):
1402         (WebCore::CustomElementReactionQueue::invokeAll):
1403         (WebCore::CustomElementReactionStack::ElementQueue::add): Added.
1404         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): Added.
1405         (WebCore::CustomElementReactionStack::ensureCurrentQueue):
1406         (WebCore::BackupElementQueueMicrotask): Added.
1407         (WebCore::CustomElementReactionStack::ensureBackupQueue): Added.
1408         (WebCore::CustomElementReactionStack::processBackupQueue): Added.
1409         (WebCore::CustomElementReactionStack::backupElementQueue): Added.
1410         * dom/CustomElementReactionQueue.h:
1411         * dom/CustomElementRegistry.cpp:
1412         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
1413         * dom/Document.cpp:
1414         (WebCore::createFallbackHTMLElement):
1415         * dom/Element.cpp:
1416         (WebCore::Element::setIsDefinedCustomElement): Create a new reaction queue if there isn't already one; when
1417         this element had been upgraded, the reaction queue have already been created in Element::enqueueToUpgrade.
1418         (WebCore::Element::setIsFailedCustomElement): Clear the reaction queue when the upgrading had failed.
1419         (WebCore::Element::enqueueToUpgrade): Added.
1420         (WebCore::Element::reactionQueue): Added.
1421         * dom/Element.h:
1422         * dom/ElementRareData.h:
1423         (WebCore::ElementRareData::customElementReactionQueue): Replaced customElementInterface.
1424         (WebCore::ElementRareData::setCustomElementReactionQueue): Replaced setCustomElementReactionQueue.
1425
1426 2016-10-24  Jiewen Tan  <jiewen_tan@apple.com>
1427
1428         Update SubtleCrypto::generateKey to match the latest spec
1429         https://bugs.webkit.org/show_bug.cgi?id=163718
1430         <rdar://problem/28864380>
1431
1432         Reviewed by Chris Dumez.
1433
1434         This patch does following few things:
1435         1. It updates the SubtleCrypto::generateKey method to match the latest spec:
1436            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey.
1437            It also refers to the latest Editor's Draft at a certain degree:
1438            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-generateKey.
1439         2. It implements generateKey operations of following algorithms: AES-CBC, AES-KW,
1440            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
1441         3. It replaces SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS with
1442         SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS_DEPRECATED for deprecated params.
1443         4. It fixes https://bugs.webkit.org/show_bug.cgi?id=129750 as well.
1444
1445         Tests: crypto/subtle/aes-cbc-generate-key-length-128.html
1446                crypto/subtle/aes-cbc-generate-key-length-192.html
1447                crypto/subtle/aes-cbc-generate-key-length-256.html
1448                crypto/subtle/aes-generate-key-malformed-parameters.html
1449                crypto/subtle/aes-kw-generate-key.html
1450                crypto/subtle/generate-key-malformed-paramters.html
1451                crypto/subtle/hmac-generate-key-customized-length.html
1452                crypto/subtle/hmac-generate-key-hash-object.html
1453                crypto/subtle/hmac-generate-key-malformed-parameters.html
1454                crypto/subtle/hmac-generate-key-sha1.html
1455                crypto/subtle/hmac-generate-key-sha224.html
1456                crypto/subtle/hmac-generate-key-sha256.html
1457                crypto/subtle/hmac-generate-key-sha384.html
1458                crypto/subtle/hmac-generate-key-sha512.html
1459                crypto/subtle/rsa-generate-key-malformed-parameters.html
1460                crypto/subtle/rsa-oaep-generate-key.html
1461                crypto/subtle/rsaes-pkcs1-v1_5-generate-key-extractable.html
1462                crypto/subtle/rsaes-pkcs1-v1_5-generate-key.html
1463                crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html
1464                crypto/webkitSubtle/hmac-generate-key.html:
1465                crypto/workers/subtle/aes-generate-key.html
1466                crypto/workers/subtle/hmac-generate-key.html
1467                crypto/workers/subtle/rsa-generate-key.html
1468
1469         * CMakeLists.txt:
1470         * DerivedSources.make:
1471         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1472         * WebCore.xcodeproj/project.pbxproj:
1473         * bindings/js/JSSubtleCryptoCustom.cpp: Added.
1474         (WebCore::toHashIdentifier):
1475         (WebCore::normalizeCryptoAlgorithmParameters):
1476         (WebCore::cryptoKeyUsagesFromJSValue):
1477         (WebCore::createAlgorithm):
1478         (WebCore::rejectWithException):
1479         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
1480         (WebCore::JSSubtleCrypto::generateKey):
1481         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1482         (WebCore::JSWebKitSubtleCrypto::generateKey):
1483         * crypto/CryptoAlgorithm.cpp:
1484         (WebCore::CryptoAlgorithm::generateKey):
1485         * crypto/CryptoAlgorithm.h:
1486         * crypto/CryptoAlgorithmParameters.h: Added.
1487         (WebCore::CryptoAlgorithmParameters::CryptoAlgorithmParameters):
1488         (WebCore::CryptoAlgorithmParameters::~CryptoAlgorithmParameters):
1489         (WebCore::CryptoAlgorithmParameters::parametersClass):
1490         * crypto/CryptoAlgorithmParameters.idl: Added.
1491         * crypto/CryptoAlgorithmParametersDeprecated.h:
1492         * crypto/CryptoKey.cpp:
1493         (WebCore::CryptoKey::setUsagesBitmap):
1494         * crypto/CryptoKey.h:
1495         * crypto/CryptoKeyPair.idl:
1496         * crypto/SubtleCrypto.idl:
1497         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1498         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
1499         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1500         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1501         (WebCore::CryptoAlgorithmAES_KW::generateKey):
1502         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1503         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1504         (WebCore::CryptoAlgorithmHMAC::generateKey):
1505         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1506         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1507         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey):
1508         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1509         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1510         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
1511         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1512         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1513         (WebCore::CryptoAlgorithmRSA_OAEP::generateKey):
1514         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1515         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
1516         (WebCore::CryptoKeyRSA::generatePair):
1517         * crypto/keys/CryptoKeyAES.cpp:
1518         (WebCore::CryptoKeyAES::generate):
1519         * crypto/keys/CryptoKeyHMAC.cpp:
1520         (WebCore::CryptoKeyHMAC::generate):
1521         * crypto/keys/CryptoKeyRSA.h:
1522         * crypto/mac/CryptoKeyRSAMac.cpp:
1523         (WebCore::CryptoKeyRSA::generatePair):
1524         * crypto/parameters/AesKeyGenParams.idl: Added.
1525         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h:
1526         * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h: Added.
1527         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h:
1528         * crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h: Added.
1529         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h:
1530         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h:
1531         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: Added.
1532         * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added.
1533         (WebCore::CryptoAlgorithmRsaKeyGenParams::arrayToVector):
1534         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h:
1535         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h:
1536         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h:
1537         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h:
1538         * crypto/parameters/HmacKeyGenParams.idl: Added.
1539         * crypto/parameters/RsaHashedKeyGenParams.idl: Added.
1540         * crypto/parameters/RsaKeyGenParams.idl: Added.
1541
1542 2016-10-24  Chris Dumez  <cdumez@apple.com>
1543
1544         IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter
1545         https://bugs.webkit.org/show_bug.cgi?id=163916
1546
1547         Reviewed by Darin Adler.
1548
1549         IDBDatabase.createObjectStore() should take a IDBObjectStoreParameters dictionary in parameter:
1550         - https://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabase
1551         - https://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStoreParameters
1552
1553         Align our IDL with the specification.
1554
1555         No new tests, no expected Web-exposed behavior change.
1556
1557         * Modules/indexeddb/IDBDatabase.cpp:
1558         (WebCore::IDBDatabase::createObjectStore):
1559         * Modules/indexeddb/IDBDatabase.h:
1560         * Modules/indexeddb/IDBDatabase.idl:
1561         * Modules/indexeddb/IDBKeyPath.cpp:
1562         (WebCore::IDBKeyPath::IDBKeyPath):
1563         * Modules/indexeddb/IDBKeyPath.h:
1564         * WebCore.xcodeproj/project.pbxproj:
1565         * bindings/js/IDBBindingUtilities.cpp:
1566         (WebCore::idbKeyPathFromValue): Deleted.
1567         * bindings/js/IDBBindingUtilities.h:
1568         * bindings/js/JSIDBDatabaseCustom.cpp: Removed.
1569         * bindings/scripts/CodeGeneratorJS.pm:
1570         (GenerateParametersCheck):
1571         (GenerateConstructorDefinition):
1572         * dom/MessageEvent.cpp:
1573         (WebCore::MessageEvent::MessageEvent):
1574         (WebCore::MessageEvent::create):
1575         * dom/MessageEvent.h:
1576         * testing/TypeConversions.h:
1577         (WebCore::TypeConversions::setTypeConversionsDictionary):
1578
1579 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1580
1581         URLParser should match old URL::parse with %2E in path
1582         https://bugs.webkit.org/show_bug.cgi?id=163929
1583
1584         Reviewed by Alexey Proskuryakov.
1585
1586         Covered by updated API tests, which show that URLParser now matches URL::parse in these cases.
1587         Also covered by newly failing web platform tests, which were failing before URLParser was enabled.
1588         If https://github.com/whatwg/url/issues/87 is resolved we can change behavior to match.
1589
1590         * platform/URLParser.cpp:
1591         (WebCore::URLParser::isSingleDotPathSegment):
1592         (WebCore::URLParser::isDoubleDotPathSegment):
1593         (WebCore::URLParser::consumeSingleDotPathSegment):
1594         (WebCore::URLParser::consumeDoubleDotPathSegment):
1595         (WebCore::URLParser::parse):
1596         (WebCore::URLParser::isPercentEncodedDot): Deleted.
1597
1598 2016-10-24  Zalan Bujtas  <zalan@apple.com>
1599
1600         Do not update selection rect on dirty lineboxes.
1601         https://bugs.webkit.org/show_bug.cgi?id=163862
1602         <rdar://problem/28813156>
1603
1604         Reviewed by Simon Fraser.
1605
1606         In certain cases RenderBlock::updateFirstLetter() triggers
1607         unwanted render tree mutation while the caller assumes intact renderers.
1608         This patch ensures that no renderers gets destroyed while computing the preferred widths
1609         when we are outside of layout context.
1610
1611         Test: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html
1612
1613         * rendering/RenderBlock.cpp:
1614         (WebCore::RenderBlock::computePreferredLogicalWidths):
1615         (WebCore::RenderBlock::updateFirstLetter):
1616         * rendering/RenderBlock.h:
1617         * rendering/RenderListItem.cpp:
1618         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
1619         * rendering/RenderRubyRun.cpp:
1620         (WebCore::RenderRubyRun::updateFirstLetter):
1621         * rendering/RenderRubyRun.h:
1622         * rendering/RenderTable.cpp:
1623         (WebCore::RenderTable::updateFirstLetter):
1624         * rendering/RenderTable.h:
1625         * rendering/svg/RenderSVGText.cpp:
1626         (WebCore::RenderSVGText::updateFirstLetter):
1627         * rendering/svg/RenderSVGText.h:
1628
1629 2016-10-24  Ryan Haddad  <ryanhaddad@apple.com>
1630
1631         Unreviewed, rolling out r207795.
1632
1633         Introduced API test failures on iOS and macOS.
1634
1635         Reverted changeset:
1636
1637         "URLParser should match old URL::parse with %2E in path"
1638         https://bugs.webkit.org/show_bug.cgi?id=163929
1639         http://trac.webkit.org/changeset/207795
1640
1641 2016-10-24  Yusuke Suzuki  <utatane.tea@gmail.com>
1642
1643         Unreviewed, attempt to fix Windows build after r207787
1644         https://bugs.webkit.org/show_bug.cgi?id=163657
1645
1646         Make the constructor public in DOMJIT::AbstractHeapRepository to make Windows bot green.
1647         It's a bit unfortunate that we need to introduce a workaround here.
1648
1649         * domjit/DOMJITAbstractHeapRepository.h:
1650
1651 2016-10-24  Chris Dumez  <cdumez@apple.com>
1652
1653         event.(dataTransfer|clipboardData).getData('text/html') (onpaste, ondrop)
1654         https://bugs.webkit.org/show_bug.cgi?id=19893
1655         <rdar://problem/6055546>
1656
1657         Reviewed by Ryosuke Niwa.
1658
1659         We now write selection as HTML as well to the pasteboard so that
1660         event.(dataTransfer|clipboardData).getData('text/html') now works.
1661
1662         I have verified manually that it is still possible to copy text from
1663         Safari and paste it to Excel 2011 Mac after this change. The text is
1664         now pasted as HTML instead of text, which is fine because Excel can
1665         display HTML.
1666
1667         No new tests, unskipped existing tests.
1668
1669         * editing/Editor.h:
1670         * editing/mac/EditorMac.mm:
1671         (WebCore::Editor::selectionInHTMLFormat):
1672         (WebCore::Editor::writeSelectionToPasteboard):
1673         * platform/Pasteboard.h:
1674         * platform/mac/PasteboardMac.mm:
1675         (WebCore::Pasteboard::write):
1676
1677 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1678
1679         URLParser should match old URL::parse with %2E in path
1680         https://bugs.webkit.org/show_bug.cgi?id=163929
1681
1682         Reviewed by Alexey Proskuryakov.
1683
1684         Covered by updated API tests, which show that URLParser now matches URL::parse in these cases.
1685         Also covered by newly failing web platform tests, which were failing before URLParser was enabled.
1686         If https://github.com/whatwg/url/issues/87 is resolved we can change behavior to match.
1687
1688         * platform/URLParser.cpp:
1689         (WebCore::URLParser::isSingleDotPathSegment):
1690         (WebCore::URLParser::isDoubleDotPathSegment):
1691         (WebCore::URLParser::consumeSingleDotPathSegment):
1692         (WebCore::URLParser::consumeDoubleDotPathSegment):
1693         (WebCore::URLParser::parse):
1694         (WebCore::URLParser::isPercentEncodedDot): Deleted.
1695
1696 2016-10-24  Per Arne Vollan  <pvollan@apple.com>
1697
1698         [Win] CMake build type is not set.
1699         https://bugs.webkit.org/show_bug.cgi?id=163917
1700
1701         Reviewed by Alex Christensen.
1702
1703         The CMAKE_BUILD_TYPE variable should be set to Debug or Release.
1704
1705         * WebCore.vcxproj/WebCore.proj:
1706
1707 2016-10-24  Yusuke Suzuki  <utatane.tea@gmail.com>
1708
1709         Unreviewed, attempt to fix Windows build after r207787
1710         https://bugs.webkit.org/show_bug.cgi?id=163657
1711
1712         According to the similar code in WebKit, I guess that
1713         Visual C++ requires friend class declaration is done
1714         in the private section to access private members.
1715
1716         And I also changed ::instance to ::shared to align to
1717         the existing WebCore code.
1718
1719         * domjit/DOMJITAbstractHeapRepository.cpp:
1720         (WebCore::DOMJIT::AbstractHeapRepository::shared):
1721         (WebCore::DOMJIT::AbstractHeapRepository::instance): Deleted.
1722         * domjit/DOMJITAbstractHeapRepository.h:
1723         * domjit/JSNodeDOMJIT.cpp:
1724         (WebCore::NodeFirstChildDOMJIT::callDOM):
1725         (WebCore::NodeLastChildDOMJIT::callDOM):
1726         (WebCore::NodeNextSiblingDOMJIT::callDOM):
1727         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
1728         (WebCore::NodeParentNodeDOMJIT::callDOM):
1729
1730 2016-10-24  Simon Fraser  <simon.fraser@apple.com>
1731
1732         Fix the lifetime of strings used in LOG_WITH_STREAM
1733         https://bugs.webkit.org/show_bug.cgi?id=163923
1734
1735         Reviewed by Brent Fulgham.
1736
1737         Make sure the const char* passed to WTFLog() outlives the call.
1738
1739         Removed logFunctionResult which wasn't used anywhere else, and encourages this bad
1740         pattern.
1741
1742         * platform/LogMacros.h:
1743         * platform/Logging.cpp:
1744         (WebCore::logFunctionResult): Deleted.
1745
1746 2016-10-24  Chris Dumez  <cdumez@apple.com>
1747
1748         Reduce special handling for typed arrays in JSDOMConvert.h
1749         https://bugs.webkit.org/show_bug.cgi?id=163907
1750
1751         Reviewed by Sam Weinig.
1752
1753         Reduce special handling for typed arrays in JSDOMConvert.h by adding a toWrapped() static
1754         function on JSGenericTypedArrayView, similarly to other wrapper types.
1755
1756         No new tests, no web-exposed behavior change.
1757
1758         * bindings/js/JSDOMConvert.h:
1759         (WebCore::Converter<IDLInterface<JSC::GenericTypedArrayView<Adaptor>>>::convert): Deleted.
1760
1761 2016-10-24  Ryan Haddad  <ryanhaddad@apple.com>
1762
1763         Unreviewed, rolling out r207783.
1764
1765         This change appears to have caused fast/selectors/invalid-
1766         functional-pseudo-class.html to crash on iOS and macOS
1767
1768         Reverted changeset:
1769
1770         "[CSS Parser] Fix :lang argument parsing"
1771         https://bugs.webkit.org/show_bug.cgi?id=163913
1772         http://trac.webkit.org/changeset/207783
1773
1774 2016-10-24  Brady Eidson  <beidson@apple.com>
1775
1776         IndexedDB 2.0: Support new IDBKeyRange interfaces.
1777         <rdar://problem/28806929> and https://bugs.webkit.org/show_bug.cgi?id=163910
1778
1779         Reviewed by Andy Estes.
1780
1781         No new tests (Covered by additions to existing test)
1782
1783         The "new IDBKeyRanges interfaces" really just means adding the instance method IDBKeyRange.contains.
1784
1785         * Modules/indexeddb/IDBKeyRange.cpp:
1786         (WebCore::IDBKeyRange::contains):
1787         * Modules/indexeddb/IDBKeyRange.h:
1788         * Modules/indexeddb/IDBKeyRange.idl:
1789
1790 2016-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
1791
1792         [DOMJIT] Add a way for DOMJIT::Patchpoint to express effects
1793         https://bugs.webkit.org/show_bug.cgi?id=163657
1794
1795         Reviewed by Saam Barati.
1796
1797         CallDOMPatchpoint now has the way to tell its effects to DFG and FTL compilers.
1798         WebCore DOMJIT::AbstractHeapRepository will construct the hierarchy of the abstract
1799         heap. And then it encodes these information into the pairs of the integers.
1800
1801         And this patch also changes the DOMJIT::PatchpointParams' parameter order.
1802         So we change them in all the DOMJIT::CallDOMPatchpoint sites.
1803
1804         * CMakeLists.txt:
1805         * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
1806         * ForwardingHeaders/domjit/DOMJITEffect.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
1807         * ForwardingHeaders/domjit/DOMJITHeapRange.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
1808         * WebCore.xcodeproj/project.pbxproj:
1809         * domjit/DOMJITAbstractHeapRepository.cpp: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
1810         (WebCore::DOMJIT::AbstractHeapRepository::AbstractHeapRepository):
1811         (WebCore::DOMJIT::AbstractHeapRepository::instance):
1812         * domjit/DOMJITAbstractHeapRepository.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
1813         * domjit/DOMJITHelpers.h:
1814         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal): Deleted.
1815         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive): Deleted.
1816         (WebCore::DOMJITHelpers::tryLookUpWrapperCache): Deleted.
1817         (WebCore::DOMJITHelpers::toWrapper): Deleted.
1818         (WebCore::DOMJITHelpers::branchIfDOMWrapper): Deleted.
1819         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper): Deleted.
1820         (WebCore::DOMJITHelpers::branchIfNode): Deleted.
1821         (WebCore::DOMJITHelpers::branchIfNotNode): Deleted.
1822         (WebCore::DOMJITHelpers::branchIfElement): Deleted.
1823         (WebCore::DOMJITHelpers::branchIfNotElement): Deleted.
1824         (WebCore::DOMJITHelpers::branchIfDocumentWrapper): Deleted.
1825         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper): Deleted.
1826         * domjit/JSNodeDOMJIT.cpp:
1827         (WebCore::createCallDOMForOffsetAccess):
1828         (WebCore::checkNode):
1829         (WebCore::NodeFirstChildDOMJIT::checkDOM):
1830         (WebCore::NodeFirstChildDOMJIT::callDOM):
1831         (WebCore::NodeLastChildDOMJIT::checkDOM):
1832         (WebCore::NodeLastChildDOMJIT::callDOM):
1833         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
1834         (WebCore::NodeNextSiblingDOMJIT::callDOM):
1835         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
1836         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
1837         (WebCore::NodeParentNodeDOMJIT::checkDOM):
1838         (WebCore::NodeParentNodeDOMJIT::callDOM):
1839         (WebCore::NodeNodeTypeDOMJIT::checkDOM):
1840         (WebCore::NodeNodeTypeDOMJIT::callDOM):
1841
1842 2016-10-24  Dave Hyatt  <hyatt@apple.com>
1843
1844         [CSS Parser] Fix :lang argument parsing
1845         https://bugs.webkit.org/show_bug.cgi?id=163913
1846
1847         Reviewed by Zalan Bujtas.
1848
1849         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
1850         Modify the map to support versions of the function pseudos
1851         without the left paren included.
1852
1853         * css/parser/CSSParserValues.cpp:
1854         (WebCore::CSSParserSelector::setLangArgumentList):
1855         * css/parser/CSSParserValues.h:
1856         Add a helper to just directly pass an AtomicString Vector through.
1857
1858         * css/parser/CSSSelectorParser.cpp:
1859         (WebCore::consumeLangArgumentList):
1860         (WebCore::CSSSelectorParser::consumePseudo):
1861         Add a new consumeLangArgumentList to collect the languages into
1862         an AtomicString Vector.
1863
1864 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1865
1866         Fix AppleWin build after r207720.
1867
1868         * html/canvas/OESVertexArrayObject.cpp:
1869
1870 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1871
1872         Fix AppleWin build after r207720.
1873
1874         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1875
1876 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1877
1878         Fix Windows build after r207767 and r207769
1879
1880         * css/CSSAllInOne.cpp:
1881         * platform/network/curl/ResourceHandleManager.cpp:
1882         (WebCore::getProtectionSpace):
1883
1884 2016-10-24  Per Arne Vollan  <pvollan@apple.com>
1885
1886         [Win] AVCF based media engine does not block cross-site/cross-domain loads.
1887         https://bugs.webkit.org/show_bug.cgi?id=163783
1888
1889         Reviewed by Brent Fulgham.
1890
1891         Prevent cross-site/cross-domain loads by setting appropriate AVCF options.
1892
1893         No new tests; covered by media/video-canvas-source.html. Media tests are
1894         currently skipped on Windows.
1895
1896         * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h:
1897         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1898         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL):
1899         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin):
1900         (WebCore::AVFWrapper::createAssetForURL):
1901         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
1902
1903 2016-10-24  Anders Carlsson  <andersca@apple.com>
1904
1905         Fix build with newer versions of clang
1906         https://bugs.webkit.org/show_bug.cgi?id=163908
1907         rdar://problem/28852016
1908
1909         Reviewed by Tim Horton.
1910
1911         Use the macros that names the soft-linked functions in such a way that they won't conflict with actual functions.
1912
1913         * platform/ios/PlatformScreenIOS.mm:
1914         (WebCore::screenIsMonochrome):
1915         (WebCore::screenHasInvertedColors):
1916         (WebCore::screenSize):
1917         (WebCore::availableScreenSize):
1918         (WebCore::screenScaleFactor):
1919
1920 2016-10-24  Joseph Pecoraro  <pecoraro@apple.com>
1921
1922         Remove unnecessary unused variable stubs
1923         https://bugs.webkit.org/show_bug.cgi?id=163688
1924
1925         Reviewed by Simon Fraser.
1926
1927         * Modules/applepay/cocoa/PaymentCocoa.mm:
1928         (WebCore::toDictionary):
1929         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1930         (WebCore::toDictionary):
1931
1932 2016-10-24  Alex Christensen  <achristensen@webkit.org>
1933
1934         Try to fix Windows build after r207767
1935         https://bugs.webkit.org/show_bug.cgi?id=163891
1936
1937         * DerivedSources.cpp:
1938
1939 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
1940
1941         [CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL file
1942         https://bugs.webkit.org/show_bug.cgi?id=163889
1943
1944         Reviewed by Chris Dumez.
1945
1946         Assert that there's only one interface or standalone dictionary
1947         per WebIDL input file, and exit from the generator otherwise.
1948
1949         This avoids potential linking issues where multiple enumeration
1950         and dictionary bindings code can be generated if the source
1951         WebIDL for them is specified in a file that contains multiple
1952         interfaces or standalone dictionaries.
1953
1954         Additionally, the generator now also exits if it fails to
1955         generate code for any interface of standalone dictionary. This
1956         should avoid processing WebIDL files that are empty in
1957         substance.
1958
1959         TestException.idl and TestInterface.idl files have their second
1960         interfaces removed. In place of those a new testing IDL file is
1961         added, TestInterfaceLeadingUnderscore.idl. Like the two removed
1962         interfaces, it tests that the leading underscode in the
1963         identifier is removed by the generator.
1964
1965         * bindings/scripts/CodeGenerator.pm:
1966         (ProcessDocument):
1967         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added.
1968         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::create):
1969         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure):
1970         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype):
1971         (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure):
1972         (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties):
1973         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation):
1974         (WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore):
1975         (WebCore::JSTestInterfaceLeadingUnderscore::createPrototype):
1976         (WebCore::JSTestInterfaceLeadingUnderscore::prototype):
1977         (WebCore::JSTestInterfaceLeadingUnderscore::destroy):
1978         (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
1979         (WebCore::jsTestInterfaceLeadingUnderscoreReadonly):
1980         (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter):
1981         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
1982         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
1983         (WebCore::JSTestInterfaceLeadingUnderscore::getConstructor):
1984         (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
1985         (WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize):
1986         (WebCore::toJSNewlyCreated):
1987         (WebCore::toJS):
1988         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
1989         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h.
1990         (WebCore::JSTestInterfaceLeadingUnderscore::create):
1991         (WebCore::JSTestInterfaceLeadingUnderscore::createStructure):
1992         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
1993         (WebCore::wrapperOwner):
1994         (WebCore::wrapperKey):
1995         (WebCore::toJS):
1996         (WebCore::toJSNewlyCreated):
1997         * bindings/scripts/test/JS/JSattribute.cpp: Removed.
1998         * bindings/scripts/test/JS/JSattribute.h: Removed.
1999         * bindings/scripts/test/JS/JSreadonly.cpp: Removed.
2000         * bindings/scripts/test/TestException.idl:
2001         * bindings/scripts/test/TestInterface.idl:
2002         * bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl.
2003
2004 2016-10-21  Alex Christensen  <achristensen@webkit.org>
2005
2006         URL::port should return Optional<uint16_t>
2007         https://bugs.webkit.org/show_bug.cgi?id=163806
2008
2009         Reviewed by Darin Adler.
2010
2011         A URL without a port is different than a URL with port 0.
2012         This matches the spec, Chrome, and Firefox.
2013
2014         Covered by newly-passing web platform tests.
2015
2016         * Modules/indexeddb/IDBDatabaseIdentifier.h:
2017         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
2018         (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue):
2019         (WebCore::IDBDatabaseIdentifier::hash):
2020         (WebCore::IDBDatabaseIdentifier::isValid):
2021         (WebCore::IDBDatabaseIdentifier::isEmpty):
2022         * Modules/websockets/WebSocket.cpp:
2023         (WebCore::WebSocket::connect):
2024         * Modules/websockets/WebSocketHandshake.cpp:
2025         (WebCore::hostName):
2026         * contentextensions/ContentExtensionsBackend.cpp:
2027         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
2028         (WebCore::ContentExtensions::applyBlockedStatusToRequest):
2029         * html/HTMLPlugInImageElement.cpp:
2030         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot):
2031         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
2032         * html/URLUtils.h:
2033         (WebCore::URLUtils<T>::protocol):
2034         (WebCore::URLUtils<T>::host):
2035         (WebCore::URLUtils<T>::port):
2036         * loader/CrossOriginAccessControl.cpp:
2037         (WebCore::isValidCrossOriginRedirectionURL):
2038         * loader/DocumentLoader.cpp:
2039         (WebCore::DocumentLoader::responseReceived):
2040         (WebCore::isRemoteWebArchive):
2041         (WebCore::DocumentLoader::maybeLoadEmpty):
2042         * loader/DocumentThreadableLoader.cpp:
2043         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
2044         * loader/ResourceLoader.cpp:
2045         (WebCore::ResourceLoader::didReceiveResponse):
2046         * loader/cache/CachedResource.cpp:
2047         (WebCore::shouldCacheSchemeIndefinitely):
2048         (WebCore::CachedResource::freshnessLifetime):
2049         * page/Location.cpp:
2050         (WebCore::Location::protocol):
2051         (WebCore::Location::host):
2052         (WebCore::Location::port):
2053         * page/Page.cpp:
2054         (WebCore::Page::userStyleSheetLocationChanged):
2055         * page/SecurityOrigin.cpp:
2056         (WebCore::shouldTreatAsUniqueOrigin):
2057         (WebCore::SecurityOrigin::SecurityOrigin):
2058         (WebCore::SecurityOrigin::isSecure):
2059         (WebCore::SecurityOrigin::canDisplay):
2060         (WebCore::SecurityOrigin::toRawString):
2061         (WebCore::SecurityOrigin::create):
2062         (WebCore::SecurityOrigin::databaseIdentifier):
2063         * page/SecurityOrigin.h:
2064         (WebCore::SecurityOrigin::port):
2065         * page/SecurityOriginData.cpp:
2066         (WebCore::SecurityOriginData::debugString):
2067         * page/SecurityOriginData.h:
2068         (): Deleted.
2069         * page/SecurityOriginHash.h:
2070         (WebCore::SecurityOriginHash::hash):
2071         * page/csp/ContentSecurityPolicy.cpp:
2072         (WebCore::ContentSecurityPolicy::allowObjectFromSource):
2073         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource):
2074         (WebCore::ContentSecurityPolicy::allowResourceFromSource):
2075         (WebCore::ContentSecurityPolicy::allowConnectToSource):
2076         (WebCore::ContentSecurityPolicy::allowBaseURI):
2077         (WebCore::stripURLForUseInReport):
2078         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded):
2079         * page/csp/ContentSecurityPolicySource.cpp:
2080         (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource):
2081         (WebCore::ContentSecurityPolicySource::portMatches):
2082         * page/csp/ContentSecurityPolicySource.h:
2083         * page/csp/ContentSecurityPolicySourceList.cpp:
2084         (WebCore::ContentSecurityPolicySourceList::parse):
2085         (WebCore::ContentSecurityPolicySourceList::parseSource):
2086         (WebCore::ContentSecurityPolicySourceList::parsePort):
2087         * page/csp/ContentSecurityPolicySourceList.h:
2088         * platform/SchemeRegistry.h:
2089         * platform/URL.cpp:
2090         (WebCore::URL::protocol):
2091         (WebCore::URL::port):
2092         (WebCore::URL::serialize):
2093         (WebCore::portAllowed):
2094         (WebCore::defaultPortsMap): Deleted.
2095         (WebCore::defaultPortForProtocol): Deleted.
2096         (WebCore::isDefaultPortForProtocol): Deleted.
2097         * platform/URL.h:
2098         (WebCore::URL::hasPort): Deleted.
2099         * platform/URLParser.cpp:
2100         (WebCore::defaultPortForProtocol):
2101         (WebCore::isDefaultPortForProtocol):
2102         (WebCore::URLParser::parsePort):
2103         (WebCore::isDefaultPort): Deleted.
2104         * platform/network/CredentialStorage.cpp:
2105         (WebCore::originStringFromURL):
2106         * platform/network/ResourceHandle.cpp:
2107         (WebCore::ResourceHandle::create):
2108         (WebCore::ResourceHandle::loadResourceSynchronously):
2109         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2110         (WebCore::SocketStreamHandleImpl::platformClose):
2111         (WebCore::SocketStreamHandleImpl::port):
2112         * workers/WorkerLocation.cpp:
2113         (WebCore::WorkerLocation::protocol):
2114         (WebCore::WorkerLocation::host):
2115         (WebCore::WorkerLocation::port):
2116
2117 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
2118
2119         [CodeGeneratorJS] Support enums for standalone dictionaries
2120         https://bugs.webkit.org/show_bug.cgi?id=163885
2121
2122         Reviewed by Youenn Fablet.
2123
2124         Add support for enumerations in WebIDL files that specify
2125         standalone dictionaries. Implementation of this is pretty
2126         straight-forward and mirrors interface and callback generators
2127         by calling GenerateEnumerations{Header,Implementation}Content()
2128         functions in GenerateDictionary{Header,Implementation}().
2129
2130         In GenerateEnumerationsImplementationContent(), the
2131         NeverDestroyed.h header is added to the implementation includes
2132         since that class is used to hold an array of possible enum
2133         values.
2134
2135         A test enum is added to the TestStandaloneDictionary.idl file
2136         and the baselines are updated to reflect the new capability.
2137
2138         * bindings/scripts/CodeGenerator.pm:
2139         (ProcessDocument):
2140         * bindings/scripts/CodeGeneratorJS.pm:
2141         (GenerateDictionary):
2142         (GenerateEnumerationsImplementationContent):
2143         (GenerateDictionaryHeader):
2144         (GenerateDictionaryImplementation):
2145         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2146         (WebCore::convertEnumerationToJS):
2147         (WebCore::parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
2148         (WebCore::convertEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
2149         (WebCore::expectedEnumerationValues<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
2150         (WebCore::convertDictionary<DictionaryImplName>):
2151         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
2152         * bindings/scripts/test/TestStandaloneDictionary.idl:
2153
2154 2016-10-24  Dave Hyatt  <hyatt@apple.com>
2155
2156         Remove CSSCharsetRule from the CSS OM
2157         https://bugs.webkit.org/show_bug.cgi?id=163891
2158
2159         Reviewed by Darin Adler.
2160
2161         Remove CSSCharsetRule from the CSS OM. All other browser engines have made this
2162         change. This eliminates the weird overloading of isCharsetRule to match both
2163         CSSCharsetRule and StyleRuleCharset (only used by the new parser).
2164
2165         Fix the destroy() method in StyleRuleBase to clean up StyleRuleCharsets created
2166         by the new parser properly.
2167
2168         * CMakeLists.txt:
2169         * DerivedSources.make:
2170         * WebCore.xcodeproj/project.pbxproj:
2171         * bindings/js/JSCSSRuleCustom.cpp:
2172         (WebCore::toJSNewlyCreated):
2173         * css/CSSCharsetRule.cpp: Removed.
2174         * css/CSSCharsetRule.h: Removed.
2175         * css/CSSCharsetRule.idl: Removed.
2176         * css/CSSPropertySourceData.h:
2177         * css/CSSStyleSheet.cpp:
2178         (WebCore::CSSStyleSheet::item):
2179         (WebCore::CSSStyleSheet::rules):
2180         * css/CSSStyleSheet.h:
2181         * css/StyleRule.cpp:
2182         (WebCore::StyleRuleBase::destroy):
2183         * inspector/InspectorStyleSheet.cpp:
2184         (WebCore::asCSSRuleList):
2185
2186 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
2187
2188         [CodeGeneratorJS] Standalone dictionaries have misplaced build guards
2189         https://bugs.webkit.org/show_bug.cgi?id=163881
2190
2191         Reviewed by Chris Dumez.
2192
2193         Build guards that are generated from the Conditional attribute
2194         on WebIDL dictionary declarations properly guard the relevant
2195         convertDictionary() functions for WebIDL files that also specify
2196         interfaces. But for standalone dictionaries these build guards
2197         should guard the complete header and implementation files, much
2198         like this is done for files that originate from interfaces or
2199         callbacks.
2200
2201         Before this patch, guarding a standalone dictionary resulted in
2202         malformed output because GenerateHeaderContentHeader() and
2203         GenerateImplementationContentHeader() functions both generated
2204         the #if macro that would guard the whole file, but
2205         GenerateDictionary{Header,Implementation}() didn't generate the
2206         closing #endif.
2207
2208         CodeGeneratorJS.pm now passes the conditional string, if any,
2209         to GenerateDictionary{Header,Implementation}Content() functions
2210         in case of a non-standalone dictionary. Otherwise, the
2211         conditional string, if any, is used to guard the complete
2212         header and implementation files.
2213
2214         Generator tests are updated to cover various build guard
2215         combinations on dictionaries in TestObj.idl, and the standalone
2216         dictionary WebIDL file now has a Conditional attribute to check
2217         that the build guards cover complete generated header and
2218         implementation files.
2219
2220         * bindings/scripts/CodeGeneratorJS.pm:
2221         (GenerateDictionaryHeaderContent):
2222         (GenerateDictionariesHeaderContent):
2223         (GenerateDictionaryImplementationContent):
2224         (GenerateDictionariesImplementationContent):
2225         (GenerateDictionaryHeader):
2226         (GenerateDictionaryImplementation):
2227         * bindings/scripts/test/JS/JSTestObj.cpp:
2228         (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>):
2229         (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>):
2230         (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>):
2231         * bindings/scripts/test/JS/JSTestObj.h:
2232         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2233         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
2234         * bindings/scripts/test/TestObj.idl:
2235         * bindings/scripts/test/TestStandaloneDictionary.idl:
2236
2237 2016-10-24  Eric Carlson  <eric.carlson@apple.com>
2238
2239         [MediaStream] Separate media capture and audio playback muting
2240         https://bugs.webkit.org/show_bug.cgi?id=163855
2241         <rdar://problem/28827186>
2242
2243         Reviewed by Darin Adler.
2244
2245         Test: fast/mediastream/MediaStream-page-muted.html
2246
2247         Change page.muted from a bool to a bitfield so audio and media capture muted are independent.
2248         Fix a couple of bugs in the mock media capture device uncovered by new test case.
2249         
2250         * Modules/mediastream/MediaStream.cpp:
2251         (WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState.
2252
2253         * Modules/webaudio/AudioContext.cpp:
2254         (WebCore::AudioContext::pageMutedStateDidChange): Ditto.
2255
2256         * html/HTMLMediaElement.cpp:
2257         (WebCore::HTMLMediaElement::updateVolume): Ditto.
2258         (WebCore::HTMLMediaElement::effectiveMuted): Ditto.
2259
2260         * page/MediaProducer.h: Add MutedState enum.
2261
2262         * page/Page.cpp:
2263         (WebCore::Page::Page):
2264         (WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState.
2265         * page/Page.h:
2266
2267         * platform/mock/MockRealtimeMediaSource.cpp:
2268         (WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted.
2269         (WebCore::MockRealtimeMediaSource::stopProducingData): Ditto.
2270         * platform/mock/MockRealtimeMediaSource.h:
2271
2272         * platform/mock/MockRealtimeVideoSource.cpp:
2273         (WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method.
2274
2275         * testing/Internals.cpp:
2276         (WebCore::Internals::setPageMuted): Change parameter from a bool to a string.
2277         * testing/Internals.h:
2278
2279         * testing/Internals.idl:
2280
2281 2016-10-24  Darin Adler  <darin@apple.com>
2282
2283         Try to fix Windows build.
2284
2285         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Rearranged includes
2286         so they are inside the conditional as they should be.
2287
2288 2016-10-24  Youenn Fablet  <youenn@apple.com>
2289
2290         Activate WEB_RTC compilation flags for Mac bots
2291         https://bugs.webkit.org/show_bug.cgi?id=163886
2292
2293         Reviewed by Eric Carlson.
2294
2295         Covered by existing tests.
2296
2297         Fixing compilation errors due to missing WEBCORE_EXPORT, missing method and missing override keywords.
2298
2299         * Configurations/FeatureDefines.xcconfig:
2300         * DerivedSources.make:
2301         * Modules/mediastream/MediaEndpointPeerConnection.h:
2302         * Modules/mediastream/RTCPeerConnection.h:
2303         * Modules/mediastream/RTCPeerConnection.idl:
2304         * Modules/mediastream/SDPProcessor.cpp:
2305         (WebCore::SDPProcessor::generate):
2306         (WebCore::SDPProcessor::parse):
2307         * WebCore.xcodeproj/project.pbxproj:
2308         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2309         (WebCore::MockRealtimeVideoSource::createMuted):
2310
2311 2016-10-24  Brady Eidson  <beidson@apple.com>
2312
2313         IndexedDB 2.0: Support IDBIndex name assignment.
2314         <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805
2315
2316         Reviewed by Alex Christensen.
2317
2318         Tests: storage/indexeddb/modern/index-rename-1-private.html
2319                storage/indexeddb/modern/index-rename-1.html
2320
2321         Touches a *lot* of code sites, but none of them are particularly interesting.
2322         They are all just getting the new name spread out to all of the various objects that need it.
2323
2324         * Modules/indexeddb/IDBDatabase.cpp:
2325         (WebCore::IDBDatabase::renameIndex):
2326         * Modules/indexeddb/IDBDatabase.h:
2327
2328         * Modules/indexeddb/IDBIndex.cpp:
2329         (WebCore::IDBIndex::IDBIndex):
2330         (WebCore::IDBIndex::setName):
2331         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
2332         * Modules/indexeddb/IDBIndex.h:
2333         * Modules/indexeddb/IDBIndex.idl:
2334
2335         * Modules/indexeddb/IDBObjectStore.cpp:
2336         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2337         (WebCore::IDBObjectStore::renameReferencedIndex):
2338         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort): Deleted.
2339         * Modules/indexeddb/IDBObjectStore.h:
2340
2341         * Modules/indexeddb/IDBTransaction.cpp:
2342         (WebCore::IDBTransaction::internalAbort):
2343         (WebCore::IDBTransaction::renameIndex):
2344         (WebCore::IDBTransaction::renameIndexOnServer):
2345         (WebCore::IDBTransaction::didRenameIndexOnServer):
2346         * Modules/indexeddb/IDBTransaction.h:
2347
2348         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2349         (WebCore::IDBClient::IDBConnectionProxy::renameIndex):
2350         * Modules/indexeddb/client/IDBConnectionProxy.h:
2351
2352         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2353         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
2354         (WebCore::IDBClient::IDBConnectionToServer::didRenameIndex):
2355         * Modules/indexeddb/client/IDBConnectionToServer.h:
2356         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2357
2358         * Modules/indexeddb/client/TransactionOperation.h:
2359         (WebCore::IDBClient::createTransactionOperation):
2360
2361         * Modules/indexeddb/server/IDBBackingStore.h:
2362
2363         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
2364         (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex):
2365         * Modules/indexeddb/server/IDBConnectionToClient.h:
2366         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
2367
2368         * Modules/indexeddb/server/IDBServer.cpp:
2369         (WebCore::IDBServer::IDBServer::renameIndex):
2370         * Modules/indexeddb/server/IDBServer.h:
2371
2372         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
2373         (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed):
2374         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
2375         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
2376
2377         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
2378         (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex):
2379         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
2380
2381         * Modules/indexeddb/server/MemoryIndex.h:
2382         (WebCore::IDBServer::MemoryIndex::rename):
2383
2384         * Modules/indexeddb/server/MemoryObjectStore.cpp:
2385         (WebCore::IDBServer::MemoryObjectStore::renameIndex):
2386         * Modules/indexeddb/server/MemoryObjectStore.h:
2387
2388         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2389         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
2390         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2391
2392         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2393         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
2394         (WebCore::IDBServer::UniqueIDBDatabase::performRenameIndex):
2395         (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameIndex):
2396         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2397
2398         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
2399         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex):
2400         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
2401
2402         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
2403         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex):
2404         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
2405
2406         * Modules/indexeddb/shared/IDBIndexInfo.h:
2407         (WebCore::IDBIndexInfo::rename):
2408
2409         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
2410         (WebCore::IDBObjectStoreInfo::infoForExistingIndex):
2411         * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
2412
2413         * Modules/indexeddb/shared/IDBResultData.cpp:
2414         (WebCore::IDBResultData::renameIndexSuccess):
2415         * Modules/indexeddb/shared/IDBResultData.h:
2416
2417         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2418         (WebCore::InProcessIDBServer::didRenameIndex):
2419         (WebCore::InProcessIDBServer::renameIndex):
2420         * Modules/indexeddb/shared/InProcessIDBServer.h:
2421
2422 2016-10-24  Dave Hyatt  <hyatt@apple.com>
2423
2424         [CSS Parser] Fix -webkit-box-reflect parsing
2425         https://bugs.webkit.org/show_bug.cgi?id=163890
2426
2427         Reviewed by Zalan Bujtas.
2428
2429         * css/parser/CSSPropertyParser.cpp:
2430         (WebCore::consumeReflect):
2431         Do a WTFMove on the mask instead of a .releaseNonNull(), since mask can be a nullptr.
2432         Exactly matches the old parser.
2433
2434         * css/parser/CSSPropertyParserHelpers.cpp:
2435         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
2436         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
2437         (WebCore::CSSPropertyParserHelpers::consumeInteger):
2438         (WebCore::CSSPropertyParserHelpers::consumeNumber):
2439         (WebCore::CSSPropertyParserHelpers::consumeLength):
2440         (WebCore::CSSPropertyParserHelpers::consumePercent):
2441         (WebCore::CSSPropertyParserHelpers::consumeAngle):
2442         (WebCore::CSSPropertyParserHelpers::consumeTime):
2443         (WebCore::CSSPropertyParserHelpers::consumeUrl):
2444         (WebCore::CSSPropertyParserHelpers::consumeColor):
2445         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
2446         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
2447         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
2448         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
2449         Clean up all instances of CSSPrimitiveValue::create to use the CSSValuePool.
2450
2451 2016-10-21  Antoine Quint  <graouts@apple.com>
2452
2453         [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources
2454         https://bugs.webkit.org/show_bug.cgi?id=163785
2455         <rdar://problem/28890058>
2456
2457         Reviewed by Darin Adler.
2458
2459         Concatenate CSS and JS resources for modern media controls into single JS and CSS files
2460         during build and load these single resources alone at runtime.
2461
2462         * Modules/modern-media-controls/js-files: Added.
2463         * WebCore.xcodeproj/project.pbxproj:
2464         * rendering/RenderThemeMac.mm:
2465         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2466         (WebCore::RenderThemeMac::mediaControlsScript):
2467
2468 2016-10-24  Dave Hyatt  <hyatt@apple.com>
2469
2470         [CSS Parser] Unprefix -webkit-writing-mode
2471         https://bugs.webkit.org/show_bug.cgi?id=163870
2472
2473         Reviewed by Zalan Bujtas.
2474
2475         * css/CSSComputedStyleDeclaration.cpp:
2476         (WebCore::ComputedStyleExtractor::propertyValue):
2477         Change -webkit-writing mode to writing-mode.
2478
2479         * css/CSSPrimitiveValueMappings.h:
2480         (WebCore::CSSPrimitiveValue::operator WritingMode):
2481         (WebCore::CSSPrimitiveValue::operator SVGWritingMode): Deleted.
2482         Eliminate the SVGWritingMode converters. Add support for the unique SVG-specific
2483         values to the WritingMode converters.
2484
2485         * css/CSSPropertyNames.in:
2486         Alias -webkit-writing-mode to writing-mode. Move writing-mode up to be
2487         high priority like -webkit-writing mode was. Alias -epub-writing-mode to writing-mode
2488         instead of to -webkit-writing-mode.
2489
2490         * css/SVGCSSComputedStyleDeclaration.cpp:
2491         (WebCore::ComputedStyleExtractor::svgPropertyValue):
2492         Remove writing-mode from SVG computed style, since the base CSSComputedStyleDeclaration handles it.
2493
2494         * css/StyleBuilderCustom.h:
2495         (WebCore::StyleBuilderCustom::applyValueWritingMode):
2496         (WebCore::StyleBuilderCustom::applyValueWebkitWritingMode): Deleted.
2497         Renamed applyValueWebkitWritingMode to applyValueWritingMode. Removed the SVG code, since
2498         the underlying converter for WritingMode now handles those values.
2499
2500         * css/StyleResolver.cpp:
2501         (WebCore::extractDirectionAndWritingMode):
2502         Rename -webkit-writing-mode to writing-mode.
2503
2504         * css/parser/CSSParser.cpp:
2505         (WebCore::isValidKeywordPropertyAndValue):
2506         Eliminate -webkit-writing-mode and make sure writing-mode handles both the SVG values
2507         and the normal values.
2508
2509         * css/parser/CSSParserFastPaths.cpp:
2510         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2511         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2512         Same deal here.
2513
2514         * html/track/TextTrackCueGeneric.cpp:
2515         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
2516         * html/track/VTTCue.cpp:
2517         (WebCore::VTTCueBox::applyCSSProperties):
2518         Cue stuff was setting -webkit-writing-mode, so make it set writing-mode instead now.
2519
2520         * rendering/RenderLineBreak.cpp:
2521         (WebCore::RenderLineBreak::collectSelectionRects):
2522         * rendering/RenderText.cpp:
2523         (WebCore::RenderText::collectSelectionRects):
2524         Switch the SVG-specific code here over to accessing the RenderStyle writing-mode and not
2525         the SVG-specific one.
2526
2527         * rendering/style/RenderStyle.h:
2528         (WebCore::RenderStyle::isVerticalWritingMode):
2529         Add a helper function for asking if something is vertical writing mode.
2530
2531         * rendering/style/SVGRenderStyle.cpp:
2532         * rendering/style/SVGRenderStyle.h:
2533         * rendering/style/SVGRenderStyleDefs.h:
2534         (WebCore::SVGRenderStyle::diff):
2535         Remove the SVG writing mode code.
2536
2537         * rendering/svg/RenderSVGInlineText.cpp:
2538         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
2539         Make sure to force SVG font descriptions to be horizontal, since SVG controls
2540         its own glyph orientation.
2541
2542         * rendering/svg/SVGRenderTreeAsText.cpp:
2543         (WebCore::writeSVGInlineTextBox):
2544         * rendering/svg/SVGTextChunk.cpp:
2545         (WebCore::SVGTextChunk::SVGTextChunk):
2546         * rendering/svg/SVGTextLayoutEngine.cpp:
2547         (WebCore::SVGTextLayoutEngine::layoutInlineTextBox):
2548         * rendering/svg/SVGTextQuery.cpp:
2549         (WebCore::SVGTextQuery::executeQuery):
2550         Changed to access the RenderStyle writing mode instead of the SVG-specific one.
2551
2552 2016-10-23  Antti Koivisto  <antti@apple.com>
2553
2554         Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties
2555         https://bugs.webkit.org/show_bug.cgi?id=163875
2556
2557         Reviewed by Andreas Kling.
2558
2559         Test: fast/css/getComputedStyle/getComputedStyle-style-resolution.html
2560
2561         * css/CSSComputedStyleDeclaration.cpp:
2562         (WebCore::hasValidStyleForProperty):
2563
2564             For non-inherited properties we don't need to update style even if some ancestor style is invalid
2565             as long as explicit 'inherit' is not being used.
2566             We still need to update if we find out that the whole subtree we are in is invalid.
2567
2568         (WebCore::updateStyleIfNeededForProperty):
2569
2570             Pass the property.
2571
2572         (WebCore::ComputedStyleExtractor::customPropertyValue):
2573         (WebCore::ComputedStyleExtractor::propertyValue):
2574         (WebCore::CSSComputedStyleDeclaration::length):
2575         (WebCore::elementOrItsAncestorNeedsStyleRecalc): Deleted.
2576         (WebCore::updateStyleIfNeededForElement): Deleted.
2577         * css/StyleResolver.cpp:
2578         (WebCore::StyleResolver::colorFromPrimitiveValue):
2579
2580             Mark style as using explicit inheritance if 'currentcolor' value is used.
2581
2582 2016-10-24  Youenn Fablet  <youenn@apple.com>
2583
2584         ASSERTION FAILED: canvas()->securityOrigin()->toString() == cachedImage.origin()->toString()
2585         https://bugs.webkit.org/show_bug.cgi?id=163242
2586
2587         Reviewed by Darin Adler.
2588
2589         Test: http/tests/security/cross-origin-cached-images-canvas.html
2590
2591         We were previously on Origin HTTP header to check whether requests were made from different origins.
2592         This is fine for CORS enabled requests but not for GET no CORS requests since they will not have any Origin header.
2593
2594         Now that CachedResource and CachedResourceRequest own their origin, it is best to use these directly.
2595
2596         * loader/cache/CachedResourceLoader.cpp:
2597         (WebCore::isRequestMatchingResourceOrigin):
2598         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2599
2600 2016-10-24  Youenn Fablet  <youenn@apple.com>
2601
2602         Remove CachedResource::passesSameOriginPolicyCheck
2603         https://bugs.webkit.org/show_bug.cgi?id=163593
2604
2605         Reviewed by Andreas Kling.
2606
2607         No change of behavior.
2608
2609         Removing no-longer used code.
2610
2611         * loader/cache/CachedResource.cpp:
2612         (WebCore::CachedResource::redirectReceived):
2613         (WebCore::CachedResource::passesAccessControlCheck): Deleted.
2614         (WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted.
2615         (WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted.
2616         * loader/cache/CachedResource.h:
2617         (WebCore::CachedResource::response):
2618
2619 2016-10-24  Youenn Fablet  <youenn@apple.com>
2620
2621         Redirections should be upgraded if CSP policy says so
2622         https://bugs.webkit.org/show_bug.cgi?id=163544
2623
2624         Reviewed by Darin Adler.
2625
2626         Test: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-after-redirect.https.html
2627
2628         Introducing CachedResourceLoader::updateRequestAfterRedirection to do the checks that CachedResourceLoader is doing
2629         to the initial request, but for redirection requests.
2630
2631         Implemented URL upgrade according CSP policy, as specified by fetch algorithm.
2632         Minor refactoring in CachedResourceRequest to share some code.
2633         Fixing some constness issues.
2634
2635         * loader/SubresourceLoader.cpp:
2636         (WebCore::SubresourceLoader::willSendRequestInternal):
2637         * loader/cache/CachedResourceLoader.cpp:
2638         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
2639         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
2640         (WebCore::CachedResourceLoader::updateRequestAfterRedirection):
2641         * loader/cache/CachedResourceLoader.h:
2642         * loader/cache/CachedResourceRequest.cpp:
2643         (WebCore::upgradeInsecureResourceRequestIfNeeded):
2644         (WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded):
2645         * loader/cache/CachedResourceRequest.h:
2646
2647 2016-10-22  Sam Weinig  <sam@webkit.org>
2648
2649         [WebIDL] Add IDLType based toJS conversion
2650         https://bugs.webkit.org/show_bug.cgi?id=163861
2651
2652         Reviewed by Darin Adler.
2653
2654         Adds toJS<IDLType>() functions to be the new way of converting
2655         from implementation types to JS types. These are implemented via
2656         a similar mechanism to the convert<IDL>() functions, though specializations
2657         of a JSConverter struct (rather than the Converter structs). This allows
2658         us to support arbitrarily complex aggregate types easily (e.g. sequence<(Node or DOMString?)>).
2659
2660         * Modules/geolocation/Geoposition.idl:
2661         * dom/Event.idl:
2662         Add typedef for DOMTimeStamp. Eventually, our IDLParser should do this for us, but
2663         for now it allows us to simplify the type system.
2664
2665         * bindings/js/JSDOMBinding.h:
2666         (WebCore::JSValueTraits::arrayJSValue): Deleted.
2667         (WebCore::JSValueTraits<String>::arrayJSValue): Deleted.
2668         (WebCore::JSValueTraits<double>::arrayJSValue): Deleted.
2669         (WebCore::JSValueTraits<float>::arrayJSValue): Deleted.
2670         (WebCore::jsArray): Deleted.
2671         (WebCore::jsFrozenArray): Deleted.
2672         (WebCore::NativeValueTraits<String>::nativeValue): Deleted.
2673         (WebCore::NativeValueTraits<unsigned>::nativeValue): Deleted.
2674         (WebCore::NativeValueTraits<float>::nativeValue): Deleted.
2675         (WebCore::NativeValueTraits<double>::nativeValue): Deleted.
2676         (WebCore::toNullableJSNumber): Deleted.
2677         (WebCore::toJSArray): Deleted.
2678         (WebCore::toJSBoolean): Deleted.
2679         (WebCore::toJSNumber): Deleted.
2680         (WebCore::toJSString): Deleted.
2681         Remove many now-unneeded conversion functions.
2682
2683         * bindings/js/JSDOMConvert.h:
2684         (WebCore::toJS):
2685         Add 5 primary toJS functions which take combinations of the following
2686         arguments: ExecState, JSDOMGlobalObject, ThrowScope.  All take the value 
2687         to be converted as well, except in the case of the throwScope ones, where
2688         they take the value in an ExceptionOr<>.
2689
2690         To simplify the implementations of the JSConverter specializations, avoiding
2691         the need for each one to implement their conversion up to 3 times (one for just
2692         the value, one for the value and the ExecState, and one for the value, the ExecState
2693         and the global object), each JSConverter instead specifies whether it's converter
2694         needs an ExecState or global object via a static constexpr. We then use the 
2695         JSConverterOverloader template, to call the correct function. This can probably be
2696         improved in the future, by inferring the number of arguments needed via SFINAE, but
2697         this seemed like a more straightforward first cut.
2698
2699         (WebCore::JSConverter<IDLNullable<T>>::convert):
2700         (WebCore::JSConverter<IDLBoolean>::convert):
2701         (WebCore::JSConverter<IDLInterface<T>>::convert):
2702         (WebCore::JSConverter<IDLAny>::convert):
2703         (WebCore::JSConverter<IDLByte>::convert):
2704         (WebCore::JSConverter<IDLOctet>::convert):
2705         (WebCore::JSConverter<IDLShort>::convert):
2706         (WebCore::JSConverter<IDLUnsignedShort>::convert):
2707         (WebCore::JSConverter<IDLLong>::convert):
2708         (WebCore::JSConverter<IDLUnsignedLong>::convert):
2709         (WebCore::JSConverter<IDLLongLong>::convert):
2710         (WebCore::JSConverter<IDLUnsignedLongLong>::convert):
2711         (WebCore::JSConverter<IDLFloat>::convert):
2712         (WebCore::JSConverter<IDLUnrestrictedFloat>::convert):
2713         (WebCore::JSConverter<IDLDouble>::convert):
2714         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
2715         (WebCore::JSConverter<IDLDOMString>::convert):
2716         (WebCore::JSConverter<IDLUSVString>::convert):
2717         (WebCore::JSConverter<IDLSequence<T>>::convert):
2718         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
2719         (WebCore::JSConverter<IDLEnumeration<T>>::convert):
2720         (WebCore::JSConverter<IDLUnion<T...>>::convert):
2721         There is slightly more duplication than I would have liked, for instance we have a
2722         specialization for each numeric type, even though they are all the same, but that is
2723         something that can be improved going forward.
2724
2725         (WebCore::Converter<IDLUnion<T...>>::convert)
2726         Fix the normal IDLUnion converter to work with boolean types. This was caught by the
2727         test case I added via TypeConversions.idl.
2728         
2729         * bindings/js/JSDOMStringMapCustom.cpp:
2730         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate):
2731         * bindings/js/JSDOMWindowCustom.cpp:
2732         (WebCore::JSDOMWindow::setTimeout):
2733         (WebCore::JSDOMWindow::setInterval):
2734         * bindings/js/JSDataTransferCustom.cpp:
2735         (WebCore::JSDataTransfer::types):
2736         * bindings/js/JSMediaStreamTrackCustom.cpp:
2737         (WebCore::JSMediaStreamTrack::getCapabilities):
2738         * bindings/js/JSMutationCallback.cpp:
2739         (WebCore::JSMutationCallback::call):
2740         * bindings/js/JSSVGLengthCustom.cpp:
2741         (WebCore::JSSVGLength::value):
2742         Switch to use new toJS<> functions.
2743
2744         * bindings/scripts/CodeGeneratorJS.pm:
2745         (AddStringifierOperationIfNeeded):
2746         Fix stringifier function signature to contain an idlType.
2747
2748         (GenerateEnumerationsHeaderContent):
2749         Remove now unnecessary JSValueTraits specializations.
2750
2751         (JSValueToNativeIsHandledByDOMConvert):
2752         Renamed from IsHandledByDOMConvert, since that name is now ambiguous.
2753
2754         (JSValueToNative):
2755         Update for new name of IsHandledByDOMConvert.
2756
2757         (NativeToJSValueIsHandledByDOMConvert):
2758         Predicate guarding what types currently work with the new conversion system.
2759
2760         (NativeToJSValueDOMConvertNeedsState):
2761         Predicate for determining if the ExecState is needed in the conversion function.
2762
2763         (NativeToJSValueDOMConvertNeedsGlobalObject):
2764         Predicate for determining if the global object is needed in the conversion function.
2765
2766         (NativeToJSValue):
2767         Move things around a little bit and start converting use the new toJS<> when possible.
2768
2769         * bindings/scripts/IDLParser.pm:
2770         (parseAttributeOrOperationRest):
2771         Fix a missing place where were not setting the idlType.
2772  
2773         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2774         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2775         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2776         * bindings/scripts/test/JS/JSTestCallback.cpp:
2777         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2778         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2779         * bindings/scripts/test/JS/JSTestException.cpp:
2780         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2781         * bindings/scripts/test/JS/JSTestInterface.cpp:
2782         * bindings/scripts/test/JS/JSTestNode.cpp:
2783         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2784         * bindings/scripts/test/JS/JSTestObj.cpp:
2785         * bindings/scripts/test/JS/JSTestObj.h:
2786         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2787         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2788         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2789         * bindings/scripts/test/JS/JSattribute.cpp:
2790         Update test results.
2791
2792         * testing/TypeConversions.h:
2793         (WebCore::TypeConversions::testUnion):
2794         (WebCore::TypeConversions::setTestUnion):
2795         (WebCore::TypeConversions::typeConversionsDictionarySequenceValue):
2796         (WebCore::TypeConversions::typeConversionsDictionaryUnionValue):
2797         * testing/TypeConversions.idl:
2798         Add a testUnion attribute, now that we can return unions to JS.
2799
2800 2016-10-23  Zalan Bujtas  <zalan@apple.com>
2801
2802         Unreviewed, rolling out r207727.
2803
2804         broke 15 selection test cases.
2805
2806         Reverted changeset:
2807
2808         "Do not update selection rect on dirty lineboxes."
2809         https://bugs.webkit.org/show_bug.cgi?id=163862
2810         http://trac.webkit.org/changeset/207727
2811
2812 2016-10-23  Chris Dumez  <cdumez@apple.com>
2813
2814         addEventListener() / removeEventListener() should use a union for last parameter
2815         https://bugs.webkit.org/show_bug.cgi?id=163863
2816
2817         Reviewed by Darin Adler.
2818
2819         addEventListener() / removeEventListener() should use a union for last parameter:
2820         - https://dom.spec.whatwg.org/#eventtarget
2821
2822         No new tests, no Web-exposed behavior change.
2823
2824         * bindings/js/JSDOMConvert.h:
2825         * dom/EventTarget.cpp:
2826         (WebCore::EventTarget::addEventListenerForBindings):
2827         (WebCore::EventTarget::removeEventListenerForBindings):
2828         * dom/EventTarget.h:
2829         * dom/EventTarget.idl:
2830
2831 2016-10-23  Zalan Bujtas  <zalan@apple.com>
2832
2833         Do not update selection rect on dirty lineboxes.
2834         https://bugs.webkit.org/show_bug.cgi?id=163862
2835         <rdar://problem/28813156>
2836
2837         Reviewed by Simon Fraser.
2838
2839         In addition to checking whether the renderer needs layout, we also need to check if its preferred
2840         width is clean and stop computing the selection rects, if needed (while adding a renderer to the tree,
2841         there's a transition phase where the parent's preferred width dirty bit is already set, but it does
2842         not yet need layout).
2843
2844         Tests: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html
2845
2846         * rendering/RenderObject.cpp:
2847         (WebCore::RenderObject::canUpdateSelectionOnRootLineBoxes):
2848
2849 2016-10-22  Myles C. Maxfield  <mmaxfield@apple.com>
2850
2851         ASSERTION FAILED: m_fonts in &WebCore::FontCascade::primaryFont
2852         https://bugs.webkit.org/show_bug.cgi?id=163459
2853
2854         Reviewed by Darin Adler.
2855
2856         The CSS Units and Values spec states that font-relative units, when used
2857         in the font-size property, are resolved against the parent element. When
2858         calc() is specified, we were trying to resolve them against the current
2859         element, which is impossible because of the circular dependency. Instead,
2860         we should resolve against the parent style the same way as when calc() 
2861         isn't specified.
2862
2863         Test: fast/text/font-size-calc.html
2864
2865         * css/StyleBuilderCustom.h:
2866         (WebCore::StyleBuilderCustom::applyValueFontSize):
2867
2868 2016-10-22  Chris Dumez  <cdumez@apple.com>
2869
2870         [Web IDL] Two types are distinguishable for overload resolution if at most one of the two includes a nullable type
2871         https://bugs.webkit.org/show_bug.cgi?id=163791
2872
2873         Reviewed by Sam Weinig.
2874
2875         Update overload resolution in the bindings generator so that 2 nullable types
2876         are no longer considered as distinguishable, as per Web IDL:
2877         - https://heycam.github.io/webidl/#dfn-distinguishable
2878
2879         * bindings/scripts/CodeGeneratorJS.pm:
2880         (AreTypesDistinguishableForOverloadResolution):
2881         * bindings/scripts/test/JS/JSTestObj.cpp:
2882         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1):
2883         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Caller):
2884         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2):
2885         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Caller):
2886         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
2887         * bindings/scripts/test/TestObj.idl:
2888
2889 2016-10-22  Chris Dumez  <cdumez@apple.com>
2890
2891         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading
2892         https://bugs.webkit.org/show_bug.cgi?id=163859
2893
2894         Reviewed by Darin Adler.
2895
2896         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading:
2897         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
2898
2899         No new tests, no Web-exposed behavior change.
2900
2901         * html/canvas/WebGL2RenderingContext.cpp:
2902         (WebCore::WebGL2RenderingContext::texSubImage2D):
2903         * html/canvas/WebGL2RenderingContext.h:
2904         * html/canvas/WebGLRenderingContext.cpp:
2905         (WebCore::WebGLRenderingContext::texSubImage2D):
2906         * html/canvas/WebGLRenderingContext.h:
2907         * html/canvas/WebGLRenderingContextBase.h:
2908         * html/canvas/WebGLRenderingContextBase.idl:
2909
2910 2016-10-22  Dan Bernstein  <mitz@apple.com>
2911
2912         Dynamically-added backdrop filter to clip-path'd element with 3D transform renders incorrectly (without clip)
2913         https://bugs.webkit.org/show_bug.cgi?id=163497
2914
2915         Reviewed by Simon Fraser.
2916
2917         Test: css3/filters/backdrop/dynamic-with-clip-path.html
2918
2919         * platform/graphics/ca/GraphicsLayerCA.cpp:
2920         (WebCore::GraphicsLayerCA::ensureStructuralLayer): Added MaskLayerChanged to
2921           structuralLayerChangeFlags to ensure that the mask layer is updated.
2922
2923 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
2924
2925         Backdrop filter doesn't show if removed then re-added
2926         https://bugs.webkit.org/show_bug.cgi?id=163860
2927
2928         Reviewed by Dan Bernstein.
2929
2930         When a backdrop filter is removed the re-added, updateBackdropFiltersRect() never
2931         runs the second time because m_backdropFiltersRect doesn't change. However, we need
2932         to run that code to size and position the newly re-created backdrop layer, so run
2933         it explicitly if we just created the backdrop layer. This is similar to how
2934         updateContentsImage() calls updateContentsRects().
2935
2936         Test: css3/filters/backdrop/add-remove-add-backdrop-filter.html
2937
2938         * platform/graphics/ca/GraphicsLayerCA.cpp:
2939         (WebCore::GraphicsLayerCA::setBackdropFilters):
2940         (WebCore::GraphicsLayerCA::updateBackdropFilters):
2941
2942 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
2943
2944         Fix repainting of slow repaint objects in WK1 when page scale is applied
2945         https://bugs.webkit.org/show_bug.cgi?id=163854
2946
2947         Reviewed by Zalan Bujtas.
2948         
2949         RenderObject::repaintSlowRepaintObject() always set the repaint container to the RenderView
2950         if it was null. This is before the call to clippedOverflowRectForRepaint(). If that function
2951         is called with a null repaintContainer, it maps the rect up through the RenderView's transform
2952         (which represents page scale), which is what we want here. Passing the RenderView itself
2953         stops the transform from being applied, which led to the bug.
2954         
2955         WebKit2 doesn't suffer from this bug because containerForRepaint() always returns the
2956         composited RenderView.
2957
2958         Test: fast/repaint/zoomed-fixed-background.html
2959
2960         * rendering/RenderObject.cpp:
2961         (WebCore::RenderObject::repaintSlowRepaintObject):
2962
2963 2016-10-22  Darin Adler  <darin@apple.com>
2964
2965         Move HTML canvas and tracks from ExceptionCode to Exception
2966         https://bugs.webkit.org/show_bug.cgi?id=163853
2967
2968         Reviewed by Chris Dumez.
2969
2970         * WebCore.xcodeproj/project.pbxproj: Added CanvasPath.idl.
2971
2972         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Tweaked a bit.
2973
2974         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2975         (WebCore::JSWebGLRenderingContextBase::getExtension): Tweaked a bit.
2976         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
2977         Removed unneeded exception handling.
2978         (WebCore::JSWebGLRenderingContextBase::getParameter): Ditto.
2979         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Ditto.
2980         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Ditto.
2981         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Use a
2982         modern for loop.
2983         (WebCore::JSWebGLRenderingContextBase::getUniform): Removed unneeded
2984         exception handling.
2985
2986         * html/HTMLCanvasElement.cpp:
2987         (WebCore::HTMLCanvasElement::getContext): Pass a reference.
2988         (WebCore::HTMLCanvasElement::reset): Use is<CanvasRenderingContext2D>.
2989         (WebCore::HTMLCanvasElement::setUsesDisplayListDrawing): Ditto.
2990         (WebCore::HTMLCanvasElement::setTracksDisplayListReplay) Ditto.:
2991         (WebCore::HTMLCanvasElement::displayListAsText): Ditto.
2992         (WebCore::HTMLCanvasElement::replayDisplayListAsText): Ditto.
2993         (WebCore::HTMLCanvasElement::clearImageBuffer): Ditto.
2994
2995         * html/canvas/CanvasGradient.cpp:
2996         (WebCore::CanvasGradient::CanvasGradient): Streamlined.
2997         (WebCore::CanvasGradient::addColorStop): Use ExceptionOr.
2998         * html/canvas/CanvasGradient.h: Updated for above changes.
2999         * html/canvas/CanvasGradient.idl: Use non-legacy exception.
3000
3001         * html/canvas/CanvasPath.cpp:
3002         (WebCore::CanvasPath::arcTo): Use ExceptionOr.
3003         (WebCore::CanvasPath::arc): Ditto.
3004         (WebCore::CanvasPath::ellipse): Ditto.
3005         * html/canvas/CanvasPath.h: Updated for above changes.
3006         * html/canvas/CanvasPath.idl: Use non-legacy exceptions.
3007
3008         * html/canvas/CanvasPattern.cpp:
3009         (WebCore::CanvasPattern::create): Use Ref&&.
3010         (WebCore::CanvasPattern::CanvasPattern): Ditto.
3011         (WebCore::CanvasPattern::parseRepetitionType): Return a boolean
3012         instead of using an ExceptionCode.
3013         * html/canvas/CanvasPattern.h: Updated for above changes.
3014
3015         * html/canvas/CanvasRenderingContext.cpp:
3016         (CanvasRenderingContext::wouldTaintOrigin): Reordered function so
3017         that it's safe to call it on an image element without a cached
3018         image, or a cached image without an underlying image.
3019
3020         * html/canvas/CanvasRenderingContext2D.cpp:
3021         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
3022         Take a reference.
3023         (WebCore::CanvasRenderingContext2D::drawImage): Use ExceptionOr.
3024         (WebCore::CanvasRenderingContext2D::drawImageFromRect): Ditto.
3025         (WebCore::CanvasRenderingContext2D::createLinearGradient): Ditto.
3026         (WebCore::CanvasRenderingContext2D::createRadialGradient): Ditto.
3027         (WebCore::CanvasRenderingContext2D::createPattern): Ditto.
3028         (WebCore::CanvasRenderingContext2D::createImageData): Ditto.
3029         (WebCore::CanvasRenderingContext2D::getImageData): Ditto.
3030         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD): Ditto.
3031         (WebCore::CanvasRenderingContext2D::putImageData): Removed unneeded
3032         ExceptionCode because this does not throw exceptions; the only one
3033         was for non-finite numeric values but this is now handled by bindings.
3034         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Ditto.
3035         * html/canvas/CanvasRenderingContext2D.h: Updated for above.
3036         * html/canvas/CanvasRenderingContext2D.idl: Use non-legacy exceptions
3037         and removed exceptions entirely in other cases.
3038
3039         * html/canvas/OESVertexArrayObject.cpp:
3040         (WebCore::OESVertexArrayObject::OESVertexArrayObject): Take a reference.
3041         (WebCore::OESVertexArrayObject::~OESVertexArrayObject): Deleted.
3042         (WebCore::OESVertexArrayObject::isVertexArrayOES): Use && instead of
3043         multiple return statements.
3044         (WebCore::OESVertexArrayObject::bindVertexArrayOES): Removed unneeded
3045         ExceptionCode since this does not throw an exception.
3046         * html/canvas/OESVertexArrayObject.h: Updated for above.
3047         * html/canvas/OESVertexArrayObject.idl: Removed unneeded exception.
3048
3049         * html/canvas/WebGL2RenderingContext.cpp:
3050         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
3051         Removed unneeded ExceptionCode since this does not throw an exception.
3052         (WebCore::WebGL2RenderingContext::texSubImage2DBase): Ditto.
3053         (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Ditto.
3054         (WebCore::WebGL2RenderingContext::texSubImage2D): Removed unneeded
3055         ExceptionCode for some overloads, for the others, use ExceptionOr
3056         for the security exception. Moved security exception code here from
3057         the validate functions.
3058         (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Removed
3059         unneeded ExceptionCode.
3060         (WebCore::WebGL2RenderingContext::getParameter): Ditto.
3061         * html/canvas/WebGL2RenderingContext.h: Updated for above.
3062
3063         * html/canvas/WebGLRenderingContext.cpp:
3064         (WebCore::WebGLRenderingContext::getExtension): Pass a reference.
3065         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
3066         Remvoed unneeded ExceptionCode since this does not throw an exception.
3067         (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto.
3068         (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto.
3069         (WebCore::WebGLRenderingContext::texSubImage2D): Removed unneeded
3070         ExceptionCode for some overloads, for the others, use ExceptionOr
3071         for the security exception. Moved security exception code here from
3072         the validate functions.
3073         (WebCore::WebGLRenderingContext::getParameter): Removed unneeded
3074         ExceptionCode.
3075         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
3076
3077         * html/canvas/WebGLRenderingContextBase.cpp:
3078         (WebCore::WebGLRenderingContextBase::texImage2DBase):
3079         Remvoed unneeded ExceptionCode since this does not throw an exception.
3080         (WebCore::WebGLRenderingContextBase::texImage2DImpl): Ditto.
3081         (WebCore::WebGLRenderingContextBase::texImage2D): Removed unneeded
3082         ExceptionCode for some overloads, for the others, use ExceptionOr
3083         for the security exception. Moved security exception code here from
3084         the validate functions.
3085         (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
3086         Moved the security exception out of here to the call sites.
3087         (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement): Ditto.
3088         (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement): Ditto.
3089         * html/canvas/WebGLRenderingContextBase.h: Updated for above changes.
3090         * html/canvas/WebGLRenderingContextBase.idl: Use non-legacy exceptions
3091         in some cases and no exceptions at all in many others.
3092
3093         * html/shadow/MediaControlElements.cpp:
3094         (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
3095         Use a reference instead of a pointer.
3096
3097         * html/track/DataCue.h: Use pragma once.
3098         * html/track/DataCue.idl: Use non-legacy exception for constructor
3099         attribute, even though it is custom and so it has no effect.
3100
3101         * html/track/InbandDataTextTrack.cpp:
3102         (WebCore::InbandDataTextTrack::create): Use RefPtr&&.
3103         (WebCore::InbandDataTextTrack::InbandDataTextTrack): Ditto.
3104         (WebCore::InbandDataTextTrack::addDataCue): Stop using
3105         ASSERT_NO_EXCEPTION.
3106         (WebCore::InbandDataTextTrack::removeDataCue): Stop using
3107         IGNORE_EXCEPTION.
3108         (WebCore::InbandDataTextTrack::removeCue): Use ExceptionOr.
3109         Also use remove instead of find/remove.
3110         * html/track/InbandDataTextTrack.h: Updated for above changes.
3111
3112         * html/track/InbandGenericTextTrack.cpp:
3113         (WebCore::GenericTextTrackCueMap::GenericTextTrackCueMap): Deleted.
3114         (WebCore::GenericTextTrackCueMap::~GenericTextTrackCueMap): Deleted.
3115         (WebCore::GenericTextTrackCueMap::add): Take references intead of
3116         pointers.
3117         (WebCore::GenericTextTrackCueMap::find): Ditto. Also use get
3118         instead of find.
3119         (WebCore::GenericTextTrackCueMap::remove): Ditto. Also use take
3120         instead of double hashing to both find and remove.
3121         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Stop using
3122         IGNORE_EXCEPTION. Also got rid of code that is converting a double
3123         to a long and then back to a double by using lround. Instead just
3124         use std::round, which keeps it a double. But also, why does this need
3125         to round?!
3126         (WebCore::InbandGenericTextTrack::addGenericCue): Updated to use
3127         reference to work with m_cueMap.
3128         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
3129         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
3130         (WebCore::InbandGenericTextTrack::removeCue): Use ExceptionOr.
3131         (WebCore::InbandGenericTextTrack::newCuesParsed): Removed
3132         ASSERT_NO_EXCEPTION.
3133         * html/track/InbandGenericTextTrack.h: Updated for above changes.
3134
3135         * html/track/InbandWebVTTTextTrack.cpp:
3136         (WebCore::InbandWebVTTTextTrack::newCuesParsed): Removed
3137         ASSERT_NO_EXCEPTION.
3138
3139         * html/track/TextTrack.cpp:
3140         (WebCore::TextTrack::addCue): Use ExcepctionOr.
3141         (WebCore::TextTrack::removeCue): Ditto.
3142         (WebCore::TextTrack::addRegion): Ditto.
3143         (WebCore::TextTrack::removeRegion): Ditto.
3144         * html/track/TextTrack.h: Updated for above changes.
3145         * html/track/TextTrack.idl: Ditto.
3146
3147         * html/track/TextTrackCue.cpp:
3148         (WebCore::TextTrackCue::cueShadowPseudoId): Moved this here
3149         since it does not need to be inlined in the header.
3150         (WebCore::TextTrackCue::~TextTrackCue): Deleted.
3151         (WebCore::TextTrackCue::setStartTime): Removed ExceptionCode&
3152         since the exceptions were for non-finite values, but this is
3153         now handled by the bindings.
3154         (WebCore::TextTrackCue::setEndTime): Ditto.
3155         * html/track/TextTrackCue.h: Updated for the above.
3156         * html/track/TextTrackCue.idl: Removed SetterMayThrowLegacyException
3157         and made startTime and endTime be double rather than unrestricted double.
3158
3159         * html/track/TextTrackCueGeneric.cpp:
3160         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
3161         Use a reference instead of a pointer.
3162         (WebCore::TextTrackCueGeneric::TextTrackCueGeneric): Initialize
3163         m_defaultPosition in the class definition instead of here.
3164         (WebCore::TextTrackCueGeneric::createDisplayTree): Return a Ref.
3165         (WebCore::TextTrackCueGeneric::setLine): Use ExceptionOr.
3166         (WebCore::TextTrackCueGeneric::setPosition): Ditto.
3167         (WebCore::TextTrackCueGeneric::setFontSize): Updated since
3168         displayTreeInternal() now returns a reference.
3169         * html/track/TextTrackCueGeneric.h: Updated for above changes.
3170         Also fixed some arguument types and made some more things private.
3171
3172         * html/track/VTTCue.cpp:
3173         (WebCore::VTTCue::createDisplayTree): Return a Ref.
3174         (WebCore::VTTCue::displayTreeInternal): Return a reference.
3175         (WebCore::VTTCue::setVertical): Use ExceptionOr.
3176         (WebCore::VTTCue::setLine): Ditto.
3177         (WebCore::VTTCue::setPosition): Ditto.
3178         (WebCore::VTTCue::setSize): Ditto.
3179         (WebCore::VTTCue::setAlign): Ditto.
3180         (WebCore::VTTCue::getDisplayTree): Return a reference.
3181         (WebCore::VTTCue::removeDisplayTree): Updated since
3182         displayTreeInternal returns a reference.
3183         (WebCore::VTTCue::setFontSize): Ditto.
3184         * html/track/VTTCue.h: Updated for the above.
3185         * html/track/VTTCue.idl: Use non-legacy exceptions and also
3186         restricted doubles.
3187
3188         * html/track/VTTRegion.cpp:
3189         (WebCore::VTTRegion::VTTRegion): Moved default values all into
3190         the class definition.
3191         (WebCore::VTTRegion::setWidth): Removed the check for non-finite
3192         since the bindings now handle that. Use ExcpetionOr.
3193         (WebCore::VTTRegion::setHeight): Ditto.
3194         (WebCore::VTTRegion::setRegionAnchorX): Ditto.
3195         (WebCore::VTTRegion::setRegionAnchorY): Ditto.
3196         (WebCore::VTTRegion::setViewportAnchorX): Ditto.
3197         (WebCore::VTTRegion::setViewportAnchorY): Ditto.
3198         (WebCore::upKeyword): Added. Shared by the code below.
3199         (WebCore::VTTRegion::scroll): Rewrote to be simpler.
3200         (WebCore::VTTRegion::setScroll): Rewrote to be simpler.
3201         (WebCore::VTTRegion::updateParametersFromRegion): Read and
3202         write data members directly to avoid awkward code that is otherwise
3203         required just to copy from one object to the other. Also take a
3204         const& instead of a pointer for the thing to update from.
3205         (WebCore::VTTRegion::parseSettingValue): Use upKeyword.
3206         (WebCore::VTTRegion::appendTextTrackCueBox): Take a Ref&&.
3207         (WebCore::VTTRegion::getDisplayTree): Do the downcast to Document
3208         here instead of using the helper function.
3209         (WebCore::VTTRegion::prepareRegionDisplayTree): Ditto.
3210         * html/track/VTTRegion.h: Updated for the above.
3211         * html/track/VTTRegion.idl: Use non-legacy exceptions and also
3212         use restricted dobules, not unrestricted.
3213
3214 2016-10-22  Chris Dumez  <cdumez@apple.com>
3215
3216         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading
3217         https://bugs.webkit.org/show_bug.cgi?id=163856
3218
3219         Reviewed by Darin Adler.
3220
3221         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading:
3222         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
3223
3224         * html/canvas/WebGLRenderingContextBase.cpp:
3225         (WebCore::WebGLRenderingContextBase::texImage2D):
3226         * html/canvas/WebGLRenderingContextBase.h:
3227         * html/canvas/WebGLRenderingContextBase.idl:
3228
3229 2016-10-22  Antti Koivisto  <antti@apple.com>
3230
3231         REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
3232         https://bugs.webkit.org/show_bug.cgi?id=163851
3233
3234         Reviewed by Darin Adler.
3235
3236         The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.
3237
3238         Add a separate invalidity bit for descendant scopes and inline the fast path.
3239
3240         * style/StyleScope.cpp:
3241         (WebCore::Style::Scope::flushPendingSelfUpdate):
3242         (WebCore::Style::Scope::flushPendingDescendantUpdates):
3243         (WebCore::Style::Scope::scheduleUpdate):
3244         (WebCore::Style::Scope::flushPendingUpdate): Deleted.
3245         * style/StyleScope.h:
3246         (WebCore::Style::Scope::hasPendingUpdate):
3247         (WebCore::Style::Scope::flushPendingUpdate):
3248
3249 2016-10-22  Darin Adler  <darin@apple.com>
3250
3251         Move SVG from ExceptionCode to Exception
3252         https://bugs.webkit.org/show_bug.cgi?id=163837
3253
3254         Reviewed by Chris Dumez.
3255
3256         * WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl.
3257
3258         * bindings/js/JSSVGLengthCustom.cpp:
3259         (WebCore::JSSVGLength::value): Use toJSNumber.
3260         (WebCore::JSSVGLength::setValue): Use propagateException.
3261         (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
3262
3263         * bindings/scripts/CodeGeneratorJS.pm:
3264         (GenerateImplementation): Properly handle SetterMayThrowException
3265         in the special case for SVG setters.
3266
3267         * rendering/style/SVGRenderStyle.h:
3268         (WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed
3269         ASSERT_NO_EXCEPTION, no longer needed.
3270         (WebCore::SVGRenderStyle::initialKerning): Ditto.
3271
3272         * svg/SVGAltGlyphElement.cpp:
3273         (WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr.
3274         (WebCore::SVGAltGlyphElement::setFormat): Ditto.
3275         (WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit.
3276         * svg/SVGAltGlyphElement.h: Updated for above changes.
3277         * svg/SVGAltGlyphElement.idl: Use non-legacy exceptions.
3278
3279         * svg/SVGAngle.cpp:
3280         (WebCore::SVGAngle::valueAsString): Removed unneeded String globals.
3281         (WebCore::parseAngleType): Rewrote to be simpler and more direct.
3282         (WebCore::SVGAngle::setValueAsString): Use ExceptionOr.
3283         (WebCore::SVGAngle::newValueSpecifiedUnits): Ditto.
3284         (WebCore::SVGAngle::convertToSpecifiedUnits): Ditto.
3285         * svg/SVGAngle.h: Updated for above changes. Initialized data members
3286         here in the class definite and removed constructor; default now works.
3287         * svg/SVGAngle.idl: Use non-legacy exceptions.
3288
3289         * svg/SVGAnimateElementBase.cpp:
3290         (WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since
3291         CalcMode is now an enum class.
3292         * svg/SVGAnimateMotionElement.cpp:
3293         (WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto.
3294
3295         * svg/SVGAnimateTransformElement.cpp:
3296         (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update
3297         since AttributeType is now an enum class.
3298
3299         * svg/SVGAnimatedAngle.cpp:
3300         (WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed
3301         ASSERT_NO_EXCEPTION, no longer needed.
3302
3303         * svg/SVGAnimatedBoolean.idl: Use non-legacy exception.
3304         * svg/SVGAnimatedEnumeration.idl: Ditto.
3305         * svg/SVGAnimatedInteger.idl: Ditto.
3306
3307         * svg/SVGAnimatedLength.cpp:
3308         (WebCore::sharedSVGLength): Deleted.
3309         (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed
3310         ASSERT_NO_EXCEPTION, no longer needed.
3311         (WebCore::parseLengthFromString): Ditto. Also rewrote to not use
3312         a shared SVGLength; no benefit to doing that.
3313         (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto.
3314         * svg/SVGAnimatedLengthList.cpp:
3315         (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto.
3316         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto.
3317
3318         * svg/SVGAnimatedNumber.idl: Use non-legacy exception.
3319         * svg/SVGAnimatedString.idl: Ditto.
3320
3321         * svg/SVGAnimatedType.cpp:
3322         (WebCore::SVGAnimatedType::setValueAsString): Updated since
3323         setValueAsString now uses ExceptionOr.
3324
3325         * svg/SVGAnimationElement.cpp:
3326         (WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars
3327         in the class definition instead of here.
3328         (WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&.
3329         (WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class.
3330         (WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType
3331         is now an enum class.
3332         (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
3333         (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto.
3334         (WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto.
3335         (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto.
3336         (WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto.
3337         (WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto.
3338         (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto.
3339         (WebCore::SVGAnimationElement::startedActiveInterval): Ditto.
3340         (WebCore::SVGAnimationElement::updateAnimation): Ditto.
3341         (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto.
3342
3343         * svg/SVGAnimationElement.h: Changed CalcMode into an enum class.
3344         Updated for above changes.
3345
3346         * svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from
3347         getSimpleDuration.
3348
3349         * svg/SVGColor.cpp:
3350         (WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward
3351         manner instead of constt SVGColorType&.
3352         (WebCore::SVGColor::setRGBColor): Use ExceptionOr.
3353         (WebCore::SVGColor::setRGBColorICCColor): Ditto.
3354         (WebCore::SVGColor::setColor): Ditto.
3355         * svg/SVGColor.h: Updated for above changes. Removed unneeded destructor.
3356         * svg/SVGColor.idl: Use non-legacy exceptions.
3357
3358         * svg/SVGGlyphRefElement.cpp:
3359         (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members
3360         in class definition, not here.
3361         (WebCore::parseFloat): Added helper. Used in parseAttribute.
3362         (WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper.
3363         (WebCore::SVGGlyphRefElement::glyphRef): Deleted.
3364         (WebCore::SVGGlyphRefElement::setGlyphRef): Deleted.
3365         (WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument.
3366         (WebCore::SVGGlyphRefElement::setY): Ditto.
3367         (WebCore::SVGGlyphRefElement::setDx): Ditto.
3368         (WebCore::SVGGlyphRefElement::setDy): Ditto.
3369         * svg/SVGGlyphRefElement.h: Updated for above changes.
3370         * svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect
3371         SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term
3372         it might be nice to use [Reflect] on these too.
3373
3374         * svg/SVGGraphicsElement.idl: Use non-legacy exception.
3375
3376         * svg/SVGLength.cpp:
3377         (WebCore::parseLengthType): Changed argument type since caller does not
3378         need to know how many characters are consumed.
3379         (WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION.
3380         Also removed the copy constructor, letting the compiler generate the default.
3381         (WebCore::SVGLength::setValueAsString): Use ExceptionOr.
3382         (WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr.
3383         (WebCore::SVGLength::value): Ditto.
3384         (WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to
3385         disambiguate with the version used outside of bindings.
3386         (WebCore::SVGLength::setValue): Use ExceptionOr.
3387         (WebCore::SVGLength::newValueSpecifiedUnits): Ditto.
3388         (WebCore::SVGLength::convertToSpecifiedUnits): Ditto.
3389         (WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits
3390         uses ExceptionOr.
3391         (WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation
3392         code to be more efficient and not unrolled. Only do one hash table lookup.
3393         * svg/SVGLength.h: Updated for above changes.
3394         * svg/SVGLength.idl: Use non-legacy exceptions.
3395
3396         * svg/SVGLengthContext.cpp:
3397         (WebCore::SVGLengthContext::valueForLength): Update since function
3398         uses ExceptionOr.
3399         (WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr.
3400         (WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto.
3401         (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto.
3402         (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto.
3403         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto.
3404         (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto.
3405         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto.
3406         (WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto.
3407         * svg/SVGLengthContext.h: Updatedfor above changes.
3408
3409         * svg/SVGLengthList.cpp:
3410         (WebCore::SVGLengthList::parse): Updated since setValueAsString uses
3411         ExceptionOr now.
3412         * svg/SVGLengthList.h: Removed unneeded constructor.
3413         * svg/SVGLengthList.idl: Use non-legacy exceptions.
3414
3415         * svg/SVGLocatable.cpp:
3416         (WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr.
3417         * svg/SVGLocatable.h: Updated for above change.
3418
3419         * svg/SVGMarkerElement.h:
3420         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
3421         Updated since setValueAsString uses ExceptionOr now.
3422
3423         * svg/SVGMatrix.h: Use ExceptionOr.
3424         * svg/SVGMatrix.idl: Use non-legacy exceptions.
3425
3426         * svg/SVGNumberList.h: Removed unneeded constructor.
3427         * svg/SVGNumberList.idl: Use non-legacy exceptions.
3428
3429         * svg/SVGPaint.cpp:
3430         (WebCore::SVGPaint::setPaint): Use ExceptionOr.
3431         * svg/SVGPaint.h: Updated for above chagne.
3432         * svg/SVGPaint.idl: Use non-legacy exception.
3433
3434         * svg/SVGPathSegList.h: Tweaked a bit.
3435         * svg/SVGPathSegList.idl: Use non-legacy exceptions.
3436
3437         * svg/SVGPointList.h: Removed unneeded constructor.
3438         * svg/SVGPointList.idl: Use non-legacy exceptions.
3439
3440         * svg/SVGPreserveAspectRatio.cpp:
3441         (WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr.
3442         (WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto.
3443         * svg/SVGPreserveAspectRatio.h: Updated for above changes.
3444         * svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions.
3445
3446         * svg/SVGSVGElement.cpp:
3447         (WebCore::SVGSVGElement::currentView): Pass a reference.
3448
3449         * svg/SVGStringList.h: Tweaked a bit.
3450         * svg/SVGStringList.idl: Use non-legacy exceptions.
3451
3452         * svg/SVGStyleElement.cpp:
3453         (WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&.
3454         (WebCore::SVGStyleElement::setMedia): Ditto.
3455         (WebCore::SVGStyleElement::setTitle): Deleted.
3456         * svg/SVGStyleElement.h: Updated for above changes, and made the title
3457         function override be private.
3458         * svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded
3459         SetterMayThrowLegacyException on all attributes.
3460
3461         * svg/SVGTextContentElement.cpp:
3462         (WebCore::SVGTextContentElement::textLengthAnimated): Removed
3463         ASSERT_NO_EXCEPTION, won't work any more.
3464         (WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr.
3465         Also remove redundant call to updateLayoutIgnorePendingStylesheets,
3466         called by getNumberOfChars.
3467         (WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto.
3468         (WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto.
3469         (WebCore::SVGTextContentElement::getExtentOfChar): Ditto.
3470         (WebCore::SVGTextContentElement::getRotationOfChar): Ditto.
3471         (WebCore::SVGTextContentElement::selectSubString): Ditto.
3472         * svg/SVGTextContentElement.h: Updated for above changes.
3473         * svg/SVGTextContentElement.idl: Use non-legacy exceptions.
3474
3475         * svg/SVGTransformList.h: Removed unneeded constructor.
3476         * svg/SVGTransformList.idl: Use non-legacy exceptions.
3477
3478         * svg/SVGViewSpec.cpp:
3479         (WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference.
3480         (WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr.
3481         (WebCore::SVGViewSpec::setTransformString): Deleted.
3482         (WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly.
3483         (WebCore::SVGViewSpec::preserveAspectRatioString): Use
3484         m_preserveAspectRatio directly.
3485         (WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>.
3486         (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use
3487         m_contextElement directly.
3488         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
3489         Ditto.
3490         (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto.
3491         (WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly.
3492         * svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual
3493         destructor, unneeded using for ref/deref, unused functions including
3494         setTransformString, setViewTargetString, non-exception setZoomAndPan,
3495         contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue.
3496         * svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify
3497         ImplementationLacksVTable.
3498
3499         * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
3500         Use ExceptionOr.
3501         * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto.
3502         * svg/properties/SVGListProperty.h: Ditto.
3503         * svg/properties/SVGListPropertyTearOff.h: Ditto.
3504          * svg/properties/SVGPathSegListPropertyTearOff.cpp:
3505         (WebCore::SVGPathSegListPropertyTearOff::clear): Ditto.
3506         (WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto.
3507         (WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto.
3508         (WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto.
3509         * svg/properties/SVGPathSegListPropertyTearOff.h: Ditto.
3510         * svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload
3511         of create that knows how to deal with exceptions.
3512         * svg/properties/SVGStaticListPropertyTearOff.h: Ditto.
3513         * svg/properties/SVGTransformListPropertyTearOff.h: Ditto.
3514
3515 2016-10-22  Chris Dumez  <cdumez@apple.com>
3516
3517         WebGLRenderingContextBase.bufferData() should use a union instead of overloading
3518         https://bugs.webkit.org/show_bug.cgi?id=163795
3519
3520         Reviewed by Darin Adler.
3521
3522         WebGLRenderingContextBase.bufferData() / bufferSubData() should use a union
3523         instead of overloading:
3524         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
3525
3526         No new tests, no web-exposed behavior change.
3527
3528         * bindings/js/JSDOMConvert.h:
3529         (WebCore::Converter<IDLInterface<T>>::convert):
3530         * bindings/scripts/CodeGeneratorJS.pm:
3531         (GenerateHeader):
3532         * bindings/scripts/test/JS/JSInterfaceName.h:
3533         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
3534         * bindings/scripts/test/JS/JSTestCEReactions.h:
3535         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
3536         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
3537         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
3538         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
3539         * bindings/scripts/test/JS/JSTestEventConstructor.h:
3540         * bindings/scripts/test/JS/JSTestEventTarget.h:
3541         * bindings/scripts/test/JS/JSTestException.h:
3542         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
3543         * bindings/scripts/test/JS/JSTestGlobalObject.h:
3544         * bindings/scripts/test/JS/JSTestInterface.h:
3545         * bindings/scripts/test/JS/JSTestIterable.h:
3546         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
3547         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
3548         * bindings/scripts/test/JS/JSTestNode.h:
3549         * bindings/scripts/test/JS/JSTestNondeterministic.h:
3550         * bindings/scripts/test/JS/JSTestObj.h:
3551         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
3552         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
3553         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
3554         * bindings/scripts/test/JS/JSTestSerialization.h:
3555         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
3556         * bindings/scripts/test/JS/JSTestTypedefs.h:
3557         * bindings/scripts/test/JS/JSattribute.h:
3558         * bindings/scripts/test/JS/JSreadonly.h:
3559         * html/canvas/WebGL2RenderingContext.cpp:
3560         (WebCore::WebGL2RenderingContext::bufferData):
3561         (WebCore::WebGL2RenderingContext::bufferSubData):
3562         * html/canvas/WebGLRenderingContextBase.cpp:
3563         (WebCore::WebGLRenderingContextBase::bufferData):
3564         (WebCore::WebGLRenderingContextBase::bufferSubData):
3565         * html/canvas/WebGLRenderingContextBase.h:
3566         * html/canvas/WebGLRenderingContextBase.idl:
3567
3568 2016-10-22  Darin Adler  <darin@apple.com>
3569
3570         [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit)
3571         https://bugs.webkit.org/show_bug.cgi?id=163839
3572
3573         Reviewed by Dan Bernstein.
3574
3575         * editing/cocoa/EditorCocoa.mm: Use the appropriate SOFT_LINK macros to find
3576         the WebKitLegacy platform in the correct location for iOS and macOS.
3577
3578 2016-10-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3579
3580         Bindings error message for missing required dictionary member should be more explicit
3581         https://bugs.webkit.org/show_bug.cgi?id=163665
3582
3583         Reviewed by Darin Adler.
3584
3585         Add throwRequiredMemberTypeError function to throw a TypeError exception with an error
3586         message indicating the missing required member.
3587
3588         No new test required, rebase existing tests.
3589
3590         * bindings/js/JSDOMBinding.cpp:
3591         (WebCore::throwRequiredMemberTypeError):
3592         * bindings/js/JSDOMBinding.h:
3593         * bindings/scripts/CodeGeneratorJS.pm:
3594         (GenerateDictionaryImplementationContent):
3595         * bindings/scripts/test/JS/JSTestObj.cpp:
3596         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
3597
3598 2016-10-22  Ryosuke Niwa  <rniwa@webkit.org>
3599
3600         Upgrading custom element should enqueue attributeChanged and connected callbacks
3601         https://bugs.webkit.org/show_bug.cgi?id=163840
3602
3603         Reviewed by Darin Adler.
3604
3605         When upgrading a custom element, enqueue attributeChanged and connectedCallbacks as needed as specified
3606         in step 3 and 4 of: https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element
3607
3608         Test: fast/custom-elements/upgrading-enqueue-reactions.html
3609
3610         * bindings/js/JSCustomElementInterface.cpp:
3611         (WebCore::JSCustomElementInterface::upgradeElement): Enqueue 
3612         * dom/CustomElementReactionQueue.cpp:
3613         (WebCore::CustomElementReactionQueueItem::invoke): Don't invoke callbacks when the custom element had
3614         failed to upgrade.
3615         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Added.
3616         (WebCore::CustomElementReactionQueue::invokeAll): Upgrading a custom element may enqueue more reactions.
3617         Keep invoking reactions until the queue becomes empty.
3618         * dom/CustomElementReactionQueue.h:
3619         * dom/Range.idl: Added a forgotten CEReactions here.
3620
3621 2016-10-21  David Kilzer  <ddkilzer@apple.com>
3622
3623         Bug 163762: IntSize::area() should used checked arithmetic
3624         <https://webkit.org/b/163762>
3625
3626         Reviewed by Darin Adler.
3627
3628         No new tests since no change in nominal behavior.
3629
3630         * platform/graphics/IntSize.h:
3631         (WebCore::IntSize::area): Change to return a
3632         Checked<unsigned, T> value. Use WTF:: namespace to avoid
3633         including another header.
3634
3635         * platform/graphics/IntRect.h:
3636         (WebCore::IntRect::area): Ditto.
3637
3638         The remaining changes are to use the Checked<unsigned> return
3639         value of IntSize::area() and IntRect::area() correctly in
3640         context, in addition to items noted below.
3641
3642         * html/HTMLPlugInImageElement.cpp:
3643         (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin):
3644         Declare contentWidth and contentHeight as float values to
3645         prevent overflow when computing the area, and to make the
3646         inequality comparison in the return statement uses the same type
3647         for both sides.
3648         * html/ImageData.cpp:
3649         (WebCore::ImageData::ImageData):
3650         * html/MediaElementSession.cpp:
3651         (WebCore::isElementRectMostlyInMainFrame):
3652         * platform/graphics/ImageBackingStore.h:
3653         (WebCore::ImageBackingStore::setSize): Restructure logic to
3654         compute area only once.
3655         (WebCore::ImageBackingStore::clear):
3656         * platform/graphics/ImageFrame.h:
3657         (WebCore::ImageFrame::frameBytes):
3658         * platform/graphics/ImageSource.cpp:
3659         (WebCore::ImageSource::maximumSubsamplingLevel):
3660         * platform/graphics/ca/LayerPool.cpp:
3661         (WebCore::LayerPool::backingStoreBytesForSize):
3662         * platform/graphics/cg/ImageDecoderCG.cpp:
3663         (WebCore::ImageDecoder::frameBytesAtIndex):
3664         * platform/graphics/filters/FEGaussianBlur.cpp:
3665         (WebCore::FEGaussianBlur::platformApplySoftware):
3666         * platform/graphics/filters/FilterEffect.cpp:
3667         (WebCore::FilterEffect::asUnmultipliedImage):
3668         (WebCore::FilterEffect::asPremultipliedImage):
3669         (WebCore::FilterEffect::copyUnmultipliedImage):
3670         (WebCore::FilterEffect::copyPremultipliedImage):
3671         (WebCore::FilterEffect::createUnmultipliedImageResult):
3672         (WebCore::FilterEffect::createPremultipliedImageResult):
3673         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
3674         (WebCore::ImageBufferData::getData): Update overflow check,
3675         rename local variable to numBytes, and compute numBytes once.
3676         * platform/graphics/win/ImageDecoderDirect2D.cpp:
3677         (WebCore::ImageDecoder::frameBytesAtIndex):
3678         * platform/image-decoders/ImageDecoder.cpp:
3679         (WebCore::ImageDecoder::frameBytesAtIndex):
3680         * platform/ios/LegacyTileLayerPool.mm:
3681         (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize):
3682         * rendering/RenderLayerCompositor.cpp:
3683         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
3684         * rendering/shapes/Shape.cpp:
3685         (WebCore::Shape::createRasterShape):
3686
3687 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
3688
3689         WebPageProxy should not need PageActivityState
3690         https://bugs.webkit.org/show_bug.cgi?id=163821
3691
3692         Reviewed by Geoff Garen.
3693
3694         The PageActivityState is currently plumbed back from WebCore up to the UI process, to
3695         determine whether to enabled process suppression. However the information it contains
3696         (whether a page load is ongoing, whether audio is playing) is already available via
3697         other means. Remove this use of PageActivityState.
3698
3699         * html/HTMLMediaElement.cpp:
3700         (WebCore::HTMLMediaElement::mediaState):
3701             - Fix a bug in how we compute IsPlayingAudio - if the volume of the MediaElement is
3702               set to zero, then audio is not playing (we were already checking muted).
3703         * page/ChromeClient.h:
3704             - removed setPageActivityState
3705         * page/Page.cpp:
3706         (WebCore::Page::setPageActivityState): Deleted.
3707             - setPageActivityState -> pageActivityStateChanged, remove call to ChromeClient
3708         * page/Page.h:
3709         (WebCore::Page::pageActivityStateChanged):
3710             - setPageActivityState -> pageActivityStateChanged
3711         * page/PageThrottler.cpp:
3712         (WebCore::PageThrottler::setActivityFlag):
3713             - setPageActivityState -> pageActivityStateChanged
3714
3715 2016-10-21  Chris Dumez  <cdumez@apple.com>
3716
3717         [Web ID] Overload resolution is wrong if one of the types is a nullable union
3718         https://bugs.webkit.org/show_bug.cgi?id=163816
3719
3720         Reviewed by Alex Christensen.
3721
3722         Overload resolution was wrong if one of the types was a nullable union. This
3723         is because we never considered the union type itself, only its subtypes.
3724         Therefore, we checked if any of the union's subtypes were nullable but we
3725         failed to check if the union itself was nullable.
3726
3727         See:
3728         - https://heycam.github.io/webidl/#es-overloads (Step 11.3.)
3729
3730         No new tests, extended bindings tests.
3731
3732         * bindings/scripts/CodeGeneratorJS.pm:
3733         (GetOverloadThatMatchesIgnoringUnionSubtypes):
3734         (GenerateOverloadedFunctionOrConstructor):
3735         * bindings/scripts/test/JS/JSTestObj.cpp:
3736         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1):
3737         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Caller):
3738         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2):
3739         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Caller):
3740         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
3741         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1):
3742         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Caller):
3743         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2):
3744         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Caller):
3745         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion):
3746         * bindings/scripts/test/TestObj.idl:
3747
3748 2016-10-21  Eric Carlson  <eric.carlson@apple.com>
3749
3750         [MediaStream] Dynamically generate media capture sandbox extensions
3751         https://bugs.webkit.org/show_bug.cgi?id=154861
3752         <rdar://problem/24909411>
3753
3754         Reviewed by Tim Horton.
3755
3756         No new tests, some of these changes are covered by existing tests and some can only be tested
3757         with physical capture devices.
3758
3759         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: AVSampleBufferAudioRenderer
3760           and AVSampleBufferRenderSynchronizer are now declared in AVFoundationSPI.h.
3761
3762         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3763         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3764         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Initialize 
3765           AVSampleBufferRenderSynchronizer.
3766         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Fail if AVSampleBufferRenderSynchronizer
3767           isn't available.
3768         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Take a MediaSample&
3769           instead of a PlatformSample&.
3770         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Ditto.
3771         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Add the sample buffer display 
3772           later to the synchronizer.
3773         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Remove the sample buffer display 
3774           later from the synchronizer.
3775         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start the synchronizer.
3776         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Stash the current clock time in 
3777           m_pausedTime, but leave the clock running. Pause the synchronizer.
3778         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime): Return the clock time
3779           when playing, m_pausedTime time when paused because we leave the clock running forever.
3780         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
3781
3782         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: AVSampleBufferAudioRenderer
3783           is now declared in AVFoundationSPI.h.
3784
3785         * platform/spi/mac/AVFoundationSPI.h: Add AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer.
3786
3787 2016-10-21  Commit Queue  <commit-queue@webkit.org>
3788
3789         Unreviewed, rolling out r207582.
3790         https://bugs.webkit.org/show_bug.cgi?id=163819
3791
3792         Not quite ready rdar://problem/28897179 (Requested by
3793         alexchristensen on #webkit).
3794
3795         Reverted changeset:
3796
3797         "Re-enable URLParser for non-Safari Cocoa apps after r207321"
3798         https://bugs.webkit.org/show_bug.cgi?id=163690
3799         http://trac.webkit.org/changeset/207582
3800
3801 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
3802
3803         WebPage should take UserActivity directly for user input
3804         https://bugs.webkit.org/show_bug.cgi?id=163813
3805
3806         Reviewed by Anders Carlsson.
3807
3808         When we receive mouse/keyboard events in a page, we want to prevent AppNap. We currently do so
3809         via the PageThrottler. This patch is to just make the WebPage drive the UserActivity directly.
3810
3811         Two reasons to do so: (1) to cleanup & simplify for further refactoring. (2) The current code
3812         isn't really achieving the desired effect. The page setting the flag in the throttler to get
3813         the activity to be set is now a less effective way of achieving this goal, since the
3814         PageActivityState bounces back across to the UI process & then messages back to the WebContent
3815         process to take the UserActivity. These extra hops defeat the purpose of making sure the boost
3816         from the initial message isn't lost.
3817
3818         * page/PageThrottler.cpp:
3819         (WebCore::PageThrottler::PageThrottler):
3820         (WebCore::m_userInputHysteresis): Deleted.
3821         * page/PageThrottler.h:
3822         (WebCore::PageThrottler::didReceiveUserInput): Deleted.
3823             - removed PageActivityState::UserInputActivity, didReceiveUserInput, m_userInputHysteresis.
3824
3825 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3826
3827         Support (insertFrom|deleteBy)Composition and (insert|delete)CompositionText inputTypes for InputEvents
3828         https://bugs.webkit.org/show_bug.cgi?id=163460
3829         <rdar://problem/28784142>
3830
3831         Reviewed by Darin Adler.
3832
3833         Adds basic support for the composition inputTypes in the InputEvent spec. See w3.org/TR/input-events,
3834         github.com/w3c/input-events/issues/41 and github.com/w3c/input-events/issues/42 for more details. While input
3835         events are fired in the correct order with respect to each other, additional work will be required to ensure
3836         that input events are fired in the correct order with respect to composition(start|update|end) events and
3837         textInput events. This is held off until the expected ordering of events is officially defined in the spec.
3838
3839         Tests: fast/events/before-input-events-prevent-insert-composition.html
3840                fast/events/before-input-events-prevent-recomposition.html
3841                fast/events/input-events-ime-composition.html
3842                fast/events/input-events-ime-recomposition.html
3843
3844         * editing/CompositeEditCommand.cpp:
3845         (WebCore::CompositeEditCommand::apply):
3846         * editing/CompositeEditCommand.h:
3847         (WebCore::CompositeEditCommand::isBeforeInputEventCancelable):
3848
3849         Adds a new virtual method hook for subclasses to mark their `beforeinput` events as non-cancelable (see
3850         TypingCommand::isBeforeInputEventCancelable). By default, `beforeinput` events are cancelable.
3851
3852         * editing/EditAction.h:
3853
3854         Adds 4 new EditActions corresponding to the 4 composition-related inputTypes. These are:
3855         EditActionTypingDeletePendingComposition    => "deleteCompositionText"
3856         EditActionTypingDeleteFinalComposition      => "deleteByComposition"
3857         EditActionTypingInsertPendingComposition    => "insertCompositionText"
3858         EditActionTypingInsertFinalComposition      => "insertFromComposition"
3859
3860         * editing/EditCommand.cpp:
3861         (WebCore::inputTypeNameForEditingAction):
3862         * editing/Editor.cpp:
3863         (WebCore::dispatchBeforeInputEvent):
3864         (WebCore::dispatchBeforeInputEvents):
3865         (WebCore::Editor::willApplyEditing):
3866         (WebCore::Editor::insertTextWithoutSendingTextEvent):
3867         (WebCore::Editor::setComposition):
3868
3869         In setComposition(text, mode), tweak the logic for committing a composition to always delete the selection
3870         before inserting the final composition text. In setComposition(text, underlines, start, end), catch the case
3871         where we're beginning to recompose an existing range in the DOM and delete the recomposed text first.
3872
3873         * editing/TypingCommand.cpp:
3874         (WebCore::editActionForTypingCommand):
3875         (WebCore::TypingCommand::TypingCommand):
3876         (WebCore::TypingCommand::deleteSelection):
3877
3878         Adds a TextCompositionType parameter so that call sites (see Editor::setComposition) can indicate what state the
3879         edited composition is in. This allows us to differentiate between deletion of finalized composition text in
3880         preparation of recomposing a range in the DOM, and deletion of composition text that has not yet been committed
3881         in preparation for inserting a finalized composition into the DOM.
3882
3883         (WebCore::TypingCommand::deleteKeyPressed):
3884         (WebCore::TypingCommand::forwardDeleteKeyPressed):
3885         (WebCore::TypingCommand::insertText):
3886         (WebCore::TypingCommand::insertLineBreak):
3887         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
3888         (WebCore::TypingCommand::insertParagraphSeparator):
3889         (WebCore::TypingCommand::isBeforeInputEventCancelable):
3890         (WebCore::TypingCommand::inputEventData):
3891         (WebCore::TypingCommand::willAddTypingToOpenCommand):
3892         * editing/TypingCommand.h:
3893
3894 2016-10-21  Dave Hyatt  <hyatt@apple.com>
3895
3896         [CSS Parser] Make sure shadow user agent sheets parse in UASheetMode
3897         https://bugs.webkit.org/show_bug.cgi?id=163810
3898
3899         Reviewed by Dean Jackson.
3900
3901         * dom/InlineStyleSheetOwner.cpp:
3902         (WebCore::parserContextForElement):
3903         (WebCore::makeInlineStyleSheetCacheKey):
3904         (WebCore::InlineStyleSheetOwner::createSheet):
3905         (WebCore::parserContextForForElement): Deleted.
3906
3907 2016-10-21  Jer Noble  <jer.noble@apple.com>
3908
3909         YouTube stalls when seeking beyond buffered range
3910         https://bugs.webkit.org/show_bug.cgi?id=162813
3911
3912         Reviewed by Eric Carlson.
3913
3914         When seeking a MediaPlayerPrivateMediaSourceAVFObjC, we will first seek the AVSampleBufferRenderSynchronizer,
3915         flush and enqueue non-displaying frames, enqueue regular frames, then begin playback. The above stall will occur
3916         when we enqueue so many non- displaying frames that the display layer is not ready for normal ones before
3917         playback begins. Then, when the synchronizer attempts to synchronize the enqueued audio and video renderers, the
3918         only available samples are back at the original media time, and so it "seeks" by updating the CMTimebase back to
3919         the original media time, causing playback to appear "stalled".  The overall solution is to "flush" the contents
3920         of the renderers before the seek, so that the synchronizer doesn't reset the currentTime, and to only restart
3921         the synchronizer when there are visible (or audible) samples available for display.
3922
3923         Breaking the fix down into sections:
3924
3925         = Don't enqueue too many non-displaying samples at once:
3926         - Rename SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples() to SourceBufferPrivate::flush(), and no longer
3927           pass in an array of non-displaying samples.
3928         - Add a new virtual method to MediaSample, createNonDisplayingCopy(), used by SourceBuffer to enqueue non-displaying
3929           samples.
3930         - in SourceBuffer::reenqueueMediaForTime(), use that new createNonDisplayingCopy() method to enqueue non-displaying
3931           samples in the same queue as regular samples.
3932
3933         * Modules/mediasource/SourceBuffer.cpp:
3934         (WebCore::SourceBuffer::provideMediaData):
3935         (WebCore::SourceBuffer::reenqueueMediaForTime):
3936         * platform/MediaSample.h:
3937         (WebCore::MediaSample::isNonDisplaying):
3938         * platform/graphics/SourceBufferPrivate.h:
3939         (WebCore::SourceBufferPrivate::flush):
3940         (WebCore::SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
3941         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
3942         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3943         (WebCore::CMSampleBufferIsNonDisplaying):
3944         (WebCore::MediaSampleAVFObjC::flags):
3945         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
3946         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3947         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3948         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
3949         (WebCore::createNonDisplayingCopy): Moved to MediaSampleAVFObjC.
3950         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
3951         * platform/mock/mediasource/MockBox.h:
3952         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
3953         (WebCore::MockMediaSample::flags):
3954         (WebCore::MockMediaSample::createNonDisplayingCopy):
3955         * platform/mock/mediasource/MockSourceBufferPrivate.h:
3956
3957         = Don't start playing until all renderers have visible/audible samples:
3958         - SourceBufferPrivateAVFObjC will notify its associated MediaPlayerPrivateMediaSourceAVFObjC when
3959           it flushes and receives visible/audible samples.
3960         - The MediaPlayer will store audio renderers as keys to a HashMap which allows it to track which
3961           have available samples.
3962         - This requires changing all the places where we loop over the available renderers.
3963
3964         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3965         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
3966         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
3967         (WebCore::SourceBufferPrivateAVFObjC::flush):
3968         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
3969         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3970         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::allRenderersHaveAvailableSamples):
3971         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): Deleted.
3972         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3973         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSou