Modern IDB: storage/indexeddb/dont-wedge.html sometimes ASSERTs.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-02-02  Brady Eidson  <beidson@apple.com>
2
3         Modern IDB: storage/indexeddb/dont-wedge.html sometimes ASSERTs.
4         https://bugs.webkit.org/show_bug.cgi?id=153790
5
6         Reviewed by Tim Horton.
7
8         No new tests (Failing test now unskipped).
9
10         This test uncovered an unhandled race where the main thread tried to perform an OpenDB operation 
11         multiple times while it was already in-progress on the server thread.
12
13         There was already a flag meant to cover this race, and it just needed to be applied to one more site.
14         
15         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
16         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
17         (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
18
19 2016-02-02  Daniel Bates  <dabates@apple.com>
20
21         CSP: Support checking content security policy without a script execution context
22         https://bugs.webkit.org/show_bug.cgi?id=153748
23         <rdar://problem/24439149>
24
25         Reviewed by Darin Alder.
26
27         Towards checking a Web Worker's content security policy against a redirected worker
28         script load or redirected XHR request for an XHR request initiated from it, we should
29         support instantiating a ContentSecurityPolicy object without a ScriptExecutionContext.
30
31         No functionality was changed. So, no new tests.
32
33         * dom/Document.cpp:
34         (WebCore::Document::initSecurityContext): Pass |this| as a reference instead of as a pointer.
35         * page/csp/ContentSecurityPolicy.cpp: Remove extraneous includes ScriptState.h, TextEncoding.h,
36         and URL.h as they are included by ContentSecurityPolicy.h, FormDataList.h and FormData.h, respectively.
37         (WebCore::CSPSource::CSPSource): Take a constant reference to a ContentSecurityPolicy instead
38         of a pointer since we never expected a null pointer.
39         (WebCore::CSPSource::schemeMatches): Move logic for checking the protocol of source "self"
40         from here to ContentSecurityPolicy::protocolMatchesSelf() because we may not have a security
41         origin if ContentSecurityPolicy was initiated without a ScriptExecutionContext object.
42         (WebCore::CSPSourceList::allowSelf): Added.
43         (WebCore::CSPSourceList::CSPSourceList): Take a constant reference to a ContentSecurityPolicy
44         instead of a pointer since we never expected a null pointer. Remove fields from member
45         initialization list that can be initialized using C++11 in-class initialization syntax.
46         (WebCore::CSPSourceList::matches): Call ContentSecurityPolicy::urlMatchesSelf() to match the
47         effective URL against the URL of source "self".
48         (WebCore::CSPSourceList::parse): Update code as necessary now that m_policy is a reference
49         instead of a pointer.
50         (WebCore::CSPSourceList::parseSource): Simplify code by setting internal member fields directly
51         instead of via member functions.
52         (WebCore::CSPSourceList::parsePath): Update code as necessary now that m_policy is a reference
53         instead of a pointer.
54         (WebCore::CSPDirective::CSPDirective): Take a constant reference to a ContentSecurityPolicy
55         instead of a pointer since we never expected a null pointer.
56         (WebCore::CSPDirective::policy): Return a reference to a const ContentSecurityPolicy.
57         (WebCore::MediaListDirective::MediaListDirective): Take a constant reference to a ContentSecurityPolicy
58         instead of a pointer since we never expected a null pointer.
59         (WebCore::MediaListDirective::parse): Update code as necessary now that m_policy is a reference
60         instead of a pointer.
61         (WebCore::SourceListDirective::SourceListDirective): Take a constant reference to a ContentSecurityPolicy
62         instead of a pointer since we never expected a null pointer.
63         (WebCore::SourceListDirective::allows): Write in terms of CSPSourceList::allowSelf() because we
64         may not have a security origin to get a URL from if ContentSecurityPolicy was initiated without
65         a ScriptExecutionContext object.
66         (WebCore::CSPDirectiveList::reportURIs): Change return type from Vector<URL> to Vector<String>
67         The caller will convert the strings to URLs with respect to the script execution context.
68         (WebCore::CSPDirectiveList::parseReportURI): Store the report URI as a string instead of a URL
69         because we may not have a security origin to compute the absolute URL if ContentSecurityPolicy
70         was initiated without a ScriptExecutionContext object.
71         (WebCore::CSPDirectiveList::CSPDirectiveList): Take a reference to a ContentSecurityPolicy
72         instead of a pointer since we never expected a null pointer. It would be better to take a const
73         reference to a ContentSecurityPolicy, but ContentSecurityPolicy::applySandboxPolicy() needs to set
74         state on ContentSecurityPolicy :(
75         (WebCore::CSPDirectiveList::create): Ditto.
76         (WebCore::CSPDirectiveList::reportViolation): Update code as necessary now that m_policy is a reference
77         instead of a pointer.
78         (WebCore::CSPDirectiveList::checkEvalAndReportViolation): Ditto.
79         (WebCore::CSPDirectiveList::checkInlineAndReportViolation): Ditto.
80         (WebCore::CSPDirectiveList::parseDirective): Ditto.
81         (WebCore::CSPDirectiveList::parseReportURI): Store the report URI as a string instead of a URL
82         because we may not have a security origin to compute the absolute URL if ContentSecurityPolicy
83         was initiated without a ScriptExecutionContext object.
84         (WebCore::CSPDirectiveList::setCSPDirective): Update code as necessary now that m_policy is a reference
85         instead of a pointer.
86         (WebCore::CSPDirectiveList::applySandboxPolicy): Ditto.
87         (WebCore::CSPDirectiveList::parseReflectedXSS): Ditto.
88         (WebCore::CSPDirectiveList::addDirective): Ditto.
89         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Modified to take the ScriptExecutionObject
90         as a reference and compute the CSPSource object for "self" and cache the protocol for "self". Removed
91         field m_overrideInlineStyleAllowed from the member initialization list and used C++11 in-class
92         initialization syntax to initialize it. Added overloaded constructor that takes a SecurityOrigin object.
93         We are not making use of this overloaded constructor at this time. We will in a subsequent patch.
94         (WebCore::ContentSecurityPolicy::didReceiveHeader): Store the eval disabled error message for
95         the last parsed policy in a member field instead of using it as part of disabling eval execution
96         on the script execution context because we may not have such a context.
97         (WebCore::ContentSecurityPolicy::applyPolicyToScriptExecutionContext): Applies the content security
98         policy eval and sandbox restrictions to the script execution context.
99         (WebCore::ContentSecurityPolicy::urlMatchesSelf): Match the specified URL against the URL for
100         source "self".
101         (WebCore::ContentSecurityPolicy::protocolMatchesSelf): Match the protocol of the specified URL
102         against the protocol for source "self".
103         (WebCore::ContentSecurityPolicy::gatherReportURIs): Modified to use the script execution context
104         to compute the absolute URL for each report URI.
105         (WebCore::ContentSecurityPolicy::reportViolation): Bail out if we do not have a script execution
106         context.
107         (WebCore::ContentSecurityPolicy::logToConsole): Only log to the console if we have a script
108         execution context.
109         (WebCore::ContentSecurityPolicy::reportBlockedScriptExecutionToInspector): Only report blocked
110         script execution to the Web Inspector if we have a script execution context.
111         (WebCore::CSPSourceList::addSourceSelf): Deleted.
112         (WebCore::CSPSourceList::addSourceStar): Deleted.
113         (WebCore::CSPSourceList::addSourceUnsafeInline): Deleted.
114         (WebCore::CSPSourceList::addSourceUnsafeEval): Deleted.
115         (WebCore::CSPDirectiveList::gatherReportURIs): Deleted.
116         (WebCore::ContentSecurityPolicy::securityOrigin): Deleted.
117         (WebCore::ContentSecurityPolicy::url): Deleted.
118         (WebCore::ContentSecurityPolicy::completeURL): Deleted.
119         (WebCore::ContentSecurityPolicy::enforceSandboxFlags): Deleted.
120         * page/csp/ContentSecurityPolicy.h:
121         (WebCore::ContentSecurityPolicy::enforceSandboxFlags): Accumulates the parsed sandbox flags. We
122         will apply the sandbox flags in ContentSecurityPolicy::applyPolicyToScriptExecutionContext().
123         * workers/WorkerGlobalScope.cpp:
124         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate ContentSecurityPolicy.
125         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Move instantiation of
126         ContentSecurityPolicy from here to constructor.
127
128 2016-02-02  Eric Carlson  <eric.carlson@apple.com>
129
130         Allow ports to disable automatic text track selection
131         https://bugs.webkit.org/show_bug.cgi?id=153761
132         <rdar://problem/24416768>
133
134         Reviewed by Darin Adler.
135
136         Test: media/track/track-manual-mode.html
137
138         * Modules/mediacontrols/MediaControlsHost.cpp:
139         (WebCore::MediaControlsHost::manualKeyword): New.
140         (WebCore::MediaControlsHost::captionDisplayMode): Support 'manual' mode.
141         * Modules/mediacontrols/MediaControlsHost.h:
142
143         * Modules/mediacontrols/mediaControlsApple.js:
144         (Controller.prototype.buildCaptionMenu): Check the 'off' item when in manual mode.
145
146         * html/HTMLMediaElement.cpp:
147         (WebCore::HTMLMediaElement::addTextTrack): Update m_captionDisplayMode when called for the first
148           time so it is always correct. Set the track's manual selection mode as appropriate.
149         (WebCore::HTMLMediaElement::captionPreferencesChanged): Set each track's manual selection 
150           mode as appropriate.
151
152         * html/track/TextTrack.cpp:
153         (WebCore::TextTrack::kind): Return 'subtitles' for forced tracks when in manual mode.
154         * html/track/TextTrack.h:
155
156         * html/track/TrackBase.h:
157         (WebCore::TrackBase::kind): Make virtual.
158
159         * page/CaptionUserPreferences.cpp:
160         (WebCore::CaptionUserPreferences::beginBlockingNotifications): New.
161         (WebCore::CaptionUserPreferences::endBlockingNotifications): Ditto.
162         (WebCore::CaptionUserPreferences::notify): Don't notify when blocked.
163         * page/CaptionUserPreferences.h:
164
165         * page/CaptionUserPreferencesMediaAF.cpp:
166         (WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF): Set manual mode 
167           when appropriate.
168         (WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode): Check manual mode.
169         (WebCore::CaptionUserPreferencesMediaAF::setCaptionDisplayMode): Ditto.
170         (WebCore::CaptionUserPreferencesMediaAF::setPreferredLanguage): Ditto.
171         (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Return zero when in manual mode.
172         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Consider manual mode. Fix
173           typos in logging.
174
175         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
176         (WebCore::mediaDescriptionForKind): Return 'auxiliary' when in manual mode.
177
178         * testing/Internals.cpp:
179         (WebCore::Internals::setCaptionDisplayMode): Support manual mode.
180
181 2016-02-02  Adrien Plazas  <aplazas@igalia.com>
182
183         REGRESSION(r195899): ASSERTION FAILED: is<Target>(source) in EventPath::retargetTouch() since r195899
184         https://bugs.webkit.org/show_bug.cgi?id=153741
185
186         Reviewed by Ryosuke Niwa.
187
188         * dom/EventDispatcher.cpp:
189         (WebCore::EventPath::retargetTouch):
190
191 2016-02-01  Joseph Pecoraro  <pecoraro@apple.com>
192
193         Web Inspector: High Level Memory Overview Instrument
194         https://bugs.webkit.org/show_bug.cgi?id=153516
195         <rdar://problem/24356378>
196
197         Reviewed by Brian Burg.
198
199         Add a new agent that gathers data from the ResourceUsageThread
200         and sends to the frontend.
201
202         Test: inspector/memory/tracking.html
203
204         * CMakeLists.txt:
205         * Configurations/FeatureDefines.xcconfig:
206         * WebCore.xcodeproj/project.pbxproj:
207         New files.
208
209         * inspector/InspectorController.cpp:
210         (WebCore::InspectorController::InspectorController):
211         Add the new agent.
212
213         * inspector/InspectorMemoryAgent.h: Added.
214         * inspector/InspectorMemoryAgent.cpp: Added.
215         (WebCore::InspectorMemoryAgent::InspectorMemoryAgent):
216         (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
217         (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
218         (WebCore::InspectorMemoryAgent::startTracking):
219         (WebCore::InspectorMemoryAgent::stopTracking):
220         (WebCore::InspectorMemoryAgent::collectSample):
221         Implement the agent by adding / removing it as a ResourceUsage
222         observer. When receiving the data forward it to the frontend.
223
224 2016-02-01  Alex Christensen  <achristensen@webkit.org>
225
226         Fix CMake build.
227
228         * PlatformMac.cmake:
229
230 2016-02-01  Brady Eidson  <beidson@apple.com>
231
232         Modern IDB: Cursors (still) do not keep their opening request alive.
233         https://bugs.webkit.org/show_bug.cgi?id=153724
234
235         Reviewed by Alex Christensen.
236
237         No new tests (All existing tests pass without flakiness).
238
239         IDBCursors did not properly keep their JS wrappers alive.
240         Making them ActiveDOMObjects that keep track of how many requests might be in flight fixes this.
241         This also makes them actually keep their opening-request live via the opaque-root mechanism.
242         
243         IDBCursorWithValue also needed to opt in to all of these mechanisms.
244
245         * CMakeLists.txt:
246         * WebCore.xcodeproj/project.pbxproj:
247
248         * Modules/indexeddb/IDBCursor.h:
249         (WebCore::IDBCursor::hasPendingActivity): The base IDBCursor always has no pending activity,
250           to maintain current behavior in LegacyIDB. This weirdness will go away when LegacyIDB does.
251         * Modules/indexeddb/IDBCursor.idl:
252         * Modules/indexeddb/IDBCursorWithValue.idl:
253
254         Track a count for all outstanding requests to keep the cursor alive as an ActiveDOMObject.
255         * Modules/indexeddb/client/IDBCursorImpl.cpp:
256         (WebCore::IDBClient::IDBCursor::IDBCursor):
257         (WebCore::IDBClient::IDBCursor::update):
258         (WebCore::IDBClient::IDBCursor::uncheckedIterateCursor):
259         (WebCore::IDBClient::IDBCursor::deleteFunction):
260         (WebCore::IDBClient::IDBCursor::activeDOMObjectName):
261         (WebCore::IDBClient::IDBCursor::canSuspendForDocumentSuspension):
262         (WebCore::IDBClient::IDBCursor::hasPendingActivity):
263         (WebCore::IDBClient::IDBCursor::decrementOutstandingRequestCount):
264         * Modules/indexeddb/client/IDBCursorImpl.h:
265         
266         Rework the "delete" family of functions on the object store to allow for returning a modern IDBRequest.
267         A lot of this can go away when LegacyIDB does.
268         * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
269         (WebCore::IDBClient::IDBObjectStore::deleteFunction):
270         (WebCore::IDBClient::IDBObjectStore::doDelete):
271         (WebCore::IDBClient::IDBObjectStore::modernDelete):
272         * Modules/indexeddb/client/IDBObjectStoreImpl.h:
273         
274         * Modules/indexeddb/client/IDBRequestImpl.cpp:
275         (WebCore::IDBClient::IDBRequest::setSource): Setup a ScopeGuard to decrement the cursor's request
276           count whenever it makes sense to do so.
277         (WebCore::IDBClient::IDBRequest::dispatchEvent): Clear the ScopeGuard (if it exists) to decrement the count.
278         (WebCore::IDBClient::IDBRequest::willIterateCursor): Set the ScopeGuard.
279         (WebCore::IDBClient::IDBRequest::didOpenOrIterateCursor): Clear the ScopeGuard (if it exists) to decrement the count.
280         * Modules/indexeddb/client/IDBRequestImpl.h:
281         
282         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
283         (WebCore::IDBServer::ScopeGuard::ScopeGuard): Deleted.
284         (WebCore::IDBServer::ScopeGuard::~ScopeGuard): Deleted.
285         (WebCore::IDBServer::ScopeGuard::enable): Deleted.
286         (WebCore::IDBServer::ScopeGuard::disable): Deleted.
287         
288         * bindings/js/JSIDBCursorWithValueCustom.cpp: Added.
289         (WebCore::JSIDBCursorWithValue::visitAdditionalChildren):
290         
291         * platform/ScopeGuard.h: Added.
292         (WebCore::ScopeGuard::ScopeGuard):
293         (WebCore::ScopeGuard::~ScopeGuard):
294         (WebCore::ScopeGuard::enable):
295         (WebCore::ScopeGuard::disable):
296
297 2016-02-01  Sun-woo Nam  <sunny.nam@samsung.com>
298
299         Free Colormap when XWindow is destroyed.
300         https://bugs.webkit.org/show_bug.cgi?id=153413
301
302         Reviewed by Žan Doberšek.
303
304         Colormap is needed to create XWindow and it should be freed when XWindow is destroyed.
305         Unless Colormap is freed before destroying XWindow, memory leak is suspected.
306         XFreeColormap therefore is needed on X11Helper.
307
308         * platform/graphics/surfaces/glx/X11Helper.cpp: Added XFreeColormap.
309         (WebCore::X11Helper::destroyWindow):
310
311 2016-02-01  Tim Horton  <timothy_horton@apple.com>
312
313         Move some SPI declarations into the appropriate SPI header
314         https://bugs.webkit.org/show_bug.cgi?id=153755
315
316         Reviewed by Darin Adler.
317
318         * platform/graphics/cocoa/IOSurface.mm:
319         * platform/spi/cg/CoreGraphicsSPI.h:
320
321 2016-02-01  Tim Horton  <timothy_horton@apple.com>
322
323         Snapshot surfaces are forever wired after being compressed
324         https://bugs.webkit.org/show_bug.cgi?id=153751
325         <rdar://problem/24354546>
326
327         Reviewed by Darin Adler.
328
329         * platform/graphics/cocoa/IOSurface.mm:
330         (IOSurface::convertToFormat):
331         Allow IOSurfaceAccelerator to unwire surfaces after they're transformed.
332
333 2016-02-01  Dan Bernstein  <mitz@apple.com>
334
335         <rdar://problem/20150072> [iOS] Remove some file upload code only needed before iOS 9
336         https://bugs.webkit.org/show_bug.cgi?id=153754
337
338         Reviewed by Darin Adler.
339
340         * English.lproj/Localizable.strings: Updated for removal of WebKit2 string.
341
342 2016-02-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
343
344         Cache the Path instead of creating it every time it is required
345         https://bugs.webkit.org/show_bug.cgi?id=152939
346
347         Reviewed by Darin Adler.
348
349         Instead of creating the Path object every time it is required, we should 
350         cache it in an LRU cache. TinyLRUCache returns a reference to the cached
351         entry so we do not have to pay the cost of copying it either.
352
353         * platform/graphics/FloatRoundedRect.h:
354         (WebCore::operator!=):
355         Implement the inequality operator for FloatRoundedRect since it is
356         called by TinyLRUCache.
357         
358         * rendering/ClipPathOperation.h:
359         Return a reference to the path in the cache since instead of creating a
360         new copy.
361         
362         * rendering/style/BasicShapes.cpp:
363         (WebCore::SVGPathTranslatedByteStream::SVGPathTranslatedByteStream):
364         (WebCore::SVGPathTranslatedByteStream::operator==):
365         (WebCore::SVGPathTranslatedByteStream::operator!=):
366         (WebCore::SVGPathTranslatedByteStream::isEmpty):
367         (WebCore::SVGPathTranslatedByteStream::path):
368         This struct holds an offset and an SVGPathByteStream. It is the key of 
369         the LRU cache for the the translated SVGPathByteStream.
370         
371         (WebCore::EllipsePathPolicy::isKeyNull):
372         (WebCore::EllipsePathPolicy::createValueForKey):
373         (WebCore::RoundedRectPathPolicy::isKeyNull):
374         (WebCore::RoundedRectPathPolicy::createValueForKey):
375         (WebCore::PolygonPathPolicy::isKeyNull):
376         (WebCore::PolygonPathPolicy::createValueForKey):
377         (WebCore::TranslatedByteStreamPathPolicy::isKeyNull):
378         (WebCore::TranslatedByteStreamPathPolicy::createValueForKey):
379         Inherit from the LRU cache policy template, so have a specific name for
380         the desired path contents and pass this class explicitly to the LRU cache
381         template.
382         
383         (WebCore::cachedEllipsePath):
384         (WebCore::cachedRoundedRectPath):
385         (WebCore::cachedPolygonPath):
386         (WebCore::cachedTranslatedByteStreamPath):
387         Return a cached path object for specific path contents.
388         
389         (WebCore::BasicShapeCircle::path):
390         (WebCore::BasicShapeEllipse::path):
391         (WebCore::BasicShapePolygon::path):
392         (WebCore::BasicShapePath::path):
393         (WebCore::BasicShapeInset::path):
394         Get the Path object from the cache; create a new one if it does not exist.
395         
396         * rendering/style/BasicShapes.h:
397         Change the prototype of the path() function to return a reference to the
398         path in the cache instead of a having to copying it.
399         
400         * svg/SVGPathByteStream.h:
401         (WebCore::SVGPathByteStream::operator!=):
402         Implement the inequality operator for SVGPathByteStream because it is
403         called by TinyLRUCache.
404
405 2016-02-01  Chris Dumez  <cdumez@apple.com>
406
407         Move properties that use custom bindings to the prototype
408         https://bugs.webkit.org/show_bug.cgi?id=153735
409
410         Reviewed by Darin Adler.
411
412         Move properties that use custom bindings to the prototype. Whether a
413         property's bindings code is generated or custom-written should not
414         impact where the property is located.
415
416         No new tests, already covered by existing tests.
417
418         * bindings/js/JSHTMLDocumentCustom.cpp:
419         (WebCore::JSHTMLDocument::getOwnPropertySlot):
420         Add null-check for staticPropHashTable. HTMLDocument no longer has
421         any property on the instance so staticPropHashTable is now null.
422
423         * bindings/scripts/CodeGeneratorJS.pm:
424
425 2016-02-01  Jer Noble  <jer.noble@apple.com>
426
427         REGRESSION(r195770): Use-after-free in ResourceLoaderOptions::cachingPolicy
428         https://bugs.webkit.org/show_bug.cgi?id=153727
429         <rdar://problem/24429886>
430
431         Reviewed by Chris Dumez.
432
433         The `this` object may be freed after calling deleteIfPossible(). Make the early-return-if-
434         deleted more explicit, and only check allowsCaching() after the deleteIfPossible() return
435         value check.
436
437         * loader/cache/CachedResource.cpp:
438         (WebCore::CachedResource::removeClient):
439
440 2016-02-01  Dan Bernstein  <mitz@apple.com>
441
442         Tried to fix a build after r195899.
443
444         * dom/EventContext.h: Enabled TouchEventContext type trait specialization on iOS.
445
446 2016-02-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
447
448         [Fetch API] Implement Fetch API Request
449         https://bugs.webkit.org/show_bug.cgi?id=153437
450
451         Added support for Fetch Request and Body.
452         Body is sharing functionality between Request and Response.
453         Conversion between various body types are not implemented yet.
454
455         Added a FetchOptions class. Options in this class are partially redundant with ResourceLoaderOptions.
456
457         Fixing bug in Headers constructor.
458         Making error reporting in case of modifying headers compliant with the spec.
459
460         Reviewed by Darin Adler.
461
462         Tests: imported/w3c/web-platform-tests/fetch/api/request/request-clone.sub.html
463                imported/w3c/web-platform-tests/fetch/api/request/request-consume.html
464                imported/w3c/web-platform-tests/fetch/api/request/request-disturbed.html
465                imported/w3c/web-platform-tests/fetch/api/request/request-error.html
466                imported/w3c/web-platform-tests/fetch/api/request/request-headers.html
467                imported/w3c/web-platform-tests/fetch/api/request/request-idl.html
468                imported/w3c/web-platform-tests/fetch/api/request/request-init-001.sub.html
469                imported/w3c/web-platform-tests/fetch/api/request/request-init-002.html
470                imported/w3c/web-platform-tests/fetch/api/request/request-init-003.sub.html
471                imported/w3c/web-platform-tests/fetch/api/request/request-structure.html
472
473         * CMakeLists.txt:
474         * DerivedSources.cpp:
475         * DerivedSources.make:
476         * Modules/fetch/FetchBody.cpp: Added.
477         (WebCore::FetchBody::initBody):
478         (WebCore::FetchBody::clear):
479         (WebCore::FetchBody::processIfEmptyOrDisturbed):
480         (WebCore::FetchBody::arrayBuffer):
481         (WebCore::FetchBody::formData):
482         (WebCore::FetchBody::blob):
483         (WebCore::FetchBody::text):
484         (WebCore::FetchBody::json):
485         * Modules/fetch/FetchBody.h: Added.
486         (WebCore::FetchBody::~FetchBody):
487         (WebCore::FetchBody::isEmpty):
488         (WebCore::FetchBody::isDisturbed):
489         (WebCore::FetchBody::setDisturbed):
490         (WebCore::FetchBody::setMimeType):
491         (WebCore::FetchBody::mimeType):
492         * Modules/fetch/FetchBody.idl: Added.
493         * Modules/fetch/FetchHeaders.cpp:
494         (WebCore::canWriteHeader):
495         (WebCore::FetchHeaders::append):
496         (WebCore::FetchHeaders::remove):
497         (WebCore::FetchHeaders::set):
498         (WebCore::FetchHeaders::fill): Helper routine implementing https://fetch.spec.whatwg.org/#concept-headers-fill
499         * Modules/fetch/FetchHeaders.h: Adding header getter/setter for FetchRequest.
500         (WebCore::FetchHeaders::fastGet):
501         (WebCore::FetchHeaders::fastSet):
502         * Modules/fetch/FetchHeaders.js: Fixing bug in constructor (covered by modified headers-basc.html test).
503         (initializeFetchHeaders):
504         * Modules/fetch/FetchOptions.h: Added.
505         (WebCore::FetchOptions::FetchOptions):
506         (WebCore::FetchOptions::type):
507         (WebCore::FetchOptions::destination):
508         (WebCore::FetchOptions::mode):
509         (WebCore::FetchOptions::credentials):
510         (WebCore::FetchOptions::cache):
511         (WebCore::FetchOptions::redirect):
512         (WebCore::FetchOptions::referrerPolicy):
513         (WebCore::FetchOptions::setType):
514         (WebCore::FetchOptions::setDestination):
515         (WebCore::FetchOptions::setMode):
516         (WebCore::FetchOptions::setCredentials):
517         (WebCore::FetchOptions::setCache):
518         (WebCore::FetchOptions::setRedirect):
519         (WebCore::FetchOptions::setReferrerPolicy):
520         * Modules/fetch/FetchRequest.cpp: Added.
521         (WebCore::FetchRequest::create):
522         (WebCore::FetchRequest::FetchRequest):
523         (WebCore::FetchRequest::init):
524         (WebCore::FetchRequest::setReferrer):
525         (WebCore::FetchRequest::setReferrerPolicy):
526         (WebCore::FetchRequest::setMode):
527         (WebCore::FetchRequest::setCredentials):
528         (WebCore::FetchRequest::setCache):
529         (WebCore::FetchRequest::setRedirect):
530         (WebCore::FetchRequest::type):
531         (WebCore::FetchRequest::destination):
532         (WebCore::FetchRequest::referrerPolicy):
533         (WebCore::FetchRequest::referrer):
534         (WebCore::FetchRequest::mode):
535         (WebCore::FetchRequest::credentials):
536         (WebCore::FetchRequest::cache):
537         (WebCore::FetchRequest::redirect):
538         (WebCore::FetchRequest::setMethod):
539         (WebCore::FetchRequest::clone):
540         * Modules/fetch/FetchRequest.h: Added.
541         (WebCore::FetchRequest::method):
542         (WebCore::FetchRequest::url):
543         (WebCore::FetchRequest::integrity):
544         (WebCore::FetchRequest::headers):
545         * Modules/fetch/FetchRequest.idl: Added.
546         * WebCore.xcodeproj/project.pbxproj:
547         * bindings/js/Dictionary.h:
548         (WebCore::Dictionary::execState):
549         * bindings/js/JSDictionary.cpp:
550         (WebCore::JSDictionary::convertValue):
551         * bindings/js/JSDictionary.h:
552         (WebCore::JSDictionary::get):
553
554 2016-01-31  Jeremy Jones  <jeremyj@apple.com>
555
556         Add resize event for HTMLMediaElement
557         https://bugs.webkit.org/show_bug.cgi?id=125715
558
559         Reviewed by Darin Adler.
560
561         Tests: http/tests/media/hls/hls-video-resize.html
562                media/video-resize.html
563
564         Move resize javascript event from DOMWindow.idl to GlobalEventHandlers.idl
565         per https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
566
567         Post resize event from video element when metadata loads and when content size changes.
568
569         * dom/GlobalEventHandlers.idl: Add onresize.
570         * html/HTMLElement.cpp:
571         (WebCore::HTMLElement::createEventHandlerNameMap): Add onresizeAttr.
572         * html/HTMLMediaElement.cpp:
573         (WebCore::HTMLMediaElement::setReadyState):
574         (WebCore::HTMLMediaElement::mediaPlayerSizeChanged):
575         * html/HTMLMediaElement.h:
576         (WebCore::HTMLMediaElement::scheduleResizeEvent):
577         (WebCore::HTMLMediaElement::scheduleResizeEventIfSizeChanged):
578         * html/HTMLVideoElement.cpp:
579         (WebCore::HTMLVideoElement::scheduleResizeEvent): Sechedule event.
580         (WebCore::HTMLVideoElement::scheduleResizeEventIfSizeChanged): Schedule event if size has changed.
581         * html/HTMLVideoElement.h: Add declarations.
582         * page/DOMWindow.idl: Remove onresize.
583
584 2016-01-31  Darin Adler  <darin@apple.com>
585
586         Revert accidental behavior change from previous patch.
587
588         * platform/URL.cpp:
589         (WebCore::mimeTypeFromDataURL): Restore behavior where an empty MIME type would
590         be turned into "text/plain".
591
592 2016-01-31  Darin Adler  <darin@apple.com>
593
594         Cut down on calls to String::lower; mostly replace with convertToASCIILowercase
595         https://bugs.webkit.org/show_bug.cgi?id=153732
596
597         Reviewed by Dean Jackson.
598
599         * Modules/mediasource/MediaSource.cpp:
600         (WebCore::MediaSource::isTypeSupported): Added comment about mysterious call
601         to lower(); should probably return here and remove it.
602
603         * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
604         (WebCore::initProtocolHandlerWhitelist): Deleted. Moved into isProtocolWhitelisted.
605         (WebCore::isProtocolWhitelisted): Changed set to be ASCIICaseInsensitiveHash and
606         initialized it using a lambda instead of a separate function.
607         (WebCore::verifyProtocolHandlerScheme): Added a FIXME about some case sensitive
608         checking of the protocol prefix here.
609
610         * Modules/plugins/QuickTimePluginReplacement.mm:
611         (WebCore::QuickTimePluginReplacement::supportsMimeType): Changed set to be
612         ASCIICaseInsensitiveHash and initialized it using a lambda instead of using
613         an explict check for empty.
614         (WebCore::QuickTimePluginReplacement::supportsFileExtension): Ditto.
615
616         * Modules/plugins/YouTubePluginReplacement.cpp:
617         (WebCore::queryKeysAndValues): Use convertToASCIILowercase. The keys here are
618         going to be all ASCII.
619         (WebCore::isYouTubeURL): Use equalLettersIgnoringASCIICase instead of lowercasing
620         the string.
621         (WebCore::processAndCreateYouTubeURL): Use url.protocolIsInHTTPFamily instead of
622         listing "http" and then "https" explicitly. Use equalLettersIgnoringASCIICase
623         instead of lowercasing a string.
624         (WebCore::YouTubePluginReplacement::youTubeURL): Ditto.
625
626         * Modules/websockets/WebSocketHandshake.cpp:
627         (WebCore::hostName): Use convertToASCIILowercase on host name.
628         (WebCore::WebSocketHandshake::host): Ditto.
629
630         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
631         (webkitAccessibleGetAttributes): Call convertToASCIILowercase instead of lower
632         to lowercase an element's tag name. This is a strange way to do things; typically
633         would be better to use some other function on Element, since tagName goes out of
634         its way to be capitalized, but some ATK expert can improve this later.
635
636         * css/CSSGrammar.y.in: Use the new convertToASCIILowercaseInPlace function rather
637         than the old lower function. We only need to lowercase the ASCII letters, and it's
638         also better to have the function have a clearer name.
639
640         * css/CSSParser.cpp:
641         (WebCore::convertToASCIILowercaseInPlace): Renamed from makeLower and made it deal
642         with only ASCII lowercasing.
643         (WebCore::CSSParserString::convertToASCIILowercaseInPlace): Renamed from lower.
644         (WebCore::isUniversalKeyword): Added. Helper for the function below that uses
645         equalLettersIgnoringASCIICase rather than lowercasing the string.
646         (WebCore::parseKeywordValue): Use isUniversalKeyword. Also clarified a comment.
647         (WebCore::CSSParser::parseAttr): Use convertToASCIILowercaseInPlace and delay
648         String creation until later in the function, using CSSParserString operations more.
649
650         * css/CSSParserValues.cpp:
651         (WebCore::CSSParserSelector::parsePseudoElementSelector): Use
652         convertToASCIILowercaseInPlace by its new name, with its new behavior.
653
654         * css/CSSParserValues.h: Tweaked comment and formatting a bit. Replaced the lower
655         function with the convertToASCIILowercaseInPlace function.
656
657         * css/CSSSelector.cpp:
658         (WebCore::CSSSelector::RareData::parseNth): Rewrote this to avoid the need to
659         make a lowercased copy of m_argument. Use equalLettersIgnoringASCIICase, and two
660         calls to find. Also use String::toIntStrict so we don't have to create String
661         objects for substrings.
662
663         * css/MediaQuery.cpp:
664         (WebCore::MediaQuery::MediaQuery): Use convertToASCIILowercase for media type name.
665         * css/MediaQueryExp.cpp:
666         (WebCore::MediaQueryExp::serialize): Use convertToASCIILowercase for media feature name.
667
668         * dom/Document.cpp:
669         (WebCore::isSeparator): Tweaked formatting and removed non-helpful comment.
670         (WebCore::processArguments): Changed this from a static member function to a non-member
671         file internal function. Use a std::function instead of a function pointer with a void*
672         pointer. Rewrote algorithm to simplify it and use StringView instead of String for the
673         keys and values.
674         (WebCore::Document::processViewport): Use a lambda instead of a function pointer to
675         call setViewportFeature, so that function's interface is no longer dictated by
676         the exact type of the function pointer argument to processArguments.
677         (WebCore::Document::processFormatDetection): Use a lambda instead of the
678         setParserFeature function above; use equalLettersIgnoringASCIICase for both the
679         key and the value, since processArguments no longer lowercases the string.
680         (WebCore::Document::processArguments): Deleted.
681
682         * dom/Document.h: Removed unnecessary declaration of processArguments and
683         ArgumentsCallback. Both are now private to the cpp file.
684
685         * dom/Element.cpp:
686         (WebCore::makeIdForStyleResolution): Use convertToASCIILowercase. When in quirks mode,
687         we want to match IDs in an ASCII case-insensitive way not match compatibility caseless.
688
689         * dom/ScriptElement.cpp:
690         (WebCore::ScriptElement::isScriptTypeSupported): Remove the use of lower here since
691         the MIME type registry is now itself ASCII case-insensitive.
692
693         * dom/ViewportArguments.cpp:
694         (WebCore::numericPrefix): Changed to use StringView and take a Document&, rearranged
695         argument order so Document& comes first.
696         (WebCore::findSizeValue): Ditto.
697         (WebCore::findScaleValue): Ditto.
698         (WebCore::findBooleanValue): Ditto. Also use std::abs instead of fabs, possibly
699         avoiding a conversion from float to double (not sure it was happening before but it's
700         definitely not happening now).
701         (WebCore::setViewportFeature): Changed to put arguments in a more logical order, to take
702         the ViewportArguments as a reference, not a void*, and to use StringView to avoid forcing
703         the caller to allocate strings. Also changed to use equalLettersIgnoringASCIICase so we
704         don't rely on the caller to make the key lowercase for us.
705         (WebCore::reportViewportWarning): Changed argument types. Added a couple comments about
706         mistakes in the function.
707
708         * dom/ViewportArguments.h: Removed unnecessary declaration of reportViewportWarning,
709         which is now private to the cpp file. Updated for new arguments to setViewportFeature.
710
711         * editing/EditorCommand.cpp:
712         (WebCore::executeFormatBlock): Use convertToASCIILowercase on the argument, which is
713         specifying a tag name.
714
715         * fileapi/Blob.cpp:
716         (WebCore::Blob::isValidContentType): Removed unnecessary separate loops for
717         8-bit and 16-bit strings. Content types are short strings and this small optimization is
718         not worth the additional code complexity.
719         (WebCore::Blob::normalizedContentType): Use convertToASCIILowercase since valid
720         content types are guaranteed to be all ASCII.
721         (WebCore::Blob::isNormalizedContentType): Removed unnecessary separate loops for
722         8-bit and 16-bit strings. Content types are short strings and this small optimization is
723         not worth the additional code complexity.
724
725         * html/parser/HTMLParserIdioms.cpp: Added now-needed include of QualifiedName.h.
726
727         * html/parser/HTMLParserIdioms.h: Removed unneeded include of QualifiedName.h and
728         WTFString.h. Made sure every function is declared first, even if it's also defined
729         later in the header in the section for functions templates and inline functions.
730
731         * loader/archive/ArchiveFactory.cpp:
732         (WebCore::ArchiveFactory::registerKnownArchiveMIMETypes): Use auto& for the type of
733         the set of MIME types here, since it's now using ASCIICaseInsensitiveHash.
734
735         * platform/MIMETypeRegistry.cpp: Changed the MIME type sets to use
736         ASCIICaseInsensitiveHash since MIME type are not case sensitive.
737         (WebCore::initializeSupportedImageMIMETypes): Use a modern for loop.
738         (WebCore::initializeSupportedImageMIMETypesForEncoding): Updated for HashSet type change.
739         (WebCore::initializePDFMIMETypes): Use a modern for loop.
740         (WebCore::initializeSupportedNonImageMimeTypes): Use a modern for loop.
741         (WebCore::initializeSupportedMediaMIMETypes): Updated for HashSet type change.
742         (WebCore::initializeUnsupportedTextMIMETypes): Use a modern for loop.
743         (WebCore::initializeMIMETypeRegistry): Updated for HashSet type change.
744         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes): Ditto.
745         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes): Ditto.
746         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypesForEncoding): Ditto.
747         (WebCore::MIMETypeRegistry::getSupportedNonImageMIMETypes): Ditto.
748         (WebCore::MIMETypeRegistry::getSupportedMediaMIMETypes): Ditto.
749         (WebCore::MIMETypeRegistry::getPDFMIMETypes): Ditto.
750         (WebCore::MIMETypeRegistry::getPDFAndPostScriptMIMETypes): Ditto.
751         (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes): Ditto.
752         (WebCore::mimeTypeAssociationMap): Use ASCIICaseInsensitiveHash.
753         (WebCore::MIMETypeRegistry::getNormalizedMIMEType): Use auto to make code tighter.
754
755         * platform/MIMETypeRegistry.h: Changed return types of the getMIMETypes functions
756         to use ASCIICaseInsensitiveHash.
757
758         * platform/SchemeRegistry.cpp:
759         (WebCore::schemesForbiddenFromDomainRelaxation): Changed type to
760         use ASCIICaseInsensitiveHash.
761
762         * platform/URL.cpp:
763         (WebCore::mimeTypeFromDataURL): Use convertToASCIILowercase instead of lower.
764         Also removed some dead code that tried to handle the case where the data URL
765         has a comma as one of the first 5 characters: That can't happen since it's a
766         precondition of this function that the first five characters are "data:".
767
768         * platform/graphics/MediaPlayer.cpp:
769         (WebCore::MediaPlayer::getSupportedTypes): Change type of argument to
770         a HashSet with ASCIICaseInsensitiveHash.
771         * platform/graphics/MediaPlayer.h: Ditto.
772
773         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
774         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList):
775         Changed type of HashSet to use ASCIICaseInsensitiveHash.
776         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: Ditto.
777
778         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
779         (WebCore::avfMIMETypes):
780         Changed type of HashSet to use ASCIICaseInsensitiveHash.
781         (WebCore::MediaPlayerPrivateAVFoundationCF::getSupportedTypes): Ditto.
782         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h: Ditto.
783
784         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
785         Changed type of HashSet to use ASCIICaseInsensitiveHash.
786         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
787         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator): Removed
788         an unnecessary line of code to set a local variable to 0 just before it falls
789         out of scope.
790         (WebCore::avfMIMETypes): Ditto. Also tightened up the code a bit.
791         (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes): Ditto.
792
793         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
794         Changed type of HashSet to use ASCIICaseInsensitiveHash.
795         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
796         (WebCore::mimeTypeCache): Ditto.
797         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes): Ditto.
798
799         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: Ditto.
800         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
801         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::getSupportedTypes): Ditto.
802
803         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
804         (WebCore::mimeTypeCache): Ditto.
805         (WebCore::MediaPlayerPrivateGStreamer::getSupportedTypes): Ditto.
806         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Ditto.
807
808         * platform/graphics/mac/MediaPlayerPrivateQTKit.h: Ditto.
809         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
810         (WebCore::shouldRejectMIMEType): Made this non-case-sensitive by using startsWith
811         and the "false" argument. Later change this to startsWithIgnoringASCIICase or
812         startsWithLettersIgnoringASCIICase.
813         (WebCore::addFileTypesToCache): Use ASCIICaseInsensitiveHash. ALso rewrote to
814         tighten up the code a bit and use modern Objective-C for loops.
815         (WebCore::mimeCommonTypesCache): Use ASCIICaseInsensitiveHash.
816         (WebCore::mimeModernTypesCache): Ditto.
817         (WebCore::concatenateHashSets): Ditto.
818         (WebCore::MediaPlayerPrivateQTKit::getSupportedTypes): Ditto.
819         (WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Initialied
820         track type set using lambda, but left it case sensitive.
821
822         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
823         (WebCore::mimeTypeCache): Changed type of HashSet to use ASCIICaseInsensitiveHash.
824         (WebCore::MediaPlayerPrivateMediaFoundation::getSupportedTypes): Ditto.
825         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
826
827         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
828         (WebCore::mimeTypeCache): Ditto.
829         (WebCore::MockMediaPlayerMediaSource::getSupportedTypes): Ditto.
830         * platform/mock/mediasource/MockMediaPlayerMediaSource.h: Ditto.
831
832 2016-01-31  Brent Fulgham  <bfulgham@apple.com>
833
834         Add "WebKit built-in PDF" Plugin to set of publicly visible plugins
835         https://bugs.webkit.org/show_bug.cgi?id=153657
836         <rdar://problem/24413107>
837
838         Reviewed by Darin Adler.
839
840         Tested by http/tests/plugins/visible_plugins.html.
841
842         A number of poorly-coded sites break when WebKit reports that it understands PDF mime types,
843         but does not have a list of plugins that the site can iterate through.
844
845         To avoid this compatibility problem, we should also expose the "WebKit built-in PDF" plugin
846         to avoid this edge case.
847
848         * plugins/PluginData.cpp:
849         (WebCore::shouldBePubliclyVisible): Add "WebKit built-in PDF" plugin.
850
851 2016-01-31  Doug Russell  <d_russell@apple.com>
852
853         AX: Add a boundary value to AXTextStateChangeType
854         https://bugs.webkit.org/show_bug.cgi?id=153085
855
856         Reviewed by Darin Adler.
857
858         Post an AT notification when navigation is attempted past
859         an editable element's boundaries.
860
861         Test: accessibility/mac/selection-boundary-userinfo.html
862
863         * accessibility/AXObjectCache.cpp:
864         (WebCore::AXObjectCache::showIntent):
865         * accessibility/AXTextStateChangeIntent.h:
866         * accessibility/mac/AXObjectCacheMac.mm:
867         (platformChangeTypeForWebCoreChangeType):
868         (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
869         * editing/FrameSelection.cpp:
870         (WebCore::FrameSelection::modifyMovingRight):
871         (WebCore::FrameSelection::modifyMovingForward):
872         (WebCore::FrameSelection::modifyMovingLeft):
873         (WebCore::FrameSelection::modifyMovingBackward):
874         (WebCore::textSelectionWithDirectionAndGranularity):
875         (WebCore::FrameSelection::modify):
876         (WebCore::FrameSelection::modifyExtendingBackward): Deleted.
877         (WebCore::FrameSelection::textSelectionIntent): Deleted.
878         * editing/FrameSelection.h:
879         * editing/VisiblePosition.cpp:
880         (WebCore::VisiblePosition::next):
881         (WebCore::VisiblePosition::previous):
882         (WebCore::VisiblePosition::left):
883         (WebCore::VisiblePosition::right):
884         (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore):
885         (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter):
886         (WebCore::VisiblePosition::leftVisuallyDistinctCandidate): Deleted.
887         (WebCore::VisiblePosition::rightVisuallyDistinctCandidate): Deleted.
888         * editing/VisiblePosition.h:
889         * editing/VisibleUnits.cpp:
890         (WebCore::startOfLine):
891         (WebCore::logicalStartOfLine):
892         (WebCore::endOfLine):
893         (WebCore::logicalEndOfLine):
894         (WebCore::leftBoundaryOfLine):
895         (WebCore::rightBoundaryOfLine):
896         (WebCore::inSameLogicalLine): Deleted.
897         (WebCore::endOfEditableContent): Deleted.
898         (WebCore::isEndOfEditableOrNonEditableContent): Deleted.
899         * editing/VisibleUnits.h:
900
901 2016-01-31  Daniel Bates  <dabates@apple.com>
902
903         CSP: Use the served CSP header for dedicated workers
904         https://bugs.webkit.org/show_bug.cgi?id=153157
905         <rdar://problem/24383254>
906         And
907         https://bugs.webkit.org/show_bug.cgi?id=153156
908         <rdar://problem/24383246>
909
910         Reviewed by Brent Fulgham.
911
912         Inspired by Blink commit:
913         <https://src.chromium.org/viewvc/blink?revision=194143&view=revision>
914
915         Implement support for respecting Content Security Policy (CSP) HTTP headers included in the
916         HTTP response for a Web Worker's script as per section Workers of the CSP 2.0 spec,
917         <https://w3c.github.io/webappsec-csp/2/#processing-model-workers> (29 August 2015).
918
919         Currently a Web Worker always inherits the CSP of its owner document. Instead a web worker
920         will inherit the CSP of its owner document only if its script is incapable of defining a
921         content security policy (i.e. its origin is a globally unique identifier). Otherwise, the
922         CSP HTTP headers delivered with the script will be used to define the CSP for the worker.
923
924         Tests: fast/workers/worker-inherits-csp-blocks-eval.html
925                fast/workers/worker-inherits-csp-blocks-xhr.html
926                http/tests/security/contentSecurityPolicy/worker-blob-inherits-csp-blocks-eval.html
927
928         * CMakeLists.txt: Add file ContentSecurityPolicyResponseHeaders.cpp.
929         * WebCore.vcxproj/WebCore.vcxproj: Add files ContentSecurityPolicyResponseHeaders.{cpp, h}.
930         * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
931         * WebCore.xcodeproj/project.pbxproj: Ditto.
932         * dom/Document.cpp:
933         (WebCore::Document::processHttpEquiv): Update code to use enum class ContentSecurityPolicyHeaderType.
934         * loader/FrameLoader.cpp:
935         (WebCore::FrameLoader::didBeginDocument): Extract logic to collect Content Security Policy HTTP headers
936         into class ContentSecurityPolicyResponseHeaders and make use of it here.
937         * page/csp/ContentSecurityPolicy.cpp:
938         (WebCore::CSPDirectiveList::headerType): Modified to use enum class ContentSecurityPolicyHeaderType.
939         (WebCore::CSPDirectiveList::CSPDirectiveList): Ditto.
940         (WebCore::CSPDirectiveList::create): Ditto.
941         (WebCore::ContentSecurityPolicy::responseHeaders): Creates and returns a ContentSecurityPolicyResponseHeaders
942         object with the parsed CSP policy headers.
943         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Processed the CSP policy headers represented by the
944         specified ContentSecurityPolicyResponseHeaders object.
945         (WebCore::ContentSecurityPolicy::deprecatedHeader): Deleted.
946         (WebCore::ContentSecurityPolicy::deprecatedHeaderType): Deleted.
947         * page/csp/ContentSecurityPolicy.h: Defines a class that represents a collection of CSP policy headers.
948         This class has two purposes:
949             - It extracts the CSP policy headers from a HTTP response (ResourceResponse object). We make use of
950             this functionality in both FrameLoader::didBeginDocument() and Worker::didReceiveResponse().
951             - It serves as a memento that externalizes the internal CSP policy details of an instance of
952             ContentSecurityPolicy. We make use of this memento functionality to support inheriting the
953             CSP policy of the worker's owner document in a thread-safe manner. You can create and restore
954             a memento using ContentSecurityPolicy::responseHeaders() and ContentSecurityPolicy::didReceiveHeaders(), respectively.
955         * page/csp/ContentSecurityPolicyResponseHeaders.cpp: Added.
956         (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders): Extracts the
957         CSP HTTP headers from a ResourceResponse object.
958         (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy): Make a copy of this object that is
959         safe to pass to another thread.
960         * page/csp/ContentSecurityPolicyResponseHeaders.h: Added.
961         * workers/DedicatedWorkerGlobalScope.cpp:
962         (WebCore::DedicatedWorkerGlobalScope::create): Modified to use class ContentSecurityPolicyResponseHeaders.
963         * workers/DedicatedWorkerGlobalScope.h:
964         * workers/DedicatedWorkerThread.cpp:
965         (WebCore::DedicatedWorkerThread::create): Ditto.
966         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): Ditto.
967         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Ditto.
968         * workers/DedicatedWorkerThread.h:
969         * workers/Worker.cpp:
970         (WebCore::Worker::didReceiveResponse): Create a ContentSecurityPolicyResponseHeaders if the origin of
971         the worker's script is capable of providing a CSP. Otherwise, we will inherit the CSP of the worker's owner
972         document in Worker::notifyFinished().
973         (WebCore::Worker::notifyFinished): Pass the appropriate CSP response headers to WorkerMessagingProxy::startWorkerGlobalScope().
974         * workers/Worker.h:
975         * workers/WorkerGlobalScope.cpp:
976         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Renamed; formerly named applyContentSecurityPolicyFromString().
977         Modified to take a ContentSecurityPolicyResponseHeaders and apply it to the ContentSecurityPolicy object associated with the worker.
978         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyFromString): Deleted.
979         * workers/WorkerGlobalScope.h:
980         * workers/WorkerMessagingProxy.cpp:
981         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Pass the worker's ContentSecurityPolicyResponseHeaders object.
982         * workers/WorkerThread.cpp:
983         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): Added field m_contentSecurityPolicyResponseHeaders to store
984         the CSP response headers to be applied to the worker's ContentSecurityPolicy object.
985         (WebCore::WorkerThread::WorkerThread): Modified to use ContentSecurityPolicyResponseHeaders.
986         (WebCore::WorkerThread::workerThread): Pass the ContentSecurityPolicyResponseHeaders object from the start up data struct
987         to DedicatedWorkerThread::createWorkerGlobalScope().
988         * workers/WorkerThread.h:
989
990 2016-01-31  Darin Adler  <darin@apple.com>
991
992         Get rid of most calls to String::upper; mostly replace them with convertToASCIIUppercase
993         https://bugs.webkit.org/show_bug.cgi?id=153715
994
995         Reviewed by Gyuyoung Kim.
996
997         * editing/cocoa/HTMLConverter.mm:
998         (HTMLConverter::computedAttributesForElement): Use convertToASCIILowercase to fold
999         ASCII case when searching for fonts by name.
1000
1001         * platform/network/cf/ResourceResponseCFNet.cpp:
1002         (WebCore::ResourceResponse::platformLazyInit): Use convertToASCIIUppercase to make
1003         the HTTP version string canonical. Not sure why it's needed at all, but the letters
1004         we might be uppercasing are "HTTP", so no need to handle non-ASCII.
1005         * platform/network/cocoa/ResourceResponseCocoa.mm:
1006         (WebCore::ResourceResponse::platformLazyInit): Ditto.
1007
1008         * rendering/svg/SVGRenderTreeAsText.cpp:
1009         (WebCore::operator<<): Use convertToASCIIUppercase when writing the spread
1010         method type into a text stream. The method types are all ASCII.
1011
1012 2016-01-31  Dan Bernstein  <mitz@apple.com>
1013
1014         [Cocoa] Remove __has_include guards around use of WebKitAdditions
1015         https://bugs.webkit.org/show_bug.cgi?id=153728
1016
1017         Reviewed by Andy Estes.
1018
1019         Guard WebKitAdditions includes with #if USE(APPLE_INTERNAL_SDK) rather than with __has_include.
1020
1021         * dom/EventNames.h:
1022         * loader/EmptyClients.cpp:
1023         (WebCore::fillWithEmptyClients):
1024         * page/MainFrame.cpp:
1025         (WebCore::MainFrame::MainFrame):
1026         * page/MainFrame.h:
1027         * page/PageConfiguration.h:
1028         * platform/cocoa/WebKitAdditions.mm:
1029         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1030         * platform/ios/LegacyTileGridTile.mm:
1031
1032 2016-01-31  Darin Adler  <darin@apple.com>
1033
1034         Replace CaseFoldingHash with ASCIICaseInsensitiveHash
1035         https://bugs.webkit.org/show_bug.cgi?id=153639
1036
1037         Reviewed by Filip Pizlo.
1038
1039         * Modules/webdatabase/DatabaseAuthorizer.h: Use ASCIICaseInsensitiveHash
1040         for whitelisted functions. Function names are all ASCII.
1041
1042         * accessibility/AccessibilityObject.cpp: Use ASCIICaseInsensitiveHash
1043         for ARIA roles. ARIA roles are all ASCII.
1044
1045         * crypto/CryptoAlgorithmRegistry.h: Use ASCIICaseInsensitiveHash for
1046         crypto algorithm names. Algorithm names are all ASCII.
1047
1048         * css/CSSFontSelector.cpp:
1049         (WebCore::registerLocalFontFacesForFamily): Use ASCIICaseInsensitiveHash
1050         for font faces. Face names should use ASCII case insensitive matching;
1051         there is no need for non-ASCII case folding.
1052         * css/CSSFontSelector.h: Ditto.
1053
1054         * dom/DOMImplementation.cpp: Use ASCIICaseInsensitiveHash for the
1055         FeatureSet. The features are all ASCII.
1056
1057         * dom/Document.h: Use ASCIICaseInsensitiveHash for the access key
1058         map. Access keys are all ASCII.
1059
1060         * dom/ScriptElement.cpp:
1061         (WebCore::isLegacySupportedJavaScriptLanguage): Use ASCIICaseInsensitiveHash
1062         for the language set. These strings are all ASCII.
1063
1064         * editing/EditorCommand.cpp: Use ASCIICaseInsensitiveHash for editor
1065         command names. These names are all ASCII.
1066
1067         * html/HTMLObjectElement.cpp:
1068         (WebCore::HTMLObjectElement::parametersForPlugin): Use ASCIICaseInsensitiveHash
1069         for parameter names. These names are all ASCII.
1070
1071         * html/InputType.cpp: Use ASCIICaseInsensitiveHash for the input types.
1072         The input types are all ASCII.
1073
1074         * loader/CrossOriginAccessControl.h: Use ASCIICaseInsensitiveHash for
1075         HTTP header field names. These names are all ASCII.
1076         * loader/CrossOriginPreflightResultCache.h: Ditto.
1077
1078         * loader/archive/ArchiveFactory.cpp: Use ASCIICaseInsensitiveHash for
1079         MIME types. MIME types are all ASCII.
1080         * platform/MIMETypeRegistry.cpp:
1081         (WebCore::initializeSupportedImageMIMETypes): Ditto.
1082
1083         * platform/SchemeRegistry.h: Use ASCIICaseInsensitiveHas for URL schemes.
1084         URL schemes are all ASCII.
1085         * platform/URL.cpp: Ditto.
1086
1087         * platform/graphics/FontCache.cpp:
1088         (WebCore::FontPlatformDataCacheKey::operator==): Use ASCIICaseInsensitiveHash.
1089         (WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.
1090
1091         * platform/graphics/FontCascade.cpp:
1092         (WebCore::keysMatch): Rename from operator== since this operation is not
1093         equality. Changed to equalIgnoringASCIICase and did a little streamlining.
1094         (WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
1095         better memory use.
1096         (WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
1097         a hash more efficient by eliminating the overhead of building a vector and
1098         even possible heap allocation and deallocation.
1099         (WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.
1100
1101         * platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
1102         for font family names. These names should use ASCII case insensitive matching;
1103         there is no need for non-ASCII case folding.
1104
1105         * platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
1106         HTTP header field names. These names are all ASCII.
1107
1108         * rendering/style/RenderStyle.cpp:
1109         (WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
1110         to compute a hash. Use ASCIICaseInsensitiveHash.
1111
1112 2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1113
1114         Reduce PassRefPtr uses in dom - 5
1115         https://bugs.webkit.org/show_bug.cgi?id=153470
1116
1117         Reviewed by Darin Adler.
1118
1119         As a step to remove PassRefPtr, this patch reduces uses of PassRefPtr in WebCore/dom. 
1120
1121         * dom/Document.cpp:
1122         (WebCore::Document::adoptNode):
1123         (WebCore::Document::implicitClose):
1124         (WebCore::Document::enqueuePopstateEvent):
1125         (WebCore::Document::setInputCursor):
1126         * dom/Document.h:
1127         * dom/DocumentMarker.cpp:
1128         (WebCore::DocumentMarkerTextMatch::instanceFor):
1129         * dom/Event.cpp:
1130         (WebCore::Event::setUnderlyingEvent):
1131         * dom/Event.h:
1132         * dom/EventDispatcher.h:
1133         * dom/GenericEventQueue.cpp:
1134         (WebCore::GenericEventQueue::enqueueEvent):
1135         * dom/GenericEventQueue.h:
1136         * dom/MouseEvent.cpp:
1137         (WebCore::SimulatedMouseEvent::SimulatedMouseEvent):
1138         * dom/Node.cpp:
1139         (WebCore::Node::dispatchDOMActivateEvent):
1140         * dom/NodeIterator.h:
1141         * dom/PendingScript.h:
1142         * dom/PopStateEvent.cpp:
1143         (WebCore::PopStateEvent::create):
1144         * dom/PopStateEvent.h:
1145         * dom/ProcessingInstruction.cpp:
1146         (WebCore::ProcessingInstruction::setCSSStyleSheet): Deleted. Nobody calls this function.
1147         * dom/ProcessingInstruction.h:
1148         * dom/RangeBoundaryPoint.h:
1149         (WebCore::RangeBoundaryPoint::RangeBoundaryPoint):
1150         * dom/TextEvent.cpp:
1151         (WebCore::TextEvent::createForFragmentPaste):
1152         (WebCore::TextEvent::TextEvent):
1153         * dom/TextEvent.h:
1154         * editing/Editor.cpp:
1155         (WebCore::Editor::pasteAsFragment):
1156         * editing/Editor.h:
1157         * editing/mac/EditorMac.mm:
1158         (WebCore::Editor::replaceNodeFromPasteboard):
1159
1160 2016-01-31  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1161
1162         Use std::make_unique<> when creating an unique_ptr object.
1163         https://bugs.webkit.org/show_bug.cgi?id=153705
1164
1165         Reviewed by Darin Adler.
1166
1167         Some factory functions have used std::unique_ptr<> for creating an unique_ptr object.
1168         It is wrong. We have to use std::make_unique<>.
1169
1170         * Modules/mediasession/WebMediaSessionManager.cpp:
1171         (WebCore::WebMediaSessionManager::mockPicker):
1172         * inspector/InspectorTimelineAgent.cpp:
1173         (WebCore::InspectorTimelineAgent::internalStart):
1174         * platform/cf/RunLoopObserver.cpp:
1175         (WebCore::RunLoopObserver::create): Deleted.
1176         * platform/cf/RunLoopObserver.h:
1177         (WebCore::RunLoopObserver::RunLoopObserver):
1178         * platform/graphics/avfoundation/WebMediaSessionManagerMac.cpp:
1179         (WebCore::WebMediaSessionManagerMac::platformPicker):
1180         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1181         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1182         (WebCore::MediaPlaybackTargetPickerMac::create): Deleted.
1183         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
1184         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
1185         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
1186         (WebCore::MediaPlaybackTargetPickerMock::create): Deleted.
1187         * platform/mock/MediaPlaybackTargetPickerMock.h:
1188         * rendering/FloatingObjects.cpp:
1189         (WebCore::FloatingObject::copyToNewContainer):
1190
1191 2016-01-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1192
1193         Unreviewed, fix GTK debug build after r195899
1194
1195         * dom/EventContext.h:
1196         (isType):
1197
1198 2016-01-30  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1199
1200         Add missing include to fix building debug configuration
1201         https://bugs.webkit.org/show_bug.cgi?id=153719
1202
1203         Reviewed by Darin Adler.
1204
1205         No new tests.
1206
1207         * rendering/RenderObject.cpp:
1208
1209 2016-01-30  Commit Queue  <commit-queue@webkit.org>
1210
1211         Unreviewed, rolling out r195911.
1212         https://bugs.webkit.org/show_bug.cgi?id=153723
1213
1214         Caused frequent assertion failures on bots (Requested by ap on
1215         #webkit).
1216
1217         Reverted changeset:
1218
1219         "Replace CaseFoldingHash with ASCIICaseInsensitiveHash"
1220         https://bugs.webkit.org/show_bug.cgi?id=153639
1221         http://trac.webkit.org/changeset/195911
1222
1223 2016-01-30  Commit Queue  <commit-queue@webkit.org>
1224
1225         Unreviewed, rolling out r195799 and r195828.
1226         https://bugs.webkit.org/show_bug.cgi?id=153722
1227
1228         Caused assertion failures, severely affecting EWS (Requested
1229         by ap on #webkit).
1230
1231         Reverted changesets:
1232
1233         "Web Inspector: InspectorTimelineAgent doesn't need to
1234         recompile functions because it now uses the sampling profiler"
1235         https://bugs.webkit.org/show_bug.cgi?id=153500
1236         http://trac.webkit.org/changeset/195799
1237
1238         "Attempt to fix the Windows build after r195799"
1239         http://trac.webkit.org/changeset/195828
1240
1241 2016-01-30  Brady Eidson  <beidson@apple.com>
1242
1243         Modern IDB: Some tests crash with specific odd database names.
1244         https://bugs.webkit.org/show_bug.cgi?id=153688
1245
1246         Reviewed by Darin Adler.
1247
1248         No new tests (2 existing tests now pass).
1249
1250         * platform/FileSystem.cpp:
1251         (WebCore::shouldEscapeUChar): Return true for some surrogate-pair situations.
1252         (WebCore::encodeForFileName): Pass along the previous and next characters, as well,
1253           and do a two byte escaping for some characters.
1254
1255 2016-01-30  Eric Carlson  <eric.carlson@apple.com>
1256
1257         More than one audio and/or text track sometimes selected in media controls menu
1258         https://bugs.webkit.org/show_bug.cgi?id=153664
1259
1260         Use an <img> element for the track menu item checkmark instead of a background image and
1261         the ::before selector.
1262
1263         Reviewed by Jer Noble.
1264
1265         Test: media/controls/track-menu.html
1266
1267         * Modules/mediacontrols/mediaControlsApple.css:
1268         (audio::-webkit-media-controls-closed-captions-container li:hover):
1269         (audio::-webkit-media-controls-closed-captions-container li .checkmark-container):
1270         (audio::-webkit-media-controls-closed-captions-container li.selected .checkmark-container):
1271         (audio::-webkit-media-controls-closed-captions-container li.selected:hover .checkmark-container):
1272         (audio::-webkit-media-controls-closed-captions-container li.selected::before): Deleted.
1273         (audio::-webkit-media-controls-closed-captions-container li.selected:hover::before): Deleted.
1274         * Modules/mediacontrols/mediaControlsApple.js:
1275         (Controller.prototype.buildCaptionMenu):
1276         (Controller.prototype.):
1277         (Controller.prototype.getCurrentControlsStatus):
1278
1279 2016-01-30  Darin Adler  <darin@apple.com>
1280
1281         Replace CaseFoldingHash with ASCIICaseInsensitiveHash
1282         https://bugs.webkit.org/show_bug.cgi?id=153639
1283
1284         Reviewed by Filip Pizlo.
1285
1286         * Modules/webdatabase/DatabaseAuthorizer.h: Use ASCIICaseInsensitiveHash
1287         for whitelisted functions. Function names are all ASCII.
1288
1289         * accessibility/AccessibilityObject.cpp: Use ASCIICaseInsensitiveHash
1290         for ARIA roles. ARIA roles are all ASCII.
1291
1292         * crypto/CryptoAlgorithmRegistry.h: Use ASCIICaseInsensitiveHash for
1293         crypto algorithm names. Algorithm names are all ASCII.
1294
1295         * css/CSSFontSelector.cpp:
1296         (WebCore::registerLocalFontFacesForFamily): Use ASCIICaseInsensitiveHash
1297         for font faces. Face names should use ASCII case insensitive matching;
1298         there is no need for non-ASCII case folding.
1299         * css/CSSFontSelector.h: Ditto.
1300
1301         * dom/DOMImplementation.cpp: Use ASCIICaseInsensitiveHash for the
1302         FeatureSet. The features are all ASCII.
1303
1304         * dom/Document.h: Use ASCIICaseInsensitiveHash for the access key
1305         map. Access keys are all ASCII.
1306
1307         * dom/ScriptElement.cpp:
1308         (WebCore::isLegacySupportedJavaScriptLanguage): Use ASCIICaseInsensitiveHash
1309         for the language set. These strings are all ASCII.
1310
1311         * editing/EditorCommand.cpp: Use ASCIICaseInsensitiveHash for editor
1312         command names. These names are all ASCII.
1313
1314         * html/HTMLObjectElement.cpp:
1315         (WebCore::HTMLObjectElement::parametersForPlugin): Use ASCIICaseInsensitiveHash
1316         for parameter names. These names are all ASCII.
1317
1318         * html/InputType.cpp: Use ASCIICaseInsensitiveHash for the input types.
1319         The input types are all ASCII.
1320
1321         * loader/CrossOriginAccessControl.h: Use ASCIICaseInsensitiveHash for
1322         HTTP header field names. These names are all ASCII.
1323         * loader/CrossOriginPreflightResultCache.h: Ditto.
1324
1325         * loader/archive/ArchiveFactory.cpp: Use ASCIICaseInsensitiveHash for
1326         MIME types. MIME types are all ASCII.
1327         * platform/MIMETypeRegistry.cpp:
1328         (WebCore::initializeSupportedImageMIMETypes): Ditto.
1329
1330         * platform/SchemeRegistry.h: Use ASCIICaseInsensitiveHas for URL schemes.
1331         URL schemes are all ASCII.
1332         * platform/URL.cpp: Ditto.
1333
1334         * platform/graphics/FontCache.cpp: Reworked FontPlatformDataCacheKey struct:
1335         Made it a conventional struct with non-prefixed data members names. Removed
1336         the "==" operator since it was appropriate for hash table lookup but wasn't
1337         a true equality operator. Tightened the implementations of the constructors.
1338         (WebCore::FontPlatformDataCacheKeyHash::hash): Use ASCIICaseInsensitiveHash.
1339         (WebCore::FontPlatformDataCacheKeyHash::equal): Do the equality check here,
1340         not using the == operator. And use equalIgnoringASCIICase.
1341         (WebCore::FontPlatformDataCacheKeyTraits::isEmptyValue): Added this entire
1342         traits struct so we check empty values in a more efficient way.
1343         (WebCore::FontCache::getCachedFontPlatformData): Added comments and tweaked
1344         style in this function.
1345
1346         * platform/graphics/FontCascade.cpp:
1347         (WebCore::keysMatch): Rename from operator== since this operation is not
1348         equality. Changed to equalIgnoringASCIICase and did a little streamlining.
1349         (WebCore::makeFontCascadeCacheKey): Use reserveInitialCapacity for slightly
1350         better memory use.
1351         (WebCore::computeFontCascadeCacheHash): Use IntegerHasher to make computing
1352         a hash more efficient by eliminating the overhead of building a vector and
1353         even possible heap allocation and deallocation.
1354         (WebCore::retrieveOrAddCachedFonts): Use keysMatch instead of ==.
1355
1356         * platform/graphics/cocoa/FontCacheCoreText.cpp: Use ASCIICaseInsensitiveHash
1357         for font family names. These names should use ASCII case insensitive matching;
1358         there is no need for non-ASCII case folding.
1359
1360         * platform/network/HTTPHeaderMap.h: Use ASCIICaseInsensitiveHash for
1361         HTTP header field names. These names are all ASCII.
1362
1363         * rendering/style/RenderStyle.cpp:
1364         (WebCore::computeFontHash): Use IntegerHasher to avoid allocating memory just
1365         to compute a hash. Use ASCIICaseInsensitiveHash.
1366
1367 2016-01-30  Chris Dumez  <cdumez@apple.com>
1368
1369         Unreviewed, rolling out r195871.
1370
1371         Caused several layout tests to time out
1372
1373         Reverted changeset:
1374
1375         "Tab suspension code shouldn't use page cache cacheability
1376         logic"
1377         https://bugs.webkit.org/show_bug.cgi?id=153680
1378         http://trac.webkit.org/changeset/195871
1379
1380 2016-01-30  Chris Dumez  <cdumez@apple.com>
1381
1382         Unreviewed, rebaseline bindings tests after r195904.
1383
1384         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1385         (WebCore::JSTestCustomNamedGetter::getOwnPropertySlot):
1386         (WebCore::jsTestCustomNamedGetterConstructor):
1387         (WebCore::setJSTestCustomNamedGetterConstructor):
1388         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1389         (WebCore::JSTestEventTarget::getOwnPropertySlot):
1390         (WebCore::jsTestEventTargetConstructor):
1391         (WebCore::setJSTestEventTargetConstructor):
1392         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1393         (WebCore::JSTestOverrideBuiltins::getOwnPropertySlot):
1394         (WebCore::jsTestOverrideBuiltinsConstructor):
1395         (WebCore::setJSTestOverrideBuiltinsConstructor):
1396
1397 2016-01-30  Chris Dumez  <cdumez@apple.com>
1398
1399         [JS Bindings] prototype.constructor should be writable
1400         https://bugs.webkit.org/show_bug.cgi?id=149412
1401         <rdar://problem/22545096>
1402
1403         Reviewed by Darin Adler.
1404
1405         prototype.constructor should have the following properties:
1406         { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
1407
1408         as per the Web IDL specification:
1409         https://heycam.github.io/webidl/#interface-prototype-object
1410
1411         In WebKit, it is currently not writable. It is writable in Firefox.
1412
1413         This patch was first landed in r190085 but was rolled out for causing
1414         crashes: <rdar://problem/22825602>. The issue was that even though we
1415         marked constructor as writable, we failed to generate a setter for it.
1416         This patch addresses the issue and the crash in <rdar://problem/22825602>
1417         no longer occurs after this change. A regression test is also added for
1418         this crash.
1419
1420         Tests:
1421         fast/dom/HTMLDocument/constructor-setter-crash.html
1422         fast/dom/prototype-constructor-setter.html
1423
1424         * bindings/scripts/CodeGeneratorJS.pm:
1425         (GenerateAttributesHashTable):
1426         (GenerateImplementation):
1427         * bindings/scripts/IDLAttributes.txt:
1428         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1429         (WebCore::setJSTestActiveDOMObjectConstructor):
1430         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1431         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
1432         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1433         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
1434         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1435         (WebCore::setJSTestCustomNamedGetterConstructor):
1436         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1437         (WebCore::setJSTestEventConstructorConstructor):
1438         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1439         (WebCore::setJSTestEventTargetConstructor):
1440         * bindings/scripts/test/JS/JSTestException.cpp:
1441         (WebCore::setJSTestExceptionConstructor):
1442         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1443         (WebCore::setJSTestGenerateIsReachableConstructor):
1444         * bindings/scripts/test/JS/JSTestInterface.cpp:
1445         (WebCore::setJSTestInterfaceConstructor):
1446         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1447         (WebCore::setJSTestJSBuiltinConstructorConstructor):
1448         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1449         (WebCore::setJSTestMediaQueryListListenerConstructor):
1450         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1451         (WebCore::setJSTestNamedConstructorConstructor):
1452         * bindings/scripts/test/JS/JSTestNode.cpp:
1453         (WebCore::setJSTestNodeConstructor):
1454         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1455         (WebCore::setJSTestNondeterministicConstructor):
1456         * bindings/scripts/test/JS/JSTestObj.cpp:
1457         (WebCore::setJSTestObjConstructor):
1458         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1459         (WebCore::setJSTestOverloadedConstructorsConstructor):
1460         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1461         (WebCore::setJSTestOverrideBuiltinsConstructor):
1462         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1463         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
1464         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1465         (WebCore::setJSTestTypedefsConstructor):
1466         * bindings/scripts/test/JS/JSattribute.cpp:
1467         (WebCore::setJSattributeConstructor):
1468         * bindings/scripts/test/JS/JSreadonly.cpp:
1469         (WebCore::setJSreadonlyConstructor):
1470         * page/DOMWindow.idl:
1471
1472 2016-01-30  Chris Dumez  <cdumez@apple.com>
1473
1474         Move more 'constructor' properties to the prototype
1475         https://bugs.webkit.org/show_bug.cgi?id=153667
1476
1477         Reviewed by Darin Adler.
1478
1479         Move more 'constructor' properties to the prototype. In particular, we
1480         used to keep the 'constructor' on the instance for interfaces that have
1481         an indexed / named property getter because our getOwnPropertySlot()
1482         implementation used to be wrong for such interfaces.
1483
1484         However, getOwnPropertySlot() should be correct after r188590 so we
1485         should now be able to move the 'constructor' up to the prototype for
1486         these interfaces, as per the specification:
1487         http://heycam.github.io/webidl/#interface-prototype-object
1488
1489         No new tests, already covered by existing tests.
1490
1491         * bindings/js/JSPluginElementFunctions.h:
1492         (WebCore::pluginElementCustomGetOwnPropertySlot):
1493         Add a null check for staticPropHashTable. It is now null because this
1494         type no longer has any property on the instance now that 'constructor'
1495         is on the prototype.
1496
1497         * bindings/scripts/CodeGeneratorJS.pm:
1498         (ConstructorShouldBeOnInstance):
1499
1500 2016-01-29  Ada Chan  <adachan@apple.com>
1501
1502         Enable VIDEO_PRESENTATION_MODE only in Debug and Release builds on Mac
1503         https://bugs.webkit.org/show_bug.cgi?id=153665
1504
1505         Reviewed by Dan Bernstein.
1506
1507         * Configurations/FeatureDefines.xcconfig:
1508
1509 2016-01-30  David Kilzer  <ddkilzer@apple.com>
1510
1511         [iOS] WebKit1 apps crash in ___ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse_block_invoke1
1512         <http://webkit.org/b/153710>
1513         <rdar://problem/23116706>
1514
1515         Reviewed by Darin Adler.
1516
1517         * loader/cocoa/DiskCacheMonitorCocoa.mm:
1518         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
1519         - Fix race condition on iOS WebKit1 clients by calling the block
1520           to cancel the DiskCacheMonitor on the WebThread, which is the
1521           same thread where the CFCachedURLResponseCallBackBlock is
1522           called.
1523         - Removed whitespace to adhere to style.
1524
1525 2016-01-30  Ryosuke Niwa  <rniwa@webkit.org>
1526
1527         TouchList should be retargeted
1528         https://bugs.webkit.org/show_bug.cgi?id=149592
1529
1530         Reviewed by Antti Koivisto.
1531
1532         Retarget touch target's using the same algorithm as the one used for related targets instead of
1533         EventRelatedNodeResolver which is removed in this patch.
1534
1535         Also enable the retargeting on iOS.
1536
1537         Test: fast/shadow-dom/touch-event-ios.html
1538
1539         * dom/EventContext.cpp:
1540         (WebCore::TouchEventContext::TouchEventContext):
1541         (WebCore::TouchEventContext::handleLocalEvents):
1542         (WebCore::TouchEventContext::checkReachability):
1543         * dom/EventContext.h:
1544         (WebCore::toTouchEventContext):
1545         (WebCore::EventContext::isUnreachableNode):
1546         * dom/EventDispatcher.cpp:
1547         (WebCore::EventRelatedNodeResolver): Deleted.
1548         (WebCore::EventPath::EventPath):
1549         (WebCore::EventDispatcher::dispatchEvent): 
1550         (WebCore::addRelatedNodeResolversForTouchList): Deleted.
1551         (WebCore::EventPath::updateTouchLists): Deleted.
1552         (WebCore::EventPath::setRelatedTarget): Removed superfluous UNUSED_PARAM since the argument is always used.
1553         (WebCore::EventPath::retargetTouch): Extracted from updateTouchLists/setRelatedTarget. Clones Touch object
1554         with the new target for each event context just like related targets.
1555         (WebCore::EventPath::retargetTouchLists): Renamed from updateTouchLists. Calls retargetTouch on each Touch
1556         object in each TouchList.
1557         * dom/TouchEvent.h:
1558
1559 2016-01-30 Dave Hyatt  <hyatt@apple.com>
1560
1561         Support break-after, break-before and break-inside.
1562         https://bugs.webkit.org/show_bug.cgi?id=148814
1563
1564         Reviewed by Dean Jackson.
1565
1566         New tests added in printing/, fast/multicol/, and fast/regions.
1567
1568         * css/CSSComputedStyleDeclaration.cpp:
1569         (WebCore::convertToPageBreak):
1570         (WebCore::convertToColumnBreak):
1571         (WebCore::convertToRegionBreak):
1572         For backwards compatibility, keep support for all the old properties in
1573         computed style. This means we have to convert the break-* property values
1574         into keywords that make sense for the legacy properties. This mainly
1575         involves mapping "page", "column", "region" to "always" (similar rule for
1576         the avoid-* versions as well).
1577
1578         (WebCore::ComputedStyleExtractor::propertyValue):
1579         Add support for the three new break-* properties.
1580
1581         * css/CSSParser.cpp:
1582         (WebCore::isValidKeywordPropertyAndValue):
1583         (WebCore::isKeywordPropertyID):
1584         (WebCore::CSSParser::parseValue):
1585         Add support for the new break properties.
1586
1587         * css/CSSPrimitiveValueMappings.h:
1588         (WebCore::CSSPrimitiveValue::operator BreakBetween):
1589         (WebCore::CSSPrimitiveValue::operator BreakInside):
1590         Add converters for the new BreakBetween and BreakInside enums. Remove
1591         the EPageBreak enum, since it is no longer used.
1592
1593         * css/CSSPropertyNames.in:
1594         * css/CSSValueKeywords.in:
1595         Add the new properties and the new values supported by the properties
1596         to the keywords lists.
1597
1598         * css/StyleBuilderConverter.h:
1599         (WebCore::StyleBuilderConverter::convertFontSynthesis):
1600         (WebCore::StyleBuilderConverter::convertPageBreakBetween):
1601         (WebCore::StyleBuilderConverter::convertPageBreakInside):
1602         (WebCore::StyleBuilderConverter::convertColumnBreakBetween):
1603         (WebCore::StyleBuilderConverter::convertColumnBreakInside):
1604         (WebCore::StyleBuilderConverter::convertRegionBreakBetween):
1605         (WebCore::StyleBuilderConverter::convertRegionBreakInside):
1606         In order to map the legacy properties into the new break-* values
1607         we have custom converter functions.
1608
1609         * rendering/RenderBlock.cpp:
1610         (WebCore::RenderBlock::paintChild):
1611         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation):
1612         (WebCore::RenderBlock::computeRegionRangeForBoxChild):
1613         * rendering/RenderBlockFlow.cpp:
1614         (WebCore::RenderBlockFlow::applyBeforeBreak):
1615         (WebCore::RenderBlockFlow::applyAfterBreak):
1616         Patch the block code to check the correct new break-* constants. For
1617         avoidance, this means checking both the general avoid value and the
1618         specific value (e.g., avoid-page). In place of "always", we check
1619         the specific value (e.g., column) and then for page specifically, we
1620         also treat "left", "right", "recto" and "verso" as "always break" for now.
1621
1622         * rendering/style/RenderStyle.cpp:
1623         (WebCore::RenderStyle::changeRequiresLayout):
1624         Make sure changes to the break properties trigger relayout.
1625
1626         * rendering/style/RenderStyle.h:
1627         Add getters and setters for the break-* properties and remove all
1628         occurrences of the legacy page, column and region values from the RenderStyle.
1629
1630         * rendering/style/RenderStyleConstants.cpp:
1631         (WebCore::alwaysPageBreak):
1632         We have a helper function here for mapping several constant values to "page".
1633
1634         * rendering/style/RenderStyleConstants.h:
1635         Definitions of the new BreakBetween and BreakInside enums.
1636
1637         * rendering/style/StyleMultiColData.cpp:
1638         (WebCore::StyleMultiColData::StyleMultiColData):
1639         (WebCore::StyleMultiColData::operator==):
1640         * rendering/style/StyleMultiColData.h:
1641         Remove the column-specific break data.
1642
1643         * rendering/style/StyleRareNonInheritedData.cpp:
1644         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
1645         (WebCore::StyleRareNonInheritedData::operator==):
1646         * rendering/style/StyleRareNonInheritedData.h:
1647         Remove the region-specific break data and replace it with generic break
1648         data that is now used by all three pagination models.
1649
1650 2016-01-29  Per Arne Vollan  <peavo@outlook.com>
1651
1652         [Win] Fix compile error.
1653         https://bugs.webkit.org/show_bug.cgi?id=153646
1654
1655         Reviewed by Darin Adler.
1656
1657         * platform/text/win/LocaleWin.cpp:
1658         (WebCore::LCIDFromLocaleInternal):
1659
1660 2016-01-29  Antti Koivisto  <antti@apple.com>
1661
1662         Tab suspension code shouldn't use page cache cacheability logic
1663         https://bugs.webkit.org/show_bug.cgi?id=153680
1664
1665         Reviewed by Andreas Kling.
1666
1667         Most of PageCache::canCache() is unnecessary for tab suspension.
1668
1669         Also improve robustness.
1670
1671         * page/Page.cpp:
1672         (WebCore::Page::setPageActivityState):
1673         (WebCore::Page::setIsVisible):
1674         (WebCore::Page::setIsVisibleInternal):
1675         (WebCore::Page::setIsPrerender):
1676         (WebCore::Page::canTabSuspend):
1677
1678             Include visibility test here.
1679
1680             Instead of calling PageCache::canCache() just check for each frame that
1681             - that the document is loaded
1682             - that active DOM objects allow suspension
1683
1684         (WebCore::Page::setIsTabSuspended):
1685         (WebCore::Page::setTabSuspensionEnabled):
1686         (WebCore::Page::updateTabSuspensionState):
1687
1688             Refactor for robustness.
1689
1690         (WebCore::Page::tabSuspensionTimerFired):
1691
1692             Call canTabSuspend, the result might have changed.
1693
1694         (WebCore::Page::scheduleTabSuspension): Deleted.
1695         * page/Page.h:
1696
1697 2016-01-29  Ryosuke Niwa  <rniwa@webkit.org>
1698
1699         fast/shadow-dom/Element-interface-attachShadow.html fails on iOS
1700         https://bugs.webkit.org/show_bug.cgi?id=153681
1701
1702         Reviewed by Antti Koivisto.
1703
1704         The bug was caused by canHaveUserAgentShadowRoot() returning false on a meter element since it's disabled on iOS.
1705         Override HTMLUnknownElement's canHaveUserAgentShadowRoot to return false for compatbility on iOS.
1706
1707         * html/HTMLUnknownElement.h:
1708         (WebCore::HTMLUnknownElement::canHaveUserAgentShadowRoot):
1709
1710 2016-01-29  Brady Eidson  <beidson@apple.com>
1711
1712         Modern IDB: Getting records for key ranges with null keys aren't properly handled in SQLite backend
1713         https://bugs.webkit.org/show_bug.cgi?id=153666
1714
1715         Reviewed by Tim Horton.
1716
1717         No new tests (Two failing tests now pass).
1718
1719         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1720         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
1721
1722 2016-01-29  Simon Fraser  <simon.fraser@apple.com>
1723
1724         image-rendering: -webkit-optimize-contrast not working for background images
1725         https://bugs.webkit.org/show_bug.cgi?id=97991
1726
1727         Reviewed by Darin Adler.
1728         
1729         Don't equate "pixelated" and "crisp-edges" values for image-rendering with low
1730         quality scaling; they should map to InterpolationNone, not InterpolationLow.
1731         
1732         To support this change ImageQualityController to return a InterpolationQuality
1733         from the renamed chooseInterpolationQuality(). If the returned value is not
1734         InterpolationDefault, set the GraphicsContext image interpolation when drawing
1735         images and image buffers.
1736         
1737         Remove the redundant "useLowQualityScale" from 
1738
1739         Test: fast/images/image-rendering-interpolation.html
1740
1741         * html/HTMLCanvasElement.cpp:
1742         (WebCore::HTMLCanvasElement::paint):
1743         * html/HTMLCanvasElement.h:
1744         * page/DragController.cpp:
1745         (WebCore::DragController::doImageDrag):
1746         * platform/graphics/GraphicsContext.cpp:
1747         (WebCore::GraphicsContext::drawImage):
1748         (WebCore::GraphicsContext::drawTiledImage):
1749         (WebCore::GraphicsContext::drawImageBuffer):
1750         (WebCore::GraphicsContext::drawConsumingImageBuffer):
1751         (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer): Deleted.
1752         (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer): Deleted.
1753         * platform/graphics/GraphicsContext.h:
1754         (WebCore::ImagePaintingOptions::ImagePaintingOptions):
1755         (WebCore::ImagePaintingOptions::usesDefaultInterpolation):
1756         (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer):
1757         (WebCore::InterpolationQualityMaintainer::~InterpolationQualityMaintainer):
1758         * platform/graphics/GraphicsTypes.h:
1759         * platform/graphics/ImageBuffer.h:
1760         * platform/graphics/cg/ImageBufferCG.cpp:
1761         (WebCore::ImageBuffer::drawConsuming):
1762         (WebCore::ImageBuffer::draw):
1763         * rendering/ImageQualityController.cpp:
1764         (WebCore::ImageQualityController::interpolationQualityFromStyle):
1765         (WebCore::ImageQualityController::chooseInterpolationQuality):
1766         (WebCore::ImageQualityController::ImageQualityController): Deleted.
1767         (WebCore::ImageQualityController::shouldPaintAtLowQuality): Deleted.
1768         * rendering/ImageQualityController.h:
1769         * rendering/RenderBoxModelObject.cpp:
1770         (WebCore::RenderBoxModelObject::chooseInterpolationQuality):
1771         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1772         (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality): Deleted.
1773         * rendering/RenderBoxModelObject.h:
1774         * rendering/RenderEmbeddedObject.cpp:
1775         (WebCore::RenderEmbeddedObject::paintSnapshotImage):
1776         * rendering/RenderHTMLCanvas.cpp:
1777         (WebCore::RenderHTMLCanvas::paintReplaced):
1778         * rendering/RenderImage.cpp:
1779         (WebCore::RenderImage::paintIntoRect):
1780         * rendering/RenderSnapshottedPlugIn.cpp:
1781         (WebCore::RenderSnapshottedPlugIn::paintSnapshot):
1782         * rendering/style/RenderStyle.h:
1783
1784 2016-01-29  Brady Eidson  <beidson@apple.com>
1785
1786         Modern IDB: storage/indexeddb/modern/index-3.html fails.
1787         https://bugs.webkit.org/show_bug.cgi?id=153661
1788
1789         Reviewed by Tim Horton.
1790
1791         No new tests (1 failing test now passes, others get closer).
1792
1793         When indexing a new record fails due to uniqueness constraints, remove all traces of the record.
1794
1795         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1796         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
1797         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
1798         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
1799
1800 2016-01-29  Brent Fulgham  <bfulgham@apple.com>
1801
1802         [WebGL] Check vertex array bounds before permitting a glDrawArrays to execute
1803         https://bugs.webkit.org/show_bug.cgi?id=153643
1804         <rdar://problem/23424456>
1805
1806         Reviewed by Dean Jackson.
1807
1808         Tested by fast/canvas/webgl/webgl-drawarrays-crash.html.
1809
1810         * html/canvas/WebGLRenderingContextBase.cpp:
1811         (WebCore::WebGLRenderingContextBase::validateDrawArrays): Make sure that we have at
1812         least one buffer bound to a program if a drawArray call with a non-zero range of
1813         requested data is being made.
1814         (WebCore::WebGLRenderingContextBase::validateDrawElements): Drive-by formatting fix.
1815
1816 2016-01-29  Brady Eidson  <beidson@apple.com>
1817
1818         Modern IDB: Fix logging that overwhelms python with strings of excessive length.
1819         https://bugs.webkit.org/show_bug.cgi?id=153652
1820
1821         Reviewed by Tim Horton.
1822
1823         No new tests (Two skipped tests now pass).
1824
1825         * Modules/indexeddb/IDBKeyData.cpp:
1826         (WebCore::IDBKeyData::loggingString): Limit the length of the string.
1827         
1828         * Modules/indexeddb/IDBKeyRangeData.cpp:
1829         (WebCore::IDBKeyRangeData::loggingString): Limit the length of the string.
1830
1831 2016-01-29  Jer Noble  <jer.noble@apple.com>
1832
1833         Unreviewed Windows build fix; one more ResourceLoaderOptions call site which needs to
1834         be updated after adding the CachingPolicy parameter.
1835
1836         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
1837         (WebCore::WebCoreAVCFResourceLoader::startLoading):
1838
1839 2016-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1840
1841         [GTK] Implement overlay scrollbars
1842         https://bugs.webkit.org/show_bug.cgi?id=153405
1843
1844         Reviewed by Michael Catanzaro.
1845
1846         Add support for overlay scrollbars to GTK+ platform following the
1847         same style and behavior than GtkScrolledWindow. They are only
1848         available for GTK+ >= 3.19, but honoring the GTK_OVERLAY_SCROLLING
1849         environment variable, so they could be disable at run time, except
1850         when threaded compositor is enabled. A new ScrollAnimator class
1851         has been added for GTK+ to implement overlay scrollbars and still
1852         allow smooth scrolling when available.
1853
1854         * PlatformGTK.cmake: Add ScrollAnimatorGtk and stop building ScrollAnimatorSmooth.
1855         * platform/ScrollAnimator.h:
1856         (WebCore::ScrollAnimator::ScrollAnimator::mouseEnteredContentArea):
1857         Remove const to allow the ScrollAnimator to be updated.
1858         (WebCore::ScrollAnimator::ScrollAnimator::mouseExitedContentArea): Ditto.
1859         (WebCore::ScrollAnimator::ScrollAnimator::mouseMovedInContentArea): Ditto.
1860         (WebCore::ScrollAnimator::ScrollAnimator::contentAreaDidShow): Ditto.
1861         (WebCore::ScrollAnimator::ScrollAnimator::contentAreaDidHide): Ditto.
1862         * platform/Scrollbar.h:
1863         (WebCore::Scrollbar::opacity): Get scrollbar opacity.
1864         (WebCore::Scrollbar::setOpacity): Set scrollbar opacity.
1865         * platform/gtk/ScrollAnimatorGtk.cpp: Added.
1866         (WebCore::ScrollAnimator::create): Create a ScrollAnimatorGtk.
1867         (WebCore::ScrollAnimatorGtk::ScrollAnimatorGtk):
1868         (WebCore::ScrollAnimatorGtk::~ScrollAnimatorGtk):
1869         (WebCore::ScrollAnimatorGtk::ensureSmoothScrollingAnimation):
1870         Initialize the ScrollAnimationSmooth if it doesn't exist.
1871         (WebCore::ScrollAnimatorGtk::scroll): Ensure we have a
1872         ScrollAnimationSmooth if smooth scrolling is enabled. This also
1873         fixes the problem of having to reload the page after changing the
1874         smooth scrolling setting.
1875         (WebCore::ScrollAnimatorGtk::scrollToOffsetWithoutAnimation):
1876         (WebCore::ScrollAnimatorGtk::willEndLiveResize):
1877         (WebCore::ScrollAnimatorGtk::didAddVerticalScrollbar): Register
1878         the scrollbar if it's an overlay scrollbar and make it visible
1879         without animating it. Start the hide animation.
1880         (WebCore::ScrollAnimatorGtk::didAddHorizontalScrollbar): Ditto.
1881         (WebCore::ScrollAnimatorGtk::willRemoveVerticalScrollbar):
1882         Unregister the scrollbar if it was registered and resrt the
1883         animation state if it was the only scrollbar.
1884         (WebCore::ScrollAnimatorGtk::willRemoveHorizontalScrollbar): Ditto.
1885         (WebCore::ScrollAnimatorGtk::updateOverlayScrollbarsOpacity): Update
1886         the scrollbars opacity and invalidate the indicator.
1887         (WebCore::easeOutCubic):
1888         (WebCore::ScrollAnimatorGtk::overlayScrollbarAnimationTimerFired):
1889         Update the scrollbars opacity and schedule a next frame if the
1890         animation didn't finish or start the hide animation otherwhise.
1891         (WebCore::ScrollAnimatorGtk::showOverlayScrollbars): Start the
1892         fade animation to show the scrollbars if needed.
1893         (WebCore::ScrollAnimatorGtk::hideOverlayScrollbars): Start the
1894         dafe animation to hide the scrollbars if needed.
1895         (WebCore::ScrollAnimatorGtk::mouseEnteredContentArea): Call
1896         showOverlayScrollbars().
1897         (WebCore::ScrollAnimatorGtk::mouseExitedContentArea): Call
1898         hideOverlayScrollbars().
1899         (WebCore::ScrollAnimatorGtk::mouseMovedInContentArea): Call
1900         showOverlayScrollbars().
1901         (WebCore::ScrollAnimatorGtk::contentAreaDidShow): Ditto.
1902         (WebCore::ScrollAnimatorGtk::contentAreaDidHide): Hide the
1903         scrollbars without animations.
1904         (WebCore::ScrollAnimatorGtk::notifyContentAreaScrolled): Call
1905         showOverlayScrollbars().
1906         (WebCore::ScrollAnimatorGtk::lockOverlayScrollbarStateToHidden):
1907         Update the lock state and hide or show the scrollbars when locked
1908         or unlocked.
1909         * platform/gtk/ScrollAnimatorGtk.h: Added.
1910         * platform/gtk/ScrollbarThemeGtk.cpp:
1911         (WebCore::ScrollbarThemeGtk::backButtonRect): Pass
1912         StyleContextMode to getOrCreateStyleContext depending on the
1913         painting parameter.
1914         (WebCore::ScrollbarThemeGtk::forwardButtonRect): Ditto.
1915         (WebCore::ScrollbarThemeGtk::trackRect): Ditto.
1916         (WebCore::ScrollbarThemeGtk::getOrCreateStyleContext): Add
1917         StyleContextMode parameter to add the hovering class
1918         unconditionally when using overlay scrollbars in layout mode. In
1919         paint mode we add the hovering clas only when the scrollbar is
1920         hovered. This way we always claim the size of the scrollbar when
1921         hovered to be able to show the full scrollbar when the mouse is
1922         close enough to the indicator.
1923         (WebCore::ScrollbarThemeGtk::ScrollbarThemeGtk): Initialize
1924         m_usesOverlayScrollbars.
1925         (WebCore::ScrollbarThemeGtk::thumbRect): Pass the scrollbar to
1926         getOrCreateStyleContext().
1927         (WebCore::adjustRectAccordingToMargin): Fix the top margin.
1928         (WebCore::ScrollbarThemeGtk::paintTrackBackground): Pass the
1929         scrollbar and paint mode to getOrCreateStyleContext().
1930         (WebCore::ScrollbarThemeGtk::paintScrollbarBackground): Ditto.
1931         (WebCore::ScrollbarThemeGtk::paintThumb): Adjust the thumb
1932         rectangle when overlay scrollbar is not hovered to its current
1933         size, since we always claim the size of the scrollbar in hovered
1934         mode.
1935         (WebCore::ScrollbarThemeGtk::paintButton): Pass the scrollbar and
1936         paint mode to getOrCreateStyleContext().
1937         (WebCore::ScrollbarThemeGtk::paint): Take the scrollbar opacity
1938         into account when rendering overlay scrollbars as indicators. Also
1939         get the scrollbar opacity from the GTK+ theme and use a
1940         transparency group when the global opacity is not full opaque.
1941         (WebCore::ScrollbarThemeGtk::buttonSize): Pass the scrollbar to
1942         getOrCreateStyleContext().
1943         * platform/gtk/ScrollbarThemeGtk.h:
1944         * platform/mac/ScrollAnimatorMac.h:
1945         * platform/mac/ScrollAnimatorMac.mm:
1946         (WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
1947         (WebCore::ScrollAnimatorMac::mouseExitedContentArea):
1948         (WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
1949         (WebCore::ScrollAnimatorMac::contentAreaDidShow):
1950         (WebCore::ScrollAnimatorMac::contentAreaDidHide):
1951
1952 2016-01-29  ChangSeok Oh  <changseok.oh@collabora.com>
1953
1954         [GStreamer] built-in media player doesn't update
1955         https://bugs.webkit.org/show_bug.cgi?id=151816
1956
1957         Reviewed by Xabier Rodriguez-Calvar.
1958
1959         The timeline of audio controls in media document is not properly updated since it is assumed
1960         that the controls are hidden as soon as playing. However, such full page audio always has
1961         opacity : 1 declared by video:-webkit-full-page-media::-webkit-media-controls-panel.no-video.
1962         i.e. it is not actually hidden. We can fix this by simply returning false for no-video media
1963         in controlsAreHidden();
1964
1965         Test: media/audio-controls-timeline-in-media-document.html
1966
1967         * Modules/mediacontrols/mediaControlsBase.js:
1968         (Controller.prototype.controlsAreAlwaysVisible):
1969         (Controller.prototype.controlsAreHidden):
1970
1971 2016-01-29  Manuel Rego Casasnovas  <rego@igalia.com>
1972
1973         [css-grid] Store lines instead of tracks in GridResolvedPosition
1974         https://bugs.webkit.org/show_bug.cgi?id=153592
1975
1976         Reviewed by Sergio Villar Senin.
1977
1978         Due to the new feature that allows to create implicit tracks before the
1979         explicit ones, we will need to use lines instead of tracks in the
1980         code to be able to implement it properly.
1981
1982         This is just a first simple patch using lines instead of tracks in
1983         GridResolvedPosition. It modifies the code that was using it, as it was
1984         considering that the resolvedFinalPosition was a track index and
1985         not a line index.
1986
1987         So if we've an item positioned like:
1988           grid-column: 2 / 5;
1989           grid-row: 1 / span 2;
1990
1991         Before we were storing this information on the GridSpan:
1992         * columns:
1993           * resolvedInitialPosition: 1
1994           * resolvedFinalPosition:  3
1995         * rows:
1996           * resolvedInitialPosition: 0
1997           * resolvedFinalPosition:  1
1998
1999         And now we're storing:
2000         * columns:
2001           * resolvedInitialPosition: 1
2002           * resolvedFinalPosition:  4
2003         * rows:
2004           * resolvedInitialPosition: 0
2005           * resolvedFinalPosition:  2
2006
2007         No new tests, no change of behavior.
2008
2009         * css/CSSGridTemplateAreasValue.cpp:
2010         (WebCore::stringForPosition):
2011         * css/CSSParser.cpp:
2012         (WebCore::CSSParser::parseGridTemplateAreasRow):
2013         * css/StyleBuilderConverter.h:
2014         (WebCore::StyleBuilderConverter::createImplicitNamedGridLinesFromGridArea):
2015         * rendering/RenderGrid.cpp:
2016         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
2017         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2018         (WebCore::RenderGrid::ensureGridSize):
2019         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
2020         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
2021         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2022         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
2023         (WebCore::RenderGrid::columnAxisOffsetForChild):
2024         (WebCore::RenderGrid::rowAxisOffsetForChild):
2025         * rendering/RenderGrid.h:
2026         * rendering/style/GridCoordinate.h:
2027         (WebCore::GridSpan::GridSpan):
2028         (WebCore::GridSpan::integerSpan):
2029         (WebCore::GridSpan::end):
2030         (WebCore::GridCoordinate::GridCoordinate):
2031         * rendering/style/GridResolvedPosition.cpp:
2032         (WebCore::resolveRowStartColumnStartNamedGridLinePositionAgainstOppositePosition):
2033         (WebCore::resolveRowEndColumnEndNamedGridLinePositionAgainstOppositePosition):
2034         (WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
2035         (WebCore::resolveGridPositionAgainstOppositePosition):
2036         (WebCore::GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition):
2037         (WebCore::GridResolvedPosition::resolveGridPositionsFromStyle):
2038         (WebCore::resolveNamedGridLinePositionFromStyle): Deleted.
2039         * rendering/style/GridResolvedPosition.h:
2040
2041 2016-01-28  Brady Eidson  <beidson@apple.com>
2042
2043         Modern IDB: SQLite backend mismanages key generator values.
2044         https://bugs.webkit.org/show_bug.cgi?id=153625
2045
2046         Reviewed by Andy Estes.
2047
2048         No new tests (Many failing tests pass, a few get closer).
2049
2050         There's mixed assumptions about whether the value stored is the current value or the next value.
2051
2052         Fixing those assumptions fixes tests.
2053         
2054         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2055         (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): Store/retrieve the correct value.
2056         (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): Ditto.
2057         (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): Ditto.
2058
2059 2016-01-28  Joseph Pecoraro  <pecoraro@apple.com>
2060
2061         Web Inspector: InspectorTimelineAgent doesn't need to recompile functions because it now uses the sampling profiler
2062         https://bugs.webkit.org/show_bug.cgi?id=153500
2063         <rdar://problem/24352458>
2064
2065         Reviewed by Timothy Hatcher.
2066
2067         * bindings/js/JSDOMWindowBase.cpp:
2068         (WebCore::JSDOMWindowBase::supportsLegacyProfiling):
2069         (WebCore::JSDOMWindowBase::supportsRichSourceInfo):
2070         (WebCore::JSDOMWindowBase::supportsProfiling): Deleted.
2071         * bindings/js/JSDOMWindowBase.h:
2072         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2073         (WebCore::JSWorkerGlobalScopeBase::supportsLegacyProfiling):
2074         (WebCore::JSWorkerGlobalScopeBase::supportsProfiling): Deleted.
2075         * bindings/js/JSWorkerGlobalScopeBase.h:
2076         * inspector/InspectorController.h:
2077         * inspector/InspectorController.cpp:
2078         (WebCore::InspectorController::legacyProfilerEnabled):
2079         (WebCore::InspectorController::setLegacyProfilerEnabled):
2080         Be more explicit about enabling legacy profiling.
2081
2082         * inspector/InspectorTimelineAgent.cpp:
2083         (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
2084         (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend): Deleted.
2085         TimelineAgent doesn't need to recompile if using the sampling profiler.
2086         This breaks console.profile, but console.profile should move to using
2087         the sampling profiler as well.
2088
2089         (WebCore::InspectorTimelineAgent::startFromConsole):
2090         (WebCore::InspectorTimelineAgent::stopFromConsole):
2091         (WebCore::startProfiling): Deleted.
2092         (WebCore::stopProfiling): Deleted.
2093         Inlined the use once static functions.
2094
2095         * page/PageConsoleClient.cpp:
2096         (WebCore::PageConsoleClient::profile):
2097         (WebCore::PageConsoleClient::profileEnd):
2098         Added FIXMEs for improving console.profile and profileEnd.
2099
2100         * testing/Internals.cpp:
2101         (WebCore::Internals::resetToConsistentState):
2102         (WebCore::Internals::setLegacyJavaScriptProfilingEnabled):
2103         (WebCore::Internals::setJavaScriptProfilingEnabled): Deleted.
2104         * testing/Internals.h:
2105         * testing/Internals.idl:
2106         Be more explicit about enabling legacy profiling.
2107
2108 2016-01-28  Chris Dumez  <cdumez@apple.com>
2109
2110         Move attributes to the prototype for List types / and types with indexed/named property getters
2111         https://bugs.webkit.org/show_bug.cgi?id=153599
2112
2113         Reviewed by Darin Adler.
2114
2115         Move attributes to the prototype for List types / and types with indexed/named property getters.
2116
2117         We used to keep them on the instance because:
2118         1. Our GetOwnProperty lookup used to be in incorrect order for interfaces with indexed/named property getters.
2119         -> This was fixed recently and we now match the specification and other browsers.
2120         2. This used to regress performance when iterating over those list types
2121         -> Local testing seems to show that this is no longer a regression (tested Speedometer and various related Bindings PerformanceTests).
2122
2123         No new tests, already covered by existing tests.
2124
2125         * bindings/scripts/CodeGeneratorJS.pm:
2126         (InterfaceRequiresAttributesOnInstance): Deleted.
2127         (AttributeShouldBeOnInstanceForCompatibility): Deleted.
2128
2129 2016-01-28  Antti Koivisto  <antti@apple.com>
2130
2131         Tab suspension code hits asserts
2132              
2133
2134         Reviewed by Chris Dumez.
2135
2136         Enabling tab suspension and navigating around in a few tabs hits an assert in
2137         ScriptExecutionContext::suspendActiveDOMObject. This is because suspend/resume reasons don't pair properly
2138
2139         * dom/Document.cpp:
2140         (WebCore::Document::documentWillBecomeInactive):
2141         (WebCore::Document::suspend):
2142         (WebCore::Document::resume):
2143
2144             Provide the reason as argument.
2145
2146         * dom/Document.h:
2147         * history/CachedFrame.cpp:
2148         (WebCore::CachedFrameBase::restore):
2149
2150             No need to call resumeActiveDOMObjects/resumeScriptedAnimationControllerCallbacks explicitly as Document::resume does that.
2151
2152         (WebCore::CachedFrame::CachedFrame):
2153         * loader/FrameLoader.cpp:
2154         (WebCore::FrameLoader::commitProvisionalLoad):
2155         * page/Page.cpp:
2156         (WebCore::Page::canTabSuspend):
2157         (WebCore::Page::setIsTabSuspended):
2158
2159 2016-01-28  Brady Eidson  <beidson@apple.com>
2160
2161         Modern IDB: Fix several more problems with object store changes during cursor iteration in SQLite backend.
2162         https://bugs.webkit.org/show_bug.cgi?id=153616
2163
2164         Reviewed by Alex Christensen.
2165
2166         No new tests (A few failing tests pass, a few get closer).
2167
2168         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2169         (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
2170         
2171         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
2172         (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
2173         (WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
2174         
2175         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
2176         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
2177
2178 2016-01-28  Daniel Bates  <dabates@apple.com>
2179
2180         Cleanup: Make DedicatedWorkerThread::create() an inline template method
2181         https://bugs.webkit.org/show_bug.cgi?id=153612
2182
2183         Reviewed by Andy Estes.
2184
2185         Make use of variadic template arguments and std::forward() to forward the arguments passed
2186         from DedicatedWorkerThread::create() to DedicatedWorkerThread::DedicatedWorkerThread(). This
2187         removes the need to duplicate code whenever we modify the parameter types or number of
2188         parameters taken by DedicatedWorkerThread::DedicatedWorkerThread().
2189
2190         * workers/DedicatedWorkerThread.cpp:
2191         (WebCore::DedicatedWorkerThread::create): Deleted.
2192         * workers/DedicatedWorkerThread.h: Reorganized listing of member functions such that we
2193         group the creation/constructor and destructor functions.
2194         (WebCore::DedicatedWorkerThread::create): Modified to be an inline template with variadic
2195         parameters that std::forward()s its arguments to DedicatedWorkerThread::DedicatedWorkerThread().
2196
2197 2016-01-28  Brady Eidson  <beidson@apple.com>
2198
2199         Modern IDB: SQLite backend doesn't handle mutation during cursor iteration.
2200         https://bugs.webkit.org/show_bug.cgi?id=153614
2201
2202         Reviewed by Alex Christensen.
2203
2204         No new tests (A few failing tests pass, a few get closer).
2205
2206         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2207         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): Call notifyCursorsOfChanges.
2208         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Ditto.
2209
2210         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
2211         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
2212         (WebCore::IDBServer::SQLiteIDBCursor::~SQLiteIDBCursor):
2213         * Modules/indexeddb/server/SQLiteIDBCursor.h:
2214
2215         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
2216         (WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenBackingStoreCursor): Remember these transient backing 
2217           store cursors so they can be notified of changes.
2218         (WebCore::IDBServer::SQLiteIDBTransaction::closeCursor): Handle removing the cursor from the right set.
2219         (WebCore::IDBServer::SQLiteIDBTransaction::notifyCursorsOfChanges):
2220         * Modules/indexeddb/server/SQLiteIDBTransaction.h:
2221
2222 2016-01-28  Brady Eidson  <beidson@apple.com>
2223
2224         Modern IDB: SQLite backend doesn't support deleting ranges with more than one key.
2225         https://bugs.webkit.org/show_bug.cgi?id=153604
2226
2227         Reviewed by Andy Estes.
2228
2229         No new tests (A few failing tests pass, a few get closer).
2230
2231         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2232         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
2233
2234 2016-01-28  Alex Christensen  <achristensen@webkit.org>
2235
2236         Fix Windows build after r195774.
2237
2238         * platform/network/ParsedContentRange.cpp:
2239
2240 2016-01-28  Anders Carlsson  <andersca@apple.com>
2241
2242         Add an ArrayValue::get overload that returns a string
2243         https://bugs.webkit.org/show_bug.cgi?id=153613
2244
2245         Reviewed by Tim Horton.
2246
2247         * bindings/js/ArrayValue.cpp:
2248         (WebCore::ArrayValue::get):
2249         * bindings/js/ArrayValue.h:
2250
2251 2016-01-28  Chris Dumez  <cdumez@apple.com>
2252
2253         EventHandler IDL attributes should be enumerable
2254         https://bugs.webkit.org/show_bug.cgi?id=153595
2255
2256         Reviewed by Sam Weinig.
2257
2258         Most of our EventHandler IDL attributes were marked as [NotEnumerable]
2259         but should not have been according to the specification:
2260         - https://html.spec.whatwg.org/#globaleventhandlers
2261         - https://html.spec.whatwg.org/#windoweventhandlers
2262
2263         Firefox and Chrome behave according to the specification.
2264         This patch aligns our behavior.
2265
2266         No new tests, already covered by existing tests.
2267
2268         * dom/Document.idl:
2269         * dom/GlobalEventHandlers.idl:
2270         * page/WindowEventHandlers.idl:
2271
2272 2016-01-28  Jer Noble  <jer.noble@apple.com>
2273
2274         Windows build fix; PRId64 formatting macro for int64_t undefined, so provide Windows-specific alternative.
2275
2276         * platform/network/ParsedContentRange.cpp:
2277
2278 2016-01-28  ChangSeok Oh  <changseok.oh@collabora.com>
2279
2280         [ThreadedCompositor] Fix flickers happening on video when entering/leaving fullscreen.
2281         https://bugs.webkit.org/show_bug.cgi?id=153585
2282
2283         Reviewed by Michael Catanzaro.
2284
2285         Video thumbnail flickers where threaded compositor is enabled. This is because
2286         a content buffer is not set to a target layer which changes before swapBuffer.
2287         This is a very rare case though, it happens where video size changes many times in a short period.
2288
2289         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
2290         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
2291
2292 2016-01-27  Jer Noble  <jer.noble@apple.com>
2293
2294         Allow CachedResourceLoader clients to opt out of the MemoryCache.
2295         https://bugs.webkit.org/show_bug.cgi?id=153549
2296
2297         Reviewed by Darin Adler.
2298
2299         Add a flag to ResourceLoaderOptions which allow loader clients to opt out of having
2300         resources stored in the MemoryCache. 
2301
2302         * loader/ResourceLoaderOptions.h:
2303         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions):
2304         (WebCore::ResourceLoaderOptions::cachingPolicy):
2305
2306         Existing clients will have to add the (default) AllowCaching flag when they create a
2307         ResourceLoaderOptions object.
2308
2309         * loader/DocumentLoader.cpp:
2310         (WebCore::DocumentLoader::startLoadingMainResource):
2311         * loader/MediaResourceLoader.cpp:
2312         (WebCore::MediaResourceLoader::start):
2313         * loader/NetscapePlugInStreamLoader.cpp:
2314         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
2315         (WebCore::ResourceLoaderOptions::setCachingPolicy):
2316         * loader/icon/IconLoader.cpp:
2317         (WebCore::IconLoader::startLoading):
2318         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2319         (WebCore::WebCoreAVFResourceLoader::startLoading):
2320
2321         Every time the CachedResource or CachedResourceLoader accesses the MemoryCache, check
2322         to see whether the resource or the request have allowed caching before adding resources
2323         to, removing resources from, or sourcing resource data from the MemoryCache.
2324
2325         * loader/cache/CachedResource.cpp:
2326         (WebCore::CachedResource::~CachedResource):
2327         (WebCore::CachedResource::failBeforeStarting):
2328         (WebCore::CachedResource::addClientToSet):
2329         (WebCore::CachedResource::removeClient):
2330         (WebCore::CachedResource::setDecodedSize):
2331         (WebCore::CachedResource::setEncodedSize):
2332         (WebCore::CachedResource::didAccessDecodedData):
2333         * loader/cache/CachedResource.h:
2334         (WebCore::CachedResource::allowsCaching):
2335         * loader/cache/CachedResourceLoader.cpp:
2336         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2337         (WebCore::CachedResourceLoader::requestResource):
2338         (WebCore::CachedResourceLoader::revalidateResource):
2339         (WebCore::CachedResourceLoader::loadResource):
2340         (WebCore::CachedResourceLoader::printPreloadStats):
2341         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
2342         * loader/cache/CachedResourceRequest.h:
2343         (WebCore::CachedResourceRequest::allowsCaching):
2344
2345 2016-01-28  Enrica Casucci  <enrica@apple.com>
2346
2347         Should avoid navigation for some data detector urls.
2348         https://bugs.webkit.org/show_bug.cgi?id=153600
2349
2350         Reviewed by Tim Horton.
2351
2352         Adding helper function to decide whether the default action should be performed.
2353
2354         * editing/cocoa/DataDetection.h:
2355         * editing/cocoa/DataDetection.mm:
2356         (WebCore::DataDetection::shouldCancelDefaultAction):
2357
2358 2016-01-28  Dave Hyatt  <hyatt@apple.com>
2359
2360         Roll out r194555, as it introduced some bad regressions and was not
2361         correct.
2362
2363         * rendering/RenderText.cpp:
2364         (WebCore::RenderText::computePreferredLogicalWidths):
2365
2366 2016-01-28  Brady Eidson  <beidson@apple.com>
2367
2368         Modern IDB: Index uniqueness broken in the SQLite backend.
2369         https://bugs.webkit.org/show_bug.cgi?id=153596
2370
2371         Reviewed by Alex Christensen.
2372
2373         No new tests (Many failing tests now pass, others improve).
2374
2375         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2376         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
2377         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
2378         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey):
2379         (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
2380         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
2381         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
2382         (WebCore::IDBServer::SQLiteIDBBackingStore::updateIndexesForAddRecord): Deleted.
2383         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
2384
2385 2016-01-08  Jer Noble  <jer.noble@apple.com>
2386
2387         Custom protocol loading through AVFoundation does not support byte-range requests.
2388         https://bugs.webkit.org/show_bug.cgi?id=152919
2389         <rdar://problem/23664657>
2390
2391         Reviewed by Alex Christensen.
2392
2393         Tests: http/tests/xmlhttprequest/blob-request-byte-range.html
2394                TestWebkitAPI/Tests/WebCore/ParsedContentRange.cpp
2395
2396         When loading data through the AVAssetResourceLoaderDelegateProtocol, AVFoundation will issue
2397         requests for specific byte-ranges by adding a "Range:" HTTP header to the NSURLRequest it
2398         passes to the delegate.  WebCore ignores this header, loads the entire resource, and replies
2399         to the callback with the requested subset of the entire resource.
2400
2401         For byte-range requests near the end of a resource, this is inefficient, as the entire
2402         resource up to, and including, the requested range must be loaded before any data can be
2403         returned. Explicitly handle byte-range requests by creating a CachedResourceRequest with the
2404         underlying NSURLRequest (which includes the "Range:" header) rather than just the request's
2405         URL. BlobResourceHandle must be modified to add the "Content-Range:" response header to the
2406         ResourceResponse. 
2407
2408         To facilitate both generating and parsing the "Content-Range:" header, add a new
2409         ParsedContentRange class for use by ResourceResponse and its clients. This class provides
2410         methods both for parsing a "Content-Range" header value string, and for generating the
2411         header value from elemental values.
2412
2413         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2414         (WebCore::WebCoreAVFResourceLoader::startLoading):
2415         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2416         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
2417         * platform/network/BlobResourceHandle.cpp:
2418         (WebCore::BlobResourceHandle::BlobResourceHandle):
2419         (WebCore::BlobResourceHandle::didGetSize):
2420         (WebCore::BlobResourceHandle::seek):
2421         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
2422         * platform/network/BlobResourceHandle.h:
2423         * platform/network/HTTPHeaderNames.in:
2424         * platform/network/ParsedContentRange.cpp: Added.
2425         (WebCore::areContentRangeValuesValid):
2426         (WebCore::parseContentRange):
2427         (WebCore::ParsedContentRange::ParsedContentRange):
2428         (WebCore::ParsedContentRange::headerValue):
2429         * platform/network/ParsedContentRange.h: Added.
2430         (WebCore::ParsedContentRange::ParsedContentRange):
2431         (WebCore::ParsedContentRange::isValid):
2432         (WebCore::ParsedContentRange::firstBytePosition):
2433         (WebCore::ParsedContentRange::lastBytePosition):
2434         (WebCore::ParsedContentRange::instanceLength):
2435         * platform/network/ResourceResponseBase.cpp:
2436         (WebCore::ResourceResponseBase::updateHeaderParsedState):
2437         (WebCore::parseContentRangeInHeader):
2438         (WebCore::ResourceResponseBase::contentRange):
2439         * platform/network/ResourceResponseBase.h:
2440         * CMakeLists.txt:
2441         * WebCore.vcxproj/WebCore.vcxproj:
2442         * WebCore.vcxproj/WebCore.vcxproj.filters:
2443         * WebCore.xcodeproj/project.pbxproj:
2444
2445 2016-01-28  Chris Dumez  <cdumez@apple.com>
2446
2447         Storage interface's attributes / operations should be enumerable
2448         https://bugs.webkit.org/show_bug.cgi?id=153573
2449
2450         Reviewed by Darin Adler.
2451
2452         Storage interface's attributes / operations should be enumerable:
2453         - https://html.spec.whatwg.org/#the-storage-interface
2454
2455         Firefox matches the specification.
2456
2457         No new tests, already covered by existing test.
2458
2459         * storage/Storage.idl:
2460
2461 2016-01-26  Ada Chan  <adachan@apple.com>
2462
2463         Get WebVideoFullscreenManager and related classes to also compile for Mac platform
2464         with video presentation mode support.
2465         https://bugs.webkit.org/show_bug.cgi?id=153221
2466
2467         Reviewed by Eric Carlson.
2468
2469         No new tests, no actual behavior change with a stub implementation of WebVideoFullscreenInterfaceMac.
2470
2471         * WebCore.xcodeproj/project.pbxproj:
2472         Add PlatformView.h, WebVideoFullscreenChangeObserver.h, and WebVideoFullscreenInterfaceMac.h.
2473
2474         * html/HTMLMediaElement.cpp:
2475         (WebCore::HTMLMediaElement::HTMLMediaElement):
2476         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated):
2477         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction):
2478         * html/HTMLMediaElement.h:
2479         Enable the code that deals with the video fullscreen layer also for Mac platform with
2480         video presentation mode support.
2481
2482         * platform/cocoa/PlatformView.h:
2483         Header file for declaring the view types for each Cocoa platform.
2484
2485         * platform/cocoa/WebVideoFullscreenChangeObserver.h:
2486         (WebCore::WebVideoFullscreenChangeObserver::~WebVideoFullscreenChangeObserver):
2487         Interface declaration moved from WebVideoFullscreenInterfaceAVKit.h.
2488
2489         * platform/cocoa/WebVideoFullscreenInterface.h:
2490         Stop guarding the declaration of WebVideoFullscreenInterface to be iOS specific. It is now
2491         enabled for iOS and Mac platform with video presentation mode support.
2492
2493         * platform/cocoa/WebVideoFullscreenModel.h:
2494         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2495         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2496         Enable also for Mac platform with video presentation mode support.
2497         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer):
2498         Set the video fullscreen layer's anchor point to (0, 0) since we are not changing the position of
2499         the video layer on Mac.
2500
2501         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2502         Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.
2503         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2504         Move the declaration of WebVideoFullscreenChangeObserver to a separate header.
2505         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2506         Import WebVideoFullscreenChangeObserver.h now that the interface declaration has been moved to that file.
2507
2508         * platform/mac/WebVideoFullscreenInterfaceMac.h: Added.
2509         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2510         (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
2511         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
2512         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver):
2513         (WebCore::WebVideoFullscreenInterfaceMac::resetMediaState):
2514         (WebCore::WebVideoFullscreenInterfaceMac::setDuration):
2515         (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
2516         (WebCore::WebVideoFullscreenInterfaceMac::setBufferedTime):
2517         (WebCore::WebVideoFullscreenInterfaceMac::setRate):
2518         (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions):
2519         (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
2520         (WebCore::WebVideoFullscreenInterfaceMac::setCanPlayFastReverse):
2521         (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions):
2522         (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions):
2523         (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback):
2524         (WebCore::WebVideoFullscreenInterfaceMac::setWirelessVideoPlaybackDisabled):
2525         (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen):
2526         (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen):
2527         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen):
2528         (WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen):
2529         (WebCore::WebVideoFullscreenInterfaceMac::invalidate):
2530         (WebCore::WebVideoFullscreenInterfaceMac::requestHideAndExitFullscreen):
2531         (WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline):
2532         (WebCore::WebVideoFullscreenInterfaceMac::setMode):
2533         (WebCore::WebVideoFullscreenInterfaceMac::clearMode):
2534         (WebCore::WebVideoFullscreenInterfaceMac::mayAutomaticallyShowVideoPictureInPicture):
2535         (WebCore::WebVideoFullscreenInterfaceMac::applicationDidBecomeActive):
2536         (WebCore::supportsPictureInPicture):
2537         Add a stub implementation of WebVideoFullscreenInterfaceMac.
2538
2539 2016-01-28  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
2540
2541         [SVG] Add support for 'lighter' operator in feComposite
2542         https://bugs.webkit.org/show_bug.cgi?id=141376
2543
2544         Reviewed by Darin Adler.
2545
2546         Added new cases where needed to support the lighter (aka 'plus')
2547         Porter Duff operator in SVG Filter Effects.
2548         https://www.w3.org/TR/filter-effects/#valdef-operator-lighter
2549         Note that in the specification, no constant was added to the IDL for
2550         the lighter operator. 
2551
2552         Test: svg/filters/feCompositeOpaque.html
2553               svg/dom/script-tests/SVGAnimatedEnumeration-SVGFECompositeElement.js
2554
2555         * platform/graphics/filters/FEComposite.cpp:
2556         (WebCore::FEComposite::platformApplySoftware):
2557           Add case to support lighter.
2558         (WebCore::operator<<):
2559           Add case to support lighter for text stream operations.
2560         * platform/graphics/filters/FEComposite.h:
2561           Add case for lighter to CompositeOperationType enum.
2562         * svg/SVGFECompositeElement.h:
2563         (WebCore::SVGIDLEnumLimits<CompositeOperationType>::highestExposedEnumValue):
2564           Higest exposed value is arithmetic - do not expose lighter.
2565         (WebCore::SVGPropertyTraits<CompositeOperationType>::highestEnumValue):
2566           Highest possible value is now lighter.
2567         (WebCore::SVGPropertyTraits<CompositeOperationType>::toString):
2568           Add case to support lighter.
2569         (WebCore::SVGPropertyTraits<CompositeOperationType>::fromString):
2570           Add case to support lighter.
2571
2572 2016-01-28  Darin Adler  <darin@apple.com>
2573
2574         Remove equalIgnoringCase since all callers really wanted equalIgnoringASCIICase
2575         https://bugs.webkit.org/show_bug.cgi?id=153411
2576
2577         Reviewed by Ryosuke Niwa.
2578
2579         Tests: fast/media/media-query-non-ASCII-case-folding.html
2580                fast/dom/HTMLAnchorElement/anchor-non-ASCII-case-folding.html
2581                fast/xpath/xpath-non-ASCII-case-folding.html
2582
2583         No tests included that cover the minor behavior changes in Document::setDomain,
2584         CSPSource::schemeMatches, CSPSource::hostMatches, OriginAccessEntry::operator==,
2585         UserContentURLPattern::matches, UserContentURLPattern::matchesHost,
2586         ContentFilterUnblockHandler::canHandleRequest. Would like to add tests for those
2587         if possible, but it seems clear all are progressions.
2588
2589         For background on why this is the right thing to do in almost every case:
2590
2591         - MIME types are all ASCII and not case sensitive (details in RFC 2045)
2592           <http://tools.ietf.org/html/rfc2045>
2593         - case insensitive comparisons in HTML are all "ASCII case-insensitive"
2594           https://www.w3.org/TR/html/infrastructure.html#ascii-case-insensitive
2595         - same for CSS
2596
2597         * Modules/webdatabase/DatabaseAuthorizer.cpp:
2598         (WebCore::DatabaseAuthorizer::denyBasedOnTableName): Use equalIgnoringASCIICase.
2599         No change in behavior since the string we are comparing with is always
2600         "__WebKitDatabaseInfoTable__" in practice.
2601
2602         * accessibility/AccessibilityNodeObject.cpp:
2603         (WebCore::siblingWithAriaRole): Changed argument type to take a const char*,
2604         added some FIXMEs and use equalIgnoringCase. No change in behavior since the
2605         strings we are comparing with are "menu" and "menuitem".
2606         (WebCore::AccessibilityNodeObject::menuElementForMenuButton): Updated to pass
2607         arguments in reverse order.
2608         (WebCore::AccessibilityNodeObject::menuItemElementForMenu): Ditto.
2609
2610         * css/CSSParser.cpp:
2611         (WebCore::CSSParser::parseFontFaceValue): Use equalIgnoringASCIICase.
2612         No change in behavior because the property names are all ASCII constants.
2613
2614         * css/CSSParserValues.h: Removed unused equalIgnoringCase function.
2615
2616         * css/MediaQueryEvaluator.cpp:
2617         (WebCore::MediaQueryEvaluator::mediaTypeMatch): Use equalIgnoringASCIICase.
2618         Changes behavior: No non-ASCII case folding when matching media types.
2619         Covered by new test.
2620         (WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Use equalIgnoringASCIICase.
2621         No change in behavior since the only string this is ever called with is "print".
2622
2623         * dom/DataTransfer.cpp:
2624         (WebCore::DataTransfer::hasFileOfType): Use equalIgnoringASCIICase.
2625         No change in behavior because local files will not have content types with
2626         non-ASCII characters in them. In the extremely unlikely case that this is incorrect,
2627         the change in behavior is a progression.
2628
2629         * dom/Document.cpp:
2630         (WebCore::Document::setDomain): Use equalIgnoringASCIICase.
2631         Changes behavior: Domains considered equal because of non-ASCII case folding
2632         would get through without an error before, and now will properly throw an exception.
2633
2634         * dom/Element.cpp:
2635         (WebCore::isStyleAttribute): Refactored into a helper function. Use
2636         equalLettersIgnoringASCIICase. No change in behavior.
2637         (WebCore::Element::synchronizeAttribute): Use isStyleAttribute.
2638
2639         * dom/TreeScope.cpp:
2640         (WebCore::TreeScope::findAnchor): Use equalIgnoringASCIICase.
2641         Changes behavior: Could go to an anchor and it would be considered a match because
2642         of non-ASCII case folding. Covered by new test.
2643
2644         * html/HiddenInputType.cpp:
2645         (WebCore::HiddenInputType::appendFormData): Use equalIgnoringASCIICase.
2646         No change in behavior: comparing with an ASCII literal.
2647         * html/canvas/WebGL2RenderingContext.cpp:
2648         (WebCore::WebGL2RenderingContext::getExtension): Ditto.
2649         * html/canvas/WebGLRenderingContext.cpp:
2650         (WebCore::WebGLRenderingContext::getExtension): Ditto.
2651
2652         * html/parser/CSSPreloadScanner.cpp:
2653         (WebCore::CSSPreloadScanner::emitRule): Use equalLettersIgnoringASCIICase and
2654         StringView to avoid needing a special ruleEqualIgnoringCase function.
2655         No change in behavior.
2656
2657         * inspector/InspectorNodeFinder.cpp:
2658         (WebCore::InspectorNodeFinder::matchesElement): Use equalIgnoringASCIICase.
2659         Changes behavior, but it's an inspector UI thing, not a web behavior thing,
2660         so I don't think a new regression test is needed.
2661
2662         * loader/HistoryController.cpp:
2663         (WebCore::HistoryController::currentItemShouldBeReplaced): Use
2664         equalIgnoringASCIICase. No change in behavior because we are comparing
2665         with "about:blank".
2666
2667         * loader/SubframeLoader.cpp:
2668         (WebCore::findPluginMIMETypeFromURL): Use equalIgnoringASCIICase.
2669         No change in behavior unless a plug-in claims an extension with non-ASCII
2670         characters. I don't think a new regression test is needed.
2671
2672         * loader/appcache/ApplicationCacheHost.cpp:
2673         (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache):
2674         Use equalIgnoringASCIICase. No change in behavior because both strings are
2675         protocols from URLs and we don't parse non-ASCII characters into protocol strings;
2676         non-ASCII are already encoding as punycode.
2677         * loader/appcache/ManifestParser.cpp:
2678         (WebCore::parseManifest): Ditto.
2679
2680         * page/ContentSecurityPolicy.cpp:
2681         (WebCore::isExperimentalDirectiveName): Added. Used by isDirectiveName.
2682         Uses equalLettersIgnoringASCIICase. No change in behavior.
2683         (WebCore::isDirectiveName): Use equalLettersIgnoringASCIICase.
2684         No change in behavior.
2685         (WebCore::isSourceListNone): Use equalLettersIgnoringASCIICase. No
2686         change in behavior.
2687         (WebCore::CSPSource::schemeMatches): Use equalLettersIgnoringASCIICase
2688         and equalIgnoringASCIICase. It's all about comparing URL protocols. The
2689         old code might have done something strange if someone specified a protocol
2690         with a non-ASCII character in it.
2691         (WebCore::CSPSource::hostMatches): Use equalIgnoringASCIICase.
2692         (WebCore::CSPSourceList::parseSource): Use equalLettersIgnoringASCIICase.
2693         No change in behavior.
2694         (WebCore::CSPDirectiveList::checkSourceAndReportViolation): Tweaked code
2695         to do less unnecessary String allocation.
2696         (WebCore::CSPDirectiveList::parseReflectedXSS): Use
2697         equalLettersIgnoringASCIICase. No change in behavior.
2698         (WebCore::CSPDirectiveList::addDirective): Ditto.
2699         (WebCore::ContentSecurityPolicy::reportUnsupportedDirective): Use
2700         equalLettersIgnoringASCIICase and remove unneeded global constant strings.
2701         No change in behavior.
2702         (WebCore::ContentSecurityPolicy::reportDirectiveAsSourceExpression):
2703         Tweak code to eliminate unneeded local.
2704         (WebCore::ContentSecurityPolicy::reportDuplicateDirective): Ditto.
2705         (WebCore::ContentSecurityPolicy::reportInvalidSourceExpression): Use
2706         equalLettersIgnoringASCIICase. No change in behavior.
2707
2708         * page/OriginAccessEntry.h:
2709         (WebCore::operator==): Use equalLettersIgnoringASCIICase.
2710
2711         * page/Performance.cpp:
2712         (WebCore::Performance::webkitGetEntriesByName): Use equalLettersIgnoringASCIICase.
2713         No change in behavior.
2714
2715         * page/UserContentURLPattern.cpp:
2716         (WebCore::UserContentURLPattern::matches): Use equalIgnoringASCIICase to match
2717         schemes.
2718         (WebCore::UserContentURLPattern::matchesHost): Use equalIgnoringASCIICase to
2719         match host names.
2720
2721         * platform/URL.cpp:
2722         (WebCore::URL::init): Use equalIgnoringASCIICase, and also use StringView to
2723         avoid having to allocate a second string just for comparison purposes. Should be
2724         better for efficiency with no change in behavior.
2725
2726         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
2727         (WebCore::ContentFilterUnblockHandler::canHandleRequest): Use equalIgnoringASCIICase
2728         to compare hosts.
2729
2730         * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp:
2731         (WebCore::PlatformSpeechSynthesisProviderEfl::voiceName): Use StringView and
2732         equalIgnoringASCIICase to compare language tags. No test needed because there are
2733         no language tags with non-ASCII characters in them.
2734
2735         * platform/graphics/FontCache.cpp:
2736         (WebCore::FontPlatformDataCacheKey::operator==): Changed to use the equal
2737         function from CaseFoldingHash. In a subsequent patch we will change this to be
2738         ASCIICaseFoldingHash since font names don't need to compare non-ASCII characters
2739         in a case folding manner, but for now preserve behavior.
2740         (WebCore::alternateFamilyName): Use equalLettersIgnoringASCIICase to avoid having
2741         to use a special familyNameEqualIgnoringCase function. This does mean there will
2742         be a null check and a length check that wasn't there before, but the actual
2743         comparison function will be tighter. Guessing it will be a wash. Also improved
2744         the comments and sorted the Windows cases in with the others. No behavior change.
2745
2746         * platform/graphics/FontCascade.cpp:
2747         (WebCore::operator==): Changed to use the equal function from CaseFoldingHash.
2748         Same rationale as above in FontPlatformDataCacheKey.
2749
2750         * platform/graphics/FontDescription.cpp:
2751         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
2752         equalIgnoringASCIICase to compare font family names. Only possible change in
2753         behavior would be if actual fonts with non-ASCII names but that were specified
2754         with different case in style sheets. Highly unlikely this exists.
2755
2756         * platform/graphics/MediaPlayer.cpp:
2757         (WebCore::MediaPlayer::supportsType): Use equalLettersIgnoringASCIICase.
2758         No change in behavior.
2759         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2760         (WebCore::keySystemIsSupported): Ditto.
2761
2762         * platform/graphics/freetype/FontCacheFreeType.cpp:
2763         (WebCore::isCommonlyUsedGenericFamily): Added.
2764         (WebCore::FontCache::createFontPlatformData): Moved code into the
2765         isCommonlyUsedGenericFamily helper and used equalIgnoringASCIICase.
2766
2767         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
2768         (WebCore::FontCustomPlatformData::supportsFormat): Use
2769         equalLettersIgnoringASCIICase. No change in behavior.
2770         * platform/graphics/win/FontCacheWin.cpp:
2771         (WebCore::adjustedGDIFontWeight): Ditto.
2772         (WebCore::FontCache::createFontPlatformData): Ditto.
2773         * platform/graphics/win/FontCustomPlatformData.cpp:
2774         (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
2775         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
2776         (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
2777
2778         * platform/mac/PlatformSpeechSynthesizerMac.mm:
2779         (-[WebSpeechSynthesisWrapper speakUtterance:]): Use equalIgnoringASCIICase to
2780         compare languages. No change in behavior because languages have all-ASCII names.
2781
2782         * platform/network/CacheValidation.cpp:
2783         (WebCore::shouldUpdateHeaderAfterRevalidation): Use equalIgnoringASCIICase.
2784         No change in behavior since it's a fixed list of all ASCII headers.
2785         * platform/network/curl/ResourceHandleManager.cpp:
2786         (WebCore::isAppendableHeader): Ditto.
2787
2788         * platform/network/mac/ResourceHandleMac.mm:
2789         (WebCore::ResourceHandle::willSendRequest): Use equalIgnoringASCIICase.
2790         No change in behavior because HTTP methods are all ASCII letters.
2791
2792         * platform/text/mac/LocaleMac.mm:
2793         (WebCore::determineLocale): Use equalIgnoringASCIICase. No change in behavior
2794         because locale languages identifiers are all ASCII.
2795         * platform/text/win/LocaleWin.cpp:
2796         (WebCore::LCIDFromLocaleInternal): Ditto.
2797
2798         * svg/SVGToOTFFontConversion.cpp:
2799         (WebCore::SVGToOTFFontConverter::appendArabicReplacementSubtable):
2800         Use equalIgnoringASCIICase. No change in behavior because Arabic form attribute
2801         values are all ASCII.
2802
2803         * xml/XMLHttpRequest.cpp:
2804         (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod): Use equalIgnoringASCIICase.
2805         No change in behavior because these are all fixed known ASCII HTTP method names.
2806
2807         * xml/XPathFunctions.cpp:
2808         (WebCore::XPath::FunLang::evaluate): Use equalIgnoringASCIICase. Changes behavior
2809         if specifying a non-ASCII character. Covered by new test.
2810
2811         * xml/XPathStep.cpp:
2812         (WebCore::XPath::nodeMatchesBasicTest): Use equalIgnoringASCIICase. Changes
2813         behavior if an element local name or XPath predicate has a non-ASCII character.
2814         Covered by new test.
2815
2816 2016-01-28  Zalan Bujtas  <zalan@apple.com>
2817
2818         Unexpected content wrapping at http://email.osh.com/H/2/v100000152474feb8ec7c1a1f4bbe5c7c0/HTML
2819         https://bugs.webkit.org/show_bug.cgi?id=153430
2820
2821         Reviewed by Simon Fraser.
2822
2823         Ensure that min/max preferred and computed widths never shrink while converting LayoutUnit to float and back.
2824
2825         Test: fast/table/fixed-size-table-with-fixed-size-content.html
2826
2827         * rendering/AutoTableLayout.cpp:
2828         (WebCore::AutoTableLayout::recalcColumn):
2829         (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
2830         (WebCore::AutoTableLayout::layout):
2831         * rendering/RenderBlock.cpp:
2832         (WebCore::RenderBlock::computePreferredLogicalWidths): Deleted.
2833
2834 2016-01-28  Gwang Yoon Hwang  <yoon@igalia.com>
2835
2836         [GStreamer] Clean up includes and headers related with GStreamerGL
2837         https://bugs.webkit.org/show_bug.cgi?id=153590
2838
2839         Reviewed by Philippe Normand.
2840
2841         Remove gstglmemory from the including list and reorder includes to
2842         organize GSTREAMER_GL related headers. It violates style rules of the
2843         include order, but there is no clean way to include gst/gl/gl.h
2844         without violating it.
2845
2846         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2847         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2848
2849 2016-01-28  Gwang Yoon Hwang  <yoon@igalia.com>
2850
2851         [GStreamer] MediaPlayerPrivateGStreamerBase::handleSyncMessage leaks GstContext
2852         https://bugs.webkit.org/show_bug.cgi?id=153580
2853
2854         Reviewed by Philippe Normand.
2855
2856         When we creates GstContext using gst_context_new it increases refcount itself.
2857         And the refcount of GstContext is increased when it is passed to
2858         gst_element_set_context, also. Therefore We should unref GstContext after
2859         using it to prevent GstContext leaks.
2860
2861         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2862         (WTF::adoptGRef): Added for GstContext.
2863         (WTF::refGPtr<GstContext>): Ditto
2864         (WTF::derefGPtr<GstContext>): Ditto
2865         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2866         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2867         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2868         Use GRefPtr<GstContext> to handle currect refcounting
2869
2870 2016-01-27  Alex Christensen  <achristensen@webkit.org>
2871
2872         Fix clean CMake build after r195711.
2873
2874         * PlatformWin.cmake:
2875         Copy forwarding headers from the new directory to find ContentSecurityPolicy.h.
2876         This should fix EWS issues like the one seen in bug 153573.
2877
2878 2016-01-27  Chris Dumez  <cdumez@apple.com>
2879
2880         Expose ValidityState on the global Window object
2881         https://bugs.webkit.org/show_bug.cgi?id=153582
2882
2883         Reviewed by Antti Koivisto.
2884
2885         Expose ValidityState on the global Window object:
2886         https://html.spec.whatwg.org/#validitystate
2887
2888         Firefox and Chrome match the specification.
2889
2890         No new tests, already covered by existing tests.
2891
2892         * html/ValidityState.idl:
2893
2894 2016-01-27  Chris Dumez  <cdumez@apple.com>
2895
2896         Expose ApplicationCache on the global Window object
2897         https://bugs.webkit.org/show_bug.cgi?id=153578
2898
2899         Reviewed by Antti Koivisto.
2900
2901         Expose ApplicationCache on the global Window object as per:
2902         https://html.spec.whatwg.org/#the-storage-interface
2903
2904         Chrome follows the spec.
2905
2906         No new tests, already covered by existing test.
2907
2908         * loader/appcache/DOMApplicationCache.idl:
2909
2910 2016-01-27  Ryosuke Niwa  <rniwa@webkit.org>
2911
2912         REGRESSION(r190430): Assertion failure in Text::~Text()
2913         https://bugs.webkit.org/show_bug.cgi?id=153577
2914
2915         Reviewed by Antti Koivisto.
2916
2917         The bug was caused by destroyRenderTreeIfNeeded exiting early on all HTMLSlotElement as it lacks a render object.
2918         Fixed it by explicitly avoiding the early return when child is a HTMLSlotElement.
2919
2920         Test: fast/shadow-dom/slot-removal-crash-2.html
2921
2922         * dom/ContainerNode.cpp:
2923         (WebCore::destroyRenderTreeIfNeeded):
2924
2925 2016-01-27  Said Abou-Hallawa  <sabouhallawa@apple.com>
2926
2927         Garbage is displayed when root svg element has mix-blend-mode set
2928         https://bugs.webkit.org/show_bug.cgi?id=150556
2929
2930         Reviewed by Darin Adler.
2931
2932         This bug happens when compositing on a CALayer and drawing on a transparent
2933         layer, so it happens with WK2 with <svg style="mix-blend-mode...">. And it
2934         can happen with WK1 also with <svg style="opacity=...;mix-blend-mode...">.
2935         But in both cases, the SVG root renderer should be the root of the render
2936         tree. So it happens only with the stand alone SVG documents.
2937
2938         SVGRenderContext::prepareToRenderSVGContent() ignores the opacity of
2939         the SVG root but it creates a transparent layer for the blend-mode.
2940
2941         But RenderLayer::beginTransparencyLayers() creates a transparent layer
2942         for opacity and it sets the blend-mode also.
2943
2944         The fix is to begin two transparent layers for the SVG root renderer: one
2945         for the opacity and the second for the blend-mode. The opacity transparent
2946         layer will be still managed by RenderLayer::beginTransparencyLayers(). While
2947         the blend-mode transparent layer will be managed by SVGRenderContext
2948         ::prepareToRenderSVGContent().
2949
2950         Tests: svg/css/mix-blend-mode-background-root.svg
2951                svg/css/mix-blend-mode-opacity-root.svg
2952
2953         * rendering/RenderLayer.cpp:
2954         (WebCore::RenderLayer::beginTransparencyLayers):
2955
2956 2016-01-27  Enrica Casucci  <enrica@apple.com>
2957
2958         Cache results of data detection in the UI process when load completes.
2959         https://bugs.webkit.org/show_bug.cgi?id=153560
2960
2961         Reviewed by Tim Horton.
2962
2963         Adding new FrameLoaderClient method to notify that data
2964         detection is complete and provide the results.
2965
2966         * loader/EmptyClients.h:
2967         * loader/FrameLoader.cpp:
2968         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2969         * loader/FrameLoaderClient.h:
2970
2971 2016-01-27  Daniel Bates  <dabates@apple.com>
2972
2973         Move ContentSecurityPolicy.{cpp, h} to its own directory
2974         https://bugs.webkit.org/show_bug.cgi?id=153527
2975         <rdar://problem/24359892>
2976
2977         Reviewed by Sam Weinig.
2978
2979         Move ContentSecurityPolicy.{cpp, h} from Source/WebCore/page to Source/WebCore/page/csp.
2980         This will facilitate separating out the policy support classes (e.g. CSPDirectiveList)
2981         into their own files to improve the hackability of this code.
2982
2983         * CMakeLists.txt:
2984         * WebCore.vcxproj/WebCore.vcxproj:
2985         * WebCore.vcxproj/WebCore.vcxproj.filters:
2986         * WebCore.xcodeproj/project.pbxproj:
2987         * page/csp/ContentSecurityPolicy.cpp: Renamed from Source/WebCore/page/ContentSecurityPolicy.cpp.
2988         * page/csp/ContentSecurityPolicy.h: Renamed from Source/WebCore/page/ContentSecurityPolicy.h.
2989
2990 2016-01-27  Brady Eidson  <beidson@apple.com>
2991
2992         Modern IDB: Incorrect handling of iterating cursors to their end.
2993         https://bugs.webkit.org/show_bug.cgi?id=153569
2994
2995         Reviewed by Alex Christensen.
2996
2997         No new tests (3 tests now pass, others are closer to passing).
2998
2999         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3000         (WebCore::IDBServer::SQLiteIDBCursor::advance):
3001         (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
3002
3003 2016-01-27  Nan Wang  <n_wang@apple.com>
3004
3005         AX: Crash in AccessibilityTableColumn::headerObject
3006         https://bugs.webkit.org/show_bug.cgi?id=153553
3007         <rdar://problem/23196278>
3008
3009         Reviewed by Chris Fleizach.
3010
3011         Webkit was crashing sometimes when we asked for column headers of a table.
3012         The columns vector of the table was reset during the iteration when we
3013         were asking for the headerObject of each column. The column's addChildren()
3014         function calls elementRect() for each child cell and that sometimes causes 
3015         the parent table to reset its children.
3016         Fixed it by caching the columns vector and moving out the elementRect() logic
3017         from AccessibilityTalbeColumn::addChildren().  
3018
3019         * accessibility/AccessibilityTable.cpp:
3020         (WebCore::AccessibilityTable::columnHeaders):
3021         (WebCore::AccessibilityTable::rowHeaders):
3022         * accessibility/AccessibilityTableColumn.cpp:
3023         (WebCore::AccessibilityTableColumn::elementRect):
3024         (WebCore::AccessibilityTableColumn::headerObject):
3025         (WebCore::AccessibilityTableColumn::addChildren):
3026         * accessibility/AccessibilityTableColumn.h:
3027
3028 2016-01-27  Chris Dumez  <cdumez@apple.com>
3029
3030         Settings a reflected DOMString attribute to null should set it to the "null" string rather than the empty string
3031         https://bugs.webkit.org/show_bug.cgi?id=153504
3032         <rdar://problem/24353072>
3033
3034         Reviewed by Ryosuke Niwa.
3035
3036         Settings a reflected DOMString attribute to null should set it to the "null"
3037         string rather than the empty string:
3038         - https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes
3039         - http://heycam.github.io/webidl/#es-DOMString
3040         - http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring
3041
3042         Firefox and Chrome match the specification here.
3043
3044         This is causing a lot of W3C HTML reflection tests to fail on WebKit, e.g.:
3045         - http://w3c-test.org/html/dom/reflection-text.html
3046
3047         No new tests, already covered by existing tests.
3048
3049         * bindings/scripts/CodeGeneratorJS.pm:
3050         (JSValueToNative):
3051         Call toString() instead of valueToStringWithNullCheck() for reflected
3052         attributes. This way, null gets converted to the string "null", as
3053         expected, instead of a null String object.
3054
3055         * html/HTMLInputElement.idl:
3056         Dropping [TreatNullAs=NullString] IDL extended attribute for
3057         input.defaultValue, as this is not present in the specification:
3058         - https://html.spec.whatwg.org/#htmlinputelement
3059
3060         Without this change, assigning null to input.defaultValue would not
3061         set to to the "null" string, as is expected.
3062
3063         * html/HTMLTextAreaElement.idl:
3064         Dropping [TreatNullAs=NullString] IDL extended attribute for
3065         textArea.defaultValue, as this is not present in the specification:
3066         - https://html.spec.whatwg.org/#htmltextareaelement
3067
3068         Without this change, assigning null to textArea.defaultValue would not
3069         set to to the "null" string, as is expected.
3070
3071         * html/HTMLTitleElement.idl:
3072         Dropping [TreatNullAs=NullString] IDL extended attribute for
3073         title.text, as this is not present in the specification:
3074         - https://html.spec.whatwg.org/#htmltitleelement
3075
3076         Without this change, assigning null to title.text would not
3077         set to to the "null" string, as is expected.
3078
3079 2016-01-27  Simon Fraser  <simon.fraser@apple.com>
3080
3081         Support CSS3 Images values for the image-rendering property
3082         https://bugs.webkit.org/show_bug.cgi?id=153556
3083
3084         Reviewed by Dean Jackson.
3085
3086         CSS3 Images has the following values for image-rendering:
3087             auto, crisp-edges, pixelated
3088
3089         The old code supported:
3090             optimizeSpeed, optimizeQuality, -webkit-crisp-edges, -webkit-optimize-contrast
3091
3092         Add support for the new values without prefixes. Map -webkit-crisp-edges to crisp-edges,
3093         and -webkit-optimize-contrast to crisp-edges. Support pixelated which behaves like 
3094         crisp-edges (a low quality scale).
3095
3096         The spec says that optimizeQuality should behave like 'auto', but that would be
3097         a behavior change since ImageQualityController::shouldPaintAtLowQuality() currently
3098         uses it as a trigger to avoid low quality scaling, so don't change that for now.
3099
3100         No new tests, covered by fast/css/script-tests/image-rendering-parsing.js
3101
3102         * css/CSSParser.cpp:
3103         (WebCore::isValidKeywordPropertyAndValue):
3104         * css/CSSPrimitiveValueMappings.h:
3105         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3106         (WebCore::CSSPrimitiveValue::operator EImageRendering):
3107         * css/CSSValueKeywords.in:
3108         * rendering/ImageQualityController.cpp:
3109         (WebCore::ImageQualityController::shouldPaintAtLowQuality):
3110         * rendering/RenderHTMLCanvas.cpp:
3111         (WebCore::RenderHTMLCanvas::paintReplaced):
3112         * rendering/style/RenderStyleConstants.h:
3113         * rendering/style/StyleRareInheritedData.h: Need another bit.
3114
3115 2016-01-27  Anders Carlsson  <andersca@apple.com>
3116
3117         Add WebKitAdditions extension points to WebCore, WebKit and WebKitLegacy
3118         https://bugs.webkit.org/show_bug.cgi?id=153550
3119
3120         Reviewed by Sam Weinig.
3121
3122         * DerivedSources.make:
3123         Add the ability for WebKitAdditions to add events and event targets.
3124
3125         * WebCore.xcodeproj/project.pbxproj:
3126         Add new files.
3127
3128         * bindings/scripts/InFilesCompiler.pm:
3129         (initializeFromCommandLine):
3130         (compile):
3131         Handle multiple --input parameters.
3132
3133         * dom/EventNames.h:
3134         Handle adding more event names.
3135
3136         * loader/EmptyClients.cpp:
3137         (WebCore::fillWithEmptyClients):
3138         * page/MainFrame.cpp:
3139         (WebCore::MainFrame::MainFrame):
3140         * page/MainFrame.h:
3141         * page/PageConfiguration.h:
3142         Add extension points.
3143
3144         * platform/cocoa/WebKitAdditions.mm: Added.
3145         Import additions.
3146
3147 2016-01-27  Brady Eidson  <beidson@apple.com>
3148
3149         Modern IDB: Fix many Index tests.
3150         https://bugs.webkit.org/show_bug.cgi?id=153561
3151
3152         Reviewed by Alex Christensen.
3153
3154         No new tests (Many failing tests now pass).
3155
3156         * Modules/indexeddb/server/MemoryIndex.cpp:
3157         (WebCore::IDBServer::MemoryIndex::getResultForKeyRange):
3158         
3159         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3160         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey):
3161         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
3162         (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord):
3163         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
3164         
3165         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3166         (WebCore::IDBServer::SQLiteIDBCursor::didComplete):
3167
3168 2016-01-27  Brady Eidson  <beidson@apple.com>
3169
3170         Modern IDB: Cursors are utterly broken in the SQLite backend.
3171         https://bugs.webkit.org/show_bug.cgi?id=153558
3172
3173         Reviewed by Alex Christensen.
3174
3175         No new tests (35 failures now pass, others improve).
3176
3177         - Fixes incorrect usage of Index cursors when ObjectStore cursors are intended.
3178         - Improves the state of getting the cursor value vs. reaching the end of a cursor.
3179
3180         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3181         (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor):
3182         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
3183
3184         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
3185         (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
3186         (WebCore::IDBServer::SQLiteIDBCursor::currentData):
3187         * Modules/indexeddb/server/SQLiteIDBCursor.h:
3188
3189 2016-01-27  Chris Dumez  <cdumez@apple.com>
3190
3191         Getting / Setting property on prototype object must throw TypeError
3192         https://bugs.webkit.org/show_bug.cgi?id=153547
3193         <rdar://problem/24370650>
3194
3195         Reviewed by Ryosuke Niwa.
3196
3197         Gettingi / Setting property on prototype object must throw TypeError as per
3198         Web IDL specification:
3199         http://heycam.github.io/webidl/#dfn-attribute-getter (Step 2.4.2)
3200         http://heycam.github.io/webidl/#dfn-attribute-setter (Step 3.5)
3201
3202         Firefox and Chrome already throw a TypeError in this case, as per
3203         the specification. However, WebKit was returning null and merely
3204         logging a deprecation error message. This patch aligns our behavior
3205         with other browsers and the specification.
3206
3207         This patch also adds support for the [LenientThis] IDL extended
3208         attribute:
3209         http://heycam.github.io/webidl/#LenientThis
3210
3211         For [LenientThis] attributes, we do not throw a TypeError if the
3212         attribute getter / setter is called on an object which does not
3213         implement the expected interface, as per:
3214         http://heycam.github.io/webidl/#dfn-attribute-getter (Step 2.4.1)
3215         http://heycam.github.io/webidl/#dfn-attribute-setter (Step 3.5)
3216
3217         No new tests, already covered by existing tests.
3218
3219         * bindings/scripts/CodeGeneratorJS.pm:
3220         (GenerateImplementation):
3221         * bindings/scripts/IDLAttributes.txt:
3222         Add support for [LenientThis]:
3223         http://heycam.github.io/webidl/#LenientThis
3224
3225         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
3226         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
3227         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3228         * bindings/scripts/test/JS/JSTestInterface.cpp:
3229         * bindings/scripts/test/JS/JSTestNode.cpp:
3230         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
3231         * bindings/scripts/test/JS/JSTestObj.cpp:
3232         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3233         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3234         * bindings/scripts/test/JS/JSattribute.cpp:
3235         * bindings/scripts/test/ObjC/DOMTestObj.h:
3236         * bindings/scripts/test/ObjC/DOMTestObj.mm:
3237         Rebaseline bindings tests.
3238
3239         * bindings/scripts/test/TestObj.idl:
3240         Add coverage for [LenientThis] attributes.
3241
3242         * dom/Document.idl:
3243         Mark 'onreadystatechange' as [LenientThis] as per the HTML
3244         specification:
3245         https://html.spec.whatwg.org/#document
3246
3247         * dom/GlobalEventHandlers.idl:
3248         Mark 'onmouseeneter' / 'onmouseleave' as [LenientThis] as per the
3249         HTML specification:
3250         https://html.spec.whatwg.org/#globaleventhandlers
3251
3252 2016-01-27  Chris Dumez  <cdumez@apple.com>
3253
3254         window.atob() should ignore spaces in input
3255         https://bugs.webkit.org/show_bug.cgi?id=153522
3256         <rdar://problem/24357822>
3257
3258         Reviewed by Benjamin Poulain.
3259
3260         window.atob() should ignore spaces in input as per:
3261         - https://html.spec.whatwg.org/#dom-windowbase64-atob (Step 3)
3262
3263         Previously, WebKit would throw an exception and it was the only browser
3264         to do so. Firefox and Chrome behavior according to the specification.
3265
3266         This was causing us to fail 10 checks in the following W3C HTML test:
3267         http://w3c-test.org/html/webappapis/atob/base64.html
3268
3269         No new tests, updated existing test.
3270
3271         * page/DOMWindow.cpp:
3272         (WebCore::DOMWindow::atob):
3273         * page/Page.cpp:
3274         (WebCore::Page::userStyleSheetLocationChanged):
3275         * platform/network/DataURL.cpp:
3276         (WebCore::handleDataURL):
3277         * platform/network/DataURLDecoder.cpp:
3278         (WebCore::DataURLDecoder::decodeBase64):
3279
3280 2016-01-27  Ada Chan  <adachan@apple.com>
3281
3282         Move some logic related to the presentation mode button from mediaControlsiOS.js to mediaControlsApple.js
3283         https://bugs.webkit.org/show_bug.cgi?id=153476
3284
3285         Reviewed by Eric Carlson.
3286
3287         Also, add the necessary styles to support that control in mediaControlsApple.css.
3288
3289         * Modules/mediacontrols/mediaControlsApple.css:
3290         (video::-webkit-media-controls-panel.picture-in-picture):
3291         (audio::-webkit-media-controls-wireless-playback-status.picture-in-picture):
3292         (audio::-webkit-media-controls-wireless-playback-text-top.picture-in-picture):
3293         (audio::-webkit-media-controls-wireless-playback-text-bottom.picture-in-picture):
3294         (video::-webkit-media-controls-panel .picture-in-picture-button):
3295         Use the same mask image as iOS, but with a different size and a background color specified
3296         (since there's another rule that makes buttons within the panel have a transparent
3297         background color).
3298         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture):
3299
3300         * Modules/mediacontrols/mediaControlsApple.js:
3301         (Controller.prototype.addVideoListeners):
3302         (Controller.prototype.removeVideoListeners):
3303         Listen for (and stop listening for) the webkitpresentationmodechanged event if presentation
3304         mode is supported for this video element.
3305         (Controller.prototype.createControls):
3306         Add a class name to the pictureInPictureButton so we can query for it in the stylesheet.
3307         (Controller.prototype.configureInlineControls):
3308         Call updatePictureInPictureButton().
3309         (Controller.prototype.presentationMode):
3310         Moved from mediaControlsiOS.js.
3311         (Controller.prototype.isFullScreen):
3312         Ditto, with a bug fix to not call presentationMode(), since that method calls isFullScreen(),
3313         resulting in infinite recursion.
3314         (Controller.prototype.updatePictureInPictureButton):
3315         Ditto.
3316         (Controller.prototype.handlePresentationModeChange):
3317         Ditto.
3318         (Controller.prototype.handleFullscreenChange):
3319         Call handlePresentationModeChanged() if presentation mode is supported for this video element.
3320         (Controller.prototype.controlsAlwaysVisible):
3321         Ditto.
3322         (Controller.prototype.handlePictureInPictureButtonClicked):
3323         Ditto.
3324         * Modules/mediacontrols/mediaControlsiOS.js:
3325         (ControllerIOS.prototype.handlePresentationModeChange):
3326         Most logic has been moved to the same method in mediaControlsApple.js, except
3327         updating the style of the panelContainer, which doesn't exist in the Mac controls.
3328         (ControllerIOS.prototype.addVideoListeners): Deleted.
3329         (ControllerIOS.prototype.removeVideoListeners): Deleted.
3330         (ControllerIOS.prototype.presentationMode): Deleted.
3331         (ControllerIOS.prototype.isFullScreen): Deleted.
3332         (ControllerIOS.prototype.handlePictureInPictureButtonClicked): Deleted.
3333         (ControllerIOS.prototype.updatePictureInPictureButton): Deleted.
3334         (ControllerIOS.prototype.handleFullscreenChange): Deleted.
3335         (ControllerIOS.prototype.controlsAlwaysVisible): Deleted.
3336         Delete all code that's already handled in the Controller.
3337
3338 2016-01-26  Ada Chan  <adachan@apple.com>
3339
3340         Enable API related to the video fullscreen layer in MediaPlayerPrivateMediaSourceAVFObjC
3341         also on Mac platform with video presentation mode support.
3342         https://bugs.webkit.org/show_bug.cgi?id=153223
3343
3344         Reviewed by Jer Noble.
3345
3346         Reuse VideoFullscreenLayerManager to manage moving the video layer between the fullscreen
3347         layer and the inline layer depending on the current presentation mode.
3348
3349         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3350         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3351         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
3352         Create m_videoFullscreenLayerManager.
3353         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer):
3354         Return the video inline layer from the VideoFullscreenLayerManager.
3355         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer):
3356         Call VideoFullscreenLayerManager::setVideoLayer() with the m_sampleBufferDisplayLayer.
3357         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeDisplayLayer):
3358         Call VideoFullscreenLayerManager::didDestroyVideoLayer().
3359         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
3360         Call VideoFullscreenLayerManager::setVideoFullscreenLayer().
3361         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
3362         Call VideoFullscreenLayerManager::setVideoFullscreenFrame().
3363
3364 2016-01-27  Brady Eidson  <beidson@apple.com>
3365
3366         Modern IDB: SQLite backend doesn't update index records as object records are added.
3367         https://bugs.webkit.org/show_bug.cgi?id=153548
3368
3369         Reviewed by Alex Christensen.
3370
3371         No new tests (4 more tests pass, others improve).
3372
3373         * Modules/indexeddb/server/IDBBackingStore.h:
3374         
3375         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
3376         (WebCore::IDBServer::MemoryIDBBackingStore::addRecord):
3377         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
3378         
3379         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3380         (WebCore::IDBServer::SQLiteIDBBackingStore::initializeVM):
3381         (WebCore::IDBServer::SQLiteIDBBackingStore::vm):<