[SOUP] Remove unused methods toSoupMessage from ResourceRequest/Response
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         [SOUP] Remove unused methods toSoupMessage from ResourceRequest/Response
4         https://bugs.webkit.org/show_bug.cgi?id=162867
5
6         Reviewed by Sergio Villar Senin.
7
8         * platform/network/soup/ResourceRequest.h:
9         * platform/network/soup/ResourceRequestSoup.cpp:
10         (WebCore::ResourceRequest::updateSoupMessage):
11         (WebCore::ResourceRequest::updateFromSoupMessage): Deleted.
12         * platform/network/soup/ResourceResponse.h:
13         * platform/network/soup/ResourceResponseSoup.cpp:
14         (WebCore::ResourceResponse::updateFromSoupMessage): Deleted.
15
16 2016-10-03  Youenn Fablet  <youenn@apple.com>
17
18         Remove FetchBody::m_isEmpty
19         https://bugs.webkit.org/show_bug.cgi?id=162857
20
21         Reviewed by Alex Christensen.
22
23         No change of behavior.
24
25         Moving handling of null bodies in FetchBodyOwner, by having an Optional<FetchBody> in FetchBodyOwner.
26         Moving storage of m_contentType in FetchBodyOwner.
27
28         Moving header storage from FetchResponse/FetchRequest to FetchBodyOwner, as it helps updating m_contentType.
29
30         * Modules/fetch/FetchBody.cpp: removing m_isEmpty and m_contentType.
31         (WebCore::FetchBody::extract): Computes the default content-type which is stored in FetchBodyOwner.
32         (WebCore::FetchBody::blob):
33         (WebCore::FetchBody::consume):
34         (WebCore::FetchBody::consumeAsStream):
35         (WebCore::FetchBody::loadingSucceeded):
36         (WebCore::FetchBody::bodyForInternalRequest):
37         (WebCore::FetchBody::clone):
38         * Modules/fetch/FetchBody.h:
39         (WebCore::FetchBody::loadingBody):
40         (WebCore::FetchBody::FetchBody):
41         * Modules/fetch/FetchBodyOwner.cpp:
42         (WebCore::FetchBodyOwner::FetchBodyOwner):
43         (WebCore::FetchBodyOwner::stop):
44         (WebCore::FetchBodyOwner::arrayBuffer):
45         (WebCore::FetchBodyOwner::blob):
46         (WebCore::FetchBodyOwner::cloneBody): Needs to clone m_contentType as well.
47         (WebCore::FetchBodyOwner::extractBody):
48         (WebCore::FetchBodyOwner::updateContentType):
49         (WebCore::FetchBodyOwner::consumeOnceLoadingFinished):
50         (WebCore::FetchBodyOwner::formData):
51         (WebCore::FetchBodyOwner::json):
52         (WebCore::FetchBodyOwner::text):
53         (WebCore::FetchBodyOwner::loadBlob):
54         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
55         (WebCore::FetchBodyOwner::blobLoadingFailed):
56         (WebCore::FetchBodyOwner::finishBlobLoading):
57         * Modules/fetch/FetchBodyOwner.h:
58         (WebCore::FetchBodyOwner::body):
59         (WebCore::FetchBodyOwner::isBodyNull):
60         * Modules/fetch/FetchRequest.cpp:
61         (WebCore::FetchRequest::setBody):
62         (WebCore::FetchRequest::internalRequest):
63         (WebCore::FetchRequest::clone):
64         * Modules/fetch/FetchRequest.h:
65         (WebCore::FetchRequest::FetchRequest):
66         * Modules/fetch/FetchResponse.cpp:
67         (WebCore::FetchResponse::initializeWith):
68         (WebCore::FetchResponse::FetchResponse):
69         (WebCore::FetchResponse::cloneForJS):
70         (WebCore::FetchResponse::fetch):
71         (WebCore::FetchResponse::BodyLoader::didSucceed):
72         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
73         (WebCore::FetchResponse::BodyLoader::start):
74         (WebCore::FetchResponse::createReadableStreamSource):
75         * Modules/fetch/FetchResponse.h:
76
77 2016-10-03  Andy Estes  <aestes@apple.com>
78
79         ASSERTION FAILED: result in WebCore::CSSParser::parseURI
80         https://bugs.webkit.org/show_bug.cgi?id=141638
81         <rdar://problem/27709952>
82
83         Reviewed by Andreas Kling.
84
85         CSSParser::parseURIInternal() failed to parse unquoted URLs with Unicode escape sequences
86         greater than 0xFF, even when the destination character type was multi-byte. Fixed by
87         checking the size of DestCharacterType instead of SrcCharacterType.
88
89         Updated fast/css/url-with-multi-byte-unicode-escape.html to test for an unquoted URL.
90
91         * css/parser/CSSParser.cpp:
92         (WebCore::CSSParser::parseURIInternal): For code points greater than 0xFF, only returned
93         false if sizeof(DestCharacterType) == 1.
94
95 2016-10-03  Alex Christensen  <achristensen@webkit.org>
96
97         URLParser: empty relative URLs should not copy fragment from the base URL
98         https://bugs.webkit.org/show_bug.cgi?id=162864
99
100         Reviewed by Chris Dumez.
101
102         Covered by new API tests.
103
104         * platform/URL.cpp:
105         (WebCore::URL::removeFragmentIdentifier):
106         Optimize removing fragments, now that it happens more often. We don't need to reparse, 
107         because the result will always be equal to just a substring when removing the fragment at the end.
108         * platform/URLParser.cpp:
109         (WebCore::URLParser::copyASCIIStringUntil):
110         (WebCore::URLParser::copyURLPartsUntil):
111         (WebCore::containsOnlyC0ControlOrSpace):
112         (WebCore::URLParser::URLParser):
113         (WebCore::URLParser::parse):
114         * platform/URLParser.h:
115         Because we are not copying the fragment, we can simplify and remove some unreachable code.
116
117 2016-10-03  Chris Dumez  <cdumez@apple.com>
118
119         td.scope should only return known values
120         https://bugs.webkit.org/show_bug.cgi?id=162755
121
122         Reviewed by Sam Weinig.
123
124         td.scope should only return known values:
125         - https://html.spec.whatwg.org/#dom-th-scope
126
127         Firefox conforms to the specification.
128
129         No new tests, rebaselined existing test.
130
131         * html/HTMLTableCellElement.cpp:
132         (WebCore::HTMLTableCellElement::scope):
133
134 2016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
135
136         [SOUP] Simplify AuthenticationChallenge
137         https://bugs.webkit.org/show_bug.cgi?id=162784
138
139         Reviewed by Alex Christensen.
140
141         We don't really need to keep references to the SoupSession and SoupMessage in AuthenticationChallenge, the
142         SoupNetworkSession callback already forwards the challenge to the right ResourceHandle.
143
144         * platform/network/soup/AuthenticationChallenge.h:
145         (WebCore::AuthenticationChallenge::authenticationClient):
146         (WebCore::AuthenticationChallenge::soupSession): Deleted.
147         (WebCore::AuthenticationChallenge::soupMessage): Deleted.
148         * platform/network/soup/AuthenticationChallengeSoup.cpp:
149         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
150         (WebCore::AuthenticationChallenge::platformCompare):
151         * platform/network/soup/ResourceHandleSoup.cpp:
152         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge):
153         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
154         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
155         (WebCore::ResourceHandle::receivedCredential):
156         (WebCore::ResourceHandle::receivedCancellation):
157         * platform/network/soup/SoupNetworkSession.cpp:
158         (WebCore::authenticateCallback):
159
160 2016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
161
162         [SOUP] Cleanup persistent credential storage code
163         https://bugs.webkit.org/show_bug.cgi?id=162777
164
165         Reviewed by Alex Christensen.
166
167         We have this feature behind ENABLE_CREDENTIAL_STORAGE flag, which is confusing, because we use credential
168         storage unconditionally and this is only about persistent storage. Also the flag assumes libsecret is available,
169         and since it's only used by GTK sometimes we use GTK ifdefs instead of CREDENTIAL_STORAGE. So, I think we should
170         use USE(LIBSECRET) instead, and reduce a bit the ifdefs in common soup code. Another problem is that current
171         implementation is always used, while it should depend on the current network storage session and never used in
172         ephemeral sessions. This patch moves the code from CredentialBackingStore to NetworkStorageSessionSoup and
173         modernizes a bit.
174
175         * PlatformGTK.cmake: Remove CredentialBackingStore.cpp.
176         * platform/gtk/GRefPtrGtk.cpp: Use USE(LIBSECRET)
177         * platform/gtk/GRefPtrGtk.h:
178         * platform/network/NetworkStorageSession.h:
179         * platform/network/ResourceHandleInternal.h:
180         * platform/network/gtk/CredentialBackingStore.cpp: Removed.
181         * platform/network/gtk/CredentialBackingStore.h: Removed.
182         * platform/network/soup/NetworkStorageSessionSoup.cpp:
183         (WebCore::NetworkStorageSession::~NetworkStorageSession):
184         (WebCore::schemeFromProtectionSpaceServerType):
185         (WebCore::authTypeFromProtectionSpaceAuthenticationScheme):
186         (WebCore::NetworkStorageSession::getCredentialFromPersistentStorage):
187         (WebCore::NetworkStorageSession::saveCredentialToPersistentStorage):
188         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
189         (WebCore::NetworkStorageSession::switchToNewTestingSession): Deleted.
190         * platform/network/soup/ResourceHandleSoup.cpp:
191         (WebCore::gotHeadersCallback):
192         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
193         (WebCore::ResourceHandle::receivedCredential):
194         (WebCore::ResourceHandle::continueDidReceiveAuthenticationChallenge): Deleted.
195         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential): Deleted.
196         (WebCore::ResourceHandle::receivedCancellation): Deleted.
197
198 2016-10-03  Carlos Garcia Campos  <cgarcia@igalia.com>
199
200         Unreviewed. Fix the build with coordinated graphics enabled after r206712.
201
202         * page/scrolling/ScrollingStateTree.cpp:
203         (WebCore::ScrollingStateTree::attachNode):
204
205 2016-10-02  Chris Dumez  <cdumez@apple.com>
206
207         Add support for KeyboardEvent.getModifierState() operation
208         https://bugs.webkit.org/show_bug.cgi?id=162855
209
210         Reviewed by Darin Adler.
211
212         Add support for KeyboardEvent.getModifierState() operation:
213         - https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate
214
215         Test: fast/events/constructors/keyboard-event-getModifierState.html
216
217         * dom/KeyboardEvent.cpp:
218         (WebCore::KeyboardEvent::getModifierState):
219         * dom/KeyboardEvent.idl:
220
221 2016-10-02  Chris Dumez  <cdumez@apple.com>
222
223         Add support for KeyboardEvent.repeat attribute
224         https://bugs.webkit.org/show_bug.cgi?id=162854
225
226         Reviewed by Darin Adler.
227
228         Add support for KeyboardEvent.repeat attribute:
229         - https://w3c.github.io/uievents/#dom-keyboardevent-repeat
230
231         No new tests, extended existing test.
232
233         * dom/KeyboardEvent.cpp:
234         (WebCore::KeyboardEvent::KeyboardEvent):
235         * dom/KeyboardEvent.h:
236         * dom/KeyboardEvent.idl:
237
238 2016-10-02  Darin Adler  <darin@apple.com>
239
240         Rename ExceptionCode-based exception handling to "legacy"
241         https://bugs.webkit.org/show_bug.cgi?id=162859
242
243         Reviewed by Chris Dumez.
244
245         RaisesException is now MayThrowLegacyException.
246
247         A follow-up patch soon will add MayThrowException for the new style,
248         where we use ExceptionOr<> as the return type instead of an ExceptionCode
249         out argument.
250
251         * bindings/scripts/CodeGeneratorJS.pm:
252         Removed the quotation marks from the syntax object->{PropertyName} so the
253         renaming script could handle it. Tweaked various comments and logic for clarity.
254         Changed to use the perl "x if y" syntax for brevity in many places.
255         Renamed with the script and by hand. Added code to skip including the same header
256         in both the implementation file and the header, just to make generated bindings
257         slightly smaller and faster to compile. Used "using" instead of "typedef".
258
259         * bindings/scripts/IDLAttributes.txt: Updated from old names to new ones.
260
261         * Modules/applepay/ApplePaySession.idl:
262         * Modules/encryptedmedia/MediaKeySession.idl:
263         * Modules/encryptedmedia/MediaKeys.idl:
264         * Modules/fetch/FetchHeaders.idl:
265         * Modules/fetch/FetchRequest.idl:
266         * Modules/fetch/FetchResponse.idl:
267         * Modules/indexeddb/IDBCursor.idl:
268         * Modules/indexeddb/IDBDatabase.idl:
269         * Modules/indexeddb/IDBFactory.idl:
270         * Modules/indexeddb/IDBIndex.idl:
271         * Modules/indexeddb/IDBKeyRange.idl:
272         * Modules/indexeddb/IDBObjectStore.idl:
273         * Modules/indexeddb/IDBRequest.idl:
274         * Modules/indexeddb/IDBTransaction.idl:
275         * Modules/mediasource/MediaSource.idl:
276         * Modules/mediasource/SourceBuffer.idl:
277         * Modules/mediastream/MediaDevices.idl:
278         * Modules/mediastream/RTCDTMFSender.idl:
279         * Modules/mediastream/RTCDataChannel.idl:
280         * Modules/mediastream/RTCIceCandidate.idl:
281         * Modules/mediastream/RTCPeerConnection.idl:
282         * Modules/mediastream/RTCRtpSender.idl:
283         * Modules/mediastream/RTCSessionDescription.idl:
284         * Modules/navigatorcontentutils/NavigatorContentUtils.idl:
285         * Modules/notifications/NotificationCenter.idl:
286         * Modules/webaudio/AnalyserNode.idl:
287         * Modules/webaudio/AudioBuffer.idl:
288         * Modules/webaudio/AudioBufferSourceNode.idl:
289         * Modules/webaudio/AudioContext.idl:
290         * Modules/webaudio/AudioNode.idl:
291         * Modules/webaudio/ConvolverNode.idl:
292         * Modules/webaudio/OfflineAudioContext.idl:
293         * Modules/webaudio/OscillatorNode.idl:
294         * Modules/webdatabase/DOMWindowWebDatabase.idl:
295         * Modules/webdatabase/SQLResultSet.idl:
296         * Modules/websockets/WebSocket.idl:
297         * bindings/scripts/test/TestImplements.idl:
298         * bindings/scripts/test/TestInterface.idl:
299         * bindings/scripts/test/TestNamedConstructor.idl:
300         * bindings/scripts/test/TestNondeterministic.idl:
301         * bindings/scripts/test/TestObj.idl:
302         * bindings/scripts/test/TestSupplemental.idl:
303         * bindings/scripts/test/TestTypedefs.idl:
304         * css/CSSCharsetRule.idl:
305         * css/CSSMediaRule.idl:
306         * css/CSSPrimitiveValue.idl:
307         * css/CSSRule.idl:
308         * css/CSSStyleDeclaration.idl:
309         * css/CSSStyleSheet.idl:
310         * css/CSSSupportsRule.idl:
311         * css/CSSValue.idl:
312         * css/FontFace.idl:
313         * css/FontFaceSet.idl:
314         * css/MediaList.idl:
315         * css/WebKitCSSMatrix.idl:
316         * dom/CharacterData.idl:
317         * dom/ChildNode.idl:
318         * dom/CustomElementRegistry.idl:
319         * dom/DataTransferItemList.idl:
320         * dom/Document.idl:
321         * dom/Element.idl:
322         * dom/EventTarget.idl:
323         * dom/MessagePort.idl:
324         * dom/MutationObserver.idl:
325         * dom/NamedNodeMap.idl:
326         * dom/Node.idl:
327         * dom/ParentNode.idl:
328         * dom/Range.idl:
329         * dom/ShadowRoot.idl:
330         * dom/Text.idl:
331         * fileapi/FileReader.idl:
332         * fileapi/FileReaderSync.idl:
333         * html/DOMTokenList.idl:
334         * html/DOMURL.idl:
335         * html/HTMLCanvasElement.idl:
336         * html/HTMLElement.idl:
337         * html/HTMLEmbedElement.idl:
338         * html/HTMLFrameElement.idl:
339         * html/HTMLIFrameElement.idl:
340         * html/HTMLInputElement.idl:
341         * html/HTMLMarqueeElement.idl:
342         * html/HTMLMediaElement.idl:
343         * html/HTMLObjectElement.idl:
344         * html/HTMLOptionElement.idl:
345         * html/HTMLOptionsCollection.idl:
346         * html/HTMLProgressElement.idl:
347         * html/HTMLSelectElement.idl:
348         * html/HTMLTableElement.idl:
349         * html/HTMLTableRowElement.idl:
350         * html/HTMLTableSectionElement.idl:
351         * html/HTMLTextAreaElement.idl:
352         * html/HTMLVideoElement.idl:
353         * html/ImageData.idl:
354         * html/MediaController.idl:
355         * html/TimeRanges.idl:
356         * html/URLUtils.idl:
357         * html/canvas/CanvasGradient.idl:
358         * html/canvas/CanvasPath.idl:
359         * html/canvas/CanvasRenderingContext2D.idl:
360         * html/canvas/OESVertexArrayObject.idl:
361         * html/canvas/WebGLRenderingContextBase.idl:
362         * html/track/DataCue.idl:
363         * html/track/TextTrack.idl:
364         * html/track/TextTrackCue.idl:
365         * html/track/VTTCue.idl:
366         * html/track/VTTRegion.idl:
367         * loader/appcache/DOMApplicationCache.idl:
368         * page/Crypto.idl:
369         * page/DOMSelection.idl:
370         * page/DOMWindow.idl:
371         * page/EventSource.idl:
372         * page/History.idl:
373         * page/Location.idl:
374         * page/Performance.idl:
375         * page/UserMessageHandler.idl:
376         * page/WindowOrWorkerGlobalScope.idl:
377         * storage/Storage.idl:
378         * svg/SVGAltGlyphElement.idl:
379         * svg/SVGAngle.idl:
380         * svg/SVGAnimatedBoolean.idl:
381         * svg/SVGAnimatedEnumeration.idl:
382         * svg/SVGAnimatedInteger.idl:
383         * svg/SVGAnimatedNumber.idl:
384         * svg/SVGAnimatedString.idl:
385         * svg/SVGAnimationElement.idl:
386         * svg/SVGColor.idl:
387         * svg/SVGGlyphRefElement.idl:
388         * svg/SVGGraphicsElement.idl:
389         * svg/SVGLength.idl:
390         * svg/SVGLengthList.idl:
391         * svg/SVGMatrix.idl:
392         * svg/SVGNumberList.idl:
393         * svg/SVGPaint.idl:
394         * svg/SVGPathSegList.idl:
395         * svg/SVGPointList.idl:
396         * svg/SVGPreserveAspectRatio.idl:
397         * svg/SVGStringList.idl:
398         * svg/SVGStyleElement.idl:
399         * svg/SVGTextContentElement.idl:
400         * svg/SVGTransformList.idl:
401         * svg/SVGViewSpec.idl:
402         * testing/InternalSettings.idl:
403         * testing/Internals.idl:
404         * workers/DedicatedWorkerGlobalScope.idl:
405         * workers/Worker.idl:
406         * xml/DOMParser.idl:
407         * xml/XMLHttpRequest.idl:
408         * xml/XPathEvaluator.idl:
409         * xml/XPathExpression.idl:
410         * xml/XPathResult.idl:
411         Allowed the rename script to rename the exception-related extended attributes.
412
413         * bindings/scripts/test/JS/JSInterfaceName.cpp:
414         * bindings/scripts/test/JS/JSInterfaceName.h:
415         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
416         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
417         * bindings/scripts/test/JS/JSTestCallback.cpp:
418         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
419         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
420         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
421         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
422         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
423         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
424         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
425         * bindings/scripts/test/JS/JSTestEventConstructor.h:
426         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
427         * bindings/scripts/test/JS/JSTestEventTarget.h:
428         * bindings/scripts/test/JS/JSTestException.cpp:
429         * bindings/scripts/test/JS/JSTestException.h:
430         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
431         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
432         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
433         * bindings/scripts/test/JS/JSTestGlobalObject.h:
434         * bindings/scripts/test/JS/JSTestInterface.cpp:
435         * bindings/scripts/test/JS/JSTestInterface.h:
436         * bindings/scripts/test/JS/JSTestIterable.cpp:
437         * bindings/scripts/test/JS/JSTestIterable.h:
438         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
439         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
440         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
441         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
442         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
443         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
444         * bindings/scripts/test/JS/JSTestNode.cpp:
445         * bindings/scripts/test/JS/JSTestNode.h:
446         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
447         * bindings/scripts/test/JS/JSTestNondeterministic.h:
448         * bindings/scripts/test/JS/JSTestObj.cpp:
449         * bindings/scripts/test/JS/JSTestObj.h:
450         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
451         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
452         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
453         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
454         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
455         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
456         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
457         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
458         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
459         * bindings/scripts/test/JS/JSTestTypedefs.h:
460         * bindings/scripts/test/JS/JSattribute.cpp:
461         * bindings/scripts/test/JS/JSattribute.h:
462         * bindings/scripts/test/JS/JSreadonly.cpp:
463         * bindings/scripts/test/JS/JSreadonly.h:
464         Regenerated.
465
466
467 2016-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
468
469         Media controls for Soundcloud easily falls out of sync with what's actually playing
470         https://bugs.webkit.org/show_bug.cgi?id=162843
471         <rdar://problem/28176874>
472
473         Reviewed by Beth Dakin.
474
475         Currently, audio elements are subject to the same main content restrictions as video elements. This is
476         problematic on sites where audio elements are really the main content, such as soundcloud. We need a different
477         heuristic for determining whether audio elements such as these should be allowed to show playback controls.
478
479         Furthermore, we currently forbid autoplaying audio from showing controls if it has user gesture restrictions
480         (i.e. it started playing via script). This is, again, problematic on sites where audio elements are played one
481         after another (such as on soundcloud). Even though a subsequent audio element may have been triggered via
482         script, we might want still want to show controls for it if the user has explicitly triggered other elements on
483         the page to begin playing. However, if the user has not gestured on any media in the page, we still should not
484         show controls for audio elements that begin playing via script.
485
486         Adds two new unit tests to TestWebKitAPI simulating audio playback behavior on soundcloud.
487
488         * html/MediaElementSession.cpp:
489         (WebCore::MediaElementSession::removeBehaviorRestriction):
490         (WebCore::MediaElementSession::canShowControlsManager):
491         (WebCore::MediaElementSession::allowsPlaybackControlsForAutoplayingAudio):
492         * html/MediaElementSession.h:
493         * page/Page.h:
494         (WebCore::Page::allowsPlaybackControlsForAutoplayingAudio):
495         (WebCore::Page::setAllowsPlaybackControlsForAutoplayingAudio):
496
497 2016-10-02  Ryan Haddad  <ryanhaddad@apple.com>
498
499         Unreviewed, rolling out r206683.
500
501         This change caused API test WebKit2.FindMatches to fail on
502         Mac.
503
504         Reverted changeset:
505
506         "The dragged image should be the current frame only of the
507         animated image"
508         https://bugs.webkit.org/show_bug.cgi?id=162109
509         http://trac.webkit.org/changeset/206683
510
511 2016-10-02  Chris Dumez  <cdumez@apple.com>
512
513         Unreviewed, rolling out r206692 and r206718.
514
515         Seems to have caused >200 failures on Sierra
516
517         Reverted changesets:
518
519         "Implement rendering of font-variation-settings"
520         https://bugs.webkit.org/show_bug.cgi?id=162782
521         http://trac.webkit.org/changeset/206692
522
523         "Tried to fix the build after r206692."
524         http://trac.webkit.org/changeset/206718
525
526 2016-10-02  Dan Bernstein  <mitz@apple.com>
527
528         Tried to fix the build after r206692.
529
530         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
531         (WebCore::cascadeToLastResortAndVariationsFontDescriptor):
532
533 2016-10-02  Commit Queue  <commit-queue@webkit.org>
534
535         Unreviewed, rolling out r206716.
536         https://bugs.webkit.org/show_bug.cgi?id=162858
537
538         It is breaking Mac CMake Debug build (Requested by youenn on
539         #webkit).
540
541         Reverted changeset:
542
543         "[Fetch API] Forbid redirection to non-HTTP(s) URL in non-
544         navigation mode."
545         https://bugs.webkit.org/show_bug.cgi?id=162785
546         http://trac.webkit.org/changeset/206716
547
548 2016-10-02  Youenn Fablet  <youenn@apple.com>
549
550         [Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode.
551         https://bugs.webkit.org/show_bug.cgi?id=162785
552
553         Reviewed by Alex Christensen.
554
555         Covered by rebased and existing tests.
556
557         Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only.
558         This should be applied to all clients at some point, but there is still some uncertainty for data URLs.
559
560         Did some refactoring to better separate the case of security checks in case of regular request or redirected request.
561         This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests.
562         But they are not allowed for same-origin redirected requests.
563
564         * WebCore.xcodeproj/project.pbxproj:
565         * loader/DocumentThreadableLoader.cpp:
566         (WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error.
567         (WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API.
568         * loader/SubresourceLoader.cpp:
569         (WebCore::SubresourceLoader::willSendRequestInternal):
570         * loader/cache/CachedResourceLoader.cpp:
571         (WebCore::CachedResourceLoader::requestImage):
572         (WebCore::CachedResourceLoader::checkInsecureContent):
573         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
574         (WebCore::isSameOriginDataURL):
575         (WebCore::CachedResourceLoader::canRequest):
576         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
577         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox):
578         (WebCore::CachedResourceLoader::requestResource):
579         * loader/cache/CachedResourceLoader.h:
580
581 2016-10-01  Simon Fraser  <simon.fraser@apple.com>
582
583         Support transitions/animations of background-position with right/bottom-relative values
584         https://bugs.webkit.org/show_bug.cgi?id=162048
585
586         Reviewed by Dean Jackson.
587         
588         Make transitions between "background-position: 10px 20px" and "background-position: right 10px bottom 20px"
589         work. We do this by by converting "right 10px" to "calc(100% - 10px)" when blending.
590         
591         Also improve logging of calculated lengths, and better animation logging for FillLayer properties.
592
593         Test: transitions/background-position-transitions.html
594
595         * page/animation/CSSPropertyAnimation.cpp:
596         (WebCore::FillLayerAnimationPropertyWrapperBase::FillLayerAnimationPropertyWrapperBase): Keep the propertyID
597         around so logging can use it.
598         (WebCore::FillLayerAnimationPropertyWrapperBase::property):
599         (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter):
600         (WebCore::FillLayerPropertyWrapperGetter::value):
601         (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper):
602         (WebCore::createCalculatedLength):
603         (WebCore::FillLayerPositionPropertyWrapper::FillLayerPositionPropertyWrapper):
604         (WebCore::FillLayerRefCountedPropertyWrapper::FillLayerRefCountedPropertyWrapper):
605         (WebCore::FillLayerStyleImagePropertyWrapper::FillLayerStyleImagePropertyWrapper):
606         (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper):
607         (WebCore::CSSPropertyAnimation::blendProperties): Blend then log, so that the logging
608         can show the result.
609         * platform/CalculationValue.cpp:
610         (WebCore::CalcExpressionNumber::dump):
611         (WebCore::CalcExpressionBinaryOperation::dump):
612         (WebCore::CalcExpressionLength::dump):
613         (WebCore::CalcExpressionBlendLength::dump):
614         (WebCore::operator<<):
615         * platform/CalculationValue.h:
616         * platform/Length.cpp:
617         (WebCore::operator<<):
618
619 2016-10-01  Simon Fraser  <simon.fraser@apple.com>
620
621         Bad cast when CSS position programmatically changed from -webkit-sticky to fixed
622         https://bugs.webkit.org/show_bug.cgi?id=160826
623
624         Reviewed by Zalan Bujtas.
625         
626         If a scrolling state tree node changed type (e.g. from sticky to fixed), we'd fail
627         to recreate the node so keep a node with the wrong type.
628         
629         Fix by destroying the node and making a new one with a new ID in this case. The
630         new ID is necessary to ensure that the scrolling tree is updated.
631
632         Test: fast/scrolling/sticky-to-fixed.html
633
634         * page/scrolling/ScrollingStateTree.cpp:
635         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch):
636         (WebCore::ScrollingStateTree::attachNode):
637         (WebCore::ScrollingStateTree::stateNodeForID):
638         * page/scrolling/ScrollingStateTree.h:
639
640 2016-10-01  Youenn Fablet  <youenn@apple.com>
641
642         removing FetchBoyd::m_type
643
644         Remove FetchBody::m_type
645         https://bugs.webkit.org/show_bug.cgi?id=162841
646
647         Reviewed by Sam Weinig.
648
649         No change of behavior.
650
651         Removing FetchBody::m_type and using m_data in lieu.
652         Introducing temporarily FetchBody::m_isEmpty to handle the case of null bodies.
653         Null body handling should be moved to FetchBodyOwner in a follow-up patch.
654
655         * Modules/fetch/FetchBody.cpp:
656         (WebCore::FetchBody::FetchBody):
657         (WebCore::FetchBody::extract):
658         (WebCore::FetchBody::arrayBuffer):
659         (WebCore::FetchBody::blob):
660         (WebCore::FetchBody::json):
661         (WebCore::FetchBody::text):
662         (WebCore::FetchBody::consumeOnceLoadingFinished):
663         (WebCore::FetchBody::consume):
664         (WebCore::FetchBody::consumeAsStream):
665         (WebCore::FetchBody::loadingSucceeded):
666         (WebCore::FetchBody::bodyForInternalRequest):
667         (WebCore::FetchBody::clone):
668         (WebCore::FetchBody::consumeText): Deleted.
669         (WebCore::FetchBody::consumeBlob): Deleted.
670         * Modules/fetch/FetchBody.h:
671         (WebCore::FetchBody::isEmpty):
672         (WebCore::FetchBody::isBlob):
673         (WebCore::FetchBody::isFormData):
674         (WebCore::FetchBody::isArrayBuffer):
675         (WebCore::FetchBody::isArrayBufferView):
676         (WebCore::FetchBody::isURLSearchParams):
677         (WebCore::FetchBody::isText):
678         (WebCore::FetchBody::FetchBody):
679         (WebCore::FetchBody::setContentType): Deleted.
680         (WebCore::FetchBody::urlSearchParamsBody): Deleted.
681         * Modules/fetch/FetchBodyOwner.cpp:
682         (WebCore::FetchBodyOwner::consumeOnceLoadingFinished):
683         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
684         (WebCore::FetchBodyOwner::finishBlobLoading): Deleted.
685         * Modules/fetch/FetchBodyOwner.h:
686         (WebCore::FetchBodyOwner::body): Deleted.
687         * Modules/fetch/FetchRequest.cpp:
688         (WebCore::FetchRequest::setBody):
689         * Modules/fetch/FetchResponse.cpp:
690         (WebCore::FetchResponse::fetch):
691         (WebCore::FetchResponse::BodyLoader::didSucceed):
692         (WebCore::FetchResponse::consume):
693         (WebCore::FetchResponse::consumeBodyAsStream):
694         (WebCore::FetchResponse::createReadableStreamSource):
695         (WebCore::FetchResponse::finishConsumingStream): Deleted.
696         * Modules/fetch/FetchResponse.h:
697
698 2016-09-30  David Kilzer  <ddkilzer@apple.com>
699
700         REGRESSION (r203424): WebCore::ImageBuffer::createCompatibleBuffer() in ImageBufferCG.cpp over-releases CGColorSpaceRef objects
701         <https://webkit.org/b/162823>
702         <rdar://problem/27723268>
703
704         Reviewed by Joseph Pecoraro.
705
706         Code is covered by existing tests, but no crashes have been
707         observed in practice.  May require running one test multiple
708         times to reproduce.
709
710         * platform/graphics/cg/ImageBufferCG.cpp:
711         (WebCore::ImageBuffer::createCompatibleBuffer): Don't use
712         adoptCF() when the function doesn't return a +1 retained
713         CGColorSpaceRef.
714
715 2016-09-30  Joonghun Park  <jh718.park@samsung.com>
716
717         [EFL] Fix build break since r206661. Unreviewed
718         https://bugs.webkit.org/show_bug.cgi?id=162825
719
720         No new tests, no new behaviours.
721
722         * rendering/RenderLayer.cpp:
723         (WebCore::ClipRects::ClipRects):
724
725 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
726
727         Declare that our variation fonts work is in progress
728         https://bugs.webkit.org/show_bug.cgi?id=162816
729
730         Reviewed by Simon Fraser.
731
732         * features.json:
733
734 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
735
736         Turn variation fonts on by default
737         https://bugs.webkit.org/show_bug.cgi?id=162818
738
739         Reviewed by Simon Fraser.
740
741         No new tests because there is no behavior change.
742
743         * page/Settings.in:
744         * testing/InternalSettings.cpp:
745         (WebCore::InternalSettings::variationFontsEnabled):
746
747 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
748
749         Implement rendering of font-variation-settings
750         https://bugs.webkit.org/show_bug.cgi?id=162782
751
752         Reviewed by Zalan Bujtas.
753
754         Because the heavy lifting for font-variation-settings is done by CoreText,
755         this patch is fairly minimal. It simply hooks up the CSS property to CoreText.
756
757         There is an existing bug in CoreText where variations inside fonts do not
758         survive the addition of a cascade list. Therefore, FontPlatformData::ctFont()
759         needs to work around this (conditionally) by resupplying the variation at
760         the same time as the cascade list. The CoreText bug is <rdar://problem/28449441>.
761
762         Tests: fast/text/variations/duplicate.html
763                fast/text/variations/exist.html
764                fast/text/variations/inheritance.html
765                fast/text/variations/order.html
766                fast/text/variations/outofbounds.html
767
768         * platform/graphics/FontCache.h:
769         * platform/graphics/cocoa/FontCacheCoreText.cpp:
770         (WebCore::preparePlatformFont):
771         (WebCore::fontWithFamily):
772         (WebCore::FontCache::createFontPlatformData):
773         (WebCore::FontCache::systemFallbackForCharacters):
774         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
775         (WebCore::cascadeToLastResortAttributesDictionary):
776         (WebCore::cascadeToLastResortAndVariationsFontDescriptor):
777         (WebCore::FontPlatformData::ctFont):
778         (WebCore::cascadeToLastResortFontDescriptor): Deleted.
779         * platform/graphics/mac/FontCustomPlatformData.cpp:
780         (WebCore::FontCustomPlatformData::fontPlatformData):
781         * rendering/RenderThemeIOS.mm:
782         (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
783
784 2016-09-29  Sam Weinig  <sam@webkit.org>
785
786         Add initial support for IDL union conversion
787         https://bugs.webkit.org/show_bug.cgi?id=161576
788
789         Reviewed by Chris Dumez.
790
791         * WebCore.xcodeproj/project.pbxproj:
792         Add IDLTypes.h
793
794         * bindings/generic/IDLTypes.h: Added.
795         Add a basic type hierarchy for types defined by WebIDL and their corresponding
796         WebCore implementation types.
797
798         * bindings/js/JSDOMConvert.h:
799         (WebCore::Converter<IDLDOMString>::convert):
800         (WebCore::Converter<IDLUSVString>::convert):
801         Add Converters for IDLDOMString and IDLUSVString.
802
803         (WebCore::ConditionalConverter<typename ReturnType, typename T, bool enabled>)
804         Add a struct to allow conditional conversion of types based on a compile boolean
805         value. This allows the union code to work, by ensuring that code for types that don't
806         exist doesn't get compiled.
807
808         (WebCore::Converter<IDLUnion>::convert):
809         Add template meta programming based version of the WebIDL conversion algorithm. It uses
810         introspection of the typelist to conditionally execute the parts of the algorithm that
811         apply and relies on the compiler eliminate the dead code it produces. This initial cut
812         doesn't implement the full algorithm, just a subset needed to see if this method will work
813         out.
814
815         * bindings/js/JSDOMWrapper.h:
816         (WebCore::isJSDOMWrapperType):
817         Add JSDOMWrapperType to the list of well known types to allow quick checking of wrappers
818         by the union code.
819
820         * bindings/js/JSNodeOrString.cpp:
821         (WebCore::toNodeOrStringVector):
822         Switch to new IDLUnion based converter.
823
824 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
825
826         Implement animation of font-variation-settings
827         https://bugs.webkit.org/show_bug.cgi?id=162783
828
829         Reviewed by Simon Fraser.
830
831         Modify CSSPropertyAnimation to understand FontVariationSettings objects and how
832         to interpolate them.
833
834         If two FontVariationSettings objects are unlike (meaning they specify different
835         variation axes), for now the interpolation simply returns an empty object. This
836         might change in the future, but for now, this is a reasonable place to start.
837
838         Because CSSPropertyAnimation interacts with RenderStyles instead of
839         FontDescriptions, this patch adds a transparent accessor from the RenderStyle
840         to the inner FontDescription.
841
842         Tests: animations/font-variation-settings-order.html
843                animations/font-variation-settings-unlike.html
844                animations/font-variation-settings.html
845
846         * page/animation/CSSPropertyAnimation.cpp:
847         (WebCore::blendFunc):
848         (WebCore::PropertyWrapperFontVariationSettings::PropertyWrapperFontVariationSettings):
849         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
850         * rendering/style/RenderStyle.cpp:
851         (WebCore::RenderStyle::setFontVariationSettings):
852         * rendering/style/RenderStyle.h:
853         (WebCore::RenderStyle::fontVariationSettings):
854
855 2016-09-30  Antoine Quint  <graouts@apple.com>
856
857         [Modern Media Controls] layout nodes
858         https://bugs.webkit.org/show_bug.cgi?id=162799
859         <rdar://problem/28569301>
860
861         Reviewed by Dean Jackson.
862
863         Modern media controls will be using a tree of LayoutNode objects that commit to the DOM
864         in coordinated `requestAnimationFrame()` calls to ensure all layouts are done in an efficient
865         and coordinated manner. As a preamble, we introduced the `scheduler` singleton in
866         https://webkit.org/b/162726 which is in charge of scheduling callbacks.
867
868         A LayoutNode is created by providing an Element to its constructor, or an HTML string. Not
869         providing a parameter creates a simple <div>.
870
871         When we set a property on a LayoutNode, we call `markDirtyProperty(propertyName)` which keeps
872         track of dirty properties in the `_dirtyProperties` set. When this set is non-empty, the node
873         is marked as dirty and registered in the global `dirtyNodes` map, asking the shared scheduler
874         that a layout is needed. When the layout is performed, all nodes in the `dirtyNodes` map are
875         processed such that `commitProperty(propertyName)` is called to commit dirty properties for
876         a given node to the DOM, and `layout()` is called to allow subclasses of LayoutNode to conduct
877         custom layout logic that goes beyond committing a given property.
878
879         Another reason why a node may be marked as dirty is when a DOM hierarchy change is needed. A
880         host of DOM-like methods are exposed to allow flexible manipulations of nodes, with an extra
881         `children` property which allows wholesale change of a node's subtree with a single array
882         property assignment. Changes to the DOM hierarchy are performed in the same scheduler callback
883         as style properties.
884
885         Nodes can be marked for layout explicitly with by setting the `needsLayout` property.
886
887         Tests: media/modern-media-controls/layout-node/addChild.html
888                media/modern-media-controls/layout-node/children.html
889                media/modern-media-controls/layout-node/constructor.html
890                media/modern-media-controls/layout-node/height.html
891                media/modern-media-controls/layout-node/insertAfter.html
892                media/modern-media-controls/layout-node/insertBefore.html
893                media/modern-media-controls/layout-node/parent.html
894                media/modern-media-controls/layout-node/remove.html
895                media/modern-media-controls/layout-node/removeChild.html
896                media/modern-media-controls/layout-node/subclassing.html
897                media/modern-media-controls/layout-node/visible.html
898                media/modern-media-controls/layout-node/width.html
899                media/modern-media-controls/layout-node/x.html
900                media/modern-media-controls/layout-node/y.html
901
902         * Modules/modern-media-controls/controls/layout-node.js: Added.
903         (LayoutNode):
904         (LayoutNode.prototype.get x):
905         (LayoutNode.prototype.set x):
906         (LayoutNode.prototype.get y):
907         (LayoutNode.prototype.set y):
908         (LayoutNode.prototype.get width):
909         (LayoutNode.prototype.set width):
910         (LayoutNode.prototype.get height):
911         (LayoutNode.prototype.set height):
912         (LayoutNode.prototype.get visible):
913         (LayoutNode.prototype.set visible):
914         (LayoutNode.prototype.get needsLayout):
915         (LayoutNode.prototype.set needsLayout):
916         (LayoutNode.prototype.get parent):
917         (LayoutNode.prototype.get children):
918         (LayoutNode.prototype.set children):
919         (LayoutNode.prototype.addChild):
920         (LayoutNode.prototype.insertBefore):
921         (LayoutNode.prototype.insertAfter):
922         (LayoutNode.prototype.removeChild):
923         (LayoutNode.prototype.remove):
924         (LayoutNode.prototype.markDirtyProperty):
925         (LayoutNode.prototype.commitProperty):
926         (LayoutNode.prototype.layout):
927         (LayoutNode.prototype._markNodeManipulation):
928         (LayoutNode.prototype._updateDirtyState):
929         (LayoutNode.prototype._updateChildren):
930         (performScheduledLayout):
931         (elementFromString):
932
933 2016-09-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
934
935         The dragged image should be the current frame only of the animated image
936         https://bugs.webkit.org/show_bug.cgi?id=162109
937
938         Reviewed by Tim Horton.
939
940         Instead of creating an NSImage with all the frames for the dragImage,
941         create an NSImage with the current frame only.
942
943         * dom/DataTransferMac.mm:
944         (WebCore::DataTransfer::createDragImage): Call currentFrameNSImage() to create the dragImage.
945         * editing/cocoa/HTMLConverter.mm:
946         (fileWrapperForElement):  Call the Image function with its new name.
947         * platform/graphics/BitmapImage.h:
948         * platform/graphics/Image.h:
949         (WebCore::Image::nsImage): Rename getNSImage() to nsImage().
950         (WebCore::Image::currentFrameNSImage): Returns the NSImage of the current frame.
951         (WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
952         (WebCore::Image::getNSImage): Deleted.
953         (WebCore::Image::getTIFFRepresentation): Deleted.
954         * platform/graphics/mac/ImageMac.mm:
955         (WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
956         (WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage().
957         (WebCore::BitmapImage::currentFrameNSImage): Returns the NSImage of the current frame.
958         (WebCore::BitmapImage::getTIFFRepresentation): Deleted.
959         (WebCore::BitmapImage::getNSImage): Deleted.
960         * platform/mac/CursorMac.mm:
961         (WebCore::createCustomCursor): Call currentFrameNSImage() since the cursor does not animate anyway.
962         * platform/mac/DragImageMac.mm:
963         (WebCore::createDragImageFromImage): Use currentFrameNSImage() for the dragImage.
964         * platform/mac/PasteboardMac.mm:
965         (WebCore::Pasteboard::write): Call the Image function with its new name.
966
967 2016-09-30  Chris Dumez  <cdumez@apple.com>
968
969         [iOS] Allow sequence<Touch> input in TouchEvent constructor
970         https://bugs.webkit.org/show_bug.cgi?id=162806
971         <rdar://problem/28566429>
972
973         Reviewed by Ryosuke Niwa.
974
975         Allow sequence<Touch> input in TouchEvent constructor in addition to
976         TouchList objects. It is convenient for developers to pass arrays of
977         Touch objects.
978
979         No new tests, already covered by:
980         imported/w3c/web-platform-tests/touch-events/touch-touchevent-constructor.html
981
982         * bindings/js/JSDOMBinding.h:
983         (WebCore::toRefNativeArray):
984         (WebCore::toRefPtrNativeArray):
985         * bindings/js/JSDictionary.cpp:
986         (WebCore::JSDictionary::convertValue):
987
988 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
989
990         Parse font-variation-settings
991         https://bugs.webkit.org/show_bug.cgi?id=162781
992
993         Reviewed by Simon Fraser.
994
995         CSS Fonts level 4 [1] details the font-variation-settings property which allows variations
996         to be applied to fonts which accept it. The property accepts a list of key/value
997         pairs where the keys are four-character Ascii codes and the values are floating
998         point values. The implementation uses font-feature-settings as a model, but with one
999         big difference: font-variation-settings can be animated. The set of variation points
1000         are animated individually.
1001
1002         This font variations work is being done behind a run-time switch, which is settable from
1003         the Safari Develop menu.
1004
1005         Now that FontDescription is growing, I'd like to do an investigation into the possibility of
1006         moving some of the rare pieces of it into their own class to reduce memory. However, upon
1007         advice, this investigation will be fairly involved and should be done in its own bug.
1008
1009         Test: fast/text/variations/getComputedStyle.html
1010
1011         * CMakeLists.txt:
1012         * WebCore.xcodeproj/project.pbxproj:
1013         * css/CSSAllInOne.cpp:
1014         * css/CSSComputedStyleDeclaration.cpp:
1015         (WebCore::ComputedStyleExtractor::propertyValue):
1016         * css/CSSFontVariationValue.cpp: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
1017         (WebCore::CSSFontVariationValue::CSSFontVariationValue):
1018         (WebCore::CSSFontVariationValue::customCSSText):
1019         (WebCore::CSSFontVariationValue::equals):
1020         * css/CSSFontVariationValue.h: Copied from Source/WebCore/platform/graphics/FontTaggedSettings.cpp.
1021         * css/CSSPropertyNames.in:
1022         * css/CSSValue.cpp:
1023         (WebCore::CSSValue::equals):
1024         (WebCore::CSSValue::cssText):
1025         (WebCore::CSSValue::destroy):
1026         * css/CSSValue.h:
1027         (WebCore::CSSValue::isFontVariationValue):
1028         (WebCore::CSSValue::isFontFeatureValue): Deleted.
1029         * css/StyleBuilderConverter.h:
1030         (WebCore::StyleBuilderConverter::convertFontVariationSettings):
1031         * css/StyleBuilderCustom.h:
1032         (WebCore::StyleBuilderCustom::applyInitialFontVariationSettings):
1033         (WebCore::StyleBuilderCustom::applyInheritFontVariationSettings):
1034         (WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted.
1035         * css/parser/CSSParser.cpp:
1036         (WebCore::CSSParserContext::CSSParserContext):
1037         (WebCore::operator==):
1038         (WebCore::CSSParser::parseValue):
1039         (WebCore::CSSParser::parseFontFeatureSettings):
1040         (WebCore::CSSParser::parseFontVariationTag):
1041         (WebCore::CSSParser::parseFontVariationSettings):
1042         * css/parser/CSSParser.h:
1043         * css/parser/CSSParserMode.h:
1044         * platform/graphics/FontCache.h:
1045         (WebCore::FontDescriptionKey::FontDescriptionKey):
1046         (WebCore::FontDescriptionKey::operator==):
1047         (WebCore::FontDescriptionKey::computeHash):
1048         * platform/graphics/FontDescription.cpp:
1049         * platform/graphics/FontDescription.h:
1050         (WebCore::FontDescription::variationSettings):
1051         (WebCore::FontDescription::setVariationSettings):
1052         (WebCore::FontDescription::operator==):
1053         (WebCore::FontDescription::featureSettings): Deleted.
1054         (WebCore::FontDescription::setFeatureSettings): Deleted.
1055         * platform/graphics/FontTaggedSettings.cpp:
1056         (WebCore::FontVariationSettings::hash):
1057         (WebCore::operator<<):
1058         * platform/graphics/FontTaggedSettings.h:
1059
1060 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
1061
1062         Followup patch to r206664
1063         https://bugs.webkit.org/show_bug.cgi?id=162774
1064
1065         Unreviewed.
1066
1067         No new tests because there is no behavior change.
1068
1069         * platform/graphics/FontTaggedSettings.h:
1070         (WebCore::FourCharacterTagHashTraits::isDeletedValue): Deleted.
1071
1072 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
1073
1074         Fix fast/text/trak-optimizeLegibility.html
1075         https://bugs.webkit.org/show_bug.cgi?id=162779
1076
1077         Reviewed by Simon Fraser.
1078
1079         I accidentally created this test to allow an unnecessary delta
1080         in the width comparison. This covered the fact that the fonts
1081         were not being selected correctly in our testing code. Update the
1082         font selection code to work with system fonts correctly and
1083         update the test to not use a delta when performing width
1084         comparisons.
1085
1086         Test: fast/text/trak-optimizeLegibility.html
1087
1088         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1089         (WebCore::isSystemFont):
1090         (WebCore::platformFontLookupWithFamily):
1091
1092 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
1093
1094         Create runtime flag for variation font work
1095         https://bugs.webkit.org/show_bug.cgi?id=162780
1096
1097         Reviewed by Alex Christensen.
1098
1099         No new tests because there is no behavior change.
1100
1101         Variation font work should be behind a runtime flag.
1102
1103         * page/Settings.in:
1104         * testing/InternalSettings.cpp:
1105         (WebCore::InternalSettings::Backup::Backup):
1106         (WebCore::InternalSettings::Backup::restoreTo):
1107         (WebCore::InternalSettings::variationFontsEnabled):
1108         (WebCore::InternalSettings::setVariationFontsEnabled):
1109         * testing/InternalSettings.h:
1110         * testing/InternalSettings.idl:
1111
1112 2016-09-30  Myles C. Maxfield  <mmaxfield@apple.com>
1113
1114         Templatize internal FontFeatureSettings class for variation font support
1115         https://bugs.webkit.org/show_bug.cgi?id=162774
1116
1117         Reviewed by Alex Christensen.
1118
1119         Font features and font variations are similar in that they are identified
1120         by four-character tags and an associated value. However, the value is an
1121         int for font features and is a float for font variations. In order to
1122         simplify code, we can use the same class for both, and use a template
1123         argument to distinguish between the two. Then, typedefs can be used to
1124         name them.
1125
1126         No new tests because there is no behavior change.
1127
1128         * WebCore.xcodeproj/project.pbxproj: Rename FontFeatureSettings.{cpp,h}
1129         to FontTaggedSettings.{cpp,h}
1130         * css/CSSComputedStyleDeclaration.cpp:
1131         (WebCore::ComputedStyleExtractor::propertyValue):
1132         * css/CSSFontFace.h:
1133         * css/CSSFontFaceSource.h:
1134         * css/CSSFontFeatureValue.cpp:
1135         (WebCore::CSSFontFeatureValue::CSSFontFeatureValue):
1136         * css/CSSFontFeatureValue.h:
1137         * css/FontFace.cpp:
1138         (WebCore::FontFace::featureSettings):
1139         * css/parser/CSSParser.cpp:
1140         (WebCore::CSSParser::parseFontFeatureTag):
1141         * loader/cache/CachedFont.h:
1142         * platform/graphics/FontDescription.h:
1143         * platform/graphics/FontFeatureSettings.cpp:
1144         (WebCore::FontFeature::FontFeature): Deleted.
1145         (WebCore::FontFeature::operator==): Deleted.
1146         (WebCore::FontFeature::operator<): Deleted.
1147         (WebCore::FontFeatureSettings::insert): Deleted.
1148         (WebCore::FontFeatureSettings::hash): Deleted.
1149         * platform/graphics/FontFeatureSettings.h: Removed.
1150         (WebCore::fontFeatureTag): Deleted.
1151         (WebCore::FontFeatureTagHash::hash): Deleted.
1152         (WebCore::FontFeatureTagHash::equal): Deleted.
1153         (WebCore::FontFeatureTagHashTraits::constructDeletedValue): Deleted.
1154         (WebCore::FontFeatureTagHashTraits::isDeletedValue): Deleted.
1155         (WebCore::FontFeature::operator!=): Deleted.
1156         (WebCore::FontFeature::tag): Deleted.
1157         (WebCore::FontFeature::value): Deleted.
1158         (WebCore::FontFeature::enabled): Deleted.
1159         (WebCore::FontFeatureSettings::operator==): Deleted.
1160         (WebCore::FontFeatureSettings::operator!=): Deleted.
1161         (WebCore::FontFeatureSettings::size): Deleted.
1162         (WebCore::FontFeatureSettings::operator[]): Deleted.
1163         (WebCore::FontFeatureSettings::at): Deleted.
1164         (WebCore::FontFeatureSettings::begin): Deleted.
1165         (WebCore::FontFeatureSettings::end): Deleted.
1166         * platform/graphics/FontTaggedSettings.cpp: Renamed from Source/WebCore/platform/graphics/FontFeatureSettings.cpp.
1167         (WebCore::FontFeatureSettings::hash):
1168         * platform/graphics/FontTaggedSettings.h: Added.
1169         (WebCore::fontFeatureTag):
1170         (WebCore::FourCharacterTagHash::hash):
1171         (WebCore::FourCharacterTagHash::equal):
1172         (WebCore::FourCharacterTagHashTraits::constructDeletedValue):
1173         (WebCore::FourCharacterTagHashTraits::isDeletedValue):
1174         (WebCore::FontTaggedSetting::operator!=):
1175         (WebCore::FontTaggedSetting::tag):
1176         (WebCore::FontTaggedSetting::value):
1177         (WebCore::FontTaggedSetting::enabled):
1178         (WebCore::FontTaggedSetting<T>::FontTaggedSetting):
1179         (WebCore::=):
1180         (WebCore::FontTaggedSetting<T>::operator<):
1181         (WebCore::FontTaggedSettings::operator==):
1182         (WebCore::FontTaggedSettings::operator!=):
1183         (WebCore::FontTaggedSettings::isEmpty):
1184         (WebCore::FontTaggedSettings::size):
1185         (WebCore::FontTaggedSettings::operator[]):
1186         (WebCore::FontTaggedSettings::at):
1187         (WebCore::FontTaggedSettings::begin):
1188         (WebCore::FontTaggedSettings::end):
1189         (WebCore::FontTaggedSettings<T>::insert):
1190         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1191         (WebCore::tagEquals):
1192         (WebCore::appendOpenTypeFeature):
1193         * platform/graphics/mac/FontCustomPlatformData.h:
1194
1195 2016-09-30  Chris Dumez  <cdumez@apple.com>
1196
1197         Fragment serialization should always use 'xml:' prefix for attributes in XML namespace
1198         https://bugs.webkit.org/show_bug.cgi?id=162803
1199
1200         Reviewed by Sam Weinig.
1201
1202         Fragment serialization should always use 'xml:' prefix for attributes in XML namespace:
1203         - https://html.spec.whatwg.org/#serialising-html-fragments
1204         """
1205         If the attribute is in the XML namespace
1206         -> The attribute's serialized name is the string "xml:" followed by the attribute's local name.
1207         """
1208
1209         - https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm
1210         """
1211         If ns is the XML namespace, then let qualified name be the concatenation of the string "xml:"
1212         and the value of node's localName.
1213         """
1214
1215         Firefox complies with the specification.
1216
1217         No new tests, rebaselined existing test.
1218
1219         * editing/MarkupAccumulator.cpp:
1220         (WebCore::MarkupAccumulator::appendAttribute):
1221
1222 2016-09-30  Zalan Bujtas  <zalan@apple.com>
1223
1224         Unreviewed, rolling out r206611.
1225
1226         Scroll perf did not recover.
1227
1228         Reverted changeset:
1229
1230         "Unreviewed, rolling out r206483."
1231         https://bugs.webkit.org/show_bug.cgi?id=162750
1232         http://trac.webkit.org/changeset/206611
1233
1234 2016-09-30  Zalan Bujtas  <zalan@apple.com>
1235
1236         Remove ClipRects's custom refcounting.
1237         https://bugs.webkit.org/show_bug.cgi?id=162798
1238
1239         Reviewed by Simon Fraser.
1240
1241         It's safer to use RefCounted<>. 
1242
1243         No change in functionality.
1244
1245         * rendering/RenderLayer.cpp:
1246         (WebCore::ClipRects::ClipRects):
1247         (WebCore::ClipRectsCache::getClipRects):
1248         (WebCore::ClipRectsCache::setClipRects):
1249         (WebCore::ClipRectsCache::getIndex):
1250         (WebCore::RenderLayer::updateClipRects):
1251         (WebCore::ClipRects::ref): Deleted.
1252         (WebCore::ClipRects::deref): Deleted.
1253
1254 2016-09-30  Chris Dumez  <cdumez@apple.com>
1255
1256         FileSaver.js does not work in WebKit
1257         https://bugs.webkit.org/show_bug.cgi?id=162788
1258
1259         Reviewed by Sam Weinig.
1260
1261         FileSaver.js does not work in WebKit:
1262         - https://eligrey.com/demos/FileSaver.js/
1263
1264         It works in Firefox and Chrome, but in WebKit, we were getting a
1265         "Synthetic clicks on anchors that have a download attribute are
1266         ignored." warning. We were too strict in restricting synthetic clicks.
1267         We now allow synthetic clicks as long as they are triggered by a user
1268         gesture.
1269
1270         Test: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
1271
1272         * html/HTMLAnchorElement.cpp:
1273         (WebCore::HTMLAnchorElement::handleClick):
1274
1275 2016-09-30  Joseph Pecoraro  <pecoraro@apple.com>
1276
1277         Breakpoints on blank lines or comments don't break
1278         https://bugs.webkit.org/show_bug.cgi?id=9885
1279         <rdar://problem/6134406>
1280
1281         Reviewed by Mark Lam.
1282
1283         Tests: inspector/debugger/breakpoints/resolved-dump-all-pause-locations.html
1284                inspector/debugger/breakpoints/resolved-dump-each-line.html
1285
1286         * bindings/js/CachedScriptSourceProvider.h:
1287         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
1288
1289 2016-09-30  Joseph Pecoraro  <pecoraro@apple.com>
1290
1291         Web Inspector: Stepping out of a function finishes the line that called it.
1292         https://bugs.webkit.org/show_bug.cgi?id=155325
1293         <rdar://problem/25094578>
1294
1295         Reviewed by Mark Lam.
1296
1297         Tests: inspector/debugger/stepping/stepInto.html
1298                inspector/debugger/stepping/stepOut.html
1299                inspector/debugger/stepping/stepOver.html
1300                inspector/debugger/stepping/stepping-arrow-functions.html
1301                inspector/debugger/stepping/stepping-classes.html
1302                inspector/debugger/stepping/stepping-control-flow.html
1303                inspector/debugger/stepping/stepping-function-calls.html
1304                inspector/debugger/stepping/stepping-function-default-parameters.html
1305                inspector/debugger/stepping/stepping-literal-construction.html
1306                inspector/debugger/stepping/stepping-loops.html
1307                inspector/debugger/stepping/stepping-misc.html
1308                inspector/debugger/stepping/stepping-switch.html
1309                inspector/debugger/stepping/stepping-template-string.html
1310                inspector/debugger/stepping/stepping-try-catch-finally.html
1311
1312         * inspector/InspectorDOMDebuggerAgent.h:
1313         * inspector/InspectorDOMDebuggerAgent.cpp:
1314         (WebCore::InspectorDOMDebuggerAgent::stepInto): Deleted.
1315         Setting this state in step-into does not make sense since we do not
1316         know when the debugger resumes and won't know when to clear it.
1317
1318 2016-09-30  Alex Christensen  <achristensen@webkit.org>
1319
1320         Fix off-by-one error in URLParser::parseIPv4Host
1321         https://bugs.webkit.org/show_bug.cgi?id=162789
1322
1323         Reviewed by Tim Horton.
1324
1325         The spec says "If any but the last item in numbers is greater than 255, return failure."
1326         This means check up to size - 1, not size - 2.
1327
1328         Covered by a new API test.
1329
1330         * platform/URLParser.cpp:
1331         (WebCore::URLParser::parseIPv4Host):
1332
1333 2016-09-30  Alex Christensen  <achristensen@webkit.org>
1334
1335         URLParser: parsing a URL with an empty host and a colon should fail
1336         https://bugs.webkit.org/show_bug.cgi?id=162795
1337
1338         Reviewed by Tim Horton.
1339
1340         Covered by new API tests.
1341
1342         * platform/URLParser.cpp:
1343         (WebCore::URLParser::parseHostAndPort):
1344
1345 2016-09-30  Alex Christensen  <achristensen@webkit.org>
1346
1347         URLParser: handle syntax violations in non-UTF-8 encoded queries
1348         https://bugs.webkit.org/show_bug.cgi?id=162770
1349
1350         Reviewed by Tim Horton.
1351
1352         There is a fast path for queries of URLs that use UTF-8 encoding, which are quite common.
1353         For non-UTF-8 encoded queries, which are less common, we put the code points in a Vector<UChar>
1354         and encode them all at once.  If there is a syntax violation in the query, we need to copy the
1355         syntax-violation-free string up to the beginning of the query, then encode the query.
1356
1357         Covered by new API tests.
1358
1359         * platform/URLParser.cpp:
1360         (WebCore::URLParser::percentEncodeByte):
1361         (WebCore::URLParser::encodeQuery):
1362         (WebCore::URLParser::parse):
1363         * platform/URLParser.h:
1364
1365 2016-09-27  Anders Carlsson  <andersca@apple.com>
1366
1367         Remove a couple of unused members from PlatformKeyboardEvent
1368         https://bugs.webkit.org/show_bug.cgi?id=162641
1369
1370         Reviewed by Tim Horton.
1371
1372         * platform/PlatformKeyboardEvent.h:
1373         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
1374         (WebCore::PlatformKeyboardEvent::nativeVirtualKeyCode): Deleted.
1375         (WebCore::PlatformKeyboardEvent::macCharCode): Deleted.
1376         * platform/mac/PlatformEventFactoryMac.mm:
1377         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
1378         * replay/SerializationMethods.cpp:
1379         (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
1380         (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):
1381
1382 2016-09-30  Antti Koivisto  <antti@apple.com>
1383
1384         Remove "rem" unit optimization for document element font size changes
1385         https://bugs.webkit.org/show_bug.cgi?id=162778
1386
1387         Reviewed by Alex Christensen.
1388
1389         We awkwardly track from the parser level if any stylesheet in a document uses any rem units. This is only used to minimally
1390         optimize a case where document element's (<html>) font size changes dynamically.
1391
1392         In practice such changes are rare. Browsing around I couldn't find a single case where this optimization got used.
1393         Even if it was used it would be of low value as a full style resolution is likely to happen anyway (as font inherits)
1394         and the only thing really saved is that we don't need to invalidate the matched properties cache.
1395
1396         * css/CSSGrammar.y.in:
1397         * css/StyleSheetContents.cpp:
1398         (WebCore::StyleSheetContents::StyleSheetContents):
1399         * css/StyleSheetContents.h:
1400         * dom/AuthorStyleSheets.cpp:
1401         (WebCore::AuthorStyleSheets::updateActiveStyleSheets):
1402         * dom/AuthorStyleSheets.h:
1403         (WebCore::AuthorStyleSheets::usesRemUnits): Deleted.
1404         (WebCore::AuthorStyleSheets::setUsesRemUnit): Deleted.
1405         * dom/Document.cpp:
1406         (WebCore::Document::recalcStyle):
1407         (WebCore::Document::updateBaseURL):
1408         * style/StyleTreeResolver.cpp:
1409         (WebCore::Style::TreeResolver::resolveElement):
1410
1411 2016-09-30  Zalan Bujtas  <zalan@apple.com>
1412
1413         RenderLayer::clipRects may return nullptr.
1414         https://bugs.webkit.org/show_bug.cgi?id=162729
1415
1416         Reviewed by Chris Dumez.
1417
1418         This patch refactors RenderLayer::updateClipRects(), parentClipRects() and backgroundClipRect()
1419         so that we don't have to rely on this seemingly unsafe line: clipRects = *parent()->clipRects(clipRectsContext);
1420         Now updateClipRects() returns the computed/cached clip rects as opposed to update and refetch them.
1421         While this patch makes the code look more readable/safer, it also eliminates cached item tripple retrievals.  
1422
1423         No change in functionality.
1424
1425         * rendering/RenderLayer.cpp:
1426         (WebCore::ClipRectsCache::getClipRects):
1427         (WebCore::ClipRectsCache::setClipRects):
1428         (WebCore::RenderLayer::updateClipRects):
1429         (WebCore::RenderLayer::clipRects):
1430         (WebCore::RenderLayer::calculateClipRects):
1431         * rendering/RenderLayer.h:
1432
1433 2016-09-30  Youenn Fablet  <youenn@apple.com>
1434
1435         Add a way to go from a RefPtr<T> to Ref<const T>
1436         https://bugs.webkit.org/show_bug.cgi?id=162683
1437
1438         Reviewed by Alex Christensen.
1439
1440         No change of behavior.
1441
1442         * Modules/fetch/FetchBody.cpp:
1443         (WebCore::FetchBody::extract):
1444
1445 2016-09-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1446
1447         Unreviewed, fix 32-bit build.
1448
1449         * loader/cache/CachedImage.cpp:
1450         (WebCore::CachedImage::decodedSizeChanged):
1451
1452 2016-09-30  Youenn Fablet  <youenn@apple.com>
1453
1454         FetchBody should use UTF8Encoding to encode text data
1455         https://bugs.webkit.org/show_bug.cgi?id=162775
1456
1457         Reviewed by Sam Weinig.
1458
1459         Covered by added tests.
1460
1461         Removing unnecesary vector allocation when extracting UTF8 bytes from a Request/Response text/URLSearchParams body.
1462         Making use of UTF8Encoding for consistency with  the upload code path.
1463
1464         * Modules/fetch/FetchBody.cpp:
1465         (WebCore::FetchBody::consumeAsStream):
1466         (WebCore::FetchBody::consumeText):
1467         (WebCore::extractBytesFromText): Deleted.
1468
1469 2016-09-30  Said Abou-Hallawa  <sabouhallawa@apple.com>
1470
1471         Change the MemoryCache and CachedResource adjustSize functions to take a long argument
1472         https://bugs.webkit.org/show_bug.cgi?id=162708
1473         <rdar://problem/28555702>
1474
1475         Reviewed by Brent Fulgham.
1476
1477         Because the MemoryCache stores the size of the cached memory in unsigned,
1478         two problems my happen when reporting a change in the size of the memory:
1479         
1480         1. Signed integer overflow -- which can happen because MemoryCache::adjustSize()
1481            takes a signed integer argument. If the allocated or the freed memory size is
1482            larger than the maximum of a signed integer, an overflow will happen.
1483            For the image caching code, this can be seen where the unsigned decodedSize
1484            is casted to an integer before passing it to ImageObserver::decodedSizeChanged().
1485
1486         2. Unsigned integer overflow -- which can happen if the new allocated memory
1487            size plus the currentSize exceeds the maximum of unsigned.
1488            This can be seen in MemoryCache::adjustSize() where we add delta to m_liveSize
1489            or m_deadSize without checking whether this addition will overflow or not. We
1490            do not assert for overflow although we assert for underflow.
1491            
1492         The fix for these two problems can be the following:
1493         
1494         1. Make all the adjustSize functions all the way till MemoryCache::adjustSize()
1495            take a signed long integer argument.
1496            
1497         2. Do not create a NativeImagePtr for an ImageFrame if its frameBytes plus the
1498            ImageFrameCache::decodedSize() will exceed the maximum of an unsigned integer.
1499
1500         * loader/cache/CachedImage.cpp:
1501         (WebCore::CachedImage::decodedSizeChanged): Change the argument to be long. No overflow will happen when casting the argument from unsigned to long.
1502         * loader/cache/CachedImage.h:
1503         * loader/cache/CachedResource.cpp: 
1504         (WebCore::CachedResource::setDecodedSize): Use long integer casting when calling MemoryCache::adjustSize().
1505         (WebCore::CachedResource::setEncodedSize): Ditto.
1506         * loader/cache/MemoryCache.cpp:
1507         (WebCore::MemoryCache::MemoryCache): Add as static assert to ensure sizeof(long long) can hold any unsigned or its negation.
1508         (WebCore::MemoryCache::revalidationSucceeded): Use long integer casting when calling MemoryCache::adjustSize().
1509         (WebCore::MemoryCache::remove): Ditto.
1510         (WebCore::MemoryCache::adjustSize): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long.
1511         * loader/cache/MemoryCache.h:
1512         * platform/graphics/ImageFrameCache.cpp:
1513         (WebCore::ImageFrameCache::destroyIncompleteDecodedData): Call a function with its new name.
1514         (WebCore::ImageFrameCache::decodedSizeChanged): Change the function argument to long integer. No overflow will happen when casting the argument from unsigned to long.
1515         (WebCore::ImageFrameCache::decodedSizeIncreased): Use long integer casting when calling decodedSizeChanged().
1516         (WebCore::ImageFrameCache::decodedSizeDecreased): Ditto.
1517         (WebCore::ImageFrameCache::decodedSizeReset): Ditto.
1518         (WebCore::ImageFrameCache::didDecodeProperties): Ditto.
1519         (WebCore::ImageFrameCache::frameAtIndex): Do not create the NativeImage if adding its frameByes to the MemoryCache will cause numerical overflow.
1520         (WebCore::ImageFrameCache::decodedSizeIncremented): Deleted. This function is renamed decodedSizeIncreased().
1521         (WebCore::ImageFrameCache::decodedSizeDecremented): Deleted. This function is renamed decodedSizeDecreased().
1522         * platform/graphics/ImageFrameCache.h:
1523         * platform/graphics/ImageObserver.h:
1524         * platform/graphics/IntSize.h:
1525         (WebCore::IntSize::unclampedArea): Returns the area of an IntSize in size_t.
1526         * platform/graphics/cg/PDFDocumentImage.cpp:
1527         (WebCore::PDFDocumentImage::decodedSizeChanged): Use long integer casting when calling ImageObserver::decodedSizeChanged().
1528
1529 2016-09-30  Chris Dumez  <cdumez@apple.com>
1530
1531         Add support for ImageData.data attribute
1532         https://bugs.webkit.org/show_bug.cgi?id=162767
1533
1534         Reviewed by Sam Weinig.
1535
1536         Add support for ImageData.data attribute:
1537         - https://html.spec.whatwg.org/#imagedata
1538
1539         Firefox already supports it.
1540
1541         No new tests, updated existing tests.
1542
1543         * html/ImageData.idl:
1544
1545 2016-09-30  Youenn Fablet  <youenn@apple.com>
1546
1547         DumpRenderTree crashed in com.apple.WebCore: WTF::Optional<WebCore::FetchBodyOwner::BlobLoader>::operator bool const + 12
1548         https://bugs.webkit.org/show_bug.cgi?id=162483
1549
1550         Reviewed by Alex Christensen.
1551
1552         Test: fetch/closing-while-fetching-blob.html
1553         No change of behavior.
1554
1555         * Modules/fetch/FetchBodyOwner.cpp:
1556         (WebCore::FetchBodyOwner::stop): Asserting m_blobLoader is null (meaning that unsetPendingActivity was done)
1557         only in case FetchBodyOwner has no risk being destroyed.
1558
1559 2016-09-30  Youenn Fablet  <youennf@gmail.com>
1560
1561         [Fetch API] Add support for URLSearchParams body
1562         https://bugs.webkit.org/show_bug.cgi?id=162667
1563
1564         Reviewed by Alex Christensen.
1565
1566         Tests: imported/w3c/web-platform-tests/fetch/api/basic/request-upload-worker.html
1567                imported/w3c/web-platform-tests/fetch/api/basic/request-upload.html
1568
1569         * Modules/fetch/FetchBody.cpp:
1570         (WebCore::extractBytesFromText): Moving to a static function that should be moved to a String method.
1571         (WebCore::FetchBody::FetchBody): Adding constructor for URLSearchParams.
1572         (WebCore::FetchBody::extract): Adding URLSearchParams body initialization.
1573         (WebCore::FetchBody::consume): Consuming URLSearchParams bodies.
1574         (WebCore::FetchBody::consumeAsStream): Ditto.
1575         (WebCore::FetchBody::consumeText): Updated to take a parameter to handle both text and URLSearchParams bodies.
1576         (WebCore::FetchBody::bodyForInternalRequest): Add URLSearchParams body upload.
1577         (WebCore::FetchBody::clone): Add URLSearchParams body cloning
1578         * Modules/fetch/FetchBody.h:
1579         (WebCore::FetchBody::urlSearchParamsBody):
1580         * html/URLSearchParams.cpp:
1581         (WebCore::URLSearchParams::toString):
1582         * html/URLSearchParams.h:
1583
1584 2016-09-29  Simon Fraser  <simon.fraser@apple.com>
1585
1586         Re-order the arguments to drawPattern() functions
1587         https://bugs.webkit.org/show_bug.cgi?id=162772
1588
1589         Reviewed by Zalan Bujtas.
1590         
1591         Re-order the arguments to have the destination rect come near the front,
1592         leaving CompositeOperator and BlendMode hanging out at the back like
1593         other drawing functions.
1594
1595         No behavior change.
1596
1597         * platform/graphics/BitmapImage.cpp:
1598         (WebCore::BitmapImage::drawPattern):
1599         * platform/graphics/BitmapImage.h:
1600         * platform/graphics/CrossfadeGeneratedImage.cpp:
1601         (WebCore::CrossfadeGeneratedImage::drawPattern):
1602         * platform/graphics/CrossfadeGeneratedImage.h:
1603         * platform/graphics/GeneratedImage.h:
1604         * platform/graphics/GradientImage.cpp:
1605         (WebCore::GradientImage::drawPattern):
1606         * platform/graphics/GradientImage.h:
1607         * platform/graphics/GraphicsContext.h:
1608         * platform/graphics/Image.cpp:
1609         (WebCore::Image::drawTiled):
1610         * platform/graphics/Image.h:
1611         * platform/graphics/ImageBuffer.h:
1612         * platform/graphics/NamedImageGeneratedImage.cpp:
1613         (WebCore::NamedImageGeneratedImage::drawPattern):
1614         * platform/graphics/NamedImageGeneratedImage.h:
1615         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1616         (WebCore::GraphicsContext::drawPattern):
1617         * platform/graphics/cairo/ImageBufferCairo.cpp:
1618         (WebCore::ImageBuffer::drawPattern):
1619         * platform/graphics/cairo/ImageCairo.cpp:
1620         (WebCore::Image::drawPattern):
1621         * platform/graphics/cg/GraphicsContextCG.cpp:
1622         (WebCore::GraphicsContext::drawPattern):
1623         * platform/graphics/cg/ImageBufferCG.cpp:
1624         (WebCore::ImageBuffer::drawPattern):
1625         * platform/graphics/cg/ImageCG.cpp: This file can probably be removed and the code moved, since the
1626         code is almost the same as the cairo code, and not platform-specific.
1627         (WebCore::Image::drawPattern):
1628         * platform/graphics/displaylists/DisplayListItems.cpp:
1629         (WebCore::DisplayList::DrawPattern::DrawPattern):
1630         (WebCore::DisplayList::DrawPattern::apply):
1631         * platform/graphics/displaylists/DisplayListItems.h:
1632         (WebCore::DisplayList::DrawPattern::create):
1633         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1634         (WebCore::DisplayList::Recorder::drawPattern):
1635         * platform/graphics/displaylists/DisplayListRecorder.h:
1636         * svg/graphics/SVGImage.cpp:
1637         (WebCore::SVGImage::drawPatternForContainer):
1638         * svg/graphics/SVGImageForContainer.cpp:
1639         (WebCore::SVGImageForContainer::drawPattern):
1640         * svg/graphics/SVGImageForContainer.h:
1641
1642 2016-09-29  Chris Dumez  <cdumez@apple.com>
1643
1644         Add support for download attribute on area elements
1645         https://bugs.webkit.org/show_bug.cgi?id=162765
1646
1647         Reviewed by Brent Fulgham.
1648
1649         Add support for download attribute on area elements:
1650         - https://html.spec.whatwg.org/#htmlanchorelement
1651
1652         Because HTMLAreaElement inherits from HTMLAnchorElement on native side,
1653         and because HTMLAnchorElement already supports the download attribute,
1654         all that was needed was to add the download attribute to
1655         HTMLAreaElement.idl file.
1656
1657         Test: http/tests/download/area-download.html
1658
1659         * html/HTMLAreaElement.idl:
1660
1661 2016-09-29  Ryosuke Niwa  <rniwa@webkit.org>
1662
1663         Editor::findStringAndScrollToVisible is unused
1664         https://bugs.webkit.org/show_bug.cgi?id=162762
1665
1666         Reviewed by Simon Fraser.
1667
1668         Deleted the unused function.
1669
1670         * editing/Editor.cpp:
1671         (WebCore::Editor::findStringAndScrollToVisible): Deleted.
1672         * editing/Editor.h:
1673
1674 2016-09-29  Jiewen Tan  <jiewen_tan@apple.com>
1675
1676         Expose CryptoKey to web workers
1677         https://bugs.webkit.org/show_bug.cgi?id=162640
1678         <rdar://problem/28182204>
1679
1680         Reviewed by Brent Fulgham.
1681
1682         Tests: crypto/workers/aes-postMessage-worker.html
1683                crypto/workers/hmac-postMessage-worker.html
1684                crypto/workers/hrsa-postMessage-worker.html
1685                crypto/workers/multiple-postMessage-worker.html
1686                crypto/workers/rsa-postMessage-worker.html
1687
1688         * crypto/CryptoKey.idl:
1689         * crypto/SerializedCryptoKeyWrap.h:
1690         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
1691         (WebCore::deleteDefaultWebCryptoMasterKey):
1692         Add a way to delete the default web crypto master key such that we can test
1693         these APIs and cleanup.
1694         * workers/WorkerGlobalScope.cpp:
1695         (WebCore::WorkerGlobalScope::wrapCryptoKey):
1696         (WebCore::WorkerGlobalScope::unwrapCryptoKey):
1697         * workers/WorkerGlobalScope.h:
1698
1699 2016-09-29  Nan Wang  <n_wang@apple.com>
1700
1701         AX: iOS: Tapping <input> in Safari zooms in a bit when page has max scale = 1
1702         https://bugs.webkit.org/show_bug.cgi?id=162471
1703
1704         Reviewed by Simon Fraser.
1705
1706         If the author has defined a maximum scale, we should honor that when keyboard focus moves
1707         to a text field, instead of using the forceAlwaysUserScalableMaximumScale.
1708
1709         Tests: fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-author-defined-scale.html
1710                fast/forms/ios/user-scalable-does-not-scale-for-keyboard-focus-with-user-scalable-no.html
1711                fast/forms/ios/user-scalable-scales-for-keyboard-focus-with-no-author-defined-scale.html
1712
1713         * page/ViewportConfiguration.cpp:
1714         (WebCore::ViewportConfiguration::allowsUserScaling):
1715         (WebCore::ViewportConfiguration::allowsUserScalingIgnoringAlwaysScalable):
1716         (WebCore::ViewportConfiguration::allowsUserScalingIgnoringForceAlwaysScaling): Deleted.
1717         * page/ViewportConfiguration.h:
1718         (WebCore::ViewportConfiguration::maximumScaleIgnoringAlwaysScalable):
1719         (WebCore::ViewportConfiguration::maximumScale): Deleted.
1720
1721 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1722
1723         Fix syntax violation handling in IPv4 address parsing
1724         https://bugs.webkit.org/show_bug.cgi?id=162756
1725
1726         Reviewed by Tim Horton.
1727
1728         When we are parsing the up to 4 numbers in an IPv4 address, if we find a syntax violation 
1729         (the canonicalized address would be different than the input string) then wait to report
1730         it until we have determined that this is a valid IPv4 address that will be canonicalized.
1731         If it is not a valid IPv4 address, then we will just treat the characters as the host, and
1732         that could be no syntax violation.
1733
1734         Covered by a new API test and existing API tests.
1735
1736         * platform/URLParser.cpp:
1737         (WebCore::URLParser::URLParser):
1738         (WebCore::URLParser::parseIPv4Number):
1739         (WebCore::URLParser::parseIPv4Host):
1740         * platform/URLParser.h:
1741
1742 2016-09-29  Chris Dumez  <cdumez@apple.com>
1743
1744         Fix post-landing nits after r206561.
1745         https://bugs.webkit.org/show_bug.cgi?id=162659
1746
1747         Reviewed by Alex Christensen.
1748
1749         Uses more StringViews and constness.
1750
1751         * dom/SecurityContext.cpp:
1752         (WebCore::SecurityContext::isSupportedSandboxPolicy):
1753         * dom/SecurityContext.h:
1754         * html/DOMTokenList.cpp:
1755         (WebCore::DOMTokenList::DOMTokenList):
1756         (WebCore::DOMTokenList::supports):
1757         * html/DOMTokenList.h:
1758         (WebCore::DOMTokenList::DOMTokenList):
1759         * html/HTMLAnchorElement.cpp:
1760         (WebCore::HTMLAnchorElement::relList):
1761         * html/HTMLIFrameElement.cpp:
1762         (WebCore::HTMLIFrameElement::sandbox):
1763         * html/HTMLLinkElement.cpp:
1764         (WebCore::HTMLLinkElement::relList):
1765         * html/LinkRelAttribute.cpp:
1766         (WebCore::LinkRelAttribute::isSupported):
1767         * html/LinkRelAttribute.h:
1768
1769 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1770
1771         URLParser should correctly parse ports with leading 0's
1772         https://bugs.webkit.org/show_bug.cgi?id=162752
1773
1774         * platform/URLParser.cpp:
1775         (WebCore::URLParser::parsePort):
1776         Followup.  Remove branches based on Geoffrey's feedback.
1777
1778 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1779
1780         URLParser should correctly parse ports with leading 0's
1781         https://bugs.webkit.org/show_bug.cgi?id=162752
1782
1783         Reviewed by Tim Horton.
1784
1785         Covered by new API tests.
1786
1787         * platform/URLParser.cpp:
1788         (WebCore::URLParser::parsePort):
1789
1790 2016-09-29  Commit Queue  <commit-queue@webkit.org>
1791
1792         Unreviewed, rolling out r206483.
1793         https://bugs.webkit.org/show_bug.cgi?id=162750
1794
1795         May have caused iOS perf regression (Requested by smfr on
1796         #webkit).
1797
1798         Reverted changeset:
1799
1800         "REGRESSION (r204552): Yelp carousel animation is not smooth."
1801         https://bugs.webkit.org/show_bug.cgi?id=162632
1802         http://trac.webkit.org/changeset/206483
1803
1804 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1805
1806         URLParser: make parsing invalid IPv4 addresses more robust and correct
1807         https://bugs.webkit.org/show_bug.cgi?id=162746
1808
1809         Reviewed by Tim Horton.
1810
1811         If parsing an IPv4 address fails, the characters are just treated as a regular domain.
1812
1813         Covered by new API tests.
1814
1815         * platform/URLParser.cpp:
1816         (WebCore::URLParser::parseIPv4Number):
1817         (WebCore::URLParser::parseIPv4Host):
1818
1819 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1820
1821         URLParser: IPv6 addresses followed by a colon are invalid
1822         https://bugs.webkit.org/show_bug.cgi?id=162747
1823
1824         Reviewed by Tim Horton.
1825
1826         Covered by new API tests.
1827
1828         * platform/URLParser.cpp:
1829         (WebCore::URLParser::parseIPv6Host):
1830
1831 2016-09-29  Antoine Quint  <graouts@apple.com>
1832
1833         [Modern Media Controls] scheduler for layout nodes
1834         https://bugs.webkit.org/show_bug.cgi?id=162726
1835         <rdar://problem/28543043>
1836
1837         Reviewed by Dean Jackson.
1838
1839         For the work on the modern media controls we will be using a tree of LayoutNode objects that will
1840         commit to the DOM in coordinated `requestAnimationFrame()` calls to ensure all layouts are done
1841         in an efficient and coordinated manner. As a preamble, we introduce a `scheduler` singleton which
1842         provides a single public method `scheduleLayout(callback)` to queue callbacks to be fired in the
1843         next `requestAnimationFrame()` callback.
1844
1845         Tests: media/modern-media-controls/scheduler/not-reentrant.html
1846                media/modern-media-controls/scheduler/single-callback-when-registered-multiple-times.html
1847
1848         * Modules/modern-media-controls/controls/scheduler.js: Added.
1849         (const.scheduler.new.prototype.scheduleLayout):
1850         (const.scheduler.new.prototype._requestFrameIfNeeded):
1851         (const.scheduler.new.prototype._frameDidFire):
1852         (const.scheduler.new.prototype._layout):
1853
1854 2016-09-28  Ryosuke Niwa  <rniwa@webkit.org>
1855
1856         Text nodes assigned to a linked slot are not clickable
1857         https://bugs.webkit.org/show_bug.cgi?id=162091
1858         <rdar://problem/28383300>
1859
1860         Reviewed by Antti Koivisto.
1861
1862         The bug was caused by updateMouseEventTargetNode adjusting the target to its parent element when
1863         the original target was a text node. Fixed the bug by using the parent element in the composed tree.
1864
1865         Also fixed the bug that the hit testing was not finding the anchor element and keeping the cursor
1866         in I-beam by traversing the composed tree instead.
1867
1868         Test: fast/shadow-dom/click-text-inside-linked-slot.html
1869
1870         * dom/Node.cpp:
1871         (WebCore::Node::enclosingLinkEventParentOrSelf): Fixed the cursor problem.
1872         * page/EventHandler.cpp:
1873         (WebCore::EventHandler::updateMouseEventTargetNode): Fixed the activation problem.
1874
1875 2016-09-29  Sam Weinig  <sam@webkit.org>
1876
1877         Allow overriding some NSURLSessionConfiguration properties on a per-NetworkProcess basis
1878         <rdar://problem/27648683>
1879         https://bugs.webkit.org/show_bug.cgi?id=162735
1880
1881         Reviewed by Dan Bernstein.
1882
1883         * platform/spi/cf/CFNetworkSPI.h:
1884         Forward declare _sourceApplicationSecondaryIdentifier and _CTDataConnectionServiceType
1885
1886 2016-09-29  Antti Koivisto  <antti@apple.com>
1887
1888         Remove addSubresourceStyleURLs functions
1889         https://bugs.webkit.org/show_bug.cgi?id=162731
1890
1891         Reviewed by Ryosuke Niwa.
1892
1893         Use the generic std::function taking traverseSubresources instead. This prevents bugs caused by the code paths
1894         not being in sync.
1895
1896         These functions are only used by the legacy webarchive code to gather URLs to locate CachedResources from the memory cache.
1897         This can be improved further by returning the cached resources themselves instead of the URLs.
1898
1899         * css/CSSFontFaceSrcValue.cpp:
1900         (WebCore::CSSFontFaceSrcValue::addSubresourceStyleURLs): Deleted.
1901         * css/CSSFontFaceSrcValue.h:
1902         * css/CSSPrimitiveValue.cpp:
1903         (WebCore::CSSPrimitiveValue::addSubresourceStyleURLs): Deleted.
1904         * css/CSSPrimitiveValue.h:
1905         * css/CSSReflectValue.cpp:
1906         (WebCore::CSSReflectValue::addSubresourceStyleURLs): Deleted.
1907         * css/CSSReflectValue.h:
1908         * css/CSSValue.cpp:
1909         (WebCore::CSSValue::addSubresourceStyleURLs): Deleted.
1910         * css/CSSValue.h:
1911         * css/CSSValueList.cpp:
1912         (WebCore::CSSValueList::addSubresourceStyleURLs): Deleted.
1913         * css/CSSValueList.h:
1914         * css/StyleProperties.cpp:
1915         (WebCore::StyleProperties::addSubresourceStyleURLs): Deleted.
1916         * css/StyleProperties.h:
1917         * css/StyleRuleImport.h:
1918         * css/StyleSheetContents.cpp:
1919         (WebCore::StyleSheetContents::traverseSubresources):
1920
1921             Fix a bug where this would miss @import rules in @imported stylesheets.
1922             Include the CachedResource for the imported stylesheet itself.
1923
1924             Tested by the test cases under LayoutTests/webarchive
1925
1926         (WebCore::StyleSheetContents::addSubresourceStyleURLs): Deleted.
1927         * css/StyleSheetContents.h:
1928         * dom/StyledElement.cpp:
1929         (WebCore::StyledElement::addSubresourceAttributeURLs):
1930         * html/HTMLLinkElement.cpp:
1931         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
1932         * html/HTMLStyleElement.cpp:
1933         (WebCore::HTMLStyleElement::addSubresourceAttributeURLs):
1934
1935 2016-09-29  Brent Fulgham  <bfulgham@apple.com>
1936
1937         [Win][Direct2D] Add D2D Font handling code
1938         https://bugs.webkit.org/show_bug.cgi?id=162712
1939
1940         Reviewed by Brent Fulgham.
1941
1942         This patch lands a set of new files that implement 
1943
1944         No new tests until complete backend lands.
1945
1946         * platform/graphics/Font.h:
1947         * platform/graphics/FontCascade.h:
1948         (WebCore::FontCascade::syntheticObliqueAngle): Added helper function.
1949         * platform/graphics/FontPlatformData.h:
1950         (WebCore::FontPlatformData::dwFont): Added.
1951         (WebCore::FontPlatformData::dwFontFace): Ditto.
1952         * platform/graphics/GlyphBuffer.h:
1953         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1954         (WebCore::FontCascade::drawGlyphs): Use helper function.
1955         * platform/graphics/win/FontCGWin.cpp:
1956         (WebCore::FontCascade::drawGlyphs): Ditto.
1957         * platform/graphics/win/FontCacheWin.cpp:
1958         (WebCore::FontCache::createFontPlatformData): Add case for Direct2D.
1959         * platform/graphics/win/FontCascadeDirect2D.cpp: Added.
1960         * platform/graphics/win/FontCustomPlatformData.cpp:
1961         (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Fix whitespace.
1962         (WebCore::FontCustomPlatformData::fontPlatformData): Add Direct2D case.
1963         * platform/graphics/win/FontPlatformDataCGWin.cpp:
1964         (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers.
1965         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
1966         (WebCore::FontPlatformData::FontPlatformData): Ditto.
1967         * platform/graphics/win/FontPlatformDataDirect2D.cpp: Added.
1968         * platform/graphics/win/FontPlatformDataWin.cpp:
1969         (WebCore::FontPlatformData::FontPlatformData): Clean up C++ initializers.
1970         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp: Added.
1971         * platform/graphics/win/SimpleFontDataDirect2D.cpp: Added.
1972         * platform/graphics/win/TextAnalyzerHelper.cpp: Added.
1973         * platform/graphics/win/TextAnalyzerHelper.h: Added.
1974
1975 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1976
1977         URLParser should fail to parse unclosed IPv6 addresses
1978         https://bugs.webkit.org/show_bug.cgi?id=162715
1979
1980         Reviewed by Tim Horton.
1981
1982         Covered by new API tests.
1983
1984         * platform/URLParser.cpp:
1985         (WebCore::URLParser::parseHostAndPort):
1986
1987 2016-09-29  Alex Christensen  <achristensen@webkit.org>
1988
1989         URLParser should ignore tabs at all possible locations
1990         https://bugs.webkit.org/show_bug.cgi?id=162711
1991
1992         Reviewed by Tim Horton.
1993
1994         The URL spec says to remove all tabs and newlines before parsing a URL.
1995         To reduce passes on the URL and copies of data, I chose to just ignore them every time I increment the iterator.
1996         This is fragile, but faster.  It can be completely tested, though.  That is what this patch does.
1997
1998         Covered by an addition to the API tests that tries inserting one tab at each location of each test.
1999
2000         * platform/URLParser.cpp:
2001         (WebCore::URLParser::advance):
2002         (WebCore::URLParser::isWindowsDriveLetter):
2003         (WebCore::URLParser::appendWindowsDriveLetter):
2004         (WebCore::URLParser::isPercentEncodedDot):
2005         (WebCore::URLParser::isSingleDotPathSegment):
2006         (WebCore::URLParser::isDoubleDotPathSegment):
2007         (WebCore::URLParser::consumeSingleDotPathSegment):
2008         (WebCore::URLParser::consumeDoubleDotPathSegment):
2009         (WebCore::URLParser::checkLocalhostCodePoint):
2010         (WebCore::URLParser::isAtLocalhost):
2011         (WebCore::URLParser::isLocalhost):
2012         (WebCore::URLParser::URLParser):
2013         (WebCore::URLParser::parse):
2014         (WebCore::isPercentEncodedDot): Deleted.
2015         (WebCore::isSingleDotPathSegment): Deleted.
2016         (WebCore::isDoubleDotPathSegment): Deleted.
2017         (WebCore::consumeSingleDotPathSegment): Deleted.
2018         (WebCore::consumeDoubleDotPathSegment): Deleted.
2019         * platform/URLParser.h:
2020         (WebCore::URLParser::advance):
2021
2022 2016-09-29  Simon Fraser  <simon.fraser@apple.com>
2023
2024         Fix hit testing on display:block <svg> elements
2025         https://bugs.webkit.org/show_bug.cgi?id=162717
2026         rdar://problem/23261130
2027
2028         Reviewed by Zalan Bujtas.
2029
2030         RenderSVGRoot::nodeAtPoint() needs to test for both the HitTestBlockBackground and
2031         HitTestChildBlockBackground phases, since we only get the HitTestChildBlockBackground
2032         phase when the <svg> is a block. This is similar to code in RenderTable::nodeAtPoint(),
2033         and matches Blink code.
2034         
2035         This fixes the point dragging on http://anthonydugois.com/svg-path-builder/.
2036
2037         Test: svg/hittest/block-svg.html
2038
2039         * rendering/svg/RenderSVGRoot.cpp:
2040         (WebCore::RenderSVGRoot::nodeAtPoint):
2041
2042 2016-09-29  Chris Dumez  <cdumez@apple.com>
2043
2044         Assigning non-numeric to input.minlength should set minlength to 0
2045         https://bugs.webkit.org/show_bug.cgi?id=162727
2046
2047         Reviewed by Ryosuke Niwa.
2048
2049         There was a typo when we were updating the m_minLength member from the 'min'
2050         content attribute instead of the 'minlength' one.
2051
2052         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/minlength.html.
2053
2054         * html/HTMLInputElement.cpp:
2055         (WebCore::HTMLInputElement::parseAttribute):
2056
2057 2016-09-29  Chris Dumez  <cdumez@apple.com>
2058
2059         [Web IDL] Fix overload resolution when the distinguishing argument is a Window
2060         https://bugs.webkit.org/show_bug.cgi?id=162728
2061
2062         Reviewed by Ryosuke Niwa.
2063
2064         Fix overload resolution when the distinguishing argument is a Window.
2065         Window is special because we could have a window or a proxy to the
2066         Window (JSDOMWindowShell).
2067
2068         * bindings/scripts/CodeGeneratorJS.pm:
2069         (GenerateOverloadedFunctionOrConstructor):
2070         * bindings/scripts/test/JS/JSTestObj.cpp:
2071         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
2072         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
2073         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
2074         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
2075         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
2076         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
2077         * bindings/scripts/test/TestObj.idl:
2078
2079 2016-09-29  Per Arne Vollan  <pvollan@apple.com>
2080
2081         [Win] Compile fix.
2082         https://bugs.webkit.org/show_bug.cgi?id=162262
2083
2084         Reviewed by Anders Carlsson.
2085
2086         If CoreText.h is included, we will get redefinition compile errors on some older SDK
2087         versions. 
2088
2089         * platform/spi/win/CoreTextSPIWin.h:
2090
2091 2016-09-29  Carlos Garcia Campos  <cgarcia@igalia.com>
2092
2093         [SOUP] Remove WebCoreSynchronousLoader from ResourceHandleSoup
2094         https://bugs.webkit.org/show_bug.cgi?id=162723
2095
2096         Reviewed by Sergio Villar Senin.
2097
2098         Since all soup based ports switched to NetworkProcess this is dead code.
2099
2100         * platform/network/soup/ResourceHandleSoup.cpp:
2101         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2102
2103 2016-09-29  Nan Wang  <n_wang@apple.com>
2104
2105         AX: Meter: [Mac] Content in label element should be used as AXTitle or AXDescription
2106         https://bugs.webkit.org/show_bug.cgi?id=162586
2107
2108         Reviewed by Chris Fleizach.
2109
2110         Exposed the label element's text as AXDescription for meter elements.
2111         Also refactored the code for fetching the label element's text and taken care of 
2112         the case where aria-label and aria-labelledby attributes are used on label elements. 
2113
2114         Test: accessibility/mac/meter-with-label-element.html
2115
2116         * accessibility/AccessibilityNodeObject.cpp:
2117         (WebCore::AccessibilityNodeObject::isLabelable):
2118         (WebCore::AccessibilityNodeObject::textForLabelElement):
2119         (WebCore::AccessibilityNodeObject::titleElementText):
2120         (WebCore::AccessibilityNodeObject::title):
2121         (WebCore::AccessibilityNodeObject::usesAltTagForTextComputation): Deleted.
2122         * accessibility/AccessibilityNodeObject.h:
2123         * accessibility/AccessibilityRenderObject.cpp:
2124         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
2125
2126 2016-09-29  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2127
2128         [Streams API] Improve ReadableStreamDefaultController.h/cpp
2129         https://bugs.webkit.org/show_bug.cgi?id=160293
2130
2131         Reviewed by Youenn Fablet.
2132
2133         Various small improvements in ReadableStreamDefaultController code (helper methods and asserts).
2134
2135         No change in behaviour.
2136
2137         * bindings/js/ReadableStreamDefaultController.cpp:
2138         (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked): Added an assert and updated based 
2139         on new helper methods.
2140         * bindings/js/ReadableStreamDefaultController.h:
2141         (WebCore::ReadableStreamDefaultController::close): Updated based on new helper methods.
2142         (WebCore::ReadableStreamDefaultController::error): Updated based on new helper methods.
2143         (WebCore::ReadableStreamDefaultController::enqueue): Added an assert and updated based on new helper methods.
2144         (WebCore::ReadableStreamDefaultController::jsController): New helper method.
2145         (WebCore::ReadableStreamDefaultController::globalObject): Return reference instead of pointer.
2146         (WebCore::ReadableStreamDefaultController::globalExec): New helper; return reference after performing an assert.
2147         (WebCore::ReadableStreamDefaultController::error<String>): Added an assert and updated based on new helper methods.
2148
2149 2016-09-29  Jon Davis  <jond@apple.com>
2150
2151         Added Beacon API to the Feature Status page.
2152         https://bugs.webkit.org/show_bug.cgi?id=162630
2153
2154         Reviewed by Alex Christensen.
2155
2156         * features.json:
2157
2158 2016-09-28  Chris Dumez  <cdumez@apple.com>
2159
2160         Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
2161         https://bugs.webkit.org/show_bug.cgi?id=162709
2162
2163         Reviewed by Alex Christensen.
2164
2165         Drop first 'state' parameter to JSDOMWindow::toWrapped() / JSEventTarget::toWrapped()
2166         as it is unused. This is the quickest way to allow DOMWindow / EventTarget members
2167         in IDL dictionaries. This is because the generated bindings code relies on
2168         convertWrapperType() in JSDOMConvert.h which calls toWrapped() with a single
2169         parameter. Right now, the only type that requires an ExecState for its toWrapped()
2170         is XPathNSResolver (which should likely be a callback interface rather than a
2171         regular interface).
2172
2173         * bindings/js/JSDOMWindowCustom.cpp:
2174         (WebCore::JSDOMWindow::toWrapped):
2175         * bindings/js/JSDictionary.cpp:
2176         (WebCore::JSDictionary::convertValue):
2177         * bindings/js/JSEventTargetCustom.cpp:
2178         (WebCore::JSEventTarget::toWrapped):
2179         * bindings/js/JSMessageEventCustom.cpp:
2180         (WebCore::handleInitMessageEvent):
2181         * bindings/scripts/CodeGeneratorJS.pm:
2182         (GenerateHeader):
2183         (JSValueToNative):
2184
2185 2016-09-28  Chris Dumez  <cdumez@apple.com>
2186
2187         Log console messages when the anchor download attribute is ignored
2188         https://bugs.webkit.org/show_bug.cgi?id=162703
2189
2190         Reviewed by Alex Christensen.
2191
2192         Log console messages when the anchor download attribute is ignored so
2193         that the developer can better understand what's happening.
2194
2195         No new tests, rebaselined existing tests.
2196
2197         * html/HTMLAnchorElement.cpp:
2198         (WebCore::HTMLAnchorElement::handleClick):
2199
2200 2016-09-28  Chris Dumez  <cdumez@apple.com>
2201
2202         Add support for DOMTokenList.supports()
2203         https://bugs.webkit.org/show_bug.cgi?id=162659
2204
2205         Reviewed by Ryosuke Niwa.
2206
2207         Add support for DOMTokenList.supports():
2208         - https://dom.spec.whatwg.org/#dom-domtokenlist-supports
2209
2210         Firefox and Chrome already recently implemented it (Chrome since
2211         version 50 and Firefox since version 49).
2212
2213         Test: fast/dom/DOMTokenList-supports.html
2214
2215         * dom/SecurityContext.cpp:
2216         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2217         (WebCore::SecurityContext::enforceSandboxFlags): Deleted.
2218         * dom/SecurityContext.h:
2219         * html/DOMTokenList.cpp:
2220         (WebCore::DOMTokenList::DOMTokenList):
2221         (WebCore::DOMTokenList::supports):
2222         (WebCore::DOMTokenList::replace): Deleted.
2223         * html/DOMTokenList.h:
2224         (WebCore::DOMTokenList::DOMTokenList):
2225         * html/DOMTokenList.idl:
2226         * html/HTMLAnchorElement.cpp:
2227         (WebCore::HTMLAnchorElement::parseAttribute):
2228         (WebCore::HTMLAnchorElement::relList):
2229         * html/HTMLAnchorElement.idl:
2230         * html/HTMLAreaElement.idl:
2231         * html/HTMLIFrameElement.cpp:
2232         (WebCore::HTMLIFrameElement::sandbox):
2233         * html/HTMLLinkElement.cpp:
2234         (WebCore::HTMLLinkElement::relList):
2235         * html/HTMLTableCellElement.idl:
2236         * html/LinkRelAttribute.cpp:
2237         (WebCore::LinkRelAttribute::isSupported):
2238         (WebCore::LinkRelAttribute::LinkRelAttribute): Deleted.
2239         * html/LinkRelAttribute.h:
2240
2241 2016-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2242
2243         DOMTokenList’s value and stringifier should not return parsed tokens
2244         https://bugs.webkit.org/show_bug.cgi?id=161076
2245
2246         Reviewed by Chris Dumez.
2247
2248         Updated our implementation of DOMTokenList.prototype.value and its toString function
2249         to match the latest DOM specification: https://dom.spec.whatwg.org/#interface-domtokenlist
2250
2251         "value" attribute, on getting, runs its serialize steps, which simply gets the attribute value.
2252         On setting, it sets the attribute value with the given value.
2253
2254         The stringification behavior returns the same serialize steps as "value" attribute on getting.
2255
2256         This change simplifies our implementation of DOMTokenList and removes the need for m_cachedValue,
2257         which has been removed in this patch.
2258
2259         No new tests since existing tests cover this.
2260
2261         * html/DOMTokenList.cpp:
2262         (WebCore::DOMTokenList::value): Just call getAttribute.
2263         (WebCore::DOMTokenList::setValue): Just call setAttribute.
2264         (WebCore::DOMTokenList::updateTokensFromAttributeValue):
2265         (WebCore::DOMTokenList::associatedAttributeValueChanged):
2266         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): Moved the code to update the tokens
2267         from from the attribute value. This is the "update steps".
2268         * html/DOMTokenList.h:
2269
2270 2016-09-28  Jer Noble  <jer.noble@apple.com>
2271
2272         CRASH at WebCore::CDMSessionAVStreamSession::update + 950
2273         https://bugs.webkit.org/show_bug.cgi?id=162701
2274
2275         Reviewed by Beth Dakin.
2276
2277         If the SourceBuffer backing a <video> element is removed before CDMSessionAVStreamSession::update() gets
2278         a chance to run, the protectedSourceBuffer will be null. Just bail early and indicate an error.
2279
2280         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2281         (WebCore::CDMSessionAVStreamSession::update):
2282
2283 2016-09-28  Alex Christensen  <achristensen@webkit.org>
2284
2285         URLParser should properly handle unexpected periods and overflows in IPv4 addresses
2286         https://bugs.webkit.org/show_bug.cgi?id=162655
2287
2288         Reviewed by Geoffrey Garen.
2289
2290         Covered by new API tests.
2291
2292         * platform/URLParser.cpp:
2293         (WebCore::URLParser::parseIPv4Number):
2294         (WebCore::URLParser::parseIPv4Host):
2295         * platform/URLParser.h:
2296
2297 2016-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2298
2299         Some media tests are crashing due to soft-linking failures
2300         https://bugs.webkit.org/show_bug.cgi?id=162698
2301
2302         Reviewed by Jer Noble.
2303
2304         We should be handling soft-linking failures for MRMediaRemoteSetNowPlayingVisibility gracefully. Guards these
2305         calls with canLoad_MediaRemote_MRMediaRemoteSetParentApplication and also use the
2306         SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER macro when soft linking.
2307
2308         * platform/audio/mac/MediaSessionManagerMac.mm:
2309         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
2310         * platform/mac/MediaRemoteSoftLink.cpp:
2311         * platform/mac/MediaRemoteSoftLink.h:
2312
2313 2016-09-28  Alex Christensen  <achristensen@webkit.org>
2314
2315         URLParser should ignore tabs in authority
2316         https://bugs.webkit.org/show_bug.cgi?id=162694
2317
2318         Reviewed by Geoffrey Garen.
2319
2320         Covered by new API tests.
2321
2322         * platform/URLParser.cpp:
2323         (WebCore::URLParser::parseAuthority):
2324
2325 2016-09-28  Alex Christensen  <achristensen@webkit.org>
2326
2327         URLParser should ignore extra slashes after scheme:// and handle a missing slash after the port
2328         https://bugs.webkit.org/show_bug.cgi?id=162690
2329
2330         Reviewed by Geoffrey Garen.
2331
2332         Covered by new API tests.
2333
2334         * platform/URLParser.cpp:
2335         (WebCore::URLParser::parse):
2336
2337 2016-09-28  Alex Christensen  <achristensen@webkit.org>
2338
2339         URLParser should correctly canonicalize uppercase IPv6 addresses
2340         https://bugs.webkit.org/show_bug.cgi?id=162680
2341
2342         Reviewed by Tim Horton.
2343
2344         Covered by a new API test.
2345
2346         * platform/URLParser.cpp:
2347         (WebCore::URLParser::parseIPv6Host):
2348         If there is an uppercase character in the IPv6 address part, then it is a syntax violation
2349         because the canonicalized IPv6 address differs from the input String.
2350
2351 2016-09-28  Chris Dumez  <cdumez@apple.com>
2352
2353         Unreviewed, fix iOS build.
2354
2355         * bindings/js/ios/TouchConstructors.cpp:
2356
2357 2016-09-28  Chris Dumez  <cdumez@apple.com>
2358
2359         It should be possible to dispatch events on template documents
2360         https://bugs.webkit.org/show_bug.cgi?id=162687
2361
2362         Reviewed by Ryosuke Niwa.
2363
2364         It should be possible to dispatch events on template documents. Firefox
2365         supports this. Chrome does not but this is likely not intentional as
2366         Chrome generally supports dispatching events on frameless documents.
2367
2368         Test: fast/dom/template-document-dispatchEvent.html
2369
2370         * dom/Document.cpp:
2371         (WebCore::Document::ensureTemplateDocument):
2372
2373 2016-09-27  Dean Jackson  <dino@apple.com>
2374
2375         Use Color references where possible
2376         https://bugs.webkit.org/show_bug.cgi?id=162643
2377         <rdar://problem/28506550>
2378
2379         Reviewed by Simon Fraser.
2380
2381         There were a bunch of places where we pass or use
2382         Colors by value. As the Color class gets a bit more
2383         complicated, it would be nice to avoid copying, so
2384         use references where possible.
2385
2386         * css/CSSGradientValue.cpp:
2387         (WebCore::interpolate):
2388         * css/StyleColor.h:
2389         (WebCore::StyleColor::getColor):
2390         (WebCore::StyleColor::resolve):
2391         * css/StyleResolver.h:
2392         (WebCore::StyleResolver::State::backgroundColor):
2393         * dom/Document.h:
2394         (WebCore::Document::textColor):
2395         * editing/FrameSelection.cpp:
2396         (WebCore::disappearsIntoBackground):
2397         * html/canvas/CanvasRenderingContext2D.cpp:
2398         (WebCore::CanvasRenderingContext2D::setShadow):
2399         * html/canvas/CanvasRenderingContext2D.h:
2400         * html/track/TextTrackCueGeneric.h:
2401         * page/PageOverlay.cpp:
2402         (WebCore::PageOverlay::setBackgroundColor):
2403         * page/PageOverlay.h:
2404         * page/animation/CSSPropertyAnimation.cpp:
2405         (WebCore::PropertyWrapperColor::PropertyWrapperColor):
2406         (WebCore::PropertyWrapperMaybeInvalidColor::PropertyWrapperMaybeInvalidColor):
2407         (WebCore::PropertyWrapperVisitedAffectedColor::PropertyWrapperVisitedAffectedColor):
2408         * platform/graphics/GraphicsContext.cpp:
2409         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2410         * platform/graphics/GraphicsContext.h:
2411         (WebCore::GraphicsContext::strokeColor):
2412         (WebCore::GraphicsContext::fillColor):
2413         * platform/graphics/InbandTextTrackPrivateClient.h:
2414         (WebCore::GenericCueData::foregroundColor):
2415         (WebCore::GenericCueData::setForegroundColor):
2416         (WebCore::GenericCueData::backgroundColor):
2417         (WebCore::GenericCueData::setBackgroundColor):
2418         (WebCore::GenericCueData::highlightColor):
2419         (WebCore::GenericCueData::setHighlightColor):
2420         * platform/graphics/ca/TileController.h:
2421         * platform/graphics/cg/GraphicsContextCG.cpp:
2422         (WebCore::GraphicsContext::drawRect):
2423         (WebCore::GraphicsContext::fillRect):
2424         (WebCore::GraphicsContext::platformFillRoundedRect):
2425         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2426         * platform/graphics/displaylists/DisplayListItems.h:
2427         (WebCore::DisplayList::DrawFocusRingPath::color):
2428         (WebCore::DisplayList::DrawFocusRingRects::color):
2429         (WebCore::DisplayList::FillRectWithColor::color):
2430         (WebCore::DisplayList::FillCompositedRect::color):
2431         (WebCore::DisplayList::FillRoundedRect::color):
2432         (WebCore::DisplayList::FillRectWithRoundedHole::color):
2433         * platform/graphics/filters/FEDiffuseLighting.cpp:
2434         (WebCore::FEDiffuseLighting::lightingColor):
2435         * platform/graphics/filters/FEDiffuseLighting.h:
2436         * platform/graphics/filters/FEDropShadow.h:
2437         (WebCore::FEDropShadow::shadowColor):
2438         * platform/graphics/filters/FEFlood.cpp:
2439         (WebCore::FEFlood::floodColor):
2440         (WebCore::FEFlood::platformApplySoftware):
2441         * platform/graphics/filters/FEFlood.h:
2442         * platform/graphics/filters/FESpecularLighting.cpp:
2443         (WebCore::FESpecularLighting::lightingColor):
2444         * platform/graphics/filters/FESpecularLighting.h:
2445         * platform/graphics/filters/FilterOperation.h:
2446         * rendering/BorderEdge.h:
2447         (WebCore::BorderEdge::color):
2448         * rendering/InlineFlowBox.cpp:
2449         (WebCore::InlineFlowBox::paintBoxDecorations):
2450         * rendering/InlineTextBox.cpp:
2451         (WebCore::InlineTextBox::paintSelection):
2452         * rendering/InlineTextBox.h:
2453         * rendering/RenderFrameSet.cpp:
2454         (WebCore::borderStartEdgeColor):
2455         (WebCore::borderEndEdgeColor):
2456         (WebCore::borderFillColor):
2457         * rendering/RenderInline.cpp:
2458         (WebCore::RenderInline::paintOutlineForLine):
2459         * rendering/RenderInline.h:
2460         * rendering/RenderLayerCompositor.h:
2461         * rendering/RenderView.cpp:
2462         (WebCore::RenderView::paintBoxDecorations):
2463         * rendering/TextDecorationPainter.cpp:
2464         (WebCore::TextDecorationPainter::paintTextDecoration):
2465         * rendering/TextPainter.cpp:
2466         (WebCore::TextPainter::paintTextWithShadows):
2467         * rendering/style/BorderValue.h:
2468         (WebCore::BorderValue::color):
2469         * rendering/style/CollapsedBorderValue.h:
2470         (WebCore::CollapsedBorderValue::color):
2471         * rendering/style/RenderStyle.cpp:
2472         (WebCore::RenderStyle::color):
2473         (WebCore::RenderStyle::visitedLinkColor):
2474         (WebCore::RenderStyle::setColor):
2475         (WebCore::RenderStyle::setVisitedLinkColor):
2476         * rendering/style/RenderStyle.h:
2477         (WebCore::RenderStyle::borderLeftColor):
2478         (WebCore::RenderStyle::borderRightColor):
2479         (WebCore::RenderStyle::borderTopColor):
2480         (WebCore::RenderStyle::borderBottomColor):
2481         (WebCore::RenderStyle::backgroundColor):
2482         (WebCore::RenderStyle::columnRuleColor):
2483         (WebCore::RenderStyle::outlineColor):
2484         (WebCore::RenderStyle::textEmphasisColor):
2485         (WebCore::RenderStyle::textFillColor):
2486         (WebCore::RenderStyle::textStrokeColor):
2487         (WebCore::RenderStyle::visitedLinkBackgroundColor):
2488         (WebCore::RenderStyle::visitedLinkBorderLeftColor):
2489         (WebCore::RenderStyle::visitedLinkBorderRightColor):
2490         (WebCore::RenderStyle::visitedLinkBorderBottomColor):
2491         (WebCore::RenderStyle::visitedLinkBorderTopColor):
2492         (WebCore::RenderStyle::visitedLinkOutlineColor):
2493         (WebCore::RenderStyle::visitedLinkColumnRuleColor):
2494         (WebCore::RenderStyle::textDecorationColor):
2495         (WebCore::RenderStyle::visitedLinkTextDecorationColor):
2496         (WebCore::RenderStyle::visitedLinkTextEmphasisColor):
2497         (WebCore::RenderStyle::visitedLinkTextFillColor):
2498         (WebCore::RenderStyle::visitedLinkTextStrokeColor):
2499         (WebCore::RenderStyle::stopColor):
2500         (WebCore::RenderStyle::floodColor):
2501         (WebCore::RenderStyle::lightingColor):
2502         * svg/SVGFEDiffuseLightingElement.cpp:
2503         (WebCore::SVGFEDiffuseLightingElement::build):
2504         * svg/SVGFEDropShadowElement.cpp:
2505         (WebCore::SVGFEDropShadowElement::build):
2506         * svg/SVGFEFloodElement.cpp:
2507         (WebCore::SVGFEFloodElement::build):
2508         * svg/SVGFESpecularLightingElement.cpp:
2509         (WebCore::SVGFESpecularLightingElement::build):
2510         * svg/SVGGradientElement.cpp:
2511         (WebCore::SVGGradientElement::buildStops):
2512
2513 2016-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2514
2515         assignedNodes should include fallback contents when flattened option is set
2516         https://bugs.webkit.org/show_bug.cgi?id=162656
2517
2518         Reviewed by Antti Koivisto.
2519
2520         Fixed the bug by traversing through fallback contents when there are no assigned nodes.
2521
2522         Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html
2523                imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html
2524
2525         * html/HTMLSlotElement.cpp:
2526         (WebCore::flattenAssignedNodes):
2527         (WebCore::HTMLSlotElement::assignedNodes):
2528
2529 2016-09-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2530
2531         Adopt MediaRemote SPI to achieve desired Now Playing behavior
2532         https://bugs.webkit.org/show_bug.cgi?id=162658
2533         <rdar://problem/28499358>
2534
2535         Reviewed by Jer Noble.
2536
2537         Restores the changes previously rolled out in r206444, and adopts new MediaRemote SPI to achieve the desired
2538         behavior for media in background tabs without breaking other features.
2539
2540         Introduces 2 new unit tests in NowPlayingControlsTests.
2541
2542         * html/MediaElementSession.cpp:
2543         (WebCore::MediaElementSession::pageAllowsNowPlayingControls):
2544         * page/Page.cpp:
2545         (WebCore::Page::setViewState):
2546         * platform/audio/PlatformMediaSessionManager.h:
2547         (WebCore::PlatformMediaSessionManager::hasActiveNowPlayingSession):
2548         * platform/audio/mac/MediaSessionManagerMac.h:
2549         * platform/audio/mac/MediaSessionManagerMac.mm:
2550         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
2551         * platform/mac/MediaRemoteSoftLink.cpp:
2552         * platform/mac/MediaRemoteSoftLink.h:
2553         * platform/spi/mac/MediaRemoteSPI.h:
2554
2555 2016-09-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
2556
2557         REGRESSION(r206481): ASSERTION FAILED: isDecoderAvailable()
2558         https://bugs.webkit.org/show_bug.cgi?id=162665
2559
2560         Reviewed by Simon Fraser.
2561
2562         Remove a wrong assertion from ImageSource::destroyDecodedData(). Before
2563         r206481, the original function BitmapImage::destroyDecodedData() did not
2564         have this assertion. Destroying the decoded ImageFrames can happen after
2565         releasing the ImageDecoder. And it can happen also if decoding the image
2566         fails and BitmapImage::isNull() is true. See CachedImage::finishLoading().
2567
2568         * platform/graphics/ImageSource.cpp:
2569         (WebCore::ImageSource::destroyDecodedData):
2570
2571 2016-09-28  Youenn Fablet  <youenn@apple.com>
2572
2573         WebCore::ResourceErrorBase::setType is crashing
2574         https://bugs.webkit.org/show_bug.cgi?id=162484
2575         <rdar://problem/28390828>
2576
2577         Reviewed by Alex Christensen.
2578
2579         Test: http/tests/xmlhttprequest/on-network-timeout-error-during-preflight.html
2580
2581         Behavior is slightly changed as we are no longer casting Timeout preflight errors as AccessControl errors.
2582         This is more inline with fetch spec which prescribes to send back any error received by preflight as response error for fetch.
2583
2584         Ideally, we should not need to change errors received during preflight loads but the error type is important for some clients:
2585         - EventSource may try to reconnect if error is not AccessControl
2586         - XMLHttpRequest will send abort events in case of Cancellation errors and timeout events in case of Timeout errors
2587
2588         * loader/CrossOriginPreflightChecker.cpp:
2589         (WebCore::CrossOriginPreflightChecker::notifyFinished): Setting error type to AccessControl except in case of Timeout.
2590         (WebCore::CrossOriginPreflightChecker::doPreflight): Ditto.
2591         * loader/DocumentThreadableLoader.cpp:
2592         (WebCore::DocumentThreadableLoader::preflightFailure): Removing ASSERT since Timeout errors may be returned.
2593         * platform/network/ResourceErrorBase.h:
2594         (WebCore::ResourceErrorBase::isGeneral): New getter.
2595
2596 2016-09-28  Jer Noble  <jer.noble@apple.com>
2597
2598         PiP shows incorrect state of play button.
2599         https://bugs.webkit.org/show_bug.cgi?id=162652
2600
2601         Reviewed by Eric Carlson.
2602
2603         After getting a new WebPlaybackSessionModel, the first thing WebVideoFullscreenInterfaceMac
2604         should do is query for it's playbackRate() and isPlaying() properties.
2605
2606         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2607         (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac):
2608
2609 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2610
2611         [GTK] Add Chrome UA quirk
2612         https://bugs.webkit.org/show_bug.cgi?id=162617
2613
2614         Reviewed by Carlos Garcia Campos.
2615
2616         Add Chrome UA quirk and use it on typekit.net, typekit.com, youtube.com, slack.com, and
2617         any domain that begins with "google".
2618
2619         * platform/gtk/UserAgentGtk.cpp:
2620         (WebCore::buildUserAgentString):
2621         (WebCore::urlRequiresChromeBrowser):
2622         (WebCore::standardUserAgentForURL):
2623
2624 2016-09-28  Jer Noble  <jer.noble@apple.com>
2625
2626         [MSE][Mac] In SourceBufferPrivateAVFObjC::abort(), support reseting parser to the last appended initialization segment.
2627         https://bugs.webkit.org/show_bug.cgi?id=135164
2628
2629         Reviewed by Eric Carlson.
2630
2631         Test: media/media-source/media-source-abort-resets-parser.html
2632
2633         Use the -[AVStreamDataParser appendStreamData:withFlags:] to implement "resetting" the parser. In this case,
2634         the parser isn't explicitly reset during resetParserState(), but rather a flag is set so that the next append
2635         signals a data discontinuity, and the parser is reset at that point.
2636
2637         Because a previous append operation may be in-flight during this abort(), care must be taken to invalidate any
2638         operations which may have already started on a background thread. So SourceBufferPrivateAVFObjC will use a
2639         separate WeakPtrFactory for its append operations, will invalidate any outstanding WeakPtrs during an abort(),
2640         and will block until the previous append() operation completes.
2641
2642         This will require the WebAVStreamDataParserListener object to occasionally have it's WeakPtr pointing back to the
2643         SourceBufferPrivateAVFObjC to be reset after an abort(), so make that ivar an @property. Rather than passing a
2644         RetainPtr to itself in all the callbacks it handles, the WebAVStreamDataParserListener can just pass in a copy
2645         of its own WeakPtr (which may be invalidated during an abort()).
2646
2647         Break the distinct operations of "abort()" and "resetParserState()" into their own methods in SourceBufferPrivate
2648         and all its subclasses.
2649
2650         * Modules/mediasource/SourceBuffer.cpp:
2651         (WebCore::SourceBuffer::resetParserState):
2652         (WebCore::SourceBuffer::abortIfUpdating):
2653         * platform/graphics/SourceBufferPrivate.h:
2654         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2655         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2656         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
2657         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
2658         (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]):
2659         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
2660         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
2661         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
2662         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
2663         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
2664         (WebCore::SourceBufferPrivateAVFObjC::append):
2665         (WebCore::SourceBufferPrivateAVFObjC::abort):
2666         (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
2667         (-[WebAVStreamDataParserListener initWithParser:parent:]): Deleted.
2668         * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:
2669         (WebCore::SourceBufferPrivateGStreamer::resetParserState):
2670         * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h:
2671         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2672         (WebCore::MockSourceBufferPrivate::resetParserState):
2673         * platform/mock/mediasource/MockSourceBufferPrivate.h:
2674         * platform/spi/mac/AVFoundationSPI.h:
2675
2676 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2677
2678         [GTK] User agent should always claim to be Intel
2679         https://bugs.webkit.org/show_bug.cgi?id=162610
2680
2681         Reviewed by Carlos Garcia Campos.
2682
2683         We should always claim to be running on Intel regardless of actual CPU type. See discussion
2684         in bug #162548 for details. In particular, we can never advertise ARM because it causes dumb
2685         websites to send mobile pages.
2686
2687         * platform/gtk/UserAgentGtk.cpp:
2688         (WebCore::platformVersionForUAString):
2689         (WebCore::buildUserAgentString):
2690         (WebCore::cpuDescriptionForUAString): Deleted.
2691
2692 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2693
2694         [GTK] Adjust OS X UA quirks list
2695         https://bugs.webkit.org/show_bug.cgi?id=162616
2696
2697         Reviewed by Carlos Garcia Campos.
2698
2699         Remove the OS X quirk for yahoo.com as it's no longer needed. Add quirks for taobao.com and
2700         whatsapp.com.
2701
2702         * platform/gtk/UserAgentGtk.cpp:
2703         (WebCore::urlRequiresMacintoshPlatform):
2704         (WebCore::standardUserAgentForURL):
2705
2706 2016-09-28  Alejandro G. Castro  <alex@igalia.com>
2707
2708         Add WebIDL special operation support: serializer
2709         https://bugs.webkit.org/show_bug.cgi?id=156293
2710
2711         Reviewed by Youenn Fablet.
2712
2713         Added support for the serializer special operation for WebIDLs,
2714         current implementation adds support for:
2715           - just the keyword: serializer; It will return all the
2716             attributes of in an object.
2717           - map of entries with the attributes: serializer = {attribute1,
2718             attribute2, ...}
2719
2720         It creates a toJSON method that returns the serialized value
2721         converted into an ECMAScript value. For more information check the
2722         definition of the operation:
2723
2724         http://heycam.github.io/webidl/#idl-serializers
2725
2726         We have created a new function in the API of the objects
2727         that are marked as serializer.
2728
2729         Used the support to add new API for RTCIceCandidate and
2730         RTCSessionDescription.
2731
2732         Updated the tests expectations of the bindings.
2733
2734         Tests: bindings/scripts/test/TestNode.idl
2735                bindings/scripts/test/TestObj.idl
2736                fast/mediastream/RTCIceCandidate.html
2737                fast/mediastream/RTCSessionDescription.html
2738
2739         * Modules/mediastream/RTCIceCandidate.idl: Added the serializer
2740         operation.
2741         * Modules/mediastream/RTCSessionDescription.idl: Added the
2742         serializer operation.
2743         * bindings/scripts/CodeGeneratorJS.pm:
2744         (GenerateImplementation): Added the calls to the serializer
2745         code generator.
2746         (GenerateSerializerFunction): Added, generates the toJSON function
2747         adding all the serializable->attributes value to an object as
2748         defined in the spec.
2749         * bindings/scripts/IDLParser.pm: Modified the serializer parser
2750         that was unused to support the WebIDL spec parts. Added a new
2751         domSerializable type to store the list of attributes in the
2752         possible map.
2753         (parseSerializer): Modified the function to follow the
2754         semicolon rule in the spec, now the serializer line must have a
2755         semicolon like any other line.
2756         (parseSerializerRest): The function now has to get the attributes
2757         list from the pattern parsing function and add them to the
2758         domSerializable item.
2759         (parseSerializationPattern): Now this function returns the list of
2760         attributes in the serializable map or list if we have one.
2761         (parseSerializationAttributes): Added, this function replaces the
2762         Map and List functions, the currently supported parts are similar
2763         for both situations.
2764         (applyMemberList): Added the serializable item to the interface
2765         variable and populate the serializable in case there is not a
2766         defined map.
2767         (parseSerializationPatternMap): Replaced with
2768         parseSerializationAttributes.
2769         (parseSerializationPatternList): Ditto.
2770         * bindings/scripts/test/JS/JSTestNode.cpp: Modified the expected result.
2771         (WebCore::jsTestNodePrototypeFunctionToJSON):
2772         * bindings/scripts/test/JS/JSTestObj.cpp: Modified the expected result.
2773         (WebCore::jsTestObjPrototypeFunctionToJSON):
2774         * bindings/scripts/test/TestNode.idl: Added the serializer test.
2775         * bindings/scripts/test/TestObj.idl: Added serializer map test.
2776
2777 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2778
2779         [GTK] Simplify platformForUAString
2780         https://bugs.webkit.org/show_bug.cgi?id=162614
2781
2782         Reviewed by Carlos Garcia Campos.
2783
2784         Note in particular that the previous PLATFORM(MAC) check was wrong here, as that is never
2785         true for GTK; this patch risks changing it to OS(MAC_OS_X), on the hope that advertising Mac
2786         when running on Mac might not break anything. If it does, then we should remove it and just
2787         always pretend to be on X11.
2788
2789         * platform/gtk/UserAgentGtk.cpp:
2790         (WebCore::platformForUAString):
2791
2792 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2793
2794         [GTK] Bump fake Safari version in UA
2795         https://bugs.webkit.org/show_bug.cgi?id=162615
2796
2797         Reviewed by Carlos Garcia Campos.
2798
2799         Pretend to be Safari 10.0 to fix sites that don't work when we pretend to be Safari 8.0.
2800
2801         * platform/gtk/UserAgentGtk.cpp:
2802         (WebCore::buildUserAgentString):
2803
2804 2016-09-28  Khaled Hosny  <khaledhosny@eglug.org>
2805
2806         Use new woff2 API
2807         https://bugs.webkit.org/show_bug.cgi?id=162608
2808
2809         Reviewed by Michael Catanzaro.
2810
2811         Test: fast/text/woff2-totalsfntsize.html
2812
2813         * platform/graphics/WOFFFileFormat.cpp:
2814         (WebCore::WOFF2VectorOut::WOFF2VectorOut):
2815         (WebCore::WOFF2VectorOut::Write):
2816         (WebCore::WOFF2VectorOut::Size):
2817         (WebCore::convertWOFFToSfnt):
2818
2819 2016-09-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2820
2821         [GTK] Add warning comment in UserAgentGtk.cpp
2822         https://bugs.webkit.org/show_bug.cgi?id=162618
2823
2824         Reviewed by Carlos Garcia Campos.
2825
2826         * platform/gtk/UserAgentGtk.cpp:
2827
2828 2016-09-28  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2829
2830         [Streams API] Align cancelReadableStream() with spec
2831         https://bugs.webkit.org/show_bug.cgi?id=162556
2832
2833         Reviewed by Xabier Rodriguez-Calvar.
2834
2835         Aligned cancelReadableStream() with Streams API. In particular, private cancel() method
2836         was added to ReadableStreamDefaultController and function name was replaced by readableStreamCancel().
2837         Implementation of cancel() (as well as pull()) is actually made in ReadableStreamInternals.js to
2838         avoid creating new function for each controller.
2839
2840         No change in behaviour.
2841
2842         * Modules/streams/ReadableStream.js:
2843         (cancel): Updated with reference to readableStreamCancel().
2844         * Modules/streams/ReadableStreamDefaultReader.js:
2845         (cancel): Updated with reference to readableStreamCancel().
2846         * Modules/streams/ReadableStreamInternals.js:
2847         (privateInitializeReadableStreamDefaultController): Refer to external functions (cancel/pull) to avoid
2848         creating new functions.
2849         (teeReadableStreamBranch2CancelFunction): Updated with reference to readableStreamCancel().
2850         (readableStreamCancel): New name for cancelReadableStream(), behaviour aligned with spec.
2851         (readableStreamDefaultControllerCancel): Added to avoid creating new function for each controller.
2852         (readableStreamDefaultControllerPull): Added to avoid creating new function for each controller.
2853         (readFromReadableStreamDefaultReader): Updated call to pull method to pass controller.
2854         * bindings/js/WebCoreBuiltinNames.h: Added "cancel".
2855
2856 2016-09-27  Joonghun Park  <jh718.park@samsung.com>
2857
2858         [EFL] Fix debug build break since r206481. Unreviewed
2859         https://bugs.webkit.org/show_bug.cgi?id=162662
2860
2861         No new tests, no new behaviours.
2862
2863         * platform/graphics/BitmapImage.cpp:
2864         (WebCore::BitmapImage::draw):
2865
2866 2016-09-27  Nan Wang  <n_wang@apple.com>
2867
2868         AX: CrashTracer: com.apple.WebKit.WebContent at WebCore::AXObjectCache::localCaretRectForCharacterOffset(WebCore::RenderObject*&, WebCore::CharacterOffset const&) + 116
2869         https://bugs.webkit.org/show_bug.cgi?id=162654
2870
2871         Reviewed by Chris Fleizach.
2872
2873         rangeForUnorderedCharacterOffsets() can return a null Range but we failed to
2874         do a null check in localCaretRectForCharacterOffset() before dereferencing it.
2875
2876         Test: accessibility/mac/bounds-for-range-crash.html
2877
2878         * accessibility/AXObjectCache.cpp:
2879         (WebCore::AXObjectCache::localCaretRectForCharacterOffset):
2880
2881 2016-09-27  Alex Christensen  <achristensen@webkit.org>
2882
2883         Inline critical functions in URLParser
2884         https://bugs.webkit.org/show_bug.cgi?id=162653
2885
2886         Reviewed by Myles C. Maxfield.
2887
2888         This gives me about a 15% speed improvement.
2889
2890         * platform/URLParser.cpp:
2891         (WebCore::CodePointIterator::CodePointIterator):
2892         (WebCore::CodePointIterator::operator==):
2893         (WebCore::CodePointIterator::operator!=):
2894         (WebCore::CodePointIterator::operator=):
2895         (WebCore::CodePointIterator::atEnd):
2896         (WebCore::CodePointIterator::codeUnitsSince):
2897         (WebCore::CodePointIterator<LChar>::operator):
2898         (WebCore::CodePointIterator<UChar>::operator):
2899         (WebCore::appendCodePoint):
2900         (WebCore::isC0Control):
2901         (WebCore::isC0ControlOrSpace):
2902         (WebCore::isTabOrNewline):
2903         (WebCore::isInSimpleEncodeSet):
2904         (WebCore::isInDefaultEncodeSet):
2905         (WebCore::isInUserInfoEncodeSet):
2906         (WebCore::isInvalidDomainCharacter):
2907         (WebCore::isPercentOrNonASCII):
2908         (WebCore::isSlashQuestionOrHash):
2909         (WebCore::isValidSchemeCharacter):
2910         (WebCore::URLParser::advance):
2911         (WebCore::URLParser::isWindowsDriveLetter):
2912         (WebCore::URLParser::appendToASCIIBuffer):
2913         (WebCore::percentEncodeByte):
2914         (WebCore::URLParser::utf8PercentEncode):
2915         (WebCore::URLParser::utf8QueryEncode):
2916         (WebCore::isDefaultPort):
2917         (WebCore::isSpecialScheme):
2918         (WebCore::isPercentEncodedDot):
2919         (WebCore::isSingleDotPathSegment):
2920         (WebCore::isDoubleDotPathSegment):
2921         (WebCore::consumeSingleDotPathSegment):
2922         (WebCore::consumeDoubleDotPathSegment):
2923         (WebCore::URLParser::popPath):
2924         (WebCore::URLParser::parsedDataView):
2925         (WebCore::URLParser::currentPosition):
2926         (WebCore::zeroSequenceLength):
2927         (WebCore::findLongestZeroSequence):
2928         (WebCore::pow256):
2929         (WebCore::percentDecode):
2930         (WebCore::containsOnlyASCII):
2931         (WebCore::domainToASCII):
2932         (WebCore::hasInvalidDomainCharacter):
2933         (WebCore::formURLDecode):
2934         (WebCore::serializeURLEncodedForm):
2935
2936 2016-09-27  Zalan Bujtas  <zalan@apple.com>
2937
2938         REGRESSION (r204552): Yelp carousel animation is not smooth.
2939         https://bugs.webkit.org/show_bug.cgi?id=162632
2940
2941         Reviewed by Simon Fraser.
2942
2943         For composited state changes when the layers don't need rebuilding, the updateGeometry() traversal
2944         is post-order (see webkit.org/162634), so we can't rely on the offsetfromRenderer() value when
2945         computing the graphics layer position on the descendants. We need this workaround until after webkit.org/162634
2946         gets fixed.
2947
2948         Tests: compositing/hidpi-composited-container-and-graphics-layer-gap-changes.html
2949                compositing/hidpi-negative-composited-bounds-on-device-pixel.html
2950
2951         * rendering/RenderLayerBacking.cpp:
2952         (WebCore::computeOffsetFromAncestorGraphicsLayer):
2953         (WebCore::ComputedOffsets::ComputedOffsets):
2954         (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
2955         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
2956
2957 2016-09-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2958
2959         Move caching the ImageFrame from BitmapImage to ImageSource
2960         https://bugs.webkit.org/show_bug.cgi?id=155498
2961
2962         Reviewed by Simon Fraser.
2963
2964         BitmapImage has two modes of operation regarding its image decoding state.
2965         The first mode happens when a remote image is loaded as encoded data and
2966         which requires an ImageDecoder to generate the image metadata and the
2967         the ImageFrames. The second mode happens when a BitmapImage is created
2968         with a NativeImagePtr. In this case, no ImageDecoder is needed.
2969
2970         To remove this burden from the BitmapImage the member 'm_frames' is removed
2971         from BitmapImage. A new member named 'm_frameCache' of type ImageFrameCache
2972         is added to ImageSource. This class handles caching and recaching the image
2973         metadata and the ImageFrames if the image needs decoding. When the BitmapImage
2974         is initialized with a memory image, the ImageFrameCache initializes its
2975         metadata and ImageFrames directly from the NativeImagePtr.
2976
2977         The plan for ImageFrameCache is to be extended for the asynchronous image
2978         decoding and also to be used by the non CG image decoders which cache
2979         other copies of the ImageFrames. This double caching should be removed.
2980
2981         When the BitmapImage is replying to the ImageFrame queries, it will ask the
2982         ImageSource which will pass the query the ImageFrameCache. ImageFrameCache
2983         will ensure the requested ImageFrame is cached and is valid for the requested
2984         SubSamplingLevel before accessing the data members of this ImageFrame.
2985
2986         * CMakeLists.txt:
2987         * WebCore.xcodeproj/project.pbxproj:
2988         Add and ImageFrameCache.cpp to the WebCore project.
2989
2990         * platform/graphics/BitmapImage.cpp:
2991         (WebCore::BitmapImage::BitmapImage): Move initializing the image metadata to
2992         ImageSource. Add initializers for the remaining members in the class declaration.
2993
2994         (WebCore::BitmapImage::destroyDecodedData): Move most of the logic of this
2995         function to ImageFrameCache::destroyDecodedData(). The only part which can't
2996         be moved is the call invalidatePlatformData().
2997
2998         (WebCore::BitmapImage::destroyDecodedDataIfNecessary): Move the logic of this
2999         function to ImageFrameCache::destroyDecodedDataIfNecessary().
3000
3001         (WebCore::BitmapImage::dataChanged): Move the logic of this function to
3002         ImageSource::dataChanged().
3003
3004         (WebCore::BitmapImage::frameImageAtIndex): Move most of the logic of this
3005         function to ImageFrameCache::frameImageAtIndex(). The only part which can't
3006         be moved is the call invalidatePlatformData() if the required subsampling
3007         level is different from the subsampling level for the cached frame image.
3008
3009         (WebCore::BitmapImage::draw): Replace the BitmapImage  cached metadata with
3010         the corresponding ImageSource cached metadata.
3011         (WebCore::BitmapImage::drawPattern): Ditto.
3012         (WebCore::BitmapImage::shouldAnimate): Ditto.
3013         (WebCore::BitmapImage::startAnimation): Ditto.
3014         (WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
3015
3016         (WebCore::BitmapImage::dump): Call ImageSource::dump() to dump the image
3017         cached metadata.
3018
3019         (WebCore::BitmapImage::haveFrameImageAtIndex): Deleted.
3020         (WebCore::BitmapImage::destroyMetadataAndNotify): Deleted.
3021         (WebCore::BitmapImage::cacheFrame): Deleted.
3022         (WebCore::BitmapImage::didDecodeProperties): Deleted.
3023         (WebCore::BitmapImage::updateSize): Deleted.
3024         (WebCore::BitmapImage::size): Deleted.
3025         (WebCore::BitmapImage::sizeRespectingOrientation): Deleted.
3026         (WebCore::BitmapImage::hotSpot): Deleted.
3027         (WebCore::BitmapImage::frameCount): Deleted.
3028         (WebCore::BitmapImage::isSizeAvailable): Deleted.
3029         (WebCore::BitmapImage::ensureFrameAtIndexIsCached): Deleted.
3030         (WebCore::BitmapImage::frameIsCompleteAtIndex): Deleted.
3031         (WebCore::BitmapImage::frameDurationAtIndex): Deleted.
3032         (WebCore::BitmapImage::frameHasAlphaAtIndex): Deleted.
3033         (WebCore::BitmapImage::currentFrameKnownToBeOpaque): Deleted.
3034         (WebCore::BitmapImage::frameOrientationAtIndex): Deleted.
3035         (WebCore::BitmapImage::singlePixelSolidColor): Deleted.
3036         (WebCore::BitmapImage::repetitionCount): Deleted.
3037         * platform/graphics/BitmapImage.h:
3038         Managing the ImageFrames caching is moved to ImageFrameCache. Caching the
3039         image metadata is now moved to the ImageSource.
3040         
3041         * platform/graphics/GeneratedImage.h:
3042         * platform/graphics/Image.h:
3043         (WebCore::Image::orientationForCurrentFrame):
3044         (WebCore::Image::singlePixelSolidColor):
3045         Change currentFrameKnownToBeOpaque(), orientationForCurrentFrame() and
3046         singlePixelSolidColor() to be const.
3047         
3048         * platform/graphics/ImageFrame.cpp:
3049         (WebCore::ImageFrame::defaultFrame): Returns an empty ImageFrame to get the default ImageFrame metadata.
3050         (WebCore::ImageFrame::fillMetadata): Deleted. Moved to ImageFrameCache.
3051         (WebCore::ImageFrame::initialize): Deleted. Ditto.
3052         
3053         * platform/graphics/ImageFrame.h:
3054         (WebCore::ImageFrame::setDuration): Change the type of the argument to float instead of unsigned.
3055         (WebCore::ImageFrame::hasAlpha): Protect the unset m_hasAlpha by checking hasMetadata() first.
3056
3057         * platform/graphics/ImageFrameCache.cpp: Added.
3058         (WebCore::ImageFrameCache::ImageFrameCache): Two constructors similar to what we do for ImageSource and BitmapImage.
3059         (WebCore::ImageFrameCache::destroyDecodedData): Moved from BitmapImage.cpp.
3060         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Ditto.
3061         (WebCore::ImageFrameCache::destroyIncompleteDecodedData): Ditto.
3062         (WebCore::ImageFrameCache::decodedSizeChanged): Ditto.
3063         (WebCore::ImageFrameCache::decodedSizeIncremented): Ditto.
3064         (WebCore::ImageFrameCache::decodedSizeDecremented): Ditto.
3065         (WebCore::ImageFrameCache::decodedSizeReset): Ditto.
3066         (WebCore::ImageFrameCache::didDecodeProperties): Ditto.
3067         (WebCore::ImageFrameCache::growFrames): Grows the size of m_frames if necessary.
3068         (WebCore::ImageFrameCache::setNativeImage): Initializes the ImageFrame metadata directly from the NativeImagePtr. 
3069         (WebCore::ImageFrameCache::setFrameNativeImage): Initializes the ImageFrame image and the metadata.
3070         (WebCore::ImageFrameCache::setFrameMetadata): Initializes the ImageFrame metadata from the ImageDecoder.
3071         (WebCore::ImageFrameCache::frameAtIndex): Returns an ImageFrame given its index. Cache or recache the requested ImageFrame if necessary.
3072         (WebCore::ImageFrameCache::clearMetadata): Invalidates the cached image metadata.
3073         (WebCore::ImageFrameCache::metadata): A template function which returns an image metadata property.
3074         (WebCore::ImageFrameCache::frameMetadataAtIndex): A template function which returns an ImageFrame metadata property.
3075         (WebCore::ImageFrameCache::isSizeAvailable): An image metadata property.
3076         (WebCore::ImageFrameCache::frameCount): Ditto.
3077         (WebCore::ImageFrameCache::repetitionCount): Ditto.
3078         (WebCore::ImageFrameCache::filenameExtension): Ditto.
3079         (WebCore::ImageFrameCache::hotSpot): Ditto.
3080         (WebCore::ImageFrameCache::size): An image metadata property but we get it from the first ImageFrame.
3081         (WebCore::ImageFrameCache::sizeRespectingOrientation): Ditto.
3082         (WebCore::ImageFrameCache::singlePixelSolidColor): Ditto.
3083         (WebCore::ImageFrameCache::frameIsCompleteAtIndex): An ImageFrame metadata property.
3084         (WebCore::ImageFrameCache::frameHasAlphaAtIndex): Ditto.
3085         (WebCore::ImageFrameCache::frameHasImageAtIndex): Ditto.
3086         (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Ditto.
3087         (WebCore::ImageFrameCache::frameSubsamplingLevelAtIndex): Ditto.
3088         (WebCore::ImageFrameCache::frameSizeAtIndex): Ditto.
3089         (WebCore::ImageFrameCache::frameBytesAtIndex): Ditto.
3090         (WebCore::ImageFrameCache::frameDurationAtIndex): Ditto.
3091         (WebCore::ImageFrameCache::frameOrientationAtIndex): Ditto.
3092         (WebCore::ImageFrameCache::frameImageAtIndex): Ditto.
3093
3094         * platform/graphics/ImageFrameCache.h: Added.
3095         (WebCore::ImageFrameCache::setDecoder): Sets the current ImageDecoder which is owned by the ImageSource.
3096         (WebCore::ImageFrameCache::decodedSize): Returns the size of the cached NativeImages.
3097         (WebCore::ImageFrameCache::isDecoderAvailable): Returns whether an ImageDecoder is available.
3098
3099         * platform/graphics/ImageSource.cpp:
3100         (WebCore::ImageSource::ImageSource): Initializes the ImageFrameCache based on the image decoding state.
3101         (WebCore::ImageSource::clearFrameBufferCache): Replace initialized() with isDecoderAvailable().
3102         (WebCore::ImageSource::clear): Clears the ImageDecoder of the ImageFrameCache.
3103         (WebCore::ImageSource::destroyDecodedData): Moved from BitmapImage.cpp.
3104         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Ditto.
3105         (WebCore::ImageSource::ensureDecoderAvailable): Creates an ImageDecoder if necessary and sets it in ImageFrameCache.
3106         (WebCore::ImageSource::setData):
3107         (WebCore::ImageSource::dataChanged): Moved from BitmapImage.cpp.
3108         (WebCore::ImageSource::isAllDataReceived):
3109         (WebCore::ImageSource::maximumSubsamplingLevel): Rename calculateMaximumSubsamplingLevel() to maximumSubsamplingLevel().
3110         (WebCore::ImageSource::subsamplingLevelForScale):
3111         (WebCore::ImageSource::createFrameImageAtIndex):
3112         (WebCore::ImageSource::dump):
3113         (WebCore::ImageSource::calculateMaximumSubsamplingLevel): Deleted. Renamed to maximumSubsamplingLevel().
3114         (WebCore::ImageSource::updateMetadata): Deleted. Not needed. Caching the image metadata is the responsibility of ImageFrameCache. 
3115         (WebCore::ImageSource::bytesDecodedToDetermineProperties): Deleted. Not needed.
3116         (WebCore::ImageSource::isSizeAvailable): Deleted. Moved to ImageSource.h. 
3117         (WebCore::ImageSource::size): Deleted. Ditto.
3118         (WebCore::ImageSource::sizeRespectingOrientation): Deleted. Ditto.
3119         (WebCore::ImageSource::frameCount): Deleted. Ditto.
3120         (WebCore::ImageSource::repetitionCount): Deleted. Ditto.
3121         (WebCore::ImageSource::filenameExtension): Deleted. Ditto.
3122         (WebCore::ImageSource::hotSpot): Deleted. Ditto.
3123         (WebCore::ImageSource::frameIsCompleteAtIndex): Deleted. Ditto.
3124         (WebCore::ImageSource::frameHasAlphaAtIndex): Deleted. Ditto.
3125         (WebCore::ImageSource::frameAllowSubsamplingAtIndex): Deleted. Ditto.
3126         (WebCore::ImageSource::frameSizeAtIndex): Deleted. Ditto.
3127         (WebCore::ImageSource::frameBytesAtIndex): Deleted. Ditto.
3128         (WebCore::ImageSource::frameDurationAtIndex): Deleted. Ditto.
3129         (WebCore::ImageSource::frameOrientationAtIndex): Deleted. Ditto.
3130
3131         * platform/graphics/ImageSource.h:
3132         (WebCore::ImageSource::isDecoderAvailable): initialized() was renamed to isDecoderAvailable().
3133         (WebCore::ImageSource::decodedSize): Send the query to ImageFrameCache.
3134         (WebCore::ImageSource::isSizeAvailable): Ditto.
3135         (WebCore::ImageSource::frameCount): Ditto.
3136         (WebCore::ImageSource::repetitionCount): Ditto.
3137         (WebCore::ImageSource::filenameExtension): Ditto.
3138         (WebCore::ImageSource::hotSpot): Ditto.
3139         (WebCore::ImageSource::size): Ditto.
3140         (WebCore::ImageSource::sizeRespectingOrientation): Ditto.
3141         (WebCore::ImageSource::singlePixelSolidColor): Ditto.
3142         (WebCore::ImageSource::frameIsCompleteAtIndex): Ditto.
3143         (WebCore::ImageSource::frameHasAlphaAtIndex): Ditto.
3144         (WebCore::ImageSource::frameHasImageAtIndex): Ditto.
3145         (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Ditto.
3146         (WebCore::ImageSource::frameSubsamplingLevelAtIndex): Ditto.
3147         (WebCore::ImageSource::frameSizeAtIndex): Ditto.
3148         (WebCore::ImageSource::frameBytesAtIndex): Ditto.
3149         (WebCore::ImageSource::frameDurationAtIndex): Ditto.
3150         (WebCore::ImageSource::frameOrientationAtIndex): Ditto.
3151         (WebCore::ImageSource::frameImageAtIndex): Ditto.
3152         (WebCore::ImageSource::decoder): Deleted. Not needed.
3153         (WebCore::ImageSource::initialized): Deleted. Was renamed to isDecoderAvailable().
3154         (WebCore::ImageSource::setNeedsUpdateMetadata): Deleted. Not needed.
3155
3156         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3157         (WebCore::GraphicsContext3D::ImageExtractor::extractImage): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3158         * platform/graphics/cg/GraphicsContext3DCG.cpp:
3159         (WebCore::GraphicsContext3D::ImageExtractor::extractImage): Ditto.
3160         
3161         * platform/graphics/cg/ImageDecoderCG.cpp:
3162         (WebCore::ImageDecoder::ImageDecoder): Make the constructor of ImageDecoder be the same for all ports. 
3163         (WebCore::ImageDecoder::setData): Removed unused overloaded function.
3164         (WebCore::ImageDecoder::size): Deleted.  Removed unused function.
3165
3166         * platform/graphics/cg/ImageDecoderCG.h:
3167         (WebCore::ImageDecoder::create): Make the constructor of CG ImageDecoder be like the other ports.
3168         (WebCore::ImageDecoder::isAllDataReceived): Make this property owned by ImageDecoder.
3169
3170         * platform/graphics/cg/PDFDocumentImage.h: Change currentFrameKnownToBeOpaque() to be const.
3171
3172         * platform/graphics/efl/GraphicsContext3DEfl.cpp:
3173         (WebCore::GraphicsContext3D::ImageExtractor::extractImage): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3174         
3175         * platform/graphics/mac/ImageMac.mm:
3176         (WebCore::BitmapImage::invalidatePlatformData): m_frames is owned by ImageFrameCache. ImageFrameCache::frameCount() has to 
3177         be equal to ImageFrame::m_frames.size().
3178
3179         * platform/image-decoders/ImageDecoder.cpp:
3180         (WebCore::ImageDecoder::create): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3181         * platform/image-decoders/ImageDecoder.h:
3182         (WebCore::ImageDecoder::ImageDecoder): Ditto.
3183         (WebCore::ImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata().
3184         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
3185         (WebCore::BMPImageDecoder::BMPImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3186         * platform/image-decoders/bmp/BMPImageDecoder.h:
3187         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3188         (WebCore::GIFImageDecoder::GIFImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3189         (WebCore::GIFImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata().
3190         * platform/image-decoders/gif/GIFImageDecoder.h:
3191         * platform/image-decoders/gif/GIFImageReader.cpp:
3192         * platform/image-decoders/gif/GIFImageReader.h:
3193         * platform/image-decoders/ico/ICOImageDecoder.cpp:
3194         (WebCore::ICOImageDecoder::ICOImageDecoder): 
3195         (WebCore::ICOImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata().
3196         (WebCore::ICOImageDecoder::decode): Move resizing the m_frameBufferCache from ICOImageDecoder::frameCount() to ICOImageDecoder::decode().
3197         (WebCore::ICOImageDecoder::decodeAtIndex): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3198         * platform/image-decoders/ico/ICOImageDecoder.h:
3199         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3200         (WebCore::JPEGImageDecoder::JPEGImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3201         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
3202         * platform/image-decoders/png/PNGImageDecoder.cpp:
3203         (WebCore::PNGImageDecoder::PNGImageDecoder): AlphaOption and GammaAndColorProfileOption are moved out of ImageSource.
3204         * platform/image-decoders/png/PNGImageDecoder.h:
3205         (WebCore::PNGImageDecoder::frameCount): Make frameCount const so it can be passed to the template function ImageFrameCache::metadata().
3206         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
3207         (WebCore::WEBPImageDecoder::WEBPImageDecoder):
3208         * platform/image-decoders/webp/WEBPImageDecoder.h:
3209
3210         * svg/graphics/SVGImage.h: Make currentFrameKnownToBeOpaque() be const.
3211         * svg/graphics/SVGImageForContainer.h: Ditto.
3212
3213 2016-09-27  Alex Christensen  <achristensen@webkit.org>
3214
3215         Correctly parse URLs with the first tab in the fragment
3216         https://bugs.webkit.org/show_bug.cgi?id=162650
3217
3218         Reviewed by Saam Barati.
3219
3220         Covered by a new API test.
3221
3222         * platform/URLParser.cpp:
3223         (WebCore::URLParser::fragmentSyntaxViolation):
3224
3225 2016-09-27  Chris Dumez  <cdumez@apple.com>
3226
3227         <a download> does not honor the same-origin requirement
3228         https://bugs.webkit.org/show_bug.cgi?id=156100
3229
3230         Reviewed by Alex Christensen.
3231
3232         We now completely ignore the "download" attribute on anchors if the
3233         href URL is cross-origin. We therefore navigate to the URL instead
3234         of forcefully downloading it in this case and leave it up to the server
3235         to give us the right headers if it should be downloaded. This is
3236         conservative and matches Firefox.
3237
3238         Chrome and the HTML specification ignore only the suggested filename
3239         if the URL is cross-origin but still download the file.
3240
3241         No new tests, updated existing test.
3242
3243         * html/HTMLAnchorElement.cpp:
3244         (WebCore::HTMLAnchorElement::handleClick):
3245
3246 2016-09-27  Alex Christensen  <achristensen@webkit.org>
3247
3248         URLParser: Handle windows drive letters after two slashes in relative URLs according to spec
3249         https://bugs.webkit.org/show_bug.cgi?id=162646
3250
3251         Reviewed by Saam Barati.
3252
3253         Covered by new API tests.
3254
3255         * platform/URLParser.cpp:
3256         (WebCore::CodePointIterator::codeUnitsSince):
3257         (WebCore::URLParser::appendWindowsDriveLetter):
3258         (WebCore::URLParser::parse):
3259         (WebCore::isWindowsDriveLetter): Deleted.
3260         (WebCore::URLParser::checkWindowsDriveLetter): Deleted.
3261         * platform/URLParser.h:
3262
3263 2016-09-27  Alex Christensen  <achristensen@webkit.org>
3264
3265         URLs with @ in the user should only search for the last @ until the end of the authority and host
3266         https://bugs.webkit.org/show_bug.cgi?id=162635
3267
3268         Reviewed by Geoffrey Garen.
3269
3270         Covered by new API tests.
3271
3272         * platform/URLParser.cpp:
3273         (WebCore::URLParser::parse):
3274
3275 2016-09-27  Chris Dumez  <cdumez@apple.com>
3276
3277         It should be possible to dispatch events on documents created using DOMParser
3278         https://bugs.webkit.org/show_bug.cgi?id=26147
3279
3280         Reviewed by Ryosuke Niwa.
3281
3282         It should be possible to dispatch events on documents created using
3283         DOMParser. It did not work because we were not setting the context
3284         document on the newly created document in DOMParser::parseFromString().
3285
3286         Firefox and Chrome both already support this.
3287
3288         Test: fast/dom/parsed-document-dispatchEvent.html
3289
3290         * xml/DOMParser.cpp:
3291         (WebCore::DOMParser::DOMParser):
3292         (WebCore::DOMParser::parseFromString):
3293         * xml/DOMParser.h:
3294         (WebCore::DOMParser::create):
3295         * xml/DOMParser.idl:
3296
3297 2016-09-26  Myles C. Maxfield  <mmaxfield@apple.com>
3298
3299         [Cocoa] Improve performance of complex text codepath
3300         https://bugs.webkit.org/show_bug.cgi?id=161936
3301
3302         Reviewed by Simon Fraser.
3303
3304         CoreText exposes a bit on the CTRunStatus which represents whether
3305         the run actually uses the glyph origins concept introduced in
3306         r205396. If this bit is not set, we can use the (slightly faster)
3307         call to CTRunGetAdvances() instead of
3308         CTRunGetBaseAdvancesAndOrigins(). In addition, if none of the runs
3309         have this bit set, we don't need to allocate storage for the vector
3310         of origins at all, thereby using less memory.
3311
3312         No new tests because there is no behavior change.
3313
3314         * platform/graphics/mac/ComplexTextController.cpp:
3315         (WebCore::ComplexTextController::advance):
3316         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3317         * platform/graphics/mac/ComplexTextController.h:
3318         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
3319         (WebCore::ComplexTextController::glyphOrigin):
3320         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3321         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
3322         * platform/spi/cocoa/CoreTextSPI.h:
3323
3324 2016-09-27  Ryosuke Niwa  <rniwa@webkit.org>
3325
3326         Import w3c shadow DOM tests and fix one assertion
3327         https://bugs.webkit.org/show_bug.cgi?id=162629
3328
3329         Reviewed by Chris Dumez.
3330
3331         The assertion failure was caused by RelatedNodeRetargeter's constructor mixing up the ancestor tree scopes
3332         for the target and the related target. Fixed the bug by reversing the two.
3333
3334         Tests: imported/w3c/web-platform-tests/shadow-dom/event-composed-path-with-related-target.html
3335
3336         * dom/EventPath.cpp:
3337         (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): i and m_ancestorTreeScopes are for the related target
3338         and j and targetTreeScopeAncestors are for the target.
3339
3340 2016-09-27  Chris Dumez  <cdumez@apple.com>
3341
3342         It should be possible to dispatch events on documents that do not have a browsing context
3343         https://bugs.webkit.org/show_bug.cgi?id=162620
3344
3345         Reviewed by Ryosuke Niwa.
3346
3347         It should be possible to dispatch events on documents that do not have a browsing
3348         context (e.g. Documents created using DOMImplementation.createHTMLDocument()).
3349         Gecko and Blink both allow this but WebKit did not.
3350
3351         The approach chosen to support this is similar to the one in Blink. When constructing
3352         a new document (e.g. using DOMImplementation.createHTMLDocument()) we now keep track
3353         of the context document. When requesting the scriptExecutionContext(), we now return
3354         the context document if the document has one instead of the document itself.
3355
3356         Test: imported/w3c/web-platform-tests/dom/events/Event-dispatch-other-document.html
3357
3358         * bindings/js/JSDocumentCustom.cpp:
3359         (WebCore::JSDocument::visitAdditionalChildren):
3360         * dom/DOMImplementation.cpp:
3361         (WebCore::DOMImplementation::createDocument):
3362         (WebCore::DOMImplementation::createHTMLDocument):
3363         * dom/Document.cpp:
3364         (WebCore::Document::create):
3365         (WebCore::Document::cloneDataFromDocument):
3366         (WebCore::Document::contextDocument):
3367         (WebCore::Document::takeDOMWindowFrom): Deleted.
3368         * dom/Document.h:
3369         (WebCore::Document::setContextDocument):
3370         (WebCore::Node::scriptExecutionContext):
3371         (WebCore::Node::isDocumentNode): Deleted.
3372         * dom/Document.idl:
3373         * xml/XMLHttpRequest.cpp:
3374         (WebCore::XMLHttpRequest::responseXML):
3375
3376 2016-09-27  Alex Christensen  <achristensen@webkit.org>
3377
3378         Implement URLParser::syntaxViolation
3379         https://bugs.webkit.org/show_bug.cgi?id=162593
3380
3381         Reviewed by Geoffrey Garen.
3382
3383         Most of the time when parsing URLs, we just look at the URL, find offsets of the host, path, query, etc., 
3384         and the String can be used untouched.  When this happens, we do not want to allocate and copy the String.
3385         We want to just add a reference to an existing String.
3386
3387         Sometimes we need to canonicalize the String because there has been a syntaxViolation,
3388         defined as any String that is different than its canonicalized URL String.  In such cases we need to
3389         allocate a new String and fill it with the canonicalized URL String.  When a syntaxViolation happens for the
3390         first time, we know that everything in the input String up to that point is equal to what it would have been
3391         if we had canonicalized the beginning of the URL, copy it into a buffer, and continue parsing in a mode where
3392         instead of just looking at the input URL String, we canonicalize each code point into the buffer.
3393
3394         Changes to behavior involve additional spec compliance with tabs and newlines in different places in URLs,
3395         as well as additional spec compliance when parsing empty and null URLs relative to other URLs.
3396         Both are covered by new API tests. Existing behavior covered by existing API tests.
3397
3398         This is about a 15% speed improvement on my URL parsing benchmark.
3399
3400         * platform/URL.cpp:
3401         (WebCore::assertProtocolIsGood):
3402         (WebCore::URL::protocolIs):
3403         (WebCore::protocolIs):
3404         * platform/URL.h:
3405         * platform/URLParser.cpp:
3406         (WebCore::isTabOrNewline):
3407         (WebCore::URLParser::incrementIteratorSkippingTabsAndNewlines):
3408         (WebCore::URLParser::isWindowsDriveLetter):
3409         (WebCore::URLParser::appendToASCIIBuffer):
3410         (WebCore::URLParser::checkWindowsDriveLetter):
3411         (WebCore::URLParser::shouldCopyFileURL):
3412         (WebCore::URLParser::utf8PercentEncode):
3413         (WebCore::URLParser::utf8QueryEncode):
3414         (WebCore::URLParser::copyURLPartsUntil):
3415         (WebCore::URLParser::syntaxViolation):
3416         (WebCore::URLParser::fragmentSyntaxViolation):
3417         (WebCore::URLParser::parsedDataView):
3418         (WebCore::URLParser::currentPosition):
3419         (WebCore::URLParser::URLParser):
3420         (WebCore::URLParser::parse):
3421         (WebCore::URLParser::parseAuthority):
3422         (WebCore::URLParser::parseIPv4Number):
3423         (WebCore::URLParser::parseIPv4Host):
3424         (WebCore::URLParser::parseIPv6Host):
3425         (WebCore::URLParser::parsePort):
3426         (WebCore::URLParser::parseHostAndPort):
3427         (WebCore::serializeURLEncodedForm):