3a8aa885257e08b41cbb9e68d9f8d55a733cc2e2
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-04-21  Brady Eidson  <beidson@apple.com>
2
3         Modern IDB (Workers): Get the IDBConnectionProxy from the Document to the WorkerGlobalScope.
4         https://bugs.webkit.org/show_bug.cgi?id=156877
5
6         Reviewed by Tim Horton.
7
8         No new tests (Covered by changes to existing tests).
9
10         * workers/WorkerMessagingProxy.cpp:
11         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): This is the point on the main thread
12           where we can get the IDBConnectionProxy from the Document and pass it down through Worker
13           machinery so it can end up at the WorkerGlobalScope.
14         
15         Everything else is this patch is just passing it along as needed.
16
17         And cleaning up header style for neglected headers.
18
19         * workers/DedicatedWorkerGlobalScope.cpp:
20         (WebCore::DedicatedWorkerGlobalScope::create):
21         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
22         * workers/DedicatedWorkerGlobalScope.h:
23
24         * workers/DedicatedWorkerThread.cpp:
25         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
26         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
27         * workers/DedicatedWorkerThread.h:
28         (WebCore::DedicatedWorkerThread::create):
29         (WebCore::DedicatedWorkerThread::workerObjectProxy):
30
31         * workers/WorkerGlobalScope.cpp:
32         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
33         (WebCore::WorkerGlobalScope::idbConnectionProxy):
34         * workers/WorkerGlobalScope.h:
35
36         * workers/WorkerThread.cpp:
37         (WebCore::WorkerThread::WorkerThread):
38         (WebCore::WorkerThread::idbConnectionProxy):
39         * workers/WorkerThread.h:
40         (WebCore::WorkerThread::threadID):
41         (WebCore::WorkerThread::runLoop):
42         (WebCore::WorkerThread::workerLoaderProxy):
43         (WebCore::WorkerThread::workerReportingProxy):
44         (WebCore::WorkerThread::getNotificationClient):
45         (WebCore::WorkerThread::setNotificationClient):
46         (WebCore::WorkerThread::workerGlobalScope):
47
48 2016-04-21  Anders Carlsson  <andersca@apple.com>
49
50         Fix crashes when loading SVG images.
51
52         * loader/EmptyClients.cpp:
53         (WebCore::fillWithEmptyClients):
54         Give the SVG page its own application cache storage.
55
56 2016-04-21  Anders Carlsson  <andersca@apple.com>
57
58         Get rid of ApplicationCacheStorage::singleton
59         https://bugs.webkit.org/show_bug.cgi?id=156882
60
61         Reviewed by Tim Horton.
62
63         * loader/appcache/ApplicationCacheStorage.cpp:
64         (WebCore::ApplicationCacheStorage::setCacheDirectory): Deleted.
65         (WebCore::ApplicationCacheStorage::singleton): Deleted.
66         * loader/appcache/ApplicationCacheStorage.h:
67         * page/Page.cpp:
68         (WebCore::Page::Page):
69
70 2016-04-21  Simon Fraser  <simon.fraser@apple.com>
71
72         ASSERTION FAILED: accumulation == TransformState::FlattenTransform in WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect
73         https://bugs.webkit.org/show_bug.cgi?id=155362
74
75         Reviewed by Zalan Bujtas.
76
77         A particular configuration of composited RenderLayers with preserve-3d and clipping
78         caused assertions because an ancestor clipping layer had masksToBounds() set, but
79         a preserves3D() parent, triggering an assertion in GraphicsLayerCA::computeVisibleAndCoverageRect().
80         Make two changes to address this:
81
82         First, CSS clip: and clip-path: should force flattening and override preserve-3d in
83         the RenderStyle.
84
85         Second, don't accumulate transforms in GraphicsLayerCA through layers with masksToBounds().
86
87         Tests: compositing/clipping/preserve3d-flatten-assertion-nested.html
88                compositing/clipping/preserve3d-flatten-assertion.html
89
90         * css/StyleResolver.cpp:
91         (WebCore::StyleResolver::adjustRenderStyle):
92         * platform/graphics/ca/GraphicsLayerCA.cpp:
93         (WebCore::accumulatesTransform):
94
95 2016-04-21  Chris Dumez  <cdumez@apple.com>
96
97         Element::idForStyleResolution() is a foot-gun
98         https://bugs.webkit.org/show_bug.cgi?id=156852
99
100         Reviewed by Darin Adler.
101
102         Element::idForStyleResolution() is a foot-gun. It requires the caller to check
103         Element::hasID() first or it may end up crashing when dereferencing elementData()
104         (e.g. see Bug 156806).
105
106         This patch updates Element::idForStyleResolution() to return nullAtom is the
107         Element does not have an ID. I did not see a performance impact on Speedometer,
108         Dromaeo DOM Core, Dromaeo CSS Selectors and our local performanceTests/.
109
110         * css/ElementRuleCollector.cpp:
111         (WebCore::ElementRuleCollector::collectMatchingRules):
112         * css/SelectorChecker.cpp:
113         (WebCore::SelectorChecker::checkOne):
114         * css/SelectorFilter.cpp:
115         (WebCore::collectElementIdentifierHashes):
116         * dom/Element.h:
117         (WebCore::Element::idForStyleResolution):
118         * rendering/RenderBlockFlow.cpp:
119         (WebCore::needsAppleMailPaginationQuirk):
120         * rendering/RenderTreeAsText.cpp:
121         (WebCore::writeRenderRegionList):
122         * style/StyleSharingResolver.cpp:
123         (WebCore::Style::SharingResolver::canShareStyleWithElement):
124
125 2016-04-21  Brady Eidson  <beidson@apple.com>
126
127         Modern IDB (Workers): Move IDBConnectionProxy into IDBRequest and IDBDatabase.
128         https://bugs.webkit.org/show_bug.cgi?id=156868
129
130         Reviewed by Tim Horton.
131
132         No new tests (No behavior change).
133
134         * Modules/indexeddb/IDBDatabase.cpp:
135         (WebCore::IDBDatabase::create):
136         (WebCore::IDBDatabase::IDBDatabase):
137         (WebCore::IDBDatabase::~IDBDatabase):
138         (WebCore::IDBDatabase::transaction):
139         (WebCore::IDBDatabase::maybeCloseInServer):
140         * Modules/indexeddb/IDBDatabase.h:
141         (WebCore::IDBDatabase::connectionProxy):
142         (WebCore::IDBDatabase::serverConnection):
143
144         * Modules/indexeddb/IDBOpenDBRequest.cpp:
145         (WebCore::IDBOpenDBRequest::createDeleteRequest):
146         (WebCore::IDBOpenDBRequest::createOpenRequest):
147         (WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
148         (WebCore::IDBOpenDBRequest::onSuccess):
149         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
150         (WebCore::IDBOpenDBRequest::requestCompleted):
151         (WebCore::IDBOpenDBRequest::maybeCreateDeleteRequest): Deleted.
152         (WebCore::IDBOpenDBRequest::maybeCreateOpenRequest): Deleted.
153         * Modules/indexeddb/IDBOpenDBRequest.h:
154
155         * Modules/indexeddb/IDBRequest.cpp:
156         (WebCore::IDBRequest::IDBRequest):
157         (WebCore::IDBRequest::connectionToServer): Deleted.
158         * Modules/indexeddb/IDBRequest.h:
159         (WebCore::IDBRequest::connectionProxy):
160
161         * Modules/indexeddb/IDBTransaction.h:
162
163         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
164         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
165         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
166
167 2016-04-21  Jiewen Tan  <jiewen_tan@apple.com>
168
169         [iOS] DumpRenderTree crashed in com.apple.WebCore: WebCore::ResourceLoadNotifier::didFailToLoad
170         https://bugs.webkit.org/show_bug.cgi?id=156829
171         <rdar://problem/23348217>
172
173         Reviewed by Daniel Bates.
174
175         Ensure that the frame associated with the ResourceLoadNotifier is kept alive when notifying the Web Inspector.
176
177         Covered by existing tests.
178
179         * loader/ResourceLoadNotifier.cpp:
180         (WebCore::ResourceLoadNotifier::didFailToLoad):
181         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
182         (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse):
183         (WebCore::ResourceLoadNotifier::dispatchDidReceiveData):
184         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
185         (WebCore::ResourceLoadNotifier::dispatchDidFailLoading):
186
187 2016-04-21  Brady Eidson  <beidson@apple.com>
188
189         Modern IDB (Workers): More IDBConnectionProxy refactoring.
190         https://bugs.webkit.org/show_bug.cgi?id=156855
191
192         Reviewed by Darin Adler.
193
194         No new tests (Covered by changes to existing tests).
195
196         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
197         (WebCore::DOMWindowIndexedDatabase::indexedDB):
198
199         Hang on to the IDBConnectionProxy passed in at creation time, as it should never change:
200         * Modules/indexeddb/IDBFactory.cpp:
201         (WebCore::IDBFactory::create):
202         (WebCore::IDBFactory::IDBFactory):
203         (WebCore::IDBFactory::openInternal):
204         (WebCore::IDBFactory::deleteDatabase):
205         * Modules/indexeddb/IDBFactory.h:
206
207         Hang on to the IDBConnectionProxy passed in at creation time, as it should never change:
208         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
209         (WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
210         (WebCore::WorkerGlobalScopeIndexedDatabase::from):
211         (WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
212         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
213
214         Make IDBConnectionProxy ThreadSafeRefCounted:
215         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
216         (WebCore::IDBClient::IDBConnectionProxy::create):
217         * Modules/indexeddb/client/IDBConnectionProxy.h:
218
219         * dom/Document.cpp:
220         (WebCore::Document::idbConnectionProxy):
221         * dom/Document.h:
222
223 2016-04-21  Keith Miller  <keith_miller@apple.com>
224
225         WebScriptObject description swizzler should work in a multi-threaded world
226         https://bugs.webkit.org/show_bug.cgi?id=156808
227
228         Reviewed by Geoffrey Garen.
229
230         A WebKit legacy API user might be running Objective-C code on another thread.
231         Since we don't want to corrupt other thread's NSObject description method
232         we use TLS to record if we are in the stringValue function. As an attempt to
233         preserve any user swizzling we update the non-stringValue NSObject description
234         method on each call to stringValue if it has changed. Additionally, the TLS
235         needs to be a int because the user might call into stringValue, back into JS,
236         then back into stringValue. If the TLS was a boolean then it would be unset
237         at that point so when we return into the first stringValue call we would call
238         the original NSObject description method rather than our override.
239
240         Test added to API tests: WebKit1.WebScriptObjectDescription
241
242         * bridge/objc/objc_instance.mm:
243         (-[NSObject _web_description]):
244         (ObjcInstance::stringValue):
245         (swizzleNSObjectDescription): Deleted.
246
247 2016-04-21  Beth Dakin  <bdakin@apple.com>
248
249         Build fix.
250
251         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
252         (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions):
253         (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions):
254         (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
255
256 2016-04-21  Beth Dakin  <bdakin@apple.com>
257
258         32 bit build fix.
259
260         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
261
262 2016-04-21  Konstantin Tokarev  <annulen@yandex.ru>
263
264         Fixed compilation with !ENABLE(SVG_FONTS).
265         https://bugs.webkit.org/show_bug.cgi?id=156850
266
267         Reviewed by Michael Catanzaro.
268
269         No new tests needed.
270
271         * css/CSSFontFaceSource.cpp:
272         (WebCore::CSSFontFaceSource::CSSFontFaceSource):
273         Added missing ENABLE(SVG_FONTS) guards.
274         * css/CSSFontFaceSource.h: Ditto.
275         * platform/graphics/FontCascade.cpp: Ditto.
276         * svg/SVGToOTFFontConversion.cpp:
277         (WebCore::FontCascade::drawGlyphBuffer): Deleted extraneous
278         !ENABLE(SVG_FONTS) guard.
279
280 2016-04-21  Beth Dakin  <bdakin@apple.com>
281
282         Remove reliance on WebAVMediaSelectionOptionMac for the 
283         WebPlaybackControlsManager
284         https://bugs.webkit.org/show_bug.cgi?id=156811
285         -and corresponding-
286         rdar://problem/25760523
287
288         Reviewed by Jer Noble.
289
290         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
291         (-[WebPlaybackControlsManager setSeekableTimeRanges:]):
292         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
293         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
294         (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
295         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
296         (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions):
297         (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions):
298         (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
299         (-[WebAVMediaSelectionOptionMac localizedDisplayName]): Deleted.
300         (-[WebAVMediaSelectionOptionMac setLocalizedDisplayName:]): Deleted.
301         (-[WebPlaybackControlsManager isSeeking]): Deleted.
302         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Deleted.
303         (-[WebPlaybackControlsManager audioMediaSelectionOptions]): Deleted.
304         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:]): Deleted.
305         (-[WebPlaybackControlsManager currentAudioMediaSelectionOption]): Deleted.
306         (-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]): Deleted.
307         (-[WebPlaybackControlsManager legibleMediaSelectionOptions]): Deleted.
308         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:]): Deleted.
309         (-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]): Deleted.
310         (-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]): Deleted.
311         (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]): Deleted.
312         (WebCore::mediaSelectionOptions): Deleted.
313
314 2016-04-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
315
316         REGRESSION(198782): ImageSource::subsamplingLevelForScale() does not cache the MaximumSubsamplingLevel for this ImageSource
317         https://bugs.webkit.org/show_bug.cgi?id=156766
318
319         Reviewed by Darin Adler.
320
321         Ensure the MaximumSubsamplingLevel for the ImageSource is calculated
322         only once and is cached for subsequent uses. 
323         
324         The image subsampling is on by default only for iOS. So the and this
325         patch currently affects the iOS port.
326
327         * platform/graphics/ImageSource.cpp:
328         (WebCore::ImageSource::cacheMetadata): Cache m_maximumSubsamplingLevel.
329         Use m_frameCount as a flag for having_the_cache_done.
330         (WebCore::ImageSource::subsamplingLevelForScale): Call cacheMetadata()
331         before using m_maximumSubsamplingLevel.
332         (WebCore::ImageSource::frameCount): Call cacheMetadata() before returning
333         m_frameCount.
334         * platform/graphics/ImageSource.h:
335
336 2016-04-21  Antoine Quint  <graouts@apple.com>
337
338         Creating a large number of WebGL contexts should recycle older contexts
339         https://bugs.webkit.org/show_bug.cgi?id=156689
340         <rdar://problem/19535330>
341
342         Reviewed by Dean Jackson.
343
344         We used to stop creating WebGL contexts once a maximum of 64 WebGL contexts had been
345         created on a page. Other browsers have a limit of 16 concurrent active WebGL contexts
346         and they lose older contexts when the developer creates a new context, logging a warning
347         to the console. We now follow the same approach.
348
349         Tests: webgl/max-active-contexts-console-warning.html
350                webgl/max-active-contexts-gc.html
351                webgl/max-active-contexts-oldest-context-lost.html
352                webgl/max-active-contexts-webglcontextlost-prevent-default.html
353
354         * html/canvas/WebGLRenderingContextBase.cpp:
355         (WebCore::WebGLRenderingContextBase::recycleContext):
356
357         Prints a warning message to the console indicating that an older WebGL context
358         will be lost to accomodate for the active contexts limit being reached and loses
359         the provided context in a way that it may not be recovered by calling `event.preventDefault()`
360         in the `webglcontextlost` event handler. Finally, we destroy the associated GraphicsContext3D
361         since it will no longer be useful and it may hold large Open GL resources.
362
363         * html/canvas/WebGLRenderingContextBase.h:
364         * platform/graphics/GraphicsContext3D.h:
365
366         Changed GraphicsContext3D::create to return RefPtr instead of PassRefPtr.
367
368         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
369         (WebCore::GraphicsContext3D::create):
370         * platform/graphics/efl/GraphicsContext3DEfl.cpp:
371         (WebCore::GraphicsContext3D::create):
372         * platform/graphics/mac/GraphicsContext3DMac.mm:
373         (WebCore::activeContexts):
374         (WebCore::GraphicsContext3D::create):
375
376         Check if we are at the active contexts limit (16) and recycle the oldest context
377         in our active contexts list. Calling recycleContext() on a context will call the
378         GraphicsContext3D destructor and remove it from the active contexts list there.
379
380         (WebCore::GraphicsContext3D::~GraphicsContext3D):
381
382         Remove the deconstructed context from the active contexts list.
383
384         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
385         (WebCore::GraphicsContext3D::recycleContext):
386         * platform/graphics/win/GraphicsContext3DWin.cpp:
387         (WebCore::GraphicsContext3D::create):
388
389 2016-04-21  Dave Hyatt  <hyatt@apple.com>
390
391         Don't hyphenate the last word in a paragraph of text.
392         https://bugs.webkit.org/show_bug.cgi?id=156803
393
394         Reviewed by Simon Fraser.
395
396         Added fast/text/hyphenate-avoid-orphaned-word.html
397
398         * rendering/RenderText.h:
399         * rendering/line/BreakingContext.h:
400         (WebCore::BreakingContext::handleText):
401
402 2016-04-21  Chris Dumez  <cdumez@apple.com>
403
404         Drop [UsePointersEvenForNonNullableObjectArguments] from Range
405         https://bugs.webkit.org/show_bug.cgi?id=156805
406
407         Reviewed by Youenn Fablet.
408
409         No new tests, no web-exposed behavior change.
410
411         * accessibility/AXObjectCache.cpp:
412         (WebCore::AXObjectCache::rangeForNodeContents):
413         (WebCore::characterOffsetsInOrder):
414         (WebCore::setRangeStartOrEndWithCharacterOffset):
415         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
416         (WebCore::AXObjectCache::previousBoundary):
417         * accessibility/AccessibilityObject.cpp:
418         (WebCore::AccessibilityObject::selectText):
419         * accessibility/AccessibilityRenderObject.cpp:
420         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange):
421         * dom/Node.cpp:
422         (WebCore::Node::textRects):
423         * dom/Range.cpp:
424         (WebCore::Range::Range):
425         (WebCore::Range::setDocument):
426         (WebCore::Range::setStart):
427         (WebCore::Range::setEnd):
428         (WebCore::Range::isPointInRange):
429         (WebCore::Range::comparePoint):
430         (WebCore::Range::compareNode):
431         (WebCore::Range::compareBoundaryPoints):
432         (WebCore::Range::compareBoundaryPointsForBindings):
433         (WebCore::Range::intersectsNode):
434         (WebCore::Range::processContents):
435         (WebCore::Range::insertNode):
436         (WebCore::Range::checkNodeWOffset):
437         (WebCore::Range::setStartAfter):
438         (WebCore::Range::setEndBefore):
439         (WebCore::Range::setEndAfter):
440         (WebCore::Range::selectNode):
441         (WebCore::Range::selectNodeContents):
442         (WebCore::Range::surroundContents):
443         (WebCore::Range::setStartBefore):
444         (WebCore::Range::contains):
445         (WebCore::rangesOverlap):
446         (WebCore::rangeOfContents):
447         (WebCore::boundaryNodeChildrenWillBeRemoved):
448         (WebCore::boundaryTextNodesMerged):
449         (WebCore::boundaryTextNodesSplit):
450         (WebCore::Range::expand):
451         (WebCore::checkForDifferentRootContainer): Deleted.
452         (WebCore::highestAncestorUnderCommonRoot): Deleted.
453         (WebCore::childOfCommonRootBeforeOffset): Deleted.
454         (WebCore::deleteCharacterData): Deleted.
455         (WebCore::Range::toString): Deleted.
456         (WebCore::Range::toHTML): Deleted.
457         (WebCore::Range::text): Deleted.
458         (WebCore::Range::cloneRange): Deleted.
459         (WebCore::Range::absoluteTextRects): Deleted.
460         (WebCore::Range::absoluteTextQuads): Deleted.
461         (WebCore::boundaryNodeChildrenChanged): Deleted.
462         (WebCore::boundaryNodeWillBeRemoved): Deleted.
463         (WebCore::Range::nodeWillBeRemoved): Deleted.
464         (WebCore::boundaryTextRemoved): Deleted.
465         (WebCore::Range::getBoundingClientRect): Deleted.
466         (WebCore::Range::getBorderAndTextQuads): Deleted.
467         * dom/Range.h:
468         * dom/Range.idl:
469         * dom/RangeBoundaryPoint.h:
470         (WebCore::RangeBoundaryPoint::set):
471         (WebCore::RangeBoundaryPoint::setToStartOfNode):
472         (WebCore::RangeBoundaryPoint::setToEndOfNode):
473         * editing/AlternativeTextController.cpp:
474         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
475         * editing/ApplyStyleCommand.cpp:
476         (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
477         * editing/Editor.cpp:
478         (WebCore::Editor::advanceToNextMisspelling):
479         (WebCore::Editor::rangeOfString):
480         (WebCore::isFrameInRange):
481         (WebCore::Editor::countMatchesForText):
482         * editing/EditorCommand.cpp:
483         (WebCore::unionDOMRanges):
484         (WebCore::executeDeleteToMark):
485         (WebCore::executeSelectToMark):
486         * editing/FormatBlockCommand.cpp:
487         (WebCore::FormatBlockCommand::formatRange):
488         * editing/FrameSelection.cpp:
489         (WebCore::FrameSelection::respondToNodeModification):
490         * editing/InsertListCommand.cpp:
491         (WebCore::InsertListCommand::doApplyForSingleParagraph):
492         * editing/TextCheckingHelper.cpp:
493         (WebCore::TextCheckingParagraph::offsetTo):
494         * editing/TextIterator.cpp:
495         (WebCore::CharacterIterator::range):
496         (WebCore::BackwardsCharacterIterator::range):
497         (WebCore::TextIterator::rangeFromLocationAndLength):
498         (WebCore::TextIterator::getLocationAndLengthFromRange):
499         (WebCore::findPlainText):
500         * editing/VisiblePosition.cpp:
501         (WebCore::setStart):
502         (WebCore::setEnd):
503         * editing/VisibleSelection.cpp:
504         (WebCore::makeSearchRange):
505         * editing/VisibleUnits.cpp:
506         (WebCore::previousBoundary):
507         (WebCore::nextBoundary):
508         * editing/htmlediting.cpp:
509         (WebCore::visiblePositionForIndexUsingCharacterIterator):
510         (WebCore::isNodeVisiblyContainedWithin):
511         * editing/htmlediting.h:
512         * editing/mac/EditorMac.mm:
513         (WebCore::Editor::adjustedSelectionRange):
514         * page/ContextMenuController.cpp:
515         (WebCore::ContextMenuController::contextMenuItemSelected):
516         * page/DOMSelection.cpp:
517         (WebCore::DOMSelection::addRange):
518         * page/DragController.cpp:
519         (WebCore::selectElement):
520         * page/EventHandler.cpp:
521         (WebCore::EventHandler::dispatchMouseEvent):
522         * page/Page.cpp:
523         (WebCore::Page::findStringMatchingRanges):
524         * page/TextIndicator.cpp:
525         (WebCore::hasNonInlineOrReplacedElements):
526         * rendering/RenderNamedFlowThread.cpp:
527         (WebCore::RenderNamedFlowThread::getRanges):
528
529 2016-04-21  Chris Dumez  <cdumez@apple.com>
530
531         Drop [UsePointersEvenForNonNullableObjectArguments] from DOMURL
532         https://bugs.webkit.org/show_bug.cgi?id=156797
533
534         Reviewed by Youenn Fablet.
535
536         * html/DOMURL.cpp:
537         (WebCore::DOMURL::create):
538         * html/DOMURL.h:
539         * html/DOMURL.idl:
540
541 2016-04-21  Claudio Saavedra  <csaavedra@igalia.com>
542
543         [GTK][EFL] Move non-glib/gtk platform implementations out of platform/gtk
544         https://bugs.webkit.org/show_bug.cgi?id=156847
545
546         Reviewed by Carlos Garcia Campos.
547
548         The Language and Logging implementation don't really need glib, so
549         rework them and move them to a new platform/unix directory so that
550         they can be shared among Unix ports.
551
552         * PlatformEfl.cmake: Use the unix version.
553         * PlatformGTK.cmake: Same.
554         * platform/efl/LanguageEfl.cpp: Removed.
555         * platform/efl/LoggingEfl.cpp: Removed.
556         * platform/unix/LanguageUnix.cpp: Renamed from Source/WebCore/platform/gtk/LanguageGtk.cpp.
557         (WebCore::platformLanguage):
558         (WebCore::platformUserPreferredLanguages):
559         * platform/unix/LoggingUnix.cpp: Renamed from Source/WebCore/platform/gtk/LoggingGtk.cpp.
560         (WebCore::logLevelString):
561
562 2016-04-21  Nan Wang  <n_wang@apple.com>
563
564         AX: stringForTextMarkerRange returning empty string for document range
565         https://bugs.webkit.org/show_bug.cgi?id=156819
566
567         Reviewed by Chris Fleizach.
568
569         Set text marker data with CharacterOffset when VisiblePosition is having PositionIsAfterAnchor
570         or PositionIsAfterChildren anchor type, so that the character offset corresponds to the anchored
571         node.
572
573         Test: accessibility/mac/text-marker-string-for-document-range.html
574
575         * accessibility/AXObjectCache.cpp:
576         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
577
578 2016-04-20  Chris Dumez  <cdumez@apple.com>
579
580         Crash under WebCore::TextIterator::subrange()
581         https://bugs.webkit.org/show_bug.cgi?id=156809
582         <rdar://problem/21102730>
583
584         Reviewed by Ryosuke Niwa.
585
586         TextIterator::rangeFromLocationAndLength() may return null. However, we
587         failed to do a null check before calling TextIterator::subrange() with
588         that range.
589
590         No new tests, do not know how to reproduce.
591
592         * editing/AlternativeTextController.cpp:
593         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
594
595 2016-04-20  Brady Eidson  <beidson@apple.com>
596
597         Modern IDB (Workers): Remove IDBRequest/IDBOpenDBRequest's requirement to get an IDBServerConnection around.
598         https://bugs.webkit.org/show_bug.cgi?id=156826
599
600         Reviewed by Alex Christensen.
601
602         No new tests (No behavior change, existing tests pass).
603
604         This doesn't appear to do much but make things a little more complicated, but it's the first of a few 
605         small pushes in the right direction.
606         
607         * Modules/indexeddb/IDBOpenDBRequest.cpp:
608         (WebCore::IDBOpenDBRequest::maybeCreateDeleteRequest):
609         (WebCore::IDBOpenDBRequest::maybeCreateOpenRequest):
610         (WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
611         (WebCore::IDBOpenDBRequest::onSuccess):
612         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
613         (WebCore::IDBOpenDBRequest::requestCompleted):
614         (WebCore::IDBOpenDBRequest::createDeleteRequest): Deleted.
615         (WebCore::IDBOpenDBRequest::createOpenRequest): Deleted.
616         * Modules/indexeddb/IDBOpenDBRequest.h:
617         
618         * Modules/indexeddb/IDBRequest.cpp:
619         (WebCore::IDBRequest::IDBRequest):
620         (WebCore::IDBRequest::connectionToServer):
621         * Modules/indexeddb/IDBRequest.h:
622         (WebCore::IDBRequest::connection): Deleted.
623         
624         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
625         (WebCore::IDBClient::IDBConnectionProxy::IDBConnectionProxy):
626         (WebCore::IDBClient::IDBConnectionProxy::connectionToServer):
627         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
628         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
629         * Modules/indexeddb/client/IDBConnectionProxy.h:
630         (WebCore::IDBClient::IDBConnectionProxy::serverConnectionIdentifier):
631         
632         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
633         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
634         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
635
636 2016-04-20  John Wilander  <wilander@apple.com>
637
638         Add Subresource Integrity as "Under consideration".
639         https://bugs.webkit.org/show_bug.cgi?id=156800
640
641         Reviewed by Alexey Proskuryakov.
642
643         No new tests needed.
644
645         * features.json:
646             Added an entry for Subresource Integrity.
647
648 2016-04-20  Anders Carlsson  <andersca@apple.com>
649
650         Get rid of a couple of uses of ApplicationCacheStorage::singleton()
651         https://bugs.webkit.org/show_bug.cgi?id=156818
652
653         Reviewed by Geoffrey Garen.
654
655         * loader/appcache/ApplicationCache.cpp:
656         (WebCore::ApplicationCache::addResource):
657         * loader/appcache/ApplicationCacheGroup.h:
658         (WebCore::ApplicationCacheGroup::storage):
659         * testing/Internals.cpp:
660         (WebCore::Internals::resetToConsistentState):
661         (WebCore::Internals::setApplicationCacheOriginQuota):
662
663 2016-04-20  Brady Eidson  <beidson@apple.com>
664
665         Modern IDB (Workers): Introduce "IDBConnectionProxy" for future threading abstraction, and adopt it in IDBFactory.
666         https://bugs.webkit.org/show_bug.cgi?id=156810
667
668         Reviewed by Alex Christensen.
669
670         No new tests (Covered by changes to existing tests).
671
672         Add the IDBConnectionProxy object, including the ability to replicate IDBFactory functionality:
673         * Modules/indexeddb/client/IDBConnectionProxy.cpp: Added.
674         (WebCore::IDBClient::IDBConnectionProxy::IDBConnectionProxy):
675         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
676         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
677         * Modules/indexeddb/client/IDBConnectionProxy.h: 
678         
679         Add pure virtual IDBConnectionProxy accessor:
680         * dom/ScriptExecutionContext.h: 
681
682         Implement it:
683         * dom/Document.cpp:
684         (WebCore::Document::idbConnectionProxy):
685         * dom/Document.h:
686         
687         Implement it:
688         * workers/WorkerGlobalScope.cpp:
689         (WebCore::WorkerGlobalScope::idbConnectionProxy):
690         * workers/WorkerGlobalScope.h:
691         
692         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
693         (WebCore::DOMWindowIndexedDatabase::indexedDB):
694
695
696         Don't keep a reference to IDBConnectionToServer, but rather get at the context's IDBConnectionProxy:
697         * Modules/indexeddb/IDBFactory.cpp:
698         (WebCore::IDBFactory::create):
699         (WebCore::IDBFactory::IDBFactory):
700         (WebCore::IDBFactory::open):
701         (WebCore::IDBFactory::openInternal):
702         (WebCore::IDBFactory::deleteDatabase):
703         * Modules/indexeddb/IDBFactory.h:
704         * Modules/indexeddb/IDBFactory.idl:
705
706         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
707         (WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
708
709         * Modules/indexeddb/client/IDBConnectionToServer.h:
710
711         * inspector/InspectorIndexedDBAgent.cpp:
712
713         * CMakeLists.txt:
714         * WebCore.xcodeproj/project.pbxproj:
715
716 2016-04-20  Chris Dumez  <cdumez@apple.com>
717
718         Use Optional<size_t> for OrderIterator::m_orderIndex instead of int
719         https://bugs.webkit.org/show_bug.cgi?id=156796
720
721         Reviewed by Anders Carlsson.
722
723         Use Optional<size_t> for OrderIterator::m_orderIndex instead of int
724         (with invalid value of -1). m_orderIndex a vector index and therefore
725         is in the range of an unsigned (type used internally by Vector, even
726         though the index is exposed as size_t). Therefore, assigning it to an
727         int is unsafe as it may overflow.
728
729         This may fix <rdar://problem/23410338> which is a top crasher.
730
731         * rendering/OrderIterator.cpp:
732         (WebCore::OrderIterator::next):
733         (WebCore::OrderIterator::reset):
734         * rendering/OrderIterator.h:
735
736 2016-04-20  Chris Dumez  <cdumez@apple.com>
737
738         Crash under needsAppleMailPaginationQuirk()
739         https://bugs.webkit.org/show_bug.cgi?id=156806
740         <rdar://problem/23323479>
741
742         Reviewed by Simon Fraser.
743
744         Add check for element()->hasID() before calling element()->idForStyleResolution()
745         so that we don't dereference a potentially null element()->elementData().
746         Also stop repeatedly atomizing "messageContentContainer" and leverage
747         the operator==(const AtomicString&, const char*) instead for performance.
748
749         * rendering/RenderBlockFlow.cpp:
750         (WebCore::needsAppleMailPaginationQuirk):
751
752 2016-04-20  Brady Eidson  <beidson@apple.com>
753
754         Attempt to fix non-INDEXED_DATABASE_IN_WORKERS builds after r199779
755
756         * testing/InternalSettings.cpp:
757         (WebCore::InternalSettings::Backup::Backup):
758         (WebCore::InternalSettings::Backup::restoreTo):
759         (WebCore::InternalSettings::setIndexedDBWorkersEnabled):
760         * testing/InternalSettings.h:
761
762 2016-04-20  Chris Dumez  <cdumez@apple.com>
763
764         Potential overflow in RenderLayer::hitTestList()
765         https://bugs.webkit.org/show_bug.cgi?id=156804
766
767         Reviewed by Simon Fraser.
768
769         Use size_t type instead of int to iterate over the Vector to make sure
770         we don't overflow. This is a speculative fix for <rdar://problem/23249479>.
771
772         * rendering/RenderLayer.cpp:
773         (WebCore::RenderLayer::hitTestList):
774
775 2016-04-20  Brady Eidson  <beidson@apple.com>
776
777         Modern IDB (Workers): Enable INDEXED_DATABASE_IN_WORKERS compile time flag, but disabled in RuntimeEnabledFeatures.
778         https://bugs.webkit.org/show_bug.cgi?id=156782
779
780         Reviewed by Alex Christensen.
781
782         Test: storage/indexeddb/modern/workers-disabled.html
783               storage/indexeddb/modern/workers-enable.html
784
785         * Configurations/FeatureDefines.xcconfig:
786
787         ScriptExecutionContext shouldn't really be supplementable:
788         * dom/ScriptExecutionContext.h:
789
790         WorkerGlobalScope should be supplementable.
791         Also modernize this archaic header (pragma once, and re-indent):
792         * workers/WorkerGlobalScope.h:
793         
794         Update for WorkerGlobalScope now being directly supplementable:
795         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp:
796         (WebCore::WorkerGlobalScopeIndexedDatabase::WorkerGlobalScopeIndexedDatabase):
797         (WebCore::WorkerGlobalScopeIndexedDatabase::from):
798         (WebCore::WorkerGlobalScopeIndexedDatabase::indexedDB):
799         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.h:
800         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl:
801         * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
802         (WebCore::WorkerGlobalScopeNotifications::WorkerGlobalScopeNotifications):
803         (WebCore::WorkerGlobalScopeNotifications::from):
804         (WebCore::WorkerGlobalScopeNotifications::webkitNotifications):
805         * Modules/notifications/WorkerGlobalScopeNotifications.h:
806         
807         Expose IndexedDBWorkers to RuntimeEnabledFeatures:
808         * bindings/generic/RuntimeEnabledFeatures.cpp:
809         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
810         * bindings/generic/RuntimeEnabledFeatures.h:
811         (WebCore::RuntimeEnabledFeatures::setIndexedDBWorkersEnabled):
812         (WebCore::RuntimeEnabledFeatures::indexedDBWorkersEnabled):
813
814         Expose IndexedDBWorkers to InternalSettings:
815         * testing/InternalSettings.cpp:
816         (WebCore::InternalSettings::Backup::Backup):
817         (WebCore::InternalSettings::Backup::restoreTo):
818         (WebCore::InternalSettings::setIndexedDBWorkersEnabled):
819         * testing/InternalSettings.h:
820         * testing/InternalSettings.idl:
821
822 2016-04-20  Dave Hyatt  <hyatt@apple.com>
823
824         Hangable punctuation measurement using the wrong indices.
825         https://bugs.webkit.org/show_bug.cgi?id=155899
826
827         Reviewed by Simon Fraser.
828
829         New tests in fast/text.
830
831         * rendering/RenderBlockFlow.cpp:
832         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
833         * rendering/RenderText.cpp:
834         (WebCore::RenderText::hangablePunctuationStartWidth):
835         (WebCore::RenderText::hangablePunctuationEndWidth):
836         (WebCore::RenderText::isHangableStopOrComma):
837
838 2016-04-20  Chris Dumez  <cdumez@apple.com>
839
840         Drop [UsePointersEvenForNonNullableObjectArguments] from several Canvas interfaces
841         https://bugs.webkit.org/show_bug.cgi?id=156781
842
843         Reviewed by Darin Adler.
844
845         * html/canvas/CanvasRenderingContext2D.cpp:
846         (WebCore::CanvasRenderingContext2D::fill):
847         (WebCore::CanvasRenderingContext2D::stroke):
848         (WebCore::CanvasRenderingContext2D::clip):
849         (WebCore::CanvasRenderingContext2D::isPointInPath):
850         (WebCore::CanvasRenderingContext2D::isPointInStroke):
851         (WebCore::size):
852         (WebCore::CanvasRenderingContext2D::drawImage):
853         (WebCore::CanvasRenderingContext2D::drawImageFromRect):
854         (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):
855         * html/canvas/CanvasRenderingContext2D.h:
856         * html/canvas/CanvasRenderingContext2D.idl:
857         * html/canvas/DOMPath.h:
858         * html/canvas/DOMPath.idl:
859         * html/canvas/WebGLDebugShaders.cpp:
860         (WebCore::WebGLDebugShaders::getTranslatedShaderSource):
861         * html/canvas/WebGLDebugShaders.h:
862         * html/canvas/WebGLDebugShaders.idl:
863
864 2016-04-20  Chris Dumez  <cdumez@apple.com>
865
866         Drop [UsePointersEvenForNonNullableObjectArguments] from WebAudio
867         https://bugs.webkit.org/show_bug.cgi?id=156777
868
869         Reviewed by Darin Adler.
870
871         Drop [UsePointersEvenForNonNullableObjectArguments] from WebAudio and
872         modernize the interface a bit.
873
874         There is no major Web-exposed behavioral change except for
875         the exception type thrown when passing null (now always TypeError).
876         Tests were updated to add coverage for this.
877
878         * Modules/webaudio/AsyncAudioDecoder.cpp:
879         (WebCore::AsyncAudioDecoder::decodeAsync):
880         (WebCore::AsyncAudioDecoder::DecodingTask::DecodingTask):
881         (WebCore::AsyncAudioDecoder::DecodingTask::decode): Deleted.
882         * Modules/webaudio/AsyncAudioDecoder.h:
883         (WebCore::AsyncAudioDecoder::DecodingTask::audioData):
884         * Modules/webaudio/AudioContext.cpp:
885         (WebCore::AudioContext::lazyInitialize):
886         (WebCore::AudioContext::createBuffer):
887         (WebCore::AudioContext::decodeAudioData):
888         (WebCore::AudioContext::createBufferSource):
889         (WebCore::AudioContext::createMediaElementSource):
890         (WebCore::AudioContext::createMediaStreamSource):
891         (WebCore::AudioContext::createMediaStreamDestination):
892         (WebCore::AudioContext::createScriptProcessor):
893         (WebCore::AudioContext::createBiquadFilter):
894         (WebCore::AudioContext::createWaveShaper):
895         (WebCore::AudioContext::createPanner):
896         (WebCore::AudioContext::createConvolver):
897         (WebCore::AudioContext::createDynamicsCompressor):
898         (WebCore::AudioContext::createAnalyser):
899         (WebCore::AudioContext::createGain):
900         (WebCore::AudioContext::createDelay):
901         (WebCore::AudioContext::createChannelSplitter):
902         (WebCore::AudioContext::createChannelMerger):
903         (WebCore::AudioContext::createOscillator):
904         (WebCore::AudioContext::createPeriodicWave):
905         (WebCore::AudioContext::derefFinishedSourceNodes):
906         (WebCore::AudioContext::refNode):
907         (WebCore::AudioContext::derefNode):
908         (WebCore::AudioContext::notifyNodeFinishedProcessing): Deleted.
909         (WebCore::AudioContext::derefUnfinishedSourceNodes): Deleted.
910         (WebCore::AudioContext::lock): Deleted.
911         * Modules/webaudio/AudioContext.h:
912         * Modules/webaudio/AudioContext.idl:
913         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
914         (WebCore::MediaElementAudioSourceNode::create):
915         (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
916         (WebCore::MediaElementAudioSourceNode::process):
917         * Modules/webaudio/MediaElementAudioSourceNode.h:
918         (WebCore::MediaElementAudioSourceNode::mediaElement):
919         * Modules/webaudio/OscillatorNode.idl:
920
921 2016-04-20  Brady Eidson  <beidson@apple.com>
922
923         Addressing additional review feedback for:
924         Modern IDB: Lots of IDB bindings cleanup (including making IDBVersionChangeEvent constructible).
925         https://bugs.webkit.org/show_bug.cgi?id=156760
926
927         * Modules/indexeddb/IDBVersionChangeEvent.h:
928
929 2016-04-20  Frederic Wang  <fwang@igalia.com>
930
931         Use OpenType MATH fonts by default
932         https://bugs.webkit.org/show_bug.cgi?id=133603
933
934         Reviewed by Alejandro G. Castro.
935
936         No new tests. This is already tested by pixel tests like roots.xhtml.
937         However, new math fonts are not used during test execution.
938
939         * css/mathml.css:
940         (math): We use only a list of known OpenType fonts with a MATH table but keep some pre-installed fallback fonts for OS X and iOS.
941
942 2016-04-20  Claudio Saavedra  <csaavedra@igalia.com>
943
944         [GTK] Move GTK+-independent platform code to platform/glib
945         https://bugs.webkit.org/show_bug.cgi?id=156787
946
947         Reviewed by Carlos Garcia Campos.
948
949         There is plenty of code in platform/gtk that is independent from the GTK+ library.
950         Move those files to platform/glib so that they can be reused by other GLib-based ports.
951
952         Also clean some style warnings in those files.
953
954         * PlatformGTK.cmake: Move the files.
955         * platform/glib/EventLoopGlib.cpp: Renamed from Source/WebCore/platform/gtk/EventLoopGtk.cpp.
956         (WebCore::EventLoop::cycle):
957         * platform/glib/FileSystemGlib.cpp: Renamed from Source/WebCore/platform/gtk/FileSystemGtk.cpp.
958         (WebCore::filenameToString):
959         (WebCore::unescapedFilename):
960         (WebCore::fileSystemRepresentation):
961         (WebCore::filenameForDisplay):
962         (WebCore::fileExists):
963         (WebCore::deleteFile):
964         (WebCore::deleteEmptyDirectory):
965         (WebCore::getFileStat):
966         (WebCore::getFileSize):
967         (WebCore::getFileCreationTime):
968         (WebCore::getFileModificationTime):
969         (WebCore::getFileMetadata):
970         (WebCore::pathByAppendingComponent):
971         (WebCore::makeAllDirectories):
972         (WebCore::homeDirectoryPath):
973         (WebCore::pathGetFileName):
974         (WebCore::applicationDirectoryPath):
975         (WebCore::sharedResourcesPath):
976         (WebCore::getVolumeFreeSizeForPath):
977         (WebCore::directoryName):
978         (WebCore::listDirectory):
979         (WebCore::openTemporaryFile):
980         (WebCore::openFile):
981         (WebCore::closeFile):
982         (WebCore::seekFile):
983         (WebCore::writeToFile):
984         (WebCore::readFromFile):
985         (WebCore::unloadModule):
986         (WebCore::hardLinkOrCopyFile):
987         * platform/glib/GamepadsGlib.cpp: Renamed from Source/WebCore/platform/gtk/GamepadsGtk.cpp.
988         (WebCore::GamepadDeviceGlib::GamepadDeviceGlib):
989         (WebCore::GamepadDeviceGlib::~GamepadDeviceGlib):
990         (WebCore::GamepadDeviceGlib::readCallback):
991         (WebCore::GamepadsGlib::GamepadsGlib):
992         (WebCore::GamepadsGlib::~GamepadsGlib):
993         (WebCore::GamepadsGlib::registerDevice):
994         (WebCore::GamepadsGlib::unregisterDevice):
995         (WebCore::GamepadsGlib::updateGamepadList):
996         (WebCore::GamepadsGlib::onUEventCallback):
997         (WebCore::GamepadsGlib::isGamepadDevice):
998         (WebCore::sampleGamepads):
999         * platform/glib/SharedBufferGlib.cpp: Renamed from Source/WebCore/platform/gtk/SharedBufferGtk.cpp.
1000         (WebCore::SharedBuffer::createFromReadingFile):
1001
1002 2016-04-20  Frederic Wang  <fwang@igalia.com>
1003
1004         Refactor RenderMathMLSpace to avoid using flexbox
1005         https://bugs.webkit.org/show_bug.cgi?id=155168
1006
1007         Reviewed by Martin Robinson.
1008
1009         No new tests, already covered by existing tests. The behavior of mspace-prefered-width-expected is not specified by the MathML recommendation, we update that test to match our new behavior.
1010
1011         * rendering/mathml/RenderMathMLSpace.cpp: Implement layout functions without passing by flebox.
1012         (WebCore::RenderMathMLSpace::computePreferredLogicalWidths): Implement this function.
1013         (WebCore::RenderMathMLSpace::layoutBlock): Implement this function.
1014         (WebCore::RenderMathMLSpace::computeIntrinsicLogicalWidths): Deleted.
1015         (WebCore::RenderMathMLSpace::updateLogicalWidth): Deleted.
1016         (WebCore::RenderMathMLSpace::updateLogicalHeight): Deleted.
1017         * rendering/mathml/RenderMathMLSpace.h: Update function declarations.
1018
1019 2016-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1020
1021         [Cairo] Crash in GraphicsContext::drawFocusRing when painting is disabled
1022         https://bugs.webkit.org/show_bug.cgi?id=156785
1023
1024         Reviewed by Žan Doberšek.
1025
1026         This happens for example when view state changes to focus and paint is called from
1027         FrameView::updateControlTints() with a graphics context that doesn't have a platform context. Layout test
1028         fast/images/image-map-outline-with-scale-transform.html sometimes crashes because of this.
1029
1030         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1031         (WebCore::GraphicsContext::drawFocusRing): Return early if painting is disabled.
1032
1033 2016-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1034
1035         REGRESSION(r198782): SHOULD NEVER BE REACHED failure in ImageSource::setData since r198782
1036         https://bugs.webkit.org/show_bug.cgi?id=156690
1037
1038         Reviewed by Michael Catanzaro.
1039
1040         The assertion is wrong, because it assumes that ImageDecoder::create() always returns a valid pointer, which is
1041         only true for the CG implementation. The non CG implementation can return nullptr if there isn't enough data to
1042         figure out the image format or if the image format is not supported. This is causing several crashes in the
1043         debug bots.
1044
1045         * platform/graphics/ImageSource.cpp:
1046         (WebCore::ImageSource::setData): Remove the invalid ASSERT and return early if we fail to create the decoder.
1047         (WebCore::ImageSource::ensureDecoderIsCreated): Deleted.
1048         * platform/graphics/ImageSource.h:
1049
1050 2016-04-19  Brent Fulgham  <bfulgham@apple.com>
1051
1052         Remove remaining bits of dynamic <link> rel='icon' loading
1053         https://bugs.webkit.org/show_bug.cgi?id=156727
1054
1055         Reviewed by Darin Adler.
1056
1057         Don't call 'shouldLoadLink' for 'icon' link types. It performs no
1058         useful checks for 'icon' types, and emits the non-standard
1059         'onbeforeload' event.
1060
1061         This work finishes up https://webkit.org/b/153151, where we removed
1062         FrameLoaderClient::dispatchDidChangeIcons() and related code.
1063
1064         Test: webarchive/test-link-rel-subresource-beforeload.html
1065
1066         * loader/LinkLoader.cpp:
1067         (WebCore::LinkLoader::loadLink): Remove unneeded call to 'shouldLoadLink'.
1068
1069 2016-04-19  Chris Dumez  <cdumez@apple.com>
1070
1071         AudioBufferSourceNode.buffer should be nullable
1072         https://bugs.webkit.org/show_bug.cgi?id=156769
1073
1074         Reviewed by Darin Adler.
1075
1076         AudioBufferSourceNode.buffer should be nullable as per the
1077         specification:
1078         https://webaudio.github.io/web-audio-api/#AudioBufferSourceNode
1079
1080         Our implementation was initially returning null when getting
1081         AudioBufferSourceNode.buffer, which is correct. However, it would
1082         throw a TypeError when trying to set the attribute to null. Our
1083         implementation setter actually supported setting the buffer to
1084         null but the custom bindings for the setter would not.
1085
1086         This patch does the following:
1087         - Get rid of the custom bindings for the AudioBufferSourceNode.buffer
1088           setter. We can have the bindings generator generate the same code
1089           by using [StrictTypeChecking]. The custom bindinds were also throwing
1090           a TypeError if the input AudioBuffer had too many channels but this
1091           does not seem to be possible.
1092         - Mark AudioBufferSourceNode.buffer as nullable in the IDL so that
1093           we no longer throw when the JS tries to assign null, but instead
1094           calls AudioBufferSourceNode::setBuffer(nullptr)
1095
1096         No new test, updated webaudio/audiobuffersource-channels.html
1097
1098         * CMakeLists.txt:
1099         * Modules/webaudio/AudioBufferSourceNode.cpp:
1100         (WebCore::AudioBufferSourceNode::setBuffer):
1101         * Modules/webaudio/AudioBufferSourceNode.h:
1102         * Modules/webaudio/AudioBufferSourceNode.idl:
1103         * Modules/webaudio/AudioContext.h:
1104         * WebCore.xcodeproj/project.pbxproj:
1105         * bindings/js/JSAudioBufferSourceNodeCustom.cpp: Removed.
1106
1107 2016-04-19  Brady Eidson  <beidson@apple.com>
1108
1109         Modern IDB: Lots of IDB bindings cleanup (including making IDBVersionChangeEvent constructible).
1110         https://bugs.webkit.org/show_bug.cgi?id=156760
1111
1112         Reviewed by Darin Adler (and looked over by Chris Dumez and Alex Christensen).
1113
1114         Test: storage/indexeddb/modern/idbversionchangeevent-constructor.html
1115
1116         Add WorkerGlobalScopeConstructors to the xcodeproj:
1117         * WebCore.xcodeproj/project.pbxproj:
1118
1119         Remove the completely irrelevant webkit* prefixed constructors from DOMWindow:
1120         * page/DOMWindow.idl:
1121
1122         Remove the poor way most objects were exposed on the WorkerGlobalScope:
1123         * Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.idl:
1124
1125         Expose most of the objects on the WorkerGlobalScope the correct way:
1126         * Modules/indexeddb/IDBCursor.idl:
1127         * Modules/indexeddb/IDBCursorWithValue.idl:
1128         * Modules/indexeddb/IDBDatabase.idl:
1129         * Modules/indexeddb/IDBFactory.idl:
1130         * Modules/indexeddb/IDBIndex.idl:
1131         * Modules/indexeddb/IDBKeyRange.idl:
1132         * Modules/indexeddb/IDBObjectStore.idl:
1133         * Modules/indexeddb/IDBOpenDBRequest.idl:
1134         * Modules/indexeddb/IDBRequest.idl:
1135         * Modules/indexeddb/IDBTransaction.idl:
1136
1137         Make IDBVersionChangeEvent constructible:        
1138         * Modules/indexeddb/IDBVersionChangeEvent.cpp:
1139         (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
1140         (WebCore::IDBVersionChangeEvent::newVersion): Deleted.
1141         * Modules/indexeddb/IDBVersionChangeEvent.h:
1142         * Modules/indexeddb/IDBVersionChangeEvent.idl:
1143
1144         * bindings/js/JSDictionary.h:
1145         (WebCore::JSDictionary::convertValue): Add a templated form of convertValue that
1146           handles Optional<>s.
1147
1148 2016-04-19  Alex Christensen  <achristensen@webkit.org>
1149
1150         Build fix after r199738
1151
1152         * platform/graphics/efl/GraphicsContext3DEfl.cpp:
1153         (WebCore::GraphicsContext3D::GraphicsContext3D):
1154         * platform/graphics/win/GraphicsContext3DWin.cpp:
1155         (WebCore::GraphicsContext3D::GraphicsContext3D):
1156
1157 2016-04-19  Keith Miller  <keith_miller@apple.com>
1158
1159         ObjcInstance::stringValue should not call NSObject's description method
1160         https://bugs.webkit.org/show_bug.cgi?id=156758
1161
1162         Reviewed by Geoffrey Garen.
1163
1164         This patch makes it so that we no longer call NSObject's description method without first
1165         swizzling the implementation for WebScriptObjects. We restore the incomming NSObject's
1166         description method once we have finished generating the string.
1167
1168         Test: platform/mac/fast/objc/webScriptObject-does-not-call-description-on-nsobject.html
1169
1170         * bridge/objc/objc_instance.mm:
1171         (swizzleNSObjectDescription):
1172         (ObjcInstance::stringValue):
1173
1174 2016-04-19  Alex Christensen  <achristensen@webkit.org>
1175
1176         Update ANGLE
1177         https://bugs.webkit.org/show_bug.cgi?id=156755
1178
1179         Reviewed by Dean Jackson.
1180
1181         * CMakeLists.txt:
1182         * platform/graphics/ANGLEWebKitBridge.h:
1183         (WebCore::ANGLEWebKitBridge::getResources):
1184         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1185         (WebCore::GraphicsContext3D::GraphicsContext3D):
1186         Continue to compile successfully with new ANGLE.
1187
1188 2016-04-19  Chris Dumez  <cdumez@apple.com>
1189
1190         Mark more classes as WTF_MAKE_FAST_ALLOCATED
1191         https://bugs.webkit.org/show_bug.cgi?id=156732
1192
1193         Reviewed by Darin Adler.
1194
1195         * css/CSSImageGeneratorValue.h:
1196         * css/DocumentRuleSets.h:
1197         * css/MediaQueryMatcher.h:
1198         * css/RuleFeature.h:
1199         * css/StyleResolver.h:
1200         * dom/ActiveDOMCallbackMicrotask.h:
1201         * dom/DocumentSharedObjectPool.h:
1202         * dom/MutationObserver.cpp:
1203         * dom/MutationObserverInterestGroup.h:
1204         * dom/MutationObserverRegistration.h:
1205         * dom/ScriptExecutionContext.cpp:
1206         * dom/SlotAssignment.h:
1207         * html/HTMLCollection.h:
1208         * html/canvas/CanvasRenderingContext2D.cpp:
1209         * html/parser/HTMLToken.h:
1210         * html/parser/XSSAuditorDelegate.h:
1211         * loader/FrameLoader.cpp:
1212         * loader/SubframeLoader.h:
1213         * page/AutoscrollController.h:
1214         * page/csp/ContentSecurityPolicySource.h:
1215         * platform/cf/RunLoopObserver.h:
1216         * platform/graphics/FloatQuad.h:
1217         * platform/graphics/FloatRoundedRect.h:
1218         * platform/graphics/IntSize.h:
1219         * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
1220         * platform/graphics/cg/ImageDecoderCG.h:
1221         * platform/graphics/cocoa/IOSurface.h:
1222         * platform/graphics/displaylists/DisplayList.h:
1223         * platform/graphics/mac/ComplexTextController.h:
1224         * platform/graphics/mac/FontCustomPlatformData.h:
1225         * platform/mac/PowerObserverMac.h:
1226         * platform/network/DataURLDecoder.cpp:
1227         * platform/text/PlatformLocale.h:
1228         * rendering/TextAutosizer.h:
1229         * style/StyleUpdate.h:
1230         * xml/XMLHttpRequestUpload.h:
1231
1232 2016-04-18  Ada Chan  <adachan@apple.com>
1233
1234         Context menu items related to fullscreen should be specific to standard fullscreen
1235         https://bugs.webkit.org/show_bug.cgi?id=156723
1236         <rdar://problem/25452632>
1237
1238         Reviewed by Darin Adler.
1239
1240         Introduce HTMLMediaElement::isStandardFullscreen() that the HitTestResult code can use
1241         when handling the validation and selection of fullscreen-related context menu items.
1242
1243         * html/HTMLMediaElement.cpp:
1244         (WebCore::HTMLMediaElement::isStandardFullscreen):
1245         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
1246         Renamed to make it clear that it's for toggling standard fullscreen. Call the new
1247         HTMLMediaElement::isStandardFullscreen().
1248         * html/HTMLMediaElement.h:
1249         * rendering/HitTestResult.cpp:
1250         (WebCore::HitTestResult::mediaIsInFullscreen):
1251         Use HTMLMediaElement::isStandardFullscreen().
1252         (WebCore::HitTestResult::toggleMediaFullscreenState):
1253         Call the renamed HTMLMediaElement::toggleStandardFullscreenState().
1254
1255 2016-04-19  Brady Eidson  <beidson@apple.com>
1256
1257         Modern IDB: ObjectStore Blob Support.
1258         https://bugs.webkit.org/show_bug.cgi?id=143193
1259
1260         Reviewed by Alex Christensen.
1261
1262         Tests: imported/blink/storage/indexeddb/blob-basics-metadata.html
1263                imported/blink/storage/indexeddb/blob-delete-objectstore-db.html
1264                imported/blink/storage/indexeddb/blob-valid-after-deletion.html
1265                imported/blink/storage/indexeddb/blob-valid-before-commit.html
1266                imported/blink/storage/indexeddb/empty-blob-file.html
1267                storage/indexeddb/modern/blob-simple.html
1268
1269         Most of the work has been done already.
1270         
1271         Besides a handful of tweaks to that work, all this really does is remove the clause
1272         that prevents blob URLs from going into the database.
1273
1274         * Modules/indexeddb/IDBObjectStore.cpp:
1275         (WebCore::IDBObjectStore::putOrAdd): Only disallow blobs if private browsing is enabled
1276           (Making that work is already covered by another bug)
1277           
1278         * Modules/indexeddb/IDBTransaction.cpp:
1279         (WebCore::IDBTransaction::putOrAddOnServer):
1280
1281         * Modules/indexeddb/IDBValue.cpp:
1282         (WebCore::IDBValue::IDBValue):
1283
1284         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1285         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
1286         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
1287
1288         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
1289         (WebCore::IDBServer::SQLiteIDBTransaction::deleteBlobFilesIfNecessary):
1290
1291         * platform/network/BlobRegistryImpl.cpp:
1292         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
1293
1294         * platform/sql/SQLiteFileSystem.cpp:
1295         (WebCore::SQLiteFileSystem::deleteDatabaseFile): Delete all database-related files 
1296           now that we use WAL mode.
1297
1298 2016-04-19  Sergio Villar Senin  <svillar@igalia.com>
1299
1300         [css-grid] Use the margin box for non-auto minimum sizes
1301         https://bugs.webkit.org/show_bug.cgi?id=156711
1302
1303         Reviewed by Darin Adler.
1304
1305         When computing the min-size of items with non-auto minimum height/width we are incorrectly
1306         returning the size of the border box, and thus incorrectly ignoring the margins of the item.
1307
1308         This is a follow up patch of r199153 were we added the missing border and paddings for
1309         heights. Contrary to that, we were not including margins for both axis.
1310
1311         This CL requires 3 different interrelated changes:
1312         - Add the margins to the min-size returned by minSizeForChild (might require a layout).
1313         - Refactor and extract width computations from logicalHeightForChild(); not totally
1314         mandatory but pretty logical and helpful.
1315         - Use a new update function to isolate the computation of the override width.
1316
1317         Test: fast/css-grid-layout/min-width-margin-box.html
1318
1319         * rendering/RenderBox.cpp:
1320         (WebCore::RenderBox::computeInlineDirectionMargins): Added const to a parameter.
1321         * rendering/RenderBox.h:
1322         * rendering/RenderGrid.cpp:
1323         (WebCore::RenderGrid::computeTrackSizesForDirection): Initialize the sizingOperation.
1324         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Ditto.
1325         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
1326         (WebCore::RenderGrid::logicalHeightForChild): Renamed from logicalContentHeightForChild as
1327         it no longer returns the content size but the outer size.
1328         (WebCore::RenderGrid::minSizeForChild):
1329         (WebCore::RenderGrid::updateOverrideContainingBlockContentLogicalWidthForChild): Extracted
1330         from logicalHeightForChild().
1331         (WebCore::RenderGrid::minContentForChild): Update override width if needed.
1332         (WebCore::RenderGrid::maxContentForChild): Ditto.
1333         (WebCore::RenderGrid::computeMarginLogicalSizeForChild): Generalized from
1334         computeMarginLogicalHeightForChild(), it can now compute also margins for the inline
1335         direction.
1336         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching):
1337         (WebCore::RenderGrid::logicalContentHeightForChild): Deleted.
1338         (WebCore::RenderGrid::computeMarginLogicalHeightForChild): Deleted.
1339         * rendering/RenderGrid.h:
1340
1341 2016-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1342
1343         [Cairo] GraphicsContext::drawFocusRing methods are not consistent to each other
1344         https://bugs.webkit.org/show_bug.cgi?id=156742
1345
1346         Reviewed by Martin Robinson.
1347
1348         We are rendering the focus ring differently depending on whether a path is used or a vector of rectangles. This
1349         is causing that some reftests fail because they assume we always render the focus ring the same way. For example
1350         fast/images/image-map-outline-in-positioned-container.html, when rendering the test
1351         GraphicsContext::drawFocusRing is called with a path, and when rendering the reference it's called with a vector
1352         of rectangles, producing different results.
1353
1354         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1355         (WebCore::GraphicsContext::drawFocusRing): When receiving a vector of rectangles, build a Path from the given
1356         rectangles and call drawFocusRing() with the built path to ensure consistency.
1357
1358 2016-04-19  Antti Koivisto  <antti@apple.com>
1359
1360         Move FontSelectorClient to a file of its own
1361         https://bugs.webkit.org/show_bug.cgi?id=156738
1362
1363         Reviewed by Carlos Garcia Campos.
1364
1365         So modifying FontSelector does not trigger world rebuild via Document.h.
1366
1367         * WebCore.xcodeproj/project.pbxproj:
1368         * css/CSSFontSelector.cpp:
1369         * dom/Document.h:
1370         * html/canvas/CanvasRenderingContext2D.h:
1371         * platform/graphics/FontSelector.h:
1372         (WebCore::FontSelectorClient::~FontSelectorClient): Deleted.
1373         * platform/graphics/FontSelectorClient.h: Added.
1374         (WebCore::FontSelectorClient::~FontSelectorClient):
1375
1376 2016-04-19  Joanmarie Diggs  <jdiggs@igalia.com>
1377
1378         [GTK] accessibility/gtk/entry-and-password.html is failing since r194847
1379         https://bugs.webkit.org/show_bug.cgi?id=153062
1380
1381         Reviewed by Carlos Garcia Campos.
1382
1383         The changes in r194847 include using WebCore's rendering for the CapsLock indicator.
1384         As a side effect, password inputs gained a TextControlInnerTextElement child from
1385         the Shadow DOM. If we include that child in the accessibility tree, the child will
1386         emit focus and text notifications that suggest the user is no longer in the control.
1387         This can be especially problematic for screen reader users with key echo enabled
1388         when typing in a password input. To fix this, prune TextControlInnerTextElement
1389         children from the accessibility tree for ATK.
1390
1391         No new tests as existing coverage caught this regression. Also modified the
1392         auto-fill-crash.html test whose expectations include the children count for
1393         a text input.
1394
1395         * accessibility/atk/AccessibilityObjectAtk.cpp:
1396         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
1397
1398 2016-04-18  Brady Eidson  <beidson@apple.com>
1399
1400         Modern IDB (Blob support): When reading Blobs from the database, grant the Networking process sandbox access to the files.
1401         https://bugs.webkit.org/show_bug.cgi?id=156640
1402
1403         Reviewed by Alex Christensen.
1404
1405         No new tests (No change in behavior, as blobs in IDB are not yet enabled,
1406                       but when they are enabled testing will cover this).
1407
1408         * Modules/indexeddb/shared/IDBResultData.h: Export some stuff
1409         
1410         * fileapi/ThreadableBlobRegistry.cpp:
1411         (WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked): Account for 
1412           BlobRegistry change described below.
1413         
1414         * platform/network/BlobRegistry.h: Change registerBlobURLOptionallyFileBacked to take a 
1415           BlobDataFileReference instead of a raw path, to allow WK2 to include a sandbox extension.
1416         
1417         * platform/network/BlobRegistryImpl.cpp:
1418         (WebCore::BlobRegistryImpl::registerBlobURL): Account for BlobRegistry change described above.
1419         (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked): Use the passed in 
1420           BlobDataFileHandle, and also register the BlobResourceHandle constructor.
1421         * platform/network/BlobRegistryImpl.h:
1422
1423 2016-04-18  Alex Christensen  <achristensen@webkit.org>
1424
1425         Fix iOS build after r199701
1426
1427         * platform/ios/WebAVPlayerController.mm:
1428
1429 2016-04-18  Darin Adler  <darin@apple.com>
1430
1431         Updated binding test result to reflect the change to not use Deprecated::ScriptValue.
1432
1433         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated with new script.
1434
1435 2016-04-18  Darin Adler  <darin@apple.com>
1436
1437         Remove all use of Deprecated::ScriptValue in generated bindings
1438         https://bugs.webkit.org/show_bug.cgi?id=156706
1439
1440         Reviewed by Brady Eidson.
1441
1442         * Modules/indexeddb/IDBCursor.idl: Removed unneeded [ImplementationReturnType=JSValue].
1443         * Modules/indexeddb/IDBCursorWithValue.idl: Ditto.
1444
1445         * Modules/indexeddb/IDBKeyRange.cpp:
1446         (WebCore::IDBKeyRange::lowerValue): Deleted.
1447         (WebCore::IDBKeyRange::upperValue): Deleted.
1448         (WebCore::IDBKeyRange::only): Changed to take ExecState since the old code just used
1449         the ScriptExecutionContext to get back to the (potentially wrong) ExecState. Also kept
1450         one overload that takes ScriptExecutionContext because I could not change all callers.
1451         (WebCore::IDBKeyRange::lowerBound): Ditto.
1452         (WebCore::IDBKeyRange::upperBound): Ditto.
1453         (WebCore::IDBKeyRange::bound): Ditto.
1454
1455         * Modules/indexeddb/IDBKeyRange.h: Updated for above.
1456
1457         * Modules/indexeddb/IDBKeyRange.idl: Use [ImplementationReturnType=IDBKey].
1458         Use ScriptState instead of ScriptExecutionContext.
1459
1460         * Modules/streams/ReadableStreamSource.h: Take JSValue instead of Deprecated::ScriptValue
1461         for the ignored argument to the cancel function.
1462
1463         * bindings/js/IDBBindingUtilities.cpp:
1464         (WebCore::toJS): Renamed idbKeyToJSValue to this, the traditional name used in the
1465         bindings generator for all these functions. Also changed to take references.
1466         (WebCore::injectIDBKeyIntoScriptValue): Updated to call with the new name and types.
1467         (WebCore::idbKeyDataToScriptValue): Ditto.
1468
1469         * bindings/js/IDBBindingUtilities.h: Added declaration of toJS for IDBKey.
1470
1471         * bindings/scripts/CodeGeneratorJS.pm: Use JSC::JSValue instead of Deprecated::ScriptValue
1472         for the "any" type.
1473         (JSValueToNative): Just return the value with no transformation when type is "any".
1474         (NativeToJSValue): Changed default behavior for "any" to just pass the value as is with
1475         no transfomration. Removed unused ImplementationReturnType case for inside Document.
1476         Removed JSValue case since it's the default now. Added IDBKey case that matches the
1477         IDBKeyPath case (still wondering if we can do those without an attribute). Removed bogus
1478         second check for type "any".
1479
1480 2016-04-18  Martin Robinson  <mrobinson@igalia.com>
1481
1482         [GTK] Possible off-by-one in hyphenation code
1483         https://bugs.webkit.org/show_bug.cgi?id=156661
1484
1485         Reviewed by Michael Catanzaro.
1486
1487         No new tests. This is covered by older tests.
1488
1489         * platform/text/hyphen/HyphenationLibHyphen.cpp:
1490         (WebCore::lastHyphenLocation): Fix an off by one error in hyphen location.
1491
1492 2016-04-18  Eric Carlson  <eric.carlson@apple.com>
1493
1494         [OSX] AVKit is not available on all systems
1495         https://bugs.webkit.org/show_bug.cgi?id=156724
1496         <rdar://problem/25501587>
1497
1498         Reviewed by Dean Jackson.
1499
1500         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm: Add _OPTIONAL to all
1501           AVKit softlink macros.
1502         * platform/ios/WebAVPlayerController.mm: Ditto.
1503         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm: Ditto.
1504         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Ditto.
1505         * platform/mac/WebPlaybackSessionInterfaceMac.mm: Ditto.
1506         * platform/mac/WebVideoFullscreenInterfaceMac.mm: Ditto.
1507
1508 2016-04-18  Gavin Barraclough  <barraclough@apple.com>
1509
1510         WebKit should adopt journal_mode=wal for all SQLite databases.
1511         https://bugs.webkit.org/show_bug.cgi?id=133496
1512
1513         Reviewed by Brady Eidson.
1514
1515         Enabling sqlite3 WAL mode on iOS causes a test failure, but appears just be something that should fail still failing, only in a different way.
1516         Enabling & marking test as failing for now. Tracking test failure here:
1517             https://bugs.webkit.org/show_bug.cgi?id=156718
1518
1519         * platform/sql/SQLiteDatabase.cpp:
1520         (WebCore::SQLiteDatabase::open):
1521             - enable on iOS.
1522
1523 2016-04-18  Brent Fulgham  <bfulgham@apple.com>
1524
1525         Remove support for X-Frame-Options in `<meta>`
1526         https://bugs.webkit.org/show_bug.cgi?id=156625
1527         <rdar://problem/25748714>
1528
1529         Rubberstamped by Darin Adler.
1530
1531         * dom/Document.cpp:
1532         (WebCore::Document::processHttpEquiv): Revise messaging based on Darin's comments.
1533
1534 2016-04-18  Chris Dumez  <cdumez@apple.com>
1535
1536         Crash in ElementDescendantIterator::operator--() when calling m_ancestorSiblingStack.last()
1537         https://bugs.webkit.org/show_bug.cgi?id=156715
1538         <rdar://problem/25750864>
1539
1540         Reviewed by Antti Koivisto.
1541
1542         Fix correctness of ElementDescendantIterator::operator--(). The last element
1543         in the m_ancestorSiblingStack stack is nullptr. However, if our parent does
1544         not have a sibling, m_current->nextSibling() == m_ancestorSiblingStack.last()
1545         would be true and we would end up removing the nullptr element from
1546         m_ancestorSiblingStack. We would crash on a follow-up call to operator--()
1547         because m_ancestorSiblingStack.last() would do an out-of-bound access, given
1548         that m_ancestorSiblingStack is empty.
1549
1550         Test: fast/dom/collection-backward-traversal-crash.html
1551
1552         * dom/ElementDescendantIterator.h:
1553         (WebCore::ElementDescendantIterator::operator--):
1554
1555 2016-04-18  Anders Carlsson  <andersca@apple.com>
1556
1557         Fix build with newer versions of clang.
1558         rdar://problem/25749769
1559
1560         Forward declare performClose:.
1561
1562         * platform/mac/WebCoreFullScreenWindow.mm:
1563
1564 2016-04-18  Tina Liu  <iting_liu@apple.com>
1565
1566         Declare a virtual function in PluginStrategy to be implemented by subclasses.
1567         https://bugs.webkit.org/show_bug.cgi?id=156540
1568
1569         Reviewed by Anders Carlsson.
1570
1571         * plugins/PluginStrategy.h:
1572
1573 2016-04-18  Eric Carlson  <eric.carlson@apple.com>
1574
1575         [iOS] don't toggle playback when media engine rate changes
1576         https://bugs.webkit.org/show_bug.cgi?id=156705
1577         <rdar://problem/25779175>
1578
1579         Reviewed by Jer Noble.
1580
1581         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1582         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged): Don't send the play/pause command
1583           unless the player item state is >= MediaPlayerAVPlayerItemStatusPlaybackBufferFull and
1584           the rate change is unexpected.
1585
1586 2016-04-18  Chris Dumez  <cdumez@apple.com>
1587
1588         Unreviewed, fix iOS9 build after r199682.
1589
1590         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1591         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1592
1593 2016-04-18  Chris Dumez  <cdumez@apple.com>
1594
1595         [WK2][iOS] Only adjust network responses' MIME type for QuickLook in the context of a main resource load
1596         https://bugs.webkit.org/show_bug.cgi?id=156639
1597         <rdar://problem/25765848>
1598
1599         Reviewed by Alex Christensen.
1600
1601         Only adjust network responses' MIME type for QuickLook in the context of a main
1602         resource load since we can only preview main resources with QuickLook. This
1603         avoids doing unnecessary work during page load. Also, this makes it a lot less
1604         likely to dlopen() the QuickLook library during page load since we now only
1605         adjust MIME type for QuickLook for main resources, and main resources usually
1606         have the well-known 'text/html' MIME type for which we know we will not use
1607         QuickLook.
1608
1609         After this change, we no longer need to dlopen() the QuickLook library in the
1610         NetworkProcess in the context of the PLT. We would previously dlopen() the
1611         library during the first page load, thus significantly slowing it down. As a
1612         result, we see a ~22% speed up in the PLT's first page load and a 0.9-1% overall
1613         PLT progression.
1614
1615         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1616         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1617         Pass flag to adjustMIMETypeIfNecessary() indicated if this is a main resource load.
1618
1619         * platform/network/ios/WebCoreURLResponseIOS.mm:
1620         (WebCore::adjustMIMETypeIfNecessary):
1621         Only adjust the MIME type for QuickLook if the isMainResourceLoad parameter is true.
1622
1623         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1624         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1625         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1626         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1627         Only adjust the MIME type for QuickLook if the isMainResourceLoad parameter is true.
1628
1629         * platform/network/mac/WebCoreURLResponse.h:
1630         * platform/network/mac/WebCoreURLResponse.mm:
1631         (WebCore::adjustMIMETypeIfNecessary):
1632
1633 2016-04-18  Brent Fulgham  <bfulgham@apple.com>
1634
1635         CSP: Remove stubs for dynamically-added favicons (via link rel="icon")
1636         https://bugs.webkit.org/show_bug.cgi?id=153151
1637         <rdar://problem/24383176>
1638
1639         Reviewed by Darin Adler.
1640
1641         Remove the unused dynamic favicon code and tests.
1642
1643         * loader/EmptyClients.h:
1644         * loader/FrameLoaderClient.h:
1645         * loader/LinkLoader.cpp:
1646         (WebCore::LinkLoader::loadLink):
1647
1648 2016-04-15  Jer Noble  <jer.noble@apple.com>
1649
1650         [Mac][EME] Protected content over HLS is not notified when a HDCP violation occurs.
1651         https://bugs.webkit.org/show_bug.cgi?id=156633
1652
1653         Reviewed by Eric Carlson.
1654
1655         Pass through the existing "outputObscuredDueToInsufficientExternalProtection" status as an
1656         error, similarly to what we do for CDMSessionMediaSourceAVFObjC.
1657
1658         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
1659         (WebCore::CDMSessionAVFoundationObjC::~CDMSessionAVFoundationObjC): Deleted.
1660         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
1661         (SOFT_LINK_CLASS):
1662         (-[WebCDMSessionAVFoundationObjCListener initWithParent:player:]):
1663         (-[WebCDMSessionAVFoundationObjCListener invalidate]):
1664         (-[WebCDMSessionAVFoundationObjCListener observeValueForKeyPath:ofObject:change:context:]):
1665         (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
1666         (WebCore::CDMSessionAVFoundationObjC::~CDMSessionAVFoundationObjC):
1667         (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
1668         (WebCore::CDMSessionAVFoundationObjC::playerDidReceiveError):
1669         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1670         (WebCore::MediaPlayerPrivateAVFoundationObjC::avPlayer):
1671
1672 2016-04-18  Chris Dumez  <cdumez@apple.com>
1673
1674         Unreviewed, rolling out r199644.
1675
1676         Seems to have caused a 1-2% regression on warm PLT
1677
1678         Reverted changeset:
1679
1680         "[WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess"
1681         https://bugs.webkit.org/show_bug.cgi?id=156639
1682         http://trac.webkit.org/changeset/199644
1683
1684 2016-04-17  Darin Adler  <darin@apple.com>
1685
1686         Get rid of IDBAny
1687         https://bugs.webkit.org/show_bug.cgi?id=156681
1688
1689         Reviewed by Brady Eidson.
1690
1691         IDBAny is not part of the public interface of Indexed Database.
1692         It was an implementation technique used to help create language bindings for
1693         functions that have to deal with types that aren't easly expressed with the
1694         normal IDL and C++ type system.
1695
1696         What was particularly dangerous about IDBAny is that it can be used to store
1697         arbitrary JavaScript objects and it's not easy to handle garbage collection and
1698         reference cycles when they are hidden behind this class's abstraction. It's also
1699         a needless extra layer, a reference counted object just to carry the types from
1700         the bindings to the C++ DOM implementation.
1701
1702         Ths patch also does many small style tweaks.
1703
1704         * CMakeLists.txt: Removed IDBAny source files. Added JSIDBRequestCustom.cpp.
1705         * DerivedSources.cpp: Ditto.
1706         * DerivedSources.make: Ditto.
1707         * WebCore.xcodeproj/project.pbxproj: Ditto.
1708
1709         * Modules/indexeddb/IDBAny.cpp: Removed.
1710         * Modules/indexeddb/IDBAny.h: Removed.
1711         * Modules/indexeddb/IDBAny.idl: Removed.
1712
1713         * Modules/indexeddb/IDBCursor.cpp: Added includes needed now that headers don't
1714         include as much.
1715         (WebCore::IDBCursor::stringToDirection): Removed unneeded IDBCursor namespacing.
1716         (WebCore::IDBCursor::directionToString): Ditto.
1717         (WebCore::IDBCursor::IDBCursor): Removed creation of IDBAny object.
1718         (WebCore::IDBCursor::direction): Removed unneeded IDBCursor namespacing.
1719         (WebCore::IDBCursor::key): Moved this function to the header.
1720         (WebCore::IDBCursor::primaryKey): Ditto.
1721         (WebCore::IDBCursor::value): Ditto.
1722         (WebCore::IDBCursor::source): Deleted this function; replaced with multiple
1723         type-specific functions; all but one will return null.
1724         (WebCore::IDBCursor::update): Take JSValue instead of Deprecated::ScriptValue.
1725         (WebCore::IDBCursor::advance): Take unsigned instead of unsigned long.
1726         Fell prey to the confusion because "unsigned long" in IDL means "unsigned" in C++.
1727         (WebCore::IDBCursor::continueFunction): Take JSValue instead of Deprecated::ScriptValue.
1728         (WebCore::IDBCursor::uncheckedIterateCursor): Take unsigned instead of unsigned long.
1729         (WebCore::IDBCursor::setGetResult): Rewrote to get the VM pointer from the
1730         ScriptExecutionContext here instead of inside the binding utilities functions.
1731
1732         * Modules/indexeddb/IDBCursor.h: Removed many unneeded includes.
1733         Changed key, primaryKey, and value to no longer take an unneeded ExecState.
1734         Made more functions private.
1735
1736         * Modules/indexeddb/IDBCursor.idl: Changed type of "source" to "any", which matches
1737         the IDB specification, rather than "IDBAny". Added [CustomGetter] so we can write the
1738         getter that understands the multiple possible values. Removed unneeded
1739         [CallWith=ScriptState] from key and primaryKey attributes.
1740
1741         * Modules/indexeddb/IDBCursorWithValue.h: Marked the class final.
1742         * Modules/indexeddb/IDBCursorWithValue.idl: Removed unneeded [CallWith=ScriptState]
1743         from the value attribute.
1744
1745         * Modules/indexeddb/IDBDatabase.cpp: Added now-needed include.
1746         * Modules/indexeddb/IDBDatabase.h: Removed this header's include of itself!
1747
1748         * Modules/indexeddb/IDBFactory.cpp: Added some now-needed includes.
1749         (WebCore::IDBFactory::~IDBFactory): Moved this out of the header file.
1750         (WebCore::IDBFactory::getDatabaseNames): Removed function that always returns nullptr.
1751         (WebCore::IDBFactory::open): Removed unneeded release() calls when returning a RefPtr.
1752         (WebCore::IDBFactory::cmp): Take JSValue instead of Deprecated::ScriptValue.
1753         Also removed unneeded typecast.
1754
1755         * Modules/indexeddb/IDBFactory.h: Removed many unneeded includes.
1756         Removed the getDatabaseNames function. We still need a solution here, but there is
1757         no reason to keep the placeholder function that returns nullptr here.
1758
1759         * Modules/indexeddb/IDBIndex.cpp:
1760         (WebCore::IDBIndex::keyPathAny): Removed.
1761         (WebCore::IDBIndex::openCursor): Take JSValue instead of Deprecated::ScriptValue.
1762         (WebCore::IDBIndex::count): Ditto.
1763         (WebCore::IDBIndex::openKeyCursor): Ditto.
1764         (WebCore::IDBIndex::get): Ditto.
1765         (WebCore::IDBIndex::getKey): Ditto.
1766
1767         * Modules/indexeddb/IDBIndex.h: Removed many unneeded includes, including this file
1768         including itself. Marked class final. Updated for above changes.
1769
1770         * Modules/indexeddb/IDBIndex.idl: Changed type of "keyPath" to "any", which matches
1771         the IDB specification, rather than "IDBAny". Specified [ImplementationReturnType=IDBKeyPath]
1772         so the code generator creates the appropriate code to convert from an IDBKeyPath.
1773         In the future, we may find a way to do this without an explicit attribute in the IDL
1774         file but this is fine for now.
1775
1776         * Modules/indexeddb/IDBKeyRange.cpp:
1777         (WebCore::IDBKeyRange::create): Moved this here from the header. Use booleans instead
1778         of enums because all the call sites outside this class are using booleans.
1779         (WebCore::IDBKeyRange::IDBKeyRange): Updated to use booleans.
1780         (WebCore::IDBKeyRange::~IDBKeyRange): Moved here from the header.
1781         (WebCore::IDBKeyRange::lowerValue): Removed now-unneeded get().
1782         (WebCore::IDBKeyRange::upperValue): Ditto.
1783         (WebCore::IDBKeyRange::only): Take JSValue instead of Deprecated::ScriptValue.
1784         (WebCore::IDBKeyRange::lowerBound): Updated for above changes.
1785         (WebCore::IDBKeyRange::upperBound): Ditto.
1786         (WebCore::IDBKeyRange::bound): Ditto.
1787         (WebCore::IDBKeyRange::isOnlyKey): Removed assertions that lower and upper are not null;
1788         there is no real guarantee of this! Rewrote and streamlined and it handles the null case now.
1789
1790         * Modules/indexeddb/IDBKeyRange.h: Removed unneeded includes. Changed class to use booleans
1791         instead of enums for m_isLowerOpen and m_isUpperOpen. Moved functions into the cpp file.
1792
1793         * Modules/indexeddb/IDBKeyRangeData.cpp:
1794         (WebCore::IDBKeyRangeData::maybeCreateIDBKeyRange): Updated to use booleans instead of enums.
1795
1796         * Modules/indexeddb/IDBObjectStore.cpp:
1797         (WebCore::IDBObjectStore::name): Changed return type to const String& to cut down on
1798         reference count churn.
1799         (WebCore::IDBObjectStore::keyPathAny): Deleted.
1800         (WebCore::IDBObjectStore::keyPath): Changed return type to const IDBKeyPath& to cut down on
1801         unnecessary copies.
1802         (WebCore::IDBObjectStore::openCursor): Take JSValue instead of Deprecated::SCriptValue.
1803         (WebCore::IDBObjectStore::get): Ditto.
1804         (WebCore::IDBObjectStore::putOrAdd): Ditto. Removed peculiar adoptRef/leakRef that was not needed.
1805         (WebCore::IDBObjectStore::deleteFunction): Ditto.
1806         (WebCore::IDBObjectStore::modernDelete): Ditto. Use releaseNonNull for better efficiency.
1807         (WebCore::IDBObjectStore::count): Ditto.
1808
1809         * Modules/indexeddb/IDBObjectStore.h: Removed unneeded includes and changed types as mentioned
1810         above in the cpp file function descriptions.
1811
1812         * Modules/indexeddb/IDBObjectStore.idl: Changed type of "keyPath" to "any" and
1813         specified [ImplementationReturnType=IDBKeyPath] as above in IDBIndex.idl.
1814
1815         * Modules/indexeddb/IDBOpenDBRequest.cpp: Added now-needed includes.
1816         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit): Removed unneeded assertions
1817         that depend on how m_result is implemented, which changed.
1818         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion): Call setResultToUndefined
1819         instead of setting m_result directly.
1820         (WebCore::IDBOpenDBRequest::onSuccess): Call setResult instead of setting m_result and
1821         m_readyState directly.
1822         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):: Ditto. Also use WTFMove to set
1823         m_transaction instead of peculiar adoptRef/leakRef.
1824         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess): Call setResultToUndefined
1825         instead of setting m_result directly.
1826
1827         * Modules/indexeddb/IDBOpenDBRequest.h: Marked the class final. Removed some unneeded headers
1828         and made more things private.
1829
1830         * Modules/indexeddb/IDBRequest.cpp:
1831         (WebCore::IDBRequest::IDBRequest): Don't initialize m_source any more. Instead initialize
1832         m_objectStoreSource and m_indexSource, preserving the old behavior and not setting m_cursorSource
1833         even when passed an IDBCursor.
1834         (WebCore::IDBRequest::~IDBRequest): Simplify the code that calls clearRequest on the result
1835         if it's a cursor. The logic is now simply a null check.
1836         (WebCore::IDBRequest::result): Deleted. The logic is now in a custom binding.
1837         (WebCore::IDBRequest::error): Updated to use m_isDone instead of m_readyState.
1838         (WebCore::IDBRequest::source): Deleted. The logic is now in a custom binding.
1839         (WebCore::IDBRequest::setSource): Set m_objectStoreSource, m_indexSource, and m_cursorSource
1840         instead of setting m_source.
1841         (WebCore::IDBRequest::readyState): Updated to use m_isDone instead of m_readyState.
1842         (WebCore::IDBRequest::sourceObjectStoreIdentifier): Use m_objectStoreSource and
1843         m_indexSource instead of using m_source. To preserve current behavior, this this does not
1844         use m_cursorSource since the old code did not handle IDBCursor.
1845         (WebCore::IDBRequest::sourceIndexIdentifier): Use m_indexSource instead of m_source, preserving
1846         current behavior.
1847         (WebCore::IDBRequest::requestedIndexRecordType): Ditto.
1848         (WebCore::IDBRequest::dispatchEvent): Updated to use m_isDone instead of m_readyState.
1849         (WebCore::IDBRequest::setResult): Rewrote to use the clearResult function so we don't
1850         have to repeat the code to clear result pointers. Also take a reference.
1851         (WebCore::IDBRequest::setResultToStructuredClone): Ditto.
1852         (WebCore::IDBRequest::clearResult): Clear out m_scriptResult, m_cursorResult, and m_databaseResult
1853         instead of m_result.
1854         (WebCore::IDBRequest::setResultToUndefined): Set m_scriptResult instead of m_result.
1855         (WebCore::IDBRequest::resultCursor): Use m_cursorResult instead of m_result.
1856         (WebCore::IDBRequest::willIterateCursor): Updated to use m_isDone instead of m_readyState.
1857         Also call setResultToUndefined instead of setting m_result.
1858         (WebCore::IDBRequest::didOpenOrIterateCursor): Call setResultToUndefined and set m_cursorResult
1859         instead of setting m_result.
1860         (WebCore::IDBRequest::requestCompleted): Updated to use m_isDone instead of m_readyState.
1861         (WebCore::IDBRequest::setResult): Added for use by the derived class; sets m_databaseResult.
1862
1863         * Modules/indexeddb/IDBRequest.h: Removed unneeded includes. Removed unused IDBRequestReadyState,
1864         since that's now done with strings. Added cursorResult, databaseResult, scriptResult,
1865         objectStoreSource, indexSource, and cursorSource function members and corresponding data members.
1866         Later we might re-cast this as some sort of union, but for now these separate functions seem fine.
1867         Removed unused modernResult function. Made more things private.
1868
1869         * Modules/indexeddb/IDBRequest.idl: Use "any" instead of "IDBAny" for "result" and "source".
1870
1871         * Modules/indexeddb/IDBTransaction.cpp: Added now-needed includes.
1872         (WebCore::IDBTransaction::didGetRecordOnServer): Updated to call the version of setResult that takes
1873         a reference.
1874         (WebCore::IDBTransaction::didPutOrAddOnServer): Ditto.
1875         * Modules/indexeddb/IDBTransaction.h: Removed unneeded includes, derive privately from ActiveDOMObject.
1876         Removed some unneeded WebCore prefixes.
1877
1878         * Modules/indexeddb/server/MemoryIndex.h: Added now-needed include.
1879
1880         * Modules/indexeddb/server/MemoryObjectStore.cpp: Added now-needed includes.
1881         (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord): Remove unneeded get() call.
1882         (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords): Ditto.
1883
1884         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: Added now-needed includes.
1885         (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): Remove unneeded get() call.
1886         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): Ditto.
1887
1888         * Modules/indexeddb/server/SQLiteIDBCursor.cpp: Added now-needed include.
1889
1890         * Modules/indexeddb/server/UniqueIDBDatabase.cpp: Added now-needed includes.
1891         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): Updated to use JSValue.
1892
1893         * Modules/indexeddb/server/UniqueIDBDatabase.h: Added now-needed forward declaration of JSC::VM.
1894
1895         * bindings/js/IDBBindingUtilities.cpp: Added now-needed includes.
1896         (WebCore::deserializeIDBValueToJSValue): Return JSValue instead of Strong<Unknown>.
1897         (WebCore::deserializeIDBValueDataToJSValue): Ditto.
1898         (WebCore::idbKeyDataToScriptValue): Ditto.
1899         (WebCore::toJS): Added an overload of toJS for IDBKeyPath here. Moved here from JSIDBAnyCustom.cpp.
1900
1901         * bindings/js/IDBBindingUtilities.h: Removed unneeded include. Changed return types to JSValue.
1902         Added the toJS function for IDBKeyPath.
1903
1904         * bindings/js/JSIDBAnyCustom.cpp: Removed.
1905
1906         * bindings/js/JSIDBCursorCustom.cpp: Added some now-needed includes.
1907         (WebCore::JSIDBCursor::visitAdditionalChildren): Removed ann unneeded type cast.
1908         (WebCore::JSIDBCursor::source): Added. Converts either the index source or the object source into
1909         a JSValue.
1910
1911         * bindings/js/JSIDBRequestCustom.cpp: Added.
1912         (WebCore::JSIDBRequest::result): Added. Throws an exception if isDone is false and then converts
1913         cursor result, database result, or script result into a JSValue.
1914         (WebCore::JSIDBRequest::source): Added. Converts the cursor source, index source, or object store
1915         source into a JSValue.
1916
1917         * bindings/scripts/CodeGeneratorJS.pm:
1918         (NativeToJSValue): Tweaked the code for array slightly. Added an ImplementationReturnType case
1919         for IDBKeyPath. The code that's generated is pretty generic, just a call to toJS with the conventional
1920         arguments, so at some point we may be able to do this with C++ overloading and not require a
1921         special case in the code generator.
1922
1923         * inspector/InspectorIndexedDBAgent.cpp: Put #if 0 around the getDatabaseNames code, which was
1924         dormant and not working.
1925         (WebCore::OpenDatabaseCallback::handleEvent): Changed this to use IDBOpenDBRequest::databaseResult
1926         instead of calling the result function checking for an exception and then doing type checking.
1927         (WebCore::idbKeyRangeFromKeyRange): Updated to use booleans for key range bound open state.
1928         (WebCore::OpenCursorCallback::handleEvent): Same kind of change as for OpenDatabaseCallback above.
1929         Also use simpler interface to key, primaryKey, and value.
1930         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): Put #if 0 around the getDatabaseNames
1931         code, which was dormant and not working. Needs to be re-implemented.
1932
1933 2016-04-18  Eric Carlson  <eric.carlson@apple.com>
1934
1935         Media element "user gesture for fullscreen" restriction is never lifted
1936         https://bugs.webkit.org/show_bug.cgi?id=156547
1937         <rdar://problem/25707814>
1938
1939         Reviewed by Jer Noble.
1940
1941         Test: media/video-fullscreen-restriction-removed.html
1942
1943         * html/MediaElementSession.cpp:
1944         (WebCore::MediaElementSession::playbackPermitted): Check fullscreenPermitted rather than
1945           checking for a user gesture because the restriction can be removed.
1946
1947 2016-04-18  Frederic Wang  <fwang@igalia.com>
1948
1949         Refactor RenderMathMLScripts layout to avoid using flexbox
1950         https://bugs.webkit.org/show_bug.cgi?id=153917
1951
1952         Reviewed by Martin Robinson.
1953
1954         Tests: mathml/mathml-in-html5/subsup-parameters-1.html
1955                mathml/opentype/large-operators-italic-correction.html
1956
1957         Reimplement RenderMathMLScripts without any flexbox or anonymous.
1958         We also rely on parameters from the MATH table to improve rendering.
1959
1960         * css/mathml.css:
1961         (msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ *): Deleted.
1962         Invalid markup for scripts is now just hidden.
1963         * rendering/mathml/RenderMathMLOperator.h: ditto.
1964         * rendering/mathml/RenderMathMLScripts.cpp:
1965         (WebCore::RenderMathMLScripts::unembellishedOperator): Reimplemented.
1966         (WebCore::RenderMathMLScripts::getBaseAndScripts): Helper function to verify whether the
1967         child list is valid and retrieve pointers on important children.
1968         (WebCore::RenderMathMLScripts::spaceAfterScript): Helper function to get the
1969         space after a script.
1970         (WebCore::RenderMathMLScripts::italicCorrection): Helper function to read the
1971         italic correction of a largeop base.
1972         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Implement this function.
1973         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Helper function to get
1974         the maximum ascent/descent of all the scripts and determine the minimal
1975         sub/sup shifts to apply.
1976         (WebCore::RenderMathMLScripts::mirrorIfNeeded): Helper function to calculate the horizontal
1977         offset depending on the directionality.
1978         (WebCore::RenderMathMLScripts::layoutBlock): Implement this function.
1979         (WebCore::RenderMathMLScripts::firstLineBaseline): Implement this function.
1980         (WebCore::RenderMathMLScripts::paintChildren): Implement this function.
1981         (WebCore::RenderMathMLScripts::RenderMathMLScripts): Deleted.
1982         (WebCore::RenderMathMLScripts::base): Deleted.
1983         (WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair): Deleted.
1984         (WebCore::RenderMathMLScripts::fixAnonymousStyles): Deleted.
1985         (WebCore::RenderMathMLScripts::addChildInternal): Deleted.
1986         (WebCore::RenderMathMLScripts::removeChildInternal): Deleted.
1987         (WebCore::RenderMathMLScripts::addChild): Deleted.
1988         (WebCore::RenderMathMLScripts::removeChild): Deleted.
1989         (WebCore::RenderMathMLScripts::styleDidChange): Deleted.
1990         (WebCore::RenderMathMLScripts::layout): Deleted.
1991         (WebCore::RenderMathMLScriptsWrapper::createAnonymousWrapper): Deleted.
1992         (WebCore::RenderMathMLScriptsWrapper::addChildInternal): Deleted.
1993         (WebCore::RenderMathMLScriptsWrapper::addChild): Deleted.
1994         (WebCore::RenderMathMLScriptsWrapper::removeChildInternal): Deleted.
1995         (WebCore::RenderMathMLScriptsWrapper::removeChild): Deleted.
1996         * rendering/mathml/RenderMathMLScripts.h: Update definitions and remove classes
1997         for anonymous wrappers.
1998
1999 2016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
2000
2001         [css-grid] Use grid-template-areas to determine the explicit grid
2002         https://bugs.webkit.org/show_bug.cgi?id=156575
2003
2004         Reviewed by Darin Adler.
2005
2006         From the spec (https://drafts.csswg.org/css-grid/#grid-definition):
2007         "The size of the explicit grid is determined by the larger of the number
2008         of rows/columns defined by grid-template-areas and the number
2009         of rows/columns sized by grid-template-rows/grid-template-columns."
2010
2011         So we need to take into account the rows/columns defined by
2012         grid-template-areas to determine the size of the explicit grid.
2013
2014         Test: fast/css-grid-layout/explicit-grid-size.html
2015
2016         * rendering/style/GridPositionsResolver.cpp:
2017         (WebCore::GridPositionsResolver::explicitGridColumnCount):
2018         (WebCore::GridPositionsResolver::explicitGridRowCount):
2019
2020 2016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2021
2022         [GTK] Menu list button doesn't use the text color from the theme
2023         https://bugs.webkit.org/show_bug.cgi?id=118234
2024
2025         Reviewed by Darin Adler.
2026
2027         Set the combo box color accroding to the theme when adjusting the menu list style like Mac port does.
2028
2029         * rendering/RenderThemeGtk.cpp:
2030         (WebCore::menuListColor):
2031         (WebCore::RenderThemeGtk::adjustMenuListStyle):
2032
2033 2016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
2034
2035         [css-grid] Fix positioned items with content alignment
2036         https://bugs.webkit.org/show_bug.cgi?id=156597
2037
2038         Reviewed by Darin Adler.
2039
2040         Like for the case of gaps we need to take into account
2041         the content alignment in order to properly place and size
2042         the positioned items.
2043
2044         Regarding content alignment we need to care about 2 values:
2045         the position offset and the distribution offset.
2046         The position offset can be extracted from m_column|rowPositions,
2047         but the distribution offset is stored in 2 new variables called
2048         m_offsetBetweenColumns|Rows.
2049
2050         Tests: fast/css-grid-layout/grid-positioned-items-content-alignment.html
2051                fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html
2052
2053         * rendering/RenderGrid.cpp:
2054         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2055         (WebCore::RenderGrid::populateGridPositions):
2056         (WebCore::RenderGrid::columnAxisOffsetForChild):
2057         (WebCore::RenderGrid::rowAxisOffsetForChild):
2058         (WebCore::RenderGrid::rowAxisPositionForChild): Deleted.
2059         * rendering/RenderGrid.h:
2060
2061 2016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
2062
2063         [css-grid] Add method to translate RTL coordinates
2064         https://bugs.webkit.org/show_bug.cgi?id=156589
2065
2066         Reviewed by Antonio Gomes.
2067
2068         This is just a small refactoring adding a new function
2069         LayoutGrid::translateRTLCoordinate().
2070         This method translates to physical coordinates the information
2071         stored in m_columnPositions when you're using RTL direction.
2072
2073         No new tests, no change of behavior.
2074
2075         * rendering/RenderGrid.cpp:
2076         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): Use the new
2077         method translateRTLCoordinate().
2078         (WebCore::RenderGrid::translateRTLCoordinate): New method that converts
2079         a coordinate from m_columnPositions in RTL into a physical coordinate.
2080         (WebCore::RenderGrid::findChildLogicalPosition): Use the new method
2081         translateRTLCoordinate().
2082         * rendering/RenderGrid.h: Add method signature.
2083
2084 2016-04-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2085
2086         [Fetch] Use @isArray instead of `instanceof @Array`
2087         https://bugs.webkit.org/show_bug.cgi?id=156682
2088
2089         Reviewed by Alex Christensen.
2090
2091         Currently, we query whether the given value is Array by using `instanceof @Array`.
2092         But it is not enough; Array from the other realm should be accepted. And Array
2093         not inheriting @Array should be also accepted.
2094
2095         Test: fetch/header-constructor-is-array.html
2096
2097         * Modules/fetch/FetchHeaders.js:
2098         (initializeFetchHeaders):
2099
2100 2016-04-17  Yoav Weiss  <yoav@yoav.ws>
2101
2102         Initial Link preload support
2103         https://bugs.webkit.org/show_bug.cgi?id=156334
2104
2105         Added basic `<link rel=preload>` functionality that enables preloading
2106         of resources according to their type.
2107
2108         Reviewed by Darin Adler.
2109
2110         Tests: http/tests/preload/download_resources.html
2111                http/tests/preload/dynamic_adding_preload.html
2112                http/tests/preload/dynamic_remove_preload_href.html
2113                http/tests/preload/dynamic_removing_preload.html
2114
2115         * bindings/generic/RuntimeEnabledFeatures.cpp: Added a runtime flag for the feature.
2116         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
2117         * bindings/generic/RuntimeEnabledFeatures.h: Added a runtime flag for the feature.
2118         (WebCore::RuntimeEnabledFeatures::setLinkPreloadEnabled):
2119         (WebCore::RuntimeEnabledFeatures::linkPreloadEnabled):
2120         * html/HTMLAttributeNames.in: Added an `as` attribute.
2121         * html/HTMLLinkElement.cpp:
2122         (WebCore::HTMLLinkElement::process): Added `as` and `crossorigin` attribute values to the loadLink() call.
2123         (WebCore::HTMLLinkElement::setCrossOrigin): Setter for crossOrigin.
2124         (WebCore::HTMLLinkElement::crossOrigin): Getter for crossOrigin.
2125         * html/HTMLLinkElement.idl: Added `as` and `crossorigin` to HTMLLinkElement.
2126         * html/HTMLLinkElement.h: Added getter and setter for crossorigin.
2127         * html/LinkRelAttribute.cpp:
2128         (WebCore::LinkRelAttribute::LinkRelAttribute): Added "preload" as a potential value.
2129         * html/LinkRelAttribute.h: Added isLinkPreload.
2130         * loader/LinkLoader.cpp:
2131         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Translates an `as` value into a resource type.
2132         (WebCore::preloadIfNeeded): Triggers a resource preload when link element is a preload one.
2133         (WebCore::LinkLoader::loadLink): Added a call to preloadIfNeeded.
2134         * loader/LinkLoader.h: Added signatures.
2135         * loader/ResourceLoadInfo.cpp:
2136         (WebCore::toResourceType): Added LinkPreload as a possible CachedResource::type.
2137         * loader/SubresourceLoader.cpp:
2138         (WebCore::logResourceLoaded): Added LinkPreload as a possible CachedResource::type.
2139         * loader/cache/CachedResource.cpp: Turned defaultPriorityForResourceType into a static member, as it's now also called from LinkLoader.
2140         (WebCore::CachedResource::defaultPriorityForResourceType): Added LinkPreload as a possible CachedResource::type, giving it low priority.
2141         (WebCore::defaultPriorityForResourceType): Deleted.
2142         * loader/cache/CachedResource.h: Added LinkPreload as a possible CachedResource::type. Added defaultPriorityForResourceType as static.
2143         * loader/cache/CachedResourceLoader.cpp:
2144         (WebCore::contentTypeFromResourceType): Added LinkPreload as a possible CachedResource::type.
2145         (WebCore::createResource): Added creation of a LinkPreload resource if needed.
2146         (WebCore::CachedResourceLoader::checkInsecureContent): Added LinkPreload as a possible CachedResource::type.
2147         (WebCore::CachedResourceLoader::canRequest): Added LinkPreload as a possible CachedResource::type.
2148         * testing/Internals.cpp: Added function to turn on the link preload feature.
2149         (WebCore::setLinkPreloadSupport):
2150         * testing/Internals.idl: Added function to turn on the link preload feature.
2151         * testing/Internals.h: Added function signature to turn on the link preload feature.
2152
2153 2016-04-17  Conrad Shultz  <conrad_shultz@apple.com>
2154
2155         Try (again) to fix debug builds after r199643.
2156
2157         Unreviewed.
2158
2159         * dom/ScriptExecutionContext.cpp:
2160         Add another missing include.
2161
2162 2016-04-17  Conrad Shultz  <conrad_shultz@apple.com>
2163
2164         Try to fix debug builds after r199643.
2165
2166         Unreviewed.
2167
2168         * Modules/indexeddb/IDBObjectStore.cpp:
2169         Add a missing include.
2170
2171 2016-04-17  Chris Dumez  <cdumez@apple.com>
2172
2173         [WK2][iOS] Do not dlopen() QuickLook in the NetworkProcess
2174         https://bugs.webkit.org/show_bug.cgi?id=156639
2175
2176         Reviewed by Darin Adler.
2177
2178         Do not unnecessarily dlopen() QuickLook in the NetworkProcess on iOS, as
2179         we already dlopen() this library in the WebContent process. This patch
2180         moves the resource response MIME type adjusting code for QuickLook from
2181         adjustMIMETypeIfNecessary() to a new adjustMIMETypeForQuickLook() function.
2182         adjustMIMETypeIfNecessary() is called in didReceiveResponse() in the Network
2183         process side, for *every* resource response, even though QuickLook can only
2184         be used to preview main resources. The new adjustMIMETypeForQuickLook()
2185         function is called in the QuickLookHandle::createIfNecessary() factory
2186         function, right before checking the MIME type to determine if we need to
2187         use QuickLook, and after checking that the load is for a main resource.
2188         In the WebKit2 case, the factory function is called from
2189         WebResourceLoader::didReceiveResponse(), on the WebContent process side.
2190
2191         This patch speeds up the first page load during PLT by ~22%, because the
2192         first load no longer triggers a dlopen() to QuickLook in the NetworkProcess.
2193         The overall PLT score seems to be progressed by 0.9-1% as well. The change
2194         should also be memory-positive as we no longer need to dlopen() the
2195         QuickLook library in the NetworkProcess at all (and we would already dlopen()
2196         it on the WebContent process side anyway). Sadly, PLUM benchmark does not
2197         show the memory benefit because it does not measure the memory used by the
2198         Network process.
2199
2200         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2201         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
2202         Refactor the code a bit for clarity, so that we only
2203         ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
2204         returns a non-null pointer.
2205
2206         * platform/network/ios/QuickLook.h:
2207         - Rename the factories from create() to createIfNecessary() given that they
2208           return nullptr when it is unnecessary to create such handle (i.e. this is not
2209           a main resource loader, or it is unecessary given the response's MIME type.
2210         - Make shouldCreateForMIMEType() private now that this is always called inside
2211           the factory functions.
2212
2213         * platform/network/ios/QuickLook.mm:
2214         (adjustMIMETypeForQuickLook):
2215         Extracted code for adjusting the MIME type for QuickLook from the generic
2216         adjustMIMETypeIfNecessary() in WebCoreURLResponseIOS.mm to its own function
2217         here.
2218
2219         (WebCore::QuickLookHandle::createIfNecessary):
2220         Call adjustMIMETypeForQuickLook() before checking the MIME type.
2221
2222         * platform/network/ios/WebCoreURLResponseIOS.mm:
2223         (WebCore::adjustMIMETypeIfNecessary):
2224         Extracted QuickLook-specific code to QuickLook.mm.
2225
2226         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2227         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
2228         Refactor the code a bit for clarity, so that we only
2229         ResourceHandle::setQuickLookHandle() when QuickLookHandle::createIfNecessary()
2230         returns a non-null pointer.
2231
2232 2016-04-17  Brady Eidson  <beidson@apple.com>
2233
2234         Clean up IDBBindingUtilities.
2235         https://bugs.webkit.org/show_bug.cgi?id=156472
2236
2237         Reviewed by Alex Christensen.
2238
2239         No new tests (No change in behavior).
2240
2241         - Get rid of a whole bunch of unused functions (since we got rid of Legacy IDB).
2242         - Make more functions deal in ExecState/ScriptExecutionContexts instead of DOMRequestState.
2243         - Make more functions deal in JSValue (as JSC::Strong<JSC::Unknown>) instead of Deprecated::ScriptValue.
2244
2245         * bindings/scripts/IDLAttributes.txt: Add a new attribute to signify that an implementation returns
2246           JSValues instead of Deprecated::ScriptState
2247         * bindings/scripts/CodeGeneratorJS.pm:
2248         (NativeToJSValue): Use that new attribute.
2249         
2250         * Modules/indexeddb/IDBAny.cpp:
2251         (WebCore::IDBAny::IDBAny):
2252         (WebCore::IDBAny::scriptValue):
2253         * Modules/indexeddb/IDBAny.h:
2254         (WebCore::IDBAny::create):
2255         
2256         * Modules/indexeddb/IDBCursor.cpp:
2257         (WebCore::IDBCursor::key):
2258         (WebCore::IDBCursor::primaryKey):
2259         (WebCore::IDBCursor::value):
2260         (WebCore::IDBCursor::update):
2261         (WebCore::IDBCursor::continueFunction):
2262         (WebCore::IDBCursor::deleteFunction):
2263         (WebCore::IDBCursor::setGetResult):
2264         * Modules/indexeddb/IDBCursor.h:
2265         * Modules/indexeddb/IDBCursor.idl:
2266         * Modules/indexeddb/IDBCursorWithValue.idl:
2267         
2268         * Modules/indexeddb/IDBFactory.cpp:
2269         (WebCore::IDBFactory::cmp):
2270         
2271         * Modules/indexeddb/IDBIndex.cpp:
2272         (WebCore::IDBIndex::count):
2273         (WebCore::IDBIndex::get):
2274         (WebCore::IDBIndex::getKey):
2275         
2276         * Modules/indexeddb/IDBKeyRange.cpp:
2277         (WebCore::IDBKeyRange::lowerValue):
2278         (WebCore::IDBKeyRange::upperValue):
2279         (WebCore::IDBKeyRange::only):
2280         (WebCore::IDBKeyRange::lowerBound):
2281         (WebCore::IDBKeyRange::upperBound):
2282         (WebCore::IDBKeyRange::bound):
2283         * Modules/indexeddb/IDBKeyRange.h:
2284         * Modules/indexeddb/IDBKeyRange.idl:
2285         
2286         * Modules/indexeddb/IDBObjectStore.cpp:
2287         (WebCore::IDBObjectStore::get):
2288         (WebCore::IDBObjectStore::modernDelete):
2289         (WebCore::IDBObjectStore::count):
2290         
2291         * Modules/indexeddb/IDBRequest.cpp:
2292         (WebCore::IDBRequest::setResult):
2293         (WebCore::IDBRequest::setResultToStructuredClone):
2294         
2295         * Modules/indexeddb/server/MemoryObjectStore.cpp:
2296         (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
2297         (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
2298         
2299         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2300         (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
2301         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
2302         
2303         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2304         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
2305         
2306         * bindings/js/IDBBindingUtilities.cpp:
2307         (WebCore::idbKeyPathFromValue):
2308         (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
2309         (WebCore::injectIDBKeyIntoScriptValue):
2310         (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
2311         (WebCore::canInjectIDBKeyIntoScriptValue):
2312         (WebCore::deserializeIDBValueToJSValue):
2313         (WebCore::deserializeIDBValueDataToJSValue):
2314         (WebCore::scriptValueToIDBKey):
2315         (WebCore::idbKeyDataToScriptValue):
2316         (WebCore::idbKeyDataToJSValue): Deleted.
2317         (WebCore::createIDBKeyFromScriptValueAndKeyPath): Deleted.
2318         (WebCore::deserializeIDBValue): Deleted.
2319         (WebCore::deserializeIDBValueData): Deleted.
2320         (WebCore::deserializeIDBValueBuffer): Deleted.
2321         (WebCore::idbValueDataToJSValue): Deleted.
2322         (WebCore::idbKeyToScriptValue): Deleted.
2323         * bindings/js/IDBBindingUtilities.h:
2324
2325         * bindings/js/JSIDBAnyCustom.cpp:
2326         (WebCore::toJS):
2327
2328         * bindings/js/JSIDBDatabaseCustom.cpp:
2329         (WebCore::JSIDBDatabase::createObjectStore):
2330
2331         * bindings/js/JSIDBObjectStoreCustom.cpp:
2332         (WebCore::JSIDBObjectStore::createIndex):
2333
2334         * dom/ScriptExecutionContext.cpp:
2335         (WebCore::ScriptExecutionContext::execState):
2336         * dom/ScriptExecutionContext.h:
2337
2338         * inspector/InspectorIndexedDBAgent.cpp:
2339
2340 2016-04-17  Darin Adler  <darin@apple.com>
2341
2342         Remove more uses of Deprecated::ScriptXXX
2343         https://bugs.webkit.org/show_bug.cgi?id=156660
2344
2345         Reviewed by Antti Koivisto.
2346
2347         * Modules/mediacontrols/MediaControlsHost.h: Removed unneeded include.
2348
2349         * Modules/plugins/PluginReplacement.h: Removed unneeded include.
2350         Changed argument to installReplacement into a reference. Changed return
2351         value for creation function from PassRefPtr to Ref.
2352
2353         * Modules/plugins/QuickTimePluginReplacement.h: Removed unneeded includes and
2354         forward declarations. Marked class final. Made almost everything private.
2355
2356         * Modules/plugins/QuickTimePluginReplacement.mm:
2357         (WebCore::QuickTimePluginReplacement::create): Changed to return Ref.
2358         (WebCore::QuickTimePluginReplacement::installReplacement): Changed to take
2359         a reference.
2360
2361         * Modules/plugins/YouTubePluginReplacement.cpp:
2362         (WebCore::YouTubePluginReplacement::create): Changed to return Ref.
2363         (WebCore::YouTubePluginReplacement::installReplacement): Changed to take
2364         a reference.
2365
2366         * Modules/plugins/YouTubePluginReplacement.h: Removed unneeded includes and
2367         forward declarations. Marked class final. Changed return type of create.
2368
2369         * Modules/websockets/WebSocket.cpp:
2370         (WebCore::WebSocket::didReceiveBinaryData): Removed local variable so the
2371         MessageEvent::create function gets a Ref&& instead of a RefPtr without having
2372         to add explicit WTFMove.
2373
2374         * bindings/js/DOMRequestState.h: Removed code that set m_exec twice.
2375
2376         * bindings/js/Dictionary.h: Reformatted function templates to use a single
2377         line so they are easier to look at.
2378         (WebCore::Dictionary::getEventListener): Rewrote this so it no longer uses
2379         a Deprecated::ScriptValue and also make it a little more compact and terse.
2380
2381         * bindings/js/JSCommandLineAPIHostCustom.cpp:
2382         (WebCore::JSCommandLineAPIHost::inspect): Rewrote to use JSValue instead of
2383         Deprecated::ScriptValue. Considerably more efficient.
2384
2385         * bindings/js/JSMessageEventCustom.cpp:
2386         (WebCore::JSMessageEvent::data): Streamlined to use Deprecated::ScriptValue
2387         a little bit less.
2388
2389         * bindings/js/JSNodeCustom.cpp: Moved include here from header.
2390         * bindings/js/JSNodeCustom.h: Moved include from here to cpp file.
2391
2392         * bindings/js/JSPopStateEventCustom.cpp:
2393         (WebCore::JSPopStateEvent::state): Updated for changes to return value of the
2394         state() and serializedState functions.
2395
2396         * bindings/js/ScriptState.h: Removed the ScriptState typedef.
2397
2398         * bindings/js/SerializedScriptValue.cpp: Moved include here from header.
2399         * bindings/js/SerializedScriptValue.h: Moved include from here to cpp file.
2400
2401         * css/FontFace.cpp:
2402         (WebCore::FontFace::create): Changed argument to JSValue instead of ScriptValue.
2403         * css/FontFace.h: Ditto.
2404
2405         * dom/MessageEvent.cpp: Moved create functions in here from header file.
2406         Removed some unused ones including one that took a Deprecated::ScriptValue.
2407         * dom/MessageEvent.h: Streamlined create functions, removing unused functions,
2408         unused arguments, and unused default values for arguments. Also moved them all
2409         into the cpp file instead of inlining them. Also changed the return type of
2410         dataAsScriptValue to JSValue.
2411
2412         * dom/NodeFilterCondition.h: Removed unneeded include. Tweaked formatting.
2413
2414         * dom/PopStateEvent.h: Changed return value of state to be a JSValue and of
2415         serializedState to be a raw pointer, not a PassRefPtr.
2416
2417         * dom/Traversal.h: Removed unneeded include. Removed unnecessary use of
2418         unsigned long instead of unsigned. Fixed indentation.
2419
2420         * html/HTMLPlugInElement.cpp:
2421         (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot): Pass reference.
2422
2423         * inspector/InspectorDOMAgent.cpp:
2424         (WebCore::InspectorDOMAgent::buildObjectForEventListener): Pass JSValue instead
2425         of constructing a Deprecated::ScriptValue.
2426
2427         * inspector/InspectorFrontendHost.cpp:
2428         (WebCore::FrontendMenuProvider::disconnect): Initialize without explicitly
2429         mentioning the Deprecated::ScriptObject type.
2430
2431         * inspector/InspectorIndexedDBAgent.cpp: Removed unneeded include.
2432
2433         * inspector/InspectorInstrumentation.h: Removed unneeded include and also
2434         declaration of two non-existent functions.
2435
2436         * page/DOMWindow.cpp:
2437         (WebCore::PostMessageTimer::PostMessageTimer): Tweaked types a little bit to
2438         match what is used in MessageEvent now.
2439         (WebCore::PostMessageTimer::event): Streamlined a bit and changed type to
2440         reference.
2441         (WebCore::DOMWindow::postMessage): Updated for changes above.
2442         (WebCore::DOMWindow::postMessageTimerFired): Ditto.
2443
2444         * page/EventSource.cpp:
2445         (WebCore::EventSource::createMessageEvent): Removed now-unneeded
2446         "false, false" from MessageEvent::create function call.
2447
2448         * page/csp/ContentSecurityPolicy.h: Removed unneeded include.
2449
2450         * page/csp/ContentSecurityPolicyDirectiveList.h: Removed unneeded
2451         include and also unneeded non-copyable, since the class has a reference as
2452         a data member and so is automatically non-copyable.
2453
2454         * testing/Internals.cpp:
2455         (WebCore::Internals::description): Changed to take JSValue.
2456         (WebCore::Internals::parserMetaData): Ditto.
2457         (WebCore::Internals::serializeObject): Removed unnecessary copying of vector.
2458         (WebCore::Internals::isFromCurrentWorld): Changed to take JSValue.
2459         (WebCore::Internals::isReadableStreamDisturbed): Changed to not rely on the
2460         ScriptState typedef and call it JSC::ExecState.
2461
2462         * testing/Internals.h: Removed unneeded includes. Removed unneeded and
2463         inappropriate use of ASSERT_NO_EXCEPTION.
2464
2465 2016-04-17  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2466
2467         [Fetch API] Consume HTTP data as a ReadableStream
2468         https://bugs.webkit.org/show_bug.cgi?id=138968
2469
2470         Reviewed by Alex Christensen.
2471
2472         This patch introduces ReadableStreamSource and ReadableStreamController which allow feeding a ReadableStream from DOM classes.
2473         ReadableStreamSource is a base class for all DOM ReadableStream sources.
2474         ReadableStreamController is a wrapper around JSReadableStreamController that can be invoked by DOM code to enqueue/close/error a ReadableStream.
2475         A createReadableStream function is introduced to allow DOM classes creating ReadableStream.
2476
2477         Added support for a FetchResponse ReadableStream source.
2478         Both synthetic FetchResponse and loading FetchResponse are supported.
2479         A new "Stream" FetchLoader::Type is introduced to allow receiving data as chunks and feeding them to a ReadableStream through ReadableStreamSource.
2480
2481         Currently, FetchResponse is consumed and marked as disturbed as soon as a ReadableStreamSource is created.
2482         This should be changed so that consumption happens on the first read call to the ReadableStreamReader, i.e. when stream gets disturbed.
2483
2484         FetchResponseSource never fulfills the start promise, which allows to enqueue, error or close the stream at any time.
2485         FetchResponseSource must therefore always ensure to close or error the stream.
2486         Added support for locked check in FetchResponse.
2487
2488         Tests: imported/w3c/web-platform-tests/fetch/api/response/response-cancel-stream.html
2489                imported/w3c/web-platform-tests/fetch/api/response/response-consume-stream.html
2490                imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-1.html
2491                imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-2.html
2492                imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-3.html
2493                imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-4.html
2494                imported/w3c/web-platform-tests/fetch/api/response/response-stream-disturbed-5.html
2495         Also covered by rebased tests.
2496
2497         * CMakeLists.txt:
2498         * DerivedSources.make:
2499         * Modules/fetch/FetchBody.cpp:
2500         (WebCore::FetchBody::consumeAsStream): Fill stream with body data.
2501         * Modules/fetch/FetchBody.h:
2502         (WebCore::FetchBody::type): Added accessor to body type, used for assertions.
2503         * Modules/fetch/FetchBodyOwner.cpp:
2504         (WebCore::FetchBodyOwner::isDisturbed): Adding stream isLocked check.
2505         (WebCore::FetchBodyOwner::blobLoadingSucceeded): Added assertion that body type is blob. Closing stream if created.
2506         (WebCore::FetchBodyOwner::blobLoadingFailed): Erroring the stream if created and not cancelled.
2507         (WebCore::FetchBodyOwner::blobChunk): Filling stream with chunk.
2508         (WebCore::FetchBodyOwner::stop): Rmoved call to finishBlobLoading as it should be called as part of FetchLoaderCLient::didFail callbacki.
2509         * Modules/fetch/FetchBodyOwner.h:
2510         * Modules/fetch/FetchLoader.cpp: Fixing the case of cancel being called when creating the ThreadableLoader by introducing FetchLoader::m_isStarted.
2511         (WebCore::FetchLoader::start): Setting m_isStarted at the end of the start method.
2512         (WebCore::FetchLoader::stop): Fixing the case that FetchLoader can be destroyed when cancelling its loader.
2513         (WebCore::FetchLoader::startStreaming): Introduced to switch the loading type from ArayBuffer to Stream. Already buffered data is returned.
2514         (WebCore::FetchLoader::didReceiveData): Handling of the new Stream type.
2515         (WebCore::FetchLoader::didFinishLoading):
2516         * Modules/fetch/FetchLoader.h:
2517         * Modules/fetch/FetchLoaderClient.h:
2518         (WebCore::FetchLoaderClient::didReceiveData): Callback to get data as chunks if loader is of type Stream.
2519         * Modules/fetch/FetchResponse.cpp:
2520         (WebCore::FetchResponse::clone): Removed m_isLocked as it is handled within isDisturbed().
2521         (WebCore::FetchResponse::isDisturbed): Checking whether related ReadableStream is locked.
2522         (WebCore::FetchResponse::BodyLoader::didSucceed): Introduced to handle ReadableStream case.
2523         (WebCore::FetchResponse::BodyLoader::didFail): Ditto.
2524         (WebCore::FetchResponse::BodyLoader::didReceiveData): Ditto.
2525         (WebCore::FetchResponse::BodyLoader::startStreaming): Ditto.
2526         (WebCore::FetchResponse::consumeBodyAsStream): Start filling the ReadableStream with data. Changing loader to Stream if there is one.
2527         (WebCore::FetchResponse::createReadableStreamSource): Called by custom binding to create the source.
2528         (WebCore::FetchResponse::stop): Fixing potential crash in case of cancelling the ibody stream.
2529         (WebCore::FetchResponse::startFetching):
2530         (WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer):
2531         * Modules/fetch/FetchResponse.h:
2532         * Modules/fetch/FetchResponse.idl:
2533         * Modules/fetch/FetchResponseSource.cpp: Specialization of ReadableStreamSource for FetchResponse. It is a push source that never resolves the start promise.
2534         (WebCore::FetchResponseSource::FetchResponseSource):
2535         (WebCore::FetchResponseSource::isReadableStreamLocked):
2536         (WebCore::FetchResponseSource::setActive):
2537         (WebCore::FetchResponseSource::setInactive):
2538         (WebCore::FetchResponseSource::doStart):
2539         (WebCore::FetchResponseSource::doCancel):
2540         (WebCore::FetchResponseSource::close):
2541         (WebCore::FetchResponseSource::error):
2542         * Modules/fetch/FetchResponseSource.h: Added.
2543         * Modules/streams/ReadableStreamController.js:
2544         (error):
2545         * Modules/streams/ReadableStreamSource.h: Added (base class for ReadableStream DOM sources).
2546         (WebCore::ReadableStreamSource::~ReadableStreamSource):
2547         (WebCore::ReadableStreamSource::isStarting):
2548         (WebCore::ReadableStreamSource::isPulling):
2549         (WebCore::ReadableStreamSource::isCancelling):
2550         (WebCore::ReadableStreamSource::controller):
2551         (WebCore::ReadableStreamSource::doStart):
2552         (WebCore::ReadableStreamSource::doCancel):
2553         (WebCore::ReadableStreamSource::start):
2554         (WebCore::ReadableStreamSource::cancel):
2555         (WebCore::ReadableStreamSource::startFinished):
2556         (WebCore::ReadableStreamSource::clean):
2557         * Modules/streams/ReadableStreamSource.idl: Added.
2558         * WebCore.xcodeproj/project.pbxproj:
2559         * bindings/js/JSDOMGlobalObject.h:
2560         * bindings/js/JSFetchResponseCustom.cpp: In case body is not created, call createReadableStreamSource.
2561         (WebCore::JSFetchResponse::body):
2562         * bindings/js/JSReadableStreamSourceCustom.cpp: Added.
2563         (WebCore::JSReadableStreamSource::start):
2564         (WebCore::JSReadableStreamSource::pull):
2565         (WebCore::JSReadableStreamSource::controller):
2566         * bindings/js/ReadableStreamController.cpp: Added.
2567         (WebCore::callFunction):
2568         (WebCore::ReadableStreamController::invoke):
2569         (WebCore::ReadableStreamController::isControlledReadableStreamLocked):
2570         (WebCore::createReadableStream):
2571         * bindings/js/ReadableStreamController.h: The DOM wrapper for JSReadableStreamController.
2572         (WebCore::ReadableStreamController::ReadableStreamController):
2573         (WebCore::ReadableStreamController::close):
2574         (WebCore::ReadableStreamController::error):
2575         (WebCore::ReadableStreamController::enqueue):
2576         (WebCore::ReadableStreamController::globalObject):
2577         (WebCore::ReadableStreamController::enqueue<RefPtr<JSC::ArrayBuffer>>):
2578         (WebCore::ReadableStreamController::error<String>):
2579
2580 2016-04-16  Antti Koivisto  <antti@apple.com>
2581
2582         Element should be const in StyleResolver
2583         https://bugs.webkit.org/show_bug.cgi?id=156672
2584
2585         Reviewed by Darin Adler.
2586
2587         Resolving element style shouldn't mutate it.
2588
2589         This patch just does Element* -> const Element*, all the groundwork has been done already.
2590
2591         * css/StyleResolver.cpp:
2592         (WebCore::StyleResolver::sweepMatchedPropertiesCache):
2593         (WebCore::StyleResolver::State::State):
2594         (WebCore::StyleResolver::State::setStyle):
2595         (WebCore::isAtShadowBoundary):
2596         (WebCore::StyleResolver::styleForElement):
2597         (WebCore::doesNotInheritTextDecoration):
2598         (WebCore::StyleResolver::adjustStyleForInterCharacterRuby):
2599         (WebCore::StyleResolver::adjustRenderStyle):
2600         (WebCore::StyleResolver::checkRegionStyle):
2601         (WebCore::StyleResolver::updateFont):
2602         (WebCore::StyleResolver::styleRulesForElement):
2603         (WebCore::StyleResolver::pseudoStyleRulesForElement):
2604         (WebCore::StyleResolver::applyMatchedProperties):
2605         * css/StyleResolver.h:
2606         (WebCore::StyleResolver::style):
2607         (WebCore::StyleResolver::parentStyle):
2608         (WebCore::StyleResolver::rootElementStyle):
2609         (WebCore::StyleResolver::element):
2610         (WebCore::StyleResolver::document):
2611         (WebCore::StyleResolver::documentSettings):
2612         (WebCore::StyleResolver::usesFirstLineRules):
2613         (WebCore::StyleResolver::usesFirstLetterRules):
2614         (WebCore::StyleResolver::State::State):
2615         (WebCore::StyleResolver::State::document):
2616         (WebCore::StyleResolver::State::element):
2617         (WebCore::StyleResolver::State::style):
2618         (WebCore::StyleResolver::hasSelectorForId):
2619         (WebCore::checkRegionSelector):
2620         * rendering/RenderTheme.cpp:
2621         (WebCore::RenderTheme::RenderTheme):
2622         (WebCore::RenderTheme::adjustStyle):
2623         (WebCore::RenderTheme::adjustCheckboxStyle):
2624         (WebCore::RenderTheme::adjustRadioStyle):
2625         (WebCore::RenderTheme::adjustButtonStyle):
2626         (WebCore::RenderTheme::adjustInnerSpinButtonStyle):
2627         (WebCore::RenderTheme::adjustTextFieldStyle):
2628         (WebCore::RenderTheme::adjustTextAreaStyle):
2629         (WebCore::RenderTheme::adjustMenuListStyle):
2630         (WebCore::RenderTheme::adjustMeterStyle):
2631         (WebCore::RenderTheme::paintMeter):
2632         (WebCore::RenderTheme::adjustCapsLockIndicatorStyle):
2633         (WebCore::RenderTheme::paintCapsLockIndicator):
2634         (WebCore::RenderTheme::adjustAttachmentStyle):
2635         (WebCore::RenderTheme::animationDurationForProgressBar):
2636         (WebCore::RenderTheme::adjustProgressBarStyle):
2637         (WebCore::RenderTheme::shouldHaveCapsLockIndicator):
2638         (WebCore::RenderTheme::adjustMenuListButtonStyle):
2639         (WebCore::RenderTheme::adjustMediaControlStyle):
2640         (WebCore::RenderTheme::adjustSliderTrackStyle):
2641         (WebCore::RenderTheme::adjustSliderThumbStyle):
2642         (WebCore::RenderTheme::adjustSliderThumbSize):
2643         (WebCore::RenderTheme::adjustSearchFieldStyle):
2644         (WebCore::RenderTheme::adjustSearchFieldCancelButtonStyle):
2645         (WebCore::RenderTheme::adjustSearchFieldDecorationPartStyle):
2646         (WebCore::RenderTheme::adjustSearchFieldResultsDecorationPartStyle):
2647         (WebCore::RenderTheme::adjustSearchFieldResultsButtonStyle):
2648         * rendering/RenderTheme.h:
2649         (WebCore::RenderTheme::minimumMenuListSize):
2650         (WebCore::RenderTheme::popupInternalPaddingBox):
2651         (WebCore::RenderTheme::popupOptionSupportsTextIndent):
2652         (WebCore::RenderTheme::paintRadioDecorations):
2653         (WebCore::RenderTheme::paintButtonDecorations):
2654         (WebCore::RenderTheme::paintTextField):
2655         (WebCore::RenderTheme::paintTextFieldDecorations):
2656         (WebCore::RenderTheme::paintTextArea):
2657         (WebCore::RenderTheme::paintTextAreaDecorations):
2658         (WebCore::RenderTheme::paintMenuList):
2659         (WebCore::RenderTheme::paintMenuListDecorations):
2660         (WebCore::RenderTheme::paintMenuListButtonDecorations):
2661         (WebCore::RenderTheme::paintPushButtonDecorations):
2662         (WebCore::RenderTheme::paintSquareButtonDecorations):
2663         (WebCore::RenderTheme::paintProgressBar):
2664         (WebCore::RenderTheme::paintSliderTrack):
2665         (WebCore::RenderTheme::paintSliderThumb):
2666         (WebCore::RenderTheme::paintSliderThumbDecorations):
2667         (WebCore::RenderTheme::paintSearchField):
2668         (WebCore::RenderTheme::paintSearchFieldDecorations):
2669         (WebCore::RenderTheme::paintSearchFieldCancelButton):
2670         (WebCore::RenderTheme::paintSearchFieldDecorationPart):
2671         (WebCore::RenderTheme::paintSearchFieldResultsDecorationPart):
2672         (WebCore::RenderTheme::paintSearchFieldResultsButton):
2673         (WebCore::RenderTheme::paintMediaFullscreenButton):
2674         (WebCore::RenderTheme::paintMediaPlayButton):
2675         (WebCore::RenderTheme::paintMediaOverlayPlayButton):
2676         * rendering/RenderThemeEfl.cpp:
2677         (WebCore::RenderThemeEfl::paintSliderTrack):
2678         (WebCore::RenderThemeEfl::adjustSliderTrackStyle):
2679         (WebCore::RenderThemeEfl::adjustSliderThumbStyle):
2680         (WebCore::RenderThemeEfl::adjustSliderThumbSize):
2681         (WebCore::RenderThemeEfl::paintSliderThumb):
2682         (WebCore::RenderThemeEfl::adjustCheckboxStyle):
2683         (WebCore::RenderThemeEfl::paintCheckbox):
2684         (WebCore::RenderThemeEfl::adjustRadioStyle):
2685         (WebCore::RenderThemeEfl::paintRadio):
2686         (WebCore::RenderThemeEfl::adjustButtonStyle):
2687         (WebCore::RenderThemeEfl::paintButton):
2688         (WebCore::RenderThemeEfl::adjustMenuListStyle):
2689         (WebCore::RenderThemeEfl::paintMenuList):
2690         (WebCore::RenderThemeEfl::adjustMenuListButtonStyle):
2691         (WebCore::RenderThemeEfl::paintMenuListButtonDecorations):
2692         (WebCore::RenderThemeEfl::adjustTextFieldStyle):
2693         (WebCore::RenderThemeEfl::paintTextField):
2694         (WebCore::RenderThemeEfl::adjustTextAreaStyle):
2695         (WebCore::RenderThemeEfl::paintTextArea):
2696         (WebCore::RenderThemeEfl::adjustSearchFieldResultsButtonStyle):
2697         (WebCore::RenderThemeEfl::paintSearchFieldResultsButton):
2698         (WebCore::RenderThemeEfl::adjustSearchFieldResultsDecorationPartStyle):
2699         (WebCore::RenderThemeEfl::paintSearchFieldResultsDecorationPart):
2700         (WebCore::RenderThemeEfl::adjustSearchFieldCancelButtonStyle):
2701         (WebCore::RenderThemeEfl::paintSearchFieldCancelButton):
2702         (WebCore::RenderThemeEfl::adjustSearchFieldStyle):
2703         (WebCore::RenderThemeEfl::paintSearchField):
2704         (WebCore::RenderThemeEfl::adjustInnerSpinButtonStyle):
2705         (WebCore::RenderThemeEfl::updateCachedSystemFontDescription):
2706         (WebCore::RenderThemeEfl::adjustProgressBarStyle):
2707         * rendering/RenderThemeEfl.h:
2708         * rendering/RenderThemeGtk.cpp:
2709         (WebCore::RenderThemeGtk::adjustRepaintRect):
2710         (WebCore::RenderThemeGtk::adjustButtonStyle):
2711         (WebCore::RenderThemeGtk::paintButton):
2712         (WebCore::RenderThemeGtk::adjustMenuListStyle):
2713         (WebCore::RenderThemeGtk::adjustMenuListButtonStyle):
2714         (WebCore::RenderThemeGtk::paintMenuListButtonDecorations):
2715         (WebCore::RenderThemeGtk::adjustTextFieldStyle):
2716         (WebCore::RenderThemeGtk::paintTextField):
2717         (WebCore::RenderThemeGtk::paintTextArea):
2718         (WebCore::RenderThemeGtk::adjustSearchFieldResultsButtonStyle):
2719         (WebCore::RenderThemeGtk::paintSearchFieldResultsButton):
2720         (WebCore::RenderThemeGtk::adjustSearchFieldResultsDecorationPartStyle):
2721         (WebCore::RenderThemeGtk::adjustSearchFieldCancelButtonStyle):
2722         (WebCore::RenderThemeGtk::paintSearchFieldCancelButton):
2723         (WebCore::RenderThemeGtk::adjustSearchFieldStyle):
2724         (WebCore::RenderThemeGtk::shouldHaveCapsLockIndicator):
2725         (WebCore::RenderThemeGtk::adjustSliderTrackStyle):
2726         (WebCore::RenderThemeGtk::adjustSliderThumbStyle):
2727         (WebCore::RenderThemeGtk::paintSliderTrack):
2728         (WebCore::RenderThemeGtk::adjustSliderThumbSize):
2729         (WebCore::RenderThemeGtk::innerSpinButtonLayout):
2730         (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
2731         (WebCore::spinButtonArrowSize):
2732         (WebCore::RenderThemeGtk::paintMediaCurrentTime):
2733         (WebCore::RenderThemeGtk::adjustProgressBarStyle):
2734         * rendering/RenderThemeGtk.h:
2735         * rendering/RenderThemeIOS.h:
2736         * rendering/RenderThemeIOS.mm:
2737         (WebCore::RenderThemeIOS::addRoundedBorderClip):
2738         (WebCore::RenderThemeIOS::adjustCheckboxStyle):
2739         (WebCore::RenderThemeIOS::isControlStyled):
2740         (WebCore::RenderThemeIOS::adjustRadioStyle):
2741         (WebCore::adjustInputElementButtonStyle):
2742         (WebCore::RenderThemeIOS::adjustMenuListButtonStyle):
2743         (WebCore::RenderThemeIOS::adjustSliderTrackStyle):
2744         (WebCore::RenderThemeIOS::paintSliderTrack):
2745         (WebCore::RenderThemeIOS::adjustSliderThumbSize):
2746         (WebCore::RenderThemeIOS::sliderTickOffsetFromTrackCenter):
2747         (WebCore::RenderThemeIOS::adjustSearchFieldStyle):
2748         (WebCore::RenderThemeIOS::paintSearchFieldDecorations):
2749         (WebCore::RenderThemeIOS::adjustButtonStyle):
2750         * rendering/RenderThemeMac.h:
2751         * rendering/RenderThemeMac.mm:
2752         (WebCore::RenderThemeMac::paintTextField):
2753         (WebCore::RenderThemeMac::adjustTextFieldStyle):
2754         (WebCore::RenderThemeMac::paintTextArea):
2755         (WebCore::RenderThemeMac::adjustTextAreaStyle):
2756         (WebCore::RenderThemeMac::animationDurationForProgressBar):
2757         (WebCore::RenderThemeMac::adjustProgressBarStyle):
2758         (WebCore::menuListButtonSizes):
2759         (WebCore::RenderThemeMac::adjustMenuListStyle):
2760         (WebCore::RenderThemeMac::popupMenuSize):
2761         (WebCore::RenderThemeMac::adjustMenuListButtonStyle):
2762         (WebCore::RenderThemeMac::adjustSliderTrackStyle):
2763         (WebCore::RenderThemeMac::paintSliderTrack):
2764         (WebCore::RenderThemeMac::adjustSliderThumbStyle):
2765         (WebCore::RenderThemeMac::setSearchFieldSize):
2766         (WebCore::RenderThemeMac::adjustSearchFieldStyle):
2767         (WebCore::RenderThemeMac::cancelButtonSizes):
2768         (WebCore::RenderThemeMac::adjustSearchFieldCancelButtonStyle):
2769         (WebCore::RenderThemeMac::resultsButtonSizes):
2770         (WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle):
2771         (WebCore::RenderThemeMac::paintSearchFieldDecorationPart):
2772         (WebCore::RenderThemeMac::adjustSearchFieldResultsDecorationPartStyle):
2773         (WebCore::RenderThemeMac::paintSearchFieldResultsDecorationPart):
2774         (WebCore::RenderThemeMac::adjustSearchFieldResultsButtonStyle):
2775         (WebCore::RenderThemeMac::adjustSliderThumbSize):
2776         * rendering/RenderThemeWin.cpp:
2777         (WebCore::RenderThemeWin::paintButton):
2778         (WebCore::RenderThemeWin::adjustInnerSpinButtonStyle):
2779         (WebCore::RenderThemeWin::paintMenuList):
2780         (WebCore::RenderThemeWin::adjustMenuListStyle):
2781         (WebCore::RenderThemeWin::adjustMenuListButtonStyle):
2782         (WebCore::RenderThemeWin::adjustSliderThumbSize):
2783         (WebCore::RenderThemeWin::paintSearchField):
2784         (WebCore::RenderThemeWin::adjustSearchFieldStyle):
2785         (WebCore::RenderThemeWin::paintSearchFieldCancelButton):
2786         (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle):
2787         (WebCore::RenderThemeWin::adjustSearchFieldDecorationPartStyle):
2788         (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle):
2789         (WebCore::RenderThemeWin::paintSearchFieldResultsDecorationPart):
2790         (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle):
2791         (WebCore::RenderThemeWin::adjustMeterStyle):
2792         * rendering/RenderThemeWin.h:
2793
2794 2016-04-16  Antti Koivisto  <antti@apple.com>
2795
2796         CSSCursorImageValue shouldn't mutate element during style resolution
2797         https://bugs.webkit.org/show_bug.cgi?id=156659
2798
2799         Reviewed by Darin Adler.
2800
2801         CSSCursorImageValue::updateIfSVGCursorIsUsed may mutate the argument element.
2802
2803         This patch removes the code that caches cursor element and image to SVGElement rare data.
2804         The whole things is basically unused. CSSCursorImageValue now maintains a weak map to
2805         SVGCursorElements directly instead of indirectly via the using SVGElements.
2806
2807         * css/CSSCursorImageValue.cpp:
2808         (WebCore::CSSCursorImageValue::CSSCursorImageValue):
2809         (WebCore::CSSCursorImageValue::~CSSCursorImageValue):
2810         (WebCore::CSSCursorImageValue::customCSSText):
2811         (WebCore::CSSCursorImageValue::updateCursorElement):
2812
2813             We no longer rely on SVGElement rare data so no need to test for SVGElement.
2814
2815         (WebCore::CSSCursorImageValue::cursorElementRemoved):
2816         (WebCore::CSSCursorImageValue::cursorElementChanged):
2817
2818             Factor to a function.
2819
2820         (WebCore::CSSCursorImageValue::cachedImage):
2821         (WebCore::CSSCursorImageValue::clearCachedImage):
2822         (WebCore::CSSCursorImageValue::equals):
2823         (WebCore::CSSCursorImageValue::removeReferencedElement): Deleted.
2824
2825             Don't track client elements anymore. Just track referenced SVGCursorElements.
2826
2827         * css/CSSCursorImageValue.h:
2828         * css/StyleBuilderCustom.h:
2829         (WebCore::StyleBuilderCustom::applyValueCursor):
2830
2831             No need to make style unique. Initialization is now done in updateSVGCursorElement.
2832
2833         * svg/SVGCursorElement.cpp:
2834         (WebCore::SVGCursorElement::~SVGCursorElement):
2835         (WebCore::SVGCursorElement::isSupportedAttribute):
2836         (WebCore::SVGCursorElement::parseAttribute):
2837         (WebCore::SVGCursorElement::addClient):
2838         (WebCore::SVGCursorElement::removeClient):
2839
2840             Client is now an CSSCursorImageValue rather than SVGElement.
2841
2842         (WebCore::SVGCursorElement::svgAttributeChanged):
2843
2844             Instead of invalidating element style just invalidate the CSSCursorImageValue directly.
2845
2846         (WebCore::SVGCursorElement::addSubresourceAttributeURLs):
2847         (WebCore::SVGCursorElement::removeReferencedElement): Deleted.
2848         * svg/SVGCursorElement.h:
2849         * svg/SVGElement.cpp:
2850         (WebCore::SVGElement::~SVGElement):
2851         (WebCore::SVGElement::getBoundingBox):
2852         (WebCore::SVGElement::correspondingElement):
2853         (WebCore::SVGElement::setCursorElement): Deleted.
2854         (WebCore::SVGElement::cursorElementRemoved): Deleted.
2855         (WebCore::SVGElement::setCursorImageValue): Deleted.
2856         (WebCore::SVGElement::cursorImageValueRemoved): Deleted.
2857
2858             SVGElements no longer need to know about their cursors.
2859
2860         * svg/SVGElement.h:
2861         * svg/SVGElementRareData.h:
2862         (WebCore::SVGElementRareData::instanceUpdatesBlocked):
2863         (WebCore::SVGElementRareData::setInstanceUpdatesBlocked):
2864         (WebCore::SVGElementRareData::correspondingElement):
2865         (WebCore::SVGElementRareData::setCorrespondingElement):
2866         (WebCore::SVGElementRareData::animatedSMILStyleProperties):
2867         (WebCore::SVGElementRareData::ensureAnimatedSMILStyleProperties):
2868         (WebCore::SVGElementRareData::cursorElement): Deleted.
2869         (WebCore::SVGElementRareData::setCursorElement): Deleted.
2870         (WebCore::SVGElementRareData::cursorImageValue): Deleted.
2871         (WebCore::SVGElementRareData::setCursorImageValue): Deleted.
2872
2873 2016-04-15  Darin Adler  <darin@apple.com>
2874
2875         Reduce use of Deprecated::ScriptXXX classes
2876         https://bugs.webkit.org/show_bug.cgi?id=156632
2877
2878         Reviewed by Alex Christensen.
2879
2880         * Modules/mediastream/SDPProcessor.cpp: Removed unneeded include.
2881
2882         * bindings/js/JSCommandLineAPIHostCustom.cpp:
2883         (WebCore::JSCommandLineAPIHost::inspectedObject): Use JSValue.
2884         * bindings/js/JSCustomEventCustom.cpp:
2885         (WebCore::JSCustomEvent::detail): Ditto.
2886         * bindings/js/ScriptController.cpp:
2887         (WebCore::ScriptController::evaluateInWorld): Ditto.
2888         (WebCore::ScriptController::evaluate): Ditto.
2889         (WebCore::ScriptController::executeScriptInWorld): Ditto.
2890         (WebCore::ScriptController::executeScript): Ditto.
2891         (WebCore::ScriptController::executeIfJavaScriptURL): Ditto.
2892         * bindings/js/ScriptController.h: Ditto.
2893
2894         * bindings/js/ScriptGlobalObject.cpp: Removed unused overload of set,
2895         and unused remove and folded handleException function into its one call site.
2896         (WebCore::ScriptGlobalObject::set): Take references instead of pointers.
2897         (WebCore::ScriptGlobalObject::get): Use JSObject instead of Deprecated::ScriptObject.
2898         * bindings/js/ScriptGlobalObject.h: Updated for the above.
2899
2900         * dom/CustomEvent.cpp:
2901         (WebCore::CustomEvent::initCustomEvent): Take JSValue and ExecState instead of
2902         Deprecated::ScriptValue.
2903         (WebCore::CustomEvent::trySerializeDetail): Take a reference instead of a pointer.
2904         Also removed an unneeded null check.
2905         * dom/CustomEvent.h: Use JSValue.
2906         * dom/CustomEvent.idl: Updated for the above.
2907
2908         * html/HTMLMediaElement.cpp: Remove unneeded include.
2909
2910         * inspector/CommandLineAPIHost.cpp:
2911         (WebCore::CommandLineAPIHost::InspectableObject::get): Take reference instead of
2912         pointer and return JSValue.
2913         * inspector/CommandLineAPIHost.h: Updated for the above.
2914
2915         * inspector/InspectorDOMAgent.cpp:
2916         (WebCore::InspectorDOMAgent::setDocument): Use "document" instead of "doc".
2917         (WebCore::InspectorDOMAgent::setAttributesAsText): Omit redundant class name.
2918         (WebCore::InspectorDOMAgent::focusNode): Ditto. Pass reference instead of pointer.
2919         (WebCore::InspectorDOMAgent::undo): Ditto.
2920         (WebCore::InspectorDOMAgent::redo): Ditto.
2921         (WebCore::InspectorDOMAgent::nodeForObjectId): Stop using Deprecated::ScriptValue.
2922         (WebCore::InspectorDOMAgent::resolveNode): Ditto.
2923         (WebCore::InspectorDOMAgent::scriptValueAsNode): Removed unneeded isObject check,
2924         which is already done by JSNode::toWrapped. Use JSValue.
2925         (WebCore::InspectorDOMAgent::nodeAsScriptValue): Use JSValue.
2926         * inspector/InspectorDOMAgent.h: Updated for the above.
2927
2928         * inspector/InspectorFrontendClientLocal.cpp:
2929         (WebCore::InspectorFrontendClientLocal::windowObjectCleared): Use references instead of
2930         pointers and removed unneeded local.
2931         (WebCore::InspectorFrontendClientLocal::evaluateAsBoolean): More of the same.
2932         * inspector/InspectorFrontendHost.cpp:
2933         (WebCore::InspectorFrontendHost::showContextMenu): Ditto.
2934
2935         * inspector/InspectorTimelineAgent.cpp:
2936         (WebCore::InspectorTimelineAgent::breakpointActionProbe): Updated to take
2937         reference instead of pointer and JSValue instead of ScriptValue.
2938         * inspector/InspectorTimelineAgent.h: Ditto.
2939         * inspector/PageConsoleAgent.cpp: Ditto.
2940         * inspector/PageDebuggerAgent.cpp:
2941         (WebCore::PageDebuggerAgent::breakpointActionLog): Ditto.
2942         * inspector/PageDebuggerAgent.h: Ditto.
2943
2944 2016-04-15  Daniel Bates  <dabates@apple.com>
2945
2946         CSP: Ignore paths in CSP matching after redirects
2947         https://bugs.webkit.org/show_bug.cgi?id=153154
2948         <rdar://problem/24383215>
2949
2950         Reviewed by Brent Fulgham.
2951
2952         For sub-resources that redirect, match the URL that is the result of the redirect against
2953         the source expressions in Content Security Policy ignoring any paths in those source
2954         expressions as per section Paths and Redirects of the Content Security Policy Level 2 spec.,
2955         <https://w3c.github.io/webappsec-csp/2/> (Editor's Draft, 29 August 2015).
2956
2957         Tests: http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html
2958                http/tests/security/contentSecurityPolicy/embed-redirect-allowed.html
2959                http/tests/security/contentSecurityPolicy/embed-redirect-allowed2.html
2960                http/tests/security/contentSecurityPolicy/embed-redirect-blocked.html
2961                http/tests/security/contentSecurityPolicy/embed-redirect-blocked2.html
2962                http/tests/security/contentSecurityPolicy/embed-redirect-blocked3.html
2963                http/tests/security/contentSecurityPolicy/font-redirect-allowed2.html
2964                http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed.html
2965                http/tests/security/contentSecurityPolicy/form-action-src-redirect-allowed2.html
2966                http/tests/security/contentSecurityPolicy/iframe-redirect-allowed-by-child-src.html
2967                http/tests/security/contentSecurityPolicy/iframe-redirect-allowed-by-child-src2.html
2968                http/tests/security/contentSecurityPolicy/iframe-redirect-allowed-by-frame-src.html
2969                http/tests/security/contentSecurityPolicy/iframe-redirect-allowed-by-frame-src2.html
2970                http/tests/security/contentSecurityPolicy/iframe-redirect-blocked-by-child-src.html
2971                http/tests/security/contentSecurityPolicy/iframe-redirect-blocked-by-frame-src.html
2972                http/tests/security/contentSecurityPolicy/image-redirect-allowed2.html
2973                http/tests/security/contentSecurityPolicy/object-redirect-allowed.html
2974                http/tests/security/contentSecurityPolicy/object-redirect-allowed2.html
2975                http/tests/security/contentSecurityPolicy/object-redirect-blocked.html
2976                http/tests/security/contentSecurityPolicy/object-redirect-blocked2.html
2977                http/tests/security/contentSecurityPolicy/object-redirect-blocked3.html
2978                http/tests/security/contentSecurityPolicy/script-redirect-allowed2.html
2979                http/tests/security/contentSecurityPolicy/stylesheet-redirect-allowed2.html
2980                http/tests/security/contentSecurityPolicy/svg-font-redirect-allowed2.html
2981                http/tests/security/contentSecurityPolicy/svg-image-redirect-allowed2.html
2982                http/tests/security/contentSecurityPolicy/track-redirect-allowed2.html
2983                http/tests/security/contentSecurityPolicy/video-redirect-allowed2.html
2984                http/tests/security/contentSecurityPolicy/xsl-redirect-allowed2.html
2985
2986         * loader/DocumentLoader.cpp:
2987         (WebCore::DocumentLoader::willSendRequest): Define a local variable didReceiveRedirectResponse as
2988         to whether this request follows from having received a redirect response from the server. Pass this
2989         information to FrameLoader::checkIfFormActionAllowedByCSP() and PolicyChecker::checkNavigationPolicy()
2990         for its consideration.
2991         * loader/DocumentThreadableLoader.cpp:
2992         (WebCore::DocumentThreadableLoader::redirectReceived): Pass whether we have a non-null redirect
2993         response (i.e. received a redirect response from the server) to DocumentThreadableLoader::isAllowedByContentSecurityPolicy()
2994         for its consideration.
2995         (WebCore::DocumentThreadableLoader::loadRequest): Pass whether we performed a redirect to
2996         DocumentThreadableLoader::isAllowedByContentSecurityPolicy() for its consideration.
2997         (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy): Modified to take a boolean
2998         argument as to whether a redirect was performed. We pass this information to the appropriate
2999         ContentSecurityPolicy method.
3000         * loader/DocumentThreadableLoader.h:
3001         * loader/FrameLoader.cpp:
3002         (WebCore::FrameLoader::checkIfFormActionAllowedByCSP): Modified to take a boolean argument as to whether
3003         a redirect response was received and passes this information to ContentSecurityPolicy::allowFormAction()
3004         for its consideration.
3005         (WebCore::FrameLoader::loadURL): Modified to tell PolicyChecker::checkNavigationPolicy() that the navigation
3006         is not in response to having received a redirect response from the server.
3007         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
3008         * loader/FrameLoader.h:
3009         * loader/PolicyChecker.cpp:
3010         (WebCore::isAllowedByContentSecurityPolicy): Modified to take a boolean argument as to whether
3011         a redirect response was received and passes this information to the appropriate ContentSecurityPolicy member
3012         function for consideration.
3013         (WebCore::PolicyChecker::checkNavigationPolicy): Modified to take a boolean argument as to whether a redirect
3014         response was received and passes this information through to WebCore::isAllowedByContentSecurityPolicy().
3015         * loader/PolicyChecker.h:
3016         * loader/SubresourceLoader.cpp:
3017         (WebCore::SubresourceLoader::willSendRequestInternal): Modified to tell CachedResourceLoader::canRequest() that
3018         the request is in response to having received a redirect response from the server.
3019         * loader/cache/CachedResourceLoader.cpp:
3020         (WebCore::CachedResourceLoader::canRequest): Modified to take a boolean argument as to whether a redirect
3021         response was received and passes this information through to the appropriate ContentSecurityPolicy member
3022         function for consideration.
3023         * loader/cache/CachedResourceLoader.h:
3024         * page/csp/ContentSecurityPolicy.cpp:
3025         (WebCore::ContentSecurityPolicy::allowScriptFromSource): Modified to take an argument as to whether a
3026         redirect response was received and passes this information through to ContentSecurityPolicyDirectiveList.
3027         (WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
3028         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
3029         (WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
3030         (WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
3031         (WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
3032         (WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
3033         (WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
3034         (WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
3035         (WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
3036         * page/csp/ContentSecurityPolicy.h:
3037         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3038         (WebCore::checkSource):
3039         (WebCore::checkFrameAncestors):
3040         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForChildContext): Modified to take an argument
3041         as to whether a redirect response was received and passes this information through to the CSP directive.
3042         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForConnectSource): Ditto.
3043         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFont): Ditto.
3044         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFormAction): Ditto.
3045         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrame): Ditto.
3046         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForImage): Ditto.
3047         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForMedia): Ditto.
3048         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Ditto.
3049         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript): Ditto.
3050         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyle): Ditto.
3051         * page/csp/ContentSecurityPolicyDirectiveList.h:
3052         * page/csp/ContentSecurityPolicySource.cpp:
3053         (WebCore::ContentSecurityPolicySource::matches): Modified to take an argument as to whether a redirect response
3054         was received. When the specified URL follows from having received a redirect response then ignore the path
3055         component of the source expression when checking for a match. Otherwise, consider the path component of the
3056         source expression when performing the match.
3057         * page/csp/ContentSecurityPolicySource.h:
3058         * page/csp/ContentSecurityPolicySourceList.cpp:
3059         (WebCore::ContentSecurityPolicySourceList::matches): Modified to take an argument as to whether a redirect
3060         response was received and pass this information through to ContentSecurityPolicySource::matches().
3061         * page/csp/ContentSecurityPolicySourceList.h:
3062         * page/csp/ContentSecurityPolicySourceListDirective.cpp:
3063         (WebCore::ContentSecurityPolicySourceListDirective::allows): Modified to take an argument as to whether a
3064         redirect response was received and pass this information through to ContentSecurityPolicySourceList::matches().
3065         * page/csp/ContentSecurityPolicySourceListDirective.h:
3066
3067 2016-04-15  Myles C. Maxfield  <mmaxfield@apple.com>
3068
3069         [CSS Font Loading] FontFace's promise may never be resolved/rejected if Content Security Policy blocks all the URLs
3070         https://bugs.webkit.org/show_bug.cgi?id=156605
3071
3072         Reviewed by Daniel Bates.
3073
3074         If all the fonts are blocked, we will create a FontFace with no FontFaceSources.
3075         Loading such a FontFace should reject the promise.
3076
3077         Test: fast/text/font-loading-csp-block-all.html
3078
3079         * css/CSSFontFace.cpp:
3080         (WebCore::CSSFontFace::pump):
3081
3082 2016-04-15  Alex Christensen  <achristensen@webkit.org>
3083
3084         [WinCairo] Another unreviewed build fix.
3085
3086         * platform/network/curl/MultipartHandle.cpp:
3087         (WebCore::MultipartHandle::parseHeadersIfPossible):
3088
3089 2016-04-15  Brent Fulgham  <bfulgham@apple.com>
3090
3091         [WinCairo] Unreviewed build fix.,
3092
3093         * platform/network/curl/MultipartHandle.cpp:
3094         (WebCore::MultipartHandle::parseHeadersIfPossible): Correct for new method signature.
3095
3096 2016-04-15  Myles C. Maxfield  <mmaxfield@apple.com>
3097
3098         ASSERT when loading github.com
3099         https://bugs.webkit.org/show_bug.cgi?id=156604
3100         <rdar://problem/19890634>
3101
3102         Reviewed by Darin Adler.
3103
3104         HTMLFormControlElement::m_isValid is a cache of the results of the valid() function.
3105         When cloning the node, we were preserving each individual item, but not the state
3106         of the cache. Therefore, the cache and the attributes didn't agree with each other.
3107
3108         Test: fast/forms/checkValidity-cloneNode-crash.html
3109
3110         * html/HTMLInputElement.cpp:
3111         (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
3112
3113 2016-04-15  Brent Fulgham  <bfulgham@apple.com>
3114
3115         Remove support for X-Frame-Options in `<meta>`
3116         https://bugs.webkit.org/show_bug.cgi?id=156625
3117         <rdar://problem/25748714>
3118
3119         Reviewed by Darin Adler.
3120
3121         Follow RFC7034 (Section 4), which recommends that 'X-Frame-Options' be ignored when delivered as part of
3122         a '<meta http-equiv="...">' tag. This brings us in line with Firefox, Edge, and Blink.
3123
3124         Tests: http/tests/security/XFrameOptions/x-frame-options-ignore-deny-meta-tag-in-body.html
3125                http/tests/security/XFrameOptions/x-frame-options-ignore-deny-meta-tag-parent-same-origin-allow.html
3126                http/tests/security/XFrameOptions/x-frame-options-ignore-deny-meta-tag-parent-same-origin-deny.html
3127                http/tests/security/XFrameOptions/x-frame-options-ignore-deny-meta-tag.html
3128                http/tests/security/xssAuditor/meta-tag-http-refresh-x-frame-options-ignored.html
3129
3130         * dom/Document.cpp:
3131         (WebCore::Document::processHttpEquiv): Log error message instead of blocking the load.
3132
3133 2016-04-15  Jer Noble  <jer.noble@apple.com>
3134
3135         Audio elements should be able to have a controls manager.
3136         https://bugs.webkit.org/show_bug.cgi?id=156630
3137
3138         Reviewed by Beth Dakin.
3139
3140         Now that there is no longer a architectural restriction about what kind of media elements
3141         can be used with WebPlaybackSessionManager, allow audio elements to create a controls
3142         manager.
3143
3144         Drive-by fix: clear the controls manager when destroying the media player due to entering
3145         the page cache, and when destroying the media element.
3146
3147         * html/HTMLMediaElement.cpp:
3148         (WebCore::HTMLMediaElement::~HTMLMediaElement):
3149         (WebCore::HTMLMediaElement::updatePlayState):
3150         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
3151         * html/MediaElementSession.cpp:
3152         (WebCore::MediaElementSession::canControlControlsManager):
3153
3154 2016-04-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
3155
3156         Calling SVGAnimatedPropertyTearOff::animationEnded() will crash if the SVG property is not animating
3157         https://bugs.webkit.org/show_bug.cgi?id=156549
3158
3159         Reviewed by Darin Adler.
3160
3161         A speculative fix for a crash which may happen when calling animationEnded()
3162         of any SVGAnimatedProperty while it is not animating.
3163
3164         * svg/SVGAnimatedTypeAnimator.h:
3165         (WebCore::SVGAnimatedTypeAnimator::executeAction):
3166
3167 2016-04-15  Jer Noble  <jer.noble@apple.com>
3168
3169         Unreviewed build fix for iOS simulator. Assert the correct variable.
3170
3171         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3172         (-[WebAVPlayerLayer layoutSublayers]):
3173         (-[WebAVPlayerLayer resolveBounds]):
3174         (-[WebAVPlayerLayer setVideoGravity:]):
3175
3176 2016-04-14  Jer Noble  <jer.noble@apple.com>
3177
3178         Allow WebVideoFullscreenManager and Proxy to be used by audio elements.
3179         https://bugs.webkit.org/show_bug.cgi?id=156564
3180
3181         Reviewed by Beth Dakin.
3182
3183         No new tests; this refactors existing functionality into new classes.
3184
3185         Tease apart the various WebVideoFullscreen{Interface,Model}{AVKit,Mac,VideoElement} into new
3186         WebPlaybackSession… classes dealing exclusively with playback state and commands, leaving
3187         fullscreen state and commands in the WebVideoFullscreen… classes. Specifically, create the
3188         following new classes:
3189
3190         - WebPlaybackSessionInterface (copied from WebVideoFullscreenInterface)
3191         - WebPlaybackSessionModelMediaElement (copied from WebVideoFullscreenModelMediaElement)
3192         - WebPlaybackSessionModel (copied from WebVideoFullscreenModel)
3193         - WebPlaybackSessionInterfaceAVKit (copied from WebVideoFullscreenInterfaceAVKit)
3194         - WebPlaybackSessionInterfaceMac (copied from WebVideoFullscreenInterfaceMac)
3195
3196         WebVideoFullscreenInterface and WebVideoFullscreenModel now inherit from
3197         WebPlaybackSessionInterface and WebPlaybackSessionModel, respectively. The concrete
3198         WebVideoFullscreen… subclasses each take their respective WebPlaybackSession… subclasses and
3199         fulfill their WebPlaybackSession interfaces through composition.
3200
3201         As part of this big tease-apart, the WebAVPlayerController class needs to be exposed in a
3202         header (as it's accessed by two different classes now), so that class is moved into its own
3203         implementation and header files.
3204
3205         The one case where a change in a WebPlaybackSession… class needs to be reflected in a
3206         WebVideoFullscreen… class is in WebPlaybackSessionInterfaceAVKit, where
3207         WebVideoFullscreenInterfaceAVKit needs to be notified when external playback becomes dis/en-
3208         abled, so a new WebPlaybackSessionInterfaceAVKitClient interface has been added to allow the
3209         WebPlaybackSession… to notify the WebVideoFullscreen….
3210
3211         The responsibility for the "controls manager" has moved from the WebVideoFullscreen… classes
3212         to the WebPlaybackSession… classes, so the ChromeClient interface for creating and destroying
3213         those controls is similarly renamed from setUpVideoControlsManager() to
3214         setUpPlaybackControlsManager().
3215
3216         * WebCore.xcodeproj/project.pbxproj:
3217         * html/HTMLMediaElement.cpp:
3218         (WebCore::HTMLMediaElement::updatePlayState):
3219         * page/ChromeClient.h:
3220         * platform/cocoa/WebPlaybackSessionInterface.h: Copied from Source/WebCore/platform/cocoa/WebVideoFullscreenInterface.h.
3221         (WebCore::WebPlaybackSessionInterface::~WebPlaybackSessionInterface):
3222         * platform/cocoa/WebPlaybackSessionModel.h: Added.
3223         (WebCore::WebPlaybackSessionModel::~WebPlaybackSessionModel):
3224         * platform/cocoa/WebPlaybackSessionModelMediaElement.h: Added.
3225         (WebCore::WebPlaybackSessionModelMediaElement::create):
3226         (WebCore::WebPlaybackSessionModelMediaElement::mediaElement):
3227         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm: Added.
3228         (WebPlaybackSessionModelMediaElement::WebPlaybackSessionModelMediaElement):
3229         (WebPlaybackSessionModelMediaElement::~WebPlaybackSessionModelMediaElement):
3230         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface):
3231         (WebPlaybackSessionModelMediaElement::setMediaElement):
3232         (WebPlaybackSessionModelMediaElement::handleEvent):
3233         (WebPlaybackSessionModelMediaElement::updateForEventName):
3234         (WebPlaybackSessionModelMediaElement::play):
3235         (WebPlaybackSessionModelMediaElement::pause):
3236         (WebPlaybackSessionModelMediaElement::togglePlayState):
3237         (WebPlaybackSessionModelMediaElement::beginScrubbing):
3238         (WebPlaybackSessionModelMediaElement::endScrubbing):
3239         (WebPlaybackSessionModelMediaElement::seekToTime):
3240         (WebPlaybackSessionModelMediaElement::fastSeek):
3241         (WebPlaybackSessionModelMediaElement::beginScanningForward):
3242         (WebPlaybackSessionModelMediaElement::beginScanningBackward):
3243         (WebPlaybackSessionModelMediaElement::endScanning):
3244         (WebPlaybackSessionModelMediaElement::selectAudioMediaOption):
3245         (WebPlaybackSessionModelMediaElement::selectLegibleMediaOption):
3246         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
3247         (WebPlaybackSessionModelMediaElement::observedEventNames):
3248         (WebPlaybackSessionModelMediaElement::eventNameAll):
3249         * platform/cocoa/WebPlaybackSessionModelVideoElement.cpp: Copied from Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm.
3250         (WebPlaybackSessionModelVideoElement::WebPlaybackSessionModelVideoElement):
3251         (WebPlaybackSessionModelVideoElement::~WebPlaybackSessionModelVideoElement):
3252         (WebPlaybackSessionModelVideoElement::setWebVideoFullscreenInterface):
3253         (WebPlaybackSessionModelVideoElement::setVideoElement):
3254         (WebPlaybackSessionModelVideoElement::handleEvent):
3255         (WebPlaybackSessionModelVideoElement::updateForEventName):
3256         (WebPlaybackSessionModelVideoElement::play):
3257         (WebPlaybackSessionModelVideoElement::pause):
3258         (WebPlaybackSessionModelVideoElement::togglePlayState):
3259         (WebPlaybackSessionModelVideoElement::beginScrubbing):
3260         (WebPlaybackSessionModelVideoElement::endScrubbing):
3261         (WebPlaybackSessionModelVideoElement::seekToTime):
3262         (WebPlaybackSessionModelVideoElement::fastSeek):
3263         (WebPlaybackSessionModelVideoElement::beginScanningForward):
3264         (WebPlaybackSessionModelVideoElement::beginScanningBackward):
3265         (WebPlaybackSessionModelVideoElement::endScanning):
3266         (WebPlaybackSessionModelVideoElement::selectAudioMediaOption):
3267         (WebPlaybackSessionModelVideoElement::selectLegibleMediaOption):
3268         (WebPlaybackSessionModelVideoElement::updateLegibleOptions):
3269         (WebPlaybackSessionModelVideoElement::observedEventNames):
3270         (WebPlaybackSessionModelVideoElement::eventNameAll):
3271         * platform/cocoa/WebVideoFullscreenInterface.h:
3272         * platform/cocoa/WebVideoFullscreenModel.h:
3273         (WebCore::WebVideoFullscreenModel::~WebVideoFullscreenModel): Deleted.
3274         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
3275         (WebCore::WebVideoFullscreenModelVideoElement::create):
3276         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3277         (WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement):
3278         (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface):
3279         (WebVideoFullscreenModelVideoElement::setVideoElement):
3280         (WebVideoFullscreenModelVideoElement::play):
3281         (WebVideoFullscreenModelVideoElement::pause):
3282         (WebVideoFullscreenModelVideoElement::togglePlayState):
3283         (WebVideoFullscreenModelVideoElement::beginScrubbing):
3284         (WebVideoFullscreenModelVideoElement::endScrubbing):
3285         (WebVideoFullscreenModelVideoElement::seekToTime):
3286         (WebVideoFullscreenModelVideoElement::fastSeek):
3287         (WebVideoFullscreenModelVideoElement::beginScanningForward):
3288         (WebVideoFullscreenModelVideoElement::beginScanningBackward):
3289         (WebVideoFullscreenModelVideoElement::endScanning):
3290         (WebVideoFullscreenModelVideoElement::selectAudioMediaOption):
3291         (WebVideoFullscreenModelVideoElement::selectLegibleMediaOption):
3292         (WebVideoFullscreenModelVideoElement::handleEvent): Deleted.
3293         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Deleted.
3294         (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
3295         (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
3296         (WebVideoFullscreenModelVideoElement::observedEventNames): Deleted.
3297         (WebVideoFullscreenModelVideoElement::eventNameAll): Deleted.
3298         (WebVideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
3299         (WebVideoFullscreenModelVideoElement::isVisible): Deleted.
3300         * platform/ios/WebAVPlayerController.h: Added.
3301         * platform/ios/WebAVPlayerController.mm: Added.
3302         (-[WebAVPlayerController dealloc]):
3303         (-[WebAVPlayerController resetState]):
3304         (-[WebAVPlayerController player]):
3305         (-[WebAVPlayerController forwardingTargetForSelector:]):
3306         (-[WebAVPlayerController play:]):
3307         (-[WebAVPlayerController pause:]):
3308         (-[WebAVPlayerController togglePlayback:]):
3309         (-[WebAVPlayerController togglePlaybackEvenWhenInBackground:]):
3310         (-[WebAVPlayerController isPlaying]):
3311         (-[WebAVPlayerController setPlaying:]):
3312         (+[WebAVPlayerController keyPathsForValuesAffectingPlaying]):
3313         (-[WebAVPlayerController beginScrubbing:]):
3314         (-[WebAVPlayerController endScrubbing:]):
3315         (-[WebAVPlayerController seekToTime:]):
3316         (-[WebAVPlayerController currentTimeWithinEndTimes]):
3317         (-[WebAVPlayerController setCurrentTimeWithinEndTimes:]):
3318         (+[WebAVPlayerController keyPathsForValuesAffectingCurrentTimeWithinEndTimes]):
3319         (-[WebAVPlayerController hasLiveStreamingContent]):
3320         (+[WebAVPlayerController keyPathsForValuesAffectingHasLiveStreamingContent]):
3321         (-[WebAVPlayerController skipBackwardThirtySeconds:]):
3322         (-[WebAVPlayerController gotoEndOfSeekableRanges:]):
3323         (-[WebAVPlayerController canScanForward]):
3324         (+[WebAVPlayerController keyPathsForValuesAffectingCanScanForward]):
3325         (-[WebAVPlayerController beginScanningForward:]):
3326         (-[WebAVPlayerController endScanningForward:]):
3327         (-[WebAVPlayerController beginScanningBackward:]):
3328         (-[WebAVPlayerController endScanningBackward:]):
3329         (-[WebAVPlayerController canSeekToBeginning]):
3330         (+[WebAVPlayerController keyPathsForValuesAffectingCanSeekToBeginning]):
3331         (-[WebAVPlayerController seekToBeginning:]):
3332         (-[WebAVPlayerController seekChapterBackward:]):
3333         (-[WebAVPlayerController canSeekToEnd]):
3334         (+[WebAVPlayerController keyPathsForValuesAffectingCanSeekToEnd]):
3335         (-[WebAVPlayerController seekToEnd:]):
3336         (-[WebAVPlayerController seekChapterForward:]):
3337         (-[WebAVPlayerController hasMediaSelectionOptions]):
3338         (+[WebAVPlayerController keyPathsForValuesAffectingHasMediaSelectionOptions]):
3339         (-[WebAVPlayerController hasAudioMediaSelectionOptions]):
3340         (+[WebAVPlayerController keyPathsForValuesAffectingHasAudioMediaSelectionOptions]):
3341         (-[WebAVPlayerController hasLegibleMediaSelectionOptions]):
3342         (+[WebAVPlayerController keyPathsForValuesAffectingHasLegibleMediaSelectionOptions]):
3343         (-[WebAVPlayerController currentAudioMediaSelectionOption]):
3344         (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
3345         (-[WebAVPlayerController currentLegibleMediaSelectionOption]):
3346         (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
3347         (-[WebAVPlayerController isPlayingOnExternalScreen]):
3348         (+[WebAVPlayerController keyPathsForValuesAffectingPlayingOnExternalScreen]):
3349         (-[WebAVPlayerController isPictureInPictureInterrupted]):
3350         (-[WebAVPlayerController setPictureInPictureInterrupted:]):
3351         * platform/ios/WebPlaybackSessionInterfaceAVKit.h: Added.
3352         (WebCore::WebPlaybackSessionInterfaceAVKitClient::~WebPlaybackSessionInterfaceAVKitClient):
3353         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm: Added.
3354         (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):
3355         (WebCore::WebPlaybackSessionInterfaceAVKit::~WebPlaybackSessionInterfaceAVKit):
3356         (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState):
3357         (WebCore::WebPlaybackSessionInterfaceAVKit::setWebPlaybackSessionModel):
3358         (WebCore::WebPlaybackSessionInterfaceAVKit::setDuration):
3359         (WebCore::WebPlaybackSessionInterfaceAVKit::setCurrentTime):
3360         (WebCore::WebPlaybackSessionInterfaceAVKit::setBufferedTime):
3361         (WebCore::WebPlaybackSessionInterfaceAVKit::setRate):
3362         (WebCore::WebPlaybackSessionInterfaceAVKit::setSeekableRanges):
3363         (WebCore::WebPlaybackSessionInterfaceAVKit::setCanPlayFastReverse):
3364         (WebCore::mediaSelectionOptions):
3365         (WebCore::WebPlaybackSessionInterfaceAVKit::setAudioMediaSelectionOptions):
3366         (WebCore::WebPlaybackSessionInterfaceAVKit::setLegibleMediaSelectionOptions):
3367         (WebCore::WebPlaybackSessionInterfaceAVKit::setExternalPlayback):
3368         (WebCore::WebPlaybackSessionInterfaceAVKit::setWirelessVideoPlaybackDisabled):
3369         (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabled):
3370         (WebCore::WebPlaybackSessionInterfaceAVKit::invalidate):
3371         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3372         (WebVideoFullscreenControllerContext::setUpFullscreen):
3373         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
3374         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3375         (-[WebAVPlayerViewControllerDelegate fullscreenInterface]):
3376         (-[WebAVPlayerViewControllerDelegate setFullscreenInterface:]):
3377         (-[WebAVPlayerLayer fullscreenInterface]):
3378         (-[WebAVPlayerLayer setFullscreenInterface:]):
3379         (-[WebAVPlayerLayer layoutSublayers]):
3380         (-[WebAVPlayerLayer resolveBounds]):
3381         (-[WebAVPlayerLayer setVideoGravity:]):
3382         (WebVideoFullscreenInterfaceAVKit::create):
3383         (WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit):
3384         (WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
3385         (WebVideoFullscreenInterfaceAVKit::playerController):
3386         (WebVideoFullscreenInterfaceAVKit::resetMediaState):
3387         (WebVideoFullscreenInterfaceAVKit::setDuration):
3388         (WebVideoFullscreenInterfaceAVKit::setCurrentTime):
3389         (WebVideoFullscreenInterfaceAVKit::setBufferedTime):
3390         (WebVideoFullscreenInterfaceAVKit::setRate):
3391         (WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
3392         (WebVideoFullscreenInterfaceAVKit::setSeekableRanges):
3393         (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse):
3394         (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions):
3395         (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions):
3396         (WebVideoFullscreenInterfaceAVKit::setExternalPlayback):
3397         (WebVideoFullscreenInterfaceAVKit::externalPlaybackEnabledChanged):
3398         (WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled):
3399         (WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled):
3400         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
3401         (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen):
3402         (WebVideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoPictureInPicture):
3403         (-[WebAVPlayerViewControllerDelegate playerViewControllerWillStartPictureInPicture:]): Deleted.
3404         (-[WebAVPlayerViewControllerDelegate playerViewControllerDidStartPictureInPicture:]): Deleted.
3405         (-[WebAVPlayerViewControllerDelegate playerViewControllerFailedToStartPictureInPicture:withError:]): Deleted.
3406         (-[WebAVPlayerViewControllerDelegate playerViewControllerWillStopPictureInPicture:]): Deleted.
3407         (-[WebAVPlayerViewControllerDelegate playerViewControllerDidStopPictureInPicture:]): Deleted.
3408         (convertToExitFullScreenReason): Deleted.
3409         (-[WebAVPlayerViewControllerDelegate playerViewController:shouldExitFullScreenWithReason:]): Deleted.
3410         (-[WebAVPlayerViewControllerDelegate playerViewController:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:]): Deleted.
3411         (-[WebAVPlayerLayer init]): Deleted.
3412         (-[WebAVPlayerLayer dealloc]): Deleted.
3413         (-[WebAVPlayerLayer videoGravity]): Deleted.
3414         (-[WebAVPlayerLayer videoRect]): Deleted.
3415         (+[WebAVPlayerLayer keyPathsForValuesAffectingVideoRect]): Deleted.
3416         (WebAVPictureInPicturePlayerLayerView_layerClass): Deleted.
3417         (getWebAVPictureInPicturePlayerLayerViewClass): Deleted.
3418         (WebAVPlayerLayerView_layerClass): Deleted.
3419         (WebAVPlayerLayerView_playerController): Deleted.
3420         (WebAVPlayerLayerView_setPlayerController): Deleted.
3421         (WebAVPlayerLayerView_videoView): Deleted.
3422         (WebAVPlayerLayerView_setVideoView): Deleted.
3423         (WebAVPlayerLayerView_startRoutingVideoToPictureInPicturePlayerLayerView): Deleted.
3424         (WebAVPlayerLayerView_stopRoutingVideoToPictureInPicturePlayerLayerView): Deleted.
3425         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView): Deleted.
3426         (WebAVPlayerLayerView_dealloc): Deleted.
3427         (getWebAVPlayerLayerViewClass): Deleted.
3428         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel): Deleted.
3429         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenChangeObserver): Deleted.
3430         (WebVideoFullscreenInterfaceAVKit::applicationDidBecomeActive): Deleted.
3431         (WebVideoFullscreenInterfaceAVKit::enterFullscreen): Deleted.
3432         (WebVideoFullscreenInterfaceAVKit::enterFullscreenStandard): Deleted.
3433         (WebVideoFullscreenInterfaceAVKit::exitFullscreen): Deleted.
3434         (WebVideoFullscreenInterfaceAVKit::didStartPictureInPicture): Deleted.
3435         (WebVideoFullscreenInterfaceAVKit::failedToStartPictureInPicture): Deleted.
3436         (WebVideoFullscreenInterfaceAVKit::willStopPictureInPicture): Deleted.
3437         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture): Deleted.
3438         (WebVideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler): Deleted.
3439         (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): Deleted.
3440         (WebVideoFullscreenInterfaceAVKit::watchdogTimerFired): Deleted.
3441         (WebVideoFullscreenInterfaceAVKit::setMode): Deleted.
3442         (WebVideoFullscreenInterfaceAVKit::clearMode): Deleted.
3443         (WebCore::supportsPictureInPicture): Deleted.
3444         * platform/mac/WebPlaybackSessionInterfaceMac.h: Added.
3445         * platform/mac/WebPlaybackSessionInterfaceMac.mm: Copied from Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm.
3446         (-[WebAVMediaSelectionOptionMac localizedDisplayName]):
3447         (-[WebAVMediaSelectionOptionMac setLocalizedDisplayName:]):
3448         (-[WebPlaybackControlsManager initWithWebPlaybackSessionInterfaceMac:]):
3449         (-[WebPlaybackControlsManager timing]):
3450         (-[WebPlaybackControlsManager setTiming:]):
3451         (-[WebPlaybackControlsManager seekableTimeRanges]):
3452         (-[WebPlaybackControlsManager setSeekableTimeRanges:]):
3453         (-[WebPlaybackControlsManager isSeeking]):
3454         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]):
3455         (-[WebPlaybackControlsManager audioMediaSelectionOptions]):
3456         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:]):
3457         (-[WebPlaybackControlsManager currentAudioMediaSelectionOption]):
3458         (-[WebPlaybackControlsManager setCurrentAudioMediaSelectionOption:]):
3459         (-[WebPlaybackControlsManager legibleMediaSelectionOptions]):
3460         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:]):
3461         (-[WebPlaybackControlsManager currentLegibleMediaSelectionOption]):
3462         (-[WebPlaybackControlsManager setCurrentLegibleMediaSelectionOption:]):
3463         (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
3464         (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
3465         (WebCore::WebPlaybackSessionInterfaceMac::setWebPlaybackSessionModel):
3466         (WebCore::WebPlaybackSessionInterfaceMac::setDuration):
3467         (WebCore::WebPlaybackSessionInterfaceMac::setCurrentTime):
3468         (WebCore::WebPlaybackSessionInterfaceMac::setRate):
3469         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
3470         (WebCore::mediaSelectionOptions):
3471         (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions):
3472         (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions):
3473         (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
3474         (WebCore::WebPlaybackSessionInterfaceMac::ensureControlsManager):
3475         (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager):
3476         * platform/mac/WebVideoFullscreenInterfaceMac.h:
3477         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3478         (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac):
3479         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
3480         (WebCore::WebVideoFullscreenInterfaceMac::setDuration):
3481         (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime):
3482         (WebCore::WebVideoFullscreenInterfaceMac::setRate):
3483         (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges):
3484         (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions):
3485         (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions):
3486         (WebCore::WebVideoFullscreenInterfaceMac::ensureControlsManager):
3487         (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac): Deleted.
3488         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver): Deleted.
3489         (WebCore::WebVideoFullscreenInterfaceMac::setMode): Deleted.
3490         (WebCore::WebVideoFullscreenInterfaceMac::clearMode): Deleted.
3491         (WebCore::WebVideoFullscreenInterfaceMac::setupFullscreen): Deleted.
3492         (WebCore::WebVideoFullscreenInterfaceMac::enterFullscreen): Deleted.
3493         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreen): Deleted.
3494         (WebCore::WebVideoFullscreenInterfaceMac::exitFullscreenWithoutAnimationToMode): Deleted.
3495         (WebCore::WebVideoFullscreenInterfaceMac::cleanupFullscreen): Deleted.
3496         (WebCore::WebVideoFullscreenInterfaceMac::invalidate): Deleted.
3497         (WebCore::WebVideoFullscreenInterfaceMac::preparedToReturnToInline): Deleted.
3498         (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions): Deleted.
3499         (WebCore::supportsPictureInPicture): Deleted.
3500
3501 2016-04-15  Chris Dumez  <cdumez@apple.com>
3502
3503         [COCOA] Do not unnecessarily initialize ResourceResponse::m_httpVersion as part of common fields
3504         https://bugs.webkit.org/show_bug.cgi?id=156606
3505
3506         Reviewed by Darin Adler.
3507
3508         Do not unnecessarily initialize ResourceResponse::m_httpVersion as part of common fields.
3509
3510         We previously initialized m_httpVersion when calling platformLazyInit(CommonFieldsOnly),
3511         even though this is not a common field. The corresponding getter/setter in
3512         HTTPResponseBase call lazyInit(AllFields).
3513
3514         * platform/network/cf/ResourceResponseCFNet.cpp:
3515         (WebCore::ResourceResponse::platformLazyInit):
3516         * platform/network/cocoa/ResourceResponseCocoa.mm:
3517         (WebCore::ResourceResponse::platformLazyInit):
3518
3519 2016-04-15  John Wilander  <wilander@apple.com>
3520
3521         Refactor WebSockets handshake to use StringView instead of String for header validation.
3522         https://bugs.webkit.org/show_bug.cgi?id=155602
3523
3524         Reviewed by Darin Adler.
3525
3526         No new tests. Existing test have been augmented.
3527
3528         * Modules/websockets/WebSocketHandshake.cpp:
3529         (WebCore::WebSocketHandshake::readServerHandshake):
3530             Made sure failure reason was set consistently with makeString().
3531         (WebCore::headerHasValidHTTPVersion):
3532             Now operates on the HTTP status line with StringView.
3533         (WebCore::WebSocketHandshake::readStatusLine):
3534             Now operates on the HTTP status line with StringView.
3535         (WebCore::WebSocketHandshake::readHTTPHeaders):
3536             Now operates on header names with StringView.
3537             Made sure failure reason was set consistently with makeString() and ASCIILiteral().
3538         (WebCore::WebSocketHandshake::checkResponseHeaders):
3539             Made sure failure reason was set consistently with ASCIILiteral().
3540         * platform/network/HTTPParsers.cpp:
3541         (WebCore::parseHTTPRequestLine):
3542             Made sure failure reason was set consistently with ASCIILiteral().
3543         (WebCore::isValidHeaderNameCharacter):
3544             Inlined function to check if a character is allowed in an HTTP header name according to RFC 7230.
3545             https://tools.ietf.org/html/rfc7230 (June 2014)
3546         (WebCore::parseHTTPHeader):
3547         * platform/network/HTTPParsers.h:
3548             Now receives the HTTP header name as a StringView.
3549             Checks that header names only contain valid characters according to RFC 7230 (see above).
3550         * platform/network/ResourceRequestBase.cpp:
3551         (WebCore::ResourceRequestBase::addHTTPHeaderField):
3552         * platform/network/ResourceRequestBase.h:
3553              Now has an overloaded function which receives the HTTP header name as an HTTPHeaderName enum value.
3554         * platform/network/ResourceResponseBase.cpp:
3555         (WebCore::ResourceResponseBase::addHTTPHeaderField):
3556         * platform/network/ResourceResponseBase.h:
3557              Now has an overloaded function which receives the HTTP header name as an HTTPHeaderName enum value.
3558
3559 2016-04-15  Joanmarie Diggs  <jdiggs@igalia.com>
3560
3561         AX: Presentational role on SVG elements is trumped by child 'title' and 'desc' elements
3562         https://bugs.webkit.org/show_bug.cgi?id=156519
3563
3564         Reviewed by Chris Fleizach.
3565
3566         Override the presentational role on SVG elements which have a child 'title' or 'desc'
3567         element. As a result of this change, AccessibilitySVGRoot objects would be exposed
3568         with an AccessibilityRole of UnknownRole. Therefore map included AccessibilitySVGRoot
3569         objects to GroupRole as per the SVG Accessibility API Mapping specification.
3570
3571         Also use indexOfBestMatchingLanguageInList() to identify which child 'title' or 'desc'
3572         element is the best match for the parent element.
3573
3574         New Test: accessibility/w3c-svg-content-language-attribute.html
3575
3576         Also: Update w3c-svg-presentational-role.html expectations because there are test cases
3577         in which elements are now being included in the accessibility tree as a result of this
3578         change. Also add new test cases which lack child 'title' and 'desc' elements.
3579
3580         * accessibility/AccessibilityNodeObject.h:
3581         * accessibility/AccessibilitySVGElement.cpp:
3582         (WebCore::AccessibilitySVGElement::childElementWithMatchingLanguage):
3583         (WebCore::AccessibilitySVGElement::accessibilityDescription):
3584         (WebCore::AccessibilitySVGElement::helpText):
3585         (WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored):
3586         (WebCore::AccessibilitySVGElement::determineAriaRoleAttribute):
3587         * accessibility/AccessibilitySVGElement.h:
3588         * accessibility/AccessibilitySVGRoot.h:
3589
3590 2016-04-15  Chris Dumez  <cdumez@apple.com>
3591
3592         Rename [GlobalContext] extended attribute to [Exposed] and align with WebIDL
3593         https://bugs.webkit.org/show_bug.cgi?id=156615
3594
3595         Reviewed by Youenn Fablet.
3596
3597         Rename [GlobalContext] extended attribute to [Exposed] and align with WebIDL:
3598         - http://heycam.github.io/webidl/#Exposed
3599
3600         * bindings/scripts/IDLAttributes.txt:
3601         Stop recognizing [GlobalContext] and start recognizing [Exposed].
3602
3603         * bindings/scripts/IDLParser.pm:
3604         (parseIdentifierList):
3605         (parseExtendedAttributeRest2):
3606         Add IDL parser support for having a list of identifiers as value
3607         for an IDL extended attribute, e.g. Exposed=(Window, Worker).
3608
3609         * bindings/scripts/preprocess-idls.pl:
3610         Tweak existing support for [GlobalContext] to use [Exposed] instead
3611         and support the new syntax.
3612
3613         (getInterfaceExtendedAttributesFromIDL):
3614         Do not split on commas that are within brackets.
3615
3616         * Modules/fetch/FetchBody.idl:
3617         * Modules/fetch/FetchHeaders.idl:
3618         * Modules/fetch/FetchRequest.idl:
3619         * Modules/fetch/FetchResponse.idl:
3620         * Modules/streams/ByteLengthQueuingStrategy.idl:
3621         * Modules/streams/CountQueuingStrategy.idl:
3622         * Modules/streams/ReadableStream.idl:
3623         * Modules/streams/ReadableStreamController.idl:
3624         * Modules/streams/ReadableStreamReader.idl:
3625         * Modules/websockets/WebSocket.idl:
3626         * dom/MessageChannel.idl:
3627         * dom/MessageEvent.idl:
3628         * fileapi/Blob.idl:
3629         * fileapi/FileReader.idl:
3630         * fileapi/FileReaderSync.idl:
3631         * html/DOMURL.idl:
3632         * html/ImageData.idl:
3633         * page/EventSource.idl:
3634         * workers/DedicatedWorkerGlobalScope.idl:
3635         * workers/WorkerGlobalScope.idl:
3636         * workers/WorkerLocation.idl:
3637         * xml/XMLHttpRequest.idl:
3638         * xml/XMLHttpRequestEventTarget.idl:
3639         Use [Exposed] instead of [GlobalContext] to match their respective
3640         specifications.
3641
3642 2016-04-15  Carlos Garcia Campos  <cgarcia@igalia.com>
3643
3644         Selection.deleteFromDocument should not leave a selection character
3645         https://bugs.webkit.org/show_bug.cgi?id=151442
3646
3647         Reviewed by Michael Catanzaro.
3648
3649         This is a merge of Blink r172511:
3650         https://codereview.chromium.org/255453003
3651
3652         Let Selection.deleteFromDocument not delete a character when the
3653         selection is a caret.
3654
3655         Selection.deleteFromDocument delete a character when the selection
3656         is a caret.
3657         However, current standard says that Selection.deleteFromDocument
3658         does nothing when the selection is a caret:
3659         https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-deletefromdocument
3660         Both IE10 and FireFox seem following the spec.
3661
3662         Test: imported/blink/editing/selection/deleteFromDocument-undo-crash.html
3663
3664         * page/DOMSelection.cpp:
3665         (WebCore::DOMSelection::deleteFromDocument): Deleted.
3666
3667 2016-04-15  Antti Koivisto  <antti@apple.com>
3668
3669         Fix return value nullptr -> false.
3670
3671         * style/StyleSharingResolver.cpp:
3672         (WebCore::Style::SharingResolver::canShareStyleWithElement):
3673
3674 2016-04-14  Antti Koivisto  <antti@apple.com>
3675
3676         AffectsNextSibling style relation marking is inefficient
3677         https://bugs.webkit.org/show_bug.cgi?id=156593
3678
3679         Reviewed by Benjamin Poulain.
3680
3681         We currently add a Style::Relation entry for each sibling to mark. With long sibling lists this can be inefficient
3682         in terms of both memory and speed. Instead make a single entry that includes the sibling count to mark.
3683
3684         * css/SelectorChecker.cpp:
3685         (WebCore::addStyleRelation):
3686
3687             When adding AffectsNextSibling entry check if the last entry in the style relation vector has the
3688             same type and is part of the same sibling chain. If so just update the existing entry.
3689
3690         * cssjit/SelectorCompiler.cpp:
3691         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):
3692
3693             The same thing in hand-crafted macro assembler.
3694
3695         * cssjit/SelectorCompiler.h:
3696
3697             Stop lying about the constness of the CheckingContext.
3698
3699         * style/StyleRelations.cpp:
3700         (WebCore::Style::commitRelations):
3701
3702             Mark as many sibling elements as the value indicates.
3703
3704         * style/StyleRelations.h:
3705         (WebCore::Style::Relation::Relation):
3706
3707             Make element a pointer so we can udpate it.
3708
3709 2016-04-15  Brady Eidson  <beidson@apple.com>
3710
3711         Add the message property to DOMError.
3712         https://bugs.webkit.org/show_bug.cgi?id=139173
3713
3714         Reviewed by Alex Christensen.
3715
3716         No new tests (Updated existing tests).
3717         
3718         Adding this property brings us up to date with other browsers, and will help
3719         test the few web features that still use DOMError.
3720
3721         * Modules/indexeddb/IDBOpenDBRequest.cpp:
3722         (WebCore::IDBOpenDBRequest::onError):
3723         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
3724
3725         * Modules/indexeddb/IDBRequest.cpp:
3726         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
3727         (WebCore::IDBRequest::onError):
3728
3729         * Modules/indexeddb/IDBTransaction.cpp:
3730         (WebCore::IDBTransaction::didCreateIndexOnServer):
3731
3732         * Modules/mediastream/NavigatorUserMediaError.h:
3733         (WebCore::NavigatorUserMediaError::NavigatorUserMediaError):
3734
3735         * dom/DOMError.cpp:
3736         (WebCore::DOMError::DOMError):
3737
3738         * dom/DOMError.h:
3739         (WebCore::DOMError::create):
3740         (WebCore::DOMError::message):
3741         * dom/DOMError.idl:
3742
3743 2016-04-14  Brent Fulgham  <bfulgham@apple.com>
3744
3745         Make <a download> a runtime enabled option
3746         https://bugs.webkit.org/show_bug.cgi?id=156583
3747         <rdar://problem/25733449>
3748
3749         Reviewed by Alex Christensen.
3750
3751         Mark the download attribute interface as EnabledAtRuntime=DownloadAttribute.
3752         Add DownloadAttribute runtime flag getter and setter.
3753
3754         * bindings/generic/RuntimeEnabledFeatures.h:
3755         (WebCore::RuntimeEnabledFeatures::fetchAPIEnabled):
3756         (WebCore::RuntimeEnabledFeatures::setDownloadAttributeEnabled):
3757         (WebCore::RuntimeEnabledFeatures::downloadAttributeEnabled):
3758         * html/HTMLAnchorElement.cpp:
3759         (WebCore::HTMLAnchorElement::handleClick):
3760         * html/HTMLAnchorElement.idl:
3761
3762 2016-04-14  David Kilzer  <ddkilzer@apple.com>
3763
3764         REGRESSION (r158956): Remove vestigial range code in FileReaderLoader class after removing ENABLE(STREAM)
3765         <http://webkit.org/b/156609>
3766
3767         Reviewed by Brent Fulgham.
3768
3769         This code was left behind when ENABLE(STREAM) was removed in
3770         November 2013.
3771
3772         * fileapi/FileReaderLoader.cpp:
3773         (WebCore::FileReaderLoader::FileReaderLoader): Remove
3774         initializers.
3775         (WebCore::FileReaderLoader::start): Remove code that uses
3776         m_hasRange, which is always false.
3777         (WebCore::FileReaderLoader::didReceiveResponse): Ditto.
3778         * fileapi/FileReaderLoader.h:
3779         (WebCore::FileReaderLoader): Remove unused instance variables.
3780
3781 2016-04-14  Alex Christensen  <achristensen@webkit.org>
3782
3783         Build fix after r199549.
3784         https://bugs.webkit.org/show_bug.cgi?id=156580
3785
3786         * CMakeLists.txt:
3787         * PlatformEfl.cmake:
3788         * PlatformGTK.cmake:
3789         * PlatformWin.cmake:
3790         KillRingNone.cpp is indeed platform-specific. KillRingMac.mm is used instead only on Mac.
3791
3792 2016-04-14  Dean Jackson  <dino@apple.com>
3793
3794         CrashTracer: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::CachedResource::addClientToSet + 27
3795         https://bugs.webkit.org/show_bug.cgi?id=156602
3796         <rdar://problem/18921091>
3797
3798         Reviewed by Simon Fraser.
3799
3800         The CSS property list-style-image is inherited, so a transition on a parent
3801         might cause a transition on a child. On that child, the value might be between
3802         two generated crossfade images which haven't yet resolved, causing a crash.
3803
3804         Test: transitions/crossfade-transition.html
3805
3806         * css/CSSCrossfadeValue.cpp:
3807         (WebCore::CSSCrossfadeValue::blend): Return null if there are no cached images.
3808         * page/animation/CSSPropertyAnimation.cpp:
3809         (WebCore::blendFunc): If we don't have an actual image to blend between, fall
3810         out to the default case.
3811
3812 2016-04-14  Antonio Gomes  <tonikitoo@webkit.org>
3813
3814         Allow listbox content and scrollbar to intrude padding area.
3815         https://bugs.webkit.org/show_bug.cgi?id=128489
3816
3817         Reviewed by Myles C. Maxfield.
3818
3819         Originally when the RenderListBox::controlClipRect method was implemented (see [1]), it used
3820         to allow its content (<option>'s) to intrude padding to get rendered. Overlay scrollbars were also
3821         allowed to paint over the padding area, if necessary.
3822
3823         [2] changed this behavior to restrict list-box'es content within the content box rect (excluding padding and border).
3824
3825         This had two consequences:
3826         1) it made WebKit disallow list-box' content to intrude the padding area, diverging from other vendors.
3827         like Firefox and Chrome.
3828         2) Since overlay scrollbar might get painted over the padding area, if any, [2] could result
3829         in the scrollbar being clipped out if padding-right is set (or padding-left in case of RTL content).
3830
3831         Patch changed WebKit back so that it allows list-box' content and overlay scrollbars to intrude the
3832         padding area, matching other browsers vendors
3833
3834         [1] https://trac.webkit.org/changeset/18819/trunk/WebCore/rendering/RenderListBox.cpp
3835         [2] https://trac.webkit.org/changeset/19037/trunk/WebCore/rendering/RenderListBox.cpp
3836
3837         Tests: fast/forms/listbox-selection-3.html
3838                fast/forms/listbox-padding-clip-selected.html
3839                fast/forms/listbox-padding-clip-expected-mismatch.html (renamed from listbox-padding-clip-overlay-expected.html)
3840                fast/forms/listbox-padding-clip-overlay-expected-mismatch.html (renamed from listbox-padding-clip-expected.html)
3841
3842         * rendering/RenderListBox.cpp:
3843         (WebCore::RenderListBox::numVisibleItems): changed to allow list-box items to get rendered on the padding-bottom area.
3844         This matches Firefox and Chrome.
3845         (WebCore::RenderListBox::listIndexAtOffset): relax the check for a given list-box item at a specific offset in the vertical axis.
3846         This means if an list-box item has its content painted into the padding-bottom area, it will be actionable by mouse clicking.
3847         This matches Firefox and Chrome.
3848         (WebCore::RenderListBox::controlClipRect): clips list-box content against the padding box rect rather than the content box rect,
3849         to allow its list-box items' content intrude the padding area.
3850         This matches Firefox and Chrome.
3851
3852 2016-04-14  Antti Koivisto  <antti@apple.com>
3853
3854         Collapsed border cache invalidation can lead to O(n^2) during style resolve
3855         https://bugs.webkit.org/show_bug.cgi?id=156570
3856
3857         Reviewed by Darin Adler.
3858
3859         RenderTable::invalidateCollapsedBorders traverses all cells. It is called when table cell border changes.
3860         This can result in O(n^2) during style resolve.
3861
3862         * rendering/RenderTable.cpp:
3863         (WebCore::RenderTable::layout):
3864         (WebCore::RenderTable::invalidateCollapsedBorders):
3865
3866             For cell border style change invalidate the hasEmptyCollapsedBorder bits only for the neighbouring cells.
3867             They are the only ones that can be affected.
3868
3869         * rendering/RenderTable.h:
3870         (WebCore::RenderTable::collapsedBordersAreValid):
3871         (WebCore::RenderTable::collapsedEmptyBorderIsPresent):
3872         (WebCore::RenderTable::currentBorderValue):
3873         * rendering/RenderTableCell.cpp:
3874         (WebCore::RenderTableCell::styleDidChange):
3875
3876 2016-04-14  Manuel Rego Casasnovas  <rego@igalia.com>
3877
3878         [css-grid] Implement CSSGridTemplateAreasValue::equals
3879         https://bugs.webkit.org/show_bug.cgi?id=156578
3880
3881         Reviewed by Darin Adler.
3882
3883         This was causing an infinite loop setting grid-template-areas
3884         from JavaScript.
3885
3886         The reason was that CSSGridTemplateAreasValue needs
3887         an specific implementation of equals() method.
3888
3889         Test: fast/css-grid-layout/grid-template-areas-infinite-loop.html
3890
3891         * css/CSSGridTemplateAreasValue.cpp:
3892         (WebCore::CSSGridTemplateAreasValue::equals):
3893         * css/CSSGridTemplateAreasValue.h:
3894
3895 2016-04-14  Brent Fulgham  <bfulgham@apple.com>
3896
3897         [CMake] Clean up CMake files
3898         https://bugs.webkit.org/show_bug.cgi?id=156580
3899
3900         Reviewed by Alex Christensen.
3901
3902         Revise the various CMake input files to reduce the amount of duplicated file references in
3903         the various ports.
3904
3905         * CMakeLists.txt:
3906         * PlatformAppleWin.cmake:
3907         * PlatformEfl.cmake:
3908         * PlatformGTK.cmake:
3909         * PlatformWin.cmake:
3910         * PlatformWinCairo.cmake:
3911
3912 2016-04-14  Frederic Wang  <fred.wang@free.fr>
3913
3914         RenderMathMLOperator: Add helper function to retrieve italic correction
3915         https://bugs.webkit.org/show_bug.cgi?id=156572
3916
3917         Reviewed by Darin Adler.
3918
3919         No new tests, the helper function will only be used in bug 153918.
3920
3921         * rendering/mathml/RenderMathMLOperator.cpp:
3922         (WebCore::RenderMathMLOperator::italicCorrection): Return the italic correction from the MATH table if it's a large operator.
3923         * rendering/mathml/RenderMathMLOperator.h: Declare italicCorrection.
3924
3925 2016-04-14  Frederic Wang  <fwang@igalia.com>
3926
3927         RenderMathMLOperator: Move glyph measuring helper functions outside the class
3928         https://bugs.webkit.org/show_bug.cgi?id=156571
3929
3930         Reviewed by Darin Adler.
3931