URLParser: Correctly parse URLs that are just nonspecialscheme:/
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-21  Alex Christensen  <achristensen@webkit.org>
2
3         URLParser: Correctly parse URLs that are just nonspecialscheme:/
4         https://bugs.webkit.org/show_bug.cgi?id=162340
5
6         Reviewed by Tim Horton.
7
8         Covered by new API tests.
9
10         * platform/URLParser.cpp:
11         (WebCore::URLParser::parse):
12         r206162 wasn't quite right.  If a url is just nonspecialscheme:/ then the path should indeed be /
13
14 2016-09-21  Alex Christensen  <achristensen@webkit.org>
15
16         URLParser: correctly parse relative URLs that are just one character
17         https://bugs.webkit.org/show_bug.cgi?id=162344
18
19         Reviewed by Tim Horton.
20
21         Covered by new API tests.
22
23         * platform/URLParser.cpp:
24         (WebCore::URLParser::parse):
25
26 2016-09-21  Daniel Bates  <dabates@apple.com>
27
28         REGRESSION (r201090): Setting style.webkitTextSizeAdjust does not change text change on iPad
29         https://bugs.webkit.org/show_bug.cgi?id=162227
30         <rdar://problem/27201529>
31
32         Reviewed by Simon Fraser.
33
34         The CSS property -webkit-text-size-adjust should be respected on all iOS devices. Following
35         r201090 we respect it only on iPhone and in iPhone-apps run on iPad.
36
37         Tests: fast/text-autosizing/ios/ipad/programmatic-text-size-adjust.html
38                fast/text-autosizing/ios/ipad/text-size-adjust-inline-style.html
39                fast/text-autosizing/ios/programmatic-text-size-adjust.html
40                fast/text-autosizing/ios/text-size-adjust-inline-style.html
41                fast/text-autosizing/text-size-adjust-inline-style.html
42
43         * css/parser/CSSParser.cpp:
44         (WebCore::isValidKeywordPropertyAndValue): Remove unused code to validate -webkit-text-size-adjust.
45         This code is never used because -webkit-text-size-adjust is a value property (since it accepts a
46         <percentage> as a value and CSSParserFastPaths::isKeywordPropertyID(CSSPropertyWebkitTextSizeAdjust)
47         returns false). That is, it is not a keyword property.
48         (WebCore::CSSParser::parseValue): Always enable the -webkit-text-size-adjust CSS property when
49         building for iOS regardless of whether Settings:textAutosizingEnabled() is enabled.
50
51 2016-09-21  Miguel Gomez  <magomez@igalia.com>
52
53         [GTK] Build fails with GSTREAMER_GL enabled
54         https://bugs.webkit.org/show_bug.cgi?id=162337
55
56         Reviewed by Michael Catanzaro.
57
58         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
59         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Remove uneeded const.
60
61 2016-09-21  Jer Noble  <jer.noble@apple.com>
62
63         REGRESSION(r206127): ASSERTION FAILED: !isClosed() in WebCore::MediaSource::detachFromElement
64         https://bugs.webkit.org/show_bug.cgi?id=162307
65
66         Reviewed by Eric Carlson.
67
68         The test is crashing when the ScriptExecutionContext is calling stop() on the media element before
69         it's attached MediaSource has been open()ed, which is a valid state. Removing this ASSERT().
70
71         * Modules/mediasource/MediaSource.cpp:
72         (WebCore::MediaSource::detachFromElement):
73
74 2016-09-19  Jer Noble  <jer.noble@apple.com>
75
76         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-activesourcebuffers.html
77         https://bugs.webkit.org/show_bug.cgi?id=162257
78
79         Reviewed by Eric Carlson.
80
81         Some of the conditions in the track changed methods were reversed, and all failed to schedule
82         a change event.
83
84         * Modules/mediasource/SourceBuffer.cpp:
85         (WebCore::SourceBuffer::videoTrackSelectedChanged):
86         (WebCore::SourceBuffer::audioTrackEnabledChanged):
87         (WebCore::SourceBuffer::textTrackModeChanged):
88
89 2016-09-20  Jer Noble  <jer.noble@apple.com>
90
91         [media-source] Fix imported/w3c/web-platform-tests/media-source/URL-createObjectURL-null.html
92         https://bugs.webkit.org/show_bug.cgi?id=162299
93
94         Reviewed by Eric Carlson.
95
96         URL.createObjectURL() should not take an optional parameter (nor return an optional String). 
97         (Ref: https://w3c.github.io/FileAPI/#dfn-createObjectURL)
98
99         * Modules/mediasource/DOMURLMediaSource.cpp:
100         (WebCore::DOMURLMediaSource::createObjectURL):
101         * Modules/mediasource/DOMURLMediaSource.h:
102         * Modules/mediasource/DOMURLMediaSource.idl:
103         * Modules/mediasource/MediaSourceRegistry.cpp:
104         (WebCore::MediaSourceRegistry::registerURL):
105         * Modules/mediasource/MediaSourceRegistry.h:
106         * Modules/mediastream/DOMURLMediaStream.cpp:
107         (WebCore::DOMURLMediaStream::createObjectURL):
108         * Modules/mediastream/DOMURLMediaStream.h:
109         * Modules/mediastream/DOMURLMediaStream.idl:
110         * Modules/mediastream/MediaStreamRegistry.cpp:
111         (WebCore::MediaStreamRegistry::registerURL):
112         * Modules/mediastream/MediaStreamRegistry.h:
113         * fileapi/Blob.cpp:
114         (WebCore::BlobURLRegistry::registerURL):
115         * html/DOMURL.cpp:
116         (WebCore::DOMURL::createObjectURL):
117         (WebCore::DOMURL::createPublicURL):
118         * html/DOMURL.h:
119         * html/DOMURL.idl:
120         * html/HTMLMediaElement.cpp:
121         (WebCore::HTMLMediaElement::setSrcObject):
122         * html/PublicURLManager.cpp:
123         (WebCore::PublicURLManager::registerURL):
124         * html/PublicURLManager.h:
125         * html/URLRegistry.h:
126
127 2016-09-21  Youenn Fablet  <youenn@apple.com>
128
129         [Fetch] Align Accept header default values with fetch spec
130         https://bugs.webkit.org/show_bug.cgi?id=162260
131
132         Reviewed by Sam Weinig.
133
134         Covered by existing and updated tests.
135
136         To start implementing step 1 to 7 of fetch algorithm, this patch updates Accept header handling.
137
138         Default values are set according the spec based on resource type.
139         Some resource types are not defined in the spec and we keep using existing values.
140
141         We check if Accept header is already present in the request. If that is the case, no change is done to that header.
142
143         If the Accept header is not set, the default value '*/*' is used.
144         An Accept header is therefore always set at CachedResourceLoader level.
145
146         * loader/cache/CachedCSSStyleSheet.cpp:
147         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): Removing accept initialization.
148         * loader/cache/CachedResource.cpp:
149         (WebCore::CachedResource::load): Removing accept header setting.
150         * loader/cache/CachedResource.h:
151         (WebCore::CachedResource::accept): Deleted.
152         (WebCore::CachedResource::setAccept): Deleted.
153         * loader/cache/CachedResourceLoader.cpp:
154         (WebCore::acceptHeaderValueFromType): helper routine merging fetch spec and existing WebKit accept values.
155         (WebCore::CachedResourceLoader::prepareFetch): Should implement step 1 to 7 of https://fetch.spec.whatwg.org/#fetching.
156         (WebCore::CachedResourceLoader::requestResource): Making use of prepareFetch.
157         * loader/cache/CachedResourceLoader.h:
158         * loader/cache/CachedSVGDocument.cpp:
159         (WebCore::CachedSVGDocument::CachedSVGDocument): Removing accept initialization.
160         * loader/cache/CachedScript.cpp:
161         (WebCore::CachedScript::CachedScript): Removing accept initialization.
162         * loader/cache/CachedXSLStyleSheet.cpp:
163         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet): Removing accept initialization.
164         * platform/network/ResourceRequestBase.cpp:
165         (WebCore::ResourceRequestBase::hasHTTPHeader): Introduced to check for header presence.
166         * platform/network/ResourceRequestBase.h:
167
168 2016-09-21  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
169
170         [GTK] Fix build failure of ScrollbarThemeGtk with libc++
171         https://bugs.webkit.org/show_bug.cgi?id=162302
172
173         Reviewed by Carlos Garcia Campos.
174
175         * platform/gtk/ScrollbarThemeGtk.cpp:
176         (WebCore::ScrollbarThemeGtk::paint): Add missing #include <cstdlib>
177
178 2016-09-21  Philippe Normand  <pnormand@igalia.com>
179
180         [OpenWebRTC] Miscellaneous fixes
181         https://bugs.webkit.org/show_bug.cgi?id=162332
182
183         Reviewed by Alejandro G. Castro.
184
185         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
186         (WebCore::MediaPlayerPrivateGStreamerOwr::currentTime): Improved logging.
187         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Ditto.
188         (WebCore::MediaPlayerPrivateGStreamerOwr::loadingFailed): Ditto.
189         (WebCore::MediaPlayerPrivateGStreamerOwr::createGSTAudioSinkBin):
190         Pre-roll the autoaudiosink, fetch the underlying platform audio
191         sink and pass it to the OpenWebRTC renderer.
192         (WebCore::MediaPlayerPrivateGStreamerOwr::maybeHandleChangeMutedState): Improved logging.
193         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Don't configure invalid video renderer.
194         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
195         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Fix copy-paste error.
196
197 2016-09-21  Youenn Fablet  <youenn@apple.com>
198
199         Refactor CachedResourceLoader::canRequest
200         https://bugs.webkit.org/show_bug.cgi?id=162144
201
202         Reviewed by Darin Adler.
203
204         Covered by existing tests.
205
206         Simplifying CachedResourceLoader::canRequest by doing:
207         - CSP checks in another method
208         - Removing Same-Origin type-specific checks by setting FetchOptions::Mode appropriately in resource loader clients
209         - Moving script specific check in ScriptElement
210
211         Note that the last check may affect the loading behavior in the case scripts are enabled when starting the load
212         of a script, but gets disabled before receiving a redirection for the script load.
213
214         * dom/ProcessingInstruction.cpp:
215         (WebCore::ProcessingInstruction::checkStyleSheet): Setting XSLT stylesheet fetch mode to SameOrigin.
216         * dom/ScriptElement.cpp:
217         (WebCore::ScriptElement::requestScriptWithCache): Returning early if scripts are disabled.
218         * loader/CrossOriginPreflightChecker.cpp:
219         (WebCore::CrossOriginPreflightChecker::startPreflight): Bypassing CSP checks.
220         * loader/DocumentLoader.cpp:
221         (WebCore::DocumentLoader::startLoadingMainResource): Bypassing CSP checks as CachedResourceLoader was not
222         checking them for MainResource.
223         * loader/DocumentThreadableLoader.cpp:
224         (WebCore::DocumentThreadableLoader::loadRequest): Ditto.
225         * loader/LinkLoader.cpp:
226         (WebCore::LinkLoader::preloadIfNeeded): Using new CachedResourceRequest constructor to enable moving the ResourceRequest.
227         (WebCore::LinkLoader::loadLink): Skipping CSP checks for link prefetch/subresources as CachedResourceLoader was
228         not checking them for Link Prefetch and Subresource types.
229         * loader/cache/CachedResourceLoader.cpp:
230         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy): Helper routine to check for CSP.
231         (WebCore::CachedResourceLoader::canRequest): Making use of introduced helper routine.
232         Simplified same origin check as all requests should have their options set.
233         * loader/cache/CachedResourceLoader.h:
234         * loader/cache/CachedResourceRequest.cpp:
235         (WebCore::CachedResourceRequest::CachedResourceRequest): More efficient constructor.
236         * loader/cache/CachedResourceRequest.h:
237         * loader/cache/CachedSVGDocumentReference.cpp:
238         (WebCore::CachedSVGDocumentReference::load): Setting fetch mode to SameOrigin.
239         * svg/SVGUseElement.cpp:
240         (WebCore::SVGUseElement::updateExternalDocument): Ditto.
241         * xml/XSLImportRule.cpp:
242         (WebCore::XSLImportRule::loadSheet): Ditto.
243
244 2016-09-21  Miguel Gomez  <magomez@igalia.com>
245
246         Build fails with GSTREAMER_GL when both desktop GL and GLES2 are enabled in gst-plugins-bad
247         https://bugs.webkit.org/show_bug.cgi?id=159562
248
249         Reviewed by Philippe Normand.
250
251         Refactor video orientation code so including TextureMapperGL in MediaPlayerPrivateGStreamerBase.h
252         is not necessary.
253
254         Covered by existent tests.
255
256         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
257         (WebCore::texMapFlagFromOrientation):
258         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
259         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
260         (WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper):
261         (WebCore::MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation):
262         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
263
264 2016-09-21  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
265
266         [GTK] Fix build failure in clipboard support
267         https://bugs.webkit.org/show_bug.cgi?id=162261
268
269         Reviewed by Carlos Garcia Campos.
270
271         * platform/PlatformPasteboard.h: Add missing #include <functional>
272         * platform/gtk/PasteboardHelper.h: Add missing #include <functional>
273
274 2016-09-20  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
275
276         VariadicHelper::Result should not include constructor to initialize members
277         https://bugs.webkit.org/show_bug.cgi?id=162298
278
279         Reviewed by Darin Adler.
280
281         Remove the constructor since member-wise initialization does the same thing.
282
283         No new tests required.
284
285         * bindings/js/JSDOMBinding.h: Remove useless constructor.
286
287 2016-09-20  Alex Christensen  <achristensen@webkit.org>
288
289         Optimize URLParser
290         https://bugs.webkit.org/show_bug.cgi?id=162105
291
292         Reviewed by Geoffrey Garen.
293
294         Covered by new API tests.
295         This is about a 5% speedup on my URLParser benchmark.
296
297         * platform/URLParser.cpp:
298         (WebCore::percentEncodeByte):
299         (WebCore::utf8PercentEncode):
300         (WebCore::utf8QueryEncode):
301         (WebCore::encodeQuery):
302         (WebCore::URLParser::parse):
303         (WebCore::serializeURLEncodedForm):
304         (WebCore::percentEncode): Deleted.
305         (WebCore::utf8PercentEncodeQuery): Deleted.
306
307 2016-09-20  Carlos Garcia Campos  <cgarcia@igalia.com>
308
309         [GTK] Clean up DataObjectGtk handling
310         https://bugs.webkit.org/show_bug.cgi?id=162267
311
312         Reviewed by Michael Catanzaro.
313
314         * platform/Pasteboard.h: Use Ref instead of RefPtr for DataObjectGtk member.
315         * platform/PasteboardStrategy.h: Pass a const reference to DataObjectGtk in write method and return a Ref from read.
316         * platform/PlatformPasteboard.h: Ditto.
317         * platform/gtk/DataObjectGtk.h:
318         (WebCore::DataObjectGtk::image): Use Image instead of GdkPixbuf.
319         (WebCore::DataObjectGtk::setImage):
320         * platform/gtk/PasteboardGtk.cpp:
321         (WebCore::Pasteboard::createForDragAndDrop): Use a reference instead of a pointer.
322         (WebCore::Pasteboard::Pasteboard): Receives a reference, so we can also remove the ASSERT.
323         (WebCore::Pasteboard::dataObject):
324         (WebCore::Pasteboard::writeToClipboard): Remove the ShouldIncludeSmartPaste parameter, callers should also update
325         canSmartPaste property of DataObjectGtk before calling this.
326         (WebCore::Pasteboard::writePlainText):
327         (WebCore::Pasteboard::write): Do not convert the image the GdkPixbuf, pass the image to the DataObjectGtk instead.
328         * platform/gtk/PasteboardHelper.cpp:
329         (WebCore::PasteboardHelper::fillSelectionData): Convert the DataObjectGtk image to GdkPixbuf right before
330         passing it to gtk_selection_data_set_pixbuf().
331         (WebCore::ClipboardSetData::ClipboardSetData): Use reference instead of pointer.
332         (WebCore::getClipboardContentsCallback):
333         (WebCore::clearClipboardContentsCallback): Never clear the saved DataObjectGtk, that was only needed when we had
334         a global DataObjectGtk associated to a GtkClipboard.
335         (WebCore::PasteboardHelper::writeClipboardContents): Use TemporaryChange to set the settingClipboardDataObject global.
336         * platform/gtk/PlatformPasteboardGtk.cpp:
337         (WebCore::PlatformPasteboard::writeToClipboard):
338         (WebCore::PlatformPasteboard::readFromClipboard):
339
340 2016-09-20  Alex Christensen  <achristensen@webkit.org>
341
342         Require WTFMove for String::adopt
343         https://bugs.webkit.org/show_bug.cgi?id=162313
344
345         Reviewed by Yusuke Suzuki.
346
347         No change in behavior.  This just makes it more clear what is going on when a String adopts a Vector.
348
349         * bindings/js/SerializedScriptValue.cpp:
350         (WebCore::CloneDeserializer::readString):
351         * css/parser/CSSParser.cpp:
352         (WebCore::quoteCSSStringInternal):
353         * dom/Document.cpp:
354         (WebCore::canonicalizedTitle):
355         * html/canvas/CanvasRenderingContext2D.cpp:
356         (WebCore::normalizeSpaces):
357         * html/parser/HTMLTreeBuilder.cpp:
358         (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace):
359         * platform/Length.cpp:
360         (WebCore::newCoordsArray):
361         * platform/URLParser.cpp:
362         (WebCore::URLParser::parse):
363         (WebCore::URLParser::serialize):
364         * platform/graphics/ca/GraphicsLayerCA.cpp:
365         (WebCore::GraphicsLayerCA::ReplicaState::cloneID):
366         * platform/text/TextCodecUTF16.cpp:
367         (WebCore::TextCodecUTF16::decode):
368         * platform/text/TextCodecUTF8.cpp:
369         (WebCore::TextCodecUTF8::decode):
370         * platform/text/mac/TextCodecMac.cpp:
371         (WebCore::TextCodecMac::decode):
372
373 2016-09-20  Jer Noble  <jer.noble@apple.com>
374
375         Adopt MRMediaRemoteSetParentApplication.
376         https://bugs.webkit.org/show_bug.cgi?id=162259
377         <rdar://problem/28376161>
378
379         Reviewed by Anders Carlsson.
380
381         Allow MediaSessionManagerMac to retrieve the correct parent application identifier
382         from a PlatformMediaSession so that it can pass that identifier through to MediaRemote
383         via MRMediaRemoteSetParentApplication.
384
385         * Modules/webaudio/AudioContext.cpp:
386         (WebCore::AudioContext::sourceApplicationIdentifier):
387         * Modules/webaudio/AudioContext.h:
388         * platform/audio/PlatformMediaSession.cpp:
389         (WebCore::PlatformMediaSession::sourceApplicationIdentifier):
390         * platform/audio/PlatformMediaSession.h:
391         (WebCore::PlatformMediaSession::resetPlaybackSessionState): Deleted.
392         * platform/audio/mac/MediaSessionManagerMac.mm:
393         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
394         * platform/mac/MediaRemoteSoftLink.cpp:
395         * platform/mac/MediaRemoteSoftLink.h:
396
397
398 2016-09-20  Nan Wang  <n_wang@apple.com>
399
400         AX: AppleVisUser: VO can't navigate web dialogs iOS10
401         https://bugs.webkit.org/show_bug.cgi?id=162322
402
403         Reviewed by Chris Fleizach.
404
405         When using VoiceOver to navigate a web dialog's children, we were setting focus
406         onto the focusable parent in accessibilityElementDidBecomeFocused. When the focusable
407         parent is the dialog, it will cause the VO cursor jumping back and forward. Fixed it
408         by not setting focus on web dialogs in such case.
409
410         Test: accessibility/ios-simulator/dialog-did-become-focused.html
411
412         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
413         (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
414
415 2016-09-20  Keith Rollin  <krollin@apple.com>
416
417         Add new logging for network resource loading
418         https://bugs.webkit.org/show_bug.cgi?id=162237
419
420         Reviewed by Antti Koivisto.
421
422         Add new logging along the non-main path for resource loading. This
423         logging should allow us to differentiate between lack-of-logging due
424         execution along a path that doesn't have logging statements and
425         lack-of-logging due to a hung process.
426
427         No new tests -- there are no tests for logging.
428
429         * loader/DocumentLoader.cpp:
430         (WebCore::DocumentLoader::startLoadingMainResource):
431         (WebCore::DocumentLoader::isAlwaysOnLoggingAllowed):
432         * loader/DocumentLoader.h:
433         * loader/FrameLoader.cpp:
434         (WebCore::FrameLoader::continueLoadAfterWillSubmitForm):
435         * loader/cache/CachedResource.cpp:
436         (WebCore::CachedResource::load):
437         * loader/cache/CachedResourceLoader.cpp:
438         (WebCore::CachedResourceLoader::requestResource):
439         (WebCore::CachedResourceLoader::isAlwaysOnLoggingAllowed):
440         * loader/cache/CachedResourceLoader.h:
441         * page/Frame.h:
442
443 2016-09-20  Zalan Bujtas  <zalan@apple.com>
444
445         REGRESSION (r204552): Athlete search on Strava gives bad rendering.
446         https://bugs.webkit.org/show_bug.cgi?id=162250
447
448         Reviewed by Simon Fraser.
449
450         Test: fast/layers/blank-content-when-child-layer-is-at-negative-big-number.html
451
452         * platform/graphics/LayoutRect.cpp:
453         (WebCore::LayoutRect::checkedUnite):
454         * platform/graphics/LayoutRect.h:
455         (WebCore::LayoutRect::isMaxXMaxYRepresentable):
456         (WebCore::LayoutRect::maxXMaxYCorner): Deleted.
457         * rendering/RenderLayer.cpp:
458         (WebCore::RenderLayer::calculateClipRects):
459
460 2016-09-20  Jer Noble  <jer.noble@apple.com>
461
462         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-appendwindow.html
463         https://bugs.webkit.org/show_bug.cgi?id=162306
464
465         Reviewed by Darin Adler.
466
467         appendWindowStart should be a restricted double, and both it and appendWindowEnd should throw
468         TypeError exceptions when setting them to disallowed values.
469
470         * Modules/mediasource/SourceBuffer.cpp:
471         (WebCore::SourceBuffer::setAppendWindowStart):
472         (WebCore::SourceBuffer::setAppendWindowEnd):
473         * Modules/mediasource/SourceBuffer.idl:
474
475 2016-09-20  Jer Noble  <jer.noble@apple.com>
476
477         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-preload.html
478         https://bugs.webkit.org/show_bug.cgi?id=162304
479
480         Reviewed by Darin Adler.
481
482         If an error occurs while loading a URL on behalf of MediaPlayerPrivateAVFObjC, make sure to signal
483         that error to AVFoundation, so that the HTMLMediaElement is notified of the error.
484
485         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
486         (WebCore::WebCoreAVFResourceLoader::notifyFinished):
487
488 2016-09-20  Anders Carlsson  <andersca@apple.com>
489
490         Remove "in-store" from "-apple-pay-button-type"
491         https://bugs.webkit.org/show_bug.cgi?id=162321
492         rdar://problem/28394581
493
494         Reviewed by Beth Dakin.
495
496         * css/CSSPrimitiveValueMappings.h:
497         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
498         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
499         * css/CSSValueKeywords.in:
500         * css/parser/CSSParser.cpp:
501         (WebCore::isValidKeywordPropertyAndValue):
502         * css/parser/CSSParserFastPaths.cpp:
503         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
504         * rendering/RenderThemeCocoa.mm:
505         (WebCore::toPKPaymentButtonType):
506         * rendering/style/RenderStyleConstants.h:
507
508 2016-09-20  Alex Christensen  <achristensen@webkit.org>
509
510         Fix occasional using uninitialized memory crashes after r206168.
511         https://bugs.webkit.org/show_bug.cgi?id=162247
512
513         This fixes a crash in imported/w3c/web-platform-tests/url/urlsearchparams-constructor.html
514         I could reproduce about 10% of the time.
515
516         * html/URLSearchParams.h:
517         Initialize the pointer to nullptr.
518
519 2016-09-20  Alex Christensen  <achristensen@webkit.org>
520
521         Reduce allocations in URLParser
522         https://bugs.webkit.org/show_bug.cgi?id=162241
523
524         Reviewed by Chris Dumez.
525
526         Use Vectors instead of StringBuilders.  This allows us to use the inline capacity on the stack
527         for short URLs (<2KB) and also allows us to skip branches because we know whether the
528         contained type is UChar or LChar at compile time.  It also allows us to use uncheckedAppend.
529
530         Added new API tests for parts that were less tested, but there is
531         no change in behavior except for a performance improvement.
532
533         * platform/URLParser.cpp:
534         (WebCore::appendCodePoint):
535         (WebCore::encodeQuery):
536         (WebCore::URLParser::failure):
537         (WebCore::URLParser::parse):
538         (WebCore::percentDecode):
539         (WebCore::domainToASCII):
540         (WebCore::hasInvalidDomainCharacter):
541         (WebCore::URLParser::parseHost):
542         (WebCore::formURLDecode):
543         (WebCore::isC0Control): Deleted.
544         * platform/URLParser.h:
545
546 2016-09-20  Nan Wang  <n_wang@apple.com>
547
548         AX: voiceover does not read contents of input role="spinbutton"
549         https://bugs.webkit.org/show_bug.cgi?id=162137
550
551         Reviewed by Chris Fleizach.
552
553         The aria-valuenow attribute value on the spinbutton is not exposed
554         on iOS. We should expose aria-valuenow attribute for range controls
555         based on https://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow
556
557         Changes are covered in the modified test.
558
559         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
560         (-[WebAccessibilityObjectWrapper accessibilityValue]):
561
562 2016-09-20  Michael Catanzaro  <mcatanzaro@igalia.com>
563
564         URLParser: uidna_IDNToASCII_56 is deprecated
565         https://bugs.webkit.org/show_bug.cgi?id=161841
566
567         Reviewed by Alex Christensen.
568
569         Add pragmas to silence the warning, plus a FIXME.
570
571         * platform/URLParser.cpp:
572         (WebCore::domainToASCII):
573
574 2016-09-20  Alex Christensen  <achristensen@webkit.org>
575
576         Make URLSearchParams spec-compliant
577         https://bugs.webkit.org/show_bug.cgi?id=162247
578
579         Reviewed by Chris Dumez and Sam Weinig.
580
581         Covered by newly-passing web platform tests.
582
583         * html/DOMURL.cpp:
584         (WebCore::DOMURL::~DOMURL):
585         (WebCore::DOMURL::setHref):
586         (WebCore::DOMURL::setQuery):
587         Update any associated URLSearchParams object when the query could change.
588         (WebCore::DOMURL::searchParams):
589         The lifetime of the URLSearchParams was wrong.  We were creating a new URLSearchParams each time
590         URL.searchParams was called, and we should have been creating one the first time and returning the
591         same instance for subsequent calls.  This means the DOMURL must own the URLSearchParams if it is associated,
592         but if it is not associated, then a URLSearchParams can live on its own.
593         * html/DOMURL.h:
594         * html/URLSearchParams.h:
595         (WebCore::URLSearchParams::URLDestroyed):
596         (WebCore::URLSearchParams::setContents):
597
598 2016-09-20  Antti Koivisto  <antti@apple.com>
599
600         Remove AuthorStyleSheets::m_hadActiveLoadingStylesheet bit
601         https://bugs.webkit.org/show_bug.cgi?id=162312
602
603         Reviewed by Chris Dumez.
604
605         * dom/AuthorStyleSheets.cpp:
606         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
607
608             We can handle loading sheets with the normal stylesheet change logic. Remove the special case.
609
610         (WebCore::filterEnabledNonemptyCSSStyleSheets):
611
612             Filter out loading stylesheets.
613
614         * dom/AuthorStyleSheets.h:
615
616 2016-09-20  Keith Rollin  <krollin@apple.com>
617
618         Adjust current networking logging
619         https://bugs.webkit.org/show_bug.cgi?id=162235
620
621         Reviewed by Antti Koivisto.
622
623         Update the "always on" network logging in order to better track the
624         loading of a particular resource and to better bind together the
625         resources downloaded for a particular page and frame. Do this by
626         consistently logging pageID, frameID, and resourceID.
627
628         No new tests -- there are no tests for logging.
629
630         * loader/FrameLoader.cpp:
631         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
632         * loader/ResourceLoader.h:
633         (WebCore::ResourceLoader::frame):
634
635 2016-09-20  Alex Christensen  <achristensen@webkit.org>
636
637         Non-special URLs should have an opaque origin
638         https://bugs.webkit.org/show_bug.cgi?id=162254
639
640         Reviewed by Sam Weinig.
641
642         Covered by newly passing web platform tests.
643
644         * page/SecurityOrigin.cpp:
645         (WebCore::shouldTreatAsUniqueOrigin):
646         According to https://url.spec.whatwg.org/#origin all URLs with non-special protocols
647         should have a unique SecurityOrigin whose serialization is "null".
648
649 2016-09-20  Christopher Reid  <Christopher.Reid@am.sony.com>
650
651         [WinCairo]  Not building since 206044
652         https://bugs.webkit.org/show_bug.cgi?id=162246
653
654         Reviewed by Alex Christensen.
655
656         No new tests. No change in behaviour.
657
658         * bindings/js/JSWebGLRenderingContextCustom.cpp:
659         * platform/network/curl/CookieJarCurl.cpp:
660
661 2016-09-20  Alex Christensen  <achristensen@webkit.org>
662
663         Align URLParser with web platform tests when parsing non-special relative URLs ending in AuthorityOrHost state
664         https://bugs.webkit.org/show_bug.cgi?id=162251
665
666         Reviewed by Tim Horton.
667
668         Covered by new and updated API tests.
669
670         * platform/URLParser.cpp:
671         (WebCore::URLParser::parse):
672         Fix parsing of non-special URLs that end after scheme:// with no authority.
673         We used to assume that parsing non-special schemes would never end with just scheme:// but a string can indeed end right there.
674         When a non-special relative URL contains just scheme:// we need the resulting URL to be valid to conform with the web platform tests.
675         (WebCore::URLParser::parseHostAndPort):
676         Renamed to reflect what the function actually does.
677         (WebCore::URLParser::internalValuesConsistent):
678         Add utility function for testing.
679         (WebCore::URLParser::parseHost): Deleted.
680         * platform/URLParser.h:
681
682 2016-09-20  Javier Fernandez  <jfernandez@igalia.com>
683
684         [css-grid] The 'grid' shorthand has a new syntax.
685         https://bugs.webkit.org/show_bug.cgi?id=161954
686
687         Reviewed by Darin Adler.
688
689         Implementation of the new CSS syntax for the 'grid' shorthand, as
690         defined in the CSS Grid Layout specification:
691         - https://drafts.csswg.org/css-grid/#grid-shorthand
692
693         No new tests, just adapted the ones we already have and added a few additional test cases.
694
695         * css/CSSValueKeywords.in:
696         * css/parser/CSSParser.cpp:
697         (WebCore::CSSParser::parseImplicitAutoFlow): Added. Similar to parseGridAutoFlow, but using the new 'auto-flow' keyword.
698         (WebCore::CSSParser::parseGridShorthand): New syntax of the 'grid' shorthand.
699         * css/parser/CSSParser.h:
700
701 2016-09-20  Alex Christensen  <achristensen@webkit.org>
702
703         URLParser should allow '@' in user
704         https://bugs.webkit.org/show_bug.cgi?id=162272
705
706         Reviewed by Tim Horton.
707
708         Covered by a new API test.
709
710         * platform/URLParser.cpp:
711         (WebCore::URLParser::parse):
712         The spec describes using an "@ flag" and rewinding iterators.  I've implemented the authority parsing
713         and host parsing a little differently, but this makes it equivalent.
714
715 2016-09-20  Alex Christensen  <achristensen@webkit.org>
716
717         URLParser: Fix parsing relative URLs with one slash after the scheme:
718         https://bugs.webkit.org/show_bug.cgi?id=162294
719
720         Reviewed by Tim Horton.
721
722         This fixes the relatively-obscure case where a relative URL has the same special scheme as the base,
723         but there is only one slash after the scheme: at the beginning of the relative URL.  According to spec,
724         this should be interpreted the same as if the scheme: were not there.
725         For example, parsing "http:/example.com/" relative to "http://example.org/foo/bar" should be the same as
726         parsing "/example.com/" relative to "http://example.org/foo/bar".
727
728         Covered by a new API test.
729
730         * platform/URLParser.cpp:
731         (WebCore::URLParser::parse):
732
733 2016-09-20  Alex Christensen  <achristensen@webkit.org>
734
735         Fix Windows file URL quirks in URLParser
736         https://bugs.webkit.org/show_bug.cgi?id=162303
737
738         Reviewed by Tim Horton.
739
740         Windows file urls allow c:\ and c|\ to have the same meaning, but when serialized they should both be c:/.
741         This is now standardized to allow cross-platform uniform behavior of URLs.
742
743         Covered by new API tests and progress on web platform tests when URLParser is enabled.
744
745         * platform/URLParser.cpp:
746         (WebCore::incrementIteratorSkippingTabAndNewLine):
747         (WebCore::isWindowsDriveLetter):
748         (WebCore::checkWindowsDriveLetter):
749         (WebCore::shouldCopyFileURL):
750         (WebCore::URLParser::parseSerializedURL):
751         (WebCore::URLParser::parse):
752
753 2016-09-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
754
755         Rename FrameData to ImageFrame, move it to a separate file and use it for all ports
756         https://bugs.webkit.org/show_bug.cgi?id=159819
757
758         Reviewed by Simon Fraser.
759
760         Rename FrameData to ImageFrame and move it to a separate file so caching
761         it can be managed outside the BitmapImage object. Make the data members
762         of FrameData be private and add getters to return their values. Add backing
763         store and disposalMethod members, getter and setters to ImageFrame so it can
764         replace the non-CG ImageFrame class.
765
766         * CMakeLists.txt:
767         * WebCore.xcodeproj/project.pbxproj:
768         Add ImageFrame class to WebCore project.
769         
770         * platform/graphics/BitmapImage.cpp:
771         (WebCore::BitmapImage::BitmapImage): The metadata for the non-decoder case is now calculated in the ImageFrame::initialize().
772         (WebCore::BitmapImage::haveFrameImageAtIndex): Call ImageFrame's getters instead of access private members.
773         (WebCore::BitmapImage::destroyDecodedData): Pass ImageFrame::Caching::Metadata to ImageFrame::clear() to clear the image only.
774         (WebCore::BitmapImage::destroyDecodedDataIfNecessary): ImageFrame::usedFrameBytes() is now renamed to ImageFrame::frameBytes().
775         (WebCore::BitmapImage::cacheFrame): Call ImageFrame::initialize() to set the image and cache the frame's metadata.
776         (WebCore::BitmapImage::dataChanged): Pass ImageFrame::Caching::Empty to ImageFrame::clear() to clear the frame's image and metadata.
777         (WebCore::BitmapImage::ensureFrameAtIndexIsCached): Call ImageFrame's getters instead of access private members.
778         (WebCore::BitmapImage::frameImageAtIndex): Call ImageFrame's getters instead of access private members.
779         (WebCore::BitmapImage::frameIsCompleteAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
780         (WebCore::BitmapImage::frameDurationAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
781         (WebCore::BitmapImage::frameHasAlphaAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
782         (WebCore::BitmapImage::frameOrientationAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
783         (WebCore::BitmapImage::singlePixelSolidColor): Call ImageFrame's getters instead of access private members.
784         (WebCore::BitmapImage::repetitionCount): Change the return type to be RepetitionCount instead of int.
785         (WebCore::BitmapImage::shouldAnimate): Use a simpler condition since RepetitionCountNone is equal to zero.
786         (WebCore::BitmapImage::startAnimation): Replace the cAnimation* constants by the new RepetitionCount* enum.
787         (WebCore::BitmapImage::internalAdvanceAnimation): Replace the cAnimation* constants by the new RepetitionCount* enum.
788
789         * platform/graphics/BitmapImage.h: FrameData is renamed to ImageFrame and moved to a separate file named ImageFrame.h.
790         (WebCore::FrameData::FrameData): Deleted.
791         (WebCore::FrameData::~FrameData): Deleted.
792         (WebCore::FrameData::clear): Deleted.
793         (WebCore::FrameData::usedFrameBytes): Deleted.
794
795         * platform/graphics/ImageBackingStore.h: 
796         (WebCore::ImageBackingStore::fillRect): Make it efficient to fill a rect in the ImageBackingStore with the same color.
797         (WebCore::ImageBackingStore::pixelAt): Asserts the point is in the bounds of the ImageBackingStore size.
798         (WebCore::ImageBackingStore::setPixel): Use pixelValue().
799         (WebCore::ImageBackingStore::inBounds): Private functions check whether a point or a rect is in the bounds of the ImageBackingStore size.
800         (WebCore::ImageBackingStore::pixelValue): Calculate the RGBA value form red, green, blue and alpha values.
801
802         * platform/graphics/ImageFrame.cpp: Added.
803         (WebCore::ImageFrame::ImageFrame): 
804         (WebCore::ImageFrame::~ImageFrame):
805         (WebCore::ImageFrame::operator=):
806         (WebCore::ImageFrame::fillMetaData): Caches the ImageFrame's metadata.
807         (WebCore::ImageFrame::clearImage): Deletes all the allocated memory by ImageFrame which can be the ImageBackingStore or the NativeImagePtr.
808         (WebCore::ImageFrame::clear): Deletes the allocated memory and may or may not clears the metadata also.
809         (WebCore::ImageFrame::initialize): Sets a new ImageBackingStore or a new NativeImagePtr in the ImageFrame.
810         (WebCore::ImageFrame::size): Returns the size of the ImageFrame which can be the size of ImageBackingStore or the size of NativeImagePtr.
811         (WebCore::ImageFrame::singlePixelSolidColor): Returns whether the ImageFrame can be drawn by filling the image rectangle with a solid color.
812         
813         * platform/graphics/ImageFrame.h: Added.
814         (WebCore::operator++): SubsamplingLevel is strongly typed but RepetitionCount is not since it can be any unsigned value in addition to -1.
815         (WebCore::ImageFrame::ImageFrame):
816         (WebCore::ImageFrame::setDecoding):
817         (WebCore::ImageFrame::decoding):
818         (WebCore::ImageFrame::isEmpty):
819         (WebCore::ImageFrame::isPartial):
820         (WebCore::ImageFrame::isComplete):
821         (WebCore::ImageFrame::sizeRespectingOrientation):
822         (WebCore::ImageFrame::frameBytes):
823         (WebCore::ImageFrame::subsamplingLevel):
824         (WebCore::ImageFrame::setDisposalMethod):
825         (WebCore::ImageFrame::disposalMethod):
826         (WebCore::ImageFrame::image):
827         (WebCore::ImageFrame::setOrientation):
828         (WebCore::ImageFrame::orientation):
829         (WebCore::ImageFrame::setDuration):
830         (WebCore::ImageFrame::duration):
831         (WebCore::ImageFrame::setHasAlpha):
832         (WebCore::ImageFrame::hasAlpha):
833         (WebCore::ImageFrame::hasImage):
834         (WebCore::ImageFrame::hasInvalidImage):
835         (WebCore::ImageFrame::hasMetadata):
836         (WebCore::ImageFrame::backingStore):
837         (WebCore::ImageFrame::hasBackingStore):
838         Setters and getters for the private members.
839
840         * platform/graphics/ImageSource.cpp:
841         (WebCore::ImageSource::calculateMaximumSubsamplingLevel): allowSubsamplingOfFrameAtIndex() is renamed to frameAllowSubsamplingAtIndex().
842         (WebCore::ImageSource::subsamplingLevelForScale): Use the values of the enum class SubsamplingLevel.
843         (WebCore::ImageSource::size): Use the values of the enum class SubsamplingLevel.
844         (WebCore::ImageSource::sizeRespectingOrientation): Use the values of the enum class SubsamplingLevel.
845         (WebCore::ImageSource::repetitionCount): Replace the constants cAnimation* by the enum RepetitionCount*.
846         (WebCore::ImageSource::frameAllowSubsamplingAtIndex): Rename allowSubsamplingOfFrameAtIndex() to frameAllowSubsamplingAtIndex().
847         (WebCore::ImageSource::frameSizeAtIndex): Replace the call to orientationAtIndex() by frameOrientationAtIndex().
848         (WebCore::ImageSource::frameOrientationAtIndex): Rename orientationAtIndex() to frameOrientationAtIndex().
849         (WebCore::ImageSource::dump): Replace the call to orientationAtIndex() by frameOrientationAtIndex().
850         (WebCore::ImageSource::allowSubsamplingOfFrameAtIndex): Deleted.
851         (WebCore::ImageSource::orientationAtIndex): Deleted.
852         
853         * platform/graphics/ImageSource.h:
854         (WebCore::ImageSource::decoder): We need this function temporarily till we move caching the frames outside BitmapImage. 
855
856         * platform/graphics/NativeImage.h: Change SubImages() to Subimages(). See Darin's comment in https://bugs.webkit.org/show_bug.cgi?id=159819#c6.
857         * platform/graphics/cairo/NativeImageCairo.cpp:
858         (WebCore::clearNativeImageSubimages):
859         (WebCore::clearNativeImageSubImages): Deleted.
860
861         * platform/graphics/cg/ImageDecoderCG.cpp:
862         (WebCore::createImageSourceOptions): Use the values of the enum class SubsamplingLevel.
863         (WebCore::imageSourceOptions): Use the values of the enum class SubsamplingLevel.
864         (WebCore::ImageDecoder::repetitionCount): Change the return type to be RepetitionCount instead of int.
865         (WebCore::ImageDecoder::frameOrientationAtIndex): orientationAtIndex() is renamed to frameOrientationAtIndex().
866         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex): allowSubsamplingOfFrameAtIndex() is renamed to frameAllowSubsamplingAtIndex().
867         (WebCore::ImageDecoder::orientationAtIndex): Deleted.
868         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex): Deleted.
869         * platform/graphics/cg/ImageDecoderCG.h:
870
871         * platform/graphics/cg/NativeImageCG.cpp:
872         (WebCore::clearNativeImageSubimages): Change SubImages() to Subimages().
873         (WebCore::clearNativeImageSubImages): Deleted.
874
875         * platform/image-decoders/ImageDecoder.cpp:
876         (WebCore::ImageDecoder::frameIsCompleteAtIndex): Use ImageFrame::isComplete() instead of checking the value of the decoding status().
877         (WebCore::ImageDecoder::frameHasAlphaAtIndex): Use ImageFrame::isComplete() instead of checking the value of the decoding status().
878         (WebCore::ImageDecoder::frameDurationAtIndex): Use ImageFrame::isEmpty() instead of checking the value of the decoding status().
879         (WebCore::ImageDecoder::createFrameImageAtIndex): Access the ImageBackingStore::image() function directly.
880         (WebCore::ImageFrame::ImageFrame): Deleted.
881         (WebCore::ImageFrame::operator=): Deleted.
882         (WebCore::ImageFrame::clearPixelData): Deleted.
883         (WebCore::ImageFrame::zeroFillPixelData): Deleted.
884         (WebCore::ImageFrame::zeroFillFrameRect): Deleted.
885         (WebCore::ImageFrame::initializeBackingStore): Deleted.
886         (WebCore::ImageFrame::hasAlpha): Deleted.
887         (WebCore::ImageFrame::setHasAlpha): Deleted.
888         (WebCore::ImageFrame::setOriginalFrameRect): Deleted.
889         (WebCore::ImageFrame::setStatus): Deleted.
890
891         * platform/image-decoders/ImageDecoder.h:
892         (WebCore::ImageDecoder::repetitionCount): Use the type RepetitionCount and the enum RepetitionCount* values.
893         (WebCore::ImageDecoder::frameOrientationAtIndex): Rename orientationAtIndex() to frameOrientationAtIndex().
894         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex): Rename allowSubsamplingOfFrameAtIndex() to frameAllowSubsamplingAtIndex().
895         (WebCore::ImageDecoder::subsamplingLevelForScale): Use the enum class SubsamplingLevel value instead of integer values.
896         (WebCore::ImageFrame::ImageFrame): Deleted.
897         (WebCore::ImageFrame::copyRowNTimes): Deleted.
898         (WebCore::ImageFrame::size): Deleted.
899         (WebCore::ImageFrame::asNewNativeImage): Deleted.
900         (WebCore::ImageFrame::backingStore): Deleted.
901         (WebCore::ImageFrame::hasBackingStore): Deleted.
902         (WebCore::ImageFrame::originalFrameRect): Deleted.
903         (WebCore::ImageFrame::status): Deleted.
904         (WebCore::ImageFrame::duration): Deleted.
905         (WebCore::ImageFrame::disposalMethod): Deleted.
906         (WebCore::ImageFrame::setDuration): Deleted.
907         (WebCore::ImageFrame::setDisposalMethod): Deleted.
908         (WebCore::ImageFrame::pixelAt): Deleted.
909         (WebCore::ImageFrame::setPixel): Deleted.
910         (WebCore::ImageFrame::blendPixel): Deleted.
911         (WebCore::ImageDecoder::orientationAtIndex): Deleted.
912         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex): Deleted.
913
914         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
915         (WebCore::BMPImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
916         (WebCore::BMPImageDecoder::decode): Ditto.
917
918         * platform/image-decoders/bmp/BMPImageReader.cpp:
919         (WebCore::BMPImageReader::decodeBMP): Call ImageFrame::isEmpty(). ImageBuffer::initializeBackingStore() is renamed to initialize().
920         (WebCore::BMPImageReader::processNonRLEData): Replace ImageFrame::zeroFillPixelData() by ImageBackingStore::clear() and ImageFrame::setAlpha().
921
922         * platform/image-decoders/bmp/BMPImageReader.h:
923         (WebCore::BMPImageReader::setPixel): Call ImageBackingStore::setPixel() directly.
924         (WebCore::BMPImageReader::fillRGBA): Replace an efficient loop to call setPixel() by ImageBackingStore::fillRect().
925
926         * platform/image-decoders/gif/GIFImageDecoder.cpp:
927         (WebCore::GIFImageDecoder::GIFImageDecoder): Move the initialization of m_repetitionCount to the header file.
928         (WebCore::GIFImageDecoder::repetitionCount): Change the return type.
929         (WebCore::GIFImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
930         (WebCore::GIFImageDecoder::clearFrameBufferCache): Use the values of the new enum class ImageFrame::DisposalMethod.
931         (WebCore::GIFImageDecoder::haveDecodedRow): Call the ImageBackingStore API's directly.
932         (WebCore::GIFImageDecoder::frameComplete): Use the values of the new enum class ImageFrame::DisposalMethod.
933         (WebCore::GIFImageDecoder::initFrameBuffer): Move calling ImageBackingStore::setFrameRect() to be after initializing the ImageBackingStore itself.
934
935         * platform/image-decoders/gif/GIFImageDecoder.h: Make repetitionCount() returns RepetitionCount and use the new enum class ImageFrame::DisposalMethod.
936         
937         * platform/image-decoders/gif/GIFImageReader.cpp:
938         (GIFImageReader::parse):
939
940         * platform/image-decoders/gif/GIFImageReader.h:
941         (GIFFrameContext::GIFFrameContext): Use new enum class ImageFrame::DisposalMethod.
942         
943         * platform/image-decoders/ico/ICOImageDecoder.cpp:
944         (WebCore::ICOImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
945         (WebCore::ICOImageDecoder::decode): Ditto.
946
947         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
948         (WebCore::JPEGImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
949         (WebCore::setPixel): Call ImageBackingStore::setPixel() directly.
950         (WebCore::JPEGImageDecoder::outputScanlines): ImageFrame::initializeBackingStore() is renamed to initialize().
951         (WebCore::JPEGImageDecoder::jpegComplete): ImageFrame::setStatus() is renamed to ImageFrame::setDecoding().
952         (WebCore::JPEGImageDecoder::decode): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
953
954         * platform/image-decoders/png/PNGImageDecoder.cpp:
955         (WebCore::PNGImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
956         (WebCore::PNGImageDecoder::rowAvailable): Call the ImageBackingStore APIs directly.
957         (WebCore::PNGImageDecoder::pngComplete): ImageFrame::setStatus() is renamed to setDecoding().
958         (WebCore::PNGImageDecoder::readChunks): Use the values of the new enum class ImageFrame::DisposalMethod.
959         (WebCore::PNGImageDecoder::clearFrameBufferCache): Replace the call to ImageFrame::clearPixelData() by  ImageFrame::clear().
960         (WebCore::PNGImageDecoder::initFrameBuffer): Move calling ImageBackingStore::setFrameRect() to be after initializing the ImageBackingStore itself.
961         (WebCore::PNGImageDecoder::frameComplete): Call the ImageBackingStore APIs directly.
962
963         * platform/image-decoders/png/PNGImageDecoder.h: Call ImageFrame::isComplete() instead of checking the value of the decoding status().
964
965         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
966         (WebCore::WEBPImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
967         (WebCore::WEBPImageDecoder::decode): ImageFrame::setStatus() is renamed to setDecoding(). And initializeBackingStore() is renamed to initialize().
968
969 2016-09-20  Don Olmstead  <don.olmstead@am.sony.com>
970
971         [WinCairo] Use find_package cairo in build
972         https://bugs.webkit.org/show_bug.cgi?id=162239
973
974         Reviewed by Alex Christensen.
975
976         No new tests. No change in behavior.
977
978         * PlatformWinCairo.cmake:
979
980 2016-09-20  Jer Noble  <jer.noble@apple.com>
981
982         [media-source] Support MediaSource.setLiveSeekableRanges()
983         https://bugs.webkit.org/show_bug.cgi?id=162252
984
985         Reviewed by Sam Weinig.
986
987         Fixes tests: imported/w3c/web-platform-tests/media-source/interfaces.html
988                      imported/w3c/web-platform-tests/media-source/mediasource-liveseekable.html
989
990         Add support for a new part of the Media Source specification, the ability for clients to
991         specify the seekable ranges for a MediaSource-backed HTMLMediaElement.
992
993         Adding the live-seekable methods to MediaSource fixes a large number of the interfaces.html
994         tests, and the rest are fixed by adding on<event> handlers to MediaSource, SourceBuffer,
995         and SourceBufferList.
996
997         * Modules/mediasource/MediaSource.cpp:
998         (WebCore::MediaSource::seekable):
999         (WebCore::MediaSource::setLiveSeekableRange):
1000         (WebCore::MediaSource::clearLiveSeekableRange):
1001         * Modules/mediasource/MediaSource.h:
1002         * Modules/mediasource/MediaSource.idl:
1003         * Modules/mediasource/SourceBuffer.idl:
1004         * Modules/mediasource/SourceBufferList.idl:
1005         * Modules/mediasource/VideoPlaybackQuality.idl:
1006         * html/HTMLMediaElement.cpp:
1007         (WebCore::HTMLMediaElement::seekable):
1008
1009 2016-09-20  Per Arne Vollan  <pvollan@apple.com>
1010
1011         [Win] Unreviewed warning fix.
1012
1013         * page/CaptionUserPreferencesMediaAF.cpp:
1014
1015 2016-09-19  Chris Dumez  <cdumez@apple.com>
1016
1017         Add support for HTMLSourceElement.prototype.sizes / HTMLSourceElement.prototype.srcset
1018         https://bugs.webkit.org/show_bug.cgi?id=162244
1019
1020         Reviewed by Alex Christensen.
1021
1022         Add support for HTMLPrototype.prototype.sizes / HTMLPrototype.prototype.srcset:
1023         - https://html.spec.whatwg.org/#the-source-element
1024
1025         We already support the corresponding content attributes internally. However, we
1026         are missing the corresponding IDL attributes that are supposed to reflect them.
1027
1028         Chrome and Firefox support them. We already had those IDL attributes on
1029         HTMLImageElement.
1030
1031         No new tests, rebaselined existing test.
1032
1033         * html/HTMLSourceElement.idl:
1034
1035 2016-09-19  Anders Carlsson  <andersca@apple.com>
1036
1037         Suppress JavaScript prompts early on in certain cases
1038         https://bugs.webkit.org/show_bug.cgi?id=162243
1039         rdar://problem/27661602
1040
1041         Reviewed by Geoffrey Garen.
1042
1043         Export symbols needed by WebKit2.
1044
1045         * loader/FrameLoader.h:
1046         * loader/FrameLoaderStateMachine.h:
1047
1048 2016-09-19  Chris Dumez  <cdumez@apple.com>
1049
1050         Align HTMLAppletElement with the specification
1051         https://bugs.webkit.org/show_bug.cgi?id=162240
1052
1053         Reviewed by Alex Christensen.
1054
1055         Align HTMLAppletElement with the specification:
1056         - https://html.spec.whatwg.org/#htmlappletelement
1057
1058         In particular:
1059         - space / vspace should be of type "unsigned long", not DOMString
1060         - codeBase and object should reflect as URLs
1061
1062         Firefox agree with the specification. Chrome does not have
1063         HTMLAppletElement anymore.
1064
1065         No new tests, rebaselined existing test.
1066
1067         * html/HTMLAppletElement.cpp:
1068         (WebCore::HTMLAppletElement::isURLAttribute):
1069         * html/HTMLAppletElement.h:
1070         * html/HTMLAppletElement.idl:
1071
1072 2016-09-16  Jer Noble  <jer.noble@apple.com>
1073
1074         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html
1075         https://bugs.webkit.org/show_bug.cgi?id=162104
1076
1077         Reviewed by Eric Carlson.
1078
1079         Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html
1080
1081         Multiple overlapping issues are causing this test to fail:
1082
1083         - When a MediaSource object is not attached from a HTMLMediaElement, it's SourceBuffer
1084           objects will return `null` from .videoTracks and .audioTracks, foiling the tests ability
1085           to assert that sourceBuffer.videoTracks.length == 0.
1086
1087         - When a MediaSource object is detached from a HTMLMediaElement, it's tracks are removed
1088           but do not generate 'removedtrack' events.
1089
1090         When these bugs were fixed, a few more popped up:
1091
1092         - The HTMLMediaElement removes its tracks before it closes the MediaSource, which causes an
1093           assertion when the MediaSource tells the HTMLMediaElement to remove its copy of the 
1094           source's tracks (which have already been removed).
1095
1096         - When the HTMLMediaElement is stop()-ed due to its ScriptExecutionContext being destroyed,
1097           it tries to close its MediaSource, which has itself already been stop()-ed and thus asserts.
1098
1099         To eliminate all these bugs and make the code more self explanatory, we will rename the 
1100         HTMLMediaElement's closeMediaSource() method to detachMediaSource(), and the MediaSource's
1101         close() method to detachFromElement(). The only way to close a MediaSource is now by calling
1102         detachMediaSource() from the HTMLMediaElement.  The parts of the "Detaching from a media
1103         element" algorithm which were previously spread across setReadyState() and onReadyStateChange()
1104         are now unified in the newly renamed detachFromElement() method. The HTMLMediaElement will
1105         first detach its MediaSource, and only after that remove all its tracks.
1106
1107         * Modules/mediasource/MediaSource.cpp:
1108         (WebCore::MediaSource::setReadyState): Move steps into detachFromElement().
1109         (WebCore::MediaSource::onReadyStateChange): Ditto.
1110         (WebCore::MediaSource::detachFromElement): Perform the steps as specified.
1111         (WebCore::MediaSource::attachToElement): Takes a reference rather than a bare pointer.
1112         (WebCore::MediaSource::stop): Ask the media elemnet to detach.
1113         (WebCore::MediaSource::close): Renamed to detachFromElement().
1114         * Modules/mediasource/MediaSource.h:
1115         * Modules/mediasource/SourceBuffer.cpp:
1116         (WebCore::SourceBuffer::videoTracks): Always return a valid TrackList object.
1117         (WebCore::SourceBuffer::audioTracks): Ditto.
1118         (WebCore::SourceBuffer::textTracks): Ditto.
1119         * html/HTMLMediaElement.cpp:
1120         (WebCore::HTMLMediaElement::~HTMLMediaElement): Renamed closeMediaSource() -> detachMediaSource().
1121         (WebCore::HTMLMediaElement::prepareForLoad): Ditto.
1122         (WebCore::HTMLMediaElement::loadResource): Ditto.
1123         (WebCore::HTMLMediaElement::noneSupported): Ditto.
1124         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally): Ditto.
1125         (WebCore::HTMLMediaElement::detachMediaSource): Ditto.
1126         (WebCore::HTMLMediaElement::userCancelledLoad): Ditto.
1127         (WebCore::HTMLMediaElement::createMediaPlayer): Ditto.
1128         (WebCore::HTMLMediaElement::clearMediaPlayer): Ditto. Also, detach from the MediaSource before
1129             removing tracks.
1130         (WebCore::HTMLMediaElement::closeMediaSource): Deleted.
1131         * html/HTMLMediaElement.h:
1132         * html/track/TrackListBase.cpp:
1133         (TrackListBase::remove): Only try to clear the media element from Tracks that have one.
1134
1135 2016-09-19  Alex Christensen  <achristensen@webkit.org>
1136
1137         URLParser can read memory out of bounds
1138         https://bugs.webkit.org/show_bug.cgi?id=162206
1139
1140         Reviewed by Geoff Garen.
1141
1142         Covered by new API tests.
1143         URLParser is disabled by default still.
1144
1145         * platform/URLParser.cpp:
1146         (WebCore::parseIPv4Host):
1147         If there are fewer than two numbers in an ipv4 address, we would subtract two from the Vector's size, 
1148         causing us to read memory up to std::numeric_limits<size_t>::max() - 2.  Added a bounds check and many tests.
1149
1150 2016-09-19  Alex Christensen  <achristensen@webkit.org>
1151
1152         URLParser should parse serialized valid URLs faster than unknown input
1153         https://bugs.webkit.org/show_bug.cgi?id=162228
1154
1155         Reviewed by Chris Dumez.
1156
1157         The URL constructor with ParsedURLStringTag is almost twice as fast as the other URL constructors.
1158         Assuming there are no tabs or newlines, and assuming characters are already encoded decreases the URLParser
1159         runtime by over 25% and adds infrastructure for more optimizations.
1160
1161         No new tests. No change in behaviour.
1162
1163         * platform/URL.cpp:
1164         (WebCore::URL::URL):
1165         * platform/URLParser.cpp:
1166         (WebCore::utf8PercentEncode):
1167         (WebCore::utf8PercentEncodeQuery):
1168         (WebCore::URLParser::parse):
1169         (WebCore::URLParser::parseSerializedURL):
1170         (WebCore::incrementIterator):
1171         (WebCore::URLParser::parseAuthority):
1172         (WebCore::URLParser::parsePort):
1173         (WebCore::URLParser::parseHost):
1174         * platform/URLParser.h:
1175         (WebCore::URLParser::parse): Deleted.
1176
1177 2016-09-19  Daniel Bates  <dabates@apple.com>
1178
1179         Cleanup: Remove an extraneous copy of SecurityOrigin
1180         https://bugs.webkit.org/show_bug.cgi?id=162118
1181
1182         Reviewed by Youenn Fablet.
1183
1184         Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and
1185         LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin.
1186         This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated
1187         in WorkerThreadableLoader::MainThreadBridge for use on the main thread only.
1188
1189         * loader/WorkerThreadableLoader.cpp:
1190         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
1191         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1192
1193 2016-09-19  Antti Koivisto  <antti@apple.com>
1194
1195         Add size assert for RenderElement
1196         https://bugs.webkit.org/show_bug.cgi?id=162096
1197
1198         Reviewed by Simon Fraser.
1199
1200         Also remove the unused m_visibleInViewportState field.
1201
1202         * rendering/RenderElement.cpp:
1203         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
1204         * rendering/RenderElement.h:
1205
1206 2016-09-19  Keith Rollin  <krollin@apple.com>
1207
1208         REGRESSION (r205275): LOG_WITH_STREAM() macros are all compiled in release builds now
1209         https://bugs.webkit.org/show_bug.cgi?id=162180
1210
1211         Reviewed by Simon Fraser.
1212
1213         Disable LOG_WITH_STREAM in release mode. Along with this, remove a
1214         local variable in GraphcsContextCG.cpp in release mode that's no
1215         longer referenced. And adjust logFunctionResult so that it gets
1216         defined only in debug mode, too, to match its declaration in
1217         LogMacros.h.
1218
1219         No new tests -- there are no tests for logging.
1220
1221         * platform/LogMacros.h:
1222         * platform/Logging.cpp:
1223         * platform/graphics/cg/GraphicsContextCG.cpp:
1224         (WebCore::GraphicsContext::drawNativeImage):
1225
1226 2016-09-19  Daniel Bates  <dabates@apple.com>
1227
1228         Remove ENABLE(TEXT_AUTOSIZING) automatic text size adjustment code
1229         https://bugs.webkit.org/show_bug.cgi?id=162167
1230
1231         Reviewed by Simon Fraser.
1232
1233         Remove the automatic text size adjustment code guarded by ENABLE(TEXT_AUTOSIZING)
1234         because it is not used by any port. On Mac and iOS, analogous code guarded by
1235         ENABLE(IOS_TEXT_AUTOSIZING) is used.
1236
1237         * CMakeLists.txt:
1238         * Configurations/FeatureDefines.xcconfig:
1239         * dom/Document.cpp:
1240         (WebCore::Document::Document):
1241         * dom/Document.h:
1242         (WebCore::Document::textAutosizer): Deleted.
1243         * page/FrameView.cpp:
1244         (WebCore::FrameView::setFrameRect):
1245         (WebCore::FrameView::layout):
1246         * page/Settings.cpp:
1247         (WebCore::Settings::Settings):
1248         (WebCore::Settings::setTextAutosizingFontScaleFactor): Deleted.
1249         * page/Settings.h:
1250         (WebCore::Settings::textAutosizingFontScaleFactor): Deleted.
1251         * page/animation/CSSPropertyAnimation.cpp:
1252         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
1253         * rendering/RenderingAllInOne.cpp:
1254         * rendering/TextAutosizer.cpp: Removed.
1255         * rendering/TextAutosizer.h: Removed.
1256         * rendering/style/RenderStyle.cpp:
1257         (WebCore::RenderStyle::changeRequiresLayout):
1258         (WebCore::RenderStyle::lineHeight):
1259         (WebCore::RenderStyle::setFontSize):
1260         * rendering/style/RenderStyle.h:
1261         (WebCore::RenderStyle::textAutosizingMultiplier): Deleted.
1262         (WebCore::RenderStyle::setTextAutosizingMultiplier): Deleted.
1263         * rendering/style/StyleVisualData.cpp:
1264         (WebCore::StyleVisualData::StyleVisualData):
1265         * rendering/style/StyleVisualData.h:
1266         * testing/InternalSettings.cpp:
1267         (WebCore::InternalSettings::Backup::Backup):
1268         (WebCore::InternalSettings::Backup::restoreTo):
1269         (WebCore::InternalSettings::setTextAutosizingEnabled):
1270         (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
1271         (WebCore::InternalSettings::setTextAutosizingFontScaleFactor): Deleted.
1272         * testing/InternalSettings.h:
1273         * testing/InternalSettings.idl:
1274
1275 2016-09-19  Chris Dumez  <cdumez@apple.com>
1276
1277         Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier
1278         https://bugs.webkit.org/show_bug.cgi?id=162166
1279
1280         Reviewed by Alex Christensen.
1281
1282         Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier as
1283         per the latest HTML specification.
1284         - https://html.spec.whatwg.org/#parsing-xhtml-documents
1285
1286         Firefox already recognizes it properly.
1287
1288         Test: imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
1289
1290         * xml/parser/XMLDocumentParserLibxml2.cpp:
1291         (WebCore::convertUTF16EntityToUTF8):
1292         Fix assertion that was causing the new test to crash in debug. The input '\u0026'
1293         gets converted to '&' which is only 1 character. However, the assertion wrongly
1294         expected WTF::Unicode::convertUTF16ToUTF8() to generate more than 1 character.
1295
1296         (WebCore::externalSubsetHandler):
1297         Add "-//W3C//DTD MathML 2.0//EN" to the list.
1298
1299 2016-09-19  Chris Dumez  <cdumez@apple.com>
1300
1301         Window's pageXOffset / pageYOffset attributes should be replaceable
1302         https://bugs.webkit.org/show_bug.cgi?id=162046
1303
1304         Reviewed by Darin Adler.
1305
1306         Window's pageXOffset / pageYOffset attributes should be replaceable as per:
1307         - https://drafts.csswg.org/cssom-view/#extensions-to-the-window-interface
1308
1309         Firefox agrees with the specification.
1310
1311         No new tests, rebaselined existing test.
1312
1313         * page/DOMWindow.h:
1314         * page/DOMWindow.idl:
1315
1316 2016-09-19  Commit Queue  <commit-queue@webkit.org>
1317
1318         Unreviewed, rolling out r206107.
1319         https://bugs.webkit.org/show_bug.cgi?id=162229
1320
1321         still failing on armv7 for some reason (Requested by anttik on
1322         #webkit).
1323
1324         Reverted changeset:
1325
1326         "Add size assert for RenderElement"
1327         https://bugs.webkit.org/show_bug.cgi?id=162096
1328         http://trac.webkit.org/changeset/206107
1329
1330 2016-09-19  Antti Koivisto  <antti@apple.com>
1331
1332         Add size assert for RenderElement
1333         https://bugs.webkit.org/show_bug.cgi?id=162096
1334
1335         Reviewed by Simon Fraser.
1336
1337         Also remove the unused m_visibleInViewportState field.
1338
1339         * rendering/RenderElement.cpp:
1340         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
1341         * rendering/RenderElement.h:
1342
1343 2016-09-19  Nan Wang  <n_wang@apple.com>
1344
1345         AX: Add accessibility support for details element on iOS
1346         https://bugs.webkit.org/show_bug.cgi?id=162041
1347
1348         Reviewed by Chris Fleizach.
1349
1350         The details and summary elements are poorly supported on iOS.
1351         Two major issues:
1352             1. Assistive technologies taking focus onto details/summary elements will cause unexpected behavior.
1353             2. VoiceOver is not speaking the expanded status of the details element.
1354         Fixed them by not setting focus onto elements inside details and exposing the details element's expanded
1355         status to its summary's accessible children.
1356
1357         Test: accessibility/ios-simulator/detail-summary-ios.html
1358
1359         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1360         (matchedParent):
1361         (-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
1362         (-[WebAccessibilityObjectWrapper _accessibilityLandmarkAncestor]):
1363         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
1364         (-[WebAccessibilityObjectWrapper _accessibilityFieldsetAncestor]):
1365         (-[WebAccessibilityObjectWrapper tableCellParent]):
1366         (-[WebAccessibilityObjectWrapper tableParent]):
1367         (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]):
1368         (-[WebAccessibilityObjectWrapper convertRectToScreenSpace:]):
1369         (-[WebAccessibilityObjectWrapper detailParentForSummaryObject:]):
1370         (-[WebAccessibilityObjectWrapper detailParentForObject:]):
1371         (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
1372         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
1373         (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
1374
1375 2016-09-19  Zalan Bujtas  <zalan@apple.com>
1376
1377         ASSERTION FAILED: clipRectsContext.rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType] while loading guardian.co.uk
1378         https://bugs.webkit.org/show_bug.cgi?id=162129
1379         <rdar://problem/28353350>
1380
1381         Reviewed by Antti Koivisto.
1382
1383         Neither ::localClipRect() nor ::selfClipRect() accounts for paginated context while computing the cliprects (See FIXMEs).
1384         This patch ensures that we don't end up caching these invalid cliprects.
1385
1386         Test: fast/multicol/assert-on-cliprect-caching-when-paginated.html
1387
1388         * rendering/RenderLayer.cpp:
1389         (WebCore::RenderLayer::calculateClipRects):
1390
1391 2016-09-19  Youenn Fablet  <youenn@apple.com>
1392
1393         Clean-up after r206014
1394         https://bugs.webkit.org/show_bug.cgi?id=162140
1395
1396         Reviewed by Sam Weinig.
1397
1398         Covered by existing tests.
1399
1400         * platform/network/HTTPHeaderMap.cpp:
1401         (WebCore::HTTPHeaderMap::add):
1402
1403 2016-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1404
1405         If a host object is only used as a variadic argument, its bindings header isn't properly included
1406         https://bugs.webkit.org/show_bug.cgi?id=150121
1407
1408         Reviewed by Youenn Fablet.
1409
1410         Modify JS binding generator to include binding headers of objects passed
1411         as variadic argument.
1412
1413         * Modules/mediastream/RTCPeerConnection.h: Remove workaround.
1414         * bindings/scripts/CodeGeneratorJS.pm:
1415         (AddVariadicToImplIncludes):
1416         (GenerateParametersCheck):
1417         * bindings/scripts/test/JS/JSTestObj.cpp:
1418
1419 2016-09-19  Joseph Pecoraro  <pecoraro@apple.com>
1420
1421         Web Inspector: ⇧⌘C should highlight node under cursor without re-moving mouse
1422         https://bugs.webkit.org/show_bug.cgi?id=162128
1423
1424         Reviewed by Brian Burg.
1425
1426         * inspector/InspectorDOMAgent.h:
1427         * inspector/InspectorDOMAgent.cpp:
1428         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
1429         (WebCore::InspectorDOMAgent::mouseDidMoveOverElement):
1430         (WebCore::InspectorDOMAgent::highlightMousedOverNode):
1431         (WebCore::InspectorDOMAgent::setSearchingForNode):
1432         When the inspector is connected, remember the last moused over node.
1433         This produces far more consistent results of highlighting under
1434         the cursor when pressing and releasing the keyboard shortcut keys,
1435         without having to move the mouse. Even when using the shortcut to
1436         first connect the inspector this produces far more consistent
1437         results because releasing the keys for the shortcut produce new
1438         mouseDidMoveOverElement events.
1439
1440 2016-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1441
1442         JSDOMBindings' toArguments() should return a more descriptive object
1443         https://bugs.webkit.org/show_bug.cgi?id=161793
1444
1445         Reviewed by Youenn Fablet.
1446
1447         Replace std::pair with new VariadicHelperResult class with more
1448         readable members names.
1449
1450         No additional tests required.
1451
1452         * bindings/js/JSDOMBinding.h:
1453         (WebCore::VariadicHelper::Result::Result):
1454         * bindings/scripts/CodeGeneratorJS.pm:
1455         (GenerateParametersCheck):
1456         * bindings/scripts/test/JS/JSTestObj.cpp:
1457         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
1458         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1459         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1460         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1461
1462 2016-09-18  Alex Christensen  <achristensen@webkit.org>
1463
1464         Remove unnecessary String allocations in URLParser
1465         https://bugs.webkit.org/show_bug.cgi?id=162089
1466
1467         Reviewed by Chris Dumez.
1468
1469         No change in behavior except a performance improvement.
1470
1471         * platform/URL.cpp:
1472         (WebCore::assertProtocolIsGood):
1473         (WebCore::URL::protocolIs):
1474         (WebCore::protocolIs):
1475         * platform/URL.h:
1476         Added a new protocolIs for non-null-terminated strings from user input.
1477         * platform/URLParser.cpp:
1478         (WebCore::URLParser::parse):
1479         Don't make a String to compare protocols.
1480
1481 2016-09-17  Alex Christensen  <achristensen@webkit.org>
1482
1483         Inline functions in URLParser
1484         https://bugs.webkit.org/show_bug.cgi?id=162106
1485
1486         Reviewed by Antti Koivisto.
1487
1488         No change in behavior. Just make URLParser faster.
1489
1490         * platform/URLParser.cpp:
1491         (WebCore::isC0Control):
1492         (WebCore::isC0ControlOrSpace):
1493         (WebCore::isTabOrNewline):
1494         (WebCore::isInSimpleEncodeSet):
1495         (WebCore::isInDefaultEncodeSet):
1496         (WebCore::isInUserInfoEncodeSet):
1497         (WebCore::isInvalidDomainCharacter):
1498         (WebCore::isPercentOrNonASCII):
1499         (WebCore::isSlashQuestionOrHash):
1500         (WebCore::isWindowsDriveLetter):
1501         (WebCore::shouldCopyFileURL):
1502         (WebCore::percentEncode):
1503         (WebCore::utf8PercentEncode):
1504         (WebCore::utf8PercentEncodeQuery):
1505         (WebCore::encodeQuery):
1506         (WebCore::isDefaultPort):
1507         (WebCore::isSpecialScheme):
1508         (WebCore::copyASCIIStringUntil):
1509         (WebCore::isPercentEncodedDot):
1510         (WebCore::isSingleDotPathSegment):
1511         (WebCore::isDoubleDotPathSegment):
1512         (WebCore::consumeSingleDotPathSegment):
1513         (WebCore::consumeDoubleDotPathSegment):
1514         (WebCore::serializeIPv4):
1515         (WebCore::zeroSequenceLength):
1516         (WebCore::findLongestZeroSequence):
1517         (WebCore::serializeIPv6Piece):
1518         (WebCore::serializeIPv6):
1519         (WebCore::parseIPv4Number):
1520         (WebCore::pow256):
1521         (WebCore::parseIPv4Host):
1522         (WebCore::parseIPv6Host):
1523         (WebCore::percentDecode):
1524         (WebCore::containsOnlyASCII):
1525         (WebCore::domainToASCII):
1526         (WebCore::hasInvalidDomainCharacter):
1527         (WebCore::formURLDecode):
1528         (WebCore::serializeURLEncodedForm):
1529
1530 2016-09-17  David Kilzer  <ddkilzer@apple.com>
1531
1532         MainThreadBridge needs an isolatedCopy() of SecurityOrigin
1533         <https://webkit.org/b/162116>
1534         <rdar://problem/27525870>
1535
1536         Reviewed by Carlos Garcia Campos.
1537
1538         Covered by existing tests.
1539
1540         * loader/WorkerThreadableLoader.cpp:
1541         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1542         Make an isolatedCopy() of SecurityOrigin here since that's the
1543         correct idiom to use when the object is passed from a worker
1544         thread back to the main thread.  Fix suggested by Daniel Bates.
1545
1546 2016-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1547
1548         [DFG] Introduce IsCellWithType node and unify IsJSArray, IsRegExpObject and newly added IsProxyObject
1549         https://bugs.webkit.org/show_bug.cgi?id=162000
1550
1551         Reviewed by Filip Pizlo.
1552
1553         * bridge/runtime_array.h:
1554         (JSC::RuntimeArray::createStructure):
1555
1556 2016-09-16  Chris Dumez  <cdumez@apple.com>
1557
1558         Cancelling one frame's load cancels load in other frames that have the same URL as well
1559         https://bugs.webkit.org/show_bug.cgi?id=162094
1560
1561         Reviewed by Antti Koivisto.
1562
1563         Cancelling one frame's load cancels load in other frames that have the same URL as well.
1564
1565         So if you have several frames that are loading URL X and you navigate one of the frames
1566         to Y, then the load of X will be cancelled and this frame will navigate to Y. All other
1567         frames will not load URL X even though they should.
1568
1569         The issue is that all the DocumentLoaders share the same CachedResource because of the
1570         memoryCache. When we call DocumentLoader::stopLoading(), it will cancel the
1571         CachedResource's load even though there are several clients for this CachedResource
1572         and other clients still want the load.
1573
1574         The approach chosen in this patch is to not reuse CachedResources that are still
1575         loading when trying to load a main resource. This is not the most efficient approach.
1576         I still chose this approach because:
1577         - It is very unlikely to introduce new bugs.
1578         - The change is very simple.
1579         - This is a corner case (several iframes having the same URL and cancelling the load in
1580           one of them).
1581
1582         Test: http/tests/navigation/frames-same-url-cancel-load.html
1583
1584         * loader/cache/CachedResourceLoader.cpp:
1585         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
1586
1587 2016-09-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1588
1589         ASSERTION FAILED: The string being removed is atomic in the string table of an other thread! iterator != atomicStringTable.end() at Source/WTF/wtf/text/AtomicStringImpl.cpp(453)
1590         https://bugs.webkit.org/show_bug.cgi?id=161800
1591
1592         Reviewed by Žan Doberšek.
1593
1594         Speculative fix. These strings are created as static objects on a secondary thread, but all
1595         static objects are destroyed in exit handlers on the main thread, and AtomicStrings must
1596         always be destroyed on the same thread they are created.
1597
1598         * platform/graphics/texmap/TextureMapperShaderProgram.h:
1599
1600 2016-09-16  Commit Queue  <commit-queue@webkit.org>
1601
1602         Unreviewed, rolling out r206055.
1603         https://bugs.webkit.org/show_bug.cgi?id=162110
1604
1605         broke 32bit ARM build (Requested by anttik on #webkit).
1606
1607         Reverted changeset:
1608
1609         "Add size assert for RenderElement"
1610         https://bugs.webkit.org/show_bug.cgi?id=162096
1611         http://trac.webkit.org/changeset/206055
1612
1613 2016-09-16  Brent Fulgham  <bfulgham@apple.com>
1614
1615         [Win][Direct2D] Provide Color support for Direct2D
1616         https://bugs.webkit.org/show_bug.cgi?id=162090
1617
1618         Reviewed by Dean Jackson.
1619
1620         Add casting operations to the Color class to allow easy interoption with
1621         native Direct2D operations.
1622
1623         No new tests. No change in behavior.
1624
1625         * PlatformWin.cmake: Add new Windows implementation file.
1626         * platform/graphics/Color.h:
1627         * platform/graphics/win/ColorDirect2D.cpp: Added.
1628         (WebCore::Color::Color):
1629         (WebCore::Color::operator D2D1_COLOR_F):
1630
1631 2016-09-16  Antti Koivisto  <antti@apple.com>
1632
1633         Add size assert for RenderElement
1634         https://bugs.webkit.org/show_bug.cgi?id=162096
1635
1636         Reviewed by Simon Fraser.
1637
1638         Also remove the unused m_visibleInViewportState field.
1639
1640         * rendering/RenderElement.cpp:
1641         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
1642         * rendering/RenderElement.h:
1643
1644 2016-09-16  Antti Koivisto  <antti@apple.com>
1645
1646         Tighten region style map to use RenderElement instead of RenderObject
1647         https://bugs.webkit.org/show_bug.cgi?id=162064
1648
1649         Reviewed by Zalan Bujtas.
1650
1651         RenderTexts don't have styles of their own so the map can operate on RenderElements.
1652
1653         * rendering/RenderElement.cpp:
1654         (WebCore::RenderElement::willBeRemovedFromTree):
1655         (WebCore::RenderElement::removeFromRenderFlowThread):
1656         (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
1657         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants):
1658         * rendering/RenderElement.h:
1659         * rendering/RenderFlowThread.cpp:
1660         (WebCore::RenderFlowThread::removeFlowChildInfo):
1661         * rendering/RenderFlowThread.h:
1662         * rendering/RenderNamedFlowFragment.cpp:
1663         (WebCore::RenderNamedFlowFragment::computeChildrenStyleInRegion):
1664         (WebCore::RenderNamedFlowFragment::setRendererStyleInRegion):
1665         (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
1666         (WebCore::RenderNamedFlowFragment::setRegionObjectsRegionStyle):
1667         (WebCore::RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle):
1668         (WebCore::RenderNamedFlowFragment::setObjectStyleInRegion): Deleted.
1669         * rendering/RenderNamedFlowFragment.h:
1670         * rendering/RenderNamedFlowThread.cpp:
1671         (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
1672         (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
1673         * rendering/RenderNamedFlowThread.h:
1674         * rendering/RenderObject.cpp:
1675         (WebCore::RenderObject::willBeRemovedFromTree):
1676         (WebCore::RenderObject::removeFromRenderFlowThread): Deleted.
1677         (WebCore::RenderObject::removeFromRenderFlowThreadIncludingDescendants): Deleted.
1678         (WebCore::RenderObject::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
1679
1680             These can now move to RenderElement.
1681
1682         * rendering/RenderObject.h:
1683
1684 2016-09-16  Brent Fulgham  <bfulgham@apple.com>
1685
1686         CaptionUserPreferences's use of the PageGroup's page map is incorrect
1687         https://bugs.webkit.org/show_bug.cgi?id=122194
1688         <rdar://problem/27332004>
1689
1690         Reviewed by Zalan Bujtas.
1691
1692         Avoid the possibility of dereferencing an unsafe iterator by checking
1693         for an empty HashSet before using the result of 'begin()'.
1694
1695         No new tests because there is no change in behavior.
1696
1697         * page/CaptionUserPreferences.cpp:
1698         (WebCore::CaptionUserPreferences::CaptionUserPreferences): Use new safer
1699         accessor to retrieve the current page.
1700         (WebCore::CaptionUserPreferences::setCaptionDisplayMode): Ditto.
1701         (WebCore::CaptionUserPreferences::currentPage): Added.
1702         (WebCore::CaptionUserPreferences::userPrefersCaptions): Use new safer
1703         accessor to retrieve the current page.
1704         (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto.
1705         (WebCore::CaptionUserPreferences::userPrefersSubtitles): Ditto.
1706         (WebCore::CaptionUserPreferences::setUserPrefersSubtitles): Ditto.
1707         (WebCore::CaptionUserPreferences::userPrefersTextDescriptions): Ditto.
1708         (WebCore::CaptionUserPreferences::setUserPrefersTextDescriptions): Ditto.
1709         * page/CaptionUserPreferences.h:
1710
1711 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1712
1713         Use Vector<LChar> instead of StringBuilder for the ASCII parts of URLParser
1714         https://bugs.webkit.org/show_bug.cgi?id=162035
1715
1716         Reviewed by Chris Dumez.
1717
1718         StringBuilder::append checks to see whether its StringBuffer is 8-bit or 16-bit each time it is called.
1719         When parsing URLs, almost all of the parsed URL is guaranteed to be 8-bit ASCII.
1720         Using a Vector<LChar> for this allows us to use uncheckedAppend in some places, and it always eliminates the 8-bit check.
1721         This is a ~20% speedup in url parsing.
1722
1723         Covered by existing API tests.
1724
1725         * platform/URLParser.cpp:
1726         (WebCore::isWindowsDriveLetter):
1727         (WebCore::percentEncode):
1728         (WebCore::utf8PercentEncode):
1729         (WebCore::utf8PercentEncodeQuery):
1730         (WebCore::encodeQuery):
1731         (WebCore::URLParser::copyURLPartsUntil):
1732         (WebCore::URLParser::popPath):
1733         (WebCore::URLParser::parse):
1734         (WebCore::URLParser::parseAuthority):
1735         (WebCore::appendNumber):
1736         (WebCore::serializeIPv4):
1737         (WebCore::serializeIPv6Piece):
1738         (WebCore::serializeIPv6):
1739         (WebCore::URLParser::parsePort):
1740         (WebCore::URLParser::parseHost):
1741         (WebCore::serializeURLEncodedForm):
1742         (WebCore::URLParser::serialize):
1743         (WebCore::bufferView): Deleted.
1744         * platform/URLParser.h:
1745
1746 2016-09-16  Dave Hyatt  <hyatt@apple.com>
1747
1748         [CSS Parser] Get CSSPropertyParserHelpers.cpp compiling
1749         https://bugs.webkit.org/show_bug.cgi?id=162078
1750
1751         Reviewed by Dean Jackson.
1752
1753         * css/CSSCalculationValue.cpp:
1754         (WebCore::hasDoubleValue):
1755         (WebCore::checkDepthAndIndex):
1756         (WebCore::CSSCalcExpressionNodeParser::parseCalc):
1757         (WebCore::CSSCalcExpressionNodeParser::operatorValue):
1758         (WebCore::CSSCalcExpressionNodeParser::parseValue):
1759         (WebCore::CSSCalcExpressionNodeParser::parseValueTerm):
1760         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
1761         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
1762         (WebCore::CSSCalcExpressionNodeParser::parseValueExpression):
1763         (WebCore::checkDepthAndIndexDeprecated):
1764         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueTerm):
1765         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueMultiplicativeExpression):
1766         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseAdditiveValueExpression):
1767         (WebCore::CSSCalcValue::create):
1768         * css/CSSCalculationValue.h:
1769         (WebCore::CSSCalcValue::createCalculationValue):
1770         (WebCore::CSSCalcValue::setPermittedValueRange):
1771         Switch off the permitted calc value range enum, since we can just use the identical ValueRange enum.
1772         Deprecate the CSSParserValueList-based parser by renaming it, and add a new parser that operates
1773         on tokens.
1774
1775         * css/CSSPrimitiveValue.cpp:
1776         (WebCore::isValidCSSUnitTypeForDoubleConversion):
1777         (WebCore::isStringType):
1778         (WebCore::CSSPrimitiveValue::cleanup):
1779         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
1780         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
1781         (WebCore::CSSPrimitiveValue::cloneForCSSOM):
1782         (WebCore::CSSPrimitiveValue::equals):
1783         (WebCore::CSSPrimitiveValue::buildParserValue):
1784         * css/CSSPrimitiveValue.h:
1785         Add support for CSS_QUIRKY_EMS as a unit type. This will let us eliminate the extra m_isQuirkValue boolean
1786         eventually.
1787
1788         * css/parser/CSSParser.cpp:
1789         (WebCore::CSSParser::validateCalculationUnit):
1790         (WebCore::CSSParser::parseCalculation):
1791         * css/parser/CSSParser.h:
1792         Switch to ValueRange.
1793
1794         * css/parser/CSSParserIdioms.cpp:
1795         (WebCore::completeURL):
1796         * css/parser/CSSParserIdioms.h:
1797         Make the URL completion function from CSSParser.cpp available to all.
1798
1799         * css/parser/CSSParserMode.h:
1800         (WebCore::isUnitLessValueParsingEnabledForMode):
1801         (WebCore::isUnitLessLengthParsingEnabledForMode): Deleted.
1802         Rename this to value, since for now we're not supporting Blink's UserUnits. This means we need to support
1803         unitless parsing for times and angles in addition to lengths, making the name of the function inappropriate.
1804
1805         * css/parser/CSSParserToken.cpp:
1806         (WebCore::cssPrimitiveValueUnitFromTrie):
1807         Turn quirky ems support back on.
1808
1809         * css/parser/CSSParserValues.cpp:
1810         (WebCore::CSSParserValue::createCSSValue):
1811         Support quirky ems.
1812
1813         * css/parser/CSSPropertyParserHelpers.cpp:
1814         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
1815         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
1816         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1817         (WebCore::CSSPropertyParserHelpers::consumePositiveInteger):
1818         (WebCore::CSSPropertyParserHelpers::consumeNumber):
1819         (WebCore::CSSPropertyParserHelpers::shouldAcceptUnitlessValue):
1820         (WebCore::CSSPropertyParserHelpers::consumeLength):
1821         (WebCore::CSSPropertyParserHelpers::consumePercent):
1822         (WebCore::CSSPropertyParserHelpers::canConsumeCalcValue):
1823         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
1824         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1825         (WebCore::CSSPropertyParserHelpers::consumeTime):
1826         (WebCore::CSSPropertyParserHelpers::consumeIdent):
1827         (WebCore::CSSPropertyParserHelpers::consumeIdentRange):
1828         (WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
1829         (WebCore::CSSPropertyParserHelpers::consumeString):
1830         (WebCore::CSSPropertyParserHelpers::consumeUrl):
1831         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
1832         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
1833         (WebCore::CSSPropertyParserHelpers::consumeColor):
1834         (WebCore::CSSPropertyParserHelpers::consumePositionComponent):
1835         (WebCore::CSSPropertyParserHelpers::positionFromOneValue):
1836         (WebCore::CSSPropertyParserHelpers::positionFromTwoValues):
1837         (WebCore::CSSPropertyParserHelpers::createPrimitiveValuePair):
1838         (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues):
1839         (WebCore::CSSPropertyParserHelpers::consumePosition):
1840         (WebCore::CSSPropertyParserHelpers::consumeOneOrTwoValuedPosition):
1841         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
1842         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientStopColor):
1843         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1844         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
1845         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
1846         (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
1847         (WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
1848         (WebCore::CSSPropertyParserHelpers::consumeImageOrNone):
1849         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1850         (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
1851         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
1852         (WebCore::CSSPropertyParserHelpers::consumeImage):
1853         * css/parser/CSSPropertyParserHelpers.h:
1854         (WebCore::CSSPropertyParserHelpers::isCSSWideKeyword):
1855         Lots of changes here. The most important is switching over to RefPtrs and Refs where appropriate, with the
1856         requisite WTFMoves. Unit types also have to be converted back to our values, and unitless parsing has
1857         to work with consumeTime and consumeAngle.
1858
1859         * platform/CalculationValue.cpp:
1860         (WebCore::CalculationValue::create):
1861         * platform/CalculationValue.h:
1862         (WebCore::CalculationValue::CalculationValue):
1863         Use ValueRange.
1864
1865         * platform/graphics/Color.cpp:
1866         (WebCore::Color::parseHexColor):
1867         (WebCore::Color::Color):
1868         * platform/graphics/Color.h:
1869         Add a StringView-based parseHexColor function.
1870
1871         * rendering/style/BasicShapes.cpp:
1872         (WebCore::BasicShapeCenterCoordinate::updateComputedLength):
1873         Use ValueRange
1874
1875 2016-09-16  Jer Noble  <jer.noble@apple.com>
1876
1877         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
1878         https://bugs.webkit.org/show_bug.cgi?id=162052
1879
1880         Reviewed by Brent Fulgham.
1881
1882         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
1883                      imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html
1884
1885         The above tests would throw an assertion while trying to invert a range with an invalid end time. Check the
1886         validity of trackBuffer.lastEnqueuedPresentationTime before comparing it and assigning it to a range.
1887
1888         * Modules/mediasource/SourceBuffer.cpp:
1889         (WebCore::SourceBuffer::removeCodedFrames):
1890
1891 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1892
1893         URLParser should percent encode the user and password according to spec
1894         https://bugs.webkit.org/show_bug.cgi?id=162049
1895
1896         Reviewed by Tim Horton.
1897
1898         Covered by new API tests based on the web platform tests.
1899
1900         * platform/URLParser.cpp:
1901         (WebCore::URLParser::parseAuthority):
1902
1903 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1904
1905         Fix more edge cases in URLParser
1906         https://bugs.webkit.org/show_bug.cgi?id=162051
1907
1908         Reviewed by Tim Horton.
1909
1910         Added new API tests.
1911
1912         * platform/URLParser.cpp:
1913         (WebCore::URLParser::parse):
1914         Some edge case handling was wrong. Also, some of the terminal states are not possible
1915         to reach because we transition to those states without incrementing the iterator.
1916
1917 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1918
1919         Fix Windows clean build after r205929
1920
1921         * DerivedSources.cpp:
1922
1923 2016-09-16  Jer Noble  <jer.noble@apple.com>
1924
1925         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-timestamp-offset.html
1926         https://bugs.webkit.org/show_bug.cgi?id=162038
1927
1928         Reviewed by Eric Carlson.
1929
1930         The timestampOffset property is no longer specified as an 'unrestricted' double.
1931
1932         * Modules/mediasource/SourceBuffer.idl:
1933
1934 2016-09-16  Per Arne Vollan  <pvollan@apple.com>
1935
1936         [Win] Compile fix.
1937         https://bugs.webkit.org/show_bug.cgi?id=162059
1938
1939         Reviewed by Alex Christensen.
1940
1941         If an include file exists in two places in the include paths, we can end up including the file twice,
1942         since #pragma once will not protect us against this.
1943
1944         * PlatformWin.cmake: Put WebCore forwarding folder first in include list.
1945
1946 2016-09-16  Chris Dumez  <cdumez@apple.com>
1947
1948         Cloning a textarea does not clone the textarea's value
1949         https://bugs.webkit.org/show_bug.cgi?id=156637
1950
1951         Reviewed by Ryosuke Niwa.
1952
1953         Update WebKit so that cloning a textarea element also clones its value.
1954         This matches the HTML specification after:
1955         - https://github.com/whatwg/html/pull/1784
1956
1957         The new behavior also matches Chrome and Edge.
1958
1959         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html
1960
1961         * html/HTMLInputElement.cpp:
1962         (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
1963         * html/HTMLTextAreaElement.cpp:
1964         (WebCore::HTMLTextAreaElement::copyNonAttributePropertiesFromElement):
1965         * html/HTMLTextAreaElement.h:
1966
1967 2016-09-16  Jer Noble  <jer.noble@apple.com>
1968
1969         [media-source] Only fire 'resize' events when new sized frame is displayed, not parsed.
1970         https://bugs.webkit.org/show_bug.cgi?id=162039
1971
1972         Reviewed by Eric Carlson.
1973
1974         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html
1975                      imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize.html
1976
1977         Currently, the SourceBufferPrivateAVFObjC will signal a size change as soon as the sample is
1978         parsed during appendData(). This is incorrect, as the intrinsic size of the video element
1979         should be based on when the sample is displayed, and it causes some W3C test cases to fail.
1980         Set a boundary time observer on the player's synchronizer at each sample's presentation time
1981         where that sample signals a change in intrinsic size. Flush those observers whenever the
1982         samples are flushed un-displayed (typically, during a seek). Because the observer callback
1983         may have already been issued (but not executed) at a flush, use a separate weak pointer
1984         factory, and invalidate all outstanding size change observer weak pointers when flushing.
1985
1986         * Modules/mediasource/SourceBuffer.cpp:
1987         (WebCore::SourceBuffer::reenqueueMediaForTime): When re-enqueing, enqueue the next decodable
1988             sample, even if it doesn't include the current time. This handles cases where the current
1989             time is 0, and the first video sample starts at 0.033.
1990         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1991         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1992         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1993         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
1994         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::naturalSize):
1995         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
1996         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::flushPendingSizeChanges):
1997         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeChanged): Deleted.
1998         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1999         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2000         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
2001         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
2002         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2003
2004 2016-09-16  Alex Christensen  <achristensen@webkit.org>
2005
2006         Fix Windows clean build after r205929
2007
2008         * DerivedSources.cpp:
2009
2010 2016-09-16  Jer Noble  <jer.noble@apple.com>
2011
2012         [media-source] ASAN crash running imported/w3c/web-platform-tests/media-source/mediasource-remove.html
2013         https://bugs.webkit.org/show_bug.cgi?id=162050
2014
2015         Reviewed by Brent Fulgham.
2016
2017         SampleMap::removeSample() was accessing the passed-in sample after removing it from its own storage. If
2018         the SampleMap held the last reference to the sample, it would end up acessing freed memory. Fix the
2019         post-removal access, but also ensure that the caller, SourceBuffer::removeCodedFrames(), retains the
2020         sample it passes into removeSample().
2021
2022         * Modules/mediasource/SampleMap.cpp:
2023         (WebCore::SampleMap::removeSample):
2024         * Modules/mediasource/SourceBuffer.cpp:
2025         (WebCore::SourceBuffer::removeCodedFrames):
2026
2027 2016-09-16  Javier Fernandez  <jfernandez@igalia.com>
2028
2029         [GTK] Unreviewed build fix after r206007.
2030         https://bugs.webkit.org/show_bug.cgi?id=162058
2031
2032         * css/parser/CSSParserFastPaths.cpp:
2033         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2034
2035 2016-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2036
2037         [TextureMapper] Scrolling through 01.org/dleyna crashes WebKitWebProcess
2038         https://bugs.webkit.org/show_bug.cgi?id=162020
2039
2040         Reviewed by Žan Doberšek.
2041
2042         The problem is that we are trying to clone a ReferenceFilterOperation, which is not expected to be cloned, from
2043         FilterAnimationValue copy constructor, and FilterOperations are never expected to be nullptr, so we end up
2044         crashing. We just need to validate the filters before setting then and before creating a TextureMapperAnimation
2045         for them.
2046
2047         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2048         (WebCore::GraphicsLayerTextureMapper::filtersCanBeComposited): Return false if there are reference filters or no
2049         filters at all. I don't know if we really support other filters, but at least we won't crash for the others.
2050         (WebCore::GraphicsLayerTextureMapper::addAnimation): Check if filters can be composited before creating a
2051         TextureMapperAnimation.
2052         (WebCore::GraphicsLayerTextureMapper::setFilters): Check if filters can be composited before setting them.
2053         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2054         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2055         (WebCore::CoordinatedGraphicsLayer::filtersCanBeComposited): Return false if there are reference filters or no
2056         filters at all. I don't know if we really support other filters, but at least we won't crash for the others.
2057         (WebCore::CoordinatedGraphicsLayer::setFilters): Check if filters can be composited before setting them.
2058         (WebCore::CoordinatedGraphicsLayer::addAnimation): Check if filters can be composited before creating a
2059         TextureMapperAnimation.
2060         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2061
2062 2016-09-16  Youenn Fablet  <youenn@apple.com>
2063
2064         CachedFont do not need to be updated according Origin/Fetch mode
2065         https://bugs.webkit.org/show_bug.cgi?id=161909
2066
2067         Reviewed by Sam Weinig.
2068
2069         No change of behavior.
2070
2071         * loader/cache/CachedFont.h: Ensuring CachedFont is not reused.
2072         * loader/cache/CachedResourceLoader.cpp:
2073         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Doing direct reuse for CachedFont as WebKit is ignoring CORS for all fonts related stuff.
2074
2075 2016-09-16  Youenn Fablet  <youenn@apple.com>
2076
2077         CachedResource should efficiently construct its ResourceRequest
2078         https://bugs.webkit.org/show_bug.cgi?id=161609
2079
2080         Reviewed by Sam Weinig.
2081
2082         Covered by existing tests.
2083
2084         Making CachedResourceLoader take a CachedResourceRequest&& when being asked to load resources.
2085         Making CachedResource et al take a CachedResourceRequest&& as constructor parameter.
2086
2087         CachedResource now sets its options at construction time instead of load time.
2088         This may change some specific behaviors, for instance when loading manually images.
2089
2090         Made some refactoring when both the resource and request are needed, for ResourceTimingInformation.
2091         Made local copies of some CachedResourceRequest fields so that we do not need it after being WTFMoved.
2092         Some of these properties may be put outside CachedResourceRequest in a later refactoring step.
2093
2094         * css/CSSFontFaceSrcValue.cpp:
2095         (WebCore::CSSFontFaceSrcValue::cachedFont):
2096         * css/CSSImageSetValue.cpp:
2097         (WebCore::CSSImageSetValue::loadBestFitImage):
2098         * css/CSSImageValue.cpp:
2099         (WebCore::CSSImageValue::loadImage):
2100         * css/StyleRuleImport.cpp:
2101         (WebCore::StyleRuleImport::requestStyleSheet):
2102         * dom/ProcessingInstruction.cpp:
2103         (WebCore::ProcessingInstruction::checkStyleSheet):
2104         * dom/ScriptElement.cpp:
2105         (WebCore::ScriptElement::requestScriptWithCache):
2106         * html/HTMLLinkElement.cpp:
2107         (WebCore::HTMLLinkElement::process):
2108         * html/parser/HTMLResourcePreloader.cpp:
2109         (WebCore::HTMLResourcePreloader::preload):
2110         * loader/CrossOriginPreflightChecker.cpp:
2111         (WebCore::CrossOriginPreflightChecker::startPreflight):
2112         * loader/DocumentLoader.cpp:
2113         (WebCore::DocumentLoader::startLoadingMainResource):
2114         * loader/DocumentThreadableLoader.cpp:
2115         (WebCore::DocumentThreadableLoader::loadRequest):
2116         * loader/ImageLoader.cpp:
2117         (WebCore::ImageLoader::updateFromElement):
2118         * loader/LinkLoader.cpp:
2119         (WebCore::LinkLoader::preloadIfNeeded):
2120         (WebCore::LinkLoader::loadLink):
2121         * loader/MediaResourceLoader.cpp:
2122         (WebCore::MediaResourceLoader::requestResource):
2123         * loader/ResourceTimingInformation.cpp:
2124         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
2125         * loader/ResourceTimingInformation.h:
2126         * loader/TextTrackLoader.cpp:
2127         (WebCore::TextTrackLoader::load):
2128         * loader/cache/CachedCSSStyleSheet.cpp:
2129         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
2130         * loader/cache/CachedCSSStyleSheet.h:
2131         * loader/cache/CachedFont.cpp:
2132         (WebCore::CachedFont::CachedFont):
2133         (WebCore::CachedFont::load):
2134         (WebCore::CachedFont::beginLoadIfNeeded):
2135         * loader/cache/CachedFont.h:
2136         * loader/cache/CachedImage.cpp:
2137         (WebCore::CachedImage::CachedImage):
2138         (WebCore::CachedImage::load):
2139         * loader/cache/CachedImage.h:
2140         * loader/cache/CachedRawResource.cpp:
2141         (WebCore::CachedRawResource::CachedRawResource):
2142         * loader/cache/CachedRawResource.h:
2143         * loader/cache/CachedResource.cpp:
2144         (WebCore::CachedResource::CachedResource):
2145         (WebCore::CachedResource::load):
2146         (WebCore::CachedResource::loadFrom):
2147         * loader/cache/CachedResource.h:
2148         (WebCore::CachedResource::resourceRequest):
2149         * loader/cache/CachedResourceLoader.cpp:
2150         (WebCore::createResource):
2151         (WebCore::CachedResourceLoader::requestImage):
2152         (WebCore::CachedResourceLoader::requestFont):
2153         (WebCore::CachedResourceLoader::requestTextTrack):
2154         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2155         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2156         (WebCore::CachedResourceLoader::requestScript):
2157         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2158         (WebCore::CachedResourceLoader::requestSVGDocument):
2159         (WebCore::CachedResourceLoader::requestLinkResource):
2160         (WebCore::CachedResourceLoader::requestMedia):
2161         (WebCore::CachedResourceLoader::requestRawResource):
2162         (WebCore::CachedResourceLoader::requestMainResource):
2163         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2164         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
2165         (WebCore::CachedResourceLoader::requestResource):
2166         (WebCore::CachedResourceLoader::revalidateResource):
2167         (WebCore::CachedResourceLoader::loadResource):
2168         (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
2169         (WebCore::CachedResourceLoader::preload):
2170         (WebCore::CachedResourceLoader::checkForPendingPreloads):
2171         (WebCore::CachedResourceLoader::requestPreload):
2172         * loader/cache/CachedResourceLoader.h:
2173         * loader/cache/CachedSVGDocument.cpp:
2174         (WebCore::CachedSVGDocument::CachedSVGDocument):
2175         * loader/cache/CachedSVGDocument.h:
2176         * loader/cache/CachedSVGDocumentReference.cpp:
2177         (WebCore::CachedSVGDocumentReference::load):
2178         * loader/cache/CachedSVGFont.cpp:
2179         (WebCore::CachedSVGFont::CachedSVGFont):
2180         * loader/cache/CachedSVGFont.h:
2181         * loader/cache/CachedScript.cpp:
2182         (WebCore::CachedScript::CachedScript):
2183         * loader/cache/CachedScript.h:
2184         * loader/cache/CachedTextTrack.cpp:
2185         (WebCore::CachedTextTrack::CachedTextTrack):
2186         * loader/cache/CachedTextTrack.h:
2187         * loader/cache/CachedXSLStyleSheet.cpp:
2188         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
2189         (WebCore::CachedXSLStyleSheet::didAddClient):
2190         * loader/cache/CachedXSLStyleSheet.h:
2191         * loader/icon/IconLoader.cpp:
2192         (WebCore::IconLoader::startLoading):
2193         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2194         (WebCore::WebCoreAVCFResourceLoader::startLoading):
2195         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2196         (WebCore::WebCoreAVFResourceLoader::startLoading):
2197         * svg/SVGFEImageElement.cpp:
2198         (WebCore::SVGFEImageElement::requestImageResource):
2199         * svg/SVGFontFaceUriElement.cpp:
2200         (WebCore::SVGFontFaceUriElement::loadFont):
2201         * svg/SVGUseElement.cpp:
2202         (WebCore::SVGUseElement::updateExternalDocument):
2203         * xml/XSLImportRule.cpp:
2204         (WebCore::XSLImportRule::loadSheet):
2205
2206 2016-09-16  Youenn Fablet  <youenn@apple.com>
2207
2208         [Fetch API] Headers should be combine with ',' and not ', '
2209         https://bugs.webkit.org/show_bug.cgi?id=161736
2210
2211         Reviewed by Sam Weinig.
2212
2213         Covered by updated tests and http/tests/xmlhttprequest/check-combining-headers.html.
2214
2215         * loader/CrossOriginAccessControl.cpp:
2216         (WebCore::createAccessControlPreflightRequest): Combining with ',' for Access-Control-Request-Headers
2217         * platform/network/HTTPHeaderMap.cpp:
2218         (HTTPHeaderMap::add): Combining with ','
2219
2220 2016-09-16  Youenn Fablet  <youenn@apple.com>
2221
2222         Custom promise-returning functions should not throw if callee has not the expected type
2223         https://bugs.webkit.org/show_bug.cgi?id=162011
2224
2225         Reviewed by Sam Weinig.
2226
2227         Covered by added test.
2228
2229         Updating code generator to handle this case.
2230         Cleaning related getUserMedia implementation.
2231
2232         * CMakeLists.txt: Removing Modules/mediastream/MediaDevices.js.
2233         * DerivedSources.make: Removing Modules/mediastream/MediaDevices.js.
2234         * Modules/mediastream/MediaDevices.idl: Cleaning IDL definition
2235         * Modules/mediastream/MediaDevices.js: Removing error throwing and so removing file.
2236         * Modules/mediastream/NavigatorUserMedia.js: getUsermMediaFromJS to getUserMedia.
2237         * WebCore.xcodeproj/project.pbxproj: Removing Modules/mediastream/MediaDevices.js.
2238         * bindings/js/JSDOMPromise.cpp:
2239         (WebCore::createRejectedPromiseWithTypeError): Helper routine.
2240         * bindings/js/JSDOMPromise.h:
2241         * bindings/js/WebCoreBuiltinNames.h: getUsermMediaFromJS to getUserMedia.
2242         * bindings/scripts/CodeGeneratorJS.pm:
2243         (GenerateImplementation): Rejecting promise in case of failing castedThis, but only for custom functions since
2244         they are handled differently for non custom methods.
2245         (GenerateFunctionCastedThis):
2246         * bindings/scripts/test/JS/JSTestObj.cpp:
2247         * bindings/scripts/test/JS/JSTestObj.h:
2248         * bindings/scripts/test/TestObj.idl: Adding custom promise test.
2249
2250 2016-09-16  Youenn Fablet  <youenn@apple.com>
2251
2252         Link loader should use FetchOptions::mode according its crossOrigin attribute
2253         https://bugs.webkit.org/show_bug.cgi?id=161859
2254
2255         Reviewed by Sam Weinig.
2256
2257         Tests: http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html
2258                http/tests/security/cached-cross-origin-preloading-css-stylesheet.html
2259
2260         Setting fetch mode according crossorigin attribute for link preload elements.
2261         This allows calling onerror callback for CORS failures, which was not the case before the patch.
2262
2263         Making cached CSS stylesheet reusable accross origins and fetch modes.
2264
2265         * loader/LinkLoader.cpp:
2266         (WebCore::LinkLoader::preloadIfNeeded): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode.
2267         * loader/cache/CachedCSSStyleSheet.cpp:
2268         (WebCore::CachedCSSStyleSheet::sheetText): clean-up.
2269         (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Implementing data init for cached css stylesheets.
2270         * loader/cache/CachedCSSStyleSheet.h:
2271         * loader/cache/CachedResourceLoader.cpp:
2272         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Activating update support for stylesheets.
2273         (WebCore::CachedResourceLoader::requestResource): Fixing for matching cached resources that need being reloaded due to different origin/fetch mode.
2274
2275 2016-09-16  Youenn Fablet  <youenn@apple.com>
2276
2277         [Fetch API] Referrer and Origin header should not be considered as safe request headers
2278         https://bugs.webkit.org/show_bug.cgi?id=161902
2279
2280         Reviewed by Sam Weinig.
2281
2282         Test: http/tests/fetch/fetch-cors-with-referrer.html and updated WPT tests.
2283
2284         Removing Origin and Referrer from safe request headers.
2285         Making referrer header setting after preflight for fetch API code path.
2286
2287         Ensuring that no ThreadableLoader client sets Origin or Referrer headers of the ResourceRequest, as they should use the proper mechanisms for that.
2288
2289         Handling no-referrer referrer special value by setting the referrer-policy to NoReferrer in FetchLoader.
2290
2291         * Modules/fetch/FetchLoader.cpp:
2292         (WebCore::FetchLoader::start): Computing referrer value and handling special "client"and "no-referrer" cases.
2293         Passing the value directly to ThreadableLoader.
2294         * Modules/fetch/FetchRequest.cpp:
2295         (WebCore::FetchRequest::internalRequest): Removing setting of ResourceRequest referrer header.
2296         (WebCore::FetchRequest::clone): Removing obsolete FIXME.
2297         * Modules/fetch/FetchRequest.h:
2298         * loader/CrossOriginAccessControl.cpp:
2299         (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Removing Origin and Referrer headers.
2300         * loader/DocumentThreadableLoader.cpp:
2301         (WebCore::DocumentThreadableLoader::create): Updated to take a referrer as parameter.
2302         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto.
2303         * loader/DocumentThreadableLoader.h: Ditto.
2304         * loader/ThreadableLoader.cpp: Ditto.
2305         (WebCore::ThreadableLoader::create): Ditto.
2306         * loader/ThreadableLoader.h: Ditto.
2307         * loader/WorkerThreadableLoader.cpp: Ditto.
2308         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader): Ditto.
2309         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
2310         * loader/WorkerThreadableLoader.h: Ditto.
2311         (WebCore::WorkerThreadableLoader::create): Ditto.
2312         * platform/network/ResourceRequestBase.cpp:
2313         (WebCore::ResourceRequestBase::hasHTTPReferrer): Added to enable asserting that no threadable loader client sets the referrer in the request.
2314         * platform/network/ResourceRequestBase.h:
2315
2316 2016-09-15  Dave Hyatt  <hyatt@apple.com>
2317
2318         [CSS Parser] Get CSSParserFastPaths.cpp compiling
2319         https://bugs.webkit.org/show_bug.cgi?id=162033
2320
2321         Reviewed by Dean Jackson.
2322
2323         * CMakeLists.txt:
2324         * WebCore.xcodeproj/project.pbxproj:
2325         Add new StyleColor.h/.cpp files to the projecty
2326
2327         * css/CSSFunctionValue.cpp:
2328         (WebCore::CSSFunctionValue::CSSFunctionValue):
2329         (WebCore::CSSFunctionValue::customCSSText):
2330         (WebCore::CSSFunctionValue::append):
2331         (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
2332         * css/CSSFunctionValue.h:
2333         Tweak CSSFunctionValue so that the name can be represented as a keyword ID instead of a String. Eventually we also
2334         want to make CSSFunctionValue subclass CSSValueList rather than referencing a separate CSSValueList as a member. For now
2335         I left that alone though in order to not change too much in the old parser.
2336
2337         * css/CSSProperty.cpp:
2338         (WebCore::CSSProperty::isDescriptorOnly):
2339         Whether or not a property is only a descriptor, e.g., used in viewport and font face stuff.
2340
2341         * css/CSSProperty.h:
2342         * css/CSSValueKeywords.in:
2343         Added new keywords for functions that can be used as values. The new parser uses keywords to represent function names.
2344
2345         * css/StyleColor.cpp: Added.
2346         (WebCore::StyleColor::colorFromKeyword):
2347         (WebCore::StyleColor::isColorKeyword):
2348         (WebCore::StyleColor::isSystemColor):
2349         * css/StyleColor.h: Added.
2350         (WebCore::StyleColor::StyleColor):
2351         (WebCore::StyleColor::currentColor):
2352         (WebCore::StyleColor::isCurrentColor):
2353         (WebCore::StyleColor::getColor):
2354         (WebCore::StyleColor::resolve):
2355         (WebCore::operator==):
2356         (WebCore::operator!=):
2357         New color helper that contains code for checking and looking up colors. This code is similar to some code we already
2358         had in the old CSSParser.cpp file, but this way it can be used outside the parser and/or in different files.
2359
2360         * css/parser/CSSParserFastPaths.cpp:
2361         (WebCore::parseSimpleLengthValue):
2362         (WebCore::isColorPropertyID):
2363         (WebCore::parseColorIntOrPercentage):
2364         (WebCore::fastParseColorInternal):
2365         (WebCore::CSSParserFastPaths::parseColor):
2366         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2367         (WebCore::isUniversalKeyword):
2368         (WebCore::parseKeywordValue):
2369         (WebCore::parseTransformTranslateArguments):
2370         (WebCore::parseTransformNumberArguments):
2371         (WebCore::parseSimpleTransformValue):
2372         (WebCore::transformCanLikelyUseFastPath):
2373         (WebCore::parseSimpleTransformList):
2374         (WebCore::parseSimpleTransform):
2375         (WebCore::CSSParserFastPaths::maybeParseValue):
2376         * css/parser/CSSParserFastPaths.h:
2377         Get everything compiling in this file. Key changes included reverting to our old unit names, making CSSFunctionValue compatible,
2378         adding support for StyleColor, adding support for mode checking of keywords, and fixing up the memory management model so that
2379         RefPtrs are used on returns from parsing functions.
2380
2381         * css/parser/CSSParserIdioms.cpp:
2382         (WebCore::isValueAllowedInMode):
2383         * css/parser/CSSParserIdioms.h:
2384         New helper function for restricting keywords to certain modes only. The -webkit-text color quirk has been moved to this function.
2385
2386 2016-09-15  Brady Eidson  <beidson@apple.com>
2387
2388         WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
2389         <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
2390
2391         Reviewed by Brent Fulgham. 
2392
2393         No new tests (Not possible with current testing infrastructure).
2394
2395         This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time
2396         it was cached, and then to report that back to the client when a CachedPage is restored.
2397
2398         Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code.
2399
2400         * history/CachedFrame.cpp:
2401         (WebCore::CachedFrame::setHasInsecureContent):
2402         * history/CachedFrame.h:
2403         (WebCore::CachedFrame::hasInsecureContent):
2404
2405         * loader/EmptyClients.h:
2406
2407         * loader/FrameLoader.cpp:
2408         (WebCore::FrameLoader::receivedFirstData):
2409         (WebCore::FrameLoader::commitProvisionalLoad):
2410         (WebCore::FrameLoader::dispatchDidCommitLoad):
2411         * loader/FrameLoader.h:
2412
2413         * loader/FrameLoaderClient.h:
2414
2415         * loader/FrameLoaderTypes.h:
2416
2417 2016-09-13  Jer Noble  <jer.noble@apple.com>
2418
2419         [media-source] web-platform-test/media-source/mediasource-remove.html test failing
2420         https://bugs.webkit.org/show_bug.cgi?id=161950
2421
2422         Reviewed by Eric Carlson.
2423
2424         Fixes test: web-platform-test/media-source/mediasource-remove.html
2425
2426         The mediasource-remove.html test was failing in a number of ways:
2427
2428         - Tests with invalid start or end times were not throwing the correct exception
2429           code, or not throwing exception codes at all
2430
2431         - Tests were showing an incorrect start buffered range at the beginning of each test.
2432
2433         - Tests which removed samples were not getting the expected buffered values at the end
2434           each test.
2435
2436         For the exception failures, update the implementation of abort() and remove() to throw
2437         the correct exceptions at the correct times.
2438
2439         For the incorrect initial buffered range, update our buffered calculations to store
2440         individual PlatformTimeRanges on each TrackBuffer, and coalesce them into a single
2441         value when an append operation completes, a remove operation completes, or when the
2442         MediaSource's ready state changes.
2443
2444         For the incorrect buffered ranges after removal, this is caused because the "samples"
2445         that make up an audio track are actually a collection of a large number of individual
2446         samples.  So when we are asked to remove media data in a given range, break these audio
2447         meta-samples into two pieces at the removal points. This allows the removal algorithm
2448         to operate on a individual audio sample basis. (We should look into using this technique
2449         when audio samples are evicted during an append operation.) This requires adding some
2450         methods to MediaSample and it's concrete subclasses to "divide" a sample into two at
2451         a given presentation time.
2452
2453         Fixing these behaviors, however, breaks the media-source-end-of-stream-buffered.html
2454         test, which expects the buffered range for the entire element to expand to the maximum
2455         buffered time of any of the element's MediaSource's active sourceBuffers. To fix this,
2456         update the MediaSource's monitorSourceBuffer() implementation to match the current
2457         specification. The new spec no longer queries the individual SourceBuffers, but rather
2458         queries the already coalesced buffered ranges. So move the helper methods hasCurrentTime()
2459         hasFutureTime(), and canPlayThrough() up into MediaSource from SourceBuffer. Also, update
2460         seekToTime, since it has the same problem as monitorSourceBuffer().
2461
2462         However, this breaks the media-source-monitor-source-buffers.html test, which appends
2463         10s of movie data instantaneously, then never appends again. The SourceBuffer's
2464         monitorBufferingRate() method only re-evaluates the rate after data has been appended,
2465         so the SourceBuffer thinks it's buffered data at a prodigious rate forever. Instead,
2466         allow the SourceBuffer to continuously re-evalute it's buffering rate by modifying the
2467         exponential moving average so that the co-efficient scales based on how frequently the
2468         method is called. Call the method more often, and the moving average changes less quickly,
2469         and it means that when media is stalled out at the end of a buffered range, the readyState
2470         of a video element will eventually drop to HAVE_CURRENT_DATA when the average buffering
2471         rate falls below the level where playback would continue uninterrupted.
2472
2473         * Modules/mediasource/MediaSource.cpp:
2474         (WebCore::MediaSource::seekToTime):
2475         (WebCore::MediaSource::currentTimeFudgeFactor):
2476         (WebCore::MediaSource::hasBufferedTime):
2477         (WebCore::MediaSource::hasCurrentTime):
2478         (WebCore::MediaSource::hasFutureTime):
2479         (WebCore::MediaSource::monitorSourceBuffers):
2480         * Modules/mediasource/MediaSource.h:
2481         * Modules/mediasource/SourceBuffer.cpp:
2482         (WebCore::SourceBuffer::abort):
2483         (WebCore::SourceBuffer::remove):
2484         (WebCore::SourceBuffer::abortIfUpdating):
2485         (WebCore::SourceBuffer::removeCodedFrames):
2486         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
2487         (WebCore::SourceBuffer::updateBufferedFromTrackBuffers):
2488         (WebCore::SourceBuffer::canPlayThroughRange):
2489         (WebCore::SourceBuffer::monitorBufferingRate):
2490         (WebCore::currentTimeFudgeFactor): Deleted.
2491         (WebCore::SourceBuffer::hasCurrentTime): Deleted.
2492         (WebCore::SourceBuffer::hasFutureTime): Deleted.
2493         (WebCore::SourceBuffer::canPlayThrough): Deleted.
2494         * platform/MediaSample.h:
2495         * platform/cf/CoreMediaSoftLink.cpp:
2496         * platform/cf/CoreMediaSoftLink.h:
2497         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
2498         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2499         (WebCore::MediaSampleAVFObjC::isDivisable):
2500         (WebCore::MediaSampleAVFObjC::divide):
2501         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2502
2503 2016-09-15  Zalan Bujtas  <zalan@apple.com>
2504
2505         ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements
2506         https://bugs.webkit.org/show_bug.cgi?id=151097
2507         <rdar://problem/27711678>
2508
2509         Reviewed by Simon Fraser.
2510
2511         This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer.
2512         (This is similar to what any other stacking context-triggering CSS property does.)  
2513
2514         Test: compositing/assert-on-will-change-transform-with-composited-descendant.html
2515
2516         * rendering/RenderLayer.cpp:
2517         (WebCore::RenderLayer::calculateClipRects):
2518
2519 2016-09-15  Zalan Bujtas  <zalan@apple.com>
2520
2521         Move RenderObject::shouldRespectImageOrientation to RenderElement.
2522         https://bugs.webkit.org/show_bug.cgi?id=162028
2523
2524         Reviewed by Antti Koivisto.
2525
2526         Tighten the type for imageSizeForRenderer/canRender so that RenderObject::shouldRespectImageOrientation could
2527         be moved to RenderElement.
2528
2529         No change in functionality.
2530
2531         * loader/cache/CachedImage.cpp:
2532         (WebCore::CachedImage::imageSizeForRenderer):
2533         * loader/cache/CachedImage.h:
2534         * rendering/RenderElement.cpp:
2535         (WebCore::RenderElement::shouldRespectImageOrientation):
2536         * rendering/RenderElement.h:
2537         * rendering/RenderObject.cpp:
2538         (WebCore::RenderObject::shouldRespectImageOrientation): Deleted.
2539         * rendering/RenderObject.h:
2540         * rendering/style/StyleCachedImage.cpp:
2541         (WebCore::StyleCachedImage::canRender):
2542         * rendering/style/StyleCachedImage.h:
2543         * rendering/style/StyleImage.h:
2544         (WebCore::StyleImage::canRender):
2545
2546 2016-09-15  Anders Carlsson  <andersca@apple.com>
2547
2548         Fix build.
2549
2550         * platform/spi/cocoa/PassKitSPI.h:
2551
2552 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2553
2554         Use character class table in URLParser
2555         https://bugs.webkit.org/show_bug.cgi?id=161997
2556
2557         Reviewed by Chris Dumez.
2558
2559         No change in behavior except a performance improvement.
2560         
2561         Before this change, URLParser took 1.514x as long to run my URL Parsing benchmark as URL::parse
2562         with a standard deviation of the ration of the runtimes of 0.063 after 8 runs with each parser.
2563         After this change, URLParser took 1.328x as long with a standard deviation of 0.037.
2564         This isn't the cleanest data, but it's enough to convince me that this is a significant improvement.
2565
2566         * platform/URLParser.cpp:
2567         (WebCore::isC0Control):
2568         (WebCore::isC0ControlOrSpace):
2569         (WebCore::isTabOrNewline):
2570         (WebCore::isInSimpleEncodeSet):
2571         (WebCore::isInDefaultEncodeSet):
2572         (WebCore::isInUserInfoEncodeSet):
2573         (WebCore::isInvalidDomainCharacter):
2574         (WebCore::isSlashQuestionOrHash):
2575         (WebCore::shouldPercentEncodeQueryByte):
2576         (WebCore::shouldCopyFileURL):
2577         (WebCore::isSingleDotPathSegment):
2578         (WebCore::URLParser::parse):
2579
2580 2016-09-15  Keith Miller  <keith_miller@apple.com>
2581
2582         Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
2583         https://bugs.webkit.org/show_bug.cgi?id=161985
2584
2585         Reviewed by Alex Christensen.
2586
2587         Delete unneeded using, which broke the build on newer versions of clang.
2588
2589         * bridge/objc/WebScriptObject.mm:
2590
2591 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2592
2593         URLParser: Check for invalid characters in the host
2594         https://bugs.webkit.org/show_bug.cgi?id=162023
2595
2596         Reviewed by Tim Horton.
2597
2598         Covered by new API tests.
2599
2600         * platform/URLParser.cpp:
2601         (WebCore::URLParser::failure):
2602         (WebCore::URLParser::parseHost):
2603
2604 2016-09-15  Antti Koivisto  <antti@apple.com>
2605
2606         Remove some extra spaces.
2607
2608         * rendering/TextDecorationPainter.cpp:
2609         (WebCore::collectStylesForRenderer):
2610
2611 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2612
2613         Use efficient iterators in URLParser
2614         https://bugs.webkit.org/show_bug.cgi?id=162007
2615
2616         Reviewed by Tim Horton.
2617
2618         URLParser used to use StringView::CodePoints::Iterator, which needs to check if
2619         the StringView is 8-bit or 16-bit every time it does anything.
2620         I wrote a new CodePointIterator template which already knows whether it is iterating
2621         8-bit or 16-bit characters, so it does not need to do the checks each time it gets a
2622         code point or advances to the next code point.
2623
2624         No change in behavior except a performance increase.
2625         Covered by existing tests.
2626
2627         * platform/URLParser.cpp:
2628         (WebCore::CodePointIterator::CodePointIterator):
2629         (WebCore::CodePointIterator::operator==):
2630         (WebCore::CodePointIterator::operator!=):
2631         (WebCore::CodePointIterator::operator=):
2632         (WebCore::CodePointIterator::atEnd):
2633         (WebCore::CodePointIterator<LChar>::operator):
2634         (WebCore::CodePointIterator<UChar>::operator):
2635         (WebCore::isWindowsDriveLetter):
2636         (WebCore::shouldCopyFileURL):
2637         (WebCore::isPercentEncodedDot):
2638         (WebCore::isSingleDotPathSegment):
2639         (WebCore::isDoubleDotPathSegment):
2640         (WebCore::consumeSingleDotPathSegment):
2641         (WebCore::consumeDoubleDotPathSegment):
2642         (WebCore::URLParser::failure):
2643         (WebCore::URLParser::parse):
2644         (WebCore::URLParser::parseAuthority):
2645         (WebCore::parseIPv4Number):
2646         (WebCore::parseIPv4Host):
2647         (WebCore::parseIPv6Host):
2648         (WebCore::URLParser::parsePort):
2649         (WebCore::URLParser::parseHost):
2650         * platform/URLParser.h:
2651
2652 2016-09-14  Antti Koivisto  <antti@apple.com>
2653
2654         Move text decoration style computation from RenderObject to TextDecorationPainter
2655         https://bugs.webkit.org/show_bug.cgi?id=162004
2656
2657         Reviewed by Zalan Bujtas.
2658
2659         It is mostly an implementation detail of TextDecorationPainter.
2660
2661         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2662         (AXAttributeStringSetStyle):
2663         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2664         (AXAttributeStringSetStyle):
2665         * rendering/RenderObject.cpp:
2666         (WebCore::decorationColor): Deleted.
2667         (WebCore::RenderObject::getTextDecorationColorsAndStyles): Deleted.
2668         * rendering/RenderObject.h:
2669         * rendering/TextDecorationPainter.cpp:
2670         (WebCore::TextDecorationPainter::TextDecorationPainter):
2671         (WebCore::TextDecorationPainter::paintTextDecoration):
2672         (WebCore::decorationColor):
2673         * rendering/TextDecorationPainter.h:
2674
2675 2016-09-15  Dave Hyatt  <hyatt@apple.com>
2676
2677         [CSS Parser] Make stylesheets parse using the new parser if the setting is enabled
2678         https://bugs.webkit.org/show_bug.cgi?id=162018
2679
2680         Reviewed by Zalan Bujtas.
2681
2682         * css/parser/CSSParser.cpp:
2683         (WebCore::CSSParserContext::CSSParserContext):
2684         (WebCore::CSSParser::parseSheet):
2685         * css/parser/CSSParserMode.h:
2686
2687 2016-09-15  Fujii Hironori  <Hironori.Fujii@sony.com>
2688
2689         [CMake] Refactor GENERATE_BINDINGS
2690         https://bugs.webkit.org/show_bug.cgi?id=161854
2691
2692         Reviewed by Gyuyoung Kim.
2693
2694         * CMakeLists.txt: Changed the arguments of GENERATE_BINDINGS to
2695         new style.  Removed add_custom_command of preprocess-idls.pl which
2696         is moved to GENERATE_BINDINGS.  Moved IDL_ATTRIBUTES_FILE into
2697         GENERATE_BINDINGS.
2698
2699 2016-09-14  Anders Carlsson  <andersca@apple.com>
2700
2701         Add CSS -webkit-appearance property for Apple Pay buttons
2702         https://bugs.webkit.org/show_bug.cgi?id=161986
2703         rdar://problem/27459216
2704
2705         Reviewed by Dean Jackson.
2706
2707         Add a new -webkit-appearance property, "-apple-pay-button".
2708         Also, add two properties, "-apple-pay-button-type" and "-apple-pay-button-style".
2709
2710         * WebCore.xcodeproj/project.pbxproj:
2711         Add RenderThemeCocoa.h and RenderThemeCocoa.mm.
2712
2713         * css/CSSComputedStyleDeclaration.cpp:
2714         (WebCore::ComputedStyleExtractor::propertyValue):
2715         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2716
2717         * css/CSSPrimitiveValueMappings.h:
2718         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2719         (WebCore::CSSPrimitiveValue::operator ApplePayButtonStyle):
2720         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
2721         Add ApplePayButtonStyle and ApplePayButtonType conversion routines.
2722
2723         * css/CSSPropertyNames.in:
2724         Add -apple-pay-button-style and -apple-pay-button-type.
2725
2726         * css/CSSValueKeywords.in:
2727         Add CSS values.
2728
2729         * css/parser/CSSParser.cpp:
2730         (WebCore::isValidKeywordPropertyAndValue):
2731         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2732
2733         * css/parser/CSSParserFastPaths.cpp:
2734         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2735         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2736
2737         (WebCore::isAppleLegacyCSSPropertyKeyword):
2738         New function that returns whether the CSS property should be rewritten to -webkit-.
2739         We want to rewrite -apple- but not -apple-pay-.
2740
2741         (WebCore::cssPropertyID):
2742         Use the newly added isAppleLegacyCSSPropertyKeyword.
2743
2744         (WebCore::isAppleLegacyCSSValueKeyword):
2745         Check for "-apple-pay-" in addition to "-apple-system-".
2746
2747         * platform/ThemeTypes.h:
2748         Add ApplePayButtonPart.
2749
2750         * platform/spi/cocoa/PassKitSPI.h:
2751         Add PKDrawApplePayButton declaration.
2752
2753         * rendering/RenderTheme.cpp:
2754         (WebCore::RenderTheme::adjustStyle):
2755         Handle ApplePayButtonPart.
2756
2757         (WebCore::RenderTheme::paint):
2758         Handle ApplePayButtonPart.
2759
2760         * rendering/RenderTheme.h:
2761         (WebCore::RenderTheme::adjustApplePayButtonStyle):
2762         (WebCore::RenderTheme::paintApplePayButton):
2763         Add new functions.
2764
2765         * rendering/RenderThemeCocoa.h: Added.
2766         * rendering/RenderThemeCocoa.mm: Added.
2767         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle):
2768         Adjust the minimum width and minimum height accordingly.
2769
2770         (WebCore::toPKPaymentButtonStyle):
2771         (WebCore::toPKPaymentButtonType):
2772         Helper functions that convert our WebCore types to PK types.
2773
2774         (WebCore::RenderThemeCocoa::paintApplePayButton):
2775         Call PKDrawApplePayButton.
2776
2777         * rendering/RenderThemeIOS.h:
2778         * rendering/RenderThemeMac.h:
2779         Inherit from RenderThemeCocoa.
2780
2781         * rendering/style/RenderStyle.h:
2782         (WebCore::RenderStyle::applePayButtonStyle):
2783         (WebCore::RenderStyle::applePayButtonType):
2784         (WebCore::RenderStyle::setApplePayButtonStyle):
2785         (WebCore::RenderStyle::setApplePayButtonType):
2786         (WebCore::RenderStyle::initialApplePayButtonStyle):
2787         (WebCore::RenderStyle::initialApplePayButtonType):
2788         * rendering/style/RenderStyleConstants.h:
2789         * rendering/style/StyleRareInheritedData.cpp:
2790         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2791         (WebCore::StyleRareInheritedData::operator==):
2792         * rendering/style/StyleRareInheritedData.h:
2793         Add new style members for the button style and button type properties.
2794
2795 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2796
2797         [css-grid] Implement fit-content track size
2798         https://bugs.webkit.org/show_bug.cgi?id=161379
2799
2800         Reviewed by Manuel Rego Casasnovas.
2801
2802         This implements the new <fit-content> track size which is defined as follows: "Represents
2803         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
2804         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
2805         greater than the auto minimum."
2806
2807         From the parsing POV fit-content was implemented as a new type of function which only takes
2808         one argument. That forced us to refactor some code because minmax() was the only allowed
2809         function for <track-size>s so far.
2810
2811         The implementation key is a new attribute in GridTrack called growthLimitCap which is
2812         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
2813         were adapted to this change like for example the sorting of tracks by growth potential (we
2814         need to consider the caps).
2815
2816         Tests: fast/css-grid-layout/fit-content-columns.html
2817         fast/css-grid-layout/fit-content-rows.html
2818
2819         * css/CSSComputedStyleDeclaration.cpp:
2820         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
2821         * css/StyleBuilderConverter.h:
2822         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
2823         * css/parser/CSSParser.cpp:
2824         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
2825         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
2826         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
2827         it'll be available once we switch to the new parser.
2828         * rendering/RenderGrid.cpp:
2829         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
2830         keep it fast in any case.
2831         (WebCore::GridTrack::growthLimit): Ditto.
2832         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
2833         never higher than the cap.
2834         (WebCore::GridTrack::infiniteGrowthPotential):
2835         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
2836         keep it fast in any case.
2837         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
2838         keep it fast in any case.
2839         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
2840         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
2841         (WebCore::GridTrack::setInfinitelyGrowable):
2842         (WebCore::GridTrack::setGrowthLimitCap): Added.
2843         (WebCore::GridTrack::growthLimitCap): Ditto.
2844         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
2845         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
2846         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
2847         it is used to compute relative (percentage) sizes.
2848         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
2849         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
2850         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
2851         of the free space.
2852         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
2853         spaces.
2854         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
2855         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
2856         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
2857         but not least, added support for fit-content tracks.
2858         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
2859         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
2860         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
2861         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2862         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
2863         (WebCore::trackSizeForTrackSizeComputationPhase):
2864         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
2865         with growth limit caps to support fit-content().
2866         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
2867         track growth limit cap.
2868         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
2869         the selected tracks to grow over growth limits in order to respect the track caps eventually
2870         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
2871         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
2872         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
2873         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
2874         (WebCore::GridTrack::infinitelyGrowable): Deleted.
2875         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
2876         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
2877         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
2878         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
2879         TrackSizeComputationPhase out of the RenderGrid class.
2880         * rendering/style/GridTrackSize.h:
2881         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
2882         attribute to the constructor to support fit-content GridTrackSizes.
2883         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
2884         cap set by fit-content().
2885         (WebCore::GridTrackSize::minTrackBreadth):
2886         (WebCore::GridTrackSize::isFitContent): Added.
2887         (WebCore::GridTrackSize::length): Deleted.
2888         (WebCore::GridTrackSize::isPercentage): Deleted.
2889
2890 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2891
2892         [css-grid] Fix a dangling reference
2893         https://bugs.webkit.org/show_bug.cgi?id=161739
2894
2895         Reviewed by Alexey Proskuryakov.
2896
2897         The code was trying to get a reference to a private attribute of a temporary object returned
2898         by gridTrackSize().
2899
2900         * rendering/RenderGrid.cpp:
2901         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
2902
2903 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2904
2905         Unreviewed, rolling out r205966.
2906
2907         Triggered some assertions
2908
2909         Reverted changeset:
2910
2911         "[css-grid] Implement fit-content track size"
2912         https://bugs.webkit.org/show_bug.cgi?id=161379
2913         http://trac.webkit.org/changeset/205966
2914
2915 2016-09-15  Zalan Bujtas  <zalan@apple.com>
2916
2917         Cleanup RenderLayer::shouldBeNormalFlowOnly
2918         https://bugs.webkit.org/show_bug.cgi?id=161981
2919
2920         Reviewed by Simon Fraser.
2921
2922         This patch changes the logic of figuring about if a particular layer is normal flow only by simply checking
2923         if the layer creates a stacking context. If it does, we assume that it can't be a normal flow layer anymore.
2924         This patch slightly changes behaviour by making layers with isolation and reflection to be non normal flow layers anymore.    
2925
2926         Covered by existing testcases.
2927
2928         * rendering/RenderLayer.cpp:
2929         (WebCore::RenderLayer::calculateClipRects):
2930
2931 2016-09-07  Sergio Villar Senin  <svillar@igalia.com>
2932
2933         [css-grid] Implement fit-content track size
2934         https://bugs.webkit.org/show_bug.cgi?id=161379
2935
2936         Reviewed by Manuel Rego Casasnovas.
2937
2938         This implements the new <fit-content> track size which is defined as follows: "Represents
2939         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
2940         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
2941         greater than the auto minimum."
2942
2943         From the parsing POV fit-content was implemented as a new type of function which only takes
2944         one argument. That forced us to refactor some code because minmax() was the only allowed
2945         function for <track-size>s so far.
2946
2947         The implementation key is a new attribute in GridTrack called growthLimitCap which is
2948         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
2949         were adapted to this change like for example the sorting of tracks by growth potential (we
2950         need to consider the caps).
2951
2952         Tests: fast/css-grid-layout/fit-content-columns.html
2953         fast/css-grid-layout/fit-content-rows.html
2954
2955         * css/CSSComputedStyleDeclaration.cpp:
2956         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
2957         * css/StyleBuilderConverter.h:
2958         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
2959         * css/parser/CSSParser.cpp:
2960         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
2961         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
2962         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
2963         it'll be available once we switch to the new parser.
2964         * rendering/RenderGrid.cpp:
2965         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
2966         keep it fast in any case.
2967         (WebCore::GridTrack::growthLimit): Ditto.
2968         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
2969         never higher than the cap.
2970         (WebCore::GridTrack::infiniteGrowthPotential):
2971         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
2972         keep it fast in any case.
2973         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
2974         keep it fast in any case.
2975         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
2976         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
2977         (WebCore::GridTrack::setInfinitelyGrowable):
2978         (WebCore::GridTrack::setGrowthLimitCap): Added.
2979         (WebCore::GridTrack::growthLimitCap): Ditto.
2980         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
2981         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
2982         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
2983         it is used to compute relative (percentage) sizes.
2984         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
2985         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
2986         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
2987         of the free space.
2988         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
2989         spaces.
2990         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
2991         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
2992         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
2993         but not least, added support for fit-content tracks.
2994         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
2995         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
2996         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
2997         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2998         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
2999         (WebCore::trackSizeForTrackSizeComputationPhase):
3000         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
3001         with growth limit caps to support fit-content().
3002         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
3003         track growth limit cap.
3004         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
3005         the selected tracks to grow over growth limits in order to respect the track caps eventually
3006         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
3007         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
3008         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
3009         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
3010         (WebCore::GridTrack::infinitelyGrowable): Deleted.
3011         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
3012         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
3013         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
3014         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
3015         TrackSizeComputationPhase out of the RenderGrid class.
3016         * rendering/style/GridTrackSize.h:
3017         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
3018         attribute to the constructor to support fit-content GridTrackSizes.
3019         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
3020         cap set by fit-content().
3021         (WebCore::GridTrackSize::minTrackBreadth):
3022         (WebCore::GridTrackSize::isFitContent): Added.
3023         (WebCore::GridTrackSize::length): Deleted.
3024         (WebCore::GridTrackSize::isPercentage): Deleted.
3025
3026 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
3027
3028         Fix build warnings in the mediastream code
3029         https://bugs.webkit.org/show_bug.cgi?id=161957
3030
3031         Reviewed by Philippe Normand.
3032
3033         * platform/mediastream/MediaConstraints.cpp:
3034         (WebCore::MediaConstraint::create): Added assertion and mock return.
3035         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
3036         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint):
3037         Added assertion and mock return.
3038         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint):
3039         Added assertion and mock return.
3040
3041 2016-09-15  Youenn Fablet  <youenn@apple.com>
3042
3043         Rebase binding tests after r205953
3044         https://bugs.webkit.org/show_bug.cgi?id=162012
3045
3046         Unreviewed.
3047
3048         * bindings/scripts/test/JS/JSTestNode.cpp:
3049         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
3050         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
3051         * bindings/scripts/test/JS/JSTestObj.cpp:
3052         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
3053         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
3054         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
3055         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
3056         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
3057         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
3058         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
3059         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
3060         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
3061         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
3062         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
3063         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
3064         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
3065         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
3066         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
3067         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
3068
3069 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
3070
3071         [WebRTC][OpenWebRTC] crash in maybeHandleChangeMutedState
3072         https://bugs.webkit.org/show_bug.cgi?id=161619
3073
3074         Added OpenWebRTC support to the RealtimeMediaSource mock class.
3075
3076         Reviewed by Eric Carlson.
3077
3078         Fixed tests.
3079
3080         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3081         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr): Allowed
3082         inheritance of the class, required to use it when creating the
3083         mock class. Added a new constructor to create the class with null
3084         mediastream.
3085         * platform/mock/MockRealtimeMediaSource.cpp:
3086         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): Use
3087         the new BaseRealtimeMediaSourceClass in the constructor.
3088         * platform/mock/MockRealtimeMediaSource.h: Added a new
3089         BaseRealtimeMediaSourceClass defined using the
3090         RealtimeMediaSourceOwr class for OpenWebRTC platform.
3091
3092 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
3093
3094         [css-grid] Fix intrinsic size computation with flexible sized tracks
3095         https://bugs.webkit.org/show_bug.cgi?id=161903
3096
3097         Reviewed by Manuel Rego Casasnovas.
3098
3099         This is fixing a regression added in r192154. When computing the min content size of a grid
3100         container (min preferred logical width) we should not take into account the fr tracks. As
3101         stated in the early versions of the spec that size is the sum of the tracks' base sizes
3102         before running the maximize tracks step.
3103
3104         That regression was causing sizing issues in grids with fr tracks both when under
3105         min|max-content constrains and also when used as grid items (in nested grids).
3106
3107         * rendering/RenderGrid.cpp:
3108         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
3109
3110 2016-09-13  Sergio Villar Senin  <svillar@igalia.com>
3111
3112         [css-grid] Too many gaps with trailing collapsing tracks
3113         https://bugs.webkit.org/show_bug.cgi?id=161905
3114
3115         Reviewed by Darin Adler.
3116
3117         The total number and size of gaps were incorrectly computed whenever there were trailing
3118         collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
3119         much the amount of hash table queries required to know the gaps between two lines. We were
3120         considering that a gap always exist between 2 consecutive tracks if the first one is not
3121         empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
3122         sequences) but not for all the cases (NOTEMPTY|EMPTY+).
3123
3124         * rendering/RenderGrid.cpp:
3125         (WebCore::RenderGrid::guttersSize):
3126
3127 2016-09-15  Youenn Fablet  <youenn@apple.com>
3128
3129         callPromiseFunction should be made usable for custom binding code
3130         https://bugs.webkit.org/show_bug.cgi?id=161961
3131
3132         Reviewed by Darin Adler.
3133
3134         Covered by updated test.
3135
3136         * bindings/js/JSDOMBinding.h:
3137         (WebCore::castThisValue): Utility function to cast this value to a specific type.
3138         * bindings/js/JSDOMPromise.h:
3139         (WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
3140         for improved efficiency. Added workerMode template parameter.
3141         (WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
3142         * bindings/js/JSMediaDevicesCustom.cpp:
3143         (WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
3144         (WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
3145         * bindings/scripts/CodeGeneratorJS.pm:
3146         (GenerateImplementation): Updated to use template parameter.
3147         * bindings/scripts/test/JS/JSTestNode.cpp:
3148         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
3149         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
3150         * bindings/scripts/test/JS/JSTestObj.cpp:
3151         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
3152         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
3153         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
3154         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
3155         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
3156         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
3157         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
3158         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
3159         * bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.
3160
3161 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
3162
3163         WebCrypto algorithms should be exposed via KeyAlgorithm dictionary
3164         https://bugs.webkit.org/show_bug.cgi?id=128748
3165         <rdar://problem/27359438>
3166
3167         Reviewed by Brent Fulgham and Chris Dumez.
3168
3169         Replace custom CryptoAlgorithmBuilder/buildAlgorithmDescription with KeyAlgorithm dictionary which is
3170         defined by the spec: https://www.w3.org/TR/WebCryptoAPI/#key-algorithm-dictionary. Moreover, mark
3171         CryptoKey.usages as CachedAttribute.
3172
3173         Tests: crypto/subtle/crypto-key-algorithm-gc.html
3174                crypto/subtle/crypto-key-usages-gc.html
3175
3176         * PlatformEfl.cmake:
3177         * PlatformGTK.cmake:
3178         * PlatformMac.cmake:
3179         Remove CryptoAlgorithmDescriptionBuilder.cpp.
3180         * WebCore.xcodeproj/project.pbxproj:
3181         * bindings/js/JSCryptoAlgorithmBuilder.cpp:
3182         (WebCore::JSCryptoAlgorithmBuilder::add):
3183         (WebCore::JSCryptoAlgorithmBuilder::createEmptyClone): Deleted.
3184         * bindings/js/JSCryptoAlgorithmBuilder.h:
3185         * bindings/js/JSCryptoKeyCustom.cpp:
3186         (WebCore::JSCryptoKey::algorithm):
3187         Get rid of dependency on CryptoAlgorithmDescriptionBuilder.
3188         * crypto/CryptoAlgorithmDescriptionBuilder.cpp: Removed.
3189         * crypto/CryptoAlgorithmDescriptionBuilder.h: Removed.
3190         Replace it with KeyAlgorithm.
3191         * crypto/CryptoKey.cpp:
3192         (WebCore::CryptoKey::CryptoKey):
3193         (WebCore::CryptoKey::buildAlgorithmDescription): Deleted.
3194         * crypto/CryptoKey.h:
3195         (WebCore::KeyAlgorithm::KeyAlgorithm):
3196         (WebCore::KeyAlgorithm::~KeyAlgorithm):
3197         (WebCore::CryptoKey::algorithmIdentifier):
3198         * crypto/CryptoKey.idl:
3199         Add KeyAlgorithm dictionary which is returned via CryptoKey.buildAlgorithm() method,
3200         and rename m_algorithm to m_algorithmIdentifier to distingush it with newly
3201         added KeyAlgorithm dictionary.
3202         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
3203         (WebCore::buildAlgorithm):
3204         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
3205         * crypto/keys/CryptoKeyAES.cpp:
3206         (WebCore::CryptoKeyAES::buildAlgorithm):
3207         (WebCore::CryptoKeyAES::buildAlgorithmDescription): Deleted.
3208         * crypto/keys/CryptoKeyAES.h:
3209         (WebCore::AesKeyAlgorithm::AesKeyAlgorithm):
3210         (WebCore::AesKeyAlgorithm::~AesKeyAlgorithm):
3211         * crypto/keys/CryptoKeyHMAC.cpp:
3212         (WebCore::CryptoKeyHMAC::buildAlgorithm):
3213         (WebCore::CryptoKeyHMAC::buildAlgorithmDescription): Deleted.
3214         * crypto/keys/CryptoKeyHMAC.h:
3215         (WebCore::HmacKeyAlgorithm::HmacKeyAlgorithm):
3216         (WebCore::HmacKeyAlgorithm::~HmacKeyAlgorithm):
3217         * crypto/keys/CryptoKeyRSA.h:
3218         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm):
3219         (WebCore::RsaKeyAlgorithm::~RsaKeyAlgorithm):
3220         (WebCore::RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm):
3221         (WebCore::RsaHashedKeyAlgorithm::~RsaHashedKeyAlgorithm):
3222         * crypto/mac/CryptoKeyRSAMac.cpp:
3223         (WebCore::CryptoKeyRSA::buildAlgorithm):
3224         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
3225
3226 2016-09-14  Chris Dumez  <cdumez@apple.com>
3227
3228         REGRESSION (r205670): ASSERTION FAILED: methodTable(vm)->toThis(this, exec, NotStrictMode) == this
3229         https://bugs.webkit.org/show_bug.cgi?id=161982
3230
3231         Reviewed by Saam Barati.
3232
3233         We no longer need a custom [[SetPrototypeOf]] anymore as JSProxy::setPrototypeOf()
3234         no longer forwards the call to its target.
3235
3236         No new layout tests because the behavior only changes in the context of the JSC
3237         tests (which were updated in this patch).
3238
3239         * bindings/js/JSDOMWindowCustom.cpp:
3240         (WebCore::JSDOMWindow::setPrototype): Deleted.
3241         * page/DOMWindow.idl:
3242
3243 2016-09-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3244
3245         Media controls behave strangely when changing media sources
3246         https://bugs.webkit.org/show_bug.cgi?id=161914
3247         <rdar://problem/28227805>
3248
3249         Reviewed by Tim Horton.
3250
3251         Addresses media controls flickering while changing the source of a media element. To accomplish this, we make
3252         the following changes to the media controls main content heuristic:
3253
3254         - Prevent elements that are not mostly within the mainframe rect (or elements with empty rects) from showing
3255           media controls. Many websites that rely on same document navigation will move videos offscreen when navigating
3256           to a section of their site that does not play media. Without this check, we would not know to hide a video
3257           element on certain popular websites that use this technique, since the video has been interacted with in the
3258           past.
3259
3260         - Rather than check whether a media element currently has video/audio sources, check whether it has ever had
3261           audio. Many websites will use the same media element across different videos and change only the source, and
3262           we should not prevent a media element from having media controls on grounds of having no audio or video in
3263           this case.
3264
3265         - Rather than add user gesture and playback behavior restrictions before dispatching an ended event, add only
3266           the gesture restriction immediately, and add the playback restriction after waiting for a grace period only if
3267           the user has not interacted with the video since ending, and the video is not currently playing or about to
3268           play. This gives the user a chance to interact with the controls when a video ends, but also allows the page
3269           to load or begin playing a new video with the same media element without thrashing media control state.
3270
3271         Adds 3 new API tests.
3272
3273         * html/HTMLMediaElement.cpp:
3274         (WebCore::HTMLMediaElement::HTMLMediaElement):
3275         (WebCore::HTMLMediaElement::~HTMLMediaElement):
3276         (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged):
3277         (WebCore::HTMLMediaElement::seekWithTolerance):
3278         (WebCore::HTMLMediaElement::beginScrubbing):
3279         (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
3280         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
3281         (WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
3282         * html/HTMLMediaElement.h:
3283         (WebCore::HTMLMediaElement::hasEverHadAudio):
3284         (WebCore::HTMLMediaElement::hasEverHadVideo):
3285         * html/MediaElementSession.cpp:
3286         (WebCore::MediaElementSession::canShowControlsManager):
3287         (WebCore::isElementRectMostlyInMainFrame):
3288         * platform/graphics/MediaPlayer.h:
3289         (WebCore::MediaPlayerClient::mediaPlayerActiveSourceBuffersChanged):
3290         * platform/graphics/MediaPlayerPrivate.h:
3291         (WebCore::MediaPlayerPrivateInterface::notifyActiveSourceBuffersChanged):
3292         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3293         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3294         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::notifyActiveSourceBuffersChanged):
3295         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3296         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
3297         (WebCore::MediaSourcePrivateAVFObjC::sourceBufferPrivateDidChangeActiveState):
3298
3299 2016-09-14  Eric Carlson  <eric.carlson@apple.com>
3300
3301         [MediaStream] Minor cleanup
3302         https://bugs.webkit.org/show_bug.cgi?id=161976
3303
3304         Reviewed by Youenn Fablet and Dean Jackson.
3305
3306         No new tests, no behavior change.
3307
3308         * CMakeLists.txt:
3309         * DerivedSources.make:
3310         * Modules/mediastream/CaptureDeviceInfo.h: Removed.
3311         * Modules/mediastream/CaptureDeviceManager.cpp: Removed.
3312         * Modules/mediastream/CaptureDeviceManager.h: Removed.
3313         * Modules/mediastream/MediaDevicesRequest.cpp:
3314         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
3315         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Deleted.
3316         (WebCore::MediaDevicesRequest::requestOrigin): Deleted.
3317         * Modules/mediastream/MediaDevicesRequest.h:
3318         * Modules/mediastream/MediaStreamTrackSourcesCallback.h: Removed.
3319         * Modules/mediastream/MediaStreamTrackSourcesCallback.idl: Removed.
3320         * Modules/mediastream/SourceInfo.cpp: Removed.
3321         * Modules/mediastream/SourceInfo.h: Removed.
3322         * Modules/mediastream/SourceInfo.idl: Removed.
3323         * WebCore.xcodeproj/project.pbxproj:
3324         * platform/mediastream/CaptureDevice.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceInfo.h.
3325         (WebCore::CaptureDevice::CaptureDevice):
3326         (WebCore::CaptureDevice::persistentId):
3327         (WebCore::CaptureDevice::label):
3328         (WebCore::CaptureDevice::groupId):
3329         (WebCore::CaptureDevice::kind):
3330         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
3331         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
3332         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
3333         * platform/mediastream/CaptureDeviceManager.cpp: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp.
3334         (CaptureDeviceManager::getSourcesInfo):
3335         * platform/mediastream/CaptureDeviceManager.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.h.
3336         (WebCore::CaptureSessionInfo::~CaptureSessionInfo):
3337         (WebCore::CaptureSessionInfo::supportsVideoSize):
3338         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions):
3339         * platform/mediastream/MediaStreamTrackSourcesRequestClient.h: Removed.
3340         * platform/mediastream/RealtimeMediaSourceCenter.h:
3341         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3342         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3343         (WebCore::AVCaptureDeviceManager::getSourcesInfo):
3344         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3345         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
3346         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources): Deleted.
3347         (WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): Deleted.
3348         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3349         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3350         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamDevices):
3351         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources): Deleted.
3352         (WebCore::RealtimeMediaSourceCenterOwr::sourceWithUID): Deleted.
3353         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
3354         * platform/mock/MockRealtimeMediaSource.cpp:
3355         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
3356         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
3357         (WebCore::MockRealtimeMediaSource::trackSourceWithUID): Deleted.
3358         * platform/mock/MockRealtimeMediaSource.h:
3359         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3360         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
3361         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources): Deleted.
3362         (WebCore::MockRealtimeMediaSourceCenter::sourceWithUID): Deleted.
3363         * platform/mock/MockRealtimeMediaSourceCenter.h:
3364
3365 2016-09-14  Antti Koivisto  <antti@apple.com>
3366
3367         Move more code out from RenderObject
3368         https://bugs.webkit.org/show_bug.cgi?id=161980
3369
3370         Reviewed by Zalan Bujtas.
3371
3372         Move some functions that are only needed for RenderElement there.
3373         Move collapsing anonymous table rows to RenderTableRow.
3374
3375         * rendering/RenderElement.cpp:
3376         (WebCore::RenderElement::hasOutlineAnnotation):
3377         (WebCore::RenderElement::hasSelfPaintingLayer):
3378         (WebCore::RenderElement::checkForRepaintDuringLayout):
3379         * rendering/RenderElement.h:
3380         (WebCore::RenderElement::hasOutline):
3381         (WebCore::RenderElement::hasHiddenBackface): Deleted.
3382         * rendering/RenderLayerCompositor.cpp:
3383         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
3384         * rendering/RenderObject.cpp:
3385         (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
3386         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
3387         (WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
3388         (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
3389         (WebCore::RenderObject::hasOutlineAnnotation): Deleted.
3390         (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.