2f42f67b3791a041468a186a50050c327fdc45a3
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-06-04  Darin Adler  <darin@apple.com>
2
3         leaks seen in fast/css/variables tests
4         https://bugs.webkit.org/show_bug.cgi?id=150728
5
6         Reviewed by Anders Carlsson.
7
8         Fixes leaks seen running fast/css/variables tests with leak checking turned on.
9
10         * css/CSSPrimitiveValue.cpp:
11         (WebCore::isStringType): Added. For debugging purposes so we catch cases where we
12         are not treating strings consistently between construction and destruction.
13         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Assert isStringType returns true.
14         (WebCore::CSSPrimitiveValue::cleanup): Added CSS_DIMENSION and CSS_PARSER_IDENTIFIER
15         to the list of types that have to decrement the reference count of the string we own.
16         Both types are passed to the string constructor above.
17
18         * css/CSSValueList.cpp:
19         (WebCore::CSSValueList::buildParserValueListSubstitutingVariables): Restructured the
20         code so we destroy any CSSParserValue that we don't use. This is needed because of the
21         peculiar requirements of CSSParserValue: it has a be a struct without a destructor so
22         it can be used in the CSS grammar, so we have to destroy it explicitly. Ideally we would
23         minimize any use of it outside the CSSParser itself, but as long as we are using it, we
24         need to do this explicit destruction.
25
26 2016-06-04  Anders Carlsson  <andersca@apple.com>
27
28         32-bit build fix
29         https://bugs.webkit.org/show_bug.cgi?id=158383
30         rdar://problem/26628125
31
32         Reviewed by Dan Bernstein.
33
34         Synthesize the webPlaybackSessionInterfaceMac property.
35
36         * platform/mac/WebPlaybackControlsManager.mm:
37
38 2016-06-04  Chris Dumez  <cdumez@apple.com>
39
40         Avoid redundant isUndefined() check for parameters that are both optional and nullable in overloads
41         https://bugs.webkit.org/show_bug.cgi?id=158380
42
43         Reviewed by Brady Eidson.
44
45         * bindings/scripts/CodeGeneratorJS.pm:
46         (GenerateParametersCheckExpression):
47         * bindings/scripts/test/JS/JSTestObj.cpp:
48         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
49
50 2016-06-04  Brent Fulgham  <bfulgham@apple.com>
51
52         CSP: Content Security Policy directive, upgrade-insecure-requests (UIR)
53         https://bugs.webkit.org/show_bug.cgi?id=143653
54         <rdar://problem/23032067>
55
56         Reviewed by Andy Estes.
57
58         Modify our loading logic so that we recognize and upgrade insecure requests to secure
59         requests if the Content Security Policy directive 'upgrade-insecure-requests' is
60         present.
61         
62         Add a static helper function to ContentSecurityPolicy to upgrade insecure URLs so
63         that we don't have to sprinkle the same code all over the loader system.
64
65         Tests: http/tests/security/contentSecurityPolicy/report-only-upgrade-insecure.php
66                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-cors.https.html
67                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade.https.html
68                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html
69                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-auxiliary.html
70                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-nested.html
71                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-subresource.html
72                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-top-level.html
73                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html
74                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-nested-upgrades.html
75                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-open-window-upgrades.html
76                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-audio-video-in-main-frame.html
77                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-css-in-iframe.html
78                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-image-in-main-frame.html
79                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-simple-ws.html
80                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-xhr-in-main-frame.html
81                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-http-to-https-script-in-iframe.html
82                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-https-to-http-script-in-iframe.html
83                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrades-mixed-content.html
84                http/tests/ssl/iframe-upgrade.https.html
85                http/tests/ssl/upgrade-origin-usage.html
86                http/tests/websocket/tests/hybi/upgrade-simple-ws.html
87
88         * Modules/websockets/WebSocket.cpp:
89         (WebCore::WebSocket::connect): Upgrade insecure requests if the CSP
90         indicates we should.
91         * dom/Document.cpp:
92         (WebCore::Document::initSecurityContext): Populate new document CSP with sets of upgrade host and port combinations.
93         * dom/ScriptElement.cpp:
94         (WebCore::ScriptElement::requestScript): Upgrade insecure requests if
95         the CSP indicates we should.
96         * html/HTMLMediaElement.cpp:
97         (WebCore::HTMLMediaElement::loadResource): Ditto.
98         * loader/DocumentWriter.cpp:
99         (WebCore::DocumentWriter::begin): Ditto.
100         * loader/FormSubmission.cpp:
101         (WebCore::FormSubmission::create): Ditto.
102         (WebCore::FormSubmission::populateFrameLoadRequest): Add "Upgrade-Insecure-Requests"
103         header to frame load requests.
104         * loader/FrameLoader.cpp:
105         (WebCore::FrameLoader::addExtraFieldsToMainResourceRequest): Add the
106         'Update-Insecure-Requests' header field if necessary.
107         (WebCore::FrameLoader::addHTTPUpgradeInsecureRequestsIfNeeded): Added helper function.
108         (WebCore::FrameLoader::loadPostRequest): Upgrade insecure requests if the CSP
109         indicates we should.
110         (WebCore::FrameLoader::loadResourceSynchronously): Ditto.
111         (WebCore::FrameLoader::loadDifferentDocumentItem): If loading a form, add the
112         'Update-Insecure-Requests' header field if necessary.
113         (WebCore::createWindow): Upgrade insecure requests if the CSP
114         indicates we should.
115         * loader/FrameLoader.h:
116         * loader/PingLoader.cpp:
117         (WebCore::PingLoader::loadImage): Upgrade insecure requests if the CSP
118         indicates we should.
119         (WebCore::PingLoader::sendPing): Ditto.
120         (WebCore::PingLoader::sendViolationReport): Ditto.
121         * loader/ResourceLoader.cpp:
122         (WebCore::ResourceLoader::willSendRequestInternal): Ditto.
123         * loader/SubframeLoader.cpp:
124         (WebCore::SubframeLoader::requestFrame): Ditto.
125         (WebCore::SubframeLoader::requestObject): Ditto.
126         * loader/appcache/ApplicationCacheHost.cpp:
127         (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache): Ditto.
128         * loader/cache/CachedResourceLoader.cpp:
129         (WebCore::CachedResourceLoader::requestImage): Ditto.
130         (WebCore::CachedResourceLoader::requestResource): Ditto.
131         * page/DOMWindow.cpp:
132         (WebCore::DOMWindow::createWindow): Add the 'Update-Insecure-Requests' header
133         field if necessary.
134         * page/csp/ContentSecurityPolicy.cpp:
135         (WebCore::ContentSecurityPolicy::copyStateFrom): Populate upgraded resource set
136         from other context.
137         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): Added helper function
138         to upgrade requests when the upgrade-insecure-requests CSP policy is present, or if
139         the host and port combination have previously been upgraded.
140         (WebCore::ContentSecurityPolicy::upgradeInsecureNavigationRequestIfNeeded): Added
141         helper function to upgrade requests that have been previously upgraded. Cross-site
142         navigations only get upgraded when they have been previously upgraded.
143         (WebCore::ContentSecurityPolicy::addInsecureNavigationRequestsToUpgrade): Added.
144         (WebCore::ContentSecurityPolicy::populateInsecureNavigationRequestsToUpgradeFromOther): Added.
145         * page/csp/ContentSecurityPolicy.h:
146         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests): Added.
147         (WebCore::ContentSecurityPolicy::upgradeInsecureRequests): Added.
148         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
149         (WebCore::ContentSecurityPolicyDirectiveList::ContentSecurityPolicyDirectiveList): Use
150         more C++11 initializations.
151         (WebCore::ContentSecurityPolicyDirectiveList::setUpgradeInsecureRequests): Added.
152         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Teach this function to
153         recognize the new directive.
154         * page/csp/ContentSecurityPolicyDirectiveList.h:
155         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
156         * page/csp/ContentSecurityPolicyDirectiveNames.h:
157         * platform/network/HTTPHeaderNames.in: Add new 'Upgrade-Insecure-Requests' header field.
158         * xml/XMLHttpRequest.cpp:
159         (WebCore::XMLHttpRequest::open): Upgrade insecure requests if the CSP if needed.
160
161 2016-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
162
163         Bopomofo ruby in Dictionary.app is written horizontally (when it should be written vertically)
164         https://bugs.webkit.org/show_bug.cgi?id=158245
165         <rdar://problem/25675318>
166
167         Reviewed by Darin Adler.
168
169         With orthogonal flows, the inner element gets a logical width that is computed from two values:
170         - The containing block's available logical height
171         - The FrameView's visibleHeight
172
173         In Dictionary.app, the FrameView's height changes, but this element doesn't get relaid out.
174         This is because of our optimization where normal-flow elements don't get relaid out if their
175         parent's width doesn't change (which is the case here).
176
177         Therefore, this orthogonal writing mode element should be relaid out when the FrameView changes
178         size. Luckily, we already have machinery for doing this: percentage heights. In quirks mode, a
179         div with a percentage height may walk arbitrarily far up the DOM tree in order to determine which
180         element the percentage should be resolved against. Therefore, we have a map of percentage-sizing-
181         ancestors to percentage-sizing-descendants which speeds up this search. If a percentage-sizing-
182         ancestor gets relaid out, all the relevant percentage-sizing-descendants get relaid out too.
183
184         Therefore, we can simply mark the FrameView as a percentage-sizing-ancestor and the orthogonal
185         flow element as a percentage-sizing-descendant. The lifetime of this relationship is already
186         managed correctly - it gets reset when style changes and when the renderer is destroyed, and
187         is created during layout.
188
189         Unfortunately, this same treatment should also be done to the element which dictates the
190         containing block's logical height (which caused https://bugs.webkit.org/show_bug.cgi?id=158286).
191         Implementing this would require giving RenderBox::availableLogicalHeight() a second result
192         of the necessary element which dictates the return. In an effort to keep this patch small and
193         focused, I'll do this secondary (much larger) work in a patch on that bug. This patch,
194         therefore, is kept small and focused.
195
196         Test: fast/text/orthogonal-writing-mode-containing-block-frameView-resize-relayout.html
197
198         * rendering/RenderBox.cpp:
199         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
200
201 2016-06-03  Myles C. Maxfield  <mmaxfield@apple.com>
202
203         Text not visible while external font downloading
204         https://bugs.webkit.org/show_bug.cgi?id=25207
205         <rdar://problem/15167413>
206
207         Reviewed by Dean Jackson.
208
209         I already laid the groundwork for this when implementing the CSS Font Loading API.
210         We only have to create a timer and correctly respond to it timing out (by setting
211         state).
212
213         This patch also adds a new internal setting which puts us in a mode where font
214         loads never complete and the timeout occurs immediately. This is so we can test
215         the fallback behavior.
216
217         Test: fast/text/web-font-load-fallback-during-loading.html
218
219         * css/CSSFontFace.cpp:
220         (WebCore::CSSFontFace::CSSFontFace):
221         (WebCore::CSSFontFace::fontLoadEventOccurred):
222         (WebCore::CSSFontFace::timeoutFired):
223         (WebCore::CSSFontFace::setStatus):
224         (WebCore::CSSFontFace::fontLoaded):
225         (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
226         (WebCore::CSSFontFace::pump):
227         (WebCore::CSSFontFace::font):
228         * css/CSSFontFace.h:
229         * css/CSSFontFaceSource.cpp:
230         (WebCore::CSSFontFaceSource::fontLoaded):
231         * css/FontFace.cpp:
232         (WebCore::FontFace::fontStateChanged):
233         * page/Settings.cpp:
234         (WebCore::Settings::Settings):
235         (WebCore::Settings::setWebFontsAlwaysFallBack):
236         * page/Settings.h:
237         (WebCore::Settings::webFontsAlwaysFallBack):
238         * testing/InternalSettings.cpp:
239         (WebCore::InternalSettings::Backup::Backup):
240         (WebCore::InternalSettings::Backup::restoreTo):
241         (WebCore::InternalSettings::setWebFontsAlwaysFallBack):
242         * testing/InternalSettings.h:
243         * testing/InternalSettings.idl:
244
245 2016-06-03  Chris Dumez  <cdumez@apple.com>
246
247         Modernize a few more lambda captures
248         https://bugs.webkit.org/show_bug.cgi?id=158370
249
250         Reviewed by Brady Eidson.
251
252         * workers/DedicatedWorkerGlobalScope.cpp:
253         (WebCore::DedicatedWorkerGlobalScope::postMessage):
254         * workers/DedicatedWorkerGlobalScope.h:
255         * workers/Worker.cpp:
256         (WebCore::Worker::postMessage):
257         * workers/Worker.h:
258         * workers/WorkerEventQueue.cpp:
259         (WebCore::WorkerEventQueue::enqueueEvent):
260         * workers/WorkerGlobalScopeProxy.h:
261         * workers/WorkerMessagingProxy.cpp:
262         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
263         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
264         * workers/WorkerMessagingProxy.h:
265         * workers/WorkerObjectProxy.h:
266
267 2016-06-03  Commit Queue  <commit-queue@webkit.org>
268
269         Unreviewed, rolling out r201663.
270         https://bugs.webkit.org/show_bug.cgi?id=158374
271
272         Broke the Windows build (Requested by andersca on #webkit).
273
274         Reverted changeset:
275
276         "Rename NoncopyableFunction to Function"
277         https://bugs.webkit.org/show_bug.cgi?id=158354
278         http://trac.webkit.org/changeset/201663
279
280 2016-06-03  Ryosuke Niwa  <rniwa@webkit.org>
281
282         Crash under VisibleSelection::firstRange()
283         https://bugs.webkit.org/show_bug.cgi?id=158241
284
285         Reviewed by Enrica Casucci.
286
287         The crash was commonly caused by parentAnchoredEquivalent returning null when the anchored node was a shadow root.
288         Fixed it by returning a shadow root in parentAnchoredEquivalent.
289
290         Also guard against other kinds of crashes by adding a null check in VisibleSelection::firstRange() since we've seen
291         a crash in the same code path outside of a shadow tree.
292
293         This patch also fixes other Position methods to stop using nonShadowBoundaryParentNode in place of parentNode as
294         that would cause a similar crash and/or a bug elsewhere.
295
296         Test: fast/shadow-dom/selection-at-shadow-root-crash.html
297
298         * accessibility/AXObjectCache.cpp:
299         (AXObjectCache::startCharacterOffsetOfParagraph): Fixed a bug uncovered by the assertion fix in Position::Position.
300         This code was sometimes creating a position inside a BR, which is wrong.
301         (AXObjectCache::endCharacterOffsetOfParagraph): Ditto.
302         * dom/Position.cpp:
303         (WebCore::Position::Position): Fixed an assertion which was checking that this constructor wasn't being called
304         with m_anchorNode set to an element editing ignores content of. ||ing it with isShadowRoot() made this assertion
305         useless because it's true whenever m_anchorNode is not a shadow root.
306         (WebCore::Position::containerNode): Use parentNode() instead of findParent() which calls nonShadowBoundaryParentNode
307         since Position should
308         (WebCore::Position::parentAnchoredEquivalent): Fixed the bug by letting this function return a shadow root.
309         (WebCore::Position::previous): Use parentNode() instead of findParent().
310         (WebCore::Position::next): Ditto.
311         (WebCore::Position::atStartOfTree): Ditto.
312         (WebCore::Position::atEndOfTree): Ditto.
313         (WebCore::Position::findParent): Deleted.
314         * dom/Position.h:
315         * editing/VisibleSelection.cpp:
316         (VisibleSelection::firstRange): Added a null check. 
317
318 2016-06-03  Zalan Bujtas  <zalan@apple.com>
319
320         Incorrect rendering on boostmobile FAQ page
321         https://bugs.webkit.org/show_bug.cgi?id=158303
322         <rdar://problem/26603462>
323
324         Reviewed by Chris Dumez.
325
326         Initial value for background-color is 'transparent'. see https://drafts.csswg.org/css-backgrounds-3/#background-color
327
328         Test: fast/selectors/non-visited-link-backround-color.html
329
330         * css/CSSPropertyNames.in:
331
332 2016-06-03  Brady Eidson  <beidson@apple.com>
333
334         More miscellaneous IDBBindingUtilities cleanup.
335         https://bugs.webkit.org/show_bug.cgi?id=158359
336
337         Reviewed by Tim Horton.
338
339         No new tests (Straight refactor, yo).
340
341         Replace more ScriptExecutionContext&s with ExecState&s.
342         Combine more unnecessarily separate functions.
343         Remove some cruft.
344         
345         * Modules/indexeddb/IDBCursor.cpp:
346         (WebCore::IDBCursor::setGetResult):
347         
348         * Modules/indexeddb/IDBRequest.cpp:
349         (WebCore::IDBRequest::setResult):
350         (WebCore::IDBRequest::setResultToStructuredClone):
351         
352         * Modules/indexeddb/server/MemoryObjectStore.cpp:
353         (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
354         (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
355         
356         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
357         (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord):
358         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
359         
360         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
361         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
362         
363         * bindings/js/IDBBindingUtilities.cpp:
364         (WebCore::deserializeIDBValueToJSValue):
365         (WebCore::idbKeyDataToScriptValue):
366         (WebCore::deserializeIDBValueDataToJSValue): Deleted.
367         * bindings/js/IDBBindingUtilities.h:
368
369 2016-06-03  Chris Dumez  <cdumez@apple.com>
370
371         CanvasRenderingContext2D.createPattern() / putImageData() throw wrong exception type
372         https://bugs.webkit.org/show_bug.cgi?id=158322
373
374         Reviewed by Ryosuke Niwa.
375
376         CanvasRenderingContext2D.createPattern() / putImageData() were throwing the wrong
377         exception type when the first parameter was null. It should throw a TypeError
378         but it was throwing a legacy TYPE_MISMATCH_ERR:
379         - http://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d
380         - http://www.w3.org/TR/2dcontext/#canvasimagesource
381
382         This patch aligns our behavior with the specification.
383
384         No new tests, covered by existing tests.
385
386         * html/canvas/CanvasRenderingContext2D.cpp:
387         (WebCore::CanvasRenderingContext2D::createPattern):
388         (WebCore::CanvasRenderingContext2D::putImageData):
389         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD):
390         (WebCore::CanvasRenderingContext2D::didDraw): Deleted.
391         (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded): Deleted.
392         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Deleted.
393         (WebCore::CanvasRenderingContext2D::font): Deleted.
394         * html/canvas/CanvasRenderingContext2D.h:
395         * html/canvas/CanvasRenderingContext2D.idl:
396
397 2016-06-03  Anders Carlsson  <andersca@apple.com>
398
399         Rename NoncopyableFunction to Function
400         https://bugs.webkit.org/show_bug.cgi?id=158354
401
402         Reviewed by Chris Dumez.
403
404         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
405         (WebCore::MediaEndpointPeerConnection::runTask):
406         * Modules/mediastream/MediaEndpointPeerConnection.h:
407         * Modules/webaudio/AudioDestinationNode.h:
408         (WebCore::AudioDestinationNode::resume):
409         (WebCore::AudioDestinationNode::suspend):
410         (WebCore::AudioDestinationNode::close):
411         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
412         (WebCore::DefaultAudioDestinationNode::resume):
413         (WebCore::DefaultAudioDestinationNode::suspend):
414         (WebCore::DefaultAudioDestinationNode::close):
415         * Modules/webaudio/DefaultAudioDestinationNode.h:
416         * dom/ActiveDOMCallbackMicrotask.cpp:
417         (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
418         * dom/ActiveDOMCallbackMicrotask.h:
419         * dom/ScriptExecutionContext.h:
420         (WebCore::ScriptExecutionContext::Task::Task):
421         * fileapi/AsyncFileStream.cpp:
422         (WebCore::callOnFileThread):
423         (WebCore::AsyncFileStream::perform):
424         * fileapi/AsyncFileStream.h:
425         * page/FrameView.cpp:
426         (WebCore::FrameView::queuePostLayoutCallback):
427         (WebCore::FrameView::flushPostLayoutTasksQueue):
428         * page/FrameView.h:
429         * page/scrolling/ScrollingThread.cpp:
430         (WebCore::ScrollingThread::dispatch):
431         (WebCore::ScrollingThread::dispatchBarrier):
432         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
433         * page/scrolling/ScrollingThread.h:
434         * platform/GenericTaskQueue.cpp:
435         (WebCore::TaskDispatcher<Timer>::postTask):
436         * platform/GenericTaskQueue.h:
437         (WebCore::TaskDispatcher::postTask):
438         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
439         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
440         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
441         * platform/mediastream/MediaStreamPrivate.cpp:
442         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
443         * platform/mediastream/MediaStreamPrivate.h:
444         * platform/mediastream/mac/AVMediaCaptureSource.h:
445         * platform/mediastream/mac/AVMediaCaptureSource.mm:
446         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
447         * style/StyleTreeResolver.cpp:
448         (WebCore::Style::postResolutionCallbackQueue):
449         (WebCore::Style::queuePostResolutionCallback):
450         * style/StyleTreeResolver.h:
451
452 2016-06-03  Ada Chan  <adachan@apple.com>
453
454         REGRESSION(r201474): Subtitles are not resizing in other fullscreen modes
455         https://bugs.webkit.org/show_bug.cgi?id=158355
456
457         Reviewed by Eric Carlson.
458
459         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
460         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
461         Set the text track representation layer's frame based on the active video layer.
462
463 2016-06-03  Brady Eidson  <beidson@apple.com>
464
465         Miscellaneous IDBBindingUtilities cleanup.
466         https://bugs.webkit.org/show_bug.cgi?id=158353
467
468         Reviewed by Tim Horton.
469
470         No new tests (Straight refactor, yo).
471
472         Starting with removing a single form of scriptValueToIDBKey(), and making the return value be
473         Ref<IDBKey> instead of RefPtr<IDBKey>, update a whole bunch of code to understand that the ExecState
474         is non-null and the resulting key is non-null.
475         
476         * Modules/indexeddb/IDBCursor.cpp:
477         (WebCore::IDBCursor::continueFunction):
478         
479         * Modules/indexeddb/IDBFactory.cpp:
480         (WebCore::IDBFactory::cmp):
481         
482         * Modules/indexeddb/IDBIndex.cpp:
483         (WebCore::IDBIndex::count):
484         (WebCore::IDBIndex::get):
485         (WebCore::IDBIndex::getKey):
486         
487         * Modules/indexeddb/IDBKey.cpp:
488         (WebCore::IDBKey::compare):
489         (WebCore::IDBKey::isLessThan):
490         (WebCore::IDBKey::isEqual):
491         * Modules/indexeddb/IDBKey.h:
492         (WebCore::IDBKey::createMultiEntryArray):
493         
494         * Modules/indexeddb/IDBKeyRange.cpp:
495         (WebCore::IDBKeyRange::only):
496         (WebCore::IDBKeyRange::lowerBound):
497         (WebCore::IDBKeyRange::upperBound):
498         (WebCore::IDBKeyRange::bound):
499         (WebCore::IDBKeyRange::isOnlyKey):
500         
501         * Modules/indexeddb/IDBObjectStore.cpp:
502         (WebCore::IDBObjectStore::get):
503         (WebCore::IDBObjectStore::modernDelete):
504         (WebCore::IDBObjectStore::count):
505         
506         * bindings/js/IDBBindingUtilities.cpp:
507         (WebCore::get):
508         (WebCore::set):
509         (WebCore::createIDBKeyFromValue):
510         (WebCore::getNthValueOnKeyPath):
511         (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
512         (WebCore::ensureNthValueOnKeyPath):
513         (WebCore::canInjectNthValueOnKeyPath):
514         (WebCore::injectIDBKeyIntoScriptValue):
515         (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
516         (WebCore::canInjectIDBKeyIntoScriptValue):
517         (WebCore::deserializeIDBValueToJSValue):
518         (WebCore::scriptValueToIDBKey):
519         (WebCore::createKeyPathArray):
520         * bindings/js/IDBBindingUtilities.h:
521
522 2016-06-03  Benjamin Poulain  <benjamin@webkit.org>
523
524         Rename CheckedRadioButtons into RadioButtonGroups
525         https://bugs.webkit.org/show_bug.cgi?id=158326
526
527         Reviewed by Alex Christensen.
528
529         CheckedRadioButtons handles the set of all the Radio Button Groups
530         for a particular form or document.
531         The name is wrong and apparently comes from former uses of this class
532         (see the comment above the class declaration).
533
534         This patch renames "CheckedRadioButtons" to "RadioButtonGroups" to reflect that it handles
535         all the Radio Button Group from a given context (form or document).
536         Internally it has a set of RadioButtonGroup but that is never explicitely
537         exposed.
538
539         * CMakeLists.txt:
540         * WebCore.xcodeproj/project.pbxproj:
541         * dom/CheckedRadioButtons.cpp:
542         (WebCore::RadioButtonGroup::isEmpty): Deleted.
543         (WebCore::RadioButtonGroup::isRequired): Deleted.
544         (WebCore::RadioButtonGroup::checkedButton): Deleted.
545         (WebCore::RadioButtonGroup::RadioButtonGroup): Deleted.
546         (WebCore::RadioButtonGroup::isValid): Deleted.
547         (WebCore::RadioButtonGroup::members): Deleted.
548         (WebCore::RadioButtonGroup::setCheckedButton): Deleted.
549         (WebCore::RadioButtonGroup::add): Deleted.
550         (WebCore::RadioButtonGroup::updateCheckedState): Deleted.
551         (WebCore::RadioButtonGroup::requiredAttributeChanged): Deleted.
552         (WebCore::RadioButtonGroup::remove): Deleted.
553         (WebCore::RadioButtonGroup::updateValidityForAllButtons): Deleted.
554         (WebCore::RadioButtonGroup::contains): Deleted.
555         (WebCore::CheckedRadioButtons::CheckedRadioButtons): Deleted.
556         (WebCore::CheckedRadioButtons::~CheckedRadioButtons): Deleted.
557         (WebCore::CheckedRadioButtons::addButton): Deleted.
558         (WebCore::CheckedRadioButtons::groupMembers): Deleted.
559         (WebCore::CheckedRadioButtons::updateCheckedState): Deleted.
560         (WebCore::CheckedRadioButtons::requiredAttributeChanged): Deleted.
561         (WebCore::CheckedRadioButtons::checkedButtonForGroup): Deleted.
562         (WebCore::CheckedRadioButtons::isInRequiredGroup): Deleted.
563         (WebCore::CheckedRadioButtons::removeButton): Deleted.
564         * dom/RadioButtonGroups.cpp: Renamed from Source/WebCore/dom/CheckedRadioButtons.cpp.
565         (WebCore::RadioButtonGroup::isEmpty):
566         (WebCore::RadioButtonGroup::isRequired):
567         (WebCore::RadioButtonGroup::checkedButton):
568         (WebCore::RadioButtonGroup::RadioButtonGroup):
569         (WebCore::RadioButtonGroup::isValid):
570         (WebCore::RadioButtonGroup::members):
571         (WebCore::RadioButtonGroup::setCheckedButton):
572         (WebCore::RadioButtonGroup::add):
573         (WebCore::RadioButtonGroup::updateCheckedState):
574         (WebCore::RadioButtonGroup::requiredAttributeChanged):
575         (WebCore::RadioButtonGroup::remove):
576         (WebCore::RadioButtonGroup::updateValidityForAllButtons):
577         (WebCore::RadioButtonGroup::contains):
578         (WebCore::RadioButtonGroups::RadioButtonGroups):
579         (WebCore::RadioButtonGroups::~RadioButtonGroups):
580         (WebCore::RadioButtonGroups::addButton):
581         (WebCore::RadioButtonGroups::groupMembers):
582         (WebCore::RadioButtonGroups::updateCheckedState):
583         (WebCore::RadioButtonGroups::requiredAttributeChanged):
584         (WebCore::RadioButtonGroups::checkedButtonForGroup):
585         (WebCore::RadioButtonGroups::isInRequiredGroup):
586         (WebCore::RadioButtonGroups::removeButton):
587         * dom/RadioButtonGroups.h: Renamed from Source/WebCore/dom/CheckedRadioButtons.h.
588         * html/FormController.h:
589         (WebCore::FormController::radioButtonGroups):
590         (WebCore::FormController::checkedRadioButtons): Deleted.
591         * html/HTMLFormElement.h:
592         * html/HTMLInputElement.cpp:
593         (WebCore::HTMLInputElement::~HTMLInputElement):
594         (WebCore::HTMLInputElement::setChecked):
595         (WebCore::HTMLInputElement::didMoveToNewDocument):
596         (WebCore::HTMLInputElement::requiredAttributeChanged):
597         (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup):
598         (WebCore::HTMLInputElement::radioButtonGroup):
599         (WebCore::HTMLInputElement::checkedRadioButtonForGroup):
600         (WebCore::HTMLInputElement::radioButtonGroups):
601         (WebCore::HTMLInputElement::addToRadioButtonGroup):
602         (WebCore::HTMLInputElement::removeFromRadioButtonGroup):
603         (WebCore::HTMLInputElement::checkedRadioButtons): Deleted.
604         * html/HTMLInputElement.h:
605
606 2016-06-03  Chris Dumez  <cdumez@apple.com>
607
608         Unreviewed, roll out r196633 as it broke PageCache on iOS for WebKit.org
609         <rdar://problem/26521101>
610
611         * dom/Document.cpp:
612         (WebCore::Document::setInPageCache): Deleted.
613         * history/CachedPage.cpp:
614         (WebCore::CachedPage::restore):
615         (WebCore::CachedPage::clear):
616         * history/CachedPage.h:
617         (WebCore::CachedPage::markForVisitedLinkStyleRecalc):
618         (WebCore::CachedPage::markForFullStyleRecalc):
619         * history/PageCache.cpp:
620         (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc):
621         (WebCore::PageCache::markPagesForFullStyleRecalc):
622         * history/PageCache.h:
623         * page/Frame.cpp:
624         (WebCore::Frame::setPageAndTextZoomFactors):
625         * page/Page.cpp:
626         (WebCore::Page::setViewScaleFactor):
627         (WebCore::Page::setDeviceScaleFactor):
628         (WebCore::Page::setPagination):
629         (WebCore::Page::setPaginationLineGridEnabled):
630         (WebCore::Page::setVisitedLinkStore):
631
632 2016-06-03  Antoine Quint  <graouts@apple.com>
633
634         Reflection of element does not respect backdrop-filter property
635         https://bugs.webkit.org/show_bug.cgi?id=158201
636
637         Reviewed by Dean Jackson.
638
639         We weren't cloning the PlatformCALayer for the backdrop so reflections would simply
640         not show their backdrops. We now follow the same pattern as other PlatformCALayers
641         owned by a GraphicsLayerCA and keep a list of backdrop layer clones that we add
642         to the structural layer when cloning to match the layer order of the original
643         and update the backdrop layer clone properties to match the original when the
644         backdrop filters or rectangle changes.
645
646         Tests: css3/filters/backdrop/backdrop-filter-with-reflection-add-backdrop.html
647                css3/filters/backdrop/backdrop-filter-with-reflection-remove-backdrop.html
648                css3/filters/backdrop/backdrop-filter-with-reflection-value-change.html
649                css3/filters/backdrop/backdrop-filter-with-reflection.html
650
651         * platform/graphics/ca/GraphicsLayerCA.cpp:
652         (WebCore::GraphicsLayerCA::updateBackdropFilters):
653         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
654         Update backdrop layer clones to match new values set when the backdrop filter
655         configuration changes.
656
657         (WebCore::GraphicsLayerCA::ensureCloneLayers):
658         Create the backdrop layer clones map if needed and clone the existing backdrop layer.
659
660         (WebCore::GraphicsLayerCA::clearClones):
661         Clear the backdrop layer clones map.
662
663         (WebCore::GraphicsLayerCA::fetchCloneLayers):
664         Obtain a clone for the backdrop layer, and if we have a valid clone, add it to the
665         structural layer clone as its first child to match the operation in updateSublayerList().
666
667         * platform/graphics/ca/GraphicsLayerCA.h:
668         Modify the signature for ensureCloneLayers() to account for the new backdrop layer clone and
669         declare the backdrop layer clone map.
670
671         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
672         (PlatformCALayerCocoa::clone):
673         Reflect the backdrop layer type when cloning a PlatformCALayer.
674
675 2016-06-03  Brady Eidson  <beidson@apple.com>
676
677         ResourceResponseBase cleanup.
678         https://bugs.webkit.org/show_bug.cgi?id=158348
679
680         Reviewed by Chris Dumez.
681
682         No new tests (Refactor, no behavior change).
683
684         CrossThreadData can be noncopyable and WTFMove()'ed around, instead of 
685         being in a unique_ptr.
686         
687         * platform/network/ResourceResponseBase.cpp:
688         (WebCore::ResourceResponseBase::crossThreadData):
689         (WebCore::ResourceResponseBase::fromCrossThreadData):
690         * platform/network/ResourceResponseBase.h:
691
692 2016-06-03  Antoine Quint  <graouts@apple.com>
693
694         REGRESSION: WebGL doesn't show up in CSS reflections
695         https://bugs.webkit.org/show_bug.cgi?id=76489
696
697         Reviewed by Dean Jackson.
698
699         The WebGLLayer needs to notify its owning GraphicsLayer that it was displayed
700         such that its clones, in GraphicsLayerCA::layerDidDisplay, may have their contents
701         updated to match that layer's contents. The test at compositing/webgl/webgl-reflection.html
702         already covers this test and its expectation on Mac has been updated.
703
704         * platform/graphics/mac/WebGLLayer.mm:
705         (-[WebGLLayer display]):
706
707 2016-06-02  Gavin Barraclough  <barraclough@apple.com>
708
709         Refactor showModalDialog handling in JSDOMWindowCustom
710         https://bugs.webkit.org/show_bug.cgi?id=158294
711
712         Reviewed by Ryosuke Niwa.
713
714         The showModalDialog property is currently implemented in a way that  effectively
715         results in duplication of the tail of the function, but modified to call
716         Base::getOwnPropertySlot instead of getStaticPropertySlot. It does so based on the
717         assumption that Base::getOwnPropertySlot is not going to search the static tables
718         (containing the property we wish to omit).
719
720         However as a part of bug #158178 I plan to change it such that Base::getOwnPropertySlot
721         does also search the static tables. So, refactoring this code to no longer depend on
722         using a function that bypasses the static tables. Always perform a lookup that will
723         check both property storage & static tables. If the object does contain the property,
724         then check explicitly for the value we're intending to suppress.
725
726         Covered by exsiting tests.
727
728         * bindings/js/JSDOMWindowCustom.cpp:
729         (WebCore::JSDOMWindow::getOwnPropertySlot):
730             - Check result of getStaticPropertySlot for showModalDialog function.
731
732 2016-06-02  Brady Eidson  <beidson@apple.com>
733
734         Fix AtomicString regression caused by r201603.
735         https://bugs.webkit.org/show_bug.cgi?id=158338
736
737         Reviewed by Chris Dumez.
738
739         No new tests (Refactor, plus already caught by existing test configs).
740
741         * loader/WorkerThreadableLoader.cpp:
742         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
743         
744         * platform/network/ResourceResponseBase.cpp:
745         (WebCore::ResourceResponseBase::crossThreadData): Re-introduce the cross thread data concept,
746           but more modern and clean this time.
747         (WebCore::ResourceResponseBase::fromCrossThreadData):
748         (WebCore::ResourceResponseBase::isolatedCopy): Deleted.
749         * platform/network/ResourceResponseBase.h:
750
751 2016-06-02  Chris Dumez  <cdumez@apple.com>
752
753         Drop BlobRegistryContext class as it is no longer needed
754         https://bugs.webkit.org/show_bug.cgi?id=158328
755
756         Reviewed by Brady Eidson.
757
758         Drop BlobRegistryContext class as it is no longer needed. We can now
759         call isolatedCopy() as we capture in the lambda.
760
761         * fileapi/ThreadableBlobRegistry.cpp:
762         (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
763         (WebCore::ThreadableBlobRegistry::registerBlobURL):
764         (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
765         (WebCore::ThreadableBlobRegistry::blobSize):
766         (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
767         (WebCore::BlobRegistryContext::BlobRegistryContext): Deleted.
768
769 2016-06-02  Zalan Bujtas  <zalan@apple.com>
770
771         Repaint issue with vertical text in an out of flow container.
772         https://bugs.webkit.org/show_bug.cgi?id=102665
773         <rdar://problem/26605298>
774
775         Reviewed by David Hyatt.
776
777         Since the renderer’s offset for positioned objects is always physical, we only
778         need to flip the repaint rect(always logical) for writing root, when we see the first positioned object.
779         All subsequent writing root changes for positioned objects are okay and they don't need flipping.
780
781         Test: fast/repaint/vertical-text-repaint.html
782
783         * rendering/RenderBox.cpp:
784         (WebCore::RenderBox::computeRectForRepaint):
785         * rendering/RenderBox.h:
786         (WebCore::RenderBox::computeRectForRepaint):
787         * rendering/RenderInline.cpp:
788         (WebCore::RenderInline::computeRectForRepaint):
789         * rendering/RenderInline.h:
790         (WebCore::RenderInline::computeRectForRepaint):
791         * rendering/RenderObject.cpp:
792         (WebCore::RenderObject::computeRectForRepaint):
793         * rendering/RenderObject.h:
794         (WebCore::RenderObject::computeAbsoluteRepaintRect):
795         (WebCore::RenderObject::computeRectForRepaint):
796         * rendering/RenderTableCell.cpp:
797         (WebCore::RenderTableCell::computeRectForRepaint):
798         * rendering/RenderTableCell.h:
799         * rendering/RenderView.cpp:
800         (WebCore::RenderView::computeRectForRepaint):
801         * rendering/RenderView.h:
802         * rendering/svg/RenderSVGForeignObject.cpp:
803         (WebCore::RenderSVGForeignObject::computeRectForRepaint):
804         * rendering/svg/RenderSVGForeignObject.h:
805         * rendering/svg/RenderSVGRoot.cpp:
806         (WebCore::RenderSVGRoot::computeFloatRectForRepaint):
807         * rendering/svg/RenderSVGText.cpp:
808         (WebCore::RenderSVGText::computeRectForRepaint):
809         * rendering/svg/RenderSVGText.h:
810
811 2016-06-02  Anders Carlsson  <andersca@apple.com>
812
813         Fix build
814         https://bugs.webkit.org/show_bug.cgi?id=158337
815         rdar://problem/26429419
816
817         Reviewed by Dan Bernstein.
818
819         * WebCore.xcodeproj/project.pbxproj:
820         Add QTKitSPI.h header.
821
822         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
823         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
824         * platform/graphics/mac/MediaTimeQTKit.h:
825         * platform/graphics/mac/MediaTimeQTKit.mm:
826         * platform/mac/WebVideoFullscreenController.mm:
827         Include QTKitSPI.h.
828
829         * platform/spi/cocoa/QuartzCoreSPI.h:
830         * platform/spi/mac/AVFoundationSPI.h:
831         Use MAX_ALLOWED instead of MIN_REQUIRED.
832
833         * platform/spi/mac/QTKitSPI.h:
834         Add new QTKit header.
835
836 2016-06-02  Said Abou-Hallawa  <sabouhallawa@apple,com>
837
838         [iOS] PDFDocumentImage should not create a cached image larger than 4M pixels
839         https://bugs.webkit.org/show_bug.cgi?id=157857
840
841         Reviewed by Darin Adler.
842
843         On iOS, if the scaled size of the PDFDocumentImage cached image will exceed
844         the 4M pixels limit and the system physical memory is 1GB or less, do not
845         create it. PDFDocumentImage::draw() falls back peacefully if the cached image
846         couldn't be created for any reason. The PDF will be drawn directly to the
847         GraphicsContext without having to go through the cached image. This means
848         the whole PDF will be drawn multiple times; one time for each tile. I think
849         this is okay for zooming a large PDFDocumentImage on a low end device.
850         
851         * html/canvas/CanvasRenderingContext2D.cpp:
852         (WebCore::CanvasRenderingContext2D::drawTextInternal): Call the static function
853         ImageBuffer::createCompatibleBuffer() without having to go through the GraphicsContext.
854         
855         * platform/graphics/BitmapImage.cpp:
856         (WebCore::BitmapImage::drawPattern): Ditto.
857         
858         * platform/graphics/FloatSize.h:
859         (WebCore::FloatSize::area): A helper function similar to IntSize::area().
860         (WebCore::operator*): Scale a FloatSize by another FloatSize and return the result.
861         
862         * platform/graphics/GradientImage.cpp:
863         (WebCore::GradientImage::drawPattern): Call ImageBuffer::createCompatibleBuffer().
864         
865         * platform/graphics/GraphicsContext.cpp:
866         (WebCore::GraphicsContext::scaleFactor):: Return the scaling part of the current CTM.
867         (WebCore::scalesMatch): Deleted.
868         (WebCore::GraphicsContext::createCompatibleBuffer): Deleted.
869         (WebCore::GraphicsContext::isCompatibleWithBuffer): Deleted.
870         * platform/graphics/GraphicsContext.h:
871         Move these image buffer functions to ImageBuffer.
872         
873         * platform/graphics/ImageBuffer.cpp:
874         (WebCore::ImageBuffer::createCompatibleBuffer): Make createCompatibleBuffer
875         a static function of the ImageBuffer. There is no need to go through the
876         GraphicsContext just to get the GraphicsContext scaleFactor.
877         
878         (WebCore::ImageBuffer::compatibleBufferSize):  Scale the size of the cachedImage
879         by the scaleFactor of the context.
880         
881         (WebCore::ImageBuffer::isCompatibleWithContext): Returns true if the drawing
882         context and the ImageBuffer context have the same scaleFactor.
883         
884         * platform/graphics/ImageBuffer.h:
885         
886         * platform/graphics/NamedImageGeneratedImage.cpp:
887         (WebCore::NamedImageGeneratedImage::drawPattern): Call ImageBuffer::createCompatibleBuffer().
888         
889         * platform/graphics/cg/PDFDocumentImage.cpp:
890         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): On iOS, if the
891         physical memory is less than 1GB, do not allocate more than 16MB for the
892         PDF cachedImage.
893         
894         * rendering/RenderBoxModelObject.cpp:
895         (WebCore::RenderBoxModelObject::paintFillLayerExtended): Call ImageBuffer::createCompatibleBuffer().
896         * rendering/svg/SVGRenderingContext.cpp:
897         (WebCore::SVGRenderingContext::bufferForeground): Ditto.
898
899 2016-06-02  Chris Dumez  <cdumez@apple.com>
900
901         [WebIDL] 'undefined' should be an acceptable value for nullable parameters
902         https://bugs.webkit.org/show_bug.cgi?id=158321
903
904         Reviewed by Ryosuke Niwa.
905
906         'undefined' should be an acceptable value for nullable parameters (and
907         should be converted to null):
908         - https://heycam.github.io/webidl/#es-nullable-type
909
910         Our bindings got most of the cases right but there was a bug in our
911         overload resolution code. This patch fixes it.
912
913         No new tests, already covered by existing tests.
914
915         * bindings/scripts/CodeGeneratorJS.pm:
916         (GenerateParametersCheckExpression):
917         * bindings/scripts/test/JS/JSTestObj.cpp:
918         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
919         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
920
921 2016-06-02  Brady Eidson  <beidson@apple.com>
922
923         Modernize how many platform/network classes do isolatedCopy().
924         https://bugs.webkit.org/show_bug.cgi?id=158313
925
926         Reviewed by Alex Christensen.
927
928         No new tests (Refactor, no behavior change).
929
930         * loader/WorkerThreadableLoader.h:
931         
932         * platform/network/FormData.cpp:
933         (WebCore::FormData::isolatedCopy):
934         (WebCore::FormDataElement::isolatedCopy):
935         (WebCore::FormData::FormData): Deleted.
936         (WebCore::FormData::deepCopy): Deleted.
937         * platform/network/FormData.h:
938         
939         * platform/network/HTTPHeaderMap.cpp:
940         (WebCore::HTTPHeaderMap::isolatedCopy):
941         (WebCore::HTTPHeaderMap::copyData): Deleted.
942         (WebCore::HTTPHeaderMap::adopt): Deleted.
943         * platform/network/HTTPHeaderMap.h:
944         
945         * platform/network/ResourceErrorBase.cpp:
946         (WebCore::ResourceErrorBase::asResourceError):
947         (WebCore::ResourceErrorBase::isolatedCopy):
948         * platform/network/ResourceErrorBase.h:
949         (WebCore::ResourceErrorBase::platformCopy): Deleted.
950
951         * platform/network/ResourceLoadTiming.h:
952         (WebCore::ResourceLoadTiming::isolatedCopy): Not strictly needed for now, but makes it obvious
953           that changes will be needed if new members are added later.
954
955         * platform/network/ResourceRequestBase.cpp:
956         (WebCore::ResourceRequestBase::isolatedCopy):
957         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
958         (WebCore::ResourceRequestBase::copyData): Deleted.
959         * platform/network/ResourceRequestBase.h:
960         
961         * platform/network/ResourceResponseBase.cpp:
962         (WebCore::ResourceResponseBase::isolatedCopy):
963         (WebCore::ResourceResponseBase::copyData): Deleted.
964         * platform/network/ResourceResponseBase.h:
965         (WebCore::CrossThreadResourceResponseDataBase::CrossThreadResourceResponseDataBase): Deleted.
966         
967         * platform/network/cf/ResourceError.h:
968         * platform/network/cf/ResourceErrorCF.cpp:
969         (WebCore::ResourceError::doPlatformIsolatedCopy):
970         (WebCore::ResourceError::platformCopy): Deleted.
971         
972         * platform/network/cf/ResourceRequest.h:
973         * platform/network/cf/ResourceRequestCFNet.cpp:
974         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
975         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
976         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
977         
978         * platform/network/cf/ResourceResponse.h:
979         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
980         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
981         
982         * platform/network/curl/ResourceError.h:
983         (WebCore::ResourceError::doPlatformIsolatedCopy):
984         
985         * platform/network/curl/ResourceRequest.h:
986         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
987         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
988         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
989         
990         * platform/network/curl/ResourceResponse.h:
991         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
992         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
993         
994         * platform/network/mac/ResourceErrorMac.mm:
995         (WebCore::ResourceError::doPlatformIsolatedCopy):
996         
997         * platform/network/soup/ResourceError.h:
998         * platform/network/soup/ResourceErrorSoup.cpp:
999         (WebCore::ResourceError::doPlatformIsolatedCopy):
1000         (WebCore::ResourceError::platformCopy): Deleted.
1001         
1002         * platform/network/soup/ResourceRequest.h:
1003         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
1004         (WebCore::ResourceRequest::doPlatformCopyData): Deleted.
1005         (WebCore::ResourceRequest::doPlatformAdopt): Deleted.
1006         
1007         * platform/network/soup/ResourceResponse.h:
1008         (WebCore::ResourceResponse::doPlatformCopyData): Deleted.
1009         (WebCore::ResourceResponse::doPlatformAdopt): Deleted.
1010
1011 2016-06-02  Chris Dumez  <cdumez@apple.com>
1012
1013         Crash under CachedResource::addClientToSet()
1014         https://bugs.webkit.org/show_bug.cgi?id=158310
1015         <rdar://problem/23643359>
1016
1017         Reviewed by Eric Carlson.
1018
1019         Only call CachedResource::addClient() on the resource returned
1020         by CachedResourceLoader::requestMedia() if the resource is
1021         non-null. CachedResourceLoader::requestMedia() can return null
1022         in some cases so we need to handle this properly.
1023
1024         No new tests, no known reproduction case.
1025
1026         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1027         (WebCore::WebCoreAVFResourceLoader::startLoading):
1028
1029 2016-06-02  Chris Dumez  <cdumez@apple.com>
1030
1031         ScriptExecutionContext::Task constructor should take a NoncopyableFunction<void ()> as parameter
1032         https://bugs.webkit.org/show_bug.cgi?id=158309
1033
1034         Reviewed by Brady Eidson.
1035
1036         ScriptExecutionContext::Task constructor should take a NoncopyableFunction<void ()>
1037         as parameter for consistency with the other constructor and because this can be
1038         called cross-thread.
1039
1040         * Modules/webaudio/AudioContext.cpp:
1041         (WebCore::AudioContext::suspend):
1042         (WebCore::AudioContext::resume):
1043         (WebCore::AudioContext::close):
1044         (WebCore::AudioContext::suspendPlayback):
1045         (WebCore::AudioContext::mayResumePlayback):
1046         * Modules/webaudio/AudioDestinationNode.h:
1047         (WebCore::AudioDestinationNode::resume):
1048         (WebCore::AudioDestinationNode::suspend):
1049         (WebCore::AudioDestinationNode::close):
1050         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1051         (WebCore::DefaultAudioDestinationNode::resume):
1052         (WebCore::DefaultAudioDestinationNode::suspend):
1053         (WebCore::DefaultAudioDestinationNode::close):
1054         * Modules/webaudio/DefaultAudioDestinationNode.h:
1055         * dom/ScriptExecutionContext.h:
1056         (WebCore::ScriptExecutionContext::Task::Task):
1057
1058 2016-06-02  Darin Adler  <darin@apple.com>
1059
1060         Fix a couple of mistakes in CSSParserValue memory management
1061         https://bugs.webkit.org/show_bug.cgi?id=158307
1062         <rdar://problem/26127225>
1063
1064         Reviewed by Daniel Bates.
1065
1066         * css/CSSGrammar.y.in: Added a destructor for calc_func_term. This presumably
1067         fixes some memory leaks in error cases. Removed an assertion about not needing
1068         a call to destroy that was far too limited. Tweaked formatting of the percentage
1069         ase in the key production. Indented calc_func_term to make it consistent with
1070         other productions nearby.
1071
1072         * css/CSSParserValues.cpp:
1073         (WebCore::CSSParserValueList::~CSSParserValueList): Use a modern for loop.
1074         (WebCore::CSSParserValueList::deleteValueAt): Deleted. Unused function, and also
1075         would have resulted in a memory leak unless the code already extracted the value
1076         from the list.
1077         (WebCore::CSSParserValueList::extend): Properly transfer ownership from one value
1078         list to the other by setting the unit to 0 in the donor.
1079
1080         * css/CSSParserValues.h: Removed unused deleteValueAt function.
1081
1082 2016-06-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
1083
1084         SVG content renders in incorrect vertical position when padding-left is not specified
1085         https://bugs.webkit.org/show_bug.cgi?id=158234
1086
1087         Reviewed by Darin Adler.
1088
1089         Fix the optimization in RenderSVGRoot::buildLocalToBorderBoxTransform().
1090         Use LayoutSize::isZero() instead of LayoutSize::isEmpty() to decide whether
1091         there is borderAndPadding applied or not.
1092
1093         Test: svg/custom/svg-root-padding-individual.html
1094
1095         * rendering/svg/RenderSVGRoot.cpp:
1096         (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
1097
1098 2016-06-02  Brady Eidson  <beidson@apple.com>
1099
1100         Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.
1101         https://bugs.webkit.org/show_bug.cgi?id=158293
1102
1103         Reviewed by Darin Adler.
1104
1105         No new tests (Refactor, no behavior change).
1106
1107         * loader/WorkerThreadableLoader.cpp:
1108         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1109         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1110         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
1111         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
1112
1113         * loader/cache/MemoryCache.cpp:
1114         (WebCore::MemoryCache::removeRequestFromSessionCaches):
1115
1116         * platform/network/ResourceErrorBase.cpp:
1117         (WebCore::ResourceErrorBase::isolatedCopy):
1118         (WebCore::ResourceErrorBase::copy): Deleted.
1119         * platform/network/ResourceErrorBase.h:
1120
1121         * platform/network/ResourceRequestBase.cpp:
1122         (WebCore::ResourceRequestBase::isolatedCopy):
1123         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
1124         (WebCore::ResourceRequestBase::adopt): Deleted.
1125         
1126         Made copyData private, and made "adopt" be "isolatedCopy".
1127         Rest of the changes are all re-indenting the file.
1128         * platform/network/ResourceRequestBase.h:
1129         (WebCore::ResourceRequestBase::responseContentDispositionEncodingFallbackArray):
1130         (WebCore::ResourceRequestBase::reportUploadProgress):
1131         (WebCore::ResourceRequestBase::setReportUploadProgress):
1132         (WebCore::ResourceRequestBase::reportLoadTiming):
1133         (WebCore::ResourceRequestBase::setReportLoadTiming):
1134         (WebCore::ResourceRequestBase::reportRawHeaders):
1135         (WebCore::ResourceRequestBase::setReportRawHeaders):
1136         (WebCore::ResourceRequestBase::hiddenFromInspector):
1137         (WebCore::ResourceRequestBase::setHiddenFromInspector):
1138         (WebCore::ResourceRequestBase::requester):
1139         (WebCore::ResourceRequestBase::setRequester):
1140         (WebCore::ResourceRequestBase::encodingRequiresPlatformData):
1141         (WebCore::ResourceRequestBase::ResourceRequestBase):
1142         (WebCore::ResourceRequestBase::platformCompare):
1143         (WebCore::operator==):
1144         (WebCore::operator!=):
1145
1146         * platform/network/ResourceResponseBase.cpp:
1147         (WebCore::ResourceResponseBase::isolatedCopy):
1148         (WebCore::ResourceResponseBase::adopt): Deleted.
1149         * platform/network/ResourceResponseBase.h:
1150
1151         * platform/network/cf/ResourceError.h:
1152         (WebCore::ResourceError::isolatedCopy): Deleted.
1153
1154         Removed platform-specific isolatedCopy, and re-indented the header:
1155         * platform/network/cf/ResourceRequest.h:
1156         (WebCore::ResourceRequest::ResourceRequest):
1157         (WebCore::ResourceRequest::encodingRequiresPlatformData):
1158         (WebCore::ResourceRequest::cachePartition):
1159         (WebCore::ResourceRequest::setCachePartition):
1160         (WebCore::ResourceRequest::setDomainForCachePartition):
1161         (WebCore::ResourceRequest::resourcePrioritiesEnabled):
1162         (WebCore::ResourceRequest::isolatedCopy): Deleted.
1163
1164         * platform/network/cf/ResourceResponse.h:
1165         (WebCore::ResourceResponse::isolatedCopy): Deleted.
1166
1167 2016-06-02  Chris Dumez  <cdumez@apple.com>
1168
1169         Modernize various lambda captures
1170         https://bugs.webkit.org/show_bug.cgi?id=158292
1171
1172         Reviewed by Brady Eidson.
1173
1174         Modernize various lambda captures, especially the ones unnecessarily
1175         allocating objects on the heap and destroying them in the lambda.
1176
1177         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
1178         (WebCore::ThreadableWebSocketChannelClientWrapper::didConnect):
1179         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveMessage):
1180         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData):
1181         (WebCore::ThreadableWebSocketChannelClientWrapper::didUpdateBufferedAmount):
1182         (WebCore::ThreadableWebSocketChannelClientWrapper::didStartClosingHandshake):
1183         (WebCore::ThreadableWebSocketChannelClientWrapper::didClose):
1184         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveMessageError):
1185         (WebCore::ThreadableWebSocketChannelClientWrapper::processPendingTasks):
1186         (WebCore::ThreadableWebSocketChannelClientWrapper::resume): Deleted.
1187         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
1188         (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
1189         * bindings/js/JSCallbackData.h:
1190         (WebCore::DeleteCallbackDataTask::DeleteCallbackDataTask):
1191         * loader/WorkerThreadableLoader.cpp:
1192         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1193         (WebCore::WorkerThreadableLoader::MainThreadBridge::destroy):
1194         (WebCore::WorkerThreadableLoader::MainThreadBridge::didSendData):
1195         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1196         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData):
1197         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1198         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
1199         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
1200         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck):
1201         (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel): Deleted.
1202
1203 2016-06-02  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1204
1205         WebRTC: Update RTCPeerConnection.addTrack() to create (or reuse) an RTCRtpTransceiver
1206         https://bugs.webkit.org/show_bug.cgi?id=158191
1207
1208         Reviewed by Eric Carlson.
1209
1210         Update RTCPeerConnection.addTrack to create an RTCRtpTranscevier, or reuse an existing
1211         transceiver that has not been used to send [1].
1212
1213         A new RtpTransceiverSet type is added that wraps a vector of RTCRtpTransceiver objects
1214         and internally maintains two lists for efficient access to RTCRtpSender and RTCRtpReceiver
1215         objects.
1216
1217         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-addtrack
1218
1219         Updated existing test: fast/mediastream/RTCPeerConnection-add-removeTrack.html
1220
1221         * Modules/mediastream/PeerConnectionBackend.h:
1222         * Modules/mediastream/RTCPeerConnection.cpp:
1223         (WebCore::RTCPeerConnection::addTrack):
1224         (WebCore::RTCPeerConnection::removeTrack):
1225         (WebCore::RTCPeerConnection::completeAddTransceiver):
1226         (WebCore::RTCPeerConnection::close):
1227         * Modules/mediastream/RTCPeerConnection.h:
1228         * Modules/mediastream/RTCRtpTransceiver.cpp:
1229         (WebCore::RtpTransceiverSet::append):
1230         * Modules/mediastream/RTCRtpTransceiver.h:
1231         (WebCore::RtpTransceiverSet::list):
1232         (WebCore::RtpTransceiverSet::getSenders):
1233         (WebCore::RtpTransceiverSet::getReceivers):
1234
1235 2016-06-02  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1236
1237         Use more references in ResourceLoader related code
1238         https://bugs.webkit.org/show_bug.cgi?id=158222
1239
1240         Reviewed by Darin Adler.
1241
1242         No change of behavior.
1243
1244         * css/CSSFontFaceSource.cpp:
1245         (WebCore::CSSFontFaceSource::load):
1246         * css/CSSFontSelector.cpp:
1247         (WebCore::CSSFontSelector::clearDocument):
1248         (WebCore::CSSFontSelector::beginLoadingFontSoon):
1249         (WebCore::CSSFontSelector::beginLoadTimerFired):
1250         * css/CSSFontSelector.h:
1251         * loader/DocumentLoader.cpp:
1252         (WebCore::DocumentLoader::scheduleArchiveLoad):
1253         * loader/DocumentLoader.h:
1254         * loader/LoaderStrategy.h:
1255         * loader/NetscapePlugInStreamLoader.cpp:
1256         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
1257         (WebCore::NetscapePlugInStreamLoader::create):
1258         * loader/NetscapePlugInStreamLoader.h:
1259         * loader/ResourceLoader.cpp:
1260         (WebCore::ResourceLoader::ResourceLoader):
1261         (WebCore::ResourceLoader::start):
1262         * loader/ResourceLoader.h:
1263         * loader/SubresourceLoader.cpp:
1264         (WebCore::SubresourceLoader::RequestCountTracker::RequestCountTracker):
1265         (WebCore::SubresourceLoader::SubresourceLoader):
1266         (WebCore::SubresourceLoader::create):
1267         (WebCore::SubresourceLoader::didReceiveResponse):
1268         (WebCore::SubresourceLoader::notifyDone):
1269         * loader/SubresourceLoader.h:
1270         * loader/appcache/ApplicationCacheHost.cpp:
1271         (WebCore::ApplicationCacheHost::maybeLoadResource):
1272         * loader/appcache/ApplicationCacheHost.h:
1273         * loader/cache/CachedResource.cpp:
1274         (WebCore::CachedResource::load):
1275         * loader/cache/CachedResourceLoader.cpp:
1276         (WebCore::CachedResourceLoader::incrementRequestCount):
1277         (WebCore::CachedResourceLoader::decrementRequestCount):
1278         * loader/cache/CachedResourceLoader.h:
1279
1280 2016-06-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1281
1282         [Wayland] PlatformDisplayWayland destructor is super crashy
1283         https://bugs.webkit.org/show_bug.cgi?id=157973
1284
1285         Reviewed by Michael Catanzaro.
1286
1287         EGL registers two at exist callbacks one to finish the display and another one to unload drivers, the one to
1288         finish the display happens first. When our destructor is called the _eglFiniDisplay callback has already been
1289         called, so we have a valid pointer for an already finished display. Then eglTerminate tries to find the display
1290         in the global display list, but fails and for some reason it crashes when trying to return an error.
1291         If atexit is called after the global PlatformDisplay constructor, the atexit handler is called before the
1292         destructor. The atexit callbacks are called in reverse order, so if we register an atexit handler after the
1293         global instace has been created and after EGL has been initialized, we could terminate the EGL display before
1294         the EGL atexit handlers and the global PlatformDisplay destructor.
1295
1296         * platform/graphics/PlatformDisplay.cpp:
1297         (WebCore::PlatformDisplay::initializeEGLDisplay):
1298
1299 2016-06-01  Brady Eidson  <beidson@apple.com>
1300
1301         Get rid of StringCapture.
1302         https://bugs.webkit.org/show_bug.cgi?id=158285
1303
1304         Reviewed by Chris Dumez.
1305
1306         No new tests (Refactor, no behavior change).
1307
1308         * dom/Document.cpp:
1309         (WebCore::Document::addConsoleMessage):
1310         (WebCore::Document::addMessage):
1311         
1312         * dom/ScriptExecutionContext.h:
1313         (WebCore::ScriptExecutionContext::AddConsoleMessageTask::AddConsoleMessageTask):
1314         
1315         * loader/DocumentLoader.cpp:
1316         (WebCore::DocumentLoader::installContentFilterUnblockHandler):
1317         
1318         * loader/WorkerThreadableLoader.cpp:
1319         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1320         
1321         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1322         (WebVideoFullscreenControllerContext::setExternalPlayback):
1323         
1324         * workers/WorkerGlobalScope.cpp:
1325         (WebCore::WorkerGlobalScope::addConsoleMessage):
1326         (WebCore::WorkerGlobalScope::addMessage):
1327         
1328         * workers/WorkerMessagingProxy.cpp:
1329         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
1330         (WebCore::WorkerMessagingProxy::postConsoleMessageToWorkerObject):
1331
1332 2016-05-31  Darin Adler  <darin@apple.com>
1333
1334         Audit RenderObject casts and fix problems and style issues found
1335         https://bugs.webkit.org/show_bug.cgi?id=158221
1336
1337         Reviewed by Chris Dumez.
1338
1339         * bindings/objc/DOM.mm:
1340         (-[DOMElement image]): Use auto to get more specific types in code getting
1341         the renderer for an element instead of dumbing down the type to RenderObject.
1342
1343         * dom/Element.cpp:
1344         (WebCore::Element::scrollByUnits): Call renderer only once. The comment in
1345         Node advises we should do this since it has a branch in it.
1346         (WebCore::Element::absoluteEventBounds): Call renderer only once. Also use
1347         auto for a rect type to clarify that we are not changing the type of the
1348         rect returned by the fucntion.
1349         (WebCore::Element::webkitGetRegionFlowRanges): Call renderer only once.
1350
1351         * editing/CompositeEditCommand.cpp:
1352         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded): Use auto
1353         to get a mroe specific renderer type.
1354
1355         * editing/SimplifyMarkupCommand.cpp:
1356         (WebCore::SimplifyMarkupCommand::doApply): Call renderer only once.
1357
1358         * editing/cocoa/HTMLConverter.mm:
1359         (HTMLConverter::_addAttachmentForElement): Add an obviously missing
1360         null check for something that is null checked elsewhere.
1361         (fileWrapperForURL): Ditto.
1362         (fileWrapperForElement): Changed argument type to HTMLImageElement& since
1363         the call site already checks the type of the object. Use HTMLImageElement::src
1364         instead of repeating the code here. Check the type of the renderer instead of
1365         assuming it's a RenderImage.
1366         (WebCore::editingAttributedStringFromRange): Pass a reference, not a pointer.
1367
1368         * html/HTMLAnchorElement.cpp:
1369         (WebCore::appendServerMapMousePosition): Take a reference to an event rather
1370         than a "known to be non-null" pointer. Call renderer only once. Round the
1371         floating point values rather than truncating them.
1372         (WebCore::HTMLAnchorElement::handleClick): Pass a reference.
1373
1374         * html/HTMLAttachmentElement.cpp:
1375         (WebCore::HTMLAttachmentElement::setFile): Removed the now-unneeded cast since
1376         the renderer function returns a pointer of a more specific type now.
1377         (WebCore::HTMLAttachmentElement::parseAttribute): Ditto.
1378         (WebCore::HTMLAttachmentElement::attachmentTitle): Use auto& to avoid a bit of
1379         reference count churn.
1380
1381         * html/HTMLAttachmentElement.h: Override renderer to return a more specific type.
1382         This follows the pattern that ContainerNode::renderer uses.
1383
1384         * html/HTMLButtonElement.h: Ditto.
1385
1386         * html/HTMLCanvasElement.cpp: Gave the constants at the top of the file more
1387         normal names. Removed unneeded "static" from them. Moved the
1388         defaultInterpolationQuality constant here from the header because it doesn't
1389         need to be there.
1390         (WebCore::HTMLCanvasElement::HTMLCanvasElement): Updated for name changes.
1391         (WebCore::HTMLCanvasElement::createElementRenderer): Removed unneeded code to
1392         set m_rendererIsCanvas to record renderer type; we can just check the type.
1393         (WebCore::HTMLCanvasElement::setHeight): Updated for name changes.
1394         (WebCore::HTMLCanvasElement::setWidth): Ditto.
1395         (WebCore::HTMLCanvasElement::reset): Check the type of the renderer directly
1396         instead of calling m_rendererIsCanvas. This helped make it clear we were
1397         do extra unneeded checks since a renderer can't both be a RenderCanvas and
1398         not be a RenderBox.
1399         (WebCore::HTMLCanvasElement::createImageBuffer): Updated for name changes.
1400
1401         * html/HTMLCanvasElement.h: Moved DefaultInterpolationQuality into the cpp file.
1402         Use nullptr instead of 0. Removed m_rendererIsCanvas.
1403
1404         * html/HTMLFieldSetElement.cpp:
1405         (WebCore::HTMLFieldSetElement::HTMLFieldSetElement): Initialize m_documentVersion
1406         in the class definition.
1407         (WebCore::HTMLFieldSetElement::~HTMLFieldSetElement): Use m_hasDisabledAttribute.
1408         (WebCore::updateFromControlElementsAncestorDisabledStateUnder): Fixed typo.
1409         (WebCore::HTMLFieldSetElement::disabledAttributeChanged): Fixed mistake in this
1410         function that would cause the number of disabled fieldset elements to be too high
1411         if the disabled attribute's value was changed from one value to another. Use a
1412         boolean to track the old value; can't think of a solution that works without that.
1413         (WebCore::HTMLFieldSetElement::childrenChanged): Fixed typo.
1414         (WebCore::HTMLFieldSetElement::didMoveToNewDocument): Use m_hasDisabledAttribute.
1415         (WebCore::HTMLFieldSetElement::updateAssociatedElements): Changed name to make it
1416         clearer what this function does. Tweaked a bit without changing behavior.
1417         (WebCore::HTMLFieldSetElement::associatedElements): Updated for name change.
1418         (WebCore::HTMLFieldSetElement::length): Changed to call associatedElements instead of
1419         repeating that it does.
1420
1421         * html/HTMLFieldSetElement.h: Override renderer to return a more specific type.
1422         Also updated for other changes mentioned above.
1423
1424         * html/HTMLFrameElement.cpp:
1425         (WebCore::HTMLFrameElement::HTMLFrameElement): Initialize booleans in the class
1426         definition rather than doing it here.
1427         (WebCore::HTMLFrameElement::parseAttribute): Call renderer only once.
1428
1429         * html/HTMLFrameElement.h: Override renderer to return a more specific type.
1430         Also initialize some booleans in the class definition.
1431
1432         * html/HTMLIFrameElement.h: Override renderer to return a more specific type.
1433
1434         * html/HTMLMediaElement.cpp:
1435         (WebCore::HTMLMediaElement::updateRenderer): Added. Helper for a common idiom.
1436         (WebCore::HTMLMediaElement::didAttachRenderers): Use auto to get a more specific
1437         type for the renderer.
1438         (WebCore::HTMLMediaElement::willDetachRenderers): Call renderer only once.
1439         (WebCore::HTMLMediaElement::didRecalcStyle): Use updateRenderer to call renderer
1440         only once.
1441         (WebCore::HTMLMediaElement::loadResource): Ditto.
1442         (WebCore::HTMLMediaElement::waitForSourceChange): Ditto.
1443         (WebCore::HTMLMediaElement::noneSupported): Ditto.
1444         (WebCore::HTMLMediaElement::setReadyState): Ditto.
1445         (WebCore::HTMLMediaElement::progressEventTimerFired): Ditto.
1446         (WebCore::HTMLMediaElement::selectNextSourceChild): Renamed goto label to use a style
1447         that fits WebKit coding style. Call renderer only once in MediaQuery code.
1448         (WebCore::HTMLMediaElement::mediaPlayerRepaint): Call renderer only once.
1449         (WebCore::HTMLMediaElement::mediaPlayerSizeChanged): Use updateRenderer to call
1450         renderer only once.
1451         (WebCore::HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated): Call renderer
1452         only once.
1453         (WebCore::HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter): Call page only once.
1454         (WebCore::HTMLMediaElement::mediaEngineWasUpdated): Use updateRenderer to call
1455         renderer only once.
1456         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1457         (WebCore::HTMLMediaElement::updatePlayState): Ditto.
1458         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
1459         (WebCore::HTMLMediaElement::resume): Ditto.
1460         (WebCore::HTMLMediaElement::mediaPlayerContentBoxRect): Call renderer only once.
1461         (WebCore::mediaElementIsAllowedToAutoplay): Use auto to get a more specific type.
1462
1463         * html/HTMLMediaElement.h: Removed conditionals around forward declarations.
1464         Tweaked formatting a bit. Added the updateRender function. Override renderer to
1465         return a more specific type.
1466
1467         * html/HTMLSelectElement.cpp:
1468         (WebCore::HTMLSelectElement::optionElementChildrenChanged): Don't use the renderer
1469         just to get to the document for the AXObjectCache.
1470         (WebCore::HTMLSelectElement::setLength): Use auto for the list items vector.
1471         (WebCore::HTMLSelectElement::nextValidIndex): Ditto.
1472         (WebCore::HTMLSelectElement::firstSelectableListIndex): Ditto.
1473         (WebCore::HTMLSelectElement::nextSelectableListIndexPageAway): Ditto. Also add a
1474         null check for the renderer.
1475         (WebCore::HTMLSelectElement::updateListBoxSelection): Split an assertion with &&
1476         in it into two separate assertions. Use auto for the list items vector and use
1477         a reference for the list items.
1478         (WebCore::HTMLSelectElement::listBoxOnChange): Use auto for the list items vector
1479         and use a reference for the list items.
1480         (WebCore::HTMLSelectElement::setRecalcListItems): Don't use the renderer
1481         just to get to the document for the AXObjectCache.
1482         (WebCore::HTMLSelectElement::selectOption): Use auto for the list items vector.
1483         (WebCore::HTMLSelectElement::optionToListIndex): Ditto.
1484         (WebCore::HTMLSelectElement::listToOptionIndex): Ditto.
1485         (WebCore::HTMLSelectElement::searchOptionsForValue): Ditto.
1486         (WebCore::HTMLSelectElement::restoreFormControlState): Ditto.
1487         (WebCore::HTMLSelectElement::platformHandleKeydownEvent): Call renderer only once.
1488         (WebCore::HTMLSelectElement::menuListDefaultEventHandler): Split an assertion with
1489         && in it into two separate assertions. Use auto for the list items vector. Call
1490         renderer only once.
1491         (WebCore::HTMLSelectElement::updateSelectedState): Use a reference for the list
1492         item.
1493         (WebCore::HTMLSelectElement::listBoxDefaultEventHandler): Use auto for the list
1494         items vvector. Call renderer less often; could not quite get it down to once.
1495         (WebCore::HTMLSelectElement::defaultEventHandler): Call renderer only once.
1496         (WebCore::HTMLSelectElement::lastSelectedListIndex): Use auto for the list items
1497         vector and use a reference for the list items.
1498         (WebCore::HTMLSelectElement::optionAtIndex): Use a reference for the list item.
1499         (WebCore::HTMLSelectElement::accessKeySetSelectedIndex): Use auto for the list
1500         items vector and use a reference for the list items.
1501         (WebCore::HTMLSelectElement::length): Use auto for the list items vector.
1502
1503         * html/HTMLTextAreaElement.h: Override renderer to return a more specific type.
1504
1505         * html/HTMLVideoElement.cpp:
1506         (WebCore::HTMLVideoElement::didAttachRenderers): Call renderer only once and
1507         don't downcast it. There was no obvious type check because the renderer has a
1508         guaranteed type, but this is now clearer because it's the renderer function
1509         that returns a more specific type.
1510         (WebCore::HTMLVideoElement::parseAttribute): Ditto.
1511         (WebCore::HTMLVideoElement::setDisplayMode): Ditto.
1512
1513         * html/HTMLVideoElement.h: Override renderer to return a more specific type.
1514         * html/HTMLWBRElement.h: Ditto.
1515
1516         * html/MediaElementSession.cpp:
1517         (WebCore::MediaElementSession::canControlControlsManager): Removed
1518         unneeded typecast in code that null checks a renderer.
1519         (WebCore::isMainContent): Remove now-unneeded downcast of a renderer
1520         obtained from an HTMLMediaElement. Fixed awkward formatting by splitting
1521         an if statement into two.
1522         (WebCore::isElementLargeEnoughForMainContent): Remove now unneeded downcast
1523         of a renderer obtained from an HTMLMediaElement.
1524
1525         * html/TextFieldInputType.cpp:
1526         (WebCore::TextFieldInputType::forwardEvent): Call renderer only once.
1527         Also use auto more in the code rather than writing out types.
1528
1529         * html/shadow/SliderThumbElement.cpp:
1530         (WebCore::SliderThumbElement::setPositionFromPoint): Used the renderBox
1531         function more consistently for all the renderers used here; before,
1532         some had null checks and others did not.
1533
1534         * html/shadow/TextControlInnerElements.cpp:
1535         (WebCore::SearchFieldResultsButtonElement::defaultEventHandler): Use auto
1536         a bit more.
1537
1538         * page/EventHandler.cpp:
1539         (WebCore::enclosingScrollableArea): Removed a redundant null check and
1540         stopped using the name "element" for a local variable that was not
1541         always an element.
1542
1543         * page/PrintContext.cpp:
1544         (WebCore::enclosingBoxModelObject): Rewrote loop to be simpler and tighter.
1545         Also marked this inline since it's used only one place.
1546         (WebCore::PrintContext::pageNumberForElement): Use auto for the return
1547         value rather than writing out the type.
1548
1549         * page/SpatialNavigation.cpp:
1550         (WebCore::isScrollableNode): Tighten the code and use auto a bit.
1551
1552         * platform/ios/WebVideoFullscreenControllerAVKit.mm: Add an include of
1553         RenderVideo.h since this gets at the renderer for a video.
1554
1555         * rendering/RenderAttachment.h:
1556         (WebCore::HTMLAttachmentElement::renderer): Added. Function is here because
1557         it can only be called by code that includes this header. This matches the
1558         pattern of RenderElement.h and ContainerNode::renderer.
1559
1560         * rendering/RenderFrame.cpp: Added now-needed include.
1561
1562         * rendering/RenderFrame.h:
1563         (WebCore::HTMLFrameElement::renderer): Added. Same logic as above.
1564
1565         * rendering/RenderLayerFilterInfo.cpp:
1566         (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients): Use auto
1567         a bit and call rendeer only once.
1568
1569         * rendering/RenderMedia.h:
1570         (WebCore::HTMLMediaElement::renderer): Added. Same logic as above.
1571         * rendering/RenderTextControlMultiLine.h:
1572         (WebCore::HTMLTextAreaElement::renderer): Ditto.
1573
1574         * rendering/RenderVideo.cpp:
1575         (WebCore::placeholder): Renamed. Tightened up argument type to match what
1576         is passed at all the call sites. Use auto instead of RenderObject.
1577         (WebCore::RenderVideo::offsetLeft): Use auto and the renamed function above.
1578         (WebCore::RenderVideo::offsetTop): Ditto.
1579         (WebCore::RenderVideo::offsetWidth): Ditto.
1580         (WebCore::RenderVideo::offsetHeight): Ditto.
1581
1582         * rendering/RenderVideo.h:
1583         (WebCore::HTMLVideoElement::renderer): Added. Same logic as above.
1584
1585         * svg/SVGGElement.cpp:
1586         (WebCore::SVGGElement::createElementRenderer): Fixed typo.
1587
1588         * svg/SVGGraphicsElement.cpp:
1589         (WebCore::SVGGraphicsElement::createElementRenderer): Removed
1590         non-helpful oblique comment.
1591         * svg/SVGPathElement.cpp:
1592         (WebCore::SVGPathElement::createElementRenderer): Ditto.
1593
1594 2016-06-01  Chris Fleizach  <cfleizach@apple.com>
1595
1596         LayoutTest accessibility/ios-simulator/attributed-string-for-range.html failing on ios-simulator debug
1597         https://bugs.webkit.org/show_bug.cgi?id=158279
1598
1599         Reviewed by Alexey Proskuryakov.
1600
1601         Just use the same description for debug and release. We're not getting any benefit from having two.
1602
1603         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1604         (-[WebAccessibilityObjectWrapper description]):
1605
1606 2016-06-01  Chris Dumez  <cdumez@apple.com>
1607
1608         Use HashMap::ensure() in DocumentOrderedMap::add()
1609         https://bugs.webkit.org/show_bug.cgi?id=158283
1610
1611         Reviewed by Ryosuke Niwa.
1612
1613         Use HashMap::ensure() in DocumentOrderedMap::add() to avoid constructing
1614         a MapEntry if the key is already present in the HashMap.
1615
1616         * dom/DocumentOrderedMap.cpp:
1617         (WebCore::DocumentOrderedMap::add):
1618
1619 2016-06-01  Alexey Proskuryakov  <ap@apple.com>
1620
1621         Update QuartzCoreSPI.h for <rdar://problem/26584828>.
1622
1623         * platform/spi/cocoa/QuartzCoreSPI.h:
1624
1625 2016-06-01  Brady Eidson  <beidson@apple.com>
1626
1627         Modernize lambda usage for all callers of RunLoop::dispatch().
1628         https://bugs.webkit.org/show_bug.cgi?id=158265
1629
1630         Reviewed by Chris Dumez.
1631
1632         No new tests (Refactor, no behavior change).
1633
1634         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
1635         (WebCore::InProcessIDBServer::deleteDatabase):
1636         (WebCore::InProcessIDBServer::didDeleteDatabase):
1637         (WebCore::InProcessIDBServer::openDatabase):
1638         (WebCore::InProcessIDBServer::didOpenDatabase):
1639         (WebCore::InProcessIDBServer::didAbortTransaction):
1640         (WebCore::InProcessIDBServer::didCommitTransaction):
1641         (WebCore::InProcessIDBServer::didCreateObjectStore):
1642         (WebCore::InProcessIDBServer::didDeleteObjectStore):
1643         (WebCore::InProcessIDBServer::didClearObjectStore):
1644         (WebCore::InProcessIDBServer::didCreateIndex):
1645         (WebCore::InProcessIDBServer::didDeleteIndex):
1646         (WebCore::InProcessIDBServer::didPutOrAdd):
1647         (WebCore::InProcessIDBServer::didGetRecord):
1648         (WebCore::InProcessIDBServer::didGetCount):
1649         (WebCore::InProcessIDBServer::didDeleteRecord):
1650         (WebCore::InProcessIDBServer::didOpenCursor):
1651         (WebCore::InProcessIDBServer::didIterateCursor):
1652         (WebCore::InProcessIDBServer::abortTransaction):
1653         (WebCore::InProcessIDBServer::commitTransaction):
1654         (WebCore::InProcessIDBServer::didFinishHandlingVersionChangeTransaction):
1655         (WebCore::InProcessIDBServer::createObjectStore):
1656         (WebCore::InProcessIDBServer::deleteObjectStore):
1657         (WebCore::InProcessIDBServer::clearObjectStore):
1658         (WebCore::InProcessIDBServer::createIndex):
1659         (WebCore::InProcessIDBServer::deleteIndex):
1660         (WebCore::InProcessIDBServer::putOrAdd):
1661         (WebCore::InProcessIDBServer::getRecord):
1662         (WebCore::InProcessIDBServer::getCount):
1663         (WebCore::InProcessIDBServer::deleteRecord):
1664         (WebCore::InProcessIDBServer::openCursor):
1665         (WebCore::InProcessIDBServer::iterateCursor):
1666         (WebCore::InProcessIDBServer::establishTransaction):
1667         (WebCore::InProcessIDBServer::fireVersionChangeEvent):
1668         (WebCore::InProcessIDBServer::didStartTransaction):
1669         (WebCore::InProcessIDBServer::didCloseFromServer):
1670         (WebCore::InProcessIDBServer::notifyOpenDBRequestBlocked):
1671         (WebCore::InProcessIDBServer::databaseConnectionClosed):
1672         (WebCore::InProcessIDBServer::abortOpenAndUpgradeNeeded):
1673         (WebCore::InProcessIDBServer::didFireVersionChangeEvent):
1674         (WebCore::InProcessIDBServer::openDBRequestCancelled):
1675         (WebCore::InProcessIDBServer::confirmDidCloseFromServer):
1676         (WebCore::InProcessIDBServer::getAllDatabaseNames):
1677         (WebCore::InProcessIDBServer::didGetAllDatabaseNames):
1678         
1679         * Modules/websockets/WebSocket.cpp:
1680         (WebCore::WebSocket::connect):
1681         
1682         * bindings/js/SerializedScriptValue.cpp:
1683         (WebCore::SerializedScriptValue::writeBlobsToDiskForIndexedDBSynchronously):
1684         
1685         * page/scrolling/ThreadedScrollingTree.cpp:
1686         (WebCore::ThreadedScrollingTree::invalidate):
1687         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1688         (WebCore::ThreadedScrollingTree::currentSnapPointIndicesDidChange):
1689         (WebCore::ThreadedScrollingTree::handleWheelEventPhase):
1690         (WebCore::ThreadedScrollingTree::setActiveScrollSnapIndices):
1691         (WebCore::ThreadedScrollingTree::deferTestsForReason):
1692         (WebCore::ThreadedScrollingTree::removeTestDeferralForReason):
1693         
1694         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1695         (WebCore::FontCache::platformPrecache):
1696         
1697         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
1698         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
1699         
1700         * platform/network/DataURLDecoder.cpp:
1701         (WebCore::DataURLDecoder::createDecodeTask):
1702         (WebCore::DataURLDecoder::decode):
1703
1704 2016-06-01  Eric Carlson  <eric.carlson@apple.com>
1705
1706         REGRESSION(r201385) ASSERT in WebCore::HTMLMediaElement::updateActiveTextTrackCues + 5688
1707         https://bugs.webkit.org/show_bug.cgi?id=158164
1708         <rdar://problem/26498634>
1709
1710         Reviewed by Jer Noble.
1711
1712         No new tests, this prevents an assert in existing tests.
1713
1714         * html/HTMLMediaElement.cpp:
1715         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call beginIgnoringTrackDisplayUpdateRequests
1716           so we avoid doing unnecessary work triggered by destruction.
1717
1718 2016-06-01  Dean Jackson  <dino@apple.com>
1719
1720         Fix iOS build.
1721
1722         * platform/spi/cg/CoreGraphicsSPI.h: No ColorSync on iOS.
1723
1724 2016-06-01  Chris Dumez  <cdumez@apple.com>
1725
1726         Crash under eventTargetRespectingTargetRules()
1727         https://bugs.webkit.org/show_bug.cgi?id=158273
1728         <rdar://problem/26343998>
1729
1730         Reviewed by Alex Christensen.
1731
1732         The code would call nodeOrHostIfPseudoElement(), which can return null
1733         and then dereference it in eventTargetRespectingTargetRules() without
1734         null check. This patch adds a null check. When the node is null, the
1735         while loop after will do nothing and thus the target will not be used.
1736
1737         No new tests, we do not have a good reproduction case.
1738
1739         * dom/EventPath.cpp:
1740         (WebCore::EventPath::EventPath):
1741
1742 2016-06-01  Commit Queue  <commit-queue@webkit.org>
1743
1744         Unreviewed, rolling out r201551 and r201552.
1745         https://bugs.webkit.org/show_bug.cgi?id=158275
1746
1747         This change caused 3 API tests to crash on ios-simulator
1748         (Requested by ryanhaddad on #webkit).
1749
1750         Reverted changesets:
1751
1752         "Precache primary font in a secondary thread"
1753         https://bugs.webkit.org/show_bug.cgi?id=158243
1754         http://trac.webkit.org/changeset/201551
1755
1756         "Remove accidental fprintf."
1757         http://trac.webkit.org/changeset/201552
1758
1759 2016-06-01  Chris Fleizach  <cfleizach@apple.com>
1760
1761         AX: iOS: VoiceOver can't access attachments in mail messages
1762         https://bugs.webkit.org/show_bug.cgi?id=158198
1763
1764         Reviewed by Joanmarie Diggs.
1765
1766         Replaced elements, like attachemnts, were not being exposed in the attributed string returned to VoiceOver.
1767         Make sure they are exposed with the attachment character, pointing to the actual element.
1768
1769         Test: accessibility/ios-simulator/attributed-string-for-range.html
1770
1771         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1772         (AccessibilityUnignoredAncestor):
1773         (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
1774
1775 2016-06-01  Jer Noble  <jer.noble@apple.com>
1776
1777         setVideoFullscreenGravity() has no effect on the fullscreen video layer
1778         https://bugs.webkit.org/show_bug.cgi?id=158267
1779
1780         Reviewed by Eric Carlson.
1781
1782         When we moved to a 2-AVPlayerLayer solution, we didn't update setVideoFullscreenGravity()
1783         to change the correct layer's videoGravity property.
1784
1785         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1786         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity):
1787
1788 2016-06-01  Alex Christensen  <achristensen@webkit.org>
1789
1790         Fix null dereferencing in ResourceTimingInformation::addResourceTiming
1791         https://bugs.webkit.org/show_bug.cgi?id=158266
1792         rdar://problem/26528466
1793
1794         Reviewed by Chris Dumez.
1795
1796         This would crash sometimes in http/tests/security/cross-frame-access-custom.html
1797
1798         * loader/ResourceTimingInformation.cpp:
1799         (WebCore::ResourceTimingInformation::addResourceTiming):
1800         * loader/ResourceTimingInformation.h:
1801         * loader/cache/CachedResourceLoader.cpp:
1802         (WebCore::CachedResourceLoader::requestResource):
1803         (WebCore::CachedResourceLoader::loadDone):
1804         We would dereference a null pointer on the first instruction when calling 
1805         Document::parentDocument from ResourceTimingInformation::addResourceTiming, 
1806         which means the document was null.  CachedResourceLoader::document even has
1807         a comment saying it can be null, so we should check it before using it.
1808
1809 2016-06-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
1810
1811         SVGImage should report its memory cost to JS garbage collector
1812         https://bugs.webkit.org/show_bug.cgi?id=158139
1813
1814         Reviewed by Geoffrey Garen.
1815
1816         Like what we do in HTMLImageLoader::notifyFinished() by reporting the memory
1817         cost of the BitmapImage, we need to do something similar for the SVGImage. In
1818         SVGImage::dataChange() and when allDataReceived is true, we can calculate
1819         the size of all DOM nodes and their renderers. The size of the encoded data
1820         has to be added as well to the total memory cost. An approximation for the
1821         memory cost has to be used since it is costly to get an accurate number.
1822
1823         * bindings/js/JSDocumentCustom.cpp: 
1824         (WebCore::reportMemoryForDocumentIfFrameless): Use Node::approximateMemoryCost()
1825         instead of sizeof(Node). A Node's descendant can override this function and
1826         return a more accurate memory cost.
1827         
1828         * dom/Node.h:
1829         (WebCore::Node::approximateMemoryCost): Define this new virtual function in the
1830         Node class. Its default value is sizeof(Node) but any descendant can return a
1831         more accurate number.
1832         
1833         * platform/graphics/Image.h:
1834         (WebCore::Image::data): Define a const version of data() so it can be called
1835         the const function SVGImage::reportApproximateMemoryCost().
1836         
1837         * svg/SVGGraphicsElement.h: Override approximateMemoryCost() to return 
1838         sizeof(SVGGraphicsElement).
1839         
1840         * svg/SVGPathElement.cpp:
1841         (WebCore::SVGPathElement::approximateMemoryCost): Override this function to return
1842         the memory cost of the points and the m_path of the renderer.
1843         * svg/SVGPathElement.h:
1844         
1845         * svg/SVGPolyElement.cpp:
1846         (WebCore::SVGPolyElement::approximateMemoryCost): Override this function to return
1847         the memory cost of the points and the m_path of the renderer.
1848         * svg/SVGPolyElement.h:
1849         
1850         * svg/graphics/SVGImage.cpp:
1851         (WebCore::SVGImage::reportApproximateMemoryCost): Calculate the memory cost of the 
1852         nodes in the SVGDocument of an SVGImage. Then report this number to the JS garbage 
1853         collector.
1854         
1855         (WebCore::SVGImage::dataChanged): After loading all the SVG encoded data and building
1856         its DOM tree and the render tree, report the total memory cost to the JS garbage collector.
1857         * svg/graphics/SVGImage.h:
1858
1859 2016-06-01  Andreas Kling  <akling@apple.com>
1860
1861         Use inline capacity for StylePropertyShorthand Vectors.
1862         <https://webkit.org/b/158260>
1863
1864         Reviewed by Antti Koivisto.
1865
1866         Vector<StylePropertyShorthand> was a huge source of heap allocations,
1867         just over 0.5% of all fastMalloc() bytes on PLUM. Giving it an inline capacity
1868         of 4 turns all of it into stack allocations.
1869
1870         * css/CSSParser.cpp:
1871         (WebCore::CSSParser::addProperty):
1872         * css/CSSProperty.cpp:
1873         (WebCore::StylePropertyMetadata::shorthandID):
1874         * css/StylePropertyShorthand.cpp:
1875         (WebCore::indexOfShorthandForLonghand):
1876         * css/StylePropertyShorthand.h:
1877         * css/makeprop.pl:
1878         (constructShorthandsVector):
1879
1880 2016-06-01  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1881
1882         POST request on a blob resource should return a "network error" instead of HTTP 500 response
1883         https://bugs.webkit.org/show_bug.cgi?id=158022
1884
1885         Reviewed by Alex Christensen.
1886
1887         Not allowed HTTP method is notified as failed in BlobResourceHandle as per Fetch
1888         specification (5.2 Basic fetch). This behavior is observable in fetch WPT tests.
1889
1890         The behavior of XHR is slightly changed for asynchronous request on a blob resource with not
1891         allowed or invalid HTTP methods. The onError callback is called instead of throwing an
1892         exception as per XHR specification (https://xhr.spec.whatwg.org/#request-error-steps).
1893
1894         WPT tests expected results have been updated for fetch tests on blob resources which are
1895         now correct.
1896
1897         Test: fast/files/xhr-blob-request.html ensures XHR response to requests on a blob resource is
1898         correct.
1899
1900         * platform/network/BlobResourceHandle.cpp:
1901         (WebCore::BlobResourceHandle::doStart):
1902         * xml/XMLHttpRequest.cpp:
1903         (WebCore::XMLHttpRequest::createRequest):
1904
1905 2016-06-01  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1906
1907         Remove allocation of SubresourceLoader::m_requestCountTracker
1908         https://bugs.webkit.org/show_bug.cgi?id=158255
1909
1910         Reviewed by Chris Dumez.
1911
1912         No change of behavior.
1913
1914         Making m_requestCountTracker an Optional in lieu of a unique_ptr.
1915         This requires constructing m_requestCountTracker in place so that constructor and destructor are called only once.
1916
1917         * loader/SubresourceLoader.cpp:
1918         (WebCore::SubresourceLoader::SubresourceLoader):
1919         (WebCore::SubresourceLoader::didReceiveResponse):
1920         (WebCore::SubresourceLoader::notifyDone):
1921         * loader/SubresourceLoader.h:
1922
1923 2016-06-01  Antti Koivisto  <antti@apple.com>
1924
1925         Remove accidental fprintf.
1926
1927         * platform/graphics/FontCache.cpp:
1928         (WebCore::FontCache::precache):
1929
1930 2016-05-31  Antti Koivisto  <antti@apple.com>
1931
1932         Precache primary font in a secondary thread
1933         https://bugs.webkit.org/show_bug.cgi?id=158243
1934
1935         Reviewed by Andreas Kling.
1936
1937         We know the font families and descriptions to use on style resolution. The actual fonts are only needed for
1938         layout. There is often time to load and cache fonts asynchronously before they are accessed. This can substantially
1939         reduce font related workload in the main thread.
1940
1941         * css/CSSFontFace.cpp:
1942         (WebCore::CSSFontFace::font):
1943         (WebCore::CSSFontFace::resolveFamilies):
1944         (WebCore::CSSFontFace::hasSVGFontFaceSource):
1945         * css/CSSFontFace.h:
1946         * css/CSSFontFaceSource.cpp:
1947         (WebCore::CSSFontFaceSource::font):
1948         (WebCore::CSSFontFaceSource::url):
1949         (WebCore::CSSFontFaceSource::isSVGFontFaceSource):
1950         * css/CSSFontFaceSource.h:
1951         * css/CSSFontSelector.cpp:
1952         (WebCore::CSSFontSelector::fallbackFontAt):
1953         (WebCore::CSSFontSelector::resolveFamilies):
1954
1955             Add a function for resolving font families of a cascade to their final values.
1956
1957         * css/CSSFontSelector.h:
1958         * css/CSSSegmentedFontFace.cpp:
1959         (WebCore::CSSSegmentedFontFace::fontRanges):
1960         (WebCore::CSSSegmentedFontFace::resolveFamilies):
1961         * css/CSSSegmentedFontFace.h:
1962         * platform/graphics/FontCache.cpp:
1963         (WebCore::fontPlatformDataCache):
1964         (WebCore::precacheTasksInProgress):
1965         (WebCore::alternateFamilyName):
1966         (WebCore::FontCache::getCachedFontPlatformData):
1967         (WebCore::FontCache::invalidate):
1968         (WebCore::FontCache::precache):
1969
1970             Precache fonts by trying to load them asyncronously one by one. On success the font is cached into font platform data cache.
1971
1972         (WebCore::FontCache::similarFont):
1973         * platform/graphics/FontCache.h:
1974         * platform/graphics/FontCascade.cpp:
1975         (WebCore::pruneSystemFallbackFonts):
1976         (WebCore::precachePrimaryFamily):
1977
1978             When initializing a new font cascade resolve any platform fonts to their actual names using FontSelector,
1979             then precache the primary font for the cascade.
1980
1981             Web fonts are ignored for now.
1982
1983         (WebCore::retrieveOrAddCachedFonts):
1984         * platform/graphics/FontSelector.h:
1985         (WebCore::FontSelector::~FontSelector):
1986         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1987         (WebCore::FontCache::setFontWhitelist):
1988         (WebCore::fontWithFamily):
1989         (WebCore::autoActivateFont):
1990         (WebCore::createFontPlatformDataThreadSafe):
1991
1992             Factor thread safe part of createFontPlatformData to a function.
1993
1994         (WebCore::FontCache::createFontPlatformData):
1995
1996             Do the main thread only hash lookups here then call to createFontPlatformDataThreadSafe.
1997
1998         (WebCore::fallbackDedupSet):
1999         (WebCore::FontCache::systemFallbackForCharacters):
2000         (WebCore::FontCache::platformPrecache):
2001
2002             Try to initialize font asynchronously in a dispatch queue, call completion handler on success or failure.
2003
2004         (WebCore::FontCache::platformCancelPrecache):
2005
2006             Cancel ongoing precache operation.
2007
2008         (WebCore::platformFontLookupWithFamily): Deleted.
2009
2010             This was inlined to the only client, fontWithFamily.
2011
2012 2016-06-01  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2013
2014         WebRTC: Add RTCRtpTransceiver interface and RTCPeerConnection.addTransceiver()
2015         https://bugs.webkit.org/show_bug.cgi?id=158189
2016
2017         Reviewed by Darin Adler.
2018
2019         The RTCRtpTransceiver interface represents a combination of an RTCRtpSender and an
2020         RTCRtpReceiver that share a common mid [1].
2021
2022         RTCPeerConnection.addTransceiver() [2] creates an RTCRtpTransceiver object, either directly
2023         from a MediaStreamTrack [3], or with a specific media type (kind).
2024
2025         This change introduces the RTCRtpTransceiver object, follow-up patches will integrate it
2026         into the offer/answer machinery.
2027
2028         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#rtcrtptransceiver-interface
2029         [2] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-addtransceiver
2030         [3] http://w3c.github.io/mediacapture-main/archives/20160513/getusermedia.html#mediastreamtrack
2031
2032         Test: fast/mediastream/RTCPeerConnection-addTransceiver.html
2033
2034         * CMakeLists.txt:
2035         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2036         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2037         (WebCore::MediaEndpointPeerConnection::createReceiver):
2038         An RTCTransceiver always has a receiver (RTCRtpReceiver) with a track (MediaStreamTrack) that
2039         can be rendered. Before that remote track is receiving data from the remote peer, it's muted.
2040         createReceiver() uses MediaEndponit::createMutedRemoteSource() to create a source to represent
2041         future incoming media.
2042         * Modules/mediastream/MediaEndpointPeerConnection.h:
2043         * Modules/mediastream/PeerConnectionBackend.h:
2044         * Modules/mediastream/RTCPeerConnection.cpp:
2045         (WebCore::RTCPeerConnection::addTransceiver):
2046         (WebCore::RTCPeerConnection::completeAddTransceiver):
2047         (WebCore::RTCPeerConnection::addReceiver): Deleted.
2048         We now create the receiver explicitly with createReceiver.
2049         * Modules/mediastream/RTCPeerConnection.h:
2050         * Modules/mediastream/RTCPeerConnection.idl:
2051         * Modules/mediastream/RTCRtpSender.cpp:
2052         (WebCore::RTCRtpSender::create):
2053         (WebCore::RTCRtpSender::RTCRtpSender):
2054         (WebCore::RTCRtpSender::setTrack):
2055         (WebCore::RTCRtpSender::replaceTrack):
2056         * Modules/mediastream/RTCRtpSender.h:
2057         (WebCore::RTCRtpSender::trackId):
2058         (WebCore::RTCRtpSender::trackKind):
2059         (WebCore::RTCRtpSender::setMediaStreamIds):
2060         (WebCore::RTCRtpSender::isStopped):
2061         (WebCore::RTCRtpSender::create): Deleted.
2062         * Modules/mediastream/RTCRtpSenderReceiverBase.h:
2063         (WebCore::RTCRtpSenderReceiverBase::track):
2064         (WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):
2065         * Modules/mediastream/RTCRtpTransceiver.cpp: Added.
2066         (WebCore::RTCRtpTransceiver::create):
2067         (WebCore::RTCRtpTransceiver::getNextMid):
2068         (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
2069         (WebCore::RTCRtpTransceiver::directionString):
2070         (WebCore::RTCRtpTransceiver::hasSendingDirection):
2071         (WebCore::RTCRtpTransceiver::enableSendingDirection):
2072         (WebCore::RTCRtpTransceiver::disableSendingDirection):
2073         * Modules/mediastream/RTCRtpTransceiver.h: Added.
2074         (WebCore::RTCRtpTransceiver::~RTCRtpTransceiver):
2075         (WebCore::RTCRtpTransceiver::direction):
2076         (WebCore::RTCRtpTransceiver::setDirection):
2077         (WebCore::RTCRtpTransceiver::provisionalMid):
2078         (WebCore::RTCRtpTransceiver::setProvisionalMid):
2079         (WebCore::RTCRtpTransceiver::mid):
2080         (WebCore::RTCRtpTransceiver::setMid):
2081         (WebCore::RTCRtpTransceiver::sender):
2082         (WebCore::RTCRtpTransceiver::receiver):
2083         (WebCore::RTCRtpTransceiver::stopped):
2084         (WebCore::RTCRtpTransceiver::stop):
2085         * Modules/mediastream/RTCRtpTransceiver.idl: Added.
2086         * WebCore.xcodeproj/project.pbxproj:
2087         * platform/mediastream/MediaEndpoint.h:
2088         Added createMutedRemoteSource() that creates a muted remote source that will become unmuted
2089         when media arrives from the remote peer.
2090         * platform/mediastream/RealtimeMediaSource.cpp:
2091         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Deleted.
2092         * platform/mediastream/RealtimeMediaSource.h:
2093         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2094         (WebCore::MockRealtimeVideoSource::create):
2095         Use Ref instead of RefPtr.
2096         * platform/mock/MockMediaEndpoint.cpp:
2097         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
2098         * platform/mock/MockMediaEndpoint.h:
2099         * platform/mock/MockRealtimeAudioSource.cpp:
2100         (WebCore::MockRealtimeAudioSource::create):
2101         (WebCore::MockRealtimeAudioSource::createMuted):
2102         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
2103         * platform/mock/MockRealtimeAudioSource.h:
2104         * platform/mock/MockRealtimeVideoSource.cpp:
2105         (WebCore::MockRealtimeVideoSource::create):
2106         (WebCore::MockRealtimeVideoSource::createMuted):
2107         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
2108         * platform/mock/MockRealtimeVideoSource.h:
2109
2110 2016-06-01  Per Arne Vollan  <pvollan@apple.com>
2111
2112         [Win][IndexedDB] Crash when running blob test.
2113         https://bugs.webkit.org/show_bug.cgi?id=158224
2114
2115         Reviewed by Brady Eidson.
2116
2117         Avoid calling WTFMove(x) before calling x->method().
2118
2119         * Modules/indexeddb/IDBTransaction.cpp:
2120         (WebCore::IDBTransaction::putOrAddOnServer):
2121
2122 2016-06-01  Manuel Rego Casasnovas  <rego@igalia.com>
2123
2124         [css-grid] Positioned items can be placed on the implicit grid
2125         https://bugs.webkit.org/show_bug.cgi?id=158197
2126
2127         Reviewed by Sergio Villar Senin.
2128
2129         The old code wrongly assumed that positioned items couldn't be placed
2130         on the implicit grid. However, the spec doesn't mention anything about this.
2131
2132         The patch fixes this issue, so now positioned items can be actually
2133         placed on the implicit tracks.
2134
2135         Test: fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html
2136
2137         * rendering/RenderGrid.cpp:
2138         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): Use the lines
2139         of the implicit grid instead of the explicit one.
2140
2141 2016-05-31  Chris Dumez  <cdumez@apple.com>
2142
2143         Modernize lambda captures in WorkerThreadableWebSocketChannel
2144         https://bugs.webkit.org/show_bug.cgi?id=158246
2145
2146         Reviewed by Brady Eidson.
2147
2148         Modernize lambda captures in WorkerThreadableWebSocketChannel and drop
2149         legacy URLCapture as it is no longer needed / used.
2150
2151         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
2152         (WebCore::WorkerThreadableWebSocketChannel::Peer::send):
2153         (WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount):
2154         (WebCore::WorkerThreadableWebSocketChannel::Peer::didConnect):
2155         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessage):
2156         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData):
2157         (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount):
2158         (WebCore::WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake):
2159         (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
2160         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError):
2161         (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize):
2162         (WebCore::WorkerThreadableWebSocketChannel::Bridge::initialize):
2163         (WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
2164         (WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
2165         (WebCore::WorkerThreadableWebSocketChannel::Bridge::bufferedAmount):
2166         (WebCore::WorkerThreadableWebSocketChannel::Bridge::close):
2167         (WebCore::WorkerThreadableWebSocketChannel::Bridge::fail):
2168         (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
2169         (WebCore::WorkerThreadableWebSocketChannel::Bridge::suspend):
2170         (WebCore::WorkerThreadableWebSocketChannel::Bridge::resume):
2171         (WebCore::WorkerThreadableWebSocketChannel::Bridge::setMethodNotCompleted): Deleted.
2172         (WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion): Deleted.
2173         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
2174         * platform/URL.h:
2175         (WebCore::operator==): Deleted.
2176
2177 2016-05-31  Joseph Pecoraro  <pecoraro@apple.com>
2178
2179         Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
2180         https://bugs.webkit.org/show_bug.cgi?id=158144
2181
2182         Reviewed by Darin Adler.
2183
2184         * bindings/scripts/CodeGeneratorJS.pm:
2185         (InstanceNeedsEstimatedSize):
2186         (GenerateHeader):
2187         (GenerateImplementation):
2188         When an interface includes ReportExtraMemoryCost, generate an estimatedSize
2189         method which includes the Base::estimatedSize and the memoryCost().
2190
2191         * bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp: Added.
2192         (WebKit::kit):
2193         (WebKit::core):
2194         (WebKit::wrapInterfaceName):
2195         (webkit_dom_interface_name_finalize):
2196         (webkit_dom_interface_name_constructor):
2197         (webkit_dom_interface_name_class_init):
2198         (webkit_dom_interface_name_init):
2199         * bindings/scripts/test/GObject/WebKitDOMInterfaceName.h: Added.
2200         * bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h: Added.
2201         * bindings/scripts/test/JS/JSInterfaceName.cpp: Added.
2202         (WebCore::JSInterfaceNamePrototype::create):
2203         (WebCore::JSInterfaceNamePrototype::createStructure):
2204         (WebCore::JSInterfaceNamePrototype::JSInterfaceNamePrototype):
2205         (WebCore::JSInterfaceNameConstructor::prototypeForStructure):
2206         (WebCore::JSInterfaceNameConstructor::initializeProperties):
2207         (WebCore::JSInterfaceNamePrototype::finishCreation):
2208         (WebCore::JSInterfaceName::JSInterfaceName):
2209         (WebCore::JSInterfaceName::createPrototype):
2210         (WebCore::JSInterfaceName::prototype):
2211         (WebCore::JSInterfaceName::destroy):
2212         (WebCore::jsInterfaceNameConstructor):
2213         (WebCore::setJSInterfaceNameConstructor):
2214         (WebCore::JSInterfaceName::getConstructor):
2215         (WebCore::JSInterfaceName::visitChildren):
2216         (WebCore::JSInterfaceName::estimatedSize):
2217         (WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
2218         (WebCore::JSInterfaceNameOwner::finalize):
2219         (WebCore::toJSNewlyCreated):
2220         (WebCore::toJS):
2221         (WebCore::JSInterfaceName::toWrapped):
2222         * bindings/scripts/test/JS/JSInterfaceName.h: Added.
2223         (WebCore::JSInterfaceName::create):
2224         (WebCore::JSInterfaceName::createStructure):
2225         (WebCore::JSInterfaceName::finishCreation):
2226         (WebCore::wrapperOwner):
2227         (WebCore::wrapperKey):
2228         (WebCore::toJS):
2229         (WebCore::toJSNewlyCreated):
2230         * bindings/scripts/test/ObjC/DOMInterfaceName.h: Added.
2231         * bindings/scripts/test/ObjC/DOMInterfaceName.mm: Added.
2232         (-[DOMInterfaceName dealloc]):
2233         (core):
2234         (kit):
2235         * bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h: Added.
2236         * bindings/scripts/test/TestReportExtraMemoryCost.idl: Added.
2237         Include a test for the ReportExtraMemoryCost attribute.
2238
2239 2016-05-31  Alex Christensen  <achristensen@webkit.org>
2240
2241         Fix assertion after r201447
2242         https://bugs.webkit.org/show_bug.cgi?id=158244
2243
2244         Reviewed by Jer Noble.
2245
2246         * loader/cache/CachedResourceLoader.cpp:
2247         (WebCore::CachedResourceLoader::loadResource):
2248         If we are loading media using WebCoreNSURLSession, we could be making a request for a
2249         resource we already have in the memory cache because we are ignoring all caches.
2250
2251 2016-05-31  Chris Dumez  <cdumez@apple.com>
2252
2253         Clean up / modernize iOS text autosizing code
2254         https://bugs.webkit.org/show_bug.cgi?id=158217
2255
2256         Reviewed by Darin Adler.
2257
2258         Clean up / modernize iOS text autosizing code.
2259
2260         I think iOS text autosizing code is too intrusive inside the RenderStyle
2261         class but I have not updated this part of the code yet to limit patch
2262         size. This patch focuses on the TextAutoSizing.* and text autosizing
2263         code in the Document class.
2264
2265         * WebCore.xcodeproj/project.pbxproj:
2266         * dom/Document.cpp:
2267         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
2268         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
2269         Move TextAutoSizingTraits to the TextAutoSizing header to
2270         promote reuse and make the text autosizing code a little less
2271         intrusive.
2272
2273         (WebCore::Document::addAutoSizingNode):
2274         - Drop local 'key' variable as it is only used once.
2275         - Use std::make_unique<> to construct the TextAutoSizingValue
2276           as it is no longer ref-counted.
2277
2278         (WebCore::Document::validateAutoSizingNodes):
2279         Iterate over the textAutosizedNodes HashMap only once instead
2280         of twice. TextAutoSizingValue::adjustTextNodeSizes() was updated
2281         to return an enum class so we know from that value if we can
2282         remove the value from the HashSet or not, without having to rely
2283         on TextAutoSizingValue::numNodes(), which I removed in this
2284         patch.
2285
2286         (WebCore::Document::clearAutoSizingNodes):
2287         Updated the TextAutoSizingValue destructor to call reset() so
2288         we don't have to explicitly call reset() on each value before
2289         clearing the textAutosizedNodes HashMap.
2290
2291         * dom/Document.h:
2292         - Move TextAutoSizingTraits to the TextAutosizing header.
2293         - Rename resetAutosizingNodes() to clearAutoSizingNodes() as
2294           the method now only clears the textAutosizedNodes HashMap
2295           and reset() is now an implementation detail for
2296           TextAutoSizingValue.
2297
2298         * rendering/RenderElement.cpp:
2299         (WebCore::RenderElement::resetTextAutosizing):
2300         Call clearAutoSizingNodes() as it was renamed.
2301
2302         * rendering/TextAutoSizing.cpp:
2303         (WebCore::TextAutoSizingKey::TextAutoSizingKey):
2304         - Use value of -1 for std::unique_ptr m_style member for distinguishing
2305         a HashTable deleted value, instead of having an extra m_isDeleted
2306         data member for this purpose.
2307         - Take RenderStyle parameter by reference and drop the null check as the
2308           call site can never pass nullptr.
2309
2310         (WebCore::TextAutoSizingValue::addTextNode):
2311         - Rename addNode() to addTextNode() for clarity.
2312
2313         (WebCore::TextAutoSizingValue::~TextAutoSizingValue):
2314         Update destructor to call reset() so that the Document does not have to
2315         call it explicitly and can instead just clear the HashMap, which will
2316         destroy the TextAutoSizingValue objects.
2317
2318         (WebCore::TextAutoSizingValue::reset):
2319         Rename text to renderer for clarity.
2320
2321         * rendering/TextAutoSizing.h:
2322         - Make TextAutoSizingValue as fast allocated.
2323         - Update TextAutoSizingValue to no longer be refcounted as ownership is never
2324           shared. The Document owns those.
2325         - Drop the factory function for TextAutoSizingValue and make the constructor
2326           public now that the class is no longer refcounted.
2327         - Make reset() method private now that it is called from the destructor and
2328           the Document is no longer expected to explicitly call it.
2329         - Update adjustTextNodeSizes() to return a StillHasNodes enum class and the
2330           Document can rely on the determine if it can drop the TextAutoSizingValue
2331           from its HashMap (and therefore destroy the object).
2332         - Drop numNodes() method as it is no longer needed.
2333
2334
2335 2016-05-31  Dave Hyatt  <hyatt@apple.com>
2336
2337         REGRESSION(r201040): Repainting of moving overflow:hidden objects is broken.
2338         https://bugs.webkit.org/show_bug.cgi?id=158079
2339
2340         Reviewed by Zalan Bujtas.
2341
2342         Added new test fast/repaint/overflow-hidden-movement.html
2343
2344         Change checkForRepaintDuringLayout() to only be true for self-painting layers
2345         and not for all layers.
2346
2347         * rendering/RenderObject.cpp:
2348         (WebCore::RenderObject::hasSelfPaintingLayer):
2349         (WebCore::RenderObject::checkForRepaintDuringLayout):
2350         * rendering/RenderObject.h:
2351         (WebCore::RenderObject::hasSelfPaintingLayer):
2352
2353 2016-05-31  Zalan Bujtas  <zalan@apple.com>
2354
2355         ShowRenderTree: Print location information for relative/sticky inlines.
2356         https://bugs.webkit.org/show_bug.cgi?id=158235
2357
2358         Reviewed by David Hyatt.
2359
2360         * rendering/RenderObject.cpp:
2361         (WebCore::RenderObject::showRenderObject):
2362
2363 2016-05-31  Jer Noble  <jer.noble@apple.com>
2364
2365         Unreviewed build fix; use ASSERT_UNUSED rather than ASSERT to fix release builds.
2366
2367         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2368         (WebCore::MediaPlayerPrivateAVFoundationObjC::removeSession):
2369
2370 2016-05-31  Jer Noble  <jer.noble@apple.com>
2371
2372         [EME] Sound continues playing when video's src is changed
2373         https://bugs.webkit.org/show_bug.cgi?id=158233
2374
2375         Reviewed by Eric Carlson.
2376
2377         When CDMSessionAVFoundation began listening for outputObscuredDueToInsufficientExternalProtection
2378         KVO notifications, it retained the AVPlayer owned by MediaPlayerPrivateAVFoundationObjC, which
2379         caused the AVPlayer to outlive its original owner, and to continue playing even after the
2380         MediaPlayerPrivateAVFoundationObjC had been destroyed.
2381
2382         Rather than observe for outputObscuredDueToInsufficientExternalProtection changes in
2383         CDMSessionAVFoundation, add a backreference from the media player to the session, listen for changes
2384         in the player, and have the player notify the session when the value of that property changes.
2385
2386         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
2387         (WebCore::CDMSessionAVFoundationObjC::createWeakPtr):
2388         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
2389         (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
2390         (-[WebCDMSessionAVFoundationObjCListener initWithParent:player:]): Deleted.
2391         (-[WebCDMSessionAVFoundationObjCListener invalidate]): Deleted.
2392         (-[WebCDMSessionAVFoundationObjCListener observeValueForKeyPath:ofObject:change:context:]): Deleted.
2393         (WebCore::CDMSessionAVFoundationObjC::~CDMSessionAVFoundationObjC): Deleted.
2394         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2395         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2396         (WebCore::MediaPlayerPrivateAVFoundationObjC::removeSession):
2397         (WebCore::MediaPlayerPrivateAVFoundationObjC::createSession):
2398         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2399         (WebCore::playerKVOProperties):
2400         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
2401
2402 2016-05-31  Eric Carlson  <eric.carlson@apple.com>
2403
2404         [Mac] AirPlay route is sometimes reset when changing video.src
2405         https://bugs.webkit.org/show_bug.cgi?id=158226
2406         <rdar://problem/24197592>
2407
2408         Reviewed by Jer Noble.
2409
2410         Test: media/airplay-autoplay.html
2411
2412         * html/HTMLMediaElement.cpp:
2413         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Remove the gesture requirement
2414           if currently processing a user gesture.
2415         (WebCore::HTMLMediaElement::dispatchEvent): Set m_failedToPlayToWirelessTarget to false when
2416           dispatching webkitcurrentplaybacktargetiswirelesschanged so an element can succeed after failing.
2417
2418 2016-05-31  Chris Dumez  <cdumez@apple.com>
2419
2420         Regression(r201482): Crash under dispatch_semaphore_wait
2421         https://bugs.webkit.org/show_bug.cgi?id=158230
2422         <rdar://problem/26534698>
2423
2424         Reviewed by Eric Carlson.
2425
2426         Stop moving hasSessionSemaphore in the lambda capture since it is used in
2427         dispatch_semaphore_wait() call after the callOnMainThread() call.
2428
2429         No new tests, already covered by tests that are crashing on the bots.
2430
2431         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2432         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
2433
2434 2016-05-31  Brady Eidson  <beidson@apple.com>
2435
2436         Make createCrossThreadTask() functions return on the stack instead of the heap.
2437         https://bugs.webkit.org/show_bug.cgi?id=158215
2438
2439         Reviewed by Darin Adler.
2440
2441         No new tests (Refactor, no change in behavior).
2442
2443         * Modules/indexeddb/client/IDBConnectionProxy.h:
2444         
2445         * Modules/indexeddb/server/IDBServer.cpp:
2446         (WebCore::IDBServer::IDBServer::postDatabaseTask):
2447         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
2448         (WebCore::IDBServer::IDBServer::databaseRunLoop):
2449         * Modules/indexeddb/server/IDBServer.h:
2450         
2451         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2452         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
2453         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
2454         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2455         
2456         * dom/ScriptExecutionContext.h:
2457         (WebCore::ScriptExecutionContext::postCrossThreadTask):
2458         
2459         * fileapi/ThreadableBlobRegistry.cpp:
2460         (WebCore::threadableQueue):
2461
2462 2016-05-31  Dave Hyatt  <hyatt@apple.com>
2463
2464         REGRESSION (r189567): Elements with aspect ratios not handled correctly inside flexbox.
2465         https://bugs.webkit.org/show_bug.cgi?id=158040
2466
2467         Reviewed by Zalan Bujtas.
2468
2469         Added new tests in fast/flexbox.
2470
2471         * rendering/RenderFlexibleBox.cpp:
2472         (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning):
2473         (WebCore::RenderFlexibleBox::hasOrthogonalFlow):
2474         (WebCore::RenderFlexibleBox::mainAxisContentExtent):
2475         (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild):
2476         (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild):
2477         (WebCore::RenderFlexibleBox::mainAxisLengthIsDefinite):
2478         (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild):
2479         (WebCore::RenderFlexibleBox::prepareOrderIteratorAndMargins):
2480         (WebCore::RenderFlexibleBox::crossAxisLengthIsDefinite):
2481         (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):
2482         (WebCore::RenderFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax):
2483         (WebCore::RenderFlexibleBox::useChildAspectRatio):
2484         (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax):
2485         (WebCore::RenderFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis):
2486         (WebCore::RenderFlexibleBox::mainAxisOverflowForChild):
2487         (WebCore::RenderFlexibleBox::mainAxisExtentIsDefinite): Deleted.
2488         (WebCore::RenderFlexibleBox::mainAxisLengthIsIndefinite): Deleted.
2489         * rendering/RenderFlexibleBox.h:
2490         (WebCore::RenderFlexibleBox::isFlexibleBoxImpl):
2491
2492 2016-05-31  Alex Christensen  <achristensen@webkit.org>
2493
2494         Build fix after r201482.
2495
2496         * platform/network/curl/CurlDownload.cpp:
2497         (WebCore::CurlDownload::didReceiveHeader):
2498         header used to be capturedHeader, which was a StringCapture, which needed .string() to get the String.
2499         Now it's a WTF::String, so we already have the String.  Hooray for c++14!
2500
2501 2016-05-31  Sergio Villar Senin  <svillar@igalia.com>
2502
2503         Unreviewed build fix.
2504
2505         * rendering/RenderGrid.cpp:
2506         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2507         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
2508
2509 2016-05-25  Sergio Villar Senin  <svillar@igalia.com>
2510
2511         [css-grid] Empty grid without explicit tracks shouldn't have any size
2512         https://bugs.webkit.org/show_bug.cgi?id=155197
2513
2514         Reviewed by Darin Adler.
2515
2516         The internal representation of the grid is a Vector of Vector representing rows and
2517         columns. Because of that it was not possible to have columns without having at least one
2518         row. That forced us to have a 1x1 internal representation of the grid even if it was
2519         actually empty. That works for most of the cases except when the grid is actually empty.
2520
2521         By changing the way we compute the sizes we can overcome that implementation
2522         restriction. This allowed us also to thighten the conditions under we could use the
2523         GridIterator. From now on it won't be possible to use it on empty grids so callers should
2524         enforce that restriction.
2525
2526         A new bool was added to verify that placeItemsOnGrid() has been already called. The previous
2527         code was relying on the fact that there were items in the internal representation, which is
2528         wrong, as there might be no items in the grid.
2529
2530         Test: fast/css-grid-layout/empty-grid.html
2531
2532         * rendering/RenderGrid.cpp:
2533         (WebCore::RenderGrid::GridIterator::GridIterator): Added ASSERTs.
2534         (WebCore::RenderGrid::GridIterator::nextGridItem): Ditto.
2535         (WebCore::RenderGrid::GridIterator::isEmptyAreaEnough): Ditto.
2536         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): Ditto.
2537         (WebCore::RenderGrid::gridColumnCount): Use the style to resolve the number of columns if
2538         the internal representation is empty.
2539         (WebCore::RenderGrid::gridRowCount):
2540         (WebCore::RenderGrid::guttersSize): Allow to pass 0 as span, this permits using the return
2541         value of gridColumnCount|gridRowCount directly to call this method.
2542         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use m_gridIsDirty.
2543         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Do not examine the contents of grid
2544         tracks if there are no items in the grid.
2545         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2546         (WebCore::RenderGrid::placeItemsOnGrid): Set m_gridIsDirty to false.
2547         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator):
2548         (WebCore::RenderGrid::clearGrid):
2549         (WebCore::RenderGrid::populateGridPositionsForDirection):
2550         * rendering/RenderGrid.h: Moved gridColumnCount/gridRowCount to cpp file.
2551
2552 2016-05-30  Brady Eidson  <beidson@apple.com>
2553
2554         Move CrossThreadCopier/CrossThreadTask to WTF.
2555         https://bugs.webkit.org/show_bug.cgi?id=158207
2556
2557         Reviewed by Alex Christensen.
2558
2559         No new tests (Refactor, no behavior change).
2560
2561         * CMakeLists.txt:
2562         * WebCore.xcodeproj/project.pbxproj:
2563
2564         * Modules/indexeddb/IDBActiveDOMObject.h:
2565         * Modules/indexeddb/IDBValue.cpp:
2566         * Modules/indexeddb/client/IDBConnectionProxy.h:
2567         * Modules/indexeddb/server/IDBServer.cpp:
2568         * Modules/indexeddb/server/IDBServer.h:
2569         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2570         * dom/ScriptExecutionContext.h:
2571         * fileapi/ThreadableBlobRegistry.cpp:
2572         
2573         * platform/WebCoreCrossThreadCopier.cpp: Added.
2574         (WTF::WebCore::SessionID>::copy):
2575         (WTF::WebCore::ThreadSafeDataBuffer>::copy):
2576         * platform/WebCoreCrossThreadCopier.h: Added.
2577         
2578         * platform/network/cf/ResourceError.h:
2579         (WebCore::ResourceError::isolatedCopy):
2580         
2581         * platform/network/cf/ResourceRequest.h:
2582         (WebCore::ResourceRequest::isolatedCopy):
2583         
2584         * platform/network/cf/ResourceResponse.h:
2585         (WebCore::ResourceResponse::isolatedCopy):
2586
2587 2016-05-30  Per Arne Vollan  <pvollan@apple.com>
2588
2589         http/tests/websocket/tests/hybi/stop-on-resume-in-error-handler.html crashes on Windows almost all the time
2590         https://bugs.webkit.org/show_bug.cgi?id=144057
2591
2592         Reviewed by Brent Fulgham.
2593
2594         Protect SocketStreamHandle object before trying to access it on the main thread, and make sure
2595         CFWriteStreamRef parameter is valid before calling CFWriteStreamCanAcceptBytes. 
2596
2597         * platform/network/cf/SocketStreamHandleCFNet.cpp:
2598         (WebCore::SocketStreamHandle::readStreamCallback):
2599         (WebCore::SocketStreamHandle::writeStreamCallback):
2600
2601 2016-05-30  Javier Fernandez  <jfernandez@igalia.com>
2602
2603         [CSS Box Alignment] New CSS Value 'normal' for Self Alignment
2604         https://bugs.webkit.org/show_bug.cgi?id=156254
2605
2606         Reviewed by Darin Adler.
2607
2608         The Box Alignment specification defines a new value 'normal' to be used
2609         as default for the different layout models, which will define the
2610         specific behavior for each case. This patch adds a new CSS value in the
2611         parsing logic and adapts the Self Alignment properties to the new
2612         value.
2613
2614         The 'auto' value is no longer valid for the 'align-items' property and
2615         the Computed Value will be always the specified value. Hence, I removed
2616         the StyleResolver logic because is not required now; the specific
2617         behavior of the 'normal' value will be resolved at layout time.
2618
2619         Additionally, this patch updates the layout logic as well, for both
2620         Flexbox and Grid layout models.
2621
2622         Test: css3/parse-alignment-of-root-elements.html
2623
2624         * css/CSSComputedStyleDeclaration.cpp:
2625         (WebCore::resolveLegacyJustifyItems): Added.
2626         (WebCore::resolveJustifyItemsAuto): Added.
2627         (WebCore::resolveJustifySelfAuto): Added.
2628         (WebCore::resolveAlignSelfAuto): Added.
2629         (WebCore::valueForItemPositionWithOverflowAlignment): Using a StyleSelfAlignmentData argument.
2630         (WebCore::ComputedStyleExtractor::propertyValue): Using the new resolving functions.
2631         * css/CSSParser.cpp:
2632         (WebCore::CSSParser::parseItemPositionOverflowPosition): A new value 'normal' is now valid.
2633         * css/CSSPrimitiveValueMappings.h:
2634         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Mappings for the new value 'normal'.
2635         (WebCore::CSSPrimitiveValue::operator ItemPosition): Mappings for the new value 'normal'.
2636         * css/CSSPropertyNames.in:
2637         * css/StyleResolver.cpp:
2638         (WebCore::StyleResolver::adjustRenderStyle): We don't need to resolve 'legacy" keyword.
2639         * rendering/RenderBox.cpp:
2640         (WebCore::flexItemHasStretchAlignment):
2641         (WebCore::RenderBox::hasStretchedLogicalWidth):
2642         * rendering/RenderFlexibleBox.cpp:
2643         (WebCore::RenderFlexibleBox::styleDidChange):
2644         (WebCore::RenderFlexibleBox::alignmentForChild):
2645         (WebCore::contentAlignmentNormalBehaviorFlexibleBox):
2646         (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
2647         (WebCore::RenderFlexibleBox::layoutColumnReverse):
2648         (WebCore::RenderFlexibleBox::alignFlexLines):
2649         (WebCore::RenderFlexibleBox::alignChildren):
2650         * rendering/RenderGrid.cpp:
2651         (WebCore::defaultAlignmentChangedToStretchInRowAxis):
2652         (WebCore::defaultAlignmentChangedFromStretchInRowAxis):
2653         (WebCore::defaultAlignmentChangedFromStretchInColumnAxis):
2654         (WebCore::selfAlignmentChangedToStretchInRowAxis):
2655         (WebCore::selfAlignmentChangedFromStretchInRowAxis):
2656         (WebCore::selfAlignmentChangedFromStretchInColumnAxis):
2657         (WebCore::contentAlignmentNormalBehaviorGrid):
2658         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
2659         (WebCore::RenderGrid::needToStretchChildLogicalHeight):
2660         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
2661         (WebCore::RenderGrid::columnAxisPositionForChild):
2662         (WebCore::RenderGrid::rowAxisPositionForChild):
2663         (WebCore::RenderGrid::columnAxisOffsetForChild):
2664         (WebCore::RenderGrid::rowAxisOffsetForChild):
2665         (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
2666         * rendering/style/RenderStyle.cpp:
2667         (WebCore::resolvedSelfAlignment):
2668         (WebCore::RenderStyle::resolvedAlignItems):
2669         (WebCore::RenderStyle::resolvedAlignSelf):
2670         (WebCore::RenderStyle::resolvedJustifyItems):
2671         (WebCore::RenderStyle::resolvedJustifySelf):
2672         * rendering/style/RenderStyle.h:
2673         * rendering/style/RenderStyleConstants.h:
2674         * rendering/style/StyleRareNonInheritedData.cpp:
2675         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): align-items uses now a different initial function.
2676
2677 2016-05-29  Brady Eidson  <beidson@apple.com>
2678
2679         Transition various Task/Function queues from std::function to NoncopyableFunction.
2680         https://bugs.webkit.org/show_bug.cgi?id=158196
2681
2682         Reviewed by Chris Dumez.
2683
2684         No new tests (Refactor, no behavior change).
2685
2686         * dom/ActiveDOMCallbackMicrotask.cpp:
2687         (WebCore::ActiveDOMCallbackMicrotask::ActiveDOMCallbackMicrotask):
2688         * dom/ActiveDOMCallbackMicrotask.h:
2689
2690         * html/HTMLMediaElement.cpp:
2691         (WebCore::HTMLMediaElement::layoutSizeChanged):
2692
2693         * page/FrameView.cpp:
2694         (WebCore::FrameView::queuePostLayoutCallback):
2695         (WebCore::FrameView::flushPostLayoutTasksQueue):
2696         * page/FrameView.h:
2697
2698         * platform/GenericTaskQueue.cpp:
2699         (WebCore::TaskDispatcher<Timer>::postTask):
2700         (WebCore::TaskDispatcher<Timer>::dispatchOneTask):
2701         * platform/GenericTaskQueue.h:
2702         (WebCore::TaskDispatcher::postTask):
2703         (WebCore::GenericTaskQueue::enqueueTask):
2704
2705         * style/StyleTreeResolver.cpp:
2706         (WebCore::Style::postResolutionCallbackQueue):
2707         (WebCore::Style::queuePostResolutionCallback):
2708         (WebCore::Style::suspendMemoryCacheClientCalls):
2709         * style/StyleTreeResolver.h:
2710
2711 2016-05-29  Brady Eidson  <beidson@apple.com>
2712
2713         Make ScriptExecutionContext::Task work in terms of wtf::NoncopyableFunction instead of std::function.
2714         https://bugs.webkit.org/show_bug.cgi?id=158187
2715
2716         Reviewed by Chris Dumez.
2717
2718         No new tests (Refactor, no behavior change).
2719
2720         Also make postTask take an rvalue reference.
2721
2722         * bindings/js/JSDOMGlobalObjectTask.cpp:
2723         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
2724         
2725         * dom/Document.cpp:
2726         (WebCore::Document::postTask):
2727         * dom/Document.h:
2728         
2729         * dom/ScriptExecutionContext.h:
2730         (WebCore::ScriptExecutionContext::Task::Task):
2731         
2732         * workers/WorkerGlobalScope.cpp:
2733         (WebCore::WorkerGlobalScope::postTask):
2734         * workers/WorkerGlobalScope.h:
2735
2736 2016-05-28  Chris Dumez  <cdumez@apple.com>
2737
2738         Templatize NoncopyableFunction class similarly to std::function
2739         https://bugs.webkit.org/show_bug.cgi?id=158185
2740
2741         Reviewed by Darin Adler.
2742
2743         Templatize NoncopyableFunction class similarly to std::function, so
2744         that it can be used as a std::function replacement in more places.
2745
2746         Previously, NoncopyableFunction could only support "void()" lambdas.
2747
2748         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2749         (WebCore::MediaEndpointPeerConnection::runTask):
2750         * Modules/mediastream/MediaEndpointPeerConnection.h:
2751         * fileapi/AsyncFileStream.cpp:
2752         (WebCore::callOnFileThread):
2753         (WebCore::AsyncFileStream::perform):
2754         (WebCore::AsyncFileStream::getSize):
2755         (WebCore::AsyncFileStream::openForRead):
2756         (WebCore::AsyncFileStream::openForWrite):
2757         (WebCore::AsyncFileStream::write):
2758         * fileapi/AsyncFileStream.h:
2759         * page/scrolling/ScrollingThread.cpp:
2760         (WebCore::ScrollingThread::dispatch):
2761         (WebCore::ScrollingThread::dispatchBarrier):
2762         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
2763         * page/scrolling/ScrollingThread.h:
2764         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2765         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2766         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
2767         * platform/mediastream/MediaStreamPrivate.cpp:
2768         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
2769         * platform/mediastream/MediaStreamPrivate.h:
2770         * platform/mediastream/mac/AVMediaCaptureSource.h:
2771         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2772         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
2773
2774 2016-05-28  Alexey Proskuryakov  <ap@apple.com>
2775
2776         Fix the build with newer clang and other custom configuration options
2777         https://bugs.webkit.org/show_bug.cgi?id=158161
2778
2779         Reviewed by Dan Bernstein.
2780
2781         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2782         (WebCore::WebVideoFullscreenInterfaceMac::rateChanged): Added UNUSED_PARAMs for the
2783         case where this function is unimplemented.
2784         (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback): Added a non-additions
2785         version of this function.
2786         * platform/spi/cf/CFNetworkSPI.h: Silence nullability-completeness (and other) warnings.
2787         I doubt that it's practical to get these right for every SDK version at this time. Added
2788         functions for overriding HTTPS certicate behavior that we used to declare in .m files.
2789         * platform/spi/mac/AVFoundationSPI.h: Define AVAssetCache conditionally.
2790
2791 2016-05-28  Ryosuke Niwa  <rniwa@webkit.org>
2792
2793         Autocorrection makes it hard to type "doesn't" and to type @ in email addresses
2794         https://bugs.webkit.org/show_bug.cgi?id=158177
2795         <rdar://problem/20490862>
2796         <rdar://problem/24707954>
2797
2798         Reviewed by Darin Adler.
2799
2800         When the user had typed "doesn'", some unified spellchecker may try to autocorrect it to "doesn't" or "does"
2801         but we should ignore this for a moment until the next character is typed by the user. The code to deal with
2802         this situation which checks the existence of an "ambiguous boundary character" was not robust when the
2803         replacement text was longer than the corrected text.
2804
2805         Fixed this bug by fixing the logic to detect this case. Also added '@' as an ambiguous boundary character
2806         since autocorrecting letters that appear right before '@' would not be useful in many cases.
2807
2808         Tests: ManualTests/autocorrection/autocorrection-at-mark.html
2809                ManualTests/autocorrection/autocorrection-contraction-2.html
2810
2811         * editing/AlternativeTextController.cpp:
2812         (WebCore::AlternativeTextController::timerFired): Fixed a bug that we can show an empty reversion panel.
2813         * editing/Editor.cpp:
2814         (WebCore::Editor::markAndReplaceFor): When the user had typed "doesn'" and our autocorrection result is
2815         "doesn't", resultEndLocation (the end of "doesn't") is larger than selectionOffset (the end of "doesn'").
2816         When the correction is "does", resultEndLocation (the end of "does") is one less than selectionOffset.
2817         Updated the condition to deal with both of these conditions as well as cases where the correction result
2818         contains more than one letter after '.
2819         * editing/htmlediting.cpp:
2820         (WebCore::isAmbiguousBoundaryCharacter): Moved from the header file since this is not a hot function and
2821         doesn't need to be inlined everywhere. Added '@' as an ambiguous boundary character.
2822         * editing/htmlediting.h:
2823         (WebCore::isAmbiguousBoundaryCharacter): Moved to the cpp file.
2824
2825 2016-05-28  Konstantin Tokarev  <annulen@yandex.ru>
2826
2827         FileSystem: use OS(WINDOWS) instead of PLATFORM(WIN).
2828         https://bugs.webkit.org/show_bug.cgi?id=158168
2829
2830         Reviewed by Darin Adler.
2831
2832         No new tests needed.
2833
2834         * platform/FileSystem.cpp:
2835         (WebCore::lastComponentOfPathIgnoringTrailingSlash):
2836         (WebCore::MappedFileData::~MappedFileData):
2837         (WebCore::MappedFileData::MappedFileData):
2838         * platform/FileSystem.h: Removed unused PlatformFilePathSeparator
2839         constant.
2840
2841 2016-05-28  Konstantin Tokarev  <annulen@yandex.ru>
2842
2843         Use COMPILER(MSVC) instead of PLATFORM(WIN) for MSVC-specific workaround
2844         https://bugs.webkit.org/show_bug.cgi?id=158169
2845
2846         Reviewed by Darin Adler.
2847
2848         No new tests needed.
2849
2850         * platform/PlatformMouseEvent.h:
2851         * platform/win/PlatformMouseEventWin.cpp: Moved operators'
2852         implementations to PlatformMouseEvent.h
2853
2854 2016-05-27  Chris Dumez  <cdumez@apple.com>
2855
2856         callOnMainThread() should not copy captured lambda variables
2857         https://bugs.webkit.org/show_bug.cgi?id=158166
2858
2859         Reviewed by Brady Eidson.
2860
2861         callOnMainThread() should not copy captured lambda variables. This 
2862         function is usually called cross-thread with a lambda and copying
2863         the lambda (and its captured variables) can lead to thread-safety
2864         issues.
2865
2866         This patch updates callOnMainThread() to take a NoncopyableFunction&&
2867         in parameter instead of a std::function. The call sites of
2868         callOnMainThread() have also been updated to use C++14's lambda
2869         capture with initializer.
2870
2871         * Modules/indexeddb/IDBTransaction.cpp:
2872         (WebCore::IDBTransaction::putOrAddOnServer):
2873         * Modules/mediastream/MediaDevicesRequest.cpp:
2874         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
2875         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest):
2876         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2877         (WebCore::MediaEndpointPeerConnection::runTask):
2878         * Modules/mediastream/MediaEndpointPeerConnection.h:
2879         * Modules/mediastream/UserMediaRequest.cpp:
2880         (WebCore::UserMediaRequest::constraintsValidated):
2881         (WebCore::UserMediaRequest::userMediaAccessGranted):
2882         * Modules/webaudio/AudioContext.cpp:
2883         (WebCore::AudioContext::scheduleNodeDeletion):
2884         (WebCore::AudioContext::isPlayingAudioDidChange):
2885         * dom/Document.cpp:
2886         (WebCore::Document::postTask):
2887         (WebCore::Document::pendingTasksTimerFired): Deleted.
2888         * dom/ScriptElement.cpp:
2889         (WebCore::ScriptElement::requestScript):
2890         * fileapi/AsyncFileStream.cpp:
2891         (WebCore::callOnFileThread):
2892         (WebCore::AsyncFileStream::~AsyncFileStream):
2893         (WebCore::AsyncFileStream::perform):
2894         * fileapi/AsyncFileStream.h:
2895         * fileapi/ThreadableBlobRegistry.cpp:
2896         (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
2897         (WebCore::ThreadableBlobRegistry::registerBlobURL):
2898         (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
2899         (WebCore::ThreadableBlobRegistry::blobSize):
2900         (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
2901         (WebCore::ThreadableBlobRegistry::registerBlobURLOptionallyFileBacked): Deleted.
2902         * loader/icon/IconDatabase.cpp:
2903         (WebCore::IconDatabase::dispatchDidImportIconURLForPageURLOnMainThread):
2904         (WebCore::IconDatabase::dispatchDidImportIconDataForPageURLOnMainThread):
2905         * page/ResourceUsageThread.cpp:
2906         (WebCore::ResourceUsageThread::notifyObservers):
2907         (WebCore::ResourceUsageThread::threadBody):
2908         * page/ResourceUsageThread.h:
2909         * page/scrolling/ScrollingThread.cpp:
2910         (WebCore::ScrollingThread::dispatch):
2911         (WebCore::ScrollingThread::dispatchBarrier):
2912         (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread):
2913         * page/scrolling/ScrollingThread.h:
2914         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2915         (WebCore::ScrollingTreeIOS::invalidate):
2916         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
2917         (WebCore::ScrollingTreeIOS::currentSnapPointIndicesDidChange):
2918         (WebCore::ScrollingTreeIOS::createScrollingTreeNode): Deleted.
2919         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2920         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread):
2921         * platform/MemoryPressureHandler.cpp:
2922         (WebCore::MemoryPressureHandler::releaseMemory):
2923         * platform/audio/ios/MediaSessionManagerIOS.mm:
2924         (-[WebMediaSessionHelper dealloc]):
2925         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
2926         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]):
2927         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2928         (WebCore::AudioSourceProviderAVFObjC::prepare):
2929         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2930         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
2931         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
2932         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
2933         (-[WebCDMSessionAVFoundationObjCListener observeValueForKeyPath:ofObject:change:context:]):
2934         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2935         (-[WebAVOutputDeviceMenuControllerHelper observeValueForKeyPath:ofObject:change:context:]):
2936         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2937         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
2938         (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
2939         (-[WebCoreAVFMovieObserver outputSequenceWasFlushed:]):
2940         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
2941         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):
2942         (-[WebCoreAVFLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
2943         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2944         (WebCore::CMTimebaseEffectiveRateChangedCallback):
2945         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
2946         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
2947         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2948         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2949         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
2950         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2951         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
2952         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
2953         (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]):
2954         (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
2955         (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
2956         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
2957         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
2958         (-[WebAVSampleBufferErrorListener layerFailedToDecode:]):
2959         * platform/graphics/cg/GraphicsContextCG.cpp:
2960         (WebCore::patternReleaseCallback):
2961         * platform/graphics/cg/PatternCG.cpp:
2962         (WebCore::patternReleaseCallback):
2963         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2964         (WebCore::MediaPlayerPrivateMediaFoundation::endCreatedMediaSource):
2965         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
2966         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
2967         * platform/mediastream/MediaStreamPrivate.cpp:
2968         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
2969         * platform/mediastream/MediaStreamPrivate.h:
2970         * platform/mediastream/mac/AVMediaCaptureSource.h:
2971         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2972         (WebCore::AVMediaCaptureSource::scheduleDeferredTask):
2973         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2974         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources):
2975         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2976         (WebCore::WebAudioSourceProviderAVFObjC::prepare):
2977         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2978         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources):
2979         * platform/network/BlobResourceHandle.cpp:
2980         (WebCore::BlobResourceHandle::start):
2981         (WebCore::BlobResourceHandle::notifyFinish):
2982         * platform/network/DataURLDecoder.cpp:
2983         (WebCore::DataURLDecoder::decode):
2984         * platform/network/DataURLDecoder.h:
2985         * platform/network/cocoa/WebCoreNSURLSession.mm:
2986         (-[WebCoreNSURLSession dealloc]):
2987         (-[WebCoreNSURLSessionDataTask cancel]):
2988         (-[WebCoreNSURLSessionDataTask suspend]):
2989         (-[WebCoreNSURLSessionDataTask resume]):
2990         * platform/network/curl/CurlDownload.cpp:
2991         (WebCore::CurlDownload::didReceiveHeader):
2992         (WebCore::CurlDownload::didReceiveData): Deleted.
2993
2994 2016-05-27  Tim Horton  <timothy_horton@apple.com>
2995
2996         REGRESSION (r190574): Swipe snapshots are always black on iPhone 5
2997         https://bugs.webkit.org/show_bug.cgi?id=158171
2998         <rdar://problem/24639709>
2999
3000         Reviewed by Beth Dakin.
3001
3002         * platform/graphics/cocoa/IOSurface.mm:
3003         (optionsForBiplanarSurface):
3004         (optionsFor32BitSurface):
3005         (IOSurface::IOSurface):
3006         (IOSurface::format):
3007         We are supposed to be using bi-planar 422f, not yuvf. They're the same
3008         size, but different formats, and 422f is supported in more places.
3009
3010         Clean up the IOSurface constructor so we don't have a switch inside an if
3011         with random ASSERT_NOT_REACHED, making helper functions to build the
3012         options dictionary for arbitrary-size biplanar and 32-bit single-planar
3013         surfaces.
3014
3015         I don't know how to write a test because IOSurface is not supported
3016         in the simulator.
3017
3018 2016-05-27  Zalan Bujtas  <zalan@apple.com>
3019
3020         EventHandler finds incorrect scrollable container.
3021         https://bugs.webkit.org/show_bug.cgi?id=158132
3022         <rdar://problem/26423126>
3023
3024         Reviewed by Brent Fulgham.
3025
3026         Fix the logic that checks whether we are at the beginning or at the end of the container (horizontally).
3027         While scrolling to the right, deltaX has negative values. So in case of deltaX < 0, we need to check if
3028         the container is not scrolled all the way to the right.
3029
3030         Test: fast/scrolling/scroll-container-horizontally.html
3031
3032         * page/mac/EventHandlerMac.mm:
3033         (WebCore::findEnclosingScrollableContainer):
3034
3035 2016-05-27  Jeremy Jones  <jeremyj@apple.com>
3036
3037         Decrease flicker when changing video presentation mode.
3038         https://bugs.webkit.org/show_bug.cgi?id=158148
3039         rdar://problem/24476949
3040
3041         Reviewed by Jer Noble.
3042
3043         No new tests because there is no behavior change. This change is about the timing of
3044         moving AVPlayerLayers between layers to prevent flicker.
3045
3046         1) Moving an AVPlayerLayer between CAContexts can flicker. So always keep two
3047         AVPlayerLayers around and add and remove them from the inline and fullscreen contexts.
3048         2) Wait to show the inline placeholder until the fullscreen video layer has been installed.
3049         3) Wait to remove the fullscreen video layer until the placeholder has been removed.
3050
3051         * Modules/mediacontrols/MediaControlsHost.cpp:
3052         (WebCore::MediaControlsHost::isVideoLayerInline): Expose isVideoLayerInline to the shadow DOM.
3053         (WebCore::MediaControlsHost::setPreparedForInline): Expose setPreparedForInline to the shadow DOM.
3054         * Modules/mediacontrols/MediaControlsHost.h: Add setPreparedForInline and isVideoLayerInline
3055         * Modules/mediacontrols/MediaControlsHost.idl: Add setPreparedForInline and isVideoLayerInline
3056         * Modules/mediacontrols/mediaControlsApple.js:
3057         (Controller.prototype.showInlinePlaybackPlaceholderWhenSafe): Wait to show placeholder when entering fullscreen.
3058         (Controller.prototype.handlePresentationModeChange): Wait to show placeholder, and notify when placeholder is removed.
3059         * html/HTMLMediaElement.cpp:
3060         (WebCore::HTMLMediaElement::setPreparedForInline):
3061         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen): Used to delay fullscreen cleanup until placeholder is removed.
3062         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add a callback so we can wait until this completes before continuing.
3063         * html/HTMLMediaElement.h:
3064         (WebCore::HTMLMediaElement::isVideoLayerInline):
3065         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
3066         (WebCore::HTMLMediaElement::setVideoFullscreenLayer): Add completionHandler.
3067         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
3068         (WebCore::WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler.
3069         (WebCore::WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen): Added.
3070         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3071         (WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer): Add completionHandler.
3072         (WebVideoFullscreenModelVideoElement::waitForPreparedForInlineThen):
3073         * platform/graphics/MediaPlayer.cpp:
3074         (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler.
3075         * platform/graphics/MediaPlayer.h:
3076         (WebCore::MediaPlayer::setVideoFullscreenLayer): Add completionHandler.
3077         * platform/graphics/MediaPlayerPrivate.h:
3078         (WebCore::MediaPlayerPrivateInterface::setVideoFullscreenLayer): Add completionHandler.
3079         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3080         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3081         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Create two video layers.
3082         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer): Allow two video layers.
3083         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer): Add completionHandler.
3084         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity): Allow two video layers.
3085         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3086         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3087         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addDisplayLayer): Allow two video layers.
3088         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer): Add completionHandler.
3089         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3090         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3091         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createPreviewLayers): Allow two video layers.
3092         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer): Add completionHandler.
3093         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h:
3094         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3095         (WebCore::VideoFullscreenLayerManager::setVideoLayers): Allow two video layers.
3096         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Add completionHandler.
3097         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenFrame): Allow two video layers.
3098         (WebCore::VideoFullscreenLayerManager::didDestroyVideoLayer): Allow two video layers.
3099         (WebCore::VideoFullscreenLayerManager::setVideoLayer): Deleted.
3100         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3101         (WebVideoFullscreenControllerContext::didSetupFullscreen): Use completionHandler. 
3102         (WebVideoFullscreenControllerContext::didExitFullscreen): Use completionHandler.
3103
3104 2016-05-26  Ryosuke Niwa  <rniwa@webkit.org>
3105
3106         Crash in TreeScope::focusedElement
3107         https://bugs.webkit.org/show_bug.cgi?id=158108
3108
3109         Reviewed by Enrica Casucci.
3110
3111         The bug was caused by a flawed sequence of steps we took to remove an element. When an element is removed,
3112         willRemoveChild and willRemoveChildren fire blur events on removed focused element and its ancestors and
3113         unload event on any removed iframes. However, it was possible to focus an element on which we had fired blur
3114         during an unload event, leaving m_focusedElement point to an element that's not in the document anymore.
3115
3116         Changing the order doesn't help because that would make it possible to insert the removed iframes back into
3117         the document inside a event listener of the blur event, which was specifically fixed by r127534 four years ago.
3118
3119         Instead, fix the bug by not firing blur and change events on removed nodes. New behavior matches Firefox and HTML5
3120         specification: https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule-one
3121
3122         Test: fast/shadow-dom/shadow-root-active-element-crash.html
3123
3124         * dom/ContainerNode.cpp:
3125         (WebCore::willRemoveChild): Made this function static local since it didn't need to have access to any private
3126         member variables. Call Document::nodeWillBeRemoved after disconnecting iframes since unload event handler could
3127         allocate new Ranges just like mutation events.
3128         (WebCore::willRemoveChildren): Ditto.
3129         (WebCore::ContainerNode::removeChild): Removed the calls to removeFullScreenElementOfSubtree and
3130         removeFocusedNodeOfSubtree as they're now called in Document::nodeWillBeRemoved.
3131         (WebCore::ContainerNode::removeChildren): Ditto.
3132         * dom/ContainerNode.h:
3133         * dom/Document.cpp:
3134         (WebCore::Document::removeFocusedNodeOfSubtree): Don't dispatch blur and change events when a node is removed.
3135         (WebCore::Document::setFocusedElement): Added FocusRemovalEventsMode as the third argument. Avoid dispatching blur
3136         and change events when FocusRemovalEventsMode::Dispatch is set.
3137         (WebCore::Document::nodeChildrenWillBeRemoved): Added calls to removeFullScreenElementOfSubtree and
3138         removeFocusedNodeOfSubtree. Also assert that no events are fired within this function. If we ever fire an event here,
3139         "unloaded" iframes can be inserted back into a document before ContainerNode::removeChild actually removes them.
3140         (WebCore::Document::nodeWillBeRemoved): Ditto.
3141         * dom/Document.h:
3142         * dom/TreeScope.cpp:
3143         (WebCore::TreeScope::focusedElement): Added a release assertion to make sure the focused element is in the document
3144         of the tree scope, and added an explicit type check just in case.
3145
3146 2016-05-27  Brent Fulgham  <bfulgham@apple.com>
3147
3148         CSP: Fire 'load' events even when blocking loads via 'frame-src'.
3149         https://bugs.webkit.org/show_bug.cgi?id=153150
3150         <rdar://problem/24383162>
3151
3152         Reviewed by Daniel Bates.
3153
3154         Always fire a load event, even when the load is blocked by CSP rules, so that
3155         attackers cannot gain knowledge about the URL in the frame by blocking the
3156         load and waiting long enough to be sure that a 'load' event would have
3157         fired if the load wasn't blocked.
3158
3159         Inspired by Blink patch:
3160         <https://src.chromium.org/viewvc/blink?view=rev&revision=165743>
3161
3162         Tests: http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html
3163
3164         * loader/PolicyChecker.cpp:
3165         (WebCore::PolicyChecker::checkNavigationPolicy):
3166
3167 2016-05-27  Andreas Kling  <akling@apple.com>
3168
3169         Document abandons its EventTargetData.
3170         <https://webkit.org/b/158158>
3171
3172         Reviewed by Darin Adler.
3173
3174         Node::willBeDeletedFrom() is called when destroying all Node types *except* Document.
3175         If a Document had an associated EventTargetData, it would not get cleaned up.
3176
3177         This patch moves the EventTargetData cleanup to ~Node() where it's guaranteed to run.
3178
3179         * dom/Node.cpp:
3180         (WebCore::Node::~Node):
3181         (WebCore::Node::willBeDeletedFrom):
3182
3183 2016-05-27  Ryan Haddad  <ryanhaddad@apple.com>
3184
3185         Attempt to fix the iOS build.
3186
3187         Unreviewed build fix.
3188
3189         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3190         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3191         (-[WebAVPlayerLayer layoutSublayers]):
3192
3193 2016-05-27  Brady Eidson  <beidson@apple.com>
3194
3195         Modern IDB: After closing a Netflix video, trying to watch it again fails.
3196         <rdar://problem/25092473> and https://bugs.webkit.org/show_bug.cgi?id=158160
3197
3198         Reviewed by Alex Christensen.
3199
3200         New APITest: IndexedDB.WebProcessKillIDBCleanup
3201
3202         * Modules/indexeddb/IDBTransaction.cpp:
3203         (WebCore::IDBTransaction::stop):
3204         
3205         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3206         (WebCore::IDBServer::UniqueIDBDatabase::connectionClosedFromClient): All active transactions need to be aborted
3207           (without callback, since there's no connection to callback to).
3208         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
3209
3210 2016-05-27  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3211
3212         WebRTC: Update RTCPeerConnection overloaded legacy operations to return a Promise
3213         https://bugs.webkit.org/show_bug.cgi?id=158114
3214
3215         Reviewed by Eric Carlson.
3216
3217         Update overloaded operations so that the legacy callback versions also return a promise
3218         and never throw [1].
3219
3220         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#legacy-interface-extensions
3221
3222         Updated existing tests.
3223         - fast/mediastream/RTCPeerConnection-overloaded-operations-params.html
3224         - fast/mediastream/RTCPeerConnection-overloaded-operations.html
3225
3226         * Modules/mediastream/RTCPeerConnection.idl:
3227         Updated legacy signatures (just for documentation purposes)
3228         * Modules/mediastream/RTCPeerConnection.js:
3229         Implements the promise overload and the legacy callbacks overload (using the promise version)
3230         as specified in [1] (above).
3231         (createOffer):
3232         (createAnswer):
3233         (setLocalDescription):
3234         (setRemoteDescription):
3235         (addIceCandidate):
3236         (getStats):
3237         * Modules/mediastream/RTCPeerConnectionInternals.js:
3238         Added helper functions objectAndCallbacksOverload and callbacksAndDictionaryOverload that
3239         process an argument list and determine which overloaded version to use.
3240         (callbacksAndDictionaryOverload):
3241         (setLocalOrRemoteDescription): Deleted.
3242         (extractCallbackArg): Deleted.
3243
3244 2016-05-27  Antoine Quint  <graouts@apple.com>
3245
3246         Video play glyph not visible if initially invisible when contained in a "-webkit-overflow-scrolling: touch" container
3247         https://bugs.webkit.org/show_bug.cgi?id=158146
3248         <rdar://problem/25816307>
3249
3250         Reviewed by Dean Jackson.
3251
3252         We now force the <video> controls play glyph into being composited due to webkit.org/b/158147. In most scenarios,
3253         this element gets composited anyway, this is just to ensure that this happens in all cases until we get the
3254         general fix for webkit.org/b/158147.
3255
3256         Test: platform/ios-simulator/media/video-play-glyph-composited-outside-overflow-scrolling-touch-container.html
3257
3258         * Modules/mediacontrols/mediaControlsiOS.css:
3259         (video::-webkit-media-controls-start-playback-button .webkit-media-controls-start-playback-glyph):
3260
3261 2016-05-26  Yoav Weiss  <yoav@yoav.ws>
3262
3263         Preload single download tests.
3264         https://bugs.webkit.org/show_bug.cgi?id=157988
3265
3266         Reviewed by Alex Christensen.
3267
3268         ResourceTiming entries for some subresource weren't registered as resource->response().isHTTP() was false, since
3269         resource->response().url() was empty. I switched the check to use resource->resourceRequest().url() directly instead.
3270
3271         Test: http/tests/preload/single_download_preload_runner.html
3272
3273         * loader/ResourceTimingInformation.cpp:
3274         (WebCore::ResourceTimingInformation::addResourceTiming):
3275
3276 2016-05-26  Nan Wang  <n_wang@apple.com>
3277
3278         AX: Wrong CharacterOffset from VisiblePosition with composed characters
3279         https://bugs.webkit.org/show_bug.cgi?id=158138
3280
3281         Reviewed by Chris Fleizach.
3282
3283         The conversion logic is not correct when the text node contains composed characters. 
3284         We should use VisiblePosition's offset directly for text nodes so we won't mess things up.
3285
3286         Test: accessibility/mac/character-offset-visible-position-conversion-with-emoji.html
3287
3288         * accessibility/AXObjectCache.cpp:
3289         (WebCore::AXObjectCache::visiblePositionFromCharacterOffset):
3290         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
3291
3292 2016-05-26  Darin Adler  <darin@apple.com>
3293
3294         Media queries and platform screen modernization and streamlining
3295         https://bugs.webkit.org/show_bug.cgi?id=158067
3296
3297         Reviewed by Alex Christensen.
3298
3299         * bindings/objc/DOM.mm:
3300         (-[DOMHTMLLinkElement _mediaQueryMatches]): Use references, use fastGetAttribute,
3301         pass a document instead of a frame to the media query evaluator and a reference instead
3302         of a pointer.
3303
3304         * css/CSSGrammar.y.in: Use "expression" instead of "exp" for media query expressions.
3305         Update vectors and arguments to move media query expressions instead of using unique_ptr.
3306
3307         * css/CSSImportRule.h: Use pragma once. Removed unneeded forward declarations.
3308         Made more overrides private and marked them final.
3309
3310         * css/CSSParser.cpp:
3311         (WebCore::CSSParser::SourceSize::SourceSize): Added missing WTFMove to avoid reference
3312         count churn. Changed type of expression to no longer use unique_ptr.
3313         (WebCore::CSSParser::sourceSize): Ditto.
3314
3315         * css/CSSParser.h: Changed SourceSize::expression to no longer use unique_ptr.
3316         Also changed SourceSize::length to be Ref instead of RefPtr.
3317
3318         * css/DocumentRuleSets.cpp:
3319         (WebCore::DocumentRuleSets::appendAuthorStyleSheets): Updated for changes to
3320         MediaQueryEvaluator.
3321
3322         * css/MediaFeatureNames.cpp:
3323         (WebCore::MediaFeatureNames::init): Streamlined a bit. Removed "MediaFeature" suffix from
3324         names of media feature strings.
3325
3326         * css/MediaFeatureNames.h: Use pragma once. Changed media feature name globals
3327         to use normal WebKit naming style instead of all lowercase with underscores.
3328         Sorted alphabetically. Removed "MediaFeature" suffix from names of media feature strings.
3329
3330         * css/MediaList.cpp:
3331         (WebCore::MediaQuerySet::MediaQuerySet): Simplified copy constructor since the queries
3332         vector can now be copied normally.
3333         (WebCore::parseMediaDescriptor): Normalized types and changed to use isASCIIAlphanumeric.
3334         The old code was not handling '0' the way the comment said it did.
3335         (WebCore::MediaQuerySet::internalParse): Added. Helper function to cut down on redundant
3336         code in functions below.
3337         (WebCore::MediaQuerySet::parse): Use stripLeadingAndTrailingHTMLSpaces instead of
3338         stripWhiteSpace. Streamlined logic using helper function. Updated to use a vector of
3339         queries instead of a vector of unique_ptr.
3340         (WebCore::MediaQuerySet::add): Use internalParse.
3341         (WebCore::MediaQuerySet::remove): Ditto.
3342         (WebCore::MediaQuerySet::addMediaQuery): Changed argument type to not be unique_ptr.
3343         (WebCore::MediaQuerySet::mediaText): Use modern for loop.
3344         (WebCore::MediaList::MediaList): Initialize pointers to null in the class definition
3345         rather than in these constructors.
3346         (WebCore::MediaList::setMediaText): Removed unhelpful local variable.
3347         (WebCore::MediaList::item): Updated since queries no longer use unique_ptr.
3348         (WebCore::addResolutionWarningMessageToConsole): Changed argument types to references
3349         instead of pointers with assertions.
3350         (WebCore::reportMediaQueryWarningIfNeeded): Updated to modernize.
3351
3352         * css/MediaList.h: Use pragma once. Removed unneeded includes and forward declarations.
3353         Changed vector to contain media queries instead of unique_ptr. Use nullptr instead of 0.
3354         Initialize pointers to null here.
3355
3356         * css/MediaQuery.cpp: Deleted now-unneeded copy constructor and destructor. Both are
3357         correctly generated without us writing them explicitly.
3358         (WebCore::MediaQuery::serialize): Rewrote to streamline.
3359         (WebCore::MediaQuery::MediaQuery): Updates since expressions are no longer unique_ptr.
3360         (WebCore::MediaQuery::cssText): Changed return type to reference.
3361
3362         * css/MediaQuery.h: Use pragma once. Added include since this now includes media query
3363         expressions, not just unique_ptr. Deleted the unneeded copy function.
3364
3365         * css/MediaQueryEvaluator.cpp:
3366         (WebCore::isViewportDependent): Moved this here. It used to be a member function of
3367         MediaQueryExp, but this file has a lot more functions about specific features and how
3368         they are evaluated, so it really belongs here.
3369         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): Changed constructor to take a
3370         document instead of a frame. Initialize the fallback result in the class definition.
3371         (WebCore::MediaQueryEvaluator::evaluate): Changed the argument type to a reference.
3372         (WebCore::compareValue): Made both of the arguments separate template types. This
3373         helps us compare an integer to a double without lots of type casts.
3374         (WebCore::compareAspectRatioValue): Changed to use early return style and got rid of
3375         the casts to int so we will do the work in double instead.
3376         (WebCore::doubleValue): Replaced the old numberValue function with this. Since values
3377         are stored as doubles, it's much better to use double rather than float.
3378         (WebCore::zeroEvaluate): Added. Helpful for the many functions that just need to
3379         evaluate as 0.
3380         (WebCore::oneEvaluate): Ditto.
3381         (WebCore::colorEvaluate): Renamed this and all the functions below. Simplified the logic
3382         to use the new doubleValue function.
3383         (WebCore::colorIndexEvaluate): Use zeroEvaluate.
3384         (WebCore::colorGamutEvaluate): No longer use page just to get from the frame to the
3385         main frame.
3386         (WebCore::monochromeEvaluate): Simplify logic using zeroEvaluate.
3387         (WebCore::invertedColorsEvaluate): Use auto for the keyword; easier to read.
3388         (WebCore::orientationEvaluate): Use early return style.
3389         (WebCore::aspectRatioEvaluate): Ditto.
3390         (WebCore::deviceAspectRatioEvaluate): Simplified logic and removed type casts.
3391         (WebCore::evaluateResolution): Added a couple null checks.
3392         (WebCore::devicePixelRatioEvaluate): Renamed. Added missing type check.
3393         (WebCore::resolutionEvaluate): Ditto.
3394         (WebCore::gridEvaluate): Use zeroEvaluate.
3395         (WebCore::computeLength): Added a null check.
3396         (WebCore::deviceHeightEvaluate): Use early return.
3397         (WebCore::deviceWidthEvaluate): Ditto.
3398         (WebCore::heightEvaluate): Ditto.
3399         (WebCore::widthEvaluate): Ditto.
3400         (WebCore::minColorEvaluate): Updated name only.
3401         (WebCore::maxColorEvaluate): Ditto.
3402         (WebCore::minColorIndexEvaluate): Ditto.
3403         (WebCore::maxColorIndexEvaluate): Ditto.
3404         (WebCore::minMonochromeEvaluate): Ditto.
3405         (WebCore::maxMonochromeEvaluate): Ditto.
3406         (WebCore::minAspectRatioEvaluate): Ditto.
3407         (WebCore::maxAspectRatioEvaluate): Ditto.
3408         (WebCore::minDeviceAspectRatioEvaluate): Ditto.
3409         (WebCore::maxDeviceAspectRatioEvaluate): Ditto.
3410         (WebCore::minDevicePixelRatioEvaluate): Ditto.
3411         (WebCore::maxDevicePixelRatioEvaluate): Ditto.
3412         (WebCore::minHeightEvaluate): Ditto.
3413         (WebCore::maxHeightEvaluate): Ditto.
3414         (WebCore::minWidthEvaluate): Ditto.
3415         (WebCore::maxWidthEvaluate): Ditto.
3416         (WebCore::minDeviceHeightEvaluate): Ditto.
3417         (WebCore::maxDeviceHeightEvaluate): Ditto.
3418         (WebCore::minDeviceWidthEvaluate): Ditto.
3419         (WebCore::maxDeviceWidthEvaluate): Ditto.
3420         (WebCore::minResolutionEvaluate): Ditto.
3421         (WebCore::maxResolutionEvaluate): Ditto.
3422         (WebCore::animationEvaluate): Use oneEvaluate.
3423         (WebCore::transitionEvaluate): Ditto.
3424         (WebCore::transform2dEvaluate): Ditto.
3425         (WebCore::transform3dEvaluate): Simplify using zeroEvaluate and oneEvaluate.
3426         (WebCore::viewModeEvaluate): Simplified logic with fewer local variables and the name "keyword".
3427         (WebCore::videoPlayableInlineEvaluate): Use reference.
3428         (WebCore::hoverEvaluate): Simplify using keyword.
3429         (WebCore::anyHoverEvaluate): Just updated name.
3430         (WebCore::pointerEvaluate): Simplify using keyword.
3431         (WebCore::anyPointerEvaluate): Just updated name.
3432         (WebCore::add): Added. Helper for building up the media query function map.
3433         (WebCore::MediaQueryEvaluator::evaluate): Moved code to build the function map in here in
3434         a lambda, rather than having it in a separate global function.
3435
3436         * css/MediaQueryEvaluator.h: Use pragma once. Removed uneeded includes. Simplified comments and
3437         modernized their style.
3438
3439         * css/MediaQueryExp.cpp:
3440         (WebCore::isFeatureValidWithIdentifier): Renamed to make it clearer what this does. Updated
3441         to take a reference and use te new feature names.
3442         (WebCore::isFeatureValidWithNonNegativeLengthOrNumber): Ditto.
3443         (WebCore::isFeatureValidWithDensity): Ditto.
3444         (WebCore::isFeatureValidWithNonNegativeInteger): Ditto.
3445         (WebCore::isFeatureValidWithNonNegativeNumber): Ditto.
3446         (WebCore::isFeatureValidWithZeroOrOne): Ditto.
3447         (WebCore::isAspectRatioFeature): Ditto.
3448         (WebCore::isFeatureValidWithoutValue): Ditto.
3449         (WebCore::isFeatureValidWithNumberWithUnit): Added. Helper that calls multiple functions above.
3450         (WebCore::isFeatureValidWithNumber): Ditto.
3451         (WebCore::isSlash): Added. Helper to make aspect ratio code below easier to read.
3452         (WebCore::isPositiveIntegerValue): Ditto.
3453         (WebCore::MediaQueryExpression::MediaQueryExpression): Rearranged code to be much less wordy and
3454         to not use current/next.
3455
3456         * css/MediaQueryExp.h: Use pragma once. Renamed class to MediaQueryExpression. Removed
3457         the isViewportDependent function, now part of MediaQueryEvaluator. Removed unneeded includes.
3458
3459         * css/MediaQueryList.cpp:
3460         (WebCore::MediaQueryList::MediaQueryList): Marked this inline. Use a reference and a Ref&&
3461         instead of PassRefPtr.
3462         (WebCore::MediaQueryList::create): Updated argument types.
3463         (WebCore::MediaQueryList::addListener): Updated argument type and use releaseNonNull.
3464         (WebCore::MediaQueryList::removeListener): Updated argument types.
3465         (WebCore::MediaQueryList::evaluate): Ditto.
3466         (WebCore::MediaQueryList::matches): More of the same.
3467
3468         * css/MediaQueryList.h: Use pragma once. Changed types to use references, RefPtr&& and Ref&&.
3469
3470         * css/MediaQueryMatcher.cpp:
3471         (WebCore::MediaQueryMatcher::MediaQueryMatcher): Take a reference.
3472         (WebCore::MediaQueryMatcher::documentDestroyed): Use nullptr.
3473         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle): Use auto.
3474         (WebCore::MediaQueryMatcher::evaluate): Take a reference. Updated for changes to MediaQueryEvaluator.
3475         (WebCore::MediaQueryMatcher::matchMedia): Updated for above changes.
3476         (WebCore::MediaQueryMatcher::addListener): Use Ref&& and reference for arguments. Simplify code.
3477         (WebCore::MediaQueryMatcher::removeListener): Ditto.
3478         (WebCore::MediaQueryMatcher::styleResolverChanged): Moved the logic for evaluating each query here.
3479         Updated for changes to MediaQueryEvaluator.
3480
3481         * css/MediaQueryMatcher.h: Use pragma once. Changed create to take a reference. Tightened argument
3482         types for addListener and removeListener. Made the private Listener a simple struct rather than a
3483         class. Initialized m_evaluationRound.
3484
3485         * css/RuleSet.cpp:
3486         (WebCore::RuleSet::addChildRules): Updated for changes to MediaQueryEvaluator.
3487         (WebCore::RuleSet::addRulesFromSheet): Ditto.
3488
3489         * css/SourceSizeList.cpp:
3490         (WebCore::match): Updated to use MediaQueryEvaluator in a simpler way.
3491         (WebCore::defaultLength): Use a reference and simpler syntax.
3492         (WebCore::computeLength): Ditto.
3493         (WebCore::parseSizesAttribute): Changed arguments to take a Document instead of both a
3494         RenderView and a Frame.
3495
3496         * css/SourceSizeList.h: Use #pragma once. Change parseSizesAttribute to take a Document.
3497
3498         * css/StyleMedia.cpp:
3499         (WebCore::StyleMedia::matchMedium): Update for changes to MediaQueryEvaluator.
3500
3501         * css/StyleResolver.cpp:
3502         (WebCore::StyleResolver::StyleResolver): Use a MediaQueryEvaluator instead of a unique_ptr
3503         to one.
3504         (WebCore::StyleResolver::appendAuthorStyleSheets): Ditto.
3505         (WebCore::StyleResolver::styleForElement): Ditto.
3506         (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
3507         (WebCore::StyleResolver::pseudoStyleRulesForElement): Ditto.
3508         (WebCore::StyleResolver::addViewportDependentMediaQueryResult): Use references instead of
3509         ponters, and use a vector of MediaQueryResult instead of unique_ptr.
3510         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange): Use a modern for loop.
3511
3512         * css/StyleResolver.h: Use a MediaQueryEvaluator instead of a unique_ptr to one.
3513         Use a vector of MediaQueryResult instead of a vector of unique_ptr.
3514
3515         * dom/Document.cpp:
3516         (WebCore::Document::mediaQueryMatcher): Pass a reference instead of a pointer.
3517
3518         * dom/InlineStyleSheetOwner.cpp:
3519         (WebCore::InlineStyleSheetOwner::createSheet): Updated for changes to MediaQueryEvaluator.
3520
3521         * editing/TextIterator.cpp:
3522         (WebCore::SimplifiedBackwardsTextIterator::advance): Removed a stray space (unrelated to
3523         the rest of the patch).
3524
3525         * html/HTMLImageElement.cpp:
3526         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Updated for changes to the
3527         MediaQueryEvaluator class. Also use auto a bit more and eliminated a double hash table
3528         lookup in code that used hasAttribute followed by fastGetAttribute.
3529         (WebCore::HTMLImageElement::selectImageSource): Updated for changes to parseSizesAttribute.
3530
3531         * html/HTMLLinkElement.cpp:
3532         (WebCore::HTMLLinkElement::process): Updated for changes to MediaQueryEvaluator.
3533         (WebCore::HTMLLinkElement::setCSSStyleSheet): Use auto.
3534
3535         * html/HTMLMediaElement.cpp:
3536         (WebCore::HTMLMediaElement::selectNextSourceChild): Updated for changes to MediaQueryEvaluator.
3537
3538         * html/HTMLPictureElement.cpp:
3539         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture): Updated for changes to
3540         MediaQueryEvaluator.
3541
3542         * html/HTMLPictureElement.h: Use #pragma once. Changed viewport dependent media query results
3543         vector to be a vector of results, not of unique_ptr.
3544
3545         * html/parser/HTMLPreloadScanner.cpp:
3546         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): Updated for changes to
3547         parseSizesAttribute.
3548         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Updated for changes to
3549         MediaQueryEvaluator.
3550
3551         * html/parser/HTMLResourcePreloader.cpp:
3552         (WebCore::mediaAttributeMatches): Updated for changes to MediaQueryEvaluator.
3553         (WebCore::HTMLResourcePreloader::preload): Ditto.
3554
3555         * page/DOMWindow.cpp: Removed unneeded include of PlatformScreen.h.
3556
3557         * page/mac/EventHandlerMac.mm:
3558         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll): Simplified code and
3559         updated for changes to PlatformScreenMac functions.
3560
3561         * platform/PlatformScreen.h: Use #pragma once. Use using instad of typedef. Put the typedef
3562         for PlatformDisplayID inside the WebCore namespace. Removed the typedef for ColorProfile.
3563         Renamed the functions that find a screen to just "screen".
3564
3565         * platform/graphics/DisplayRefreshMonitorClient.cpp:
3566         (WebCore::DisplayRefreshMonitorClient::DisplayRefreshMonitorClient): Moved initialization
3567         of booleans to the class definition.
3568
3569         * platform/graphics/DisplayRefreshMonitorClient.h: Use pragma once. Removed unneeded
3570         forward declarations. Changed display ID data member to be an Optional instead of a boolean
3571         paired with another data member.
3572
3573         * platform/graphics/GraphicsLayerUpdater.h: Use pragma once. Removed unneeded include of
3574         PlatformScreen.h.
3575
3576         * platform/image-decoders/ImageDecoder.h: Use pragma once. Moved ColorProfile here from
3577         PlatformScreen.h, since it's not used there. and is used here.
3578
3579         * platform/mac/PlatformEventFactoryMac.h: Use parma once. Changed reutrn type of the
3580         globalPoint function to NSPoint. Tweaked comments and formatting a bit.
3581
3582         * platform/mac/PlatformEventFactoryMac.mm:
3583         (WebCore::globalPoint): Changed return type to NSPoint and so removed the explicit
3584         conversion to IntPoint.
3585         (WebCore::globalPointForEvent): Changed return type to NSPoint.
3586         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): Moved conversion to
3587         IntPoint in here. Also got rid of special indenting style and just indented normally.
3588         (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Ditto.
3589         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Ditto.
3590
3591         * platform/mac/PlatformScreenMac.mm:
3592         (WebCore::displayID): Renamed from displayIDFromScreen and displayFromWidget since this
3593         is C++ and we have overloading to determine the types of arguments. Added a null check
3594         of the how dinwo pointer.
3595         (WebCore::firstScreen): Added. Helper used below.
3596         (WebCore::window): Added. Helper used below.
3597         (WebCore::screen): Renamed from screenForWidget and screenFromWindow and removed the
3598         unneeded window argument from the widget version.
3599         (WebCore::screenDepth): Simplified, using new helpers.
3600         (WebCore::screenDepthPerComponent): Ditto.
3601         (WebCore::screenIsMonochrome): Tweaked comment.
3602         (WebCore::screenHasInvertedColors): Ditto.
3603         (WebCore::screenRect): Simplified using new elpers.
3604         (WebCore::screenAvailableRect): Ditto.
3605         (WebCore::screenSupportsExtendedColor): Streamlined using fewer local variables and
3606         using auto for types of the results of adoptCF.
3607         (WebCore::toUserSpace): Updated for function name changes.
3608         (WebCore::toDeviceSpace): Ditto.
3609
3610 2016-05-26  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3611
3612         Purge PassRefPtr in Modules/battery
3613         https://bugs.webkit.org/show_bug.cgi?id=157062
3614
3615         Reviewed by Darin Adler.
3616
3617         Use RefPtr<>& to reduce uses of PassRefPtr in WebKit.
3618
3619         * Modules/battery/BatteryClient.h:
3620         * Modules/battery/BatteryController.cpp:
3621         (WebCore::BatteryController::BatteryController):
3622         (WebCore::BatteryController::~BatteryController):
3623         (WebCore::BatteryController::addListener):
3624         (WebCore::BatteryController::removeListener):
3625         (WebCore::BatteryController::updateBatteryStatus):
3626         (WebCore::BatteryController::didChangeBatteryStatus):
3627         (WebCore::provideBatteryTo):
3628         * Modules/battery/BatteryController.h:
3629         * Modules/battery/BatteryManager.cpp:
3630         (WebCore::BatteryManager::didChangeBatteryStatus):
3631         (WebCore::BatteryManager::updateBatteryStatus):
3632         * Modules/battery/BatteryManager.h:
3633         * Modules/battery/BatteryStatus.h:
3634         * testing/Internals.cpp:
3635         (WebCore::Internals::setBatteryStatus):
3636
3637 2016-05-25  Ada Chan  <adachan@apple.com>
3638
3639         Add WebKitAdditions extension point in HTMLMediaElement.
3640         https://bugs.webkit.org/show_bug.cgi?id=158097
3641
3642         Reviewed by Eric Carlson.
3643
3644         * html/HTMLMediaElement.cpp:
3645         (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction):
3646         We need to load data in the background if playing to wireless playback target.
3647         (WebCore::HTMLMediaElement::fullscreenModeChanged):
3648         Moved from header file.
3649         * html/HTMLMediaElement.h:
3650
3651         * platform/audio/PlatformMediaSession.cpp:
3652         (WebCore::PlatformMediaSession::clientWillPausePlayback):
3653         The code to start m_clientDataBufferingTimer is also in visibilityChanged().
3654         Moved that code to PlatformMediaSession::scheduleClientDataBufferingCheck() and call
3655         that method here.
3656         (WebCore::PlatformMediaSession::visibilityChanged):
3657         Call PlatformMediaSession::scheduleClientDataBufferingCheck().
3658         (WebCore::PlatformMediaSession::scheduleClientDataBufferingCheck):
3659         Start m_clientDataBufferingTimer if it's not already active.
3660         (WebCore::PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction):
3661         Call the client.
3662
3663         * platform/audio/PlatformMediaSession.h:
3664         (WebCore::PlatformMediaSessionClient::shouldOverrideBackgroundLoadingRestriction):
3665
3666         * platform/audio/PlatformMediaSessionManager.cpp:
3667         (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia):
3668         Call the new PlatformMediaSession::shouldOverrideBackgroundLoadingRestriction().
3669
3670 2016-05-26  Jer Noble  <jer.noble@apple.com>
3671
3672         Use std::atomic<> rather than OSAtomicIncrement in CARingBuffer.cpp
3673         https://bugs.webkit.org/show_bug.cgi?id=158129
3674
3675         Reviewed by Eric Carlson.
3676
3677         std::atomic is a more portable atomic primitive than OSAtomicIncrement.
3678
3679         * platform/audio/mac/CARingBuffer.cpp:
3680         (WebCore::CARingBuffer::setCurrentFrameBounds):
3681         (WebCore::CARingBuffer::getCurrentFrameBounds):
3682         (WebCore::CARingBuffer::currentStartFrame):
3683         (WebCore::CARingBuffer::currentEndFrame):
3684         * platform/audio/mac/CARingBuffer.h:
3685
3686 2016-05-26  Ryan Haddad  <ryanhaddad@apple.com>
3687
3688         Rebaseline bindings tests after r201428
3689
3690         Unreviewed test gardening.
3691
3692         * bindings/scripts/test/JS/JSTestObj.cpp:
3693         (WebCore::setJSTestObjReplaceableAttribute):
3694
3695 2016-05-25  Geoffrey Garen  <ggaren@apple.com>
3696
3697         replaceable own properties seem to ignore replacement after property caching
3698         https://bugs.webkit.org/show_bug.cgi?id=158091
3699
3700         Reviewed by Darin Adler.
3701
3702         * bindings/scripts/CodeGeneratorJS.pm:
3703         (GenerateImplementation): Use our new replacement helper if we're replacing
3704         an own static property with an own direct property. Because we advertise
3705         that our own static properties are cacheable, we need to do a structure
3706         transition to indicate when they change. (Only own properties need this 
3707         special treatment because JSC considers it normal to shadow a prototype
3708         property with an own property.)
3709
3710 2016-05-26  Said Abou-Hallawa  <sabouhallawa@apple,com>
3711
3712         BitmapImage::checkForSolidColor() cleanup
3713         https://bugs.webkit.org/show_bug.cgi?id=157750
3714
3715         Reviewed by Darin Adler.
3716
3717         Have a single implementation for BitmapImage::checkForSolidColor(). Create
3718         a new function named NativeImage::solidColor() and call it from the former
3719         one. The goal is to have the platform files contain only the platform dependent
3720         code rather than repeating the platform independent code multiple times.
3721
3722         * platform/graphics/BitmapImage.cpp:
3723         (WebCore::BitmapImage::destroyMetadataAndNotify): Invalidate m_solidColor.
3724         (WebCore::BitmapImage::singlePixelSolidColor): Combine mayFillWithSolidColor(),
3725         checkForSolidColor() and solidColor() in one function to guarantee the validity
3726         of the returned value. Before, if solidColor() is called without calling
3727         mayFillWithSolidColor() or checkForSolidColor(), the returned value would be
3728         incorrect.
3729         
3730         (WebCore::BitmapImage::dump): Use the m_solidColor Optional and Color states.
3731         (WebCore::BitmapImage::mayFillWithSolidColor): Deleted.
3732         (WebCore::BitmapImage::solidColor): Deleted.
3733         
3734         * platform/graphics/BitmapImage.h: Delete m_checkedForSolidColor and
3735         m_isSolidColor and change m_solidColor to be Optional<Color>.
3736         
3737         * platform/graphics/Image.cpp:
3738         (WebCore::Image::drawTiled): Use singlePixelSolidColor() and check the returned
3739         value to know whether the singe pixel solid color optimization applies or not.
3740         
3741         * platform/graphics/Image.h:
3742         (WebCore::Image::singlePixelSolidColor):
3743         (WebCore::Image::mayFillWithSolidColor): Deleted.
3744         (WebCore::Image::solidColor): Deleted.
3745         Replace mayFillWithSolidColor() and solidColor() with a single function named
3746         singlePixelSolidColor(). isValid() of the returned Color can be used to tell
3747         whether the singe pixel solid color optimization applies or not.
3748         
3749         * platform/graphics/cairo/BitmapImageCairo.cpp:
3750         (WebCore::NativeImage::singlePixelSolidColor):
3751         (WebCore::BitmapImage::draw):
3752         (WebCore::BitmapImage::checkForSolidColor): Deleted.
3753         Delete the platform dependent BitmapImage::checkForSolidColor() and add
3754         the new platform dependent function NativeImage::singlePixelSolidColor() and
3755         use to know whether the singe pixel solid color optimization applies or not.
3756         
3757         * platform/graphics/cg/BitmapImageCG.cpp:
3758         (WebCore::NativeImage::singlePixelSolidColor):
3759         (WebCore::BitmapImage::draw):
3760         (WebCore::BitmapImage::checkForSolidColor): Deleted.
3761         Ditto.
3762
3763 2016-05-26  Pranjal Jumde  <pjumde@apple.com>
3764
3765         Sites served over insecure connections should not be allowed to use geolocation.
3766         https://bugs.webkit.org/show_bug.cgi?id=157423
3767         <rdar://problem/23751632>
3768
3769         Reviewed by Brent Fulgham.
3770
3771         Tests: http/tests/security/insecure-geolocation.html
3772                http/tests/security/mixedcontent-geolocation-block-insecure-content.html
3773                http/tests/security/mixedcontent-geolocation.html
3774
3775         * Modules/geolocation/Geolocation.cpp:
3776         (WebCore::logError):
3777         Logs an error to the console if geolocation is blocked.
3778         (WebCore::Geolocation::startRequest):
3779         Access to Geolocation will be blocked if site is not secure. An error will be logged when access to Geolocation is blocked.
3780         (WebCore::Geolocation::shouldBlockGeolocationRequests)
3781         Returns true if the access to geolocation should be blocked.
3782         * Modules/geolocation/Geolocation.h:
3783         * dom/SecurityContext.h:
3784         (WebCore::SecurityContext::foundMixedContent):
3785         Returns true if insecure content was accessed over secure connection.
3786         (WebCore::SecurityContext::setFoundMixedContent):
3787         Sets m_foundMixedContent to true if insecure content is accessed over secure connection.
3788         (WebCore::SecurityContext::geolocationAccessed):
3789         Returns true if geolocation was accessed
3790         (WebCore::SecurityContext::setGeolocationAccessed):
3791         Sets m_geolocationAccessed to true if geolocation was accessed.
3792         * loader/MixedContentChecker.cpp:
3793         (WebCore::MixedContentChecker::canDisplayInsecureContent):
3794         Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.
3795         (WebCore::MixedContentChecker::canRunInsecureContent):
3796         Insecure content will be blocked if geolocation was accessed by the page. Updates document to keep track of mixed content.
3797
3798 2016-05-26  Brady Eidson  <beidson@apple.com>
3799
3800         Implement internals.observeGC to get called back when a Javascript object is GC'ed.
3801         https://bugs.webkit.org/show_bug.cgi?id=158093
3802
3803         Reviewed by Geoffrey Garen.
3804
3805         Test: js/test-observegc.html
3806
3807         * CMakeLists.txt:
3808         * DerivedSources.make:
3809         * WebCore.xcodeproj/project.pbxproj:
3810
3811         * testing/GCObservation.cpp: Added.
3812         (WebCore::GCObservation::GCObservation):
3813         * testing/GCObservation.h: Added.
3814         * testing/GCObservation.idl: Added.
3815
3816         * testing/Internals.cpp:
3817         (WebCore::Internals::observeGC):
3818         * testing/Internals.h:
3819         * testing/Internals.idl:
3820
3821 2016-05-26  Myles C. Maxfield  <mmaxfield@apple.com>
3822
3823         [Font Loading] Allow empty strings in FontFace constructor
3824         https://bugs.webkit.org/show_bug.cgi?id=158112
3825
3826         Reviewed by Darin Adler.
3827
3828         Other browsers accept empty strings and parse them as if they are omitted.
3829         We should do the same. However, this is only true for the constructor. Setting
3830         an attribute to an empty string should still throw an exception.
3831
3832         Test: fast/text/font-face-empty-string.html
3833
3834         * css/FontFace.cpp:
3835         (WebCore::FontFace::create):
3836         (WebCore::FontFace::setFamily):
3837         (WebCore::FontFace::setStyle):
3838         (WebCore::FontFace::setWeight):
3839         (WebCore::FontFace::setUnicodeRange):
3840         (WebCore::FontFace::setVariant):
3841         (WebCore::FontFace::setFeatureSettings):
3842
3843 2016-05-26  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3844
3845         WebRTC: RTCSessionDescription: Make attributes readonly (and remove custom binding)
3846         https://bugs.webkit.org/show_bug.cgi?id=157858
3847
3848         Reviewed by Eric Carlson.
3849
3850         Align RTCSessionDescription type with WebRTC 1.0 specification [1].
3851         - Make constructor dictionary member mandatory
3852         - Align constructor dictionary argument (RTCSessionDescriptionInit) with [1]
3853         - Use RTCSdpType enum for the type attribute
3854         - Remove custom binding
3855
3856         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html
3857
3858         Updated existing test.
3859
3860         * CMakeLists.txt:
3861         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3862         (WebCore::MediaEndpointPeerConnection::createOfferTask):
3863         * Modules/mediastream/RTCSessionDescription.cpp:
3864         (WebCore::parseTypeString):
3865         (WebCore::RTCSessionDescription::create):
3866         (WebCore::RTCSessionDescription::RTCSessionDescription):
3867         (WebCore::verifyType): Deleted.
3868         (WebCore::RTCSessionDescription::setType): Deleted.
3869         * Modules/mediastream/RTCSessionDescription.h:
3870         (WebCore::RTCSessionDescription::type):
3871         * Modules/mediastream/RTCSessionDescription.idl:
3872         * WebCore.xcodeproj/project.pbxproj:
3873         * bindings/js/JSRTCSessionDescriptionCustom.cpp: Removed.
3874         (WebCore::constructJSRTCSessionDescription): Deleted.
3875
3876 2016-05-26  Alejandro G. Castro  <alex@igalia.com>
3877
3878         NativeToJSValue is harcoding the $thisValue in some strings
3879         https://bugs.webkit.org/show_bug.cgi?id=158113
3880
3881         Reviewed by Darin Adler.
3882
3883         Replaced the string with the variable value.
3884
3885         Updated the tests results in the bindings.
3886
3887         * bindings/scripts/CodeGeneratorJS.pm:
3888         (NativeToJSValue): Replaced the hardcoded string with the variable
3889         value.
3890         * bindings/scripts/test/JS/JSTestCallback.cpp:
3891         (WebCore::JSTestCallback::callbackWithSerializedScriptValueParam):
3892         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
3893         (WebCore::JSTestCallbackFunction::callbackWithSerializedScriptValueParam):
3894
3895 2016-05-26  Frederic Wang  <fwang@igalia.com>
3896
3897         Small improvements to RenderBox/LayoutUnit casting in MathML
3898         https://bugs.webkit.org/show_bug.cgi?id=157943
3899
3900         Reviewed by Darin Adler.
3901
3902         This is a small follow-up of the RenderMathMLRow/RenderMathMLUnderOver/RenderMathMLFraction
3903         refactoring. Since these MathML renderers can only contain other MathML renderers, we can
3904         just considerer RenderBox children and avoid unnecessary casts. Similarly, when the two
3905         arguments of std::max are LayoutUnit's, we do not need to specialize to std::max<LayoutUnit>.
3906
3907         No new tests, behavior is not changed.
3908
3909         * rendering/mathml/RenderMathMLFraction.cpp:
3910         (WebCore::RenderMathMLFraction::layoutBlock): Do not to specialize to std::max<LayoutUnit>.
3911         * rendering/mathml/RenderMathMLRow.cpp:
3912         (WebCore::RenderMathMLRow::updateOperatorProperties): Browse the list of RenderBox children
3913         and use auto*.
3914         (WebCore::RenderMathMLRow::computeLineVerticalStretch): Do not to specialize to std::max<LayoutUnit>.
3915         * rendering/mathml/RenderMathMLUnderOver.cpp:
3916         (WebCore::RenderMathMLUnderOver::unembellishedOperator): Get the RenderBox child and use auto*.
3917         (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Browse the list of
3918         RenderBox children, use auto* and remove unnecessary casts. Do not to specialize to
3919         std::max<LayoutUnit>.
3920
3921 2016-05-26  Chris Fleizach  <cfleizach@apple.com>
3922
3923         AX: crash at AccessibilityRenderObject::remoteSVGRootElement const
3924         https://bugs.webkit.org/show_bug.cgi?id=158098
3925
3926         Reviewed by Joanmarie Diggs.
3927
3928         What looks like happens here is that when a document is torn down and we try to detach, we end up creating an accessibility element during detachment phase.
3929         So instead of just clearing the callback pointer on an existing AXObject, we make a new object and access properties of an object being deallocated.
3930
3931         I tried very hard to make a test but it looks like this can really only be triggered during document tear down which also tears down the AXObjectCache. I didn't
3932         have luck reproducing because of that.