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