b3ee9cb3ddf815dd25b4b6925c6817b3b4665f10
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-16  Youenn Fablet  <youenn@apple.com>
2
3         CachedFont do not need to be updated according Origin/Fetch mode
4         https://bugs.webkit.org/show_bug.cgi?id=161909
5
6         Reviewed by Sam Weinig.
7
8         No change of behavior.
9
10         * loader/cache/CachedFont.h: Ensuring CachedFont is not reused.
11         * loader/cache/CachedResourceLoader.cpp:
12         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Doing direct reuse for CachedFont as WebKit is ignoring CORS for all fonts related stuff.
13
14 2016-09-16  Youenn Fablet  <youenn@apple.com>
15
16         CachedResource should efficiently construct its ResourceRequest
17         https://bugs.webkit.org/show_bug.cgi?id=161609
18
19         Reviewed by Sam Weinig.
20
21         Covered by existing tests.
22
23         Making CachedResourceLoader take a CachedResourceRequest&& when being asked to load resources.
24         Making CachedResource et al take a CachedResourceRequest&& as constructor parameter.
25
26         CachedResource now sets its options at construction time instead of load time.
27         This may change some specific behaviors, for instance when loading manually images.
28
29         Made some refactoring when both the resource and request are needed, for ResourceTimingInformation.
30         Made local copies of some CachedResourceRequest fields so that we do not need it after being WTFMoved.
31         Some of these properties may be put outside CachedResourceRequest in a later refactoring step.
32
33         * css/CSSFontFaceSrcValue.cpp:
34         (WebCore::CSSFontFaceSrcValue::cachedFont):
35         * css/CSSImageSetValue.cpp:
36         (WebCore::CSSImageSetValue::loadBestFitImage):
37         * css/CSSImageValue.cpp:
38         (WebCore::CSSImageValue::loadImage):
39         * css/StyleRuleImport.cpp:
40         (WebCore::StyleRuleImport::requestStyleSheet):
41         * dom/ProcessingInstruction.cpp:
42         (WebCore::ProcessingInstruction::checkStyleSheet):
43         * dom/ScriptElement.cpp:
44         (WebCore::ScriptElement::requestScriptWithCache):
45         * html/HTMLLinkElement.cpp:
46         (WebCore::HTMLLinkElement::process):
47         * html/parser/HTMLResourcePreloader.cpp:
48         (WebCore::HTMLResourcePreloader::preload):
49         * loader/CrossOriginPreflightChecker.cpp:
50         (WebCore::CrossOriginPreflightChecker::startPreflight):
51         * loader/DocumentLoader.cpp:
52         (WebCore::DocumentLoader::startLoadingMainResource):
53         * loader/DocumentThreadableLoader.cpp:
54         (WebCore::DocumentThreadableLoader::loadRequest):
55         * loader/ImageLoader.cpp:
56         (WebCore::ImageLoader::updateFromElement):
57         * loader/LinkLoader.cpp:
58         (WebCore::LinkLoader::preloadIfNeeded):
59         (WebCore::LinkLoader::loadLink):
60         * loader/MediaResourceLoader.cpp:
61         (WebCore::MediaResourceLoader::requestResource):
62         * loader/ResourceTimingInformation.cpp:
63         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
64         * loader/ResourceTimingInformation.h:
65         * loader/TextTrackLoader.cpp:
66         (WebCore::TextTrackLoader::load):
67         * loader/cache/CachedCSSStyleSheet.cpp:
68         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
69         * loader/cache/CachedCSSStyleSheet.h:
70         * loader/cache/CachedFont.cpp:
71         (WebCore::CachedFont::CachedFont):
72         (WebCore::CachedFont::load):
73         (WebCore::CachedFont::beginLoadIfNeeded):
74         * loader/cache/CachedFont.h:
75         * loader/cache/CachedImage.cpp:
76         (WebCore::CachedImage::CachedImage):
77         (WebCore::CachedImage::load):
78         * loader/cache/CachedImage.h:
79         * loader/cache/CachedRawResource.cpp:
80         (WebCore::CachedRawResource::CachedRawResource):
81         * loader/cache/CachedRawResource.h:
82         * loader/cache/CachedResource.cpp:
83         (WebCore::CachedResource::CachedResource):
84         (WebCore::CachedResource::load):
85         (WebCore::CachedResource::loadFrom):
86         * loader/cache/CachedResource.h:
87         (WebCore::CachedResource::resourceRequest):
88         * loader/cache/CachedResourceLoader.cpp:
89         (WebCore::createResource):
90         (WebCore::CachedResourceLoader::requestImage):
91         (WebCore::CachedResourceLoader::requestFont):
92         (WebCore::CachedResourceLoader::requestTextTrack):
93         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
94         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
95         (WebCore::CachedResourceLoader::requestScript):
96         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
97         (WebCore::CachedResourceLoader::requestSVGDocument):
98         (WebCore::CachedResourceLoader::requestLinkResource):
99         (WebCore::CachedResourceLoader::requestMedia):
100         (WebCore::CachedResourceLoader::requestRawResource):
101         (WebCore::CachedResourceLoader::requestMainResource):
102         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
103         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
104         (WebCore::CachedResourceLoader::requestResource):
105         (WebCore::CachedResourceLoader::revalidateResource):
106         (WebCore::CachedResourceLoader::loadResource):
107         (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
108         (WebCore::CachedResourceLoader::preload):
109         (WebCore::CachedResourceLoader::checkForPendingPreloads):
110         (WebCore::CachedResourceLoader::requestPreload):
111         * loader/cache/CachedResourceLoader.h:
112         * loader/cache/CachedSVGDocument.cpp:
113         (WebCore::CachedSVGDocument::CachedSVGDocument):
114         * loader/cache/CachedSVGDocument.h:
115         * loader/cache/CachedSVGDocumentReference.cpp:
116         (WebCore::CachedSVGDocumentReference::load):
117         * loader/cache/CachedSVGFont.cpp:
118         (WebCore::CachedSVGFont::CachedSVGFont):
119         * loader/cache/CachedSVGFont.h:
120         * loader/cache/CachedScript.cpp:
121         (WebCore::CachedScript::CachedScript):
122         * loader/cache/CachedScript.h:
123         * loader/cache/CachedTextTrack.cpp:
124         (WebCore::CachedTextTrack::CachedTextTrack):
125         * loader/cache/CachedTextTrack.h:
126         * loader/cache/CachedXSLStyleSheet.cpp:
127         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
128         (WebCore::CachedXSLStyleSheet::didAddClient):
129         * loader/cache/CachedXSLStyleSheet.h:
130         * loader/icon/IconLoader.cpp:
131         (WebCore::IconLoader::startLoading):
132         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
133         (WebCore::WebCoreAVCFResourceLoader::startLoading):
134         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
135         (WebCore::WebCoreAVFResourceLoader::startLoading):
136         * svg/SVGFEImageElement.cpp:
137         (WebCore::SVGFEImageElement::requestImageResource):
138         * svg/SVGFontFaceUriElement.cpp:
139         (WebCore::SVGFontFaceUriElement::loadFont):
140         * svg/SVGUseElement.cpp:
141         (WebCore::SVGUseElement::updateExternalDocument):
142         * xml/XSLImportRule.cpp:
143         (WebCore::XSLImportRule::loadSheet):
144
145 2016-09-16  Youenn Fablet  <youenn@apple.com>
146
147         [Fetch API] Headers should be combine with ',' and not ', '
148         https://bugs.webkit.org/show_bug.cgi?id=161736
149
150         Reviewed by Sam Weinig.
151
152         Covered by updated tests and http/tests/xmlhttprequest/check-combining-headers.html.
153
154         * loader/CrossOriginAccessControl.cpp:
155         (WebCore::createAccessControlPreflightRequest): Combining with ',' for Access-Control-Request-Headers
156         * platform/network/HTTPHeaderMap.cpp:
157         (HTTPHeaderMap::add): Combining with ','
158
159 2016-09-16  Youenn Fablet  <youenn@apple.com>
160
161         Custom promise-returning functions should not throw if callee has not the expected type
162         https://bugs.webkit.org/show_bug.cgi?id=162011
163
164         Reviewed by Sam Weinig.
165
166         Covered by added test.
167
168         Updating code generator to handle this case.
169         Cleaning related getUserMedia implementation.
170
171         * CMakeLists.txt: Removing Modules/mediastream/MediaDevices.js.
172         * DerivedSources.make: Removing Modules/mediastream/MediaDevices.js.
173         * Modules/mediastream/MediaDevices.idl: Cleaning IDL definition
174         * Modules/mediastream/MediaDevices.js: Removing error throwing and so removing file.
175         * Modules/mediastream/NavigatorUserMedia.js: getUsermMediaFromJS to getUserMedia.
176         * WebCore.xcodeproj/project.pbxproj: Removing Modules/mediastream/MediaDevices.js.
177         * bindings/js/JSDOMPromise.cpp:
178         (WebCore::createRejectedPromiseWithTypeError): Helper routine.
179         * bindings/js/JSDOMPromise.h:
180         * bindings/js/WebCoreBuiltinNames.h: getUsermMediaFromJS to getUserMedia.
181         * bindings/scripts/CodeGeneratorJS.pm:
182         (GenerateImplementation): Rejecting promise in case of failing castedThis, but only for custom functions since
183         they are handled differently for non custom methods.
184         (GenerateFunctionCastedThis):
185         * bindings/scripts/test/JS/JSTestObj.cpp:
186         * bindings/scripts/test/JS/JSTestObj.h:
187         * bindings/scripts/test/TestObj.idl: Adding custom promise test.
188
189 2016-09-16  Youenn Fablet  <youenn@apple.com>
190
191         Link loader should use FetchOptions::mode according its crossOrigin attribute
192         https://bugs.webkit.org/show_bug.cgi?id=161859
193
194         Reviewed by Sam Weinig.
195
196         Tests: http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html
197                http/tests/security/cached-cross-origin-preloading-css-stylesheet.html
198
199         Setting fetch mode according crossorigin attribute for link preload elements.
200         This allows calling onerror callback for CORS failures, which was not the case before the patch.
201
202         Making cached CSS stylesheet reusable accross origins and fetch modes.
203
204         * loader/LinkLoader.cpp:
205         (WebCore::LinkLoader::preloadIfNeeded): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode.
206         * loader/cache/CachedCSSStyleSheet.cpp:
207         (WebCore::CachedCSSStyleSheet::sheetText): clean-up.
208         (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Implementing data init for cached css stylesheets.
209         * loader/cache/CachedCSSStyleSheet.h:
210         * loader/cache/CachedResourceLoader.cpp:
211         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Activating update support for stylesheets.
212         (WebCore::CachedResourceLoader::requestResource): Fixing for matching cached resources that need being reloaded due to different origin/fetch mode.
213
214 2016-09-16  Youenn Fablet  <youenn@apple.com>
215
216         [Fetch API] Referrer and Origin header should not be considered as safe request headers
217         https://bugs.webkit.org/show_bug.cgi?id=161902
218
219         Reviewed by Sam Weinig.
220
221         Test: http/tests/fetch/fetch-cors-with-referrer.html and updated WPT tests.
222
223         Removing Origin and Referrer from safe request headers.
224         Making referrer header setting after preflight for fetch API code path.
225
226         Ensuring that no ThreadableLoader client sets Origin or Referrer headers of the ResourceRequest, as they should use the proper mechanisms for that.
227
228         Handling no-referrer referrer special value by setting the referrer-policy to NoReferrer in FetchLoader.
229
230         * Modules/fetch/FetchLoader.cpp:
231         (WebCore::FetchLoader::start): Computing referrer value and handling special "client"and "no-referrer" cases.
232         Passing the value directly to ThreadableLoader.
233         * Modules/fetch/FetchRequest.cpp:
234         (WebCore::FetchRequest::internalRequest): Removing setting of ResourceRequest referrer header.
235         (WebCore::FetchRequest::clone): Removing obsolete FIXME.
236         * Modules/fetch/FetchRequest.h:
237         * loader/CrossOriginAccessControl.cpp:
238         (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Removing Origin and Referrer headers.
239         * loader/DocumentThreadableLoader.cpp:
240         (WebCore::DocumentThreadableLoader::create): Updated to take a referrer as parameter.
241         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto.
242         * loader/DocumentThreadableLoader.h: Ditto.
243         * loader/ThreadableLoader.cpp: Ditto.
244         (WebCore::ThreadableLoader::create): Ditto.
245         * loader/ThreadableLoader.h: Ditto.
246         * loader/WorkerThreadableLoader.cpp: Ditto.
247         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader): Ditto.
248         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
249         * loader/WorkerThreadableLoader.h: Ditto.
250         (WebCore::WorkerThreadableLoader::create): Ditto.
251         * platform/network/ResourceRequestBase.cpp:
252         (WebCore::ResourceRequestBase::hasHTTPReferrer): Added to enable asserting that no threadable loader client sets the referrer in the request.
253         * platform/network/ResourceRequestBase.h:
254
255 2016-09-15  Dave Hyatt  <hyatt@apple.com>
256
257         [CSS Parser] Get CSSParserFastPaths.cpp compiling
258         https://bugs.webkit.org/show_bug.cgi?id=162033
259
260         Reviewed by Dean Jackson.
261
262         * CMakeLists.txt:
263         * WebCore.xcodeproj/project.pbxproj:
264         Add new StyleColor.h/.cpp files to the projecty
265
266         * css/CSSFunctionValue.cpp:
267         (WebCore::CSSFunctionValue::CSSFunctionValue):
268         (WebCore::CSSFunctionValue::customCSSText):
269         (WebCore::CSSFunctionValue::append):
270         (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
271         * css/CSSFunctionValue.h:
272         Tweak CSSFunctionValue so that the name can be represented as a keyword ID instead of a String. Eventually we also
273         want to make CSSFunctionValue subclass CSSValueList rather than referencing a separate CSSValueList as a member. For now
274         I left that alone though in order to not change too much in the old parser.
275
276         * css/CSSProperty.cpp:
277         (WebCore::CSSProperty::isDescriptorOnly):
278         Whether or not a property is only a descriptor, e.g., used in viewport and font face stuff.
279
280         * css/CSSProperty.h:
281         * css/CSSValueKeywords.in:
282         Added new keywords for functions that can be used as values. The new parser uses keywords to represent function names.
283
284         * css/StyleColor.cpp: Added.
285         (WebCore::StyleColor::colorFromKeyword):
286         (WebCore::StyleColor::isColorKeyword):
287         (WebCore::StyleColor::isSystemColor):
288         * css/StyleColor.h: Added.
289         (WebCore::StyleColor::StyleColor):
290         (WebCore::StyleColor::currentColor):
291         (WebCore::StyleColor::isCurrentColor):
292         (WebCore::StyleColor::getColor):
293         (WebCore::StyleColor::resolve):
294         (WebCore::operator==):
295         (WebCore::operator!=):
296         New color helper that contains code for checking and looking up colors. This code is similar to some code we already
297         had in the old CSSParser.cpp file, but this way it can be used outside the parser and/or in different files.
298
299         * css/parser/CSSParserFastPaths.cpp:
300         (WebCore::parseSimpleLengthValue):
301         (WebCore::isColorPropertyID):
302         (WebCore::parseColorIntOrPercentage):
303         (WebCore::fastParseColorInternal):
304         (WebCore::CSSParserFastPaths::parseColor):
305         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
306         (WebCore::isUniversalKeyword):
307         (WebCore::parseKeywordValue):
308         (WebCore::parseTransformTranslateArguments):
309         (WebCore::parseTransformNumberArguments):
310         (WebCore::parseSimpleTransformValue):
311         (WebCore::transformCanLikelyUseFastPath):
312         (WebCore::parseSimpleTransformList):
313         (WebCore::parseSimpleTransform):
314         (WebCore::CSSParserFastPaths::maybeParseValue):
315         * css/parser/CSSParserFastPaths.h:
316         Get everything compiling in this file. Key changes included reverting to our old unit names, making CSSFunctionValue compatible,
317         adding support for StyleColor, adding support for mode checking of keywords, and fixing up the memory management model so that
318         RefPtrs are used on returns from parsing functions.
319
320         * css/parser/CSSParserIdioms.cpp:
321         (WebCore::isValueAllowedInMode):
322         * css/parser/CSSParserIdioms.h:
323         New helper function for restricting keywords to certain modes only. The -webkit-text color quirk has been moved to this function.
324
325 2016-09-15  Brady Eidson  <beidson@apple.com>
326
327         WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
328         <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
329
330         Reviewed by Brent Fulgham. 
331
332         No new tests (Not possible with current testing infrastructure).
333
334         This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time
335         it was cached, and then to report that back to the client when a CachedPage is restored.
336
337         Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code.
338
339         * history/CachedFrame.cpp:
340         (WebCore::CachedFrame::setHasInsecureContent):
341         * history/CachedFrame.h:
342         (WebCore::CachedFrame::hasInsecureContent):
343
344         * loader/EmptyClients.h:
345
346         * loader/FrameLoader.cpp:
347         (WebCore::FrameLoader::receivedFirstData):
348         (WebCore::FrameLoader::commitProvisionalLoad):
349         (WebCore::FrameLoader::dispatchDidCommitLoad):
350         * loader/FrameLoader.h:
351
352         * loader/FrameLoaderClient.h:
353
354         * loader/FrameLoaderTypes.h:
355
356 2016-09-13  Jer Noble  <jer.noble@apple.com>
357
358         [media-source] web-platform-test/media-source/mediasource-remove.html test failing
359         https://bugs.webkit.org/show_bug.cgi?id=161950
360
361         Reviewed by Eric Carlson.
362
363         Fixes test: web-platform-test/media-source/mediasource-remove.html
364
365         The mediasource-remove.html test was failing in a number of ways:
366
367         - Tests with invalid start or end times were not throwing the correct exception
368           code, or not throwing exception codes at all
369
370         - Tests were showing an incorrect start buffered range at the beginning of each test.
371
372         - Tests which removed samples were not getting the expected buffered values at the end
373           each test.
374
375         For the exception failures, update the implementation of abort() and remove() to throw
376         the correct exceptions at the correct times.
377
378         For the incorrect initial buffered range, update our buffered calculations to store
379         individual PlatformTimeRanges on each TrackBuffer, and coalesce them into a single
380         value when an append operation completes, a remove operation completes, or when the
381         MediaSource's ready state changes.
382
383         For the incorrect buffered ranges after removal, this is caused because the "samples"
384         that make up an audio track are actually a collection of a large number of individual
385         samples.  So when we are asked to remove media data in a given range, break these audio
386         meta-samples into two pieces at the removal points. This allows the removal algorithm
387         to operate on a individual audio sample basis. (We should look into using this technique
388         when audio samples are evicted during an append operation.) This requires adding some
389         methods to MediaSample and it's concrete subclasses to "divide" a sample into two at
390         a given presentation time.
391
392         Fixing these behaviors, however, breaks the media-source-end-of-stream-buffered.html
393         test, which expects the buffered range for the entire element to expand to the maximum
394         buffered time of any of the element's MediaSource's active sourceBuffers. To fix this,
395         update the MediaSource's monitorSourceBuffer() implementation to match the current
396         specification. The new spec no longer queries the individual SourceBuffers, but rather
397         queries the already coalesced buffered ranges. So move the helper methods hasCurrentTime()
398         hasFutureTime(), and canPlayThrough() up into MediaSource from SourceBuffer. Also, update
399         seekToTime, since it has the same problem as monitorSourceBuffer().
400
401         However, this breaks the media-source-monitor-source-buffers.html test, which appends
402         10s of movie data instantaneously, then never appends again. The SourceBuffer's
403         monitorBufferingRate() method only re-evaluates the rate after data has been appended,
404         so the SourceBuffer thinks it's buffered data at a prodigious rate forever. Instead,
405         allow the SourceBuffer to continuously re-evalute it's buffering rate by modifying the
406         exponential moving average so that the co-efficient scales based on how frequently the
407         method is called. Call the method more often, and the moving average changes less quickly,
408         and it means that when media is stalled out at the end of a buffered range, the readyState
409         of a video element will eventually drop to HAVE_CURRENT_DATA when the average buffering
410         rate falls below the level where playback would continue uninterrupted.
411
412         * Modules/mediasource/MediaSource.cpp:
413         (WebCore::MediaSource::seekToTime):
414         (WebCore::MediaSource::currentTimeFudgeFactor):
415         (WebCore::MediaSource::hasBufferedTime):
416         (WebCore::MediaSource::hasCurrentTime):
417         (WebCore::MediaSource::hasFutureTime):
418         (WebCore::MediaSource::monitorSourceBuffers):
419         * Modules/mediasource/MediaSource.h:
420         * Modules/mediasource/SourceBuffer.cpp:
421         (WebCore::SourceBuffer::abort):
422         (WebCore::SourceBuffer::remove):
423         (WebCore::SourceBuffer::abortIfUpdating):
424         (WebCore::SourceBuffer::removeCodedFrames):
425         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
426         (WebCore::SourceBuffer::updateBufferedFromTrackBuffers):
427         (WebCore::SourceBuffer::canPlayThroughRange):
428         (WebCore::SourceBuffer::monitorBufferingRate):
429         (WebCore::currentTimeFudgeFactor): Deleted.
430         (WebCore::SourceBuffer::hasCurrentTime): Deleted.
431         (WebCore::SourceBuffer::hasFutureTime): Deleted.
432         (WebCore::SourceBuffer::canPlayThrough): Deleted.
433         * platform/MediaSample.h:
434         * platform/cf/CoreMediaSoftLink.cpp:
435         * platform/cf/CoreMediaSoftLink.h:
436         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
437         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
438         (WebCore::MediaSampleAVFObjC::isDivisable):
439         (WebCore::MediaSampleAVFObjC::divide):
440         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
441
442 2016-09-15  Zalan Bujtas  <zalan@apple.com>
443
444         ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements
445         https://bugs.webkit.org/show_bug.cgi?id=151097
446         <rdar://problem/27711678>
447
448         Reviewed by Simon Fraser.
449
450         This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer.
451         (This is similar to what any other stacking context-triggering CSS property does.)  
452
453         Test: compositing/assert-on-will-change-transform-with-composited-descendant.html
454
455         * rendering/RenderLayer.cpp:
456         (WebCore::RenderLayer::calculateClipRects):
457
458 2016-09-15  Zalan Bujtas  <zalan@apple.com>
459
460         Move RenderObject::shouldRespectImageOrientation to RenderElement.
461         https://bugs.webkit.org/show_bug.cgi?id=162028
462
463         Reviewed by Antti Koivisto.
464
465         Tighten the type for imageSizeForRenderer/canRender so that RenderObject::shouldRespectImageOrientation could
466         be moved to RenderElement.
467
468         No change in functionality.
469
470         * loader/cache/CachedImage.cpp:
471         (WebCore::CachedImage::imageSizeForRenderer):
472         * loader/cache/CachedImage.h:
473         * rendering/RenderElement.cpp:
474         (WebCore::RenderElement::shouldRespectImageOrientation):
475         * rendering/RenderElement.h:
476         * rendering/RenderObject.cpp:
477         (WebCore::RenderObject::shouldRespectImageOrientation): Deleted.
478         * rendering/RenderObject.h:
479         * rendering/style/StyleCachedImage.cpp:
480         (WebCore::StyleCachedImage::canRender):
481         * rendering/style/StyleCachedImage.h:
482         * rendering/style/StyleImage.h:
483         (WebCore::StyleImage::canRender):
484
485 2016-09-15  Anders Carlsson  <andersca@apple.com>
486
487         Fix build.
488
489         * platform/spi/cocoa/PassKitSPI.h:
490
491 2016-09-15  Alex Christensen  <achristensen@webkit.org>
492
493         Use character class table in URLParser
494         https://bugs.webkit.org/show_bug.cgi?id=161997
495
496         Reviewed by Chris Dumez.
497
498         No change in behavior except a performance improvement.
499         
500         Before this change, URLParser took 1.514x as long to run my URL Parsing benchmark as URL::parse
501         with a standard deviation of the ration of the runtimes of 0.063 after 8 runs with each parser.
502         After this change, URLParser took 1.328x as long with a standard deviation of 0.037.
503         This isn't the cleanest data, but it's enough to convince me that this is a significant improvement.
504
505         * platform/URLParser.cpp:
506         (WebCore::isC0Control):
507         (WebCore::isC0ControlOrSpace):
508         (WebCore::isTabOrNewline):
509         (WebCore::isInSimpleEncodeSet):
510         (WebCore::isInDefaultEncodeSet):
511         (WebCore::isInUserInfoEncodeSet):
512         (WebCore::isInvalidDomainCharacter):
513         (WebCore::isSlashQuestionOrHash):
514         (WebCore::shouldPercentEncodeQueryByte):
515         (WebCore::shouldCopyFileURL):
516         (WebCore::isSingleDotPathSegment):
517         (WebCore::URLParser::parse):
518
519 2016-09-15  Keith Miller  <keith_miller@apple.com>
520
521         Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
522         https://bugs.webkit.org/show_bug.cgi?id=161985
523
524         Reviewed by Alex Christensen.
525
526         Delete unneeded using, which broke the build on newer versions of clang.
527
528         * bridge/objc/WebScriptObject.mm:
529
530 2016-09-15  Alex Christensen  <achristensen@webkit.org>
531
532         URLParser: Check for invalid characters in the host
533         https://bugs.webkit.org/show_bug.cgi?id=162023
534
535         Reviewed by Tim Horton.
536
537         Covered by new API tests.
538
539         * platform/URLParser.cpp:
540         (WebCore::URLParser::failure):
541         (WebCore::URLParser::parseHost):
542
543 2016-09-15  Antti Koivisto  <antti@apple.com>
544
545         Remove some extra spaces.
546
547         * rendering/TextDecorationPainter.cpp:
548         (WebCore::collectStylesForRenderer):
549
550 2016-09-15  Alex Christensen  <achristensen@webkit.org>
551
552         Use efficient iterators in URLParser
553         https://bugs.webkit.org/show_bug.cgi?id=162007
554
555         Reviewed by Tim Horton.
556
557         URLParser used to use StringView::CodePoints::Iterator, which needs to check if
558         the StringView is 8-bit or 16-bit every time it does anything.
559         I wrote a new CodePointIterator template which already knows whether it is iterating
560         8-bit or 16-bit characters, so it does not need to do the checks each time it gets a
561         code point or advances to the next code point.
562
563         No change in behavior except a performance increase.
564         Covered by existing tests.
565
566         * platform/URLParser.cpp:
567         (WebCore::CodePointIterator::CodePointIterator):
568         (WebCore::CodePointIterator::operator==):
569         (WebCore::CodePointIterator::operator!=):
570         (WebCore::CodePointIterator::operator=):
571         (WebCore::CodePointIterator::atEnd):
572         (WebCore::CodePointIterator<LChar>::operator):
573         (WebCore::CodePointIterator<UChar>::operator):
574         (WebCore::isWindowsDriveLetter):
575         (WebCore::shouldCopyFileURL):
576         (WebCore::isPercentEncodedDot):
577         (WebCore::isSingleDotPathSegment):
578         (WebCore::isDoubleDotPathSegment):
579         (WebCore::consumeSingleDotPathSegment):
580         (WebCore::consumeDoubleDotPathSegment):
581         (WebCore::URLParser::failure):
582         (WebCore::URLParser::parse):
583         (WebCore::URLParser::parseAuthority):
584         (WebCore::parseIPv4Number):
585         (WebCore::parseIPv4Host):
586         (WebCore::parseIPv6Host):
587         (WebCore::URLParser::parsePort):
588         (WebCore::URLParser::parseHost):
589         * platform/URLParser.h:
590
591 2016-09-14  Antti Koivisto  <antti@apple.com>
592
593         Move text decoration style computation from RenderObject to TextDecorationPainter
594         https://bugs.webkit.org/show_bug.cgi?id=162004
595
596         Reviewed by Zalan Bujtas.
597
598         It is mostly an implementation detail of TextDecorationPainter.
599
600         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
601         (AXAttributeStringSetStyle):
602         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
603         (AXAttributeStringSetStyle):
604         * rendering/RenderObject.cpp:
605         (WebCore::decorationColor): Deleted.
606         (WebCore::RenderObject::getTextDecorationColorsAndStyles): Deleted.
607         * rendering/RenderObject.h:
608         * rendering/TextDecorationPainter.cpp:
609         (WebCore::TextDecorationPainter::TextDecorationPainter):
610         (WebCore::TextDecorationPainter::paintTextDecoration):
611         (WebCore::decorationColor):
612         * rendering/TextDecorationPainter.h:
613
614 2016-09-15  Dave Hyatt  <hyatt@apple.com>
615
616         [CSS Parser] Make stylesheets parse using the new parser if the setting is enabled
617         https://bugs.webkit.org/show_bug.cgi?id=162018
618
619         Reviewed by Zalan Bujtas.
620
621         * css/parser/CSSParser.cpp:
622         (WebCore::CSSParserContext::CSSParserContext):
623         (WebCore::CSSParser::parseSheet):
624         * css/parser/CSSParserMode.h:
625
626 2016-09-15  Fujii Hironori  <Hironori.Fujii@sony.com>
627
628         [CMake] Refactor GENERATE_BINDINGS
629         https://bugs.webkit.org/show_bug.cgi?id=161854
630
631         Reviewed by Gyuyoung Kim.
632
633         * CMakeLists.txt: Changed the arguments of GENERATE_BINDINGS to
634         new style.  Removed add_custom_command of preprocess-idls.pl which
635         is moved to GENERATE_BINDINGS.  Moved IDL_ATTRIBUTES_FILE into
636         GENERATE_BINDINGS.
637
638 2016-09-14  Anders Carlsson  <andersca@apple.com>
639
640         Add CSS -webkit-appearance property for Apple Pay buttons
641         https://bugs.webkit.org/show_bug.cgi?id=161986
642         rdar://problem/27459216
643
644         Reviewed by Dean Jackson.
645
646         Add a new -webkit-appearance property, "-apple-pay-button".
647         Also, add two properties, "-apple-pay-button-type" and "-apple-pay-button-style".
648
649         * WebCore.xcodeproj/project.pbxproj:
650         Add RenderThemeCocoa.h and RenderThemeCocoa.mm.
651
652         * css/CSSComputedStyleDeclaration.cpp:
653         (WebCore::ComputedStyleExtractor::propertyValue):
654         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
655
656         * css/CSSPrimitiveValueMappings.h:
657         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
658         (WebCore::CSSPrimitiveValue::operator ApplePayButtonStyle):
659         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
660         Add ApplePayButtonStyle and ApplePayButtonType conversion routines.
661
662         * css/CSSPropertyNames.in:
663         Add -apple-pay-button-style and -apple-pay-button-type.
664
665         * css/CSSValueKeywords.in:
666         Add CSS values.
667
668         * css/parser/CSSParser.cpp:
669         (WebCore::isValidKeywordPropertyAndValue):
670         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
671
672         * css/parser/CSSParserFastPaths.cpp:
673         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
674         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
675
676         (WebCore::isAppleLegacyCSSPropertyKeyword):
677         New function that returns whether the CSS property should be rewritten to -webkit-.
678         We want to rewrite -apple- but not -apple-pay-.
679
680         (WebCore::cssPropertyID):
681         Use the newly added isAppleLegacyCSSPropertyKeyword.
682
683         (WebCore::isAppleLegacyCSSValueKeyword):
684         Check for "-apple-pay-" in addition to "-apple-system-".
685
686         * platform/ThemeTypes.h:
687         Add ApplePayButtonPart.
688
689         * platform/spi/cocoa/PassKitSPI.h:
690         Add PKDrawApplePayButton declaration.
691
692         * rendering/RenderTheme.cpp:
693         (WebCore::RenderTheme::adjustStyle):
694         Handle ApplePayButtonPart.
695
696         (WebCore::RenderTheme::paint):
697         Handle ApplePayButtonPart.
698
699         * rendering/RenderTheme.h:
700         (WebCore::RenderTheme::adjustApplePayButtonStyle):
701         (WebCore::RenderTheme::paintApplePayButton):
702         Add new functions.
703
704         * rendering/RenderThemeCocoa.h: Added.
705         * rendering/RenderThemeCocoa.mm: Added.
706         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle):
707         Adjust the minimum width and minimum height accordingly.
708
709         (WebCore::toPKPaymentButtonStyle):
710         (WebCore::toPKPaymentButtonType):
711         Helper functions that convert our WebCore types to PK types.
712
713         (WebCore::RenderThemeCocoa::paintApplePayButton):
714         Call PKDrawApplePayButton.
715
716         * rendering/RenderThemeIOS.h:
717         * rendering/RenderThemeMac.h:
718         Inherit from RenderThemeCocoa.
719
720         * rendering/style/RenderStyle.h:
721         (WebCore::RenderStyle::applePayButtonStyle):
722         (WebCore::RenderStyle::applePayButtonType):
723         (WebCore::RenderStyle::setApplePayButtonStyle):
724         (WebCore::RenderStyle::setApplePayButtonType):
725         (WebCore::RenderStyle::initialApplePayButtonStyle):
726         (WebCore::RenderStyle::initialApplePayButtonType):
727         * rendering/style/RenderStyleConstants.h:
728         * rendering/style/StyleRareInheritedData.cpp:
729         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
730         (WebCore::StyleRareInheritedData::operator==):
731         * rendering/style/StyleRareInheritedData.h:
732         Add new style members for the button style and button type properties.
733
734 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
735
736         [css-grid] Implement fit-content track size
737         https://bugs.webkit.org/show_bug.cgi?id=161379
738
739         Reviewed by Manuel Rego Casasnovas.
740
741         This implements the new <fit-content> track size which is defined as follows: "Represents
742         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
743         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
744         greater than the auto minimum."
745
746         From the parsing POV fit-content was implemented as a new type of function which only takes
747         one argument. That forced us to refactor some code because minmax() was the only allowed
748         function for <track-size>s so far.
749
750         The implementation key is a new attribute in GridTrack called growthLimitCap which is
751         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
752         were adapted to this change like for example the sorting of tracks by growth potential (we
753         need to consider the caps).
754
755         Tests: fast/css-grid-layout/fit-content-columns.html
756         fast/css-grid-layout/fit-content-rows.html
757
758         * css/CSSComputedStyleDeclaration.cpp:
759         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
760         * css/StyleBuilderConverter.h:
761         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
762         * css/parser/CSSParser.cpp:
763         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
764         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
765         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
766         it'll be available once we switch to the new parser.
767         * rendering/RenderGrid.cpp:
768         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
769         keep it fast in any case.
770         (WebCore::GridTrack::growthLimit): Ditto.
771         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
772         never higher than the cap.
773         (WebCore::GridTrack::infiniteGrowthPotential):
774         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
775         keep it fast in any case.
776         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
777         keep it fast in any case.
778         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
779         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
780         (WebCore::GridTrack::setInfinitelyGrowable):
781         (WebCore::GridTrack::setGrowthLimitCap): Added.
782         (WebCore::GridTrack::growthLimitCap): Ditto.
783         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
784         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
785         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
786         it is used to compute relative (percentage) sizes.
787         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
788         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
789         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
790         of the free space.
791         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
792         spaces.
793         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
794         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
795         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
796         but not least, added support for fit-content tracks.
797         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
798         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
799         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
800         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
801         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
802         (WebCore::trackSizeForTrackSizeComputationPhase):
803         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
804         with growth limit caps to support fit-content().
805         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
806         track growth limit cap.
807         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
808         the selected tracks to grow over growth limits in order to respect the track caps eventually
809         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
810         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
811         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
812         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
813         (WebCore::GridTrack::infinitelyGrowable): Deleted.
814         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
815         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
816         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
817         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
818         TrackSizeComputationPhase out of the RenderGrid class.
819         * rendering/style/GridTrackSize.h:
820         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
821         attribute to the constructor to support fit-content GridTrackSizes.
822         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
823         cap set by fit-content().
824         (WebCore::GridTrackSize::minTrackBreadth):
825         (WebCore::GridTrackSize::isFitContent): Added.
826         (WebCore::GridTrackSize::length): Deleted.
827         (WebCore::GridTrackSize::isPercentage): Deleted.
828
829 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
830
831         [css-grid] Fix a dangling reference
832         https://bugs.webkit.org/show_bug.cgi?id=161739
833
834         Reviewed by Alexey Proskuryakov.
835
836         The code was trying to get a reference to a private attribute of a temporary object returned
837         by gridTrackSize().
838
839         * rendering/RenderGrid.cpp:
840         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
841
842 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
843
844         Unreviewed, rolling out r205966.
845
846         Triggered some assertions
847
848         Reverted changeset:
849
850         "[css-grid] Implement fit-content track size"
851         https://bugs.webkit.org/show_bug.cgi?id=161379
852         http://trac.webkit.org/changeset/205966
853
854 2016-09-15  Zalan Bujtas  <zalan@apple.com>
855
856         Cleanup RenderLayer::shouldBeNormalFlowOnly
857         https://bugs.webkit.org/show_bug.cgi?id=161981
858
859         Reviewed by Simon Fraser.
860
861         This patch changes the logic of figuring about if a particular layer is normal flow only by simply checking
862         if the layer creates a stacking context. If it does, we assume that it can't be a normal flow layer anymore.
863         This patch slightly changes behaviour by making layers with isolation and reflection to be non normal flow layers anymore.    
864
865         Covered by existing testcases.
866
867         * rendering/RenderLayer.cpp:
868         (WebCore::RenderLayer::calculateClipRects):
869
870 2016-09-07  Sergio Villar Senin  <svillar@igalia.com>
871
872         [css-grid] Implement fit-content track size
873         https://bugs.webkit.org/show_bug.cgi?id=161379
874
875         Reviewed by Manuel Rego Casasnovas.
876
877         This implements the new <fit-content> track size which is defined as follows: "Represents
878         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
879         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
880         greater than the auto minimum."
881
882         From the parsing POV fit-content was implemented as a new type of function which only takes
883         one argument. That forced us to refactor some code because minmax() was the only allowed
884         function for <track-size>s so far.
885
886         The implementation key is a new attribute in GridTrack called growthLimitCap which is
887         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
888         were adapted to this change like for example the sorting of tracks by growth potential (we
889         need to consider the caps).
890
891         Tests: fast/css-grid-layout/fit-content-columns.html
892         fast/css-grid-layout/fit-content-rows.html
893
894         * css/CSSComputedStyleDeclaration.cpp:
895         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
896         * css/StyleBuilderConverter.h:
897         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
898         * css/parser/CSSParser.cpp:
899         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
900         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
901         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
902         it'll be available once we switch to the new parser.
903         * rendering/RenderGrid.cpp:
904         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
905         keep it fast in any case.
906         (WebCore::GridTrack::growthLimit): Ditto.
907         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
908         never higher than the cap.
909         (WebCore::GridTrack::infiniteGrowthPotential):
910         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
911         keep it fast in any case.
912         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
913         keep it fast in any case.
914         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
915         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
916         (WebCore::GridTrack::setInfinitelyGrowable):
917         (WebCore::GridTrack::setGrowthLimitCap): Added.
918         (WebCore::GridTrack::growthLimitCap): Ditto.
919         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
920         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
921         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
922         it is used to compute relative (percentage) sizes.
923         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
924         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
925         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
926         of the free space.
927         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
928         spaces.
929         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
930         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
931         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
932         but not least, added support for fit-content tracks.
933         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
934         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
935         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
936         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
937         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
938         (WebCore::trackSizeForTrackSizeComputationPhase):
939         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
940         with growth limit caps to support fit-content().
941         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
942         track growth limit cap.
943         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
944         the selected tracks to grow over growth limits in order to respect the track caps eventually
945         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
946         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
947         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
948         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
949         (WebCore::GridTrack::infinitelyGrowable): Deleted.
950         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
951         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
952         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
953         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
954         TrackSizeComputationPhase out of the RenderGrid class.
955         * rendering/style/GridTrackSize.h:
956         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
957         attribute to the constructor to support fit-content GridTrackSizes.
958         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
959         cap set by fit-content().
960         (WebCore::GridTrackSize::minTrackBreadth):
961         (WebCore::GridTrackSize::isFitContent): Added.
962         (WebCore::GridTrackSize::length): Deleted.
963         (WebCore::GridTrackSize::isPercentage): Deleted.
964
965 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
966
967         Fix build warnings in the mediastream code
968         https://bugs.webkit.org/show_bug.cgi?id=161957
969
970         Reviewed by Philippe Normand.
971
972         * platform/mediastream/MediaConstraints.cpp:
973         (WebCore::MediaConstraint::create): Added assertion and mock return.
974         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
975         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint):
976         Added assertion and mock return.
977         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint):
978         Added assertion and mock return.
979
980 2016-09-15  Youenn Fablet  <youenn@apple.com>
981
982         Rebase binding tests after r205953
983         https://bugs.webkit.org/show_bug.cgi?id=162012
984
985         Unreviewed.
986
987         * bindings/scripts/test/JS/JSTestNode.cpp:
988         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
989         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
990         * bindings/scripts/test/JS/JSTestObj.cpp:
991         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
992         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
993         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
994         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
995         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
996         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
997         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
998         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
999         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
1000         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
1001         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
1002         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
1003         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
1004         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
1005         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
1006         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
1007
1008 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
1009
1010         [WebRTC][OpenWebRTC] crash in maybeHandleChangeMutedState
1011         https://bugs.webkit.org/show_bug.cgi?id=161619
1012
1013         Added OpenWebRTC support to the RealtimeMediaSource mock class.
1014
1015         Reviewed by Eric Carlson.
1016
1017         Fixed tests.
1018
1019         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
1020         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr): Allowed
1021         inheritance of the class, required to use it when creating the
1022         mock class. Added a new constructor to create the class with null
1023         mediastream.
1024         * platform/mock/MockRealtimeMediaSource.cpp:
1025         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): Use
1026         the new BaseRealtimeMediaSourceClass in the constructor.
1027         * platform/mock/MockRealtimeMediaSource.h: Added a new
1028         BaseRealtimeMediaSourceClass defined using the
1029         RealtimeMediaSourceOwr class for OpenWebRTC platform.
1030
1031 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
1032
1033         [css-grid] Fix intrinsic size computation with flexible sized tracks
1034         https://bugs.webkit.org/show_bug.cgi?id=161903
1035
1036         Reviewed by Manuel Rego Casasnovas.
1037
1038         This is fixing a regression added in r192154. When computing the min content size of a grid
1039         container (min preferred logical width) we should not take into account the fr tracks. As
1040         stated in the early versions of the spec that size is the sum of the tracks' base sizes
1041         before running the maximize tracks step.
1042
1043         That regression was causing sizing issues in grids with fr tracks both when under
1044         min|max-content constrains and also when used as grid items (in nested grids).
1045
1046         * rendering/RenderGrid.cpp:
1047         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
1048
1049 2016-09-13  Sergio Villar Senin  <svillar@igalia.com>
1050
1051         [css-grid] Too many gaps with trailing collapsing tracks
1052         https://bugs.webkit.org/show_bug.cgi?id=161905
1053
1054         Reviewed by Darin Adler.
1055
1056         The total number and size of gaps were incorrectly computed whenever there were trailing
1057         collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
1058         much the amount of hash table queries required to know the gaps between two lines. We were
1059         considering that a gap always exist between 2 consecutive tracks if the first one is not
1060         empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
1061         sequences) but not for all the cases (NOTEMPTY|EMPTY+).
1062
1063         * rendering/RenderGrid.cpp:
1064         (WebCore::RenderGrid::guttersSize):
1065
1066 2016-09-15  Youenn Fablet  <youenn@apple.com>
1067
1068         callPromiseFunction should be made usable for custom binding code
1069         https://bugs.webkit.org/show_bug.cgi?id=161961
1070
1071         Reviewed by Darin Adler.
1072
1073         Covered by updated test.
1074
1075         * bindings/js/JSDOMBinding.h:
1076         (WebCore::castThisValue): Utility function to cast this value to a specific type.
1077         * bindings/js/JSDOMPromise.h:
1078         (WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
1079         for improved efficiency. Added workerMode template parameter.
1080         (WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
1081         * bindings/js/JSMediaDevicesCustom.cpp:
1082         (WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
1083         (WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
1084         * bindings/scripts/CodeGeneratorJS.pm:
1085         (GenerateImplementation): Updated to use template parameter.
1086         * bindings/scripts/test/JS/JSTestNode.cpp:
1087         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
1088         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
1089         * bindings/scripts/test/JS/JSTestObj.cpp:
1090         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
1091         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
1092         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
1093         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
1094         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
1095         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
1096         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
1097         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
1098         * bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.
1099
1100 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
1101
1102         WebCrypto algorithms should be exposed via KeyAlgorithm dictionary
1103         https://bugs.webkit.org/show_bug.cgi?id=128748
1104         <rdar://problem/27359438>
1105
1106         Reviewed by Brent Fulgham and Chris Dumez.
1107
1108         Replace custom CryptoAlgorithmBuilder/buildAlgorithmDescription with KeyAlgorithm dictionary which is
1109         defined by the spec: https://www.w3.org/TR/WebCryptoAPI/#key-algorithm-dictionary. Moreover, mark
1110         CryptoKey.usages as CachedAttribute.
1111
1112         Tests: crypto/subtle/crypto-key-algorithm-gc.html
1113                crypto/subtle/crypto-key-usages-gc.html
1114
1115         * PlatformEfl.cmake:
1116         * PlatformGTK.cmake:
1117         * PlatformMac.cmake:
1118         Remove CryptoAlgorithmDescriptionBuilder.cpp.
1119         * WebCore.xcodeproj/project.pbxproj:
1120         * bindings/js/JSCryptoAlgorithmBuilder.cpp:
1121         (WebCore::JSCryptoAlgorithmBuilder::add):
1122         (WebCore::JSCryptoAlgorithmBuilder::createEmptyClone): Deleted.
1123         * bindings/js/JSCryptoAlgorithmBuilder.h:
1124         * bindings/js/JSCryptoKeyCustom.cpp:
1125         (WebCore::JSCryptoKey::algorithm):
1126         Get rid of dependency on CryptoAlgorithmDescriptionBuilder.
1127         * crypto/CryptoAlgorithmDescriptionBuilder.cpp: Removed.
1128         * crypto/CryptoAlgorithmDescriptionBuilder.h: Removed.
1129         Replace it with KeyAlgorithm.
1130         * crypto/CryptoKey.cpp:
1131         (WebCore::CryptoKey::CryptoKey):
1132         (WebCore::CryptoKey::buildAlgorithmDescription): Deleted.
1133         * crypto/CryptoKey.h:
1134         (WebCore::KeyAlgorithm::KeyAlgorithm):
1135         (WebCore::KeyAlgorithm::~KeyAlgorithm):
1136         (WebCore::CryptoKey::algorithmIdentifier):
1137         * crypto/CryptoKey.idl:
1138         Add KeyAlgorithm dictionary which is returned via CryptoKey.buildAlgorithm() method,
1139         and rename m_algorithm to m_algorithmIdentifier to distingush it with newly
1140         added KeyAlgorithm dictionary.
1141         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
1142         (WebCore::buildAlgorithm):
1143         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
1144         * crypto/keys/CryptoKeyAES.cpp:
1145         (WebCore::CryptoKeyAES::buildAlgorithm):
1146         (WebCore::CryptoKeyAES::buildAlgorithmDescription): Deleted.
1147         * crypto/keys/CryptoKeyAES.h:
1148         (WebCore::AesKeyAlgorithm::AesKeyAlgorithm):
1149         (WebCore::AesKeyAlgorithm::~AesKeyAlgorithm):
1150         * crypto/keys/CryptoKeyHMAC.cpp:
1151         (WebCore::CryptoKeyHMAC::buildAlgorithm):
1152         (WebCore::CryptoKeyHMAC::buildAlgorithmDescription): Deleted.
1153         * crypto/keys/CryptoKeyHMAC.h:
1154         (WebCore::HmacKeyAlgorithm::HmacKeyAlgorithm):
1155         (WebCore::HmacKeyAlgorithm::~HmacKeyAlgorithm):
1156         * crypto/keys/CryptoKeyRSA.h:
1157         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm):
1158         (WebCore::RsaKeyAlgorithm::~RsaKeyAlgorithm):
1159         (WebCore::RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm):
1160         (WebCore::RsaHashedKeyAlgorithm::~RsaHashedKeyAlgorithm):
1161         * crypto/mac/CryptoKeyRSAMac.cpp:
1162         (WebCore::CryptoKeyRSA::buildAlgorithm):
1163         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
1164
1165 2016-09-14  Chris Dumez  <cdumez@apple.com>
1166
1167         REGRESSION (r205670): ASSERTION FAILED: methodTable(vm)->toThis(this, exec, NotStrictMode) == this
1168         https://bugs.webkit.org/show_bug.cgi?id=161982
1169
1170         Reviewed by Saam Barati.
1171
1172         We no longer need a custom [[SetPrototypeOf]] anymore as JSProxy::setPrototypeOf()
1173         no longer forwards the call to its target.
1174
1175         No new layout tests because the behavior only changes in the context of the JSC
1176         tests (which were updated in this patch).
1177
1178         * bindings/js/JSDOMWindowCustom.cpp:
1179         (WebCore::JSDOMWindow::setPrototype): Deleted.
1180         * page/DOMWindow.idl:
1181
1182 2016-09-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1183
1184         Media controls behave strangely when changing media sources
1185         https://bugs.webkit.org/show_bug.cgi?id=161914
1186         <rdar://problem/28227805>
1187
1188         Reviewed by Tim Horton.
1189
1190         Addresses media controls flickering while changing the source of a media element. To accomplish this, we make
1191         the following changes to the media controls main content heuristic:
1192
1193         - Prevent elements that are not mostly within the mainframe rect (or elements with empty rects) from showing
1194           media controls. Many websites that rely on same document navigation will move videos offscreen when navigating
1195           to a section of their site that does not play media. Without this check, we would not know to hide a video
1196           element on certain popular websites that use this technique, since the video has been interacted with in the
1197           past.
1198
1199         - Rather than check whether a media element currently has video/audio sources, check whether it has ever had
1200           audio. Many websites will use the same media element across different videos and change only the source, and
1201           we should not prevent a media element from having media controls on grounds of having no audio or video in
1202           this case.
1203
1204         - Rather than add user gesture and playback behavior restrictions before dispatching an ended event, add only
1205           the gesture restriction immediately, and add the playback restriction after waiting for a grace period only if
1206           the user has not interacted with the video since ending, and the video is not currently playing or about to
1207           play. This gives the user a chance to interact with the controls when a video ends, but also allows the page
1208           to load or begin playing a new video with the same media element without thrashing media control state.
1209
1210         Adds 3 new API tests.
1211
1212         * html/HTMLMediaElement.cpp:
1213         (WebCore::HTMLMediaElement::HTMLMediaElement):
1214         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1215         (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged):
1216         (WebCore::HTMLMediaElement::seekWithTolerance):
1217         (WebCore::HTMLMediaElement::beginScrubbing):
1218         (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
1219         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1220         (WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
1221         * html/HTMLMediaElement.h:
1222         (WebCore::HTMLMediaElement::hasEverHadAudio):
1223         (WebCore::HTMLMediaElement::hasEverHadVideo):
1224         * html/MediaElementSession.cpp:
1225         (WebCore::MediaElementSession::canShowControlsManager):
1226         (WebCore::isElementRectMostlyInMainFrame):
1227         * platform/graphics/MediaPlayer.h:
1228         (WebCore::MediaPlayerClient::mediaPlayerActiveSourceBuffersChanged):
1229         * platform/graphics/MediaPlayerPrivate.h:
1230         (WebCore::MediaPlayerPrivateInterface::notifyActiveSourceBuffersChanged):
1231         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1232         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1233         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::notifyActiveSourceBuffersChanged):
1234         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1235         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
1236         (WebCore::MediaSourcePrivateAVFObjC::sourceBufferPrivateDidChangeActiveState):
1237
1238 2016-09-14  Eric Carlson  <eric.carlson@apple.com>
1239
1240         [MediaStream] Minor cleanup
1241         https://bugs.webkit.org/show_bug.cgi?id=161976
1242
1243         Reviewed by Youenn Fablet and Dean Jackson.
1244
1245         No new tests, no behavior change.
1246
1247         * CMakeLists.txt:
1248         * DerivedSources.make:
1249         * Modules/mediastream/CaptureDeviceInfo.h: Removed.
1250         * Modules/mediastream/CaptureDeviceManager.cpp: Removed.
1251         * Modules/mediastream/CaptureDeviceManager.h: Removed.
1252         * Modules/mediastream/MediaDevicesRequest.cpp:
1253         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
1254         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Deleted.
1255         (WebCore::MediaDevicesRequest::requestOrigin): Deleted.
1256         * Modules/mediastream/MediaDevicesRequest.h:
1257         * Modules/mediastream/MediaStreamTrackSourcesCallback.h: Removed.
1258         * Modules/mediastream/MediaStreamTrackSourcesCallback.idl: Removed.
1259         * Modules/mediastream/SourceInfo.cpp: Removed.
1260         * Modules/mediastream/SourceInfo.h: Removed.
1261         * Modules/mediastream/SourceInfo.idl: Removed.
1262         * WebCore.xcodeproj/project.pbxproj:
1263         * platform/mediastream/CaptureDevice.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceInfo.h.
1264         (WebCore::CaptureDevice::CaptureDevice):
1265         (WebCore::CaptureDevice::persistentId):
1266         (WebCore::CaptureDevice::label):
1267         (WebCore::CaptureDevice::groupId):
1268         (WebCore::CaptureDevice::kind):
1269         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
1270         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
1271         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
1272         * platform/mediastream/CaptureDeviceManager.cpp: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp.
1273         (CaptureDeviceManager::getSourcesInfo):
1274         * platform/mediastream/CaptureDeviceManager.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.h.
1275         (WebCore::CaptureSessionInfo::~CaptureSessionInfo):
1276         (WebCore::CaptureSessionInfo::supportsVideoSize):
1277         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions):
1278         * platform/mediastream/MediaStreamTrackSourcesRequestClient.h: Removed.
1279         * platform/mediastream/RealtimeMediaSourceCenter.h:
1280         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1281         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1282         (WebCore::AVCaptureDeviceManager::getSourcesInfo):
1283         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1284         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
1285         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources): Deleted.
1286         (WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): Deleted.
1287         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1288         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1289         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamDevices):
1290         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources): Deleted.
1291         (WebCore::RealtimeMediaSourceCenterOwr::sourceWithUID): Deleted.
1292         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
1293         * platform/mock/MockRealtimeMediaSource.cpp:
1294         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
1295         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
1296         (WebCore::MockRealtimeMediaSource::trackSourceWithUID): Deleted.
1297         * platform/mock/MockRealtimeMediaSource.h:
1298         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1299         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
1300         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources): Deleted.
1301         (WebCore::MockRealtimeMediaSourceCenter::sourceWithUID): Deleted.
1302         * platform/mock/MockRealtimeMediaSourceCenter.h:
1303
1304 2016-09-14  Antti Koivisto  <antti@apple.com>
1305
1306         Move more code out from RenderObject
1307         https://bugs.webkit.org/show_bug.cgi?id=161980
1308
1309         Reviewed by Zalan Bujtas.
1310
1311         Move some functions that are only needed for RenderElement there.
1312         Move collapsing anonymous table rows to RenderTableRow.
1313
1314         * rendering/RenderElement.cpp:
1315         (WebCore::RenderElement::hasOutlineAnnotation):
1316         (WebCore::RenderElement::hasSelfPaintingLayer):
1317         (WebCore::RenderElement::checkForRepaintDuringLayout):
1318         * rendering/RenderElement.h:
1319         (WebCore::RenderElement::hasOutline):
1320         (WebCore::RenderElement::hasHiddenBackface): Deleted.
1321         * rendering/RenderLayerCompositor.cpp:
1322         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
1323         * rendering/RenderObject.cpp:
1324         (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
1325         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
1326         (WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
1327         (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
1328         (WebCore::RenderObject::hasOutlineAnnotation): Deleted.
1329         (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.
1330         (WebCore::collapseAnonymousTableRowsIfNeeded): Deleted.
1331         * rendering/RenderObject.h:
1332         (WebCore::RenderObject::hasLayer):
1333         (WebCore::RenderObject::canBeSelectionLeaf):
1334         (WebCore::RenderObject::hasOutline): Deleted.
1335         (WebCore::RenderObject::hasSelectedChildren): Deleted.
1336         * rendering/RenderTableRow.cpp:
1337         (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows):
1338         * rendering/RenderTableRow.h:
1339         * rendering/RenderView.cpp:
1340         (WebCore::RenderView::rootBackgroundIsEntirelyFixed):
1341
1342 2016-09-14  Daniel Bates  <dabates@apple.com>
1343
1344         Switch CSSParser to use CSSParserFastPaths::isKeywordPropertyID()
1345         https://bugs.webkit.org/show_bug.cgi?id=161983
1346
1347         Reviewed by David Hyatt.
1348
1349         Towards switching to the new CSS parser keyword properties validation logic,
1350         switch over the old CSS parser logic for determining a keyword property to
1351         use the analogous logic in the new CSS parser.
1352
1353         A side benefit of this change is that it is a step towards unifying CSS- and
1354         SVG CSS- keyword properties. The new CSS parser does not make a distinction
1355         between these kinds of properties and will allow us to have a shared code path
1356         for validating a keyword property.
1357
1358         No functionality was changed. So, no new tests.
1359
1360         * css/parser/CSSParser.cpp: Include header CSSParserFastPaths.h.
1361         (WebCore::isValidKeywordPropertyAndValue): Validate SVG CSS keyword properties. This
1362         logic was moved from CSSParser::parseSVGValue(). In subsequent patches we will switch
1363         the old CSS parser from this function to CSSParserFastPaths::isValidKeywordPropertyAndValue().
1364         (WebCore::parseKeywordValue): Modified to call CSSParserFastPaths::isKeywordPropertyID().
1365         (WebCore::CSSParser::parseValue): Ditto.
1366         (WebCore::isKeywordPropertyID): Deleted. Incorporated its functionality into
1367         CSSParserFastPaths::isKeywordPropertyID().
1368         * css/parser/CSSParserFastPaths.cpp:
1369         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Incorporates the functionality
1370         of WebCore::isKeywordPropertyID().
1371         * css/parser/SVGCSSParser.cpp:
1372         (WebCore::CSSParser::parseSVGValue): Move properties that can be processed as
1373         keyword properties from here to WebCore::isValidKeywordPropertyAndValue().
1374
1375 2016-09-13  Dean Jackson  <dino@apple.com>
1376
1377         Rename parseColorParameters and clean up conditional
1378         https://bugs.webkit.org/show_bug.cgi?id=161941
1379         <rdar://problem/28292750>
1380
1381         Reviewed by Dan Bates.
1382
1383         In preparation for adding color() support, rename the existing
1384         parseColorParameters to parseRGBParameters.
1385
1386         Also clean up the logic in the parseColorFromValue function.
1387
1388         * css/parser/CSSParser.cpp:
1389         (WebCore::CSSParser::parseRGBParameters):
1390         (WebCore::CSSParser::parseColorFromValue):
1391         (WebCore::CSSParser::parseColorParameters): Deleted.
1392         * css/parser/CSSParser.h:
1393
1394 2016-09-14  Chris Dumez  <cdumez@apple.com>
1395
1396         Add support hr.color IDL attribute
1397         https://bugs.webkit.org/show_bug.cgi?id=161977
1398
1399         Reviewed by Darin Adler.
1400
1401         Add support hr.color IDL attribute as per:
1402         - https://html.spec.whatwg.org/#HTMLHRElement-partial
1403
1404         Even though this is a legacy attribute, it is still part of the HTML specification
1405         and it is still supported by Firefox and Chrome.
1406
1407         Also note that even though WebKit does not currently support the 'color' IDL
1408         attribute on <hr>, it does support the 'color' content attribute on <hr>.
1409         Therefore, we only need to reflect the 'color' content attribute.
1410
1411         No new tests, rebaselined existing test.
1412
1413         * html/HTMLHRElement.idl:
1414
1415 2016-09-14  Alex Christensen  <achristensen@webkit.org>
1416
1417         URLParser: Add fast path for hosts containing no non-ASCII or percent characters
1418         https://bugs.webkit.org/show_bug.cgi?id=161970
1419
1420         Reviewed by Daniel Bates.
1421
1422         Covered by existing tests.
1423
1424         * platform/URLParser.cpp:
1425         (WebCore::URLParser::parse):
1426         (WebCore::URLParser::parseHost):
1427         * platform/URLParser.h:
1428         When parsing the host of a URL, if it contains non-ASCII characters or percent-encoded values,
1429         we need to do additional encoding.  Many URLs, including all already-parsed URLs, do not have
1430         such characters in their host, and therefore do not need the additional encoding.  Skipping
1431         the additional encoding significantly speeds up my URL parsing benchmark.
1432
1433 2016-09-14  Zalan Bujtas  <zalan@apple.com>
1434
1435         ShowRenderTree should take position offset into account when printing inflow positioned renderers.
1436         https://bugs.webkit.org/show_bug.cgi?id=161978
1437
1438         Reviewed by Simon Fraser.
1439
1440         Adjust (x, y) with the inflow positioned renderer's offset.  
1441
1442         Not testable.
1443
1444         * rendering/RenderObject.cpp:
1445         (WebCore::RenderObject::showRenderObject):
1446
1447 2016-09-14  Alex Christensen  <achristensen@webkit.org>
1448
1449         URLParser: Add fast path for utf8 encoding queries
1450         https://bugs.webkit.org/show_bug.cgi?id=161968
1451
1452         Reviewed by Daniel Bates.
1453
1454         No change in behavior.  Covered by existing tests.
1455
1456         * platform/URLParser.cpp:
1457         (WebCore::utf8PercentEncodeQuery):
1458         (WebCore::URLParser::parse):
1459         If the text encoding is UTF-8 (which is quite common), then we can encode the query
1460         as we iterate its code points. This reduces memory allocation and significantly speeds
1461         up my URL parsing benchmark.
1462
1463 2016-09-14  Chris Dumez  <cdumez@apple.com>
1464
1465         Regression(r152725): generate-bindings.pl --write-dependencies does not work
1466         https://bugs.webkit.org/show_bug.cgi?id=161897
1467
1468         Reviewed by Darin Adler.
1469
1470         r152725 inadvertently dropped the code generating the JS*.dep files when
1471         --write-dependencies is passed to the bindings generator. As a result,
1472         our dependency tracking was broken. This patch restores the code that
1473         was dropped in r152725.
1474
1475         * bindings/scripts/CodeGeneratorJS.pm:
1476         (new):
1477         (GenerateHeader):
1478
1479 2016-09-14  Chris Dumez  <cdumez@apple.com>
1480
1481         input.type cannot be set to "file" after being set to another type
1482         https://bugs.webkit.org/show_bug.cgi?id=161943
1483
1484         Reviewed by Daniel Bates.
1485
1486         input.type cannot be set to "file" after being set to another type.
1487         This behavior does not match the HTML specification or the behavior
1488         of Firefox and Chrome. This patch drops this restriction and aligns
1489         our behavior with other browsers.
1490
1491         Test: fast/dom/HTMLInputElement/input-type-change-to-file.html
1492
1493         * html/FileInputType.cpp:
1494         (WebCore::FileInputType::canChangeFromAnotherType): Deleted.
1495         * html/FileInputType.h:
1496         * html/HTMLInputElement.cpp:
1497         (WebCore::HTMLInputElement::updateType):
1498         * html/InputType.cpp:
1499         (WebCore::InputType::canChangeFromAnotherType): Deleted.
1500         * html/InputType.h:
1501
1502 2016-09-14  Carlos Garnacho <carlosg@gnome.org>
1503
1504         [GTK][Wayland] Implement clipboard support
1505         https://bugs.webkit.org/show_bug.cgi?id=146574
1506
1507         Reviewed by Carlos Garcia Campos.
1508
1509         Implement PlatformPasteboard in the GTK+ platform, and move Pasteboard
1510         to using PasteboardStrategy so clipboard management is left to the
1511         UIProcess.
1512
1513         DataObjectGtk is still used in the Pasteboard GTK implementation, it's
1514         now just never backed by a GtkClipboard, this object is instead
1515         serialized through PasteboardStrategy, so the UIProcess side can mirror
1516         the content in a GtkClipboard-backed DataObjectGtk, which is then
1517         exposed to the windowing through PlatformPasteboard/PasteboardHelper.
1518
1519         When requesting clipboard content, it works similarly, the UIProcess
1520         side first updates its DataObjectGtk, which is then mirrored by the
1521         WebProcess through the PasteboardStrategy requests.
1522
1523         * PlatformGTK.cmake: Added PlatformPasteboardGtk.cpp
1524         * editing/gtk/EditorGtk.cpp:
1525         (WebCore::Editor::writeSelectionToPasteboard): Eliminate usage of
1526         PasteboardWebContent callback argument. This is done differently as
1527         we have to signal back the WebProcess.
1528         * platform/Pasteboard.h: Cleaned up of direct GTK+ dependency.
1529         * platform/PasteboardStrategy.h: Added plumbing towards the pasteboard
1530         proxy.
1531         * platform/PlatformPasteboard.h:
1532         * platform/gtk/DataObjectGtk.cpp:
1533         (WebCore::DataObjectGtk::clearAllExceptFilenames): Clear the "smart
1534         paste" flag if set, now that this is DataObjectGtk data.
1535         * platform/gtk/DataObjectGtk.h:
1536         (WebCore::DataObjectGtk::canSmartReplace):
1537         (WebCore::DataObjectGtk::setCanSmartReplace): Added functions, in order
1538         to flag whether a DataObjectGtk has the "smart paste" feature enabled
1539         or not.
1540         * platform/gtk/PasteboardGtk.cpp:
1541         (WebCore::Pasteboard::createForCopyAndPaste):
1542         (WebCore::Pasteboard::createForGlobalSelection):
1543         (WebCore::Pasteboard::Pasteboard):
1544         (WebCore::Pasteboard::writeToClipboard):
1545         (WebCore::Pasteboard::readFromClipboard):
1546         (WebCore::Pasteboard::writePlainText):
1547         (WebCore::Pasteboard::write):
1548         (WebCore::Pasteboard::writePasteboard):
1549         (WebCore::Pasteboard::clear):
1550         (WebCore::Pasteboard::canSmartReplace):
1551         (WebCore::Pasteboard::read):
1552         (WebCore::Pasteboard::hasData):
1553         (WebCore::Pasteboard::types):
1554         (WebCore::Pasteboard::readString):
1555         (WebCore::Pasteboard::readFilenames): Made to use the
1556         PasteboardStrategy instead of PasteboardHelper/GTK+ API.
1557         * platform/gtk/PasteboardHelper.cpp:
1558         (WebCore::PasteboardHelper::~PasteboardHelper):
1559         (WebCore::ClipboardSetData::ClipboardSetData):
1560         (WebCore::clearClipboardContentsCallback):
1561         (WebCore::PasteboardHelper::writeClipboardContents): Remove the GClosure
1562         to notify whether the global selection has been replaced. Use std:function
1563         instead. Remove SmartPasteInclusion argument, now figured out through
1564         DataObjectGtk canSmartPaste() member.
1565         * platform/gtk/PasteboardHelper.h:
1566         * platform/gtk/PlatformPasteboardGtk.cpp: Added.
1567         (WebCore::PlatformPasteboard::PlatformPasteboard):
1568         (WebCore::PlatformPasteboard::writeToClipboard):
1569         (WebCore::PlatformPasteboard::readFromClipboard): Implemented
1570         PlatformPasteboard using PasteboardHelper/GTK+ API.
1571
1572 2016-09-13  Dave Hyatt  <hyatt@apple.com>
1573
1574         [CSS Parser] Enable the new sizes parser by default
1575         https://bugs.webkit.org/show_bug.cgi?id=161931
1576
1577         Reviewed by Zalan Bujtas.
1578
1579         Added new tests in fast/dom/HTMLImageElement/sizes.
1580
1581         * CMakeLists.txt:
1582         * WebCore.xcodeproj/project.pbxproj:
1583         * css/CSSGrammar.y.in:
1584         Remove the old code that parsed source size lists.
1585
1586         * css/MediaQueryEvaluator.cpp:
1587         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
1588         * css/MediaQueryEvaluator.h:
1589         Change to take a const Document&, since the Document is not modified.
1590
1591         * css/SourceSizeList.cpp: Removed.
1592         * css/SourceSizeList.h: Removed.
1593         * css/parser/CSSParser.cpp:
1594         (WebCore::CSSParser::parseSizesAttribute): Deleted.
1595         (WebCore::CSSParser::SourceSize::SourceSize): Deleted.
1596         (WebCore::CSSParser::sourceSize): Deleted.
1597         * css/parser/CSSParser.h:
1598         Remove the old sizes processing code.
1599
1600         * css/parser/MediaQueryParser.cpp:
1601         (WebCore::MediaQueryParser::skipUntilComma):
1602         (WebCore::MediaQueryParser::parseInternal):
1603         Fix a bug I introduced when modifying this code from Blink. The Nones should have been Nots.
1604
1605         * css/parser/SizesAttributeParser.cpp:
1606         (WebCore::SizesAttributeParser::computeLength):
1607         (WebCore::SizesAttributeParser::SizesAttributeParser):
1608         (WebCore::SizesAttributeParser::calculateLengthInPixels):
1609         (WebCore::SizesAttributeParser::mediaConditionMatches):
1610         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
1611         * css/parser/SizesAttributeParser.h:
1612         * css/parser/SizesCalcParser.cpp:
1613         (WebCore::SizesCalcParser::SizesCalcParser):
1614         (WebCore::SizesCalcParser::appendLength):
1615         * css/parser/SizesCalcParser.h:
1616         Make the sizes parsers take a Document, since having separate style and view arguments made
1617         no sense, given that the style used is always the view's.
1618
1619         * html/HTMLImageElement.cpp:
1620         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
1621         (WebCore::HTMLImageElement::selectImageSource):
1622         * html/parser/HTMLPreloadScanner.cpp:
1623         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
1624         Switch image elements and the preload scanner over to the new code.
1625
1626 2016-09-13  Chris Dumez  <cdumez@apple.com>
1627
1628         Unreviewed, rolling out r205887.
1629
1630         Broke the Windows build
1631
1632         Reverted changeset:
1633
1634         "Merge Element::ScrollToOptions and
1635         DOMWindow::ScrollToOptions"
1636         https://bugs.webkit.org/show_bug.cgi?id=161932
1637         http://trac.webkit.org/changeset/205887
1638
1639 2016-09-13  Dean Jackson  <dino@apple.com>
1640
1641         Remove a .rej file.
1642
1643         * animation/DocumentTimeline.h.rej: Removed.
1644
1645 2016-09-13  Alex Christensen  <achristensen@webkit.org>
1646
1647         Implement URLSearchParams
1648         https://bugs.webkit.org/show_bug.cgi?id=161920
1649
1650         Reviewed by Chris Dumez.
1651
1652         Covered by newly passing web platform tests.
1653
1654         * CMakeLists.txt:
1655         * DerivedSources.make:
1656         * WebCore.xcodeproj/project.pbxproj:
1657         * html/DOMURL.cpp:
1658         (WebCore::DOMURL::setQuery):
1659         (WebCore::DOMURL::searchParams):
1660         * html/DOMURL.h:
1661         * html/URLSearchParams.cpp: Added.
1662         (WebCore::URLSearchParams::URLSearchParams):
1663         (WebCore::URLSearchParams::get):
1664         (WebCore::URLSearchParams::has):
1665         (WebCore::URLSearchParams::set):
1666         (WebCore::URLSearchParams::append):
1667         (WebCore::URLSearchParams::getAll):
1668         (WebCore::URLSearchParams::remove):
1669         (WebCore::URLSearchParams::toString):
1670         (WebCore::URLSearchParams::updateURL):
1671         (WebCore::URLSearchParams::Iterator::Iterator):
1672         * html/URLSearchParams.h: Added.
1673         (WebCore::URLSearchParams::create):
1674         (WebCore::URLSearchParams::createIterator):
1675         * html/URLSearchParams.idl: Added.
1676         * html/URLUtils.idl:
1677         * platform/URLParser.cpp:
1678         (WebCore::percentDecode):
1679         (WebCore::URLParser::parseHost):
1680         (WebCore::formURLDecode):
1681         (WebCore::serializeURLEncodedForm):
1682         (WebCore::URLParser::serialize):
1683         * platform/URLParser.h:
1684
1685 2016-09-12  Dean Jackson  <dino@apple.com>
1686
1687         Replace RGBA32 with Color in member variables
1688         https://bugs.webkit.org/show_bug.cgi?id=161856
1689         <rdar://problem/28254324>
1690
1691         Reviewed by Simon Fraser.
1692
1693         In preparation for the Color class to become more than
1694         just a 4-byte RGBA value, I went through a few places
1695         that were using the RGBA32 type directly, and replaced
1696         them with Color. This will make some objects a little
1697         bigger e.g. BorderValue and its friends.
1698
1699         I mostly looked at the places that were using RGBA32 as
1700         a member variable. There is still a lot of RGBA32 use
1701         around the project, in particular the CSS parser.
1702
1703         There should be no behaviour change.
1704
1705         * html/canvas/CanvasRenderingContext2D.cpp: Shadows now use Color.
1706         (WebCore::CanvasRenderingContext2D::setShadow):
1707         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
1708         (WebCore::CanvasRenderingContext2D::didDraw):
1709         * html/canvas/CanvasRenderingContext2D.h:
1710         * html/canvas/CanvasStyle.cpp: Canvas style uses Color for fills and strokes.
1711         (WebCore::CanvasStyle::CanvasStyle):
1712         (WebCore::CanvasStyle::isEquivalentColor):
1713         (WebCore::CanvasStyle::isEquivalentRGBA):
1714         (WebCore::CanvasStyle::applyStrokeColor):
1715         (WebCore::CanvasStyle::applyFillColor):
1716         * html/canvas/CanvasStyle.h:
1717         (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
1718         (WebCore::CanvasStyle::color):
1719
1720         * html/track/TextTrackCueGeneric.h: Foreground, background and
1721         highlight colors.
1722         * platform/graphics/InbandTextTrackPrivateClient.h:
1723         (WebCore::GenericCueData::setForegroundColor):
1724         (WebCore::GenericCueData::setBackgroundColor):
1725         (WebCore::GenericCueData::setHighlightColor):
1726
1727         * page/PageOverlay.cpp: Background color.
1728         (WebCore::PageOverlay::setBackgroundColor):
1729         * page/PageOverlay.h:
1730
1731         * platform/graphics/mac/ColorMac.h: Random function that returned RGBA32.
1732         * platform/graphics/mac/ColorMac.mm:
1733         (WebCore::oldAquaFocusRingColor):
1734
1735         * rendering/RenderTableCell.cpp: Update the size of CollapsedBorderValue.
1736
1737         * rendering/RenderTheme.h: Use a NeverDestroyed Color rather than a static RGBA32.
1738
1739         * rendering/style/BorderValue.h: Use a Color.
1740         (WebCore::BorderValue::BorderValue):
1741         (WebCore::BorderValue::isTransparent):
1742         (WebCore::BorderValue::operator==):
1743         (WebCore::BorderValue::setColor):
1744         (WebCore::BorderValue::color):
1745         * rendering/style/CollapsedBorderValue.h:
1746         (WebCore::CollapsedBorderValue::CollapsedBorderValue):
1747         (WebCore::CollapsedBorderValue::color):
1748         * rendering/style/OutlineValue.h:
1749         (WebCore::OutlineValue::operator==):
1750
1751         * rendering/style/RenderStyle.cpp: Update to match new BorderValue.
1752
1753 2016-09-13  Jer Noble  <jer.noble@apple.com>
1754
1755         [media-source] MediaSource.addSourceBuffer(null) should throw an exception
1756         https://bugs.webkit.org/show_bug.cgi?id=161884
1757
1758         Reviewed by Eric Carlson.
1759
1760         Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer.html
1761
1762         * Modules/mediasource/MediaSource.idl: The addSourceBuffer() parameter is not optional
1763             and not nullable.
1764
1765 2016-09-13  Daniel Bates  <dabates@apple.com>
1766
1767         Remove Chrome app-specific CSS property -webkit-app-region
1768         https://bugs.webkit.org/show_bug.cgi?id=161935
1769
1770         Reviewed by Simon Fraser.
1771
1772         * css/parser/CSSParserFastPaths.cpp:
1773
1774 2016-09-13  Daniel Bates  <dabates@apple.com>
1775
1776         Treat some CSS properties as keyword properties
1777         https://bugs.webkit.org/show_bug.cgi?id=161934
1778
1779         Reviewed by Simon Fraser.
1780
1781         Move validation of the following CSS keyword properties from CSSParser::parseValue() to
1782         WebCore::isValidKeywordPropertyAndValue():
1783
1784         CSSPropertyColumnProgression
1785         CSSPropertyFontStretch
1786         CSSPropertyTextAlign
1787         CSSPropertyUnicodeBidi
1788         CSSPropertyWebkitColumnAxis
1789         CSSPropertyWebkitCursorVisibility
1790         CSSPropertyWebkitTextDecorationStyle
1791         CSSPropertyWebkitTextOrientation
1792         CSSPropertyWebkitTextZoom
1793         CSSPropertyWebkitTouchCallout
1794
1795         Among other benefits, this will make it more straightforward to migrate from CSSParser::is{KeywordPropertyID, ValidKeywordPropertyAndValue}()
1796         to CSSParserFastPaths::is{KeywordPropertyID, ValidKeywordPropertyAndValue}(), respectively.
1797
1798         * css/parser/CSSParser.cpp:
1799         (WebCore::isValidKeywordPropertyAndValue):
1800         (WebCore::isKeywordPropertyID):
1801         (WebCore::CSSParser::parseValue):
1802
1803 2016-09-13  Chris Dumez  <cdumez@apple.com>
1804
1805         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
1806         https://bugs.webkit.org/show_bug.cgi?id=161932
1807
1808         Reviewed by Simon Fraser.
1809
1810         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
1811         Ideally we would merge them on IDL side as well but this is for
1812         another patch.
1813
1814         * WebCore.xcodeproj/project.pbxproj:
1815         * bindings/scripts/CodeGeneratorJS.pm:
1816         (GenerateDictionaryImplementationContent):
1817         * bindings/scripts/test/JS/JSTestObj.cpp:
1818         (WebCore::convertDictionary<TestObj::Dictionary>):
1819         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1820         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1821         (WebCore::convertDictionary<AlternateDictionaryName>):
1822         * dom/Element.h:
1823         * dom/Element.idl:
1824         * dom/ScrollToOptions.h: Added.
1825         * html/HTMLBodyElement.cpp:
1826         (WebCore::HTMLBodyElement::scrollTo):
1827         * page/DOMWindow.h:
1828         * page/DOMWindow.idl:
1829
1830 2016-09-13  Myles C. Maxfield  <mmaxfield@apple.com>
1831
1832         [Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS
1833         https://bugs.webkit.org/show_bug.cgi?id=161877
1834
1835         Reviewed by Simon Fraser.
1836
1837         macOS and iOS have slightly different handling of ascent, descent, and x-height.
1838         This patch migrates them to have the same handling of them.
1839
1840         There are slight behavior changes here because our previous code converted between
1841         floats and doubles in unnecessary places, and does not handle rounding in
1842         consistent ways. The differences are all miniscule, but nevertheless lead to test
1843         results needing to be updated.
1844
1845         Coincidentally, by performing this unification, there are no longer any places
1846         on macOS Sierra which are using the CGFontRef member of PlatformFontData. This
1847         patch removes the member on that operating system for memory savings as well as
1848         clarity.
1849
1850         Covered by existing tests.
1851
1852         * platform/graphics/FontPlatformData.cpp:
1853         * platform/graphics/FontPlatformData.h:
1854         * platform/graphics/cocoa/FontCocoa.mm:
1855         (WebCore::Font::platformInit):
1856         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1857         (WebCore::FontPlatformData::FontPlatformData):
1858         (WebCore::FontPlatformData::platformIsEqual):
1859         (WebCore::FontPlatformData::ctFont):
1860
1861 2016-09-13  Brent Fulgham  <bfulgham@apple.com>
1862
1863         [Win] Unreviewed build fix.
1864
1865         Based on a suggestion by Simon Fraser, I have corrected the
1866         headers to avoid including <d2d1.h> directly, relying instead
1867         on forward declarations.
1868
1869         * platform/graphics/FloatPoint.h:
1870         * platform/graphics/FloatRect.h:
1871         * platform/graphics/FloatSize.h:
1872         * platform/graphics/IntPoint.h:
1873         * platform/graphics/IntRect.h:
1874         * platform/graphics/IntSize.h:
1875         * platform/graphics/transforms/AffineTransform.h:
1876         * platform/graphics/transforms/TransformationMatrix.h:
1877
1878 2016-09-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1879
1880         Get rid of the m_premultiplyAlpha flag of the ImageFrame class
1881         https://bugs.webkit.org/show_bug.cgi?id=159721
1882
1883         Reviewed by Simon Fraser.
1884
1885         This flag was only needed when calling ImageBackingStore::create() in 
1886         ImageFrame::setSize(). Instead we can pass ImageDecoder::m_premultiplyAlpha 
1887         to ImageFrame::setSize(), which is renamed ImageFrame::initializeBackingStore().
1888         The passed premultiplyAlpha can then be passed to ImageBackingStore::create().
1889
1890         * platform/image-decoders/ImageDecoder.cpp:
1891         (WebCore::ImageFrame::ImageFrame):
1892         (WebCore::ImageFrame::operator=):
1893         (WebCore::ImageFrame::initializeBackingStore):
1894         (WebCore::ImageFrame::copyBitmapData): Deleted.
1895         (WebCore::ImageFrame::setSize): Deleted.
1896         * platform/image-decoders/ImageDecoder.h:
1897         (WebCore::ImageFrame::disposalMethod):
1898         (WebCore::ImageFrame::setDisposalMethod):
1899         (WebCore::ImageDecoder::premultiplyAlpha):
1900         (WebCore::ImageFrame::premultiplyAlpha): Deleted.
1901         (WebCore::ImageFrame::setPremultiplyAlpha): Deleted.
1902         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
1903         (WebCore::BMPImageDecoder::frameBufferAtIndex):
1904         * platform/image-decoders/bmp/BMPImageReader.cpp:
1905         (WebCore::BMPImageReader::decodeBMP):
1906         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1907         (WebCore::GIFImageDecoder::decode):
1908         (WebCore::GIFImageDecoder::initFrameBuffer):
1909         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1910         (WebCore::ICOImageDecoder::frameCount):
1911         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1912         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
1913         (WebCore::JPEGImageDecoder::outputScanlines):
1914         * platform/image-decoders/png/PNGImageDecoder.cpp:
1915         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1916         (WebCore::PNGImageDecoder::rowAvailable):
1917         (WebCore::PNGImageDecoder::readChunks):
1918         (WebCore::PNGImageDecoder::initFrameBuffer):
1919         (WebCore::setPixelRGB): Deleted.
1920         (WebCore::setPixelRGBA): Deleted.
1921         (WebCore::setPixelPremultipliedRGBA): Deleted.
1922         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1923         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
1924         (WebCore::WEBPImageDecoder::decode):
1925
1926 2016-09-12  Brent Fulgham  <bfulgham@apple.com>
1927
1928         [Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
1929         https://bugs.webkit.org/show_bug.cgi?id=161818
1930
1931         Reviewed by Dean Jackson.
1932
1933         Tested by new TestWebKitAPI tests.
1934
1935         Add new casting operators to and from various Direct2D data types.
1936
1937         * PlatformWin.cmake:
1938         * platform/graphics/FloatPoint.h:
1939         (WebCore::FloatPoint::FloatPoint):
1940         * platform/graphics/FloatRect.h:
1941         * platform/graphics/FloatSize.h:
1942         (WebCore::FloatSize::FloatSize):
1943         * platform/graphics/IntPoint.h:
1944         * platform/graphics/IntRect.h:
1945         * platform/graphics/IntSize.h:
1946         * platform/graphics/transforms/AffineTransform.h:
1947         * platform/graphics/transforms/TransformationMatrix.h:
1948         * platform/graphics/win/FloatPointDirect2D.cpp:
1949         * platform/graphics/win/FloatRectDirect2D.cpp:
1950         * platform/graphics/win/FloatSizeDirect2D.cpp:
1951         * platform/graphics/win/IntPointWin.cpp:
1952         (WebCore::IntPoint::IntPoint):
1953         (WebCore::IntPoint::operator D2D1_POINT_2F):
1954         (WebCore::IntPoint::operator D2D1_POINT_2U):
1955         * platform/graphics/win/IntRectWin.cpp:
1956         (WebCore::IntRect::IntRect):
1957         (WebCore::IntRect::operator D2D1_RECT_F):
1958         (WebCore::IntRect::operator D2D1_RECT_U):
1959         * platform/graphics/win/IntSizeWin.cpp:
1960         (WebCore::IntSize::IntSize):
1961         (WebCore::IntSize::operator D2D1_SIZE_U):
1962         (WebCore::IntSize::operator D2D1_SIZE_F):
1963         * platform/graphics/win/TransformationMatrixDirect2D.cpp: Added.
1964         (WebCore::TransformationMatrix::TransformationMatrix):
1965         (WebCore::TransformationMatrix::operator D2D1_MATRIX_3X2_F):
1966         (WebCore::AffineTransform::AffineTransform):
1967         (WebCore::AffineTransform::operator D2D1_MATRIX_3X2_F):
1968
1969 2016-09-13  Tim Horton  <timothy_horton@apple.com>
1970
1971         Undoing a candidate insertion results in the replaced text being selected
1972         https://bugs.webkit.org/show_bug.cgi?id=161894
1973         <rdar://problem/28225774>
1974
1975         Reviewed by Simon Fraser.
1976
1977         Test: editing/mac/spelling/accept-candidate-undo-does-not-select.html
1978
1979         * WebCore.xcodeproj/project.pbxproj:
1980         * editing/ReplaceRangeWithTextCommand.cpp: Added.
1981         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
1982         (WebCore::ReplaceRangeWithTextCommand::doApply):
1983         * editing/ReplaceRangeWithTextCommand.h: Added.
1984         (WebCore::ReplaceRangeWithTextCommand::create):
1985         Add a editor command that replaces a range with the given text.
1986
1987         * editing/Editor.cpp:
1988         (WebCore::Editor::rangeForTextCheckingResult):
1989         (WebCore::Editor::handleAcceptedCandidate):
1990         (WebCore::Editor::selectTextCheckingResult): Deleted.
1991         * editing/Editor.h:
1992         Make use of the new editor command to do candidate insertion as a single
1993         composite operation, so that it is undone as a unit. Otherwise, undo ends up
1994         undoing the insertion, but not the selection, and we are left with the old
1995         text, selected, which is undesirable.
1996
1997 2016-09-13  Dave Hyatt  <hyatt@apple.com>
1998
1999         [CSS Parser] Add CSS Variable Parsing support
2000         https://bugs.webkit.org/show_bug.cgi?id=161916
2001
2002         Reviewed by Dean Jackson.
2003
2004         This patch not only adds the parser for CSS variables (from Blink), but it also brings in
2005         all of the data structures used to store variables and custom property declarations. We
2006         will be abandoning our old data structures eventually in favor of these new ones. They
2007         are not significantly different other than operating on the CSSParserTokenRanges rather
2008         than the soon-to-be-removed parser value lists.
2009
2010         * CMakeLists.txt:
2011         * WebCore.xcodeproj/project.pbxproj:
2012         * css/CSSCustomIdentValue.cpp: Added.
2013         (WebCore::CSSCustomIdentValue::CSSCustomIdentValue):
2014         (WebCore::CSSCustomIdentValue::customCSSText):
2015         * css/CSSCustomIdentValue.h: Added.
2016         (WebCore::CSSCustomIdentValue::create):
2017         (WebCore::CSSCustomIdentValue::value):
2018         (WebCore::CSSCustomIdentValue::isKnownPropertyID):
2019         (WebCore::CSSCustomIdentValue::valueAsPropertyID):
2020         (WebCore::CSSCustomIdentValue::equals):
2021         * css/CSSCustomPropertyDeclaration.cpp: Added.
2022         (WebCore::CSSCustomPropertyDeclaration::customCSSText):
2023         * css/CSSCustomPropertyDeclaration.h: Added.
2024         (WebCore::CSSCustomPropertyDeclaration::create):
2025         (WebCore::CSSCustomPropertyDeclaration::name):
2026         (WebCore::CSSCustomPropertyDeclaration::value):
2027         (WebCore::CSSCustomPropertyDeclaration::id):
2028         (WebCore::CSSCustomPropertyDeclaration::equals):
2029         (WebCore::CSSCustomPropertyDeclaration::CSSCustomPropertyDeclaration):
2030         * css/CSSCustomPropertyValue.h:
2031         * css/CSSValue.cpp:
2032         (WebCore::CSSValue::cssText):
2033         (WebCore::CSSValue::destroy):
2034         * css/CSSValue.h:
2035         (WebCore::CSSValue::isCustomPropertyDeclaration):
2036         (WebCore::CSSValue::isCustomIdentValue):
2037         (WebCore::CSSValue::isVariableReferenceValue):
2038         * css/CSSValueKeywords.in:
2039         * css/CSSVariableData.cpp: Added.
2040         (WebCore::CSSVariableData::updateTokens):
2041         (WebCore::CSSVariableData::operator==):
2042         (WebCore::CSSVariableData::consumeAndUpdateTokens):
2043         (WebCore::CSSVariableData::CSSVariableData):
2044         * css/CSSVariableData.h: Added.
2045         (WebCore::CSSVariableData::create):
2046         (WebCore::CSSVariableData::createResolved):
2047         (WebCore::CSSVariableData::tokenRange):
2048         (WebCore::CSSVariableData::tokens):
2049         (WebCore::CSSVariableData::needsVariableResolution):
2050         (WebCore::CSSVariableData::CSSVariableData):
2051         * css/CSSVariableDependentValue.h:
2052         * css/CSSVariableReferenceValue.cpp: Added.
2053         (WebCore::CSSVariableReferenceValue::customCSSText):
2054         * css/CSSVariableReferenceValue.h: Added.
2055         (WebCore::CSSVariableReferenceValue::create):
2056         (WebCore::CSSVariableReferenceValue::variableDataValue):
2057         (WebCore::CSSVariableReferenceValue::equals):
2058         (WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
2059         * css/CSSVariableValue.h:
2060         * css/parser/CSSParserImpl.cpp:
2061         (WebCore::filterProperties):
2062         (WebCore::CSSParserImpl::consumeDeclaration):
2063         (WebCore::CSSParserImpl::consumeVariableValue):
2064         * css/parser/CSSVariableParser.cpp: Added.
2065         (WebCore::CSSVariableParser::isValidVariableName):
2066         (WebCore::classifyBlock):
2067         (WebCore::isValidVariableReference):
2068         (WebCore::classifyVariableRange):
2069         (WebCore::CSSVariableParser::containsValidVariableReferences):
2070         (WebCore::CSSVariableParser::parseDeclarationValue):
2071         * css/parser/CSSVariableParser.h: Added.
2072
2073 2016-09-13  Daniel Bates  <dabates@apple.com>
2074
2075         Remove CSS keyword properties from CSSParser::parseValue(CSSPropertyID, bool)
2076         https://bugs.webkit.org/show_bug.cgi?id=161918
2077
2078         Reviewed by Simon Fraser.
2079
2080         CSSParser::parseValue(CSSPropertyID, bool) calls ASSERT_NOT_REACHED() when processing a CSS property
2081         that is known to accept only keyword values as a means to guide a person to add such a CSS property
2082         to the switch block in WebCore::isValidKeywordPropertyAndValue(). In theory this sounds good, but
2083         in practice it does not work out and the list of such properties is stale. We should remove the
2084         case statements for such properties and the maintenance burden they required, which was manual and
2085         error prone. We should think about a better way to enforce that all CSS properties are parsed/validated.
2086
2087         The approach of calling ASSERT_NOT_REACHED is not beneficial to catching coding mistakes because
2088         CSSParser::parseValue() has a default case statement to parse/validate SVG CSS properties and hence
2089         does not allow the C++ compiler to validate that the switch block covers all CSSPropertyIDs.
2090
2091         * css/parser/CSSParser.cpp:
2092         (WebCore::CSSParser::parseValue):
2093
2094 2016-09-13  Daniel Bates  <dabates@apple.com>
2095
2096         Organize CSS keyword properties in WebCore::isKeywordPropertyID()
2097         https://bugs.webkit.org/show_bug.cgi?id=161917
2098
2099         Reviewed by Simon Fraser.
2100
2101         Group and sort compile-time feature keywords and move them to the end of the switch block
2102         to avoid the distraction of preprocessor statements scattered throughout the list. Sort
2103         all the other keyword properties to make it straightforward to find a property by name.
2104
2105         * css/parser/CSSParser.cpp:
2106         (WebCore::isKeywordPropertyID):
2107
2108 2016-09-13  Nan Wang  <n_wang@apple.com>
2109
2110         AX: Crash at AccessibilityRenderObject::computeAccessibilityIsIgnored const  + 552
2111         https://bugs.webkit.org/show_bug.cgi?id=161276
2112
2113         Reviewed by Chris Fleizach.
2114
2115         Sometimes when calling JavaScript removeChild or setAttribute on a node, it seems like
2116         the renderer is deallocated during the process of computeAccessibilityIsIgnored. It's 
2117         causing a crash when we are accessing the renderer after that. Since RenderObject is not ref
2118         counted and we cannot hold onto it for the duration of the function, fixed it by adding
2119         more nil checks.
2120
2121         Despite my best efforts, I couldn't make a layout test that destroys the renderer within
2122         the computeAccessibilityIsIgnored function. 
2123
2124         * accessibility/AccessibilityRenderObject.cpp:
2125         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
2126
2127 2016-09-12  Jer Noble  <jer.noble@apple.com>
2128
2129         Media-source backed elements block load event; cause web-platform-test flakiness
2130         https://bugs.webkit.org/show_bug.cgi?id=161881
2131
2132         Reviewed by Eric Carlson.
2133
2134         Test: media/media-source/media-source-delaying-load-event.html
2135
2136         The MSE specification has added an explicit step to their "attaching to media element"
2137         algorithm which tells the media element to stop delaying the load event. And indeed,
2138         the HTMLMediaElement blocks the load event when a MediaSource is attached but its data
2139         is never loaded.
2140
2141         * Modules/mediasource/MediaSource.cpp:
2142         (WebCore::MediaSource::setPrivateAndOpen):
2143         * html/HTMLMediaElement.h:
2144
2145 2016-09-12  Zalan Bujtas  <zalan@apple.com>
2146
2147         Input type object and the associated render can go out of sync.
2148         https://bugs.webkit.org/show_bug.cgi?id=161871
2149         <rdar://problem/28178094>
2150
2151         Reviewed by Antti Koivisto.
2152
2153         Bail out when we've got a mismatched renderer.
2154
2155         Test: fast/forms/assert-on-input-type-change.html
2156
2157         * html/ImageInputType.cpp:
2158         (WebCore::ImageInputType::altAttributeChanged):
2159
2160 2016-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2161
2162         [GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
2163         https://bugs.webkit.org/show_bug.cgi?id=161907
2164
2165         Reviewed by Michael Catanzaro.
2166
2167         We don't really need to keep a DataObjectGtk for every clipboard, we could simply pass the DataObjectGtk to read
2168         and write methods of PasteboardHelper.
2169
2170         * editing/gtk/EditorGtk.cpp:
2171         (WebCore::createFragmentFromPasteboardData): Update for DataObjectGtk API changes.
2172         * platform/Pasteboard.h:
2173         * platform/gtk/DataObjectGtk.cpp: Remove forClipboard() static method.
2174         * platform/gtk/DataObjectGtk.h: Ditto.
2175         * platform/gtk/PasteboardGtk.cpp:
2176         (WebCore::Pasteboard::Pasteboard): Always create a new DataObjectGtk.
2177         (WebCore::Pasteboard::dataObject): Return a const reference instead of a pointer.
2178         (WebCore::Pasteboard::writePlainText): Pass the DataObjectGtk to PasteboardHelper.
2179         (WebCore::Pasteboard::write): Ditto.
2180         (WebCore::Pasteboard::writePasteboard): Ditto.
2181         (WebCore::Pasteboard::clear): Ditto.
2182         (WebCore::Pasteboard::read): Ditto.
2183         (WebCore::Pasteboard::hasData): Ditto.
2184         (WebCore::Pasteboard::types): Ditto.
2185         (WebCore::Pasteboard::readString): Ditto.
2186         (WebCore::Pasteboard::readFilenames): Ditto.
2187         * platform/gtk/PasteboardHelper.cpp:
2188         (WebCore::PasteboardHelper::getClipboardContents): Update the given DataObjectGtk.
2189         (WebCore::PasteboardHelper::fillSelectionData): Use a const reference to DataObjectGtk instead of a pointer.
2190         (WebCore::PasteboardHelper::targetListForDataObject): Ditto.
2191         (WebCore::PasteboardHelper::fillDataObjectFromDropData): Use a reference to DataObjectGtk instead of a pointer.
2192         (WebCore::ClipboardSetData::ClipboardSetData): Helper struct to pass DataObjectGtk and callback to clipboard callbacks.
2193         (WebCore::ClipboardSetData::~ClipboardSetData):
2194         (WebCore::getClipboardContentsCallback): Get the DataObjectGtk from ClipboardSetData struct passed as user data.
2195         (WebCore::clearClipboardContentsCallback): Get the DataObjectGtk and callback from ClipboardSetData struct
2196         passed as user data.
2197         (WebCore::PasteboardHelper::writeClipboardContents): Write the given DataObjectGtk.
2198         * platform/gtk/PasteboardHelper.h:
2199
2200 2016-09-13  Chris Dumez  <cdumez@apple.com>
2201
2202         Drop support for <isindex>
2203         https://bugs.webkit.org/show_bug.cgi?id=7139
2204
2205         Reviewed by Ryosuke Niwa.
2206
2207         Drop support for <isindex> and <input name=isindex>. Those are no longer
2208         in the HTML specification and Chrome / Edge have already dropped their
2209         support. Firefox is also planning on dropping this.
2210
2211         Test: imported/w3c/web-platform-tests/html/semantics/forms/historical.html
2212
2213         * css/StyleResolver.cpp:
2214         (WebCore::elementTypeHasAppearanceFromUAStyle):
2215         * css/html.css:
2216         (input, textarea, keygen, select, button, meter, progress):
2217         (input, textarea, keygen, select, button):
2218         (#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
2219         (input::placeholder):
2220         (input:focus, textarea:focus, keygen:focus, select:focus):
2221         * dom/Element.cpp:
2222         (WebCore::Element::ieForbidsInsertHTML):
2223         * html/HTMLInputElement.cpp:
2224         (WebCore::HTMLInputElement::HTMLInputElement):
2225         * html/HTMLTagNames.in:
2226         * html/parser/HTMLStackItem.h:
2227         (WebCore::isSpecialNode):
2228         * html/parser/HTMLTreeBuilder.cpp:
2229         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
2230         (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): Deleted.
2231         (WebCore::createCaseMap): Deleted.
2232         * html/parser/HTMLTreeBuilder.h:
2233         * platform/network/FormData.cpp:
2234         (WebCore::FormData::appendKeyValuePairItems):
2235
2236 2016-09-12  Per Arne Vollan  <pvollan@apple.com>
2237
2238         [Win] Warning fix.
2239         https://bugs.webkit.org/show_bug.cgi?id=161858
2240
2241         Reviewed by Brent Fulgham.
2242
2243         Use exported constants from CoreText.dll, instead of creating copies.
2244
2245         * PlatformAppleWin.cmake:
2246         * platform/spi/win/CoreTextSPIWin.cpp: Removed.
2247         * platform/spi/win/CoreTextSPIWin.h:
2248
2249 2016-09-12  Youenn Fablet  <youenn@apple.com>
2250
2251         ScriptElement should use FetchOptions::mode according its crossOrigin attribute
2252         https://bugs.webkit.org/show_bug.cgi?id=161686
2253
2254         Reviewed by Darin Adler.
2255
2256         Setting ScriptElement fetch mode according its crossOrigin attribute.
2257         Removing LoadableClassicScriptchecking of CORS since this is now done at ResourceLoader/CachedResource level.
2258
2259         Updating CachedResourceLoader to ensure that a resource that matches an on-going resource load but with different fetch mode/origin,
2260         always gets its loading started if the resource state is not Cached.
2261
2262         Tests: fast/dom/script-crossorigin-loads-fail-origin.html
2263                http/tests/security/cross-origin-cached-images-parallel.html
2264                http/tests/security/cross-origin-cached-images.html
2265                http/tests/security/cross-origin-cached-scripts-parallel.html
2266                http/tests/security/cross-origin-cached-scripts.html
2267                http/tests/security/script-crossorigin-loads-correctly-credentials.html
2268                http/tests/security/script-with-dataurl.html
2269
2270         * dom/LoadableClassicScript.cpp:
2271         (WebCore::LoadableClassicScript::create):
2272         (WebCore::LoadableClassicScript::notifyFinished): Checking CORS failures using the resource state.
2273         (WebCore::LoadableClassicScript::~LoadableClassicScript): Deleted.
2274         (WebCore::LoadableClassicScript::isLoaded): Deleted.
2275         * dom/LoadableClassicScript.h:
2276         * dom/ScriptElement.cpp:
2277         (WebCore::ScriptElement::requestClassicScript):
2278         (WebCore::ScriptElement::requestScriptWithCache): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode according crossOrigin attribute.
2279         * dom/ScriptElement.h:
2280         * loader/cache/CachedImage.cpp:
2281         (WebCore::CachedImage::setBodyDataFrom):
2282         * loader/cache/CachedResourceLoader.cpp:
2283         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Adding support for script resources.
2284         (WebCore::CachedResourceLoader::requestResource): Ensuring that 'updated' resources gets actually loaded.
2285         * loader/cache/CachedScript.cpp:
2286         (WebCore::CachedScript::setBodyDataFrom): Implementing specific data copy from another CachedScript.
2287         * loader/cache/CachedScript.h:
2288
2289 2016-09-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2290
2291         [GTK] Scrollbar  too large
2292         https://bugs.webkit.org/show_bug.cgi?id=161735
2293
2294         Reviewed by Michael Catanzaro.
2295
2296         We were not calculating the total scrollbar size correctly when the theme defines a minimum width/height. In
2297         that case we need to take the extra size into account (border, margin, padding), but not adding the minimum
2298         size. We were also adjusting the thumb position when rendering in indicator mode, but we really need to adjust
2299         the whole rectangle. This worked in Adwaita because it uses a transparent track when in indicator mode. We are
2300         also now taking into account the text direction when doing this adjustment for the indicator mode.
2301
2302         * platform/gtk/ScrollbarThemeGtk.cpp:
2303         (WebCore::ScrollbarThemeGtk::paint):
2304         (WebCore::ScrollbarThemeGtk::scrollbarThickness):
2305
2306 2016-09-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2307
2308         [GTK] Crash of WebProcess on the last WebView disconnect (take two)
2309         https://bugs.webkit.org/show_bug.cgi?id=161842
2310
2311         Reviewed by Michael Catanzaro.
2312
2313         The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor
2314         makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native
2315         X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL
2316         context is deleted before the native X11 display is closed.
2317
2318         * platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected.
2319         * platform/graphics/glx/GLContextGLX.cpp:
2320         (WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display.
2321         (WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with
2322         nviedia closed drivers.
2323         (WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display.
2324         (WebCore::GLContextGLX::makeContextCurrent): Ditto.
2325         (WebCore::GLContextGLX::swapBuffers): Ditto.
2326         (WebCore::GLContextGLX::swapInterval): Ditto.
2327         (WebCore::GLContextGLX::cairoDevice): Ditto.
2328         * platform/graphics/glx/GLContextGLX.h:
2329         * platform/graphics/x11/PlatformDisplayX11.cpp:
2330         (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display.
2331
2332 2016-09-12  Chris Dumez  <cdumez@apple.com>
2333
2334         Fix post-landing review comments after r205787
2335         https://bugs.webkit.org/show_bug.cgi?id=161885
2336
2337         Reviewed by Darin Adler.
2338
2339         Leverage new StringBuilder::append(CFStringRef) overload.
2340
2341         * html/parser/HTMLParserIdioms.cpp:
2342         (WebCore::parseHTTPRefreshInternal):
2343         * page/CaptionUserPreferencesMediaAF.cpp:
2344         (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
2345         (WebCore::buildDisplayStringForTrackBase):
2346         * platform/network/mac/CookieJarMac.mm:
2347         (WebCore::cookiesForSession):
2348         * rendering/RenderThemeIOS.mm:
2349         (WebCore::RenderThemeIOS::mediaControlsStyleSheet):
2350         (WebCore::RenderThemeIOS::mediaControlsScript):
2351         * rendering/RenderThemeMac.mm:
2352         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2353         (WebCore::RenderThemeMac::mediaControlsScript):
2354
2355 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2356
2357         URLParser: Correctly ignore spaces before relative URLs with no scheme
2358         https://bugs.webkit.org/show_bug.cgi?id=161889
2359
2360         Reviewed by Daniel Bates.
2361
2362         Covered by new API tests.
2363
2364         * platform/URLParser.cpp:
2365         (WebCore::URLParser::parse):
2366
2367 2016-09-12  Nan Wang  <n_wang@apple.com>
2368
2369         AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
2370         https://bugs.webkit.org/show_bug.cgi?id=161878
2371
2372         Reviewed by Chris Fleizach.
2373
2374         In function characterOffsetsInOrder(const CharacterOffset&, const CharacterOffset&), we are creating two
2375         ranges based on the nodes that are associated to the passed in CharacterOffsets. When the first node is a doctype
2376         node, the first range will be a nullptr, and dereferencing it leads to a crash. Fixed this by adding a 
2377         NULL check.
2378
2379         Test: accessibility/mac/doctype-node-in-text-marker-crash.html
2380
2381         * accessibility/AXObjectCache.cpp:
2382         (WebCore::characterOffsetsInOrder):
2383         (WebCore::resetNodeAndOffsetForReplacedNode):
2384
2385 2016-09-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2386
2387         Move the pixel data of ImageFrame to a separate class named ImageBackingStore
2388         https://bugs.webkit.org/show_bug.cgi?id=159679
2389
2390         Reviewed by Simon Fraser.
2391
2392         Move the pixel data manipulation part in ImageFrame into a separate class
2393         and allocate it on demand.
2394
2395         * PlatformEfl.cmake:
2396         * PlatformGTK.cmake:
2397         * PlatformWinCairo.cmake:
2398         * WebCore.xcodeproj/project.pbxproj:
2399         Add ImageBackingStoreCairo.cpp and remove ImageDecoderCairo.cpp from the
2400         WebKit projects.
2401
2402         * platform/graphics/Color.cpp:
2403         (WebCore::premultipliedChannel): channel = channel * alpha / 255.
2404         (WebCore::unpremultipliedChannel): channel = channel * 255 / alpha.
2405         (WebCore::makePremultipliedRGBA): Un-premultiplied channels to premultiplied RGBA32.
2406         (WebCore::makeUnPremultipliedRGBA): Premultiplied channels to un-premultiplied RGBA32.
2407         (WebCore::colorFromPremultipliedARGB): Use makeUnPremultipliedRGBA.
2408         (WebCore::premultipliedARGBFromColor): Use makePremultipliedRGBA.
2409         * platform/graphics/Color.h:
2410         (WebCore::fastMultiplyBy255): x * 255 = x * 256 - x = x << 8 - x.
2411
2412         * platform/graphics/ImageBackingStore.h: Added.
2413         (WebCore::ImageBackingStore::create): Creates a new ImageBackingStore.
2414         (WebCore::ImageBackingStore::setSize): Changes the pixels size.
2415         (WebCore::ImageBackingStore::setFrameRect): This will always just be the entire buffer except for GIF and PNG frames.
2416         (WebCore::ImageBackingStore::size): Returns the pixels size.
2417         (WebCore::ImageBackingStore::frameRect): Returns the pixels frame rectangle.
2418         (WebCore::ImageBackingStore::clear): Clears the entire image.
2419         (WebCore::ImageBackingStore::clearRect): Clears a rectangle in the image.
2420         (WebCore::ImageBackingStore::repeatFirstRow): Repeats the first row in a rectangle in the image.
2421         (WebCore::ImageBackingStore::pixelAt): Returns a pointer to a pixel data.
2422         (WebCore::ImageBackingStore::setPixel): Sets the color of a pixel in the image.
2423         (WebCore::ImageBackingStore::blendPixel): Blend a color with a pixel in the image.
2424         (WebCore::ImageBackingStore::inBounds): Checks if a rectangle is in the bounds of the image.
2425         (WebCore::ImageBackingStore::isOverSize): Checks whether a size could not be allocated for an image.
2426         (WebCore::ImageBackingStore::ImageBackingStore):
2427
2428         * platform/graphics/cg/NativeImageCG.cpp:
2429         (WebCore::nativeImageHasAlpha): Implement this function. See comments in https://bugs.webkit.org/show_bug.cgi?id=158684.
2430
2431         * platform/image-decoders/ImageDecoder.cpp:
2432         (WebCore::ImageFrame::operator=): copyBitmapData() now copies the frameRect of the ImageBackingStore.
2433         (WebCore::ImageFrame::clearPixelData): The pixels data and the pointer to these pixels are now included in the ImageBackingStore.
2434         (WebCore::ImageFrame::zeroFillPixelData): Clearing the image pixels are now in ImageBackingStore::clear().
2435         (WebCore::ImageFrame::zeroFillFrameRect): Clearing the image pixels are now in ImageBackingStore::clearRect().
2436         (WebCore::ImageFrame::copyBitmapData): We either need to create a new ImageBackingStore or nullify the current one.
2437         (WebCore::ImageFrame::setSize): ImageFrame::setSize() is supposed to be called once and to create the ImageBackingStore.
2438         (WebCore::ImageFrame::setOriginalFrameRect): Delegate this call to ImageBackingStore::setFrameRect().
2439         (WebCore::ImageDecoder::frameBytesAtIndex): ImageFrame::PixelData can be replaced by RGBA32.
2440
2441         * platform/image-decoders/ImageDecoder.h:
2442         (WebCore::ImageFrame::copyRowNTimes): The implementation was moved to ImageBackingStore::repeatFirstRow().
2443         (WebCore::ImageFrame::size): Gets the size of an image from its ImageBackingStore.
2444         (WebCore::ImageFrame::asNewNativeImage): Gets a NtaiveImagePtr from the ImageBackingStore.
2445         (WebCore::ImageFrame::backingStore): Returns a raw pointer to the ImageBackingStore.
2446         (WebCore::ImageFrame::hasBackingStore): Returns whether the ImageFrame has an ImageBackingStore.
2447         (WebCore::ImageFrame::originalFrameRect): Returns the frameRect of the image from its ImageBackingStore.
2448         (WebCore::ImageFrame::pixelAt): Delegates the call to the ImageBackingStore.
2449         (WebCore::ImageFrame::setPixel): Delegates the call to the ImageBackingStore.
2450         (WebCore::ImageFrame::blendPixel): Delegates the call to the ImageBackingStore.
2451         
2452         (WebCore::ImageDecoder::setSize): setSize() now takes an IntSize.
2453         (WebCore::ImageFrame::setOriginalFrameRect): Deleted. Moved to ImageDecoder.cpp.
2454         (WebCore::ImageFrame::setRGBA): Deleted. Renamed to ImageFrame::setPixel().
2455         (WebCore::ImageFrame::getAddr): Deleted. Renamed to ImageFrame::pixelAt().
2456         (WebCore::ImageFrame::hasPixelData): Deleted. Renamed to ImageFrame::hasBackingStore().
2457         (WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
2458         (WebCore::ImageFrame::divide255): Deleted. Replaced by fastDivideBy255() from Color.h.
2459         (WebCore::ImageFrame::overRGBA): Deleted. Renamed to ImageFrame::blendPixel().
2460         (WebCore::ImageFrame::width): Deleted.
2461         (WebCore::ImageFrame::height): Deleted.
2462         (WebCore::ImageDecoder::isOverSize): Deleted. Moved to ImageBackingStore::isOverSize().
2463
2464         * platform/image-decoders/bmp/BMPImageReader.cpp:
2465         (WebCore::BMPImageReader::decodeBMP):
2466         (WebCore::BMPImageReader::processInfoHeader):
2467         (WebCore::BMPImageReader::processNonRLEData):
2468         * platform/image-decoders/bmp/BMPImageReader.h:
2469         (WebCore::BMPImageReader::setI):
2470         (WebCore::BMPImageReader::setPixel):
2471         (WebCore::BMPImageReader::fillRGBA):
2472         (WebCore::BMPImageReader::setRGBA): Deleted.
2473         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: Added.
2474         (WebCore::ImageBackingStore::image):
2475         * platform/image-decoders/cairo/ImageDecoderCairo.cpp: Removed.
2476         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2477         (WebCore::GIFImageDecoder::setSize):
2478         (WebCore::GIFImageDecoder::haveDecodedRow):
2479         (WebCore::GIFImageDecoder::initFrameBuffer):
2480         * platform/image-decoders/gif/GIFImageDecoder.h:
2481         * platform/image-decoders/gif/GIFImageReader.cpp:
2482         (GIFImageReader::parse):
2483         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2484         (WebCore::ICOImageDecoder::setSize):
2485         (WebCore::ICOImageDecoder::processDirectoryEntries):
2486         * platform/image-decoders/ico/ICOImageDecoder.h:
2487         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
2488         (WebCore::JPEGImageReader::decode):
2489         (WebCore::JPEGImageDecoder::setSize):
2490         (WebCore::setPixel):
2491         (WebCore::JPEGImageDecoder::outputScanlines):
2492         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
2493         * platform/image-decoders/png/PNGImageDecoder.cpp:
2494         (WebCore::PNGImageDecoder::setSize):
2495         (WebCore::PNGImageDecoder::headerAvailable):
2496         (WebCore::setPixelRGB):
2497         (WebCore::setPixelRGBA):
2498         (WebCore::setPixelPremultipliedRGBA):
2499         (WebCore::PNGImageDecoder::rowAvailable):
2500         (WebCore::PNGImageDecoder::initFrameBuffer):
2501         (WebCore::PNGImageDecoder::frameComplete):
2502         * platform/image-decoders/png/PNGImageDecoder.h:
2503         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2504         (WebCore::WEBPImageDecoder::decode):
2505         - Send an IntSize to ImageFrame::setSize() and ImageDecoder::setSize().
2506         - Replace ImageFrame::PixelData by RGBA32.
2507         - No need to call ImageFrame::setOriginalFrameRect() if this sets the
2508           frameRect to the entire image rectangle since this is done by default
2509           in ImageBackingStore::setSize().
2510         - ImageBackingStore::image() now replaces ImageFrame::asNewNativeImage().
2511         - ImageFrame::setPixel() now replaces ImageFrame::setRGBA().
2512         - ImageFrame::blendPixel() now replaces ImageFrame::overRGBA().
2513         - ImageFrame::pixelAt() now replaces ImageFrame::getAddr().
2514
2515 2016-09-12  Joseph Pecoraro  <pecoraro@apple.com>
2516
2517         HTMLButtonElement.prototype.click should be HTMLElement.prototype.click
2518         https://bugs.webkit.org/show_bug.cgi?id=161874
2519
2520         Reviewed by Chris Dumez.
2521
2522         Test: fast/dom/HTMLButtonElement/click.html
2523
2524         * html/HTMLButtonElement.idl:
2525         Remove the unnecessary 'click' definition. It already exists in HTMLElement.
2526         If this was needed for ObjC code generation on DOMHTMLButtonElement, then
2527         the extra definition is no longer needed now that ObjC bindings have moved.
2528
2529 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2530
2531         URLParser: Fix relative URLs containing only fragments
2532         https://bugs.webkit.org/show_bug.cgi?id=161882
2533
2534         Reviewed by Brady Eidson.
2535
2536         Covered by new API tests.
2537
2538         * platform/URLParser.cpp:
2539         (WebCore::URLParser::parse):
2540
2541 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2542
2543         URLParser: Correctly handle relative URLs that are just a scheme and a colon
2544         https://bugs.webkit.org/show_bug.cgi?id=161876
2545
2546         Reviewed by Brady Eidson.
2547
2548         Covered by new API tests.
2549
2550         * platform/URLParser.cpp:
2551         (WebCore::URLParser::parse):
2552
2553 2016-09-12  Dean Jackson  <dino@apple.com>
2554
2555         Remove OptionalColor
2556         https://bugs.webkit.org/show_bug.cgi?id=161853
2557         <rdar://problem/28252385>
2558
2559         Reviewed by Alex Christensen.
2560
2561         OptionalColor isn't used. The concept will be implemented
2562         in a different manner.
2563
2564         * platform/graphics/Color.h:
2565
2566 2016-09-12  Simon Fraser  <simon.fraser@apple.com>
2567
2568         Add Intersection Observer to the features.json file.
2569
2570         * features.json:
2571
2572 2016-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
2573
2574         [Cocoa] Reduce uses of CGFonts in favor of CTFonts
2575         https://bugs.webkit.org/show_bug.cgi?id=161809
2576
2577         Reviewed by Daniel Bates.
2578
2579         Eventually, we want to remove the cgFont() member of PlatformFontData for both memory
2580         savings and conceptual clarity. Because there is no performance loss from moving from
2581         CGFontGetGlyphsForUnichars() to CTFontGetGlyphsForCharacters(), making this switch
2582         gets us closer to reducing the uses of cgFont().
2583
2584         No new tests because there is no behavior change.
2585
2586         * platform/graphics/Font.cpp:
2587         (WebCore::createAndFillGlyphPage):
2588         * platform/graphics/GlyphPage.h:
2589         (WebCore::GlyphData::GlyphData):
2590         * platform/graphics/mac/GlyphPageMac.cpp:
2591         (WebCore::shouldFillWithVerticalGlyphs):
2592         (WebCore::GlyphPage::fill):
2593         (WebCore::shouldUseCoreText): Deleted.
2594
2595 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2596
2597         Remove trailing control characters and spaces before parsing a URL
2598         https://bugs.webkit.org/show_bug.cgi?id=161870
2599
2600         Reviewed by Tim Horton.
2601
2602         Covered by new API tests.
2603
2604         * platform/URLParser.cpp:
2605         (WebCore::bufferView):
2606         (WebCore::URLParser::parse):
2607
2608 2016-09-12  Chris Dumez  <cdumez@apple.com>
2609
2610         window.performance object resets script-applied properties
2611         https://bugs.webkit.org/show_bug.cgi?id=137407
2612
2613         Reviewed by Darin Adler.
2614
2615         Make sure the window.performance wrapper stays alive for as long as the
2616         associated frame, similarly to what we do for window.screen.
2617
2618         Test: fast/performance/performance-object-gc.html
2619
2620         * page/Performance.idl:
2621
2622 2016-09-12  Saam Barati  <sbarati@apple.com>
2623
2624         Add WebKit support for an option in Safari's debug menu similar to "Get Bytecode Profile" but for the Sampling Profiler's data
2625         https://bugs.webkit.org/show_bug.cgi?id=161785
2626
2627         Reviewed by Tim Horton.
2628
2629         * ForwardingHeaders/runtime/SamplingProfiler.h: Added.
2630
2631 2016-09-12  Dave Hyatt  <hyatt@apple.com>
2632
2633         [CSS Parser] Add support for the parsing of the HTML sizes attribute
2634         https://bugs.webkit.org/show_bug.cgi?id=161868
2635
2636         Reviewed by Dean Jackson.
2637
2638         This patch adds the parsers for the sizes attribute. This code is heavily modified
2639         from Blink, and it really only makes use of the tokenization/parsing code. What is done
2640         with the results involves the same original code that we used over in SourceSizeList.cpp.
2641
2642         * CMakeLists.txt:
2643         * WebCore.xcodeproj/project.pbxproj:
2644         * css/parser/SizesAttributeParser.cpp: Added.
2645         (WebCore::SizesAttributeParser::computeLength):
2646         (WebCore::SizesAttributeParser::SizesAttributeParser):
2647         (WebCore::SizesAttributeParser::length):
2648         (WebCore::SizesAttributeParser::calculateLengthInPixels):
2649         (WebCore::SizesAttributeParser::mediaConditionMatches):
2650         (WebCore::SizesAttributeParser::parse):
2651         (WebCore::SizesAttributeParser::effectiveSize):
2652         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
2653         * css/parser/SizesAttributeParser.h: Added.
2654         * css/parser/SizesCalcParser.cpp: Added.
2655         (WebCore::SizesCalcParser::SizesCalcParser):
2656         (WebCore::SizesCalcParser::result):
2657         (WebCore::operatorPriority):
2658         (WebCore::SizesCalcParser::handleOperator):
2659         (WebCore::SizesCalcParser::appendNumber):
2660         (WebCore::SizesCalcParser::appendLength):
2661         (WebCore::SizesCalcParser::appendOperator):
2662         (WebCore::SizesCalcParser::calcToReversePolishNotation):
2663         (WebCore::operateOnStack):
2664         (WebCore::SizesCalcParser::calculate):
2665         * css/parser/SizesCalcParser.h: Added.
2666         (WebCore::SizesCalcValue::SizesCalcValue):
2667         (WebCore::SizesCalcParser::isValid):
2668
2669 2016-09-12  Jer Noble  <jer.noble@apple.com>
2670
2671         Fix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html tests
2672         https://bugs.webkit.org/show_bug.cgi?id=161819
2673
2674         Reviewed by Eric Carlson.
2675
2676         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-play.html
2677                      imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html
2678
2679         The newest revision of the web-platform-test suite for Media Source tests new behavior
2680         added to the MSE specification. Specifically, setting a MediaSource's duration will no
2681         longer implicitly truncate the source's active SourceBuffer objects.
2682
2683         * Modules/mediasource/MediaSource.cpp:
2684         (WebCore::MediaSource::setDuration): Return exception if issued by setDurationInternal.
2685         (WebCore::MediaSource::setDurationInternal): Bring "duration change" algorithm up to spec.
2686         * Modules/mediasource/MediaSource.h:
2687         * Modules/mediasource/SampleMap.h:
2688         (WebCore::PresentationOrderSampleMap::begin): Add const accessor.
2689         (WebCore::PresentationOrderSampleMap::end): Ditto.
2690         (WebCore::PresentationOrderSampleMap::rbegin): Ditto.
2691         (WebCore::PresentationOrderSampleMap::rend): DItto.
2692         (WebCore::DecodeOrderSampleMap::begin): Ditto.
2693         (WebCore::DecodeOrderSampleMap::end): Ditto.
2694         (WebCore::DecodeOrderSampleMap::rbegin): Ditto.
2695         (WebCore::DecodeOrderSampleMap::rend): Ditto.
2696         * Modules/mediasource/SourceBuffer.cpp:
2697         (WebCore::SourceBuffer::highestPresentationTimestamp): Added convenience method.
2698         (WebCore::SourceBuffer::removeCodedFrames): Drive-by fix; use .values() rather than
2699             pulling the value out of each HashMap iterator.
2700         * Modules/mediasource/SourceBuffer.h:
2701
2702 2016-09-12  Chris Dumez  <cdumez@apple.com>
2703
2704         Switch remaining users of Document::inPageCache() to pageCacheState()
2705         https://bugs.webkit.org/show_bug.cgi?id=161865
2706
2707         Reviewed by Darin Adler.
2708
2709         Switch remaining users of Document::inPageCache() to pageCacheState() as
2710         the former one is confusing (given that it returns true while the
2711         pagehide event is being fired).
2712
2713         * dom/Document.cpp:
2714         (WebCore::Document::scheduleStyleRecalc):
2715         (WebCore::Document::fontsNeedUpdate):
2716         (WebCore::Document::removeFocusedNodeOfSubtree):
2717         (WebCore::Document::setFocusedElement):
2718         (WebCore::Document::takeDOMWindowFrom):
2719         (WebCore::Document::topDocument):
2720         (WebCore::Document::webkitWillEnterFullScreenForElement):
2721         (WebCore::Document::webkitDidEnterFullScreenForElement):
2722         (WebCore::Document::webkitWillExitFullScreenForElement):
2723         (WebCore::Document::webkitDidExitFullScreenForElement):
2724         * dom/Document.h:
2725         (WebCore::Document::needsStyleRecalc):
2726         (WebCore::Document::inPageCache): Deleted.
2727         * history/CachedFrame.cpp:
2728         (WebCore::CachedFrame::CachedFrame):
2729         (WebCore::CachedFrame::clear):
2730         (WebCore::CachedFrame::destroy):
2731         * html/HTMLMediaElement.cpp:
2732         (WebCore::mediaElementIsAllowedToAutoplay):
2733         * html/HTMLPlugInImageElement.cpp:
2734         (WebCore::HTMLPlugInImageElement::createElementRenderer):
2735         * loader/DocumentLoader.cpp:
2736         (WebCore::DocumentLoader::addSubresourceLoader):
2737         * loader/HistoryController.cpp:
2738         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
2739         * page/DOMWindow.cpp:
2740         (WebCore::DOMWindow::decrementScrollEventListenersCount):
2741         * page/FrameView.cpp:
2742         (WebCore::FrameView::layout):
2743         * page/animation/AnimationBase.cpp:
2744         (WebCore::AnimationBase::setNeedsStyleRecalc):
2745         * page/animation/AnimationController.cpp:
2746         (WebCore::AnimationControllerPrivate::updateAnimations):
2747         (WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
2748         (WebCore::AnimationController::cancelAnimations):
2749         (WebCore::AnimationController::updateAnimations):
2750         * page/animation/ImplicitAnimation.cpp:
2751         (WebCore::ImplicitAnimation::sendTransitionEvent):
2752         * page/animation/KeyframeAnimation.cpp:
2753         (WebCore::KeyframeAnimation::sendAnimationEvent):
2754         * page/scrolling/AsyncScrollingCoordinator.cpp:
2755         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
2756         * rendering/RenderElement.cpp:
2757         (WebCore::shouldRepaintForImageAnimation):
2758         (WebCore::RenderElement::newImageAnimationFrameAvailable):
2759         * rendering/RenderImage.cpp:
2760         (WebCore::RenderImage::imageChanged):
2761         * rendering/RenderLayerCompositor.cpp:
2762         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2763         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
2764         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
2765         * rendering/RenderObject.cpp:
2766         (WebCore::printRenderTreeForLiveDocuments):
2767         (WebCore::printLayerTreeForLiveDocuments):
2768         * rendering/RenderView.cpp:
2769         (WebCore::RenderView::lazyRepaintTimerFired):
2770         * rendering/SimpleLineLayout.cpp:
2771         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
2772
2773 2016-09-12  Keith Rollin  <krollin@apple.com>
2774
2775         Enhance Network logging
2776         https://bugs.webkit.org/show_bug.cgi?id=161771
2777
2778         Reviewed by Antti Koivisto.
2779
2780         Modify current logging statements to follow a consistent pattern in
2781         order to enhance readability and parsing.
2782
2783         No new tests -- there are no tests for logging.
2784
2785         * loader/FrameLoader.cpp:
2786         (WebCore::FrameLoader::prepareForLoadStart):
2787         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2788
2789 2016-09-12  Brady Eidson  <beidson@apple.com>
2790
2791         Crash in com.apple.WebCore: WebCore::NavigatorGamepad::gamepadFromPlatformGamepad.
2792         <rdar://problem/28018073> and https://bugs.webkit.org/show_bug.cgi?id=161694
2793
2794         Reviewed by Alex Christensen.
2795
2796         No new tests (Caught by existing tests in some configurations).
2797
2798         * Modules/gamepad/GamepadManager.cpp:
2799         (WebCore::GamepadManager::platformGamepadInputActivity): Null check.
2800
2801 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2802
2803         Fix more URLParser quirks
2804         https://bugs.webkit.org/show_bug.cgi?id=161834
2805
2806         Reviewed by Brady Eidson.
2807
2808         Added new API tests.
2809
2810         * platform/URLParser.cpp:
2811         (WebCore::URLParser::parse):
2812         Skip some tabs and newlines.  The spec says to remove them before processing the String,
2813         but to reduce allocations I am skipping them whenever we increment an iterator.
2814         Fix a few other quirks to be more web platform conformant.
2815
2816 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2817
2818         Optimize URLParser performance
2819         https://bugs.webkit.org/show_bug.cgi?id=161837
2820
2821         Reviewed by Brady Eidson.
2822
2823         No change in behavior.  Existing behavior covered by API tests and added a new API test.
2824
2825         * platform/URLParser.cpp:
2826         (WebCore::isDefaultPort):
2827         Use switch statements instead of HashMap lookups.
2828         (WebCore::isSpecialScheme):
2829         Use switch statements instead of repeated String comparisons.
2830         (WebCore::URLParser::parsePort):
2831         Reduce String allocation.
2832
2833 2016-09-12  Simon Fraser  <simon.fraser@apple.com>
2834
2835         Make -webkit-transition-* and -webkit-animation-* properties be pure aliases of the unprefixed ones
2836         https://bugs.webkit.org/show_bug.cgi?id=160478
2837
2838         Reviewed by Dean Jackson.
2839         
2840         Remove the custom -webkit prefixed transition and animation properties, and just make
2841         them aliases of the unprefixed ones, as we do for transforms.
2842         
2843         -webkit-animation-trigger remains as the only prefixed-only animation property.
2844         
2845         This is mostly code deletion.
2846
2847         Test: fast/css/longhand-overrides-shorthand-prefixing.html
2848
2849         * css/CSSComputedStyleDeclaration.cpp:
2850         (WebCore::ComputedStyleExtractor::propertyValue):
2851         * css/CSSProperty.h:
2852         (WebCore::prefixingVariantForPropertyId): Deleted.
2853         * css/CSSPropertyNames.in:
2854         * css/CSSToStyleMap.cpp:
2855         (WebCore::CSSToStyleMap::mapAnimationDelay):
2856         (WebCore::CSSToStyleMap::mapAnimationDirection):
2857         (WebCore::CSSToStyleMap::mapAnimationDuration):
2858         (WebCore::CSSToStyleMap::mapAnimationFillMode):
2859         (WebCore::CSSToStyleMap::mapAnimationIterationCount):
2860         (WebCore::CSSToStyleMap::mapAnimationName):
2861         (WebCore::CSSToStyleMap::mapAnimationPlayState):
2862         (WebCore::CSSToStyleMap::mapAnimationProperty):
2863         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
2864         * css/PropertySetCSSStyleDeclaration.cpp:
2865         (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
2866         (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
2867         * css/StyleProperties.cpp:
2868         (WebCore::StyleProperties::getPropertyValue):
2869         (WebCore::MutableStyleProperties::removeShorthandProperty):
2870         (WebCore::StyleProperties::asText):
2871         * css/StylePropertyShorthand.cpp:
2872         (WebCore::animationShorthandForParsing):
2873         * css/StylePropertyShorthand.h:
2874         * css/StyleResolver.cpp:
2875         (WebCore::StyleResolver::styleForKeyframe):
2876         * css/parser/CSSParser.cpp:
2877         (WebCore::CSSParser::parseValue):
2878         (WebCore::CSSParser::parseAnimationShorthand):
2879         (WebCore::CSSParser::parseTransitionShorthand):
2880         (WebCore::CSSParser::parseAnimationProperty):
2881         (WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted.
2882         * css/parser/CSSParser.h:
2883         * html/shadow/MediaControlElements.cpp:
2884         (WebCore::MediaControlPanelElement::makeOpaque):
2885         (WebCore::MediaControlPanelElement::makeTransparent):
2886
2887 2016-09-12  Per Arne Vollan  <pvollan@apple.com>
2888
2889         Unreviewed build fix after r205090.
2890
2891         * platform/cf/MediaAccessibilitySoftLink.cpp:
2892
2893 2016-09-12  Javier Fernandez  <jfernandez@igalia.com>
2894
2895         [css-align] Initial values are parsed as invalid for some Alignment properties
2896         https://bugs.webkit.org/show_bug.cgi?id=161303
2897
2898         Reviewed by Darin Adler.
2899
2900         Due to the implementation of the new CSS Box Alignment specification,
2901         some properties have now new values allowed, which are not valid
2902         according to the Flexible Box Layout specification.
2903
2904         In r205102 we have get back the keywordID parsing, originally implemented for
2905         the Flexbible Box Layout specification. Even though the new valued would be
2906         parsed as invalid when they are set, the 'initial' values will be assigned
2907         in any case.
2908
2909         This patch verifies that the 'initial' values depend on whether the Grid
2910         Layout is enabled or not and verifying such values are parsed as valid.
2911
2912         Additionally, it gets back as well they keywordID parsing for the Content
2913         Alignment properties (align-content and justify-content). This required to
2914         touch a bit the StyleBuilderConverter logic, since we will have to deal with
2915         either the complex CSSContentDistributionValue complex or the  simpler
2916         CSSPrimitiveValue.
2917
2918         Test: fast/css/ensure-flexbox-compatibility-with-initial-values.html
2919
2920         * css/StyleBuilderConverter.h:
2921         (WebCore::StyleBuilderConverter::convertContentAlignmentData): Handling a primitive value if Grid Layout is not enabled.
2922         * css/parser/CSSParser.cpp:
2923         (WebCore::isValidKeywordPropertyAndValue): Simpler parsing of alignment properties if Grid Layout is not enabled.
2924         (WebCore::isKeywordPropertyID): Alignment properties are defined as keyword if Grid Layout is no enabled.
2925         (WebCore::CSSParser::parseValue): Assert Grid Layout is enabled when using the complex parsing.
2926         * rendering/style/RenderStyle.cpp:
2927         (WebCore::RenderStyle::isCSSGridLayoutEnabled): Checking out the Grid Layout runtime flags.
2928         * rendering/style/RenderStyle.h:
2929         (WebCore::RenderStyle::initialDefaultAlignment): Initial value will depend on whether Grid Layout is enabled or not.
2930         (WebCore::RenderStyle::initialContentAlignment): Initial value will depend on whether Grid Layout is enabled or not.
2931
2932 2016-09-12  Chris Dumez  <cdumez@apple.com>
2933
2934         ol.start may return incorrect value for reversed lists when not explicitly set
2935         https://bugs.webkit.org/show_bug.cgi?id=161713
2936
2937         Reviewed by Ryosuke Niwa.
2938
2939         Fix style nit after r205689.
2940
2941         * html/HTMLOListElement.cpp:
2942         (WebCore::HTMLOListElement::itemCount):
2943         (WebCore::HTMLOListElement::itemCountAfterLayout):
2944         * html/HTMLOListElement.h:
2945
2946 2016-09-12  Chris Dumez  <cdumez@apple.com>
2947
2948         Start using Document::pageCacheState() instead of Document::inPageCache()
2949         https://bugs.webkit.org/show_bug.cgi?id=161851
2950
2951         Reviewed by Ryosuke Niwa.
2952
2953         Start using Document::pageCacheState() instead of Document::inPageCache()
2954         as the latter one is confusing (given that it is true when firing the
2955         pagehide event, when the document is about to enter page cache).
2956
2957         * loader/FrameLoader.cpp:
2958         (WebCore::FrameLoader::closeURL):
2959         (WebCore::FrameLoader::clear):
2960         (WebCore::FrameLoader::dispatchUnloadEvents):
2961         * loader/cache/CachedResource.cpp:
2962         (WebCore::CachedResource::load):
2963         * page/Page.cpp:
2964         (WebCore::incrementFrame): Deleted.
2965         * page/Page.h:
2966
2967 2016-09-11  Chris Dumez  <cdumez@apple.com>
2968
2969         HTMLTrackElement.kind's invalid value default should be the metadata state
2970         https://bugs.webkit.org/show_bug.cgi?id=161840
2971
2972         Reviewed by Eric Carlson.
2973
2974         HTMLTrackElement.kind's invalid value default should be the metadata state,
2975         not the subtitles state:
2976         - https://html.spec.whatwg.org/#attr-track-kind
2977
2978         Chrome agrees with the specification.
2979
2980         No new tests, rebaselined existing tests.
2981
2982         * html/track/TextTrack.cpp:
2983         (WebCore::TextTrack::setKindKeywordIgnoringASCIICase):
2984
2985 2016-09-11  Dave Hyatt  <hyatt@apple.com>
2986
2987         [CSS Parser] Add the main parser implementation
2988         https://bugs.webkit.org/show_bug.cgi?id=161813
2989
2990         Reviewed by Dean Jackson.
2991
2992         This patch adds the main CSSParserImpl that handles stylesheet and rule parsing. All parsing starts with this
2993         class (it will eventually be invoked from the CSSParser). This patch also adds @supports parsing.
2994
2995         * WebCore.xcodeproj/project.pbxproj:
2996         * css/CSSKeyframeRule.cpp:
2997         (WebCore::StyleKeyframe::StyleKeyframe):
2998         * css/CSSKeyframeRule.h:
2999         * css/StyleRule.cpp:
3000         (WebCore::StyleRuleBase::destroy):
3001         (WebCore::StyleRuleBase::copy):
3002         (WebCore::StyleRuleBase::createCSSOMWrapper):
3003         (WebCore::StyleRuleCharset::StyleRuleCharset):
3004         (WebCore::StyleRuleCharset::~StyleRuleCharset):
3005         (WebCore::StyleRuleNamespace::StyleRuleNamespace):
3006         (WebCore::StyleRuleNamespace::~StyleRuleNamespace):
3007         * css/StyleRule.h:
3008         (WebCore::StyleRuleBase::isNamespaceRule):
3009         (isType):
3010         (WebCore::StyleRuleBase::isKeyframesRule): Deleted.
3011         * css/StyleSheetContents.cpp:
3012         (WebCore::traverseSubresourcesInRules):
3013         * css/parser/CSSParserImpl.cpp: Added.
3014         (WebCore::CSSParserImpl::CSSParserImpl):
3015         (WebCore::CSSParserImpl::parseValue):
3016         (WebCore::CSSParserImpl::parseVariableValue):
3017         (WebCore::filterProperties):
3018         (WebCore::createStyleProperties):
3019         (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
3020         (WebCore::CSSParserImpl::parseDeclarationList):
3021         (WebCore::CSSParserImpl::parseRule):
3022         (WebCore::CSSParserImpl::parseStyleSheet):
3023         (WebCore::CSSParserImpl::parsePageSelector):
3024         (WebCore::CSSParserImpl::parseCustomPropertySet):
3025         (WebCore::CSSParserImpl::parseKeyframeKeyList):
3026         (WebCore::CSSParserImpl::supportsDeclaration):
3027         (WebCore::CSSParserImpl::parseDeclarationListForInspector):
3028         (WebCore::CSSParserImpl::parseStyleSheetForInspector):
3029         (WebCore::computeNewAllowedRules):
3030         (WebCore::CSSParserImpl::consumeRuleList):
3031         (WebCore::CSSParserImpl::consumeAtRule):
3032         (WebCore::CSSParserImpl::consumeQualifiedRule):
3033         (WebCore::consumeStringOrURI):
3034         (WebCore::CSSParserImpl::consumeCharsetRule):
3035         (WebCore::CSSParserImpl::consumeImportRule):
3036         (WebCore::CSSParserImpl::consumeNamespaceRule):
3037         (WebCore::CSSParserImpl::consumeMediaRule):
3038         (WebCore::CSSParserImpl::consumeSupportsRule):
3039         (WebCore::CSSParserImpl::consumeViewportRule):
3040         (WebCore::CSSParserImpl::consumeFontFaceRule):
3041         (WebCore::CSSParserImpl::consumeKeyframesRule):
3042         (WebCore::CSSParserImpl::consumePageRule):
3043         (WebCore::CSSParserImpl::consumeKeyframeStyleRule):
3044         (WebCore::observeSelectors):
3045         (WebCore::CSSParserImpl::consumeStyleRule):
3046         (WebCore::CSSParserImpl::consumeDeclarationList):
3047         (WebCore::CSSParserImpl::consumeDeclaration):
3048         (WebCore::CSSParserImpl::consumeVariableValue):
3049         (WebCore::CSSParserImpl::consumeDeclarationValue):
3050         (WebCore::CSSParserImpl::consumeKeyframeKeyList):
3051         * css/parser/CSSParserImpl.h: Added.
3052         * css/parser/CSSParserValues.cpp:
3053         (WebCore::CSSParserSelector::parsePagePseudoSelector):
3054         * css/parser/CSSParserValues.h:
3055         * css/parser/CSSPropertyParser.cpp:
3056         (WebCore::CSSPropertyParser::parseValue):
3057         * css/parser/CSSSupportsParser.cpp: Added.
3058         (WebCore::CSSSupportsParser::supportsCondition):
3059         (WebCore::CSSSupportsParser::consumeCondition):
3060         (WebCore::CSSSupportsParser::consumeNegation):
3061         (WebCore::CSSSupportsParser::consumeConditionInParenthesis):
3062         * css/parser/CSSSupportsParser.h: Added.
3063         (WebCore::CSSSupportsParser::CSSSupportsParser):
3064
3065 2016-09-11  Tim Horton  <timothy_horton@apple.com>
3066
3067         Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to them
3068         https://bugs.webkit.org/show_bug.cgi?id=161846
3069         <rdar://problem/28245097>
3070
3071         Reviewed by Beth Dakin.
3072
3073         Tests: editing/mac/spelling/accept-candidate-without-adding-space.html,
3074                editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html
3075
3076         * editing/Editor.cpp:
3077         (WebCore::Editor::handleAcceptedCandidate):
3078         Stop appending a space just because the candidate doesn't end in a space.
3079         There are languages where that doesn't make sense, and the platform
3080         guarantees that candidates will always have spaces if they need them.
3081
3082         Also, adjust the way we compute the AcceptedCandidate document marker range.
3083         There were two problems with the existing code: it expanded outward from
3084         the post-insertion cursor in *both* directions, instead of just backwards,
3085         and it used the length of the replaced text, not the length of the newly
3086         inserted text (more of the confusion mentioned in r205765).
3087
3088 2016-09-10  Chris Dumez  <cdumez@apple.com>
3089
3090         parseHTMLInteger() should take a StringView in parameter
3091         https://bugs.webkit.org/show_bug.cgi?id=161669
3092
3093         Reviewed by Ryosuke Niwa.
3094
3095         parseHTMLInteger() should take a StringView in parameter instead of a
3096         const String&.
3097
3098         * css/parser/CSSParser.cpp:
3099         (WebCore::CSSParser::parseFontFaceSrcLocal):
3100         * css/parser/CSSParserValues.h:
3101         (WebCore::CSSParserString::toStringView):
3102         Add toStringView() to avoid unnecessarily constructing a String for
3103         calling StringBuilder::append().
3104
3105         * html/parser/HTMLParserIdioms.cpp:
3106         (WebCore::parseHTMLInteger):
3107         (WebCore::parseHTMLNonNegativeInteger):
3108         (WebCore::parseHTTPRefreshInternal):
3109         * html/parser/HTMLParserIdioms.h:
3110         (WebCore::limitToOnlyHTMLNonNegativeNumbersGreaterThanZero):
3111         (WebCore::limitToOnlyHTMLNonNegative):
3112         Take a StringView in parameter instead of a const String&.
3113
3114         * platform/sql/SQLiteStatement.cpp:
3115         (WebCore::SQLiteStatement::isColumnDeclaredAsBlob):
3116         Avoid unnecessarily constructing a String to call equalLettersIgnoringASCIICase()
3117         by leveraging the StringView constructor taking a 'const char*' in parameter.
3118
3119         * rendering/RenderBlock.cpp:
3120         (WebCore::RenderBlock::constructTextRun):
3121         * rendering/RenderBlock.h:
3122         Add constructTextRun() overload taking an AtomicString. It was otherwise ambiguous
3123         because both a String or a StringView could be constructed from an AtomicString.
3124
3125         * page/CaptionUserPreferencesMediaAF.cpp:
3126         (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
3127         (WebCore::buildDisplayStringForTrackBase):
3128         * rendering/RenderThemeMac.mm:
3129         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
3130         (WebCore::RenderThemeMac::mediaControlsScript):
3131         Explicitly construct a String from NSString / CFStringRef types as such calls are
3132         now ambiguous.
3133
3134 2016-09-10  Chris Dumez  <cdumez@apple.com>
3135
3136         It is possible for Document::m_frame pointer to become stale
3137         https://bugs.webkit.org/show_bug.cgi?id=161812
3138         <rdar://problem/27745023>
3139
3140         Reviewed by Ryosuke Niwa.
3141
3142         Document::m_frame is supposed to get cleared by Document::prepareForDestruction().
3143         The Frame destructor calls Frame::setView(nullptr) which is supposed to call the
3144         prepareForDestruction() on the Frame's associated document. However,
3145         Frame::setView(nullptr) was calling prepareForDestruction() only if
3146         Document::inPageCache() returned true. This is because, we allow Documents to
3147         stay alive in the PageCache even though they don't have a frame.
3148
3149         The issue is that Document::m_inPageCache flag was set to true right before
3150         firing the pagehide event, so technically before really entering PageCache.
3151         Therefore, we can run into problems if a Frame gets destroyed by a pagehide
3152         EventHandler because ~Frame() will not call Document::prepareForDestruction()
3153         due to Document::m_inPageCache being true. After the frame is destroyed,
3154         Document::m_frame becomes stale and any action on the document will likely
3155         lead to crashes (such as the one in the layout test and the radar which
3156         happens when trying to unregister event listeners from the document).
3157
3158         The solution adopted in this patch is to replace the m_inPageCache boolean
3159         with a m_pageCacheState enumeration that has 3 states:
3160         - NotInPageCache
3161         - AboutToEnterPageCache
3162         - InPageCache
3163
3164         Frame::setView() / Frame::setDocument() were then updated to call
3165         Document::prepareForDestruction() on the associated document whenever
3166         the document's pageCacheState is not InPageCache. This means that we
3167         will now call Document::prepareForDestruction() when the document is
3168         being detached from its frame while firing the pagehide event.
3169
3170         Note that I tried to keep this patch minimal. Therefore, I kept
3171         the Document::inPageCache() getter for now. I plan to switch all its
3172         calls sites to the new Document::pageCacheState() getter in a follow-up
3173         patch so that we can finally drop the confusing Document::inPageCache().
3174
3175         Test: fast/history/pagehide-remove-iframe-crash.html
3176
3177         * dom/Document.cpp:
3178         (WebCore::Document::Document):
3179         (WebCore::Document::~Document):
3180         (WebCore::Document::createRenderTree):
3181         (WebCore::Document::destroyRenderTree):
3182         (WebCore::Document::setFocusedElement):
3183         (WebCore::Document::setPageCacheState):
3184         (WebCore::Document::topDocument):
3185         * dom/Document.h:
3186         (WebCore::Document::pageCacheState):
3187         (WebCore::Document::inPageCache):
3188         * history/CachedFrame.cpp:
3189         (WebCore::CachedFrame::destroy):
3190         * history/PageCache.cpp:
3191         (WebCore::setPageCacheState):
3192         (WebCore::PageCache::addIfCacheable):
3193         * loader/FrameLoader.cpp:
3194         (WebCore::FrameLoader::stopAllLoaders):
3195         (WebCore::FrameLoader::open):
3196         * loader/HistoryController.cpp:
3197         (WebCore::HistoryController::invalidateCurrentItemCachedPage):
3198         * page/Frame.cpp:
3199         (WebCore::Frame::setView):
3200
3201 2016-09-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3202
3203         Apple.com keynote does not display media controls
3204         https://bugs.webkit.org/show_bug.cgi?id=161833
3205         <rdar://problem/28230123>
3206
3207         Reviewed by Tim Horton.
3208
3209         Tweaks the main content check so that we can distinguish between main content for the purposes of determining
3210         autoplay policy vs. main content for the purposes of showing media controls. Namely, we make the latter less
3211         restrictive than the former in terms of the maximum aspect ratio a video can have to be considered the right
3212         size for main content.
3213
3214         New unit test in TestWebKitAPI.
3215
3216         * html/HTMLMediaElement.cpp:
3217         (WebCore::mediaElementSessionInfoForSession):
3218         * html/MediaElementSession.cpp:
3219         (WebCore::MediaElementSession::canShowControlsManager):
3220         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
3221         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
3222         (WebCore::isMainContentForPurposesOfAutoplay):
3223         (WebCore::isElementLargeEnoughForMainContent):
3224         (WebCore::MediaElementSession::updateIsMainContent):
3225         (WebCore::isMainContent): Deleted.
3226         * html/MediaElementSession.h:
3227
3228 2016-09-09  Alex Christensen  <achristensen@webkit.org>
3229
3230         URLParser: Keep track of cannot-be-a-base-url according to spec
3231         https://bugs.webkit.org/show_bug.cgi?id=161830
3232
3233         Reviewed by Tim Horton.
3234
3235         Covered by new API tests.
3236
3237         * platform/URL.cpp:
3238         (WebCore::URL::invalidate):
3239         * platform/URL.h:
3240         Add a boolean required by the spec.
3241         This will not add to sizeof(URL) because we already have some bit fields.
3242         * platform/URLParser.cpp:
3243         (WebCore::URLParser::parse):
3244         (WebCore::URLParser::allValuesEqual):
3245
3246 2016-09-09  Commit Queue  <commit-queue@webkit.org>
3247
3248         Unreviewed, rolling out r205771.
3249         https://bugs.webkit.org/show_bug.cgi?id=161823
3250
3251         Broke Windows build (Requested by litherum on #webkit).
3252
3253         Reverted changeset:
3254
3255         "Remove unused member of GlyphBuffer"
3256         https://bugs.webkit.org/show_bug.cgi?id=161814
3257         http://trac.webkit.org/changeset/205771
3258
3259 2016-09-09  Alex Christensen  <achristensen@webkit.org>
3260
3261         URLParser should convert ASCII hosts to lowercase
3262         https://bugs.webkit.org/show_bug.cgi?id=161820
3263
3264         Reviewed by Geoffrey Garen.
3265
3266         Covered by new API tests.
3267
3268         * platform/URLParser.cpp:
3269         (WebCore::domainToASCII):
3270         The fast path for domains that are already ASCII and do not need punycode encoding
3271         should convert the domain to lowercase.
3272         This matches behavior in URL::parse if isCanonicalHostnameLowercaseForScheme is true,
3273         and RFC 5890.
3274
3275 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
3276
3277         Remove unused member of GlyphBuffer
3278         https://bugs.webkit.org/show_bug.cgi?id=161814
3279
3280         Reviewed by Simon Fraser.
3281
3282         This m_offsets member never actually affected anything. It just made
3283         FontCascade::drawGlyphBuffer() slower.
3284
3285         No new tests because there is no behavior change.
3286
3287         * platform/graphics/FontCascade.cpp:
3288         (WebCore::FontCascade::drawGlyphBuffer):
3289         * platform/graphics/GlyphBuffer.h:
3290         (WebCore::GlyphBuffer::clear):
3291         (WebCore::GlyphBuffer::advanceAt):
3292         (WebCore::GlyphBuffer::add):
3293         (WebCore::GlyphBuffer::shrink):
3294         (WebCore::GlyphBuffer::swap):
3295         (WebCore::GlyphBuffer::offsetAt): Deleted.
3296         * platform/graphics/win/UniscribeController.cpp:
3297         (WebCore::UniscribeController::shapeAndPlaceItem):
3298
3299 2016-09-09  Tim Horton  <timothy_horton@apple.com>
3300
3301         Text replacement candidates don't always overwrite the entire original string
3302         https://bugs.webkit.org/show_bug.cgi?id=161779
3303         <rdar://problem/28033492>
3304
3305         Reviewed by Simon Fraser.
3306
3307         New test: editing/mac/spelling/accept-candidate-replacing-multiple-words.html.
3308
3309         * editing/Editor.cpp:
3310         (WebCore::Editor::contextRangeForCandidateRequest):
3311         Factor contextRangeForCandidateRequest out of the WebKits, into Editor.
3312         This just expands to paragraph boundaries from the cursor.
3313
3314         (WebCore::Editor::selectTextCheckingResult):
3315         Add selectTextCheckingResult, which, given a TextCheckingResult,
3316         selects the range represented by the result's location and length, which
3317         indicate the portion of the context string that the result refers to.
3318         In the case of accepting a candidate, we want to select that range
3319         so that our insertion will overwrite it.
3320
3321         (WebCore::Editor::handleAcceptedCandidate):
3322         Make use of selectTextCheckingResult instead of just assuming that we want
3323         to replace the word to the left of the insertion point.
3324
3325         (WebCore::Editor::stringForCandidateRequest): Deleted.
3326         * editing/Editor.h:
3327
3328         * testing/Internals.cpp:
3329         (WebCore::Internals::handleAcceptedCandidate):
3330         * testing/Internals.h:
3331         * testing/Internals.idl:
3332         Internals' handleAcceptedCandidate assumed (wrongly) that the length
3333         of a TextCheckerResult was the length of the candidate, when really it is
3334         the length of the text that the candidate would replace. Adjust this,
3335         and expose the replacement range to JavaScript, so we can test this.
3336
3337 2016-09-09  Brady Eidson  <beidson@apple.com>
3338
3339         Soft-link GameController.framework.
3340         <rdar://problem/28219953> and https://bugs.webkit.org/show_bug.cgi?id=161802
3341
3342         Reviewed by Brian Burg.
3343
3344         No new tests (No change in behavior).
3345
3346         * Configurations/WebCore.xcconfig:
3347         * WebCore.xcodeproj/project.pbxproj:
3348         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
3349         (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
3350
3351 2016-09-09  Jiewen Tan  <jiewen_tan@apple.com>
3352
3353         Rename Key to CryptoKey
3354         https://bugs.webkit.org/show_bug.cgi?id=161665
3355         <rdar://problem/28083391>
3356
3357         Reviewed by Brent Fulgham.
3358
3359         A link to the spec: https://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface
3360
3361         * crypto/CryptoKey.idl:
3362         Remove some unnecessary IDL attributes and reorder KeyType enum to match the spec.
3363         * crypto/CryptoKeyType.h:
3364
3365 2016-09-09  Alex Christensen  <achristensen@webkit.org>
3366
3367         URLParser: Fix and optimize parsing file URLs ending with a host but no slash
3368         https://bugs.webkit.org/show_bug.cgi?id=161815
3369
3370         Reviewed by Geoffrey Garen.
3371
3372         Covered by new API tests.
3373
3374         * platform/URLParser.cpp:
3375         (WebCore::bufferView):
3376         (WebCore::URLParser::copyURLPartsUntil):
3377         (WebCore::URLParser::parse):
3378
3379 2016-09-09  Alex Christensen  <achristensen@webkit.org>
3380
3381         URLParser: Handle \ in path according to spec
3382         https://bugs.webkit.org/show_bug.cgi?id=161805
3383
3384         Reviewed by Andy Estes.
3385
3386         Covered by new API tests.
3387
3388         * platform/URLParser.cpp:
3389         (WebCore::URLParser::parse):
3390
3391 2016-09-09  Youenn Fablet  <youenn@apple.com>
3392
3393         TextTrackLoader should use FetchOptions::mode according its crossOrigin attribute
3394         https://bugs.webkit.org/show_bug.cgi?id=161792
3395
3396         Reviewed by Eric Carlson.
3397
3398         Covered by existing and updated tests.
3399
3400         Updating text track loader to use fetch mode according crossOrigin value.
3401
3402         Removed the check done in the case the crossOrigin value is not set.
3403         Previously cross-origin loads were forbidden, now this is authorized.
3404         This change allows aligning with the spec.
3405         Also, this check could be bypassed in the case of a same-origin URL redirecting to a cross-origin one.
3406
3407         * loader/TextTrackLoader.cpp:
3408         (WebCore::TextTrackLoader::notifyFinished): Checking resource error in lieu of doing CORS checks on its own.
3409         (WebCore::TextTrackLoader::load): Using CachedResourceRequest::setAsPotentiallyCrossOrigin
3410         * loader/TextTrackLoader.h:
3411         * loader/cache/CachedResource.cpp:
3412         (WebCore::CachedResource::loadFrom): Setting loading and status values as would be done when load is finished.
3413         (WebCore::CachedResource::setBodyDataFrom): Default implementation is to copy the shared buffer.
3414         * loader/cache/CachedResource.h:
3415         * loader/cache/CachedResourceLoader.cpp:
3416         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Enabling resource update when mode or origin is different for TextTrack resources.
3417
3418 2016-09-09  Alex Christensen  <achristensen@webkit.org>
3419
3420         URLParser should parse URLs with non-special schemes
3421         https://bugs.webkit.org/show_bug.cgi?id=161786
3422
3423         Reviewed by Andy Estes.
3424
3425         Covered by new API tests.
3426
3427         * platform/URLParser.cpp:
3428         (WebCore::URLParser::parse):
3429         There's no reason for a SchemeEndCheckForSlashes state now that we can copy iterators.
3430         It's not in the spec and not needed.
3431         Also, move things around a little so parsing special or non-special schemes
3432         followed by one or two slashes works correctly.
3433
3434 2016-09-09  Chris Dumez  <cdumez@apple.com>
3435
3436         Regression(r186020): Null dereference in getStartDate()
3437         https://bugs.webkit.org/show_bug.cgi?id=161733
3438
3439         Reviewed by Eric Carlson.
3440
3441         Update HTMLMediaElement::getStartDate() to return NaN if m_player is null,
3442         instead of crashing.
3443
3444         Test: fast/media/getStartDate-NaN.html
3445
3446         * bindings/js/IDBBindingUtilities.cpp:
3447         (WebCore::toJS):
3448         Add a FIXME comment as this code is using jsDateOrNull() but should
3449         probably be using jsDate() as per:
3450         - http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
3451
3452         * bindings/js/JSDOMBinding.cpp:
3453         (WebCore::jsDate):
3454         (WebCore::jsDateOrNull):
3455         * bindings/js/JSDOMBinding.h:
3456         - Rename jsDateOrNaN() to jsDate() as this is the default behavior. Also,
3457           return new Date(NaN) instead of NaN if the implementation returns NaN.
3458           The IDL says we should return a Date, not a number.
3459         - Update jsDateOrNull() to only return jsNull() if the native value is
3460           NaN, instead of doing so for every value that is not finite. Our
3461           convention is to use NaN as special value to represent null in JS.
3462
3463         * bindings/scripts/CodeGeneratorJS.pm:
3464         (NativeToJSValue):
3465         When converting a native value (double) into a Date, rely on the fact
3466         that the type is nullable when deciding if we should call jsDate() or
3467         jsDateOrNull() to convert. This way, we no longe need a WebKit specific
3468         [TreatReturnedDateAs=Null|NaN] IDL extended attribute.
3469
3470         * bindings/scripts/IDLAttributes.txt:
3471         * html/HTMLInputElement.idl:
3472         Mark valueAsDate attribute as nullable, as per the specification:
3473         - https://html.spec.whatwg.org/#htmlinputelement
3474
3475         * html/HTMLMediaElement.cpp:
3476         (WebCore::HTMLMediaElement::getStartDate):
3477         Return NaN if m_player is null instead of crashing. The reason I decided
3478         to return NaN is because the specification [1] says to return a new Date
3479         object representing the current timeline offset. The spec of timeline
3480         offset [2] says that the initial timeline offset value is NaN.
3481         [1] https://html.spec.whatwg.org/#dom-media-getstartdate
3482         [2] https://html.spec.whatwg.org/#timeline-offset
3483
3484         * bindings/scripts/IDLAttributes.txt:
3485         * html/HTMLMediaElement.idl:
3486         Drop [TreatReturnedDateAs] attribute as it is no longer supported.
3487
3488 2016-09-09  Youenn Fablet  <youenn@apple.com>
3489
3490         ASSERTION FAILED: promise.inherits(JSPromise::info())
3491         https://bugs.webkit.org/show_bug.cgi?id=161632
3492         <rdar://problem/28184743>
3493
3494         Reviewed by Mark Lam.
3495
3496         Test: fetch/fetch-worker-crash.html
3497
3498         * bindings/js/JSDOMPromise.h:
3499         (WebCore::callPromiseFunction): Returning early if created promise is null.
3500         Passing directly a DeferredWrapper to the generated code.
3501         * bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
3502         (GenerateImplementation):
3503         (GenerateReturnParameters):
3504         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
3505         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
3506         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
3507         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
3508         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
3509         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
3510         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
3511         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
3512         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
3513
3514 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
3515
3516         [Cocoa] Improve performance of glyph advance metrics gathering
3517         https://bugs.webkit.org/show_bug.cgi?id=161119
3518
3519         Reviewed by Simon Fraser.
3520
3521         Most of the glyphs in a GlyphPage are never read from. Therefore, we can get a performance boost
3522         by not populating as many items in the GlyphPage. Because of the performance characteristics of
3523         CTFontGetGlyphsForCharacters(), a better size for a GlyphPage is 16 items. This, coupled with
3524         using CTFontGetUnsummedAdvancesForGlyphsAndStyle(), causes between a 0.01%-0.5% speedup on PLT.
3525
3526         No new tests because there is no behavior change.
3527
3528         * platform/graphics/Font.cpp:
3529         (WebCore::Font::initCharWidths):
3530         (WebCore::Font::platformGlyphInit):
3531         (WebCore::createAndFillGlyphPage):
3532         * platform/graphics/Font.h:
3533         (WebCore::Font::widthForGlyph):
3534         * platform/graphics/GlyphMetricsMap.h:
3535         * platform/graphics/GlyphPage.h:
3536         * platform/graphics/cocoa/FontCocoa.mm:
3537         * platform/spi/cocoa/CoreTextSPI.h:
3538         (WebCore::Font::platformWidthForGlyph):
3539         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
3540
3541 2016-09-09  Antti Koivisto  <antti@apple.com>
3542
3543         v3: WebContent crash due to RELEASE_ASSERT in WebCore: WebCore::StyleResolver::styleForElement
3544         https://bugs.webkit.org/show_bug.cgi?id=161689
3545
3546         Reviewed by Andreas Kling.
3547
3548         These crashes happen because synchronously triggered resource loads generate callbacks that may end up
3549         deleting the resource loader.
3550
3551         Stop triggering resource loads from StyleResolver. Instead trigger them when applying style to render tree.
3552
3553         * css/StyleResolver.cpp:
3554         (WebCore::StyleResolver::~StyleResolver):
3555
3556             Replace the RELEASE_ASSERT against deletion during resource loads by a general isDeleted assert.
3557
3558         (WebCore::StyleResolver::styleForElement):
3559         (WebCore::StyleResolver::styleForKeyframe):
3560         (WebCore::StyleResolver::pseudoStyleForElement):
3561         (WebCore::StyleResolver::styleForPage):
3562         (WebCore::StyleResolver::applyMatchedProperties):
3563         (WebCore::StyleResolver::loadPendingResources): Deleted.
3564         * css/StyleResolver.h:
3565         * page/animation/KeyframeAnimation.cpp:
3566         (WebCore::KeyframeAnimation::KeyframeAnimation):
3567         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
3568
3569             Ensure resource load for all animation frames.
3570
3571         * page/animation/KeyframeAnimation.h:
3572         * rendering/RenderElement.cpp:
3573         (WebCore::RenderElement::createFor):
3574         (WebCore::RenderElement::initializeStyle):
3575
3576             Load resources when renderer initializes a style.
3577
3578         (WebCore::RenderElement::setStyle):
3579         (WebCore::RenderElement::getUncachedPseudoStyle):
3580
3581             Load resources for pseudo styles.
3582
3583         * rendering/RenderImage.cpp:
3584         (WebCore::RenderImage::RenderImage):
3585         (WebCore::RenderImage::styleWillChange):
3586
3587             Shuffle image resource initialization out from constructor so initializeStyle gets called before.
3588
3589         * rendering/RenderImage.h:
3590         * rendering/style/StyleCachedImage.cpp:
3591         (WebCore::StyleCachedImage::StyleCachedImage):
3592
3593             Track pending status with a bit instead of implicitly by the existence of CachedResource.
3594             This is useful for asserts.
3595
3596         (WebCore::StyleCachedImage::load):
3597         (WebCore::StyleCachedImage::isPending):
3598         (WebCore::StyleCachedImage::addClient):
3599         (WebCore::StyleCachedImage::removeClient):
3600         (WebCore::StyleCachedImage::image):
3601         * rendering/style/StyleCachedImage.h:
3602
3603 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3604
3605         ScriptRunner should be driven by PendingScript rather than ScriptElement
3606         https://bugs.webkit.org/show_bug.cgi?id=161726
3607
3608         Reviewed by Ryosuke Niwa.
3609
3610         Tests: js/dom/document-write-in-error-event.html
3611                js/dom/document-write-in-load-event.html
3612
3613         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
3614         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
3615         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
3616         while all the external script will load the LoadableScript. It is confusing.
3617         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
3618         in ScriptRunner instead.
3619
3620         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
3621         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
3622         this execution. The added tests ensure this behavior.
3623
3624         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
3625
3626         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
3627         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
3628         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
3629         So no need to do it here, that's duplicated.
3630         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
3631         (WebCore::ScriptElement::stopLoadRequest): Deleted.
3632         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
3633         merged into executeScriptForRunner.
3634         (WebCore::ScriptElement::notifyFinished): Deleted.
3635         * dom/ScriptElement.h:
3636         (WebCore::ScriptElement::~ScriptElement):
3637         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
3638         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
3639         * dom/ScriptRunner.cpp:
3640         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
3641         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
3642         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
3643         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
3644         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
3645         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
3646         * dom/ScriptRunner.h:
3647         * html/parser/HTMLScriptRunner.cpp:
3648         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
3649
3650 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3651
3652         [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
3653         https://bugs.webkit.org/show_bug.cgi?id=161763
3654
3655         Reviewed by Mark Lam.
3656
3657         Include wtf/text/StringHash.h to avoid linking errors in EFL port.
3658
3659         * loader/ResourceLoadStatistics.h:
3660
3661 2016-09-08  Chris Dumez  <cdumez@apple.com>
3662
3663         HTMLObjectElement.hspace / vspace attributes should be unsigned
3664         https://bugs.webkit.org/show_bug.cgi?id=161766
3665
3666         Reviewed by Ryosuke Niwa.
3667
3668         HTMLObjectElement.hspace / vspace attributes should be unsigned:
3669         - https://html.spec.whatwg.org/#HTMLObjectElement-partial
3670
3671         Firefox agrees with the specification but those were signed in WebKit.
3672
3673         No new tests, rebaselined existing test.
3674
3675         * html/HTMLObjectElement.idl:
3676
3677 2016-09-08  Chris Dumez  <cdumez@apple.com>
3678
3679         HTMLObjectElement.codebase attribute should reflect as a URL
3680         https://bugs.webkit.org/show_bug.cgi?id=161768
3681
3682         Reviewed by Alex Christensen.
3683
3684         HTMLObjectElement.codebase attribute should reflect as a URL:
3685         - https://html.spec.whatwg.org/#dom-applet-codebase
3686
3687         Chrome and Firefox agree with the specification.
3688
3689         No new test, rebaselined existing test.
3690
3691         * html/HTMLObjectElement.idl:
3692
3693 2016-09-08  Chris Dumez  <cdumez@apple.com>
3694
3695         ol.start may return incorrect value for reversed lists when not explicitly set
3696         https://bugs.webkit.org/show_bug.cgi?id=161713
3697
3698         Reviewed by Zalan Bujtas.
3699
3700         ol.start may return incorrect value for reversed lists when not explicitly set.
3701         This is because we're supposed to return the number of rendered <li> child
3702         elements, which relies on layout. However, we did not make sure the layout is
3703         up-to-date before counting the number of li child elements. This patch fixes
3704         the issue.
3705
3706         No new tests, rebaselined existing tests.
3707
3708         * html/HTMLOListElement.h:
3709
3710 2016-09-08  Chris Dumez  <cdumez@apple.com>
3711
3712         Add support for HTMLIframeElement.allowFullscreen attribute
3713         https://bugs.webkit.org/show_bug.cgi?id=161757
3714
3715         Reviewed by Sam Weinig.
3716
3717         Add support for HTMLIframeElement.allowFullscreen attribute:
3718         - https://html.spec.whatwg.org/#dom-iframe-allowfullscreen
3719
3720         Firefox and Chrome already support it, unprefixed.
3721
3722         Note that the HTMLIframeElement.allowFullscreen attribute reflects the
3723         allowfullscreen content attribute which we already support.
3724
3725         Test: fullscreen/full-screen-iframe-allowFullscreen.html
3726
3727         * html/HTMLIFrameElement.idl:
3728
3729 2016-09-08  Chris Dumez  <cdumez@apple.com>
3730
3731         frame.longDesc / iframe.longDesc should reflect as a URL
3732         https://bugs.webkit.org/show_bug.cgi?id=161764
3733
3734         Reviewed by Alex Christensen.
3735
3736         frame.longDesc / iframe.longDesc should reflect as a URL:
3737         - https://html.spec.whatwg.org/#dom-iframe-longdesc
3738         - https://html.spec.whatwg.org/#dom-frame-longdesc
3739
3740         They already do in Chrome and Firefox.
3741
3742         No new tests, rebaselined existing tests.
3743
3744         * html/HTMLFrameElement.idl:
3745         * html/HTMLIFrameElement.idl:
3746
3747 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3748
3749         URLParser: Handle \ in paths of special URLs according to spec
3750         https://bugs.webkit.org/show_bug.cgi?id=161781
3751
3752         Reviewed by Tim Horton.
3753
3754         Covered by new API tests.
3755
3756         * platform/URLParser.cpp:
3757         (WebCore::bufferView):
3758         (WebCore::URLParser::copyURLPartsUntil):
3759         (WebCore::URLParser::parse):
3760         * platform/URLParser.h:
3761
3762 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3763
3764         Move the BitmapImage platform dependent code to a new file named NativeImage[CG|Cairo].cpp
3765         https://bugs.webkit.org/show_bug.cgi?id=158684
3766
3767         Reviewed by Simon Fraser.
3768
3769         This is a refactoring patch. It moves the BitmapImage platform dependent
3770         code from BitmapImage to NativeImage[CG|Cairo].cpp. The new APIs are
3771         responsible of drawing a NativeImagePtr and answering some metadata queries.
3772
3773         No new tests -- Code refactoring, no behavior change.
3774
3775         * PlatformAppleWin.cmake:
3776         * PlatformEfl.cmake:
3777         * PlatformGTK.cmake:
3778         * PlatformMac.cmake:
3779         * PlatformWinCairo.cmake:
3780         * WebCore.xcodeproj/project.pbxproj:
3781         * loader/cache/MemoryCache.h:
3782         * loader/icon/IconDatabaseBase.h:
3783         * page/mac/TextIndicatorWindow.mm:
3784         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
3785         (createContentCrossfadeAnimation):
3786         * platform/graphics/BitmapImage.cpp:
3787         (WebCore::BitmapImage::BitmapImage):
3788         (WebCore::BitmapImage::destroyDecodedData):
3789         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
3790         (WebCore::BitmapImage::dataChanged):
3791         (WebCore::BitmapImage::ensureFrameAtIndexIsCached):
3792         (WebCore::BitmapImage::frameImageAtIndex):
3793         (WebCore::BitmapImage::nativeImage):
3794         (WebCore::BitmapImage::nativeImageForCurrentFrame):
3795         (WebCore::BitmapImage::nativeImageOfSize):
3796         (WebCore::BitmapImage::framesNativeImages):
3797         (WebCore::BitmapImage::frameIsCompleteAtIndex):
3798         (WebCore::BitmapImage::frameDurationAtIndex):
3799         (WebCore::BitmapImage::frameHasAlphaAtIndex):
3800         (WebCore::BitmapImage::frameOrientationAtIndex):
3801         (WebCore::BitmapImage::singlePixelSolidColor):
3802         (WebCore::BitmapImage::draw):
3803         (WebCore::BitmapImage::drawPattern):
3804         (WebCore::BitmapImage::canAnimate):
3805         (WebCore::BitmapImage::clearTimer):
3806         (WebCore::BitmapImage::startTimer):
3807         (WebCore::BitmapImage::stopAnimation):
3808         (WebCore::BitmapImage::resetAnimation):
3809         (WebCore::BitmapImage::hasSingleSecurityOrigin): Deleted.
3810         (WebCore::BitmapImage::filenameExtension): Deleted.
3811         (WebCore::BitmapImage::ensureFrameIsCached): Deleted.
3812         * platform/graphics/BitmapImage.h:
3813         (WebCore::FrameData::FrameData):
3814         m_hasAlpha can be initialized with false because it is accessed only in
3815         BitmapImage::frameHasAlphaAtIndex() and it is guarded by m_haveMetadata.
3816         Both m_haveMetadata and m_hasAlpha are set in BitmapImage constructor
3817         and in BitmapImage::cacheFrame().
3818         
3819         (WebCore::FrameData::~FrameData):
3820         (WebCore::FrameData::clear):
3821         * platform/graphics/Icon.h:
3822         * platform/graphics/Image.h:
3823         (WebCore::Image::nativeImage):
3824         (WebCore::Image::nativeImageOfSize):
3825         (WebCore::Image::framesNativeImages):
3826         (WebCore::Image::orientationForCurrentFrame): Deleted.
3827         (WebCore::Image::getCGImageRef): Deleted.
3828         (WebCore::Image::getFirstCGImageRefOfSize): Deleted.
3829         (WebCore::Image::getCGImageArray): Deleted.
3830         * platform/graphics/ImageSource.cpp:
3831         (WebCore::ImageSource::calculateMaximumSubsamplingLevel):
3832         (WebCore::ImageSource::size):
3833         (WebCore::ImageSource::sizeRespectingOrientation):
3834         * platform/graphics/ImageSource.h:
3835         * platform/graphics/MediaPlayer.h:
3836         * platform/graphics/NativeImage.h: Added.
3837         * platform/graphics/NativeImagePtr.h: Removed.
3838         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3839         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage):
3840         * platform/graphics/cairo/BitmapImageCairo.cpp: Removed.
3841         * platform/graphics/cairo/NativeImageCairo.cpp: Added.
3842         (WebCore::nativeImageSize):
3843         (WebCore::nativeImageHasAlpha):
3844         (WebCore::nativeImageSinglePixelSolidColor):
3845         (WebCore::subsamplingScale):
3846         (WebCore::drawNativeImage):
3847         (WebCore::clearNativeImageSubImages):
3848         * platform/graphics/cg/BitmapImageCG.cpp: Removed.
3849         * platform/graphics/cg/ImageDecoderCG.cpp:
3850         (WebCore::ImageDecoder::size):
3851         * platform/graphics/cg/ImageDecoderCG.h:
3852         * platform/graphics/cg/NativeImageCG.cpp: Added.
3853         (WebCore::nativeImageSize):
3854         (WebCore::nativeImageHasAlpha):
3855         (WebCore::nativeImageSinglePixelSolidColor):
3856         (WebCore::subsamplingScale):
3857         (WebCore::drawNativeImage):
3858         (WebCore::clearNativeImageSubImages):
3859         * platform/graphics/cg/PatternCG.cpp:
3860         (WebCore::Pattern::createPlatformPattern):
3861         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3862         (TextTrackRepresentationCocoa::update):
3863         * platform/graphics/mac/ImageMac.mm:
3864         (WebCore::BitmapImage::getTIFFRepresentation):
3865         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3866         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer):
3867         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
3868         * platform/win/DragImageCGWin.cpp:
3869         (WebCore::createDragImageFromImage):
3870
3871 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3872
3873         URLParser: Parsing empty URLs with a base URL should return the base URL
3874         https://bugs.webkit.org/show_bug.cgi?id=161777
3875
3876         Reviewed by Tim Horton.
3877
3878         Covered by an API test and progress towards passing all web platform tests when using URLParser.
3879
3880         * platform/URLParser.cpp:
3881         (WebCore::URLParser::parse):
3882
3883 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3884
3885         URLParser failures should preserve the original input string
3886         https://bugs.webkit.org/show_bug.cgi?id=161769
3887
3888         Reviewed by Tim Horton.
3889
3890         No new tests, but covered by updates to API tests.
3891         This also represents many newly passing web platform tests when using URLParser.
3892
3893         * platform/URLParser.cpp:
3894         (WebCore::URLParser::failure):
3895         (WebCore::URLParser::parse):
3896         * platform/URLParser.h:
3897
3898 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3899
3900         URLParser should parse URLs with a user but no password
3901         https://bugs.webkit.org/show_bug.cgi?id=161773
3902
3903         Reviewed by Brady Eidson.
3904
3905         Covered by new API tests.
3906
3907         * platform/URLParser.cpp:
3908         (WebCore::URLParser::parseAuthority):
3909
3910 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3911
3912         Fix URLs after r205669.
3913         https://bugs.webkit.org/show_bug.cgi?id=161731
3914
3915         * platform/URLParser.cpp:
3916         (WebCore::URLParser::enabled):
3917         I accidentally committed enabling the URLParser by default.  Not ready yet.
3918
3919 2016-09-08  Chris Dumez  <cdumez@apple.com>
3920
3921         Align proto getter / setter behavior with other browsers
3922         https://bugs.webkit.org/show_bug.cgi?id=161455
3923
3924         Reviewed by Saam Barati.
3925
3926         Align cross-origin __proto__ getter / setter behavior with other
3927         browsers and the specification:
3928
3929         [[SetPrototypeOf]] should throw a TypeError:
3930         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
3931         - https://html.spec.whatwg.org/#location-setprototypeof
3932         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
3933
3934         [[GetPrototypeOf]] should return null cross-origin:
3935         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
3936         - https://html.spec.whatwg.org/#location-getprototypeof
3937
3938         Test: js/dom/setPrototypeOf-location-window.html
3939
3940         * bindings/js/JSDOMWindowBase.cpp:
3941         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
3942         * bindings/js/JSDOMWindowCustom.cpp:
3943         (WebCore::JSDOMWindow::setPrototype):
3944         (WebCore::JSDOMWindow::getPrototype):
3945         (WebCore::JSDOMWindow::preventExtensions):
3946         * bindings/js/JSLocationCustom.cpp:
3947         (WebCore::JSLocation::setPrototype):
3948         (WebCore::JSLocation::getPrototype):
3949         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3950         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
3951         * bindings/js/JSWorkerGlobalScopeBase.h:
3952         * bindings/scripts/CodeGeneratorJS.pm:
3953         (GenerateHeader):
3954         * bindings/scripts/IDLAttributes.txt:
3955         * page/DOMWindow.idl:
3956         * page/Location.idl:
3957
3958 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3959
3960         URLParser should parse ports after IPv4 and IPv6 hosts
3961         https://bugs.webkit.org/show_bug.cgi?id=161731
3962
3963         Reviewed by Brady Eidson.
3964
3965         Covered by new API tests.
3966
3967         * platform/URLParser.cpp:
3968         (WebCore::URLParser::parsePort):
3969         (WebCore::URLParser::parseHost):
3970
3971 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3972
3973         URLParser should correctly handle \ in path
3974         https://bugs.webkit.org/show_bug.cgi?id=161762
3975
3976         Reviewed by Brady Eidson.
3977
3978         Covered by new API tests.
3979
3980         * platform/URLParser.cpp:
3981         (WebCore::isSpecialScheme):
3982         (WebCore::bufferView):
3983         (WebCore::URLParser::parse):
3984         Treat \ as / in the path of special URLs as described in the spec and tested in web platform tests.
3985         Also a slight performance improvement using StringViews instead of copied Strings.
3986
3987 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3988
3989         URLParser should handle URLs with empty authority
3990         https://bugs.webkit.org/show_bug.cgi?id=161711
3991
3992         Reviewed by Brady Eidson.