Make sure MediaStream uses blob protocol
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2015-07-08  Matthew Daiter  <mdaiter@apple.com>
2
3         Make sure MediaStream uses blob protocol
4         https://bugs.webkit.org/show_bug.cgi?id=146752
5         <rdar://problem/21736057>
6
7         Reviewed by Eric Carlson.
8
9         * html/HTMLMediaElement.cpp:
10         (WebCore::HTMLMediaElement::selectNextSourceChild): Added MediaStream
11         blob protocol
12
13 2015-07-08  Andreas Kling  <akling@apple.com>
14
15         Videos on apple.com don't show up when restored from page cache.
16         <https://webkit.org/b/146766>
17         <rdar://problem/21712311>
18
19         Reviewed by Darin Adler.
20
21         Break out most of HTMLMediaElement::stop() (override of ActiveDOMObject::stop(), to be clear)
22         into a stopWithoutDestroyingMediaPlayer() function that both stop() and suspend() can call.
23
24         Before this change, suspend() would call stop() when moving into the page cache, killing the
25         internal MediaPlayer object which caused the video to disappear from the page.
26
27         Test: LayoutTests/media/restore-from-page-cache.html (amended)
28
29         * html/HTMLMediaElement.cpp:
30         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
31         (WebCore::HTMLMediaElement::stop):
32         (WebCore::HTMLMediaElement::suspend):
33         * html/HTMLMediaElement.h:
34
35 2015-07-08  Matthew Daiter  <mdaiter@apple.com>
36
37         Make MediaStream conform to its private client like MediaSource does
38         https://bugs.webkit.org/show_bug.cgi?id=146756
39         <rdar://problem/21736457>
40
41         Reviewed by Brent Fulgham.
42
43         MediaStream should be inheriting its PrivateClient's getters and
44         setters for RefCounted, not inheriting its own.
45
46         * Modules/mediastream/MediaStream.h: Changed MediaStream's inherit
47         statements
48         * platform/mediastream/MediaStreamPrivate.h: Changed
49         MediaStreamPrivateClient to inherit RefCounted<MediaStreamPrivateClient>
50
51 2015-07-08  Matthew Daiter  <mdaiter@apple.com>
52
53         Made AVMediaCaptureSource's session accessor public
54         https://bugs.webkit.org/show_bug.cgi?id=146758
55         <rdar://problem/21736651>
56
57         Reviewed by Brent Fulgham.
58
59         * platform/mediastream/mac/AVMediaCaptureSource.h:
60         (WebCore::AVMediaCaptureSource::session): Changed to public
61
62 2015-07-08  Matthew Daiter  <mdaiter@apple.com>
63
64         Make sure MediaStream engine loaded for interpreting MediaStreams
65         https://bugs.webkit.org/show_bug.cgi?id=146748
66         <rdar://problem/21735416>
67
68         Reviewed by Brent Fulgham.
69
70         Prevent the MediaSource engine from being used to process
71         MediaStreams, since they are not compatible
72
73         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 
74         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
75         Changed MediaStream to never be loaded
76         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
77         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
78         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): 
79         Changed MediaStream to never be loaded
80
81
82 2015-07-08  Benjamin Poulain  <bpoulain@apple.com>
83
84         [Content Extensions] Fuse undistinguishable actions as much as possible
85         https://bugs.webkit.org/show_bug.cgi?id=146762
86
87         Reviewed by Alex Christensen.
88
89         Our previous code that fused actions was based on test lists that were
90         grouping similar actions in the input.
91
92         The input we get from developers is more distributed. It is very common to
93         have trigger flags all over the place, and "css-display-none" mixed with "block".
94
95         This patch refines the merging code to merge those cases as much as possible.
96
97         The size taken by the actions is negligible, but having different actions make
98         nodes unkillable by the Minimizer. By merging many more actions, the minimizer
99         no longer see those subtrees as distinguishable and can do a better job.
100
101         On a large test list, this cuts the bytecode size by 2 megabytes.
102
103         Tests: http/tests/contentextensions/css-display-none-after-ignore-previous-rules.html
104                http/tests/contentextensions/single-css-display-none.html
105
106         * contentextensions/ContentExtensionCompiler.cpp:
107         (WebCore::ContentExtensions::resolvePendingDisplayNoneActions):
108         (WebCore::ContentExtensions::serializeActions):
109
110 2015-07-08  Matthew Daiter  <mdaiter@apple.com>
111
112         Cleared contentMIMETypes for MediaStreams
113         https://bugs.webkit.org/show_bug.cgi?id=146750
114         <rdar://problem/21735678>
115
116         Reviewed by Brent Fulgham.
117
118         * platform/graphics/MediaPlayer.cpp:
119         (WebCore::MediaPlayer::load): Needed to clear contentMIMETypes
120
121 2015-07-08  Dean Jackson  <dino@apple.com>
122
123         Audio elements with controls force their enclosing stacking context to composite
124         https://bugs.webkit.org/show_bug.cgi?id=146751
125         <rdar://problem/21466572>
126
127         Reviewed by Simon Fraser.
128
129         There were a number of issues with audio controls, on both iOS and OS X.
130
131         - they used a blurry background which was not the intended design
132         - they cause the page to composite, which causes a degradation in
133           text rendering quality
134         - they inserted 20px of padding above every audio element, which
135           could break existing page designs.
136
137         Removing the need for compositing and blending means that the
138         colors used for control tints need to be adjusted for the non-blended
139         case. Wherever I could, I kept as much as possible in a shared
140         rule and made specific changes for audio or video.
141
142         The controls were also unintentionally relying on the compositing
143         to create stacking contexts and control the rendering order. Without
144         them, I needed to add some explicit stacking.
145
146         I also made some drive-by whitespace clean-ups.
147
148         * Modules/mediacontrols/mediaControlsApple.css: Remove as much compositing
149         as possible in audio controls.
150
151         * Modules/mediacontrols/mediaControlsApple.js:
152         (Controller.prototype.drawTimelineBackground): Use specific colors for audio.
153
154         * Modules/mediacontrols/mediaControlsiOS.css: Remove as much need for compositing
155         as possible.
156
157 2015-07-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
158
159         Crash when appending an SVG <use> element dynamically which has animated SVG <path> element
160         https://bugs.webkit.org/show_bug.cgi?id=146690
161         <rdar://problem/20790376>
162
163         Reviewed by Dean Jackson.
164
165         Test: svg/animations/insert-animate-use-path-while-animation.svg
166
167         The crashing call stack shows that
168         SVGAnimatedListPropertyTearOff<SVGPathSegList>::m_animVal is null when
169         trying to access it in synchronizeWrappersIfNeeded(). This happens because
170         animationStarted() was not called for this animatedType.
171         
172         SVGAnimateElementBase::resetAnimatedType() calls
173         SVGAnimatedPathAnimator::startAnimValAnimation() at the beginning of the
174         animation. For the target element and all its instances, this function calls
175         SVGAnimatedPathSegListPropertyTearOff::animationStarted() which calls
176         SVGAnimatedListPropertyTearOff<SVGPathSegList>::animationStarted(). This
177         last function allocates the member m_animVal when calling
178         SVGAnimatedListPropertyTearOff<SVGPathSegList>::animVal(). 
179         
180         When adding a new instance of the same animating target element, 
181         SVGAnimateElementBase::resetAnimatedType() just keeps calling
182         SVGAnimatedPathAnimator::animValDidChange() for all the instances of the
183         targetElement without ensuring that all of them have started their
184         animations.
185         
186         The fix is to make SVGAnimatedPathAnimator::resetAnimValToBaseVal() ensure
187         that animationStarted() is called for the targetElement and all its instances.
188
189         * svg/SVGAnimatedPath.cpp:
190         (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation): Move resetting
191         the animation value and starting the animatedTypes code to a new overriding
192         function which is named resetAnimValToBaseVal().
193         
194         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal): Call the overriding
195         function which calls buildSVGPathByteStreamFromSVGPathSegList() as before
196         and ensure that all the animatedTypes have started their animations.
197         
198         * svg/SVGAnimatedPath.h:
199
200 2015-07-08  Brady Eidson  <beidson@apple.com>
201
202         Move PingLoaders to the NetworkingProcess.
203         <rdar://problem/18860263> and https://bugs.webkit.org/show_bug.cgi?id=146710
204
205         Reviewed by Tim Horton.
206
207         No new tests.
208         There's no current solution for communicating back to a page that a ping load has reached its target.
209         Until we have such a solution, any attempt at a layout test will be fragile at best.
210
211         * WebCore.xcodeproj/project.pbxproj:
212         
213         * loader/LoaderStrategy.cpp:
214         (WebCore::LoaderStrategy::createPingHandle): Default implementation is create the PingHandle directly.
215         * loader/LoaderStrategy.h:
216
217         PingLoader becomes a static class for now that crafts the ResourceRequest then passes it off
218         to the LoaderStrategy:        
219         * loader/PingLoader.cpp:
220         (WebCore::PingLoader::loadImage):
221         (WebCore::PingLoader::sendPing):
222         (WebCore::PingLoader::sendViolationReport):
223         (WebCore::PingLoader::startPingLoad):
224         (WebCore::PingLoader::createPingLoader): Deleted.
225         (WebCore::PingLoader::PingLoader): Deleted.
226         (WebCore::PingLoader::~PingLoader): Deleted.
227         * loader/PingLoader.h:
228         (WebCore::PingLoader::timeoutTimerFired): Deleted.
229
230         PingHandle does what PingLoader used to - It's a basic ResourceHandleClient that simply waits
231         for any response/completion/failure and then deletes itself.
232         * platform/network/PingHandle.h: Added.
233         (WebCore::PingHandle::PingHandle):
234         (WebCore::PingHandle::usesAsyncCallbacks):
235         (WebCore::PingHandle::timeoutTimerFired):
236         (WebCore::PingHandle::~PingHandle):
237
238 2015-07-08  Csaba Osztrogonác  <ossy@webkit.org>
239
240         Add new sources to StyleAllInOne.cpp
241         https://bugs.webkit.org/show_bug.cgi?id=146584
242
243         Reviewed by Brent Fulgham.
244
245         * WebCore.vcxproj/WebCore.vcxproj:
246         * rendering/style/StyleAllInOne.cpp:
247
248 2015-07-08  Csaba Osztrogonác  <ossy@webkit.org>
249
250         Add new sources to DOMAllInOne.cpp
251         https://bugs.webkit.org/show_bug.cgi?id=146587
252
253         Reviewed by Brent Fulgham.
254
255         * WebCore.vcxproj/WebCore.vcxproj:
256         * dom/DOMAllInOne.cpp:
257
258 2015-07-08  Csaba Osztrogonác  <ossy@webkit.org>
259
260         Add new sources to AccessibilityAllInOne.cpp
261         https://bugs.webkit.org/show_bug.cgi?id=146582
262
263         Reviewed by Brent Fulgham.
264
265         * WebCore.vcxproj/WebCore.vcxproj:
266         * accessibility/AccessibilityAllInOne.cpp:
267
268 2015-07-08  Eric Carlson  <eric.carlson@apple.com>
269
270         [Mac] Two clicks required to enable AirPlay at youtube.com
271         https://bugs.webkit.org/show_bug.cgi?id=146733
272         <rdar://problem/21556356>
273
274         Reviewed by Brent Fulgham.
275
276         * Modules/mediasession/WebMediaSessionManager.cpp:
277         (WebCore::WebMediaSessionManager::clientStateDidChange): Only log when state has changed.
278           Don't steal the route if another client is actively playing to the device.
279         (WebCore::WebMediaSessionManager::setPlaybackTarget): Set m_targetChanged.
280         (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Don't consider the
281           requestedPicker flag until after a target change.
282         * Modules/mediasession/WebMediaSessionManager.h:
283
284         * html/HTMLMediaElement.cpp:
285         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Add logging.
286         (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): Ditto.
287
288         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
289         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Always log.
290
291 2015-07-08  Zalan Bujtas  <zalan@apple.com>
292
293         Do not waste window server memory for placeholder windows initiated by ThemeMac.
294         https://bugs.webkit.org/show_bug.cgi?id=146730
295         rdar://problem/20321222
296
297         Using defer:YES prevents us from wasting any window server resources for WebCoreThemeWindow(s).
298
299         Patch by Darin Adler.
300         Reviewed by Zalan Bujtas.
301
302         Not testable.
303
304         * platform/mac/ThemeMac.mm:
305         (-[WebCoreThemeView window]):
306
307 2015-07-08  Xabier Rodriguez Calvar  <calvaris@igalia.com>
308
309         [GTK] Deactivate GObject bindings for static methods
310         https://bugs.webkit.org/show_bug.cgi?id=146717
311
312         Reviewed by Carlos Garcia Campos.
313
314         Static methods are currently not supported by GObject bindings so we deactivate them from the generation.
315
316         Current tests suffice. Expectations updated.
317
318         * bindings/scripts/CodeGeneratorGObject.pm:
319         (SkipFunction): Skip isStatic functions.
320         * bindings/scripts/test/GObject/WebKitDOMTestInterface.h:
321         * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp:
322         (webkit_dom_test_interface_implements_method4): Deleted.
323         (webkit_dom_test_interface_supplemental_method4): Deleted.
324         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
325         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
326         (webkit_dom_test_obj_class_method): Deleted.
327         (webkit_dom_test_obj_class_method_with_optional): Deleted.
328         (webkit_dom_test_obj_overloaded_method1): Deleted.
329
330 2015-07-07  Benjamin Poulain  <bpoulain@apple.com>
331
332         Remove the overflow checks from the important vectors used by the content extensions machines
333         https://bugs.webkit.org/show_bug.cgi?id=146703
334
335         Reviewed by Andreas Kling.
336
337         Most of the overflow checks cannot be eliminated by clang. Removing them
338         explicitly removes 400 ms from the compile time of a very large test list.
339
340         * contentextensions/ContentExtensionsDebugging.h:
341         * contentextensions/DFA.h:
342         * contentextensions/DFACombiner.cpp:
343         * contentextensions/DFAMinimizer.cpp:
344         * contentextensions/ImmutableNFA.h:
345         * contentextensions/MutableRangeList.h:
346         * contentextensions/NFAToDFA.cpp:
347         (WebCore::ContentExtensions::epsilonClosureExcludingSelf):
348         (WebCore::ContentExtensions::resolveEpsilonClosures):
349         (WebCore::ContentExtensions::extendSetWithClosure):
350         (WebCore::ContentExtensions::DataConverterWithEpsilonClosure::convert):
351         (WebCore::ContentExtensions::DataConverterWithEpsilonClosure::extend):
352         (WebCore::ContentExtensions::createCombinedTransition):
353         (WebCore::ContentExtensions::getOrCreateDFANode):
354         (WebCore::ContentExtensions::NFAToDFA::convert):
355
356 2015-07-07  Dean Jackson  <dino@apple.com>
357
358         [iOS] MediaControls: Start Play and Can't Play buttons need to be cutout and blurred
359         https://bugs.webkit.org/show_bug.cgi?id=146226
360
361         Reviewed by Simon Fraser.
362
363         This patch takes what Said Abou-Hallawa posted in an earlier revision and
364         makes a few tweaks to workaround the bugs he's listed.
365
366         Replicate the iOS System blur backdrop in pure CSS, so that the large
367         start button looks more correct. Also add artwork for a failure state.
368
369         * Modules/mediacontrols/mediaControlsiOS.css: New style rules for the start
370         button, which now is a collection of elements rather than a <button>.
371         (video::-webkit-media-controls-start-playback-button):
372         (video::-webkit-media-controls-start-playback-background):
373         (video::-webkit-media-controls-start-playback-tint):
374
375         * Modules/mediacontrols/mediaControlsiOS.js:
376         (ControllerIOS.prototype.createBase): Replace the <button> with the hierarchy of
377         elements to replicate the blur. Give some of them a class attribute, so they
378         can match selectors (see the bugs Said filed in the original bugzilla).
379         (ControllerIOS.prototype.handleStartPlaybackButtonTouchStart): Toggle classes on
380         the hierarchy as needed.
381         (ControllerIOS.prototype.handleStartPlaybackButtonTouchEnd): Ditto.
382         (ControllerIOS.prototype.updateStatusDisplay): Ditto.
383
384 2015-07-07  Zalan Bujtas  <zalan@apple.com>
385
386         Crash when parent iframe is set to display none and the child frame is mutated the same time.
387         https://bugs.webkit.org/show_bug.cgi?id=146699
388         rdar://problem/16207881
389
390         Reviewed by Andreas Kling.
391
392         When the parent iframe is set to display: none, we destroy the associated renderer (RenderIFrame).
393         However if the child frame is mutated the same time, during layout we try to access this RenderIFrame
394         to check whether it needs frame flattening.
395         This patch checks whether the parent render widget is still valid.
396
397         Test: fast/frames/crash-display-none-iframe-during-onbeforeload.html
398
399         * page/FrameView.cpp:
400         (WebCore::FrameView::isInChildFrameWithFrameFlattening): rearrange early returns.
401
402 2015-07-06  Matt Rajca  <mrajca@apple.com>
403
404         Media Session: remove seek forward/backward attributes
405         https://bugs.webkit.org/show_bug.cgi?id=146645
406
407         Reviewed by Eric Carlson.
408
409         * Modules/mediasession/MediaRemoteControls.h:
410         * Modules/mediasession/MediaRemoteControls.idl:
411
412 2015-07-07  Brent Fulgham  <bfulgham@apple.com>
413
414         REGRESSION (r183133-r183138): Secondary clicking in whitespace selects preceding word
415         https://bugs.webkit.org/show_bug.cgi?id=146695
416         <rdar://problem/21441466>
417
418         Reviewed by Tim Horton.
419
420         When we would currently use dictionary lookup to decide on our text selection, first check if we
421         are targeting an editable field. If we are, use the original selection behavior. Otherwise, use
422         the new "dictionary lookup" selection.
423
424         * page/EventHandler.cpp:
425         (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent): Only use dictionary lookup
426         when our target node is not editable.
427         
428
429 2015-07-07  Brady Eidson  <beidson@apple.com>
430
431         Another attempt to fix CURL/Soup builds after r186476
432
433         Reviewed by NOBODY.
434
435         * platform/network/curl/SocketStreamHandle.h:
436
437         * platform/network/soup/SocketStreamHandle.h:
438
439 2015-07-07  Brady Eidson  <beidson@apple.com>
440
441         Attempt to fix CURL/Soup builds after r186476
442
443         Reviewed by NOBODY.
444
445         * platform/network/curl/SocketStreamHandle.h:
446         (WebCore::SocketStreamHandle::create):
447
448         * platform/network/soup/SocketStreamHandle.h:
449         (WebCore::SocketStreamHandle::create):
450
451 2015-07-07  Brady Eidson  <beidson@apple.com>
452
453         HTTP Auth cached after disabling private browsing/reset.
454         <rdar://problem/8293055> and https://bugs.webkit.org/show_bug.cgi?id=146654
455
456         Reviewed by Tim Horton.
457
458         Test: http/tests/security/private-browsing-http-auth.html
459
460         - Change most static CredentialStorage methods to be instance methods instead.
461         - Make a CredentialStorage objects be per-NetworkStorageSession.
462
463         * Modules/websockets/WebSocketChannel.cpp:
464         (WebCore::WebSocketChannel::WebSocketChannel):
465         (WebCore::WebSocketChannel::connect): Only start the web socket load if a networking
466           context is available.
467
468         * platform/network/CredentialStorage.cpp:
469         (WebCore::CredentialStorage::defaultCredentialStorage): Returns the credential storage
470           from the default NetworkStorageSession.
471         (WebCore::CredentialStorage::set):
472         (WebCore::CredentialStorage::get):
473         (WebCore::CredentialStorage::remove):
474         (WebCore::CredentialStorage::findDefaultProtectionSpaceForURL):
475         (WebCore::CredentialStorage::clearCredentials):
476         (WebCore::protectionSpaceToCredentialMap): Deleted.
477         (WebCore::originsWithCredentials): Deleted.
478         (WebCore::pathToDefaultProtectionSpaceMap): Deleted.
479         (WebCore::findDefaultProtectionSpaceForURL): Deleted.
480         (WebCore::CredentialStorage::setPrivateMode): Deleted. Was a no-op anyways.
481         * platform/network/CredentialStorage.h:
482         
483         * platform/network/NetworkStorageSession.h:
484         (WebCore::NetworkStorageSession::credentialStorage):
485         
486         * platform/network/cf/ResourceHandleCFNet.cpp:
487         (WebCore::ResourceHandle::createCFURLConnection):
488         (WebCore::ResourceHandle::willSendRequest):
489         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
490         (WebCore::ResourceHandle::receivedCredential):
491         
492         * platform/network/cf/SocketStreamHandle.h:
493         (WebCore::SocketStreamHandle::create):
494         * platform/network/cf/SocketStreamHandleCFNet.cpp:
495         (WebCore::SocketStreamHandle::SocketStreamHandle):
496         (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials):
497         (WebCore::getStoredCONNECTProxyCredentials): Deleted.
498         
499         * platform/network/curl/ResourceHandleCurl.cpp:
500         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
501         (WebCore::ResourceHandle::receivedCredential):
502         * platform/network/curl/ResourceHandleManager.cpp:
503         (WebCore::ResourceHandleManager::applyAuthenticationToRequest):
504         
505         * platform/network/mac/ResourceHandleMac.mm:
506         (WebCore::ResourceHandle::createNSURLConnection):
507         (WebCore::ResourceHandle::willSendRequest):
508         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
509         (WebCore::ResourceHandle::receivedCredential):
510         
511         * platform/network/soup/ResourceHandleSoup.cpp:
512         (WebCore::applyAuthenticationToRequest):
513         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
514         (WebCore::ResourceHandle::receivedCredential):
515         
516 2015-07-07  Zalan Bujtas  <zalan@apple.com>
517
518         REGRESSION(169105): CSS Regions: renderer returns wrong selection root when it is inside a column flow.
519         https://bugs.webkit.org/show_bug.cgi?id=146529
520         rdar://problem/21613670
521
522         Reviewed by Mihnea Ovidenie and David Kilzer.
523
524         This patch ensures that RenderObject::selectionRoot() handles column flows properly while searching for the associated
525         selection root.
526         When the renderer is inside a column flow and the column flow is part of a named flow, we stop
527         traversing the ancestor chain, searching for the selection root, when we reach the column flow.
528         Since the column flow is not a selection root, we mistakenly fall back to the RenderView as selection root.
529         Instead, we should check if the column is inside a named flow and return the selection root accordingly.
530         Returning the wrong selection root confuses RenderView::splitSelectionBetweenSubtrees() logic and this particular
531         RenderObject could end up in multiple selection trees.
532
533         Test: fast/regions/selection/crash-when-element-is-inside-column-and-the-containing-block-is-inside-flow.html
534
535         * rendering/RenderObject.cpp:
536         (WebCore::RenderObject::selectionRoot):
537
538 2015-07-07  Brent Fulgham  <bfulgham@apple.com>
539
540         [Mac] REGRESSION (r184794): Play/Pause control doesn't update state in full screen
541         https://bugs.webkit.org/show_bug.cgi?id=146689
542         <rdar://problem/21393490>
543
544         Reviewed by Dean Jackson.
545
546         The changes in r184794 did not take full screen mode into account. This needed to be corrected.
547
548         * Modules/mediacontrols/mediaControlsApple.js:
549         (Controller.prototype.handlePanelTransitionEnd):
550         (Controller.prototype.setPlaying):
551         (Controller.prototype.showControls):
552
553 2015-07-07  Wenson Hsieh  <whsieh@berkeley.edu>
554         
555         Snap point regions containing X and Y snap points should do a better job animating
556         https://bugs.webkit.org/show_bug.cgi?id=142523
557         <rdar://problem/20100753>
558
559         Reviewed by Brent Fulgham.
560
561         Reimplemented snap point animations to use a single timer for both horizontal and
562         vertical axes to better support 2D snap scrolling. Instead of making velocity
563         dependent on progress to the snap point and handling 2D snapping with different
564         timer update functions, this implementation uses a fixed animation time to coordinate
565         the snapping animation across both axes.
566
567         Test: platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-2d-overflow.html
568
569         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: Refactored to use a single scroll snap timer.
570         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: See above.
571         (WebCore::ScrollingTreeFrameScrollingNodeMac::startScrollSnapTimer): See above.
572         (WebCore::ScrollingTreeFrameScrollingNodeMac::stopScrollSnapTimer): See above.
573         * platform/cocoa/ScrollController.h: Refactored to use a single scroll snap timer and update function to handle
574             snapping in both axes. This entails removing the ScrollEventAxis parameter from various functions below. Also
575             removed methods that computed "snap" and "glide" offsets.
576         (WebCore::ScrollControllerClient::startScrollSnapTimer): See above.
577         (WebCore::ScrollControllerClient::stopScrollSnapTimer): See above.
578         * platform/cocoa/ScrollController.mm: See above.
579         (WebCore::ScrollController::ScrollController): Added new constants used to compute animation offsets.
580         (WebCore::ScrollController::snapRubberBandTimerFired):  Added a check to prevent the rubber band timer from firing
581             alongside the scroll snap timer. This results in scroll snapping taking precedence over rubber banding when
582             scrolling against the edge of a container in the case of 2D scrolling. We didn't run into this issue before
583             because snapping wasn't working properly at the edges of a 2D scrolling container. In the future, we may want
584             to unify both snap scrolling and rubber banding timers to solve this issue.
585         (WebCore::ScrollController::isScrollSnapInProgress): Refactored to use a single scroll snap timer.
586         (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Fixed an issue where wheel deltas were being pushed
587             to the snap state incorrectly.
588         (WebCore::ScrollController::processWheelEventForScrollSnap): Fixed an issue with 2D snapping where scrolling in 2 axes
589             simultaneously would cause the vertical axis to override the horizontal axis. This is more like a sub-issue of fixing
590             2D scrolling, and is required for 2D snap animations to work properly.
591         (WebCore::ScrollController::startScrollSnapTimer): Refactored to use a single scroll snap timer.
592         (WebCore::ScrollController::stopScrollSnapTimer): See above.
593         (WebCore::ScrollController::scrollSnapTimerFired): This new method handles snap scroll updates on both axes.
594         (WebCore::ScrollController::beginScrollSnapAnimation): Refactored to account for single scroll snap timer.
595         (WebCore::ScrollController::endScrollSnapAnimation): See above.
596         (WebCore::ScrollController::initializeScrollSnapAnimationParameters): New method that initializes parameters used to
597             coordinate the animation state across horizontal and vertical axes.
598         (WebCore::ScrollController::isSnappingOnAxis):  Checks whether or not a given axis is currently scroll snapping. This will
599             return true in the case of active 2D scroll snapping.
600         (WebCore::ScrollController::hasActiveScrollSnapTimerForAxis): Deleted.
601         (WebCore::ScrollController::horizontalScrollSnapTimerFired): Deleted.
602         (WebCore::ScrollController::verticalScrollSnapTimerFired): Deleted.
603         (WebCore::ScrollController::scrollSnapAnimationUpdate): Deleted.
604         (WebCore::ScrollController::initializeGlideParameters): Deleted.
605         (WebCore::snapProgress): Deleted.
606         (WebCore::clampedSnapMagnitude): Deleted.
607         (WebCore::ScrollController::computeSnapDelta): Deleted.
608         (WebCore::snapGlide): Deleted.
609         (WebCore::ScrollController::computeGlideDelta): Deleted.
610         * platform/cocoa/ScrollSnapAnimatorState.h:  Added a new datastructure, ScrollSnapAnimationCurveState, which tracks
611             the scroll snap animation state across both axes.
612         * platform/cocoa/ScrollSnapAnimatorState.mm: Removed fields relevant to the former "gliding" model and renamed the
613             initial wheel delta variable to reflect this.
614         (WebCore::ScrollSnapAnimatorState::averageInitialWheelDelta): Fixed an issue where wheel deltas were being pushed
615             to the snap state incorrectly.
616         (WebCore::ScrollSnapAnimatorState::clearInitialWheelDeltaWindow): Tiny for loop incrementor style fix.
617         (WebCore::ScrollSnapAnimatorState::isSnapping): Checks whether this state is in either snapping or gliding mode.
618         (WebCore::ScrollSnapAnimatorState::canReachTargetWithCurrentInitialScrollDelta): Checks whether the scroll velocity is
619             consistent with the initial and target offsets.
620         (WebCore::ScrollSnapAnimatorState::interpolatedOffsetAtProgress): Interpolates the offset for a given progress value.
621         (WebCore::ScrollSnapAnimationCurveState::ScrollSnapAnimationCurveState): New constants.
622         (WebCore::ScrollSnapAnimationCurveState::initializeSnapProgressCurve): Abstracts out part of the initialization process.
623         (WebCore::ScrollSnapAnimationCurveState::initializeInterpolationCoefficientsIfNecessary): Abstracts out part of the
624             initialization process.
625         (WebCore::ScrollSnapAnimationCurveState::interpolatedPositionAtProgress): Abstracts out curve interpolation.
626         (WebCore::ScrollSnapAnimationCurveState::shouldCompleteSnapAnimationImmediatelyAtTime): Added.
627         (WebCore::ScrollSnapAnimationCurveState::animationProgressAtTime): Added.
628         
629 2015-07-07  Chris Dumez  <cdumez@apple.com>
630
631         Unreviewed, attempt to fix iOS build.
632
633         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
634         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
635
636 2015-07-07  Andreas Kling  <akling@apple.com>
637
638         REGRESSION(r183706): HTMLImageElement sometimes fails to register as document named item.
639         <https://webkit.org/b/146679>
640         <rdar://problem/21613839>
641
642         Reviewed by Antti Koivisto.
643
644         After r183706, Element::hasName() no longer returns outdated information when called
645         inside a parseAttribute() override. HTMLImageElement was relying on this to check
646         if it *used* to have a name attribute before the currently parsing one was set.
647
648         Since parseAttribute() only shows subclasses the new attribute value, I'm adding a
649         flag to HTMLImageElement that remembers whether we had a name attribute or not.
650
651         Test: fast/dom/HTMLImageElement/remove-img-with-name-from-document-crash.html
652
653         * html/HTMLImageElement.cpp:
654         (WebCore::HTMLImageElement::parseAttribute):
655         * html/HTMLImageElement.h:
656
657 2015-07-07  Youenn Fablet  <youenn.fablet@crf.canon.fr>
658
659         [Streams API] Remove ReadableStreamReader.read() custom binding
660         https://bugs.webkit.org/show_bug.cgi?id=146643
661
662         Reviewed by Darin Adler.
663
664         Moved ReadableStreamReader.read handling from callbacks to promises.
665         Introduced DOMPromiseIteratorWithCallback for that purpose: it takes resolve() to resolve a promise with a not-ending iterator value,
666         resolveEnd() to resolve a promise with a terminating iterator value and reject().
667         Added template helper routine to convert typed values to JS iterator wrapping the value.
668         Removed ReadableStreamReader.read custom binding.
669
670         Covered by rebased tests.
671
672         * Modules/streams/ReadableStream.cpp: Updated code to use DOMPromiseIteratorWithCallback API.
673         (WebCore::ReadableStream::releaseReader):
674         (WebCore::ReadableStream::changeStateToErrored):
675         (WebCore::ReadableStream::read):
676         (WebCore::ReadableStream::resolveReadCallback):
677         * Modules/streams/ReadableStream.h:
678         * Modules/streams/ReadableStreamReader.cpp:
679         (WebCore::ReadableStreamReader::read):
680         * Modules/streams/ReadableStreamReader.h:
681         * Modules/streams/ReadableStreamReader.idl: Removed custom binding.
682         * bindings/js/JSDOMBinding.h:
683         (WebCore::toJSIterator): create JS iterator from typed value.
684         (WebCore::toJSIteratorEnd): create JS end iterator.
685         * bindings/js/JSDOMPromise.cpp:
686         (WebCore::DeferredWrapper::globalObject): Added globaObject getter and removed promise getter.
687         * bindings/js/JSDOMPromise.h:
688         (WebCore::DOMPromiseIteratorWithCallback::DOMPromiseIteratorWithCallback):
689         (WebCore::Error>::resolve):
690         (WebCore::Error>::resolveEnd):
691         (WebCore::Error>::reject):
692         * bindings/js/JSReadableStreamReaderCustom.cpp: Removed custom binding.
693
694 2015-07-06  Zalan Bujtas  <zalan@apple.com>
695
696         REGRESSION: Slider thumb does not render properly (image tests with <input type="range">)
697         https://bugs.webkit.org/show_bug.cgi?id=146669
698         rdar://problem/21677831
699
700         Reviewed by Simon Fraser.
701
702         Draw NSSliderCell's knob only when slider's thumb paint is requested.
703
704         Covered by existing tests.
705
706         * rendering/RenderThemeMac.mm:
707         (WebCore::RenderThemeMac::paintSliderThumb):
708
709 2015-07-06  Csaba Osztrogonác  <ossy@webkit.org>
710
711         Move shouldIgnoreAttributeCase inline function to Element.h
712         https://bugs.webkit.org/show_bug.cgi?id=146588
713
714         Reviewed by Andreas Kling.
715
716         * dom/Element.cpp:
717         (WebCore::shouldIgnoreAttributeCase): Deleted.
718         * dom/Element.h:
719         (WebCore::shouldIgnoreAttributeCase):
720         * dom/NamedNodeMap.cpp:
721         (WebCore::shouldIgnoreAttributeCase): Deleted.
722
723 2015-07-06  Brent Fulgham  <bfulgham@apple.com>
724
725         Ensure media playback is stopped during page close
726         https://bugs.webkit.org/show_bug.cgi?id=146554
727         <rdar://problem/18033944>
728
729         Reviewed by Brady Eidson.
730
731         * Modules/webaudio/AudioContext.cpp:
732         (WebCore::WebAudio::hostingDocument): Added.
733         * Modules/webaudio/AudioContext.h:
734         * html/HTMLMediaElement.h:
735         (WebCore::HTMLMediaElement::hostingDocument): Added.
736         * dom/Document.cpp:
737         (WebCore::Document::~Document): Call new 'stopAllMediaPlaybackForDocument' at destruction time.
738         * platform/audio/PlatformMediaSession.h:
739         Made PlatformMediaSessionManager a friend so it can access the protected 'client' accessor.
740         Updated PlatformMediaSessionClient to require clients to have a "hostingDocument" member.
741         * platform/audio/PlatformMediaSessionManager.cpp:
742         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument): Added. Only pauses
743         playback on elements that match the provided document.
744         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess): Added. Pauses playback
745         on all elements in the current process.
746         * platform/audio/PlatformMediaSessionManager.h:
747
748 2015-07-06  Daniel Bates  <dabates@apple.com>
749
750         Isolated worlds should respect Content Security Policy; User Agent Shadow DOM
751         should be exempt from Content Security Policy
752         https://bugs.webkit.org/show_bug.cgi?id=144830
753         <rdar://problem/18860261>
754
755         Inadvertently omitted argument overrideContentSecurityPolicy in calls to ContentSecurityPolicy::allowEval()
756         that explicitly specified a report status. And the report status, which is an enum, was being implicitly
757         converted to bool.
758
759         * bindings/js/ScriptController.cpp:
760         (WebCore::ScriptController::initScript):
761         * page/DOMSecurityPolicy.cpp:
762         (WebCore::DOMSecurityPolicy::allowsEval):
763
764 2015-07-06  Commit Queue  <commit-queue@webkit.org>
765
766         Unreviewed, rolling out r186385.
767         https://bugs.webkit.org/show_bug.cgi?id=146668
768
769         crashes 3 webaudio tests in debug builds (Requested by
770         alexchristensen on #webkit).
771
772         Reverted changeset:
773
774         "Ensure media playback is stopped during page close"
775         https://bugs.webkit.org/show_bug.cgi?id=146554
776         http://trac.webkit.org/changeset/186385
777
778 2015-07-06  Andreas Kling  <akling@apple.com>
779
780         Crash when setting text direction via MakeTextWritingDirection* editing commands.
781         <https://webkit.org/b/146665>
782         <rdar://problem/20835477>
783
784         Reviewed by Ryosuke Niwa.
785
786         Fix two buggy clients of enclosingBlock(node) that would fail if the returned
787         element is the same as the node passed in.
788
789         Test: editing/style/change-text-direction-crash.html
790
791         * editing/ApplyStyleCommand.cpp:
792         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
793         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
794
795 2015-07-06  Simon Fraser  <simon.fraser@apple.com>
796
797         Revert use of  SVG <mask> elements for -webkit-mask-image (r176798, r177494)
798         https://bugs.webkit.org/show_bug.cgi?id=146653
799
800         Reviewed by Dean Jackson.
801
802         Fixes rdar://problem/21435233.
803
804         r177494 caused a number of regressions (bugs 141857, 146509, 146561), added new layering violations, and
805         was not being maintained, so revert it.
806
807         This patch reverts r176798.
808
809         * CMakeLists.txt:
810         * WebCore.vcxproj/WebCore.vcxproj:
811         * WebCore.vcxproj/WebCore.vcxproj.filters:
812         * WebCore.xcodeproj/project.pbxproj:
813         * css/CSSValue.cpp:
814         (WebCore::CSSValue::cssText): Deleted.
815         (WebCore::CSSValue::destroy): Deleted.
816         * css/CSSValue.h:
817         (WebCore::CSSValue::isWebKitCSSResourceValue): Deleted.
818         * css/StyleBuilderConverter.h:
819         (WebCore::maskImageValueFromIterator): Deleted.
820         * css/StyleResolver.cpp:
821         (WebCore::StyleResolver::State::clear): Deleted.
822         * css/StyleResolver.h:
823         (WebCore::StyleResolver::State::maskImagesWithPendingSVGDocuments): Deleted.
824         * css/WebKitCSSResourceValue.cpp: Removed.
825         * css/WebKitCSSResourceValue.h: Removed.
826         * loader/cache/CachedResourceLoader.cpp:
827         (WebCore::CachedResourceLoader::addCachedResource): Deleted.
828         * loader/cache/CachedResourceLoader.h:
829         * loader/cache/CachedSVGDocument.cpp:
830         (WebCore::CachedSVGDocument::finishLoading):
831         (WebCore::CachedSVGDocument::CachedSVGDocument): Deleted.
832         * loader/cache/CachedSVGDocument.h:
833         * loader/cache/CachedSVGDocumentReference.cpp:
834         (WebCore::CachedSVGDocumentReference::CachedSVGDocumentReference):
835         (WebCore::CachedSVGDocumentReference::~CachedSVGDocumentReference):
836         (WebCore::CachedSVGDocumentReference::load):
837         * loader/cache/CachedSVGDocumentReference.h:
838         * page/FrameView.cpp:
839         (WebCore::FrameView::containsSVGDocument): Deleted.
840         * page/FrameView.h:
841         * page/Page.cpp:
842         (WebCore::Page::createPageFromBuffer): Deleted.
843         * page/Page.h:
844         * platform/ScrollView.h:
845         (WebCore::ScrollView::containsSVGDocument): Deleted.
846         * platform/graphics/MaskImageOperation.cpp: Removed.
847         * platform/graphics/MaskImageOperation.h: Removed.
848         * rendering/RenderLayer.cpp:
849         (WebCore::RenderLayer::RenderLayer): Deleted.
850         * rendering/RenderLayer.h:
851         * rendering/RenderLayerFilterInfo.cpp:
852         * rendering/RenderLayerFilterInfo.h:
853         * rendering/RenderLayerMaskImageInfo.h: Removed.
854         * rendering/style/FillLayer.cpp:
855         (WebCore::FillLayer::operator==):
856         (WebCore::FillLayer::cullEmptyLayers):
857         (WebCore::layerImagesIdentical):
858         (WebCore::FillLayer::FillLayer): Deleted.
859         (WebCore::FillLayer::operator=): Deleted.
860         (WebCore::FillLayer::hasNonEmptyMaskImage): Deleted.
861         (WebCore::FillLayer::imagesAreLoaded): Deleted.
862         * rendering/style/FillLayer.h:
863         (WebCore::FillLayer::maskImage): Deleted.
864         (WebCore::FillLayer::imageOrMaskImage): Deleted.
865         (WebCore::FillLayer::setMaskImage): Deleted.
866         (WebCore::FillLayer::clearMaskImage): Deleted.
867         (WebCore::FillLayer::hasMaskImage): Deleted.
868         * rendering/svg/RenderSVGResourceMasker.cpp:
869         (WebCore::RenderSVGResourceMasker::applyResource):
870         (WebCore::RenderSVGResourceMasker::applySVGMask): Deleted.
871         (WebCore::RenderSVGResourceMasker::drawMaskForRenderer): Deleted.
872         * rendering/svg/RenderSVGResourceMasker.h:
873         * svg/SVGMaskElement.cpp:
874         (WebCore::SVGMaskElement::createElementRenderer):
875         (WebCore::SVGMaskElement::addClientRenderLayer): Deleted.
876         (WebCore::SVGMaskElement::removeClientRenderLayer): Deleted.
877         * svg/SVGMaskElement.h:
878         * svg/SVGUseElement.cpp:
879         (WebCore::SVGUseElement::updateExternalDocument):
880         * svg/graphics/SVGImage.cpp:
881         (WebCore::SVGImage::dataChanged):
882
883 2015-07-06  Simon Fraser  <simon.fraser@apple.com>
884
885         Revert use of SVG <mask> elements for -webkit-mask-image (r176798, r177494, r186180)
886         https://bugs.webkit.org/show_bug.cgi?id=146653
887
888         Reviewed by Dean Jackson.
889
890         Fixes rdar://problem/21435233.
891
892         r177494 caused a number of regressions (bugs 141857, 146509, 146561), added new layering violations, and
893         was not being maintained, so revert it.
894
895         This patch reverts r177494.
896
897         * WebCore.xcodeproj/project.pbxproj:
898         * css/CSSComputedStyleDeclaration.cpp:
899         (WebCore::ComputedStyleExtractor::propertyValue):
900         * css/CSSParser.cpp:
901         (WebCore::CSSParser::parseFillProperty):
902         (WebCore::CSSParser::parseMaskImage): Deleted.
903         * css/CSSParser.h:
904         * css/CSSPropertyNames.in:
905         * css/CSSValue.h:
906         * css/StyleBuilderConverter.h:
907         (WebCore::StyleBuilderConverter::convertMaskImageOperations): Deleted.
908         * css/StyleResolver.cpp:
909         (WebCore::StyleResolver::loadPendingSVGDocuments):
910         (WebCore::StyleResolver::loadPendingImages):
911         (WebCore::StyleResolver::adjustStyleForMaskImages): Deleted.
912         (WebCore::StyleResolver::applyMatchedProperties): Deleted.
913         * css/StyleResolver.h:
914         * page/FrameView.cpp:
915         (WebCore::FrameView::containsSVGDocument):
916         * page/FrameView.h:
917         * page/animation/CSSPropertyAnimation.cpp:
918         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
919         (WebCore::blendFunc): Deleted.
920         (WebCore::MaskImagePropertyWrapper::MaskImagePropertyWrapper): Deleted.
921         (WebCore::MaskImagePropertyWrapper::equals): Deleted.
922         * platform/ScrollView.h:
923         (WebCore::ScrollView::containsSVGDocument):
924         * platform/graphics/MaskImageOperation.cpp:
925         (WebCore::MaskImageOperation::~MaskImageOperation): Deleted.
926         (WebCore::MaskImageOperation::operator==): Deleted.
927         * platform/graphics/MaskImageOperation.h:
928         * rendering/RenderBox.cpp:
929         (WebCore::RenderBox::maskClipRect):
930         * rendering/RenderBoxModelObject.cpp:
931         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
932         * rendering/RenderElement.cpp:
933         (WebCore::RenderElement::updateFillImages):
934         (WebCore::RenderElement::~RenderElement): Deleted.
935         * rendering/RenderLayer.cpp:
936         (WebCore::RenderLayer::~RenderLayer): Deleted.
937         (WebCore::RenderLayer::calculateClipRects): Deleted.
938         * rendering/RenderLayer.h:
939         * rendering/RenderLayerMaskImageInfo.cpp: Removed.
940         * rendering/style/FillLayer.h:
941         (WebCore::FillLayer::image):
942         (WebCore::FillLayer::imageOrMaskImage):
943         * rendering/style/RenderStyle.cpp:
944         (WebCore::RenderStyle::setMaskImage): Deleted.
945         * rendering/style/RenderStyle.h:
946
947 2015-07-06  Simon Fraser  <simon.fraser@apple.com>
948
949         Revert use of SVG <mask> elements for -webkit-mask-image (r176798, r177494, r186180)
950         https://bugs.webkit.org/show_bug.cgi?id=146653
951         
952         Fixes rdar://problem/21435233.
953
954         This patch reverts r186180, but keeps the layout test.
955
956         This feature caused a number of regressions (bugs 141857, 146509, 146561), added new layering violations, and
957         was not being maintained, so revert it.
958         
959         * loader/cache/CachedResourceLoader.cpp:
960         (WebCore::CachedResourceLoader::requestResource): Deleted.
961         * loader/cache/CachedResourceRequest.h:
962         (WebCore::CachedResourceRequest::acceptOverride): Deleted.
963         (WebCore::CachedResourceRequest::setAcceptOverride): Deleted.
964         * loader/cache/CachedSVGDocumentReference.cpp:
965         (WebCore::CachedSVGDocumentReference::load): Deleted.
966         * loader/cache/CachedSVGDocumentReference.h:
967         (WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType): Deleted.
968         * platform/graphics/MaskImageOperation.cpp:
969         (WebCore::MaskImageOperation::ensureCachedSVGDocumentReference):
970         (WebCore::MaskImageOperation::notifyFinished):
971
972 2015-07-06  Daniel Bates  <dabates@apple.com>
973
974         Fix the Windows build following <https://trac.webkit.org/changeset/186388>
975         (https://bugs.webkit.org/show_bug.cgi?id=144830)
976
977         As we for for Mac in WebCoreAVFResourceLoader::startLoading(), instantiate ResourceLoaderOptions
978         with ContentSecurityPolicyImposition::DoPolicyCheck.
979
980         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
981         (WebCore::WebCoreAVCFResourceLoader::startLoading):
982
983 2015-07-06  Daniel Bates  <dabates@apple.com>
984
985         Isolated worlds should respect Content Security Policy; User Agent Shadow DOM
986         should be exempt from Content Security Policy
987         https://bugs.webkit.org/show_bug.cgi?id=144830
988         <rdar://problem/18860261>
989
990         Reviewed by Geoffrey Garen.
991
992         Make scripts that run in an isolated world be subject to the Content Security Policy (CSP) of the page
993         and exempt features implemented using a user agent shadow DOM. As a side effect of this change,
994         Safari Content Extensions will respect the CSP policy of the page when loading subresources (e.g. an image).
995
996         Tests: http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
997                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-css-background.html
998                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-css-cursor.html
999                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-css-filter-on-image.html
1000                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-css-webkit-image-set.html
1001                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-embed-plugin.html
1002                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-external-script.html
1003                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-iframe.html
1004                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-image-after-redirect.html
1005                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-image.html
1006                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-inline-script.html
1007                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-inline-style.html
1008                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-inline-stylesheet.html
1009                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object-plugin.html
1010                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-object.html
1011                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-svg-feimage-element.html
1012                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-svg-font.html
1013                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-svg-use-element.html
1014                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-track.html
1015                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
1016                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/block-loading-user-agent-image-from-non-user-agent-content.html
1017                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/default-src-object-data-url-allowed.html
1018                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/default-src-object-data-url-blocked.html
1019                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/default-src-object-data-url-blocked2.html
1020                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/default-src-object-data-url-blocked3.html
1021                http/tests/security/contentSecurityPolicy/userAgentShadowDOM/video-controls-allowed.html
1022                http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp.html
1023
1024         * Modules/websockets/WebSocket.cpp:
1025         (WebCore::WebSocket::connect): Pass shouldBypassMainWorldContentSecurityPolicy to ContentSecurityPolicy::allowConnectToSource().
1026         * css/CSSCanvasValue.h:
1027         (WebCore::CSSCanvasValue::loadSubimages): Modified to take argument ResourceLoaderOptions (unused).
1028         * css/CSSCrossfadeValue.cpp:
1029         (WebCore::CSSCrossfadeValue::fixedSize): Explicitly instantiate default ResourceLoaderOptions and pass
1030         pass it when requesting a cached image. Added FIXME comment to skip Content Security Policy check when
1031         the cross fade is applied to an element in a user agent shadow tree.
1032         (WebCore::CSSCrossfadeValue::loadSubimages): Take a ResourceLoaderOptions as an argument and passes it
1033         as appropriate.
1034         (WebCore::CSSCrossfadeValue::image): Explicitly instantiate default ResourceLoaderOptions and pass it
1035         when requesting a cached image. Added FIXME comment to skip Content Security Policy check when the cross
1036         fade is applied to an element in a user agent shadow tree.
1037         * css/CSSCrossfadeValue.h:
1038         * css/CSSCursorImageValue.cpp:
1039         (WebCore::CSSCursorImageValue::cachedImage): Take a ResourceLoaderOptions as an argument and passes it
1040         as appropriate.
1041         * css/CSSCursorImageValue.h:
1042         * css/CSSFilterImageValue.cpp:
1043         (WebCore::CSSFilterImageValue::fixedSize): Explicitly instantiate default ResourceLoaderOptions and pass
1044         pass it when requesting a cached image. Added FIXME comment to skip Content Security Policy check when
1045         the cross fade is applied to an element in a user agent shadow tree.
1046         (WebCore::CSSFilterImageValue::loadSubimages): Take a ResourceLoaderOptions as an argument and passes it
1047         as appropriate.
1048         (WebCore::CSSFilterImageValue::loadSubimages): Explicitly instantiate default ResourceLoaderOptions and pass
1049         pass it when requesting a cached image. Added FIXME comment to skip Content Security Policy check when
1050         the cross fade is applied to an element in a user agent shadow tree.
1051         (WebCore::CSSFilterImageValue::image):
1052         * css/CSSFilterImageValue.h:
1053         * css/CSSFontFaceSrcValue.cpp:
1054         (WebCore::CSSFontFaceSrcValue::cachedFont): Take a boolean, isInitiatingElementInUserAgentShadowTree,
1055         so as to determine the appropriate CSP imposition. In particular, we skip the CSP check when the initiating element
1056         (e.g. SVG font-face element) is in a user agent shadow tree.
1057         * css/CSSFontFaceSrcValue.h:
1058         * css/CSSFontSelector.cpp:
1059         (WebCore::CSSFontSelector::addFontFaceRule): Take a boolean, isInitiatingElementInUserAgentShadowTree, and passes
1060         it as appropriate.
1061         * css/CSSFontSelector.h:
1062         * css/CSSGradientValue.h:
1063         (WebCore::CSSGradientValue::loadSubimages): Take a ResourceLoaderOptions as an argument and passes it
1064         as appropriate.
1065         * css/CSSImageGeneratorValue.cpp:
1066         (WebCore::CSSImageGeneratorValue::loadSubimages): Ditto.
1067         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue): Ditto.
1068         * css/CSSImageGeneratorValue.h:
1069         * css/CSSImageSetValue.cpp:
1070         (WebCore::CSSImageSetValue::cachedImageSet): Deleted.
1071         * css/CSSImageSetValue.h:
1072         * css/CSSImageValue.cpp:
1073         (WebCore::CSSImageValue::cachedImage): Deleted.
1074         * css/CSSImageValue.h:
1075         * css/RuleSet.cpp:
1076         (WebCore::RuleSet::addChildRules): Take a boolean, isInitiatingElementInUserAgentShadowTree, and passes
1077         it as appropriate.
1078         (WebCore::RuleSet::addRulesFromSheet): Added FIXME comment to skip Content Security Policy check when
1079         when stylesheet is in a user agent shadow tree.
1080         * css/RuleSet.h:
1081         * css/StyleResolver.cpp:
1082         (WebCore::StyleResolver::StyleResolver): Determine whether the SVG font-face element is in a user agent shadow tree
1083         and pass the appropriate value when calling CSSFontSelector::addFontFaceRule(). Also, modernized code; used C++11 range
1084         -based for-loop instead of const_iterator idiom.
1085         (WebCore::StyleResolver::loadPendingSVGDocuments): Skip CSP check when requesting subresources as a byproduct of
1086         resolving style for an element in a user agent shadow tree.
1087         (WebCore::StyleResolver::loadPendingImage): Ditto.
1088         (WebCore::StyleResolver::loadPendingShapeImage): Ditto.
1089         * css/StyleRuleImport.cpp:
1090         (WebCore::StyleRuleImport::requestStyleSheet): Added FIXME comment to skip Content Security Policy check when
1091         when stylesheet is in a user agent shadow tree.
1092         * dom/Element.h:
1093         * dom/InlineStyleSheetOwner.cpp:
1094         (WebCore::InlineStyleSheetOwner::createSheet): Skip CSP check for an inline <style> that is in a user agent shadow tree.
1095         * dom/Node.cpp:
1096         (WebCore::Node::isInUserAgentShadowTree): Added.
1097         * dom/Node.h:
1098         * dom/ScriptElement.cpp:
1099         (WebCore::ScriptElement::requestScript): Skip CSP check for an external JavaScript script in a user agent shadow tree.
1100         (WebCore::ScriptElement::executeScript): Skip CSP check for an inline JavaScript script that is in a user agent shadow tree.
1101         * dom/StyledElement.cpp:
1102         (WebCore::StyledElement::styleAttributeChanged): Skip CSP check when modifying the inline style of an element in a user
1103         agent shadow tree.
1104         * html/HTMLMediaElement.cpp:
1105         (WebCore::HTMLMediaElement::isSafeToLoadURL): Skip CSP check for a <audio>, <video> in a user agent shadow tree.
1106         (WebCore::HTMLMediaElement::outOfBandTrackSources): Ditto.
1107         * html/HTMLTrackElement.cpp:
1108         (WebCore::HTMLTrackElement::canLoadURL): Ditto.
1109         * html/track/LoadableTextTrack.cpp:
1110         (WebCore::LoadableTextTrack::loadTimerFired): Determine whether the <track> is in a user agent shadow tree
1111         and pass the appropriate value when calling TextTrackLoader::load().
1112         * loader/DocumentLoader.cpp:
1113         (WebCore::DocumentLoader::startLoadingMainResource): Do CSP check when loading a resource by default.
1114         * loader/ImageLoader.cpp:
1115         (WebCore::ImageLoader::updateFromElement): Skip CSP check for an image that is in a user agent shadow tree.
1116         * loader/MediaResourceLoader.cpp:
1117         (WebCore::MediaResourceLoader::start): Instantiate ResourceLoaderOptions passing placeholder value ContentSecurityPolicyImposition::DoPolicyCheck.
1118         This value does not affect the request because we do not check the Content Security Policy for raw resource requests.
1119         * loader/NetscapePlugInStreamLoader.cpp:
1120         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader): Added FIXME comment to skip Content Security Policy check
1121         when when associated plugin element is in a user agent shadow tree.
1122         * loader/PolicyChecker.cpp:
1123         (WebCore::PolicyChecker::checkNavigationPolicy): Skip CSP check for a <iframe> in a user agent shadow tree.
1124         * loader/ResourceLoaderOptions.h: Defined enum class ContentSecurityPolicyImposition with explicit type uint8_t so
1125         as to provide a hint to the compiler (for better packing) when it computes the memory layout for struct that
1126         contains an instance of this class.
1127         (WebCore::ResourceLoaderOptions::ResourceLoaderOptions): Added argument contentSecurityPolicyImposition.
1128         (WebCore::ResourceLoaderOptions::contentSecurityPolicyImposition): Added.
1129         (WebCore::ResourceLoaderOptions::setContentSecurityPolicyImposition): Added.
1130         * loader/SubframeLoader.cpp:
1131         (WebCore::SubframeLoader::pluginIsLoadable): Skip CSP check for a plugin element that is in a user agent shadow tree.
1132         (WebCore::SubframeLoader::createJavaAppletWidget): Skip CSP check for an applet element that is in a user agent shadow tree.
1133         * loader/TextTrackLoader.cpp:
1134         (WebCore::TextTrackLoader::load): Take a boolean, isInitiatingElementInUserAgentShadowTree, and sets the appropriate
1135         Content Security Policy imposition for the text track request.
1136         * loader/TextTrackLoader.h:
1137         * loader/cache/CachedResourceLoader.cpp:
1138         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): Skip CSP check for a user-specified stylesheet.
1139         (WebCore::CachedResourceLoader::canRequest): Only check the CSP of the page if specified in the resource loader options for the request.
1140         (WebCore::CachedResourceLoader::defaultCachedResourceOptions): Add ContentSecurityPolicyImposition::DoPolicyCheck to the default
1141         resource loader options so that do check the CSP policy of the page before performing a resource request by default.
1142         * loader/cache/CachedSVGDocumentReference.cpp:
1143         (WebCore::CachedSVGDocumentReference::load): Take a ResourceLoaderOptions as an argument and passes it as appropriate.
1144         * loader/cache/CachedSVGDocumentReference.h:
1145         * loader/icon/IconLoader.cpp:
1146         (WebCore::IconLoader::startLoading): Instantiate ResourceLoaderOptions passing placeholder value ContentSecurityPolicyImposition::DoPolicyCheck.
1147         This value does not affect the request because we do not check the Content Security Policy for raw resource requests.
1148         * page/ContentSecurityPolicy.cpp:
1149         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Take an argument called overrideContentSecurityPolicy (defaults to false). When
1150         overrideContentSecurityPolicy := true, this function unconditionally returns true.
1151         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Ditto.
1152         (WebCore::ContentSecurityPolicy::allowInlineScript): Ditto.
1153         (WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
1154         (WebCore::ContentSecurityPolicy::allowEval): Ditto.
1155         (WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
1156         (WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
1157         (WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
1158         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
1159         (WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
1160         (WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
1161         (WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
1162         (WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
1163         (WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
1164         (WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
1165         (WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
1166         * page/ContentSecurityPolicy.h:
1167         * page/DOMSecurityPolicy.cpp:
1168         * page/EventSource.cpp:
1169         (WebCore::EventSource::create): Pass shouldBypassMainWorldContentSecurityPolicy to ContentSecurityPolicy::allowConnectToSource().
1170         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1171         (WebCore::WebCoreAVFResourceLoader::startLoading): Instantiate ResourceLoaderOptions passing placeholder value ContentSecurityPolicyImposition::DoPolicyCheck.
1172         This value does not affect the request because we do not check the Content Security Policy for raw resource requests.
1173         * svg/SVGFEImageElement.cpp:
1174         (WebCore::SVGFEImageElement::requestImageResource): Skip CSP check for a SVG FEImage element in a user agent shadow tree.
1175         * svg/SVGFontFaceUriElement.cpp:
1176         (WebCore::SVGFontFaceUriElement::loadFont): Skip CSP check for a SVG font-face-uri element in a user agent shadow tree.
1177         * svg/SVGUseElement.cpp:
1178         (WebCore::SVGUseElement::updateExternalDocument): Skip CSP check for a SVG use element in a user agent shadow tree.
1179         * testing/Internals.cpp:
1180         (WebCore::Internals::ensureUserAgentShadowRoot): Added.
1181         * testing/Internals.h:
1182         * testing/Internals.idl: Added declaration for ensureUserAgentShadowRoot().
1183         * xml/XMLHttpRequest.cpp:
1184         (WebCore::XMLHttpRequest::open): Pass shouldBypassMainWorldContentSecurityPolicy to ContentSecurityPolicy::allowConnectToSource().
1185
1186 2015-07-06  Brent Fulgham  <bfulgham@apple.com>
1187
1188         Ensure media playback is stopped during page close
1189         https://bugs.webkit.org/show_bug.cgi?id=146554
1190         <rdar://problem/18033944>
1191
1192         Reviewed by Brady Eidson.
1193
1194         * Modules/webaudio/AudioContext.h:
1195         (WebCore::WebAudio::hostingDocument): Added.
1196         * html/HTMLMediaElement.h:
1197         (WebCore::HTMLMediaElement::hostingDocument): Added.
1198         * dom/Document.cpp:
1199         (WebCore::Document::~Document): Call new 'stopAllMediaPlaybackForDocument' at destruction time.
1200         * platform/audio/PlatformMediaSession.h:
1201         Made PlatformMediaSessionManager a friend so it can access the protected 'client' accessor.
1202         Updated PlatformMediaSessionClient to require clients to have a "hostingDocument" member.
1203         * platform/audio/PlatformMediaSessionManager.cpp:
1204         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument): Added. Only pauses
1205         playback on elements that match the provided document.
1206         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess): Added. Pauses playback
1207         on all elements in the current process.
1208         * platform/audio/PlatformMediaSessionManager.h:
1209
1210 2015-07-06  Alex Christensen  <achristensen@webkit.org>
1211
1212         [Content Extensions] Remove memory page reporting
1213         https://bugs.webkit.org/show_bug.cgi?id=146659
1214
1215         Reviewed by Benjamin Poulain.
1216
1217         * contentextensions/CompiledContentExtension.cpp:
1218         (WebCore::ContentExtensions::CompiledContentExtension::~CompiledContentExtension):
1219         (WebCore::ContentExtensions::CompiledContentExtension::globalDisplayNoneSelectors):
1220         * contentextensions/CompiledContentExtension.h:
1221         * contentextensions/ContentExtension.cpp:
1222         (WebCore::ContentExtensions::ContentExtension::globalDisplayNoneStyleSheet):
1223         * contentextensions/ContentExtension.h:
1224         (WebCore::ContentExtensions::ContentExtension::compiledExtension):
1225         * contentextensions/ContentExtensionsBackend.cpp:
1226         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
1227         * contentextensions/DFABytecodeInterpreter.cpp:
1228         (WebCore::ContentExtensions::getBits):
1229         (WebCore::ContentExtensions::getInstruction):
1230         (WebCore::ContentExtensions::jumpSizeInBytes):
1231         (WebCore::ContentExtensions::getJumpSize):
1232         (WebCore::ContentExtensions::getJumpDistance):
1233         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
1234         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
1235         (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsForDefaultStylesheetFromDFARoot):
1236         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
1237         * contentextensions/DFABytecodeInterpreter.h:
1238         Don't keep track of memory page usage.  It wasn't even correct anyways.
1239
1240 2015-07-06  Alex Christensen  <achristensen@webkit.org>
1241
1242         [Content Extensions] Increase maxNFASize
1243         https://bugs.webkit.org/show_bug.cgi?id=146656
1244
1245         Reviewed by Benjamin Poulain.
1246
1247         Because of memory improvements in r186375, r186374, and r186079,
1248         we can now increase the maximum number of NFA nodes in order to avoid
1249         long compile times of some large, complicated content blockers.
1250         This also improves the interpreting time of content blockers.
1251
1252         * contentextensions/ContentExtensionCompiler.cpp:
1253         (WebCore::ContentExtensions::compileRuleList):
1254         Increase maxNFASize to 75000 to avoid long compile times.
1255
1256 2015-07-06  Dean Jackson  <dino@apple.com>
1257
1258         Memory corruption in WebGLRenderingContext::simulateVertexAttrib0
1259         https://bugs.webkit.org/show_bug.cgi?id=146652
1260         <rdar://problem/21567767>
1261
1262         Follow-up fix.
1263
1264         * html/canvas/WebGLRenderingContextBase.cpp:
1265         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
1266
1267 2015-07-06  Dean Jackson  <dino@apple.com>
1268
1269         Memory corruption in WebGLRenderingContext::simulateVertexAttrib0
1270         https://bugs.webkit.org/show_bug.cgi?id=146652
1271         <rdar://problem/21567767>
1272
1273         Reviewed by Brent Fulgham.
1274
1275         The expression "(numVertex + 1) * 4 * sizeof(GC3Dfloat)" could potentially
1276         overflow. Make it use checked arithmetic.
1277
1278         I couldn't make a test case that reliably exercised this.
1279
1280         * html/canvas/WebGLRenderingContextBase.cpp:
1281         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Used Checked<GC3Dsizeiptr>
1282         for calculating the size of the buffer.
1283
1284 2015-07-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
1285
1286         [Mac] REGRESSION: (r181403) Enter/Exit full screen on 1x secondary display plugged into 2x Mac displays WebView as 1/4 size during transition
1287         https://bugs.webkit.org/show_bug.cgi?id=146651
1288
1289         Reviewed by Simon Fraser.
1290
1291         * platform/mac/WebCoreFullScreenPlaceholderView.mm: set layerContentsPlacement
1292         to NSViewLayerContentsPlacementScaleProportionallyToFit so AppKit resizes the
1293         content CALayer to fit in the WebView.
1294
1295 2015-07-06  Benjamin Poulain  <benjamin@webkit.org>
1296
1297         Reduce the memory usage of the prefix tree
1298         https://bugs.webkit.org/show_bug.cgi?id=146615
1299
1300         Reviewed by Sam Weinig.
1301
1302         This patch introduces two little changes that reduces the size
1303         of the prefix tree by about 40%.
1304
1305         First, the Terms are interned. The new class CombinedFiltersAlphabet
1306         takes care of keeping a unique version of each term for use
1307         by the CombinedURLFilters.
1308
1309         Since each Term is fairly big but we have a small number of
1310         unique term, we significantly reduce the edge size.
1311
1312         Second, the actions are no longer stored on each Vertex.
1313         They are now stored on the side, in a HashMap indexed by
1314         their Vertex.
1315
1316         This works well because the Actions are sparse over the tree.
1317         Typically, only the leaves have actions. Internal vertices
1318         sometime get actions but that's uncommon.
1319
1320         ---
1321
1322         The next step to reduce the memory footprint would be to
1323         make PrefixTreeVertex into a custom packed structure instead
1324         of using a Vector.
1325
1326         Such change is very invasive and more error prone so I decided
1327         against it for this patch.
1328
1329         * WebCore.xcodeproj/project.pbxproj:
1330         * contentextensions/CombinedFiltersAlphabet.cpp: Copied from Source/WebCore/contentextensions/CombinedURLFilters.h.
1331         (WebCore::ContentExtensions::TermCreatorTranslator::hash):
1332         (WebCore::ContentExtensions::TermCreatorTranslator::equal):
1333         (WebCore::ContentExtensions::TermCreatorTranslator::translate):
1334         (WebCore::ContentExtensions::CombinedFiltersAlphabet::interned):
1335         (WebCore::ContentExtensions::CombinedFiltersAlphabet::memoryUsed):
1336         * contentextensions/CombinedFiltersAlphabet.h: Copied from Source/WebCore/contentextensions/CombinedURLFilters.h.
1337         (WebCore::ContentExtensions::CombinedFiltersAlphabet::TermPointerHash::hash):
1338         (WebCore::ContentExtensions::CombinedFiltersAlphabet::TermPointerHash::equal):
1339         * contentextensions/CombinedURLFilters.cpp:
1340         (WebCore::ContentExtensions::recursiveMemoryUsed):
1341         (WebCore::ContentExtensions::CombinedURLFilters::memoryUsed):
1342         (WebCore::ContentExtensions::prefixTreeVertexToString):
1343         (WebCore::ContentExtensions::recursivePrint):
1344         (WebCore::ContentExtensions::CombinedURLFilters::addPattern):
1345         (WebCore::ContentExtensions::generateNFAForSubtree):
1346         (WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
1347         * contentextensions/CombinedURLFilters.h:
1348         * contentextensions/ContentExtensionsDebugging.h:
1349         * contentextensions/Term.h:
1350         (WebCore::ContentExtensions::Term::isValid):
1351         (WebCore::ContentExtensions::Term::destroy):
1352         (WebCore::ContentExtensions::Term::memoryUsed):
1353         (WebCore::ContentExtensions::Term::toString): Deleted.
1354         (WebCore::ContentExtensions::TermHash::hash): Deleted.
1355         (WebCore::ContentExtensions::TermHash::equal): Deleted.
1356         (WebCore::ContentExtensions::Term::Term): Deleted.
1357         (WebCore::ContentExtensions::Term::isKnownToMatchAnyString): Deleted.
1358         (WebCore::ContentExtensions::Term::hasFixedLength): Deleted.
1359         (WebCore::ContentExtensions::Term::operator==): Deleted.
1360         (WebCore::ContentExtensions::Term::hash): Deleted.
1361         (WebCore::ContentExtensions::Term::isDeletedValue): Deleted.
1362         (WebCore::ContentExtensions::Term::isUniversalTransition): Deleted.
1363         (WebCore::ContentExtensions::Term::generateSubgraphForAtom): Deleted.
1364
1365 2015-07-06  Benjamin Poulain  <benjamin@webkit.org>
1366
1367         [Content Extensions] Make the DFA transitions ranges instead of characters
1368         https://bugs.webkit.org/show_bug.cgi?id=146575
1369
1370         Reviewed by Alex Christensen.
1371
1372         This patch changes the DFA and code using the DFA to use ranges
1373         to represent the transitions between any two nodes.
1374
1375         This patch builds on top of the tools introduced in r186079.
1376
1377         The DFA structure is basically the same as ImmutableNFA but without
1378         any epsilon transitions.
1379
1380         This patch introduces a transition iterator to make the DFA
1381         compatible with the existing algorithms.
1382
1383         ---
1384
1385         The DFA combiner is rebuilt on top of MutableRangeList. Combining the transitions
1386         of two nodes is one by merging the range list of each not into a common
1387         MutableRangeList.
1388         The data converter takes care of creating the signature of the combination.
1389
1390         The code got simpler since MutableRangeList does most of the work now. It is also
1391         much faster.
1392
1393         ---
1394
1395         The minimizer is more intersting.
1396
1397         With the current algorithm, we cannot resolve overlaps between ranges. On the other
1398         hand, the minimizer does not care about the symbol of the transitions if we are careful
1399         to partition transitions of the same symbol together.
1400
1401         What I did was to turn the minimizer into a pure transition based one, BUT each
1402         "symbol" is actually an unbreakable range.
1403
1404         The first step is to go over all the transitions of all the nodes and find the largest
1405         ranges such that the alphabet of interest is covered but there is not a single intersection
1406         between any two nodes (what I called "singular transitions" in the code). 
1407
1408         This can be done efficiently with MutableRangeList.
1409         A little trick there is that I also used the converter to count how many real transition
1410         overlaps any singular transition.
1411
1412         Those singular transitions become the alphabet of our minimizer. The "symbol" of our alphabet
1413         is simply the position of the singular transition in the list.
1414
1415         The partition of transition is created by populating each set with all the transition that
1416         overlaps the symbols.
1417         Note that since the partition is created on the fly, the Transition structure used for
1418         repartitioning only contains the source of the transitions.
1419
1420         Once our transition parition has been carefuly created, we can completely forget about
1421         the symbols and only work with subsets.
1422
1423         Since the singular transitions have no overlap (unlike fallback transitions), this new minimizer
1424         will find the minimial solution for well formed input.
1425
1426         * WebCore.xcodeproj/project.pbxproj:
1427         * contentextensions/DFA.cpp:
1428         (WebCore::ContentExtensions::DFA::memoryUsed):
1429         (WebCore::ContentExtensions::printTransitions):
1430         (WebCore::ContentExtensions::DFANode::actions): Deleted.
1431         (WebCore::ContentExtensions::DFANode::transitions): Deleted.
1432         (WebCore::ContentExtensions::DFANode::fallbackTransitionDestination): Deleted.
1433         (WebCore::ContentExtensions::DFANode::changeFallbackTransition): Deleted.
1434         (WebCore::ContentExtensions::DFANode::addFallbackTransition): Deleted.
1435         (WebCore::ContentExtensions::DFANode::containsTransition): Deleted.
1436         (WebCore::ContentExtensions::DFANode::kill): Deleted.
1437         (WebCore::ContentExtensions::DFA::debugPrintDot): Deleted.
1438         * contentextensions/DFA.h:
1439         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::range):
1440         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::target):
1441         (WebCore::ContentExtensions::DFANode::RangeIterator::range):
1442         (WebCore::ContentExtensions::DFANode::RangeIterator::target):
1443         (WebCore::ContentExtensions::DFANode::RangeIterator::resetTarget):
1444         * contentextensions/DFABytecodeCompiler.cpp:
1445         (WebCore::ContentExtensions::DFABytecodeCompiler::ranges):
1446         (WebCore::ContentExtensions::DFABytecodeCompiler::nodeTransitionsMaxBytecodeSize):
1447         (WebCore::ContentExtensions::DFABytecodeCompiler::compileNodeTransitions):
1448         * contentextensions/DFACombiner.cpp:
1449         (WebCore::ContentExtensions::DFAMerger::TargetConverter::convert):
1450         (WebCore::ContentExtensions::DFAMerger::TargetConverter::extend):
1451         (WebCore::ContentExtensions::DFAMerger::TargetConverter::setHalfSignature):
1452         (WebCore::ContentExtensions::DFAMerger::merge):
1453         (WebCore::ContentExtensions::DFAMerger::getOrCreateCombinedNode):
1454         (WebCore::ContentExtensions::DFAMerger::setHalfSignature): Deleted.
1455         (WebCore::ContentExtensions::DFAMerger::populateTransitions): Deleted.
1456         (WebCore::ContentExtensions::DFAMerger::populateFromFallbackTransitions): Deleted.
1457         (WebCore::ContentExtensions::DFAMerger::createTransitions): Deleted.
1458         (WebCore::ContentExtensions::DFAMerger::createFallbackTransitionIfNeeded): Deleted.
1459         * contentextensions/DFAMinimizer.cpp:
1460         (WebCore::ContentExtensions::DFAMinimizer::minimize):
1461         * contentextensions/DFANode.cpp: Added.
1462         (WebCore::ContentExtensions::DFANode::actions):
1463         (WebCore::ContentExtensions::DFANode::containsTransition):
1464         (WebCore::ContentExtensions::DFANode::kill):
1465         (WebCore::ContentExtensions::DFANode::canUseFallbackTransition):
1466         (WebCore::ContentExtensions::DFANode::bestFallbackTarget):
1467         * contentextensions/DFANode.h:
1468         (WebCore::ContentExtensions::CharRange::size):
1469         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::operator*):
1470         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::operator==):
1471         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::operator!=):
1472         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::operator++):
1473         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::first):
1474         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::last):
1475         (WebCore::ContentExtensions::DFANode::ConstRangeIterator::data):
1476         (WebCore::ContentExtensions::DFANode::IterableConstRange::begin):
1477         (WebCore::ContentExtensions::DFANode::IterableConstRange::end):
1478         (WebCore::ContentExtensions::DFANode::transitions):
1479         (WebCore::ContentExtensions::DFANode::RangeIterator::operator*):
1480         (WebCore::ContentExtensions::DFANode::RangeIterator::operator==):
1481         (WebCore::ContentExtensions::DFANode::RangeIterator::operator!=):
1482         (WebCore::ContentExtensions::DFANode::RangeIterator::operator++):
1483         (WebCore::ContentExtensions::DFANode::RangeIterator::first):
1484         (WebCore::ContentExtensions::DFANode::RangeIterator::last):
1485         (WebCore::ContentExtensions::DFANode::RangeIterator::data):
1486         (WebCore::ContentExtensions::DFANode::IterableRange::begin):
1487         (WebCore::ContentExtensions::DFANode::IterableRange::end):
1488         (WebCore::ContentExtensions::DFANode::hasFallbackTransition): Deleted.
1489         (WebCore::ContentExtensions::DFANode::transitionsLength): Deleted.
1490         (WebCore::ContentExtensions::DFANode::transitionsStart): Deleted.
1491         (WebCore::ContentExtensions::DFANode::resetTransitions): Deleted.
1492         (WebCore::ContentExtensions::DFANode::setHasFallbackTransitionWithoutChangingDFA): Deleted.
1493         * contentextensions/ImmutableNFA.h:
1494         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::first):
1495         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::last):
1496         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::data):
1497         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::range):
1498         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator*): Deleted.
1499         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator->): Deleted.
1500         * contentextensions/ImmutableNFANodeBuilder.h:
1501         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::FakeRangeIterator::first):
1502         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::FakeRangeIterator::last):
1503         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::FakeRangeIterator::operator*): Deleted.
1504         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::FakeRangeIterator::operator->): Deleted.
1505         * contentextensions/MutableRange.h:
1506         (WebCore::ContentExtensions::MutableRange::size): Deleted.
1507         * contentextensions/MutableRangeList.h:
1508         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::first):
1509         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::last):
1510         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::data):
1511         (WebCore::ContentExtensions::MutableRangeList::extend):
1512         (WebCore::ContentExtensions::MutableRangeList::size):
1513         (WebCore::ContentExtensions::MutableRangeList::initializeFrom):
1514         * contentextensions/NFAToDFA.cpp:
1515         (WebCore::ContentExtensions::NFAToDFA::convert):
1516         (WebCore::ContentExtensions::canUseFallbackTransition): Deleted.
1517         (WebCore::ContentExtensions::findBestFallbackTarget): Deleted.
1518
1519 2015-07-06  Timothy Hatcher  <timothy@apple.com>
1520
1521         Fix ASSERT causing crashes in Inspector tests on the bots.
1522
1523         * inspector/InspectorPageAgent.cpp:
1524         (WebCore::InspectorPageAgent::enable): Reset stopwatch before starting it.
1525
1526 2015-07-06  Brady Eidson  <beidson@apple.com>
1527
1528         Remove unused "m_isPrivate" flag on NetworkStorageSession.
1529         https://bugs.webkit.org/show_bug.cgi?id=146648
1530
1531         Reviewed by Alex Christensen.
1532
1533         No new tests (No behavior change).
1534
1535         * platform/network/NetworkStorageSession.h:
1536         (WebCore::NetworkStorageSession::isPrivateBrowsingSession): Deleted.
1537
1538         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1539         (WebCore::NetworkStorageSession::NetworkStorageSession): Deleted.
1540         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
1541
1542         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1543         (WebCore::NetworkStorageSession::NetworkStorageSession): Deleted.
1544         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
1545
1546 2015-07-04  Timothy Hatcher  <timothy@apple.com>
1547
1548         Web Inspector: Add a dedicated Network tab that is always live
1549         https://bugs.webkit.org/show_bug.cgi?id=146568
1550
1551         Make sure the executionStopwatch is always started and never stops so resource loads
1552         always get timestamps, even when Timeline is not recording.
1553
1554         Reviewed by Joseph Pecoraro.
1555
1556         * inspector/InspectorPageAgent.cpp:
1557         (WebCore::InspectorPageAgent::enable): Start executionStopwatch.
1558         (WebCore::InspectorPageAgent::frameStartedLoading): Reset and start executionStopwatch.
1559         * inspector/InspectorTimelineAgent.cpp:
1560         (WebCore::InspectorTimelineAgent::internalStart): Removed executionStopwatch code.
1561         (WebCore::InspectorTimelineAgent::internalStop): Ditto.
1562
1563 2015-07-02  Timothy Hatcher  <timothy@apple.com>
1564
1565         Update the localized strings file.
1566
1567         * English.lproj/Localizable.strings: Updated with the script.
1568
1569 2015-07-06  Zalan Bujtas  <zalan@apple.com>
1570
1571         Crash: LayoutState root's container is nullptr when the layout root is detached.
1572         https://bugs.webkit.org/show_bug.cgi?id=146646
1573         rdar://problem/21371544
1574
1575         Reviewed by Simon Fraser.
1576
1577         This is a speculative fix to ensure that when the root of the LayoutState is detached
1578         we don't try to access its container (nullptr).
1579         This is related to trac.webkit.org/r185484.
1580
1581         Not reproducible.
1582
1583         * rendering/LayoutState.cpp:
1584         (WebCore::LayoutState::LayoutState):
1585         * rendering/LayoutState.h:
1586         (WebCore::LayoutState::LayoutState): Deleted.
1587
1588 2015-07-06  Eric Carlson  <eric.carlson@apple.com>
1589
1590         [Mac] Inactive AirPlay route should automatically timeout
1591         https://bugs.webkit.org/show_bug.cgi?id=146642
1592         <rdar://problem/21602955>
1593
1594         Automatically clear a media element's AirPlay connection after it has been paused
1595         for 60 minutes, or after 8 minutes if it played to the end before pausing.
1596
1597         Reviewed by Brent Fulgham.
1598
1599         * Modules/mediasession/WebMediaSessionManager.cpp:
1600         (WebCore::WebMediaSessionManager::WebMediaSessionManager): Initialize m_watchdogTimer.
1601         (WebCore::WebMediaSessionManager::clientStateDidChange): Schedule watchdog timer configuration
1602           if the client started playing or paused.
1603         (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Schedule watchdog timer configuration.
1604         (WebCore::WebMediaSessionManager::toString): Print watchdog configuration flag.
1605         (WebCore::WebMediaSessionManager::taskTimerFired): Call configureWatchdogTimer.
1606         (WebCore::WebMediaSessionManager::configureWatchdogTimer): New, start or stop watchdog timer.
1607         (WebCore::WebMediaSessionManager::watchdogTimerFired): Stop monitoring for targets, which 
1608           clears the route.
1609         * Modules/mediasession/WebMediaSessionManager.h:
1610
1611         * html/HTMLMediaElement.cpp:
1612         (WebCore::HTMLMediaElement::mediaState): Set DidPlayToEnd when appropriate.
1613
1614         * page/MediaProducer.h: Add DidPlayToEnd.
1615
1616         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1617         (WebCore::MediaPlaybackTargetPickerMac::~MediaPlaybackTargetPickerMac): Clear m_client, call
1618           stopMonitoringPlaybackTargets.
1619         (WebCore::MediaPlaybackTargetPickerMac::pendingActionTimerFired): Send a neutered 
1620           MediaPlaybackTarget when m_outputDeviceMenuController is NULL.
1621         (WebCore::MediaPlaybackTargetPickerMac::devicePicker): Add logging.
1622         (WebCore::MediaPlaybackTargetPickerMac::stopMonitoringPlaybackTargets): Clear the menu
1623           controller to cancel the route.
1624
1625 2015-07-06  Zan Dobersek  <zdobersek@igalia.com>
1626
1627         [GTK] Fix build errors with OpenGL ES
1628         https://bugs.webkit.org/show_bug.cgi?id=146626
1629
1630         Reviewed by Carlos Garcia Campos.
1631
1632         * platform/graphics/ANGLEWebKitBridge.h: Include <GLES2/gl2.h>
1633         when building with OpenGL ES 2 support enabled.
1634         (WebCore::ANGLEShaderSymbol::isSampler): Don't test for
1635         OpenGL-specific GL_SAMPLER_2D_RECT_ARB value when OpenGL ES 2
1636         support is enabled.
1637
1638 2015-07-06  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1639
1640         [Streams API] Remove ReadableStream custom constructor
1641         https://bugs.webkit.org/show_bug.cgi?id=146547
1642
1643         Reviewed by Darin Adler.
1644
1645         Removed custom binding.
1646         Made use of Dictionary in lieu of JSObject to reduce readable stream constructor parameter parsing.
1647         Added support for passing ExecState to construtor within binding generator.
1648
1649         No change in behavior.
1650
1651         * Modules/streams/ReadableStream.cpp:
1652         (WebCore::ReadableStream::create):
1653         * Modules/streams/ReadableStream.h:
1654         (WebCore::ReadableStream::create):
1655         * Modules/streams/ReadableStream.idl:
1656         * bindings/js/JSDictionary.cpp:
1657         (WebCore::JSDictionary::convertValue):
1658         * bindings/js/JSDictionary.h:
1659         * bindings/js/JSReadableStreamCustom.cpp:
1660         * bindings/js/ReadableJSStream.cpp:
1661         (WebCore::ReadableJSStream::create):
1662         (WebCore::ReadableJSStream::ReadableJSStream):
1663         * bindings/js/ReadableJSStream.h:
1664         * bindings/scripts/CodeGeneratorJS.pm:
1665         (GenerateConstructorDefinition):
1666         * bindings/scripts/IDLAttributes.txt:
1667
1668 2015-07-06  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1669
1670         Promise-returning functions should reject promises if the callee is not of the expected type
1671         https://bugs.webkit.org/show_bug.cgi?id=146585
1672
1673         Reviewed by Darin Adler.
1674
1675         Updated binding generator to reject promise in case the casting of the thisValue is not working properly
1676         (i.e. the callee is not wrapping a DOM object of the expected class.
1677
1678         Covered by rebased test and binding expectations.
1679
1680         * bindings/js/JSDOMPromise.h:
1681         (WebCore::callPromiseFunction): Removed wrapper class parameter.
1682         * bindings/scripts/CodeGeneratorJS.pm:
1683         (GenerateImplementation):
1684         * bindings/scripts/test/JS/JSTestObj.cpp: Updated binding expectations.
1685         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
1686         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
1687         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
1688         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
1689         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
1690         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
1691         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
1692         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
1693
1694 2015-07-05  Chris Dumez  <cdumez@apple.com>
1695
1696         [WK2] Current page's scroll position is lost when transferring sessionState from one view to another
1697         https://bugs.webkit.org/show_bug.cgi?id=146625
1698         <rdar://problem/21585268>
1699
1700         Reviewed by Gavin Barraclough.
1701
1702         Export HistoryController:saveScrollPositionAndViewStateToItem()
1703         so that it can be called from WebKit2.
1704
1705         * loader/HistoryController.h:
1706
1707 2015-07-05  Simon Fraser  <simon.fraser@apple.com>
1708
1709         REGRESSION (r180582): background-attachment: local; does not scroll the background image when scrolling the the element's contents
1710         https://bugs.webkit.org/show_bug.cgi?id=146623
1711
1712         Reviewed by Zalan Bujtas.
1713         
1714         r180582 erroneously asserted that m_destOrigin in BackgroundImageGeometry was unused.
1715         However, it is needed to compute the correct phase when the destination rect is
1716         altered by clipping.
1717
1718         Test: fast/backgrounds/background-attachment-local.html
1719
1720         * rendering/RenderBoxModelObject.cpp:
1721         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1722         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
1723         * rendering/RenderBoxModelObject.h:
1724         (WebCore::BackgroundImageGeometry::BackgroundImageGeometry):
1725         (WebCore::BackgroundImageGeometry::relativePhase):
1726         * rendering/svg/RenderSVGResourceMasker.cpp:
1727         (WebCore::RenderSVGResourceMasker::drawMaskForRenderer):
1728
1729 2015-07-05  Chris Dumez  <cdumez@apple.com>
1730
1731         [WK2] WebBackForwardListItems' pageState is not kept up-to-date
1732         https://bugs.webkit.org/show_bug.cgi?id=146614
1733         <rdar://problem/21585268>
1734
1735         Reviewed by Gavin Barraclough.
1736
1737         WebBackForwardListItems' pageState on UIProcess-side were not kept
1738         up-to-date when it was updated on WebContent process side. This meant
1739         that we were losing the scroll position (among other things) when
1740         transferring the session state over from one view to another.
1741
1742         We now call notifyHistoryItemChanged(item) after saving the scroll
1743         position and the view state on the HistoryItem. As a result, the
1744         WebBackForwardListProxy will send the updated pageState to the
1745         UIProcess.
1746
1747         * history/HistoryItem.cpp:
1748         (WebCore::HistoryItem::notifyChanged):
1749         * history/HistoryItem.h:
1750         * loader/HistoryController.cpp:
1751         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
1752
1753 2015-07-04  Chris Dumez  <cdumez@apple.com>
1754
1755         Unreviewed Windows build fix after r186279.
1756
1757         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1758         (WebCore::AVFWrapper::destroyVideoLayer):
1759         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
1760         (WebCore::CACFLayerTreeHost::destroyRenderer):
1761
1762 2015-07-04  Chris Dumez  <cdumez@apple.com>
1763
1764         Drop RefPtr::clear() method
1765         https://bugs.webkit.org/show_bug.cgi?id=146556
1766
1767         Reviewed by Brady Eidson.
1768
1769         Drop RefPtr::clear() method in favor of "= nullptr;" pattern.
1770
1771 2015-07-03  Dan Bernstein  <mitz@apple.com>
1772
1773         Fixed the iOS 8 build.
1774
1775         * editing/cocoa/HTMLConverter.mm:
1776
1777 2015-07-03  Chris Dumez  <cdumez@apple.com>
1778
1779         REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options
1780         https://bugs.webkit.org/show_bug.cgi?id=146566
1781         <rdar://problem/21663919>
1782
1783         Reviewed by Ryosuke Niwa.
1784
1785         HTMLSelectElement.add(X, undefined) is supposed to be equivalent to
1786         HTMLSelectElement.add(X) which should *append* X. The same is true
1787         for HTMLOptionsCollection.add(X, undefined).
1788
1789         However, due to a bug in our bindings generator for overloaded
1790         operations, the actual behavior was not the expected one. The
1791         second overload would be chosen: add(X, index) and undefined would
1792         be converted as 0-index, which would *prepend* X.
1793
1794         This patch fixes the bindings generator so that undefined is allowed
1795         for optional parameters of an overload operation, when doing the
1796         overload resolution.
1797
1798         Tests:
1799         - fast/dom/HTMLSelectElement/add.html
1800         - fast/dom/HTMLSelectElement/options-collection-add.html
1801         - http/tests/websocket/tests/hybi/undefined-protocol.html
1802
1803         * bindings/scripts/CodeGeneratorJS.pm:
1804         (GenerateParametersCheckExpression):
1805         Allow undefined value for optional parameters when doing the overload
1806         resolution.
1807
1808         * bindings/scripts/test/JS/JSTestObj.cpp:
1809         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
1810         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
1811         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
1812         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
1813         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1814         (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors):
1815         * bindings/scripts/test/TestObj.idl:
1816         Add bindings tests coverage and rebaseline.
1817
1818 2015-07-03  Dan Bernstein  <mitz@apple.com>
1819
1820         Fixed the Mavericks build after r186236.
1821
1822         * loader/cache/CachedResource.h:
1823         (WebCore::CachedResource::url): Removed the export macro from this inline function.
1824
1825 2015-07-03  Dan Bernstein  <mitz@apple.com>
1826
1827         Tried to fix the iOS build.
1828
1829         * bridge/objc/objc_class.mm:
1830         (JSC::Bindings::ObjcClass::fieldNamed):
1831
1832 2015-07-03  Dan Bernstein  <mitz@apple.com>
1833
1834         Tried to fix the iOS build.
1835
1836         * editing/cocoa/HTMLConverter.mm:
1837
1838 2015-07-03  Dan Bernstein  <mitz@apple.com>
1839
1840         Tried to fix the iOS build.
1841
1842         * page/FrameView.cpp:
1843         (WebCore::FrameView::calculateExtendedBackgroundMode):
1844
1845 2015-07-03  Dan Bernstein  <mitz@apple.com>
1846
1847         [Xcode] Update some build settings as recommended by Xcode 7
1848         https://bugs.webkit.org/show_bug.cgi?id=146597
1849
1850         Reviewed by Sam Weinig.
1851
1852         * Configurations/Base.xcconfig: Enabled CLANG_WARN_UNREACHABLE_CODE,
1853         GCC_WARN_UNDECLARED_SELECTOR, and GCC_NO_COMMON_BLOCKS. Removed GCC_MODEL_TUNING.
1854
1855         * WebCore.xcodeproj/project.pbxproj: Updated LastUpgradeCheck. Disabled -Wunreachable-code
1856         for two bison-generated source files. Updated for rename of WebScriptObject.h.
1857
1858         * bindings/objc/WebScriptObject.mm:
1859         (-[WebUndefined dealloc]): Removed unreachable code and suppressed warning about not calling
1860         super.
1861         * bridge/objc/WebScriptObject.h: Renamed to WebScriptObjectProtocol.h to enabled inlcuding
1862         the other WebScriptObject.h.
1863         * bridge/objc/WebScriptObjectProtocol.h: Renamed from WebScriptObject.h.
1864
1865         * bridge/objc/objc_class.mm: Updated for rename and included WebScriptObject.h because we
1866         use selectors declared in that file.
1867
1868         * bridge/objc/objc_instance.mm: Ditto.
1869         (ObjCRuntimeMethod::create): Resolved ambiguity between JSC::JSValue and the Objective-C
1870         JSValue class.
1871         (ObjCRuntimeMethod::createStructure): Ditto.
1872         (ObjcInstance::invokeMethod): Ditto.
1873         (ObjcInstance::invokeObjcMethod): Ditto.
1874         (ObjcInstance::invokeDefaultMethod): Ditto.
1875         (ObjcInstance::setValueOfUndefinedField): Ditto.
1876         (ObjcInstance::getValueOfUndefinedField): Ditto.
1877         (ObjcInstance::defaultValue): Ditto.
1878         (ObjcInstance::stringValue): Ditto.
1879         (ObjcInstance::numberValue): Ditto.
1880         (ObjcInstance::booleanValue): Ditto.
1881         (ObjcInstance::valueOf): Ditto,
1882
1883         * bridge/objc/objc_runtime.h: Moved definition of isFallbackMethod() from here to the
1884         implementation.
1885         * bridge/objc/objc_runtime.mm: Updated for rename and included WebScriptObject.h because we
1886         use selectors declared in that file.
1887         (JSC::Bindings::ObjcMethod::isFallbackMethod): Moved definition from the header to here.
1888
1889         * bridge/objc/objc_utility.mm: Updated for rename.
1890
1891         * cssjit/SelectorCompiler.cpp:
1892         (WebCore::SelectorCompiler::addScrollbarPseudoClassType): Removed unreachable code.
1893
1894         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1895         Added declarations to the WebCoreMovieObserver interface.
1896         (WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Suppressed
1897         -Wundeclared-selector around invocation of a selector that is not declared anywhere.
1898
1899 2015-07-03  Kyounga Ra  <kyounga@alticast.com>
1900
1901         Memory leak for a protected Element having pending events in ImageLoader. 
1902         https://bugs.webkit.org/show_bug.cgi?id=146538
1903
1904         Reviewed by Brady Eidson.
1905
1906         If ImageLoader is destroyed before an active derefElementTimer is fired, protected element's refCount never be zero..
1907
1908         * loader/ImageLoader.cpp:
1909         (WebCore::ImageLoader::~ImageLoader):
1910         (WebCore::ImageLoader::updateFromElement):
1911         (WebCore::ImageLoader::updateRenderer):
1912         (WebCore::ImageLoader::updatedHasPendingEvent):
1913         (WebCore::ImageLoader::timerFired):
1914         * loader/ImageLoader.h:
1915
1916 2015-07-03  Daniel Bates  <dabates@apple.com>
1917
1918         REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo Mail
1919         https://bugs.webkit.org/show_bug.cgi?id=146515
1920         <rdar://problem/21348421>
1921
1922         Reviewed by Chris Dumez.
1923
1924         Fixes an issue where extra arguments passed to a Web IDL overloaded function, whose implementation
1925         is generated by the bindings generator script, are not ignored as per the note in section "Interface object [[Call]] method"
1926         of the Web IDL spec, <http://www.w3.org/TR/2012/CR-WebIDL-20120419/> (19 April 2012).
1927
1928         Currently for an overloaded function the JavaScript bindings generator script emits code to
1929         throw a TypeError when it cannot find a candidate function that takes the same number of
1930         arguments as passed by a caller. Prior to the change made in bug #139179 (r178097), the
1931         bindings code for HTMLSelectElement.add() was written by hand and ignored extra arguments
1932         that were passed to it. Following this change, the bindings code for HTMLSelectElement.add()
1933         is generated by the bindings generator script. Therefore, we throw a TypeError when Yahoo Mail
1934         calls HTMLSelectElement.add() with extra arguments because the code emitted by the bindings
1935         generator script does not ignore them.
1936
1937         * bindings/scripts/CodeGeneratorJS.pm:
1938         (LengthOfLongestFunctionParameterList): Added. Computes the length of longest overload parameter list.
1939         (GenerateOverloadedFunction): Emit code that ignores more arguments than LengthOfLongestFunctionParameterList().
1940         (GenerateOverloadedConstructorDefinition): Ditto.
1941         * bindings/scripts/test/JS/JSTestObj.cpp:
1942         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): Added; expected result for an overloaded
1943         function that takes a variadic number of Blob elements.
1944         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Update expected result. The added
1945         if-conditional expression for the IDL declaration overloadedMethod(Blob... blobArgs) is empty
1946         because we do not support overloading of functions with variadic arguments.
1947         (WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
1948         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1949         (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5): Added; expected
1950         result for an overloaded constructors that takes a variadic number of long arguments.
1951         (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors): Update expected
1952         result. The added if-conditional expression for the IDL declaration Constructor(long... longArgs) is empty
1953         because we do not support overloading of constructors with variadic arguments.
1954         * bindings/scripts/test/TestObj.idl: Added declaration overloadedMethod(Blob...). Also fixed
1955         typo in license block text.
1956         * bindings/scripts/test/TestOverloadedConstructors.idl: Added declaration Constructor(long... longArgs).
1957         Also fixed typo in license block text.
1958
1959 2015-07-03  Mario Sanchez Prada  <mario@endlessm.com>
1960
1961         Crash on xLarge memory allocation using bmalloc on 32bit systems
1962         https://bugs.webkit.org/show_bug.cgi?id=146440
1963
1964         Reviewed by Gustavo Noronha Silva.
1965
1966         Disable the gcc's -ftree-sra optimization (automatically enabled
1967         with -O1 and higher levels) for WebCore and 32bit Intel architectures,
1968         as that causes the crash in bmalloc when allocating large amounts of
1969         memory from the texture mapper's tiled backing store implementation.
1970
1971         * CMakeLists.txt: Pass -fno-free-sra to gcc on 32bit Intel architectures.
1972
1973 2015-07-03  Csaba Osztrogonác  <ossy@webkit.org>
1974
1975         Fix the !ENABLE(VIDEO) build after r186054
1976         https://bugs.webkit.org/show_bug.cgi?id=146592
1977
1978         Reviewed by Eric Carlson.
1979
1980         * platform/MemoryPressureHandler.cpp:
1981         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
1982
1983 2015-07-03  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1984
1985         [Streams API] Remove ReadableStream and Reader cancel() custom binding
1986         https://bugs.webkit.org/show_bug.cgi?id=146458
1987
1988         Reviewed by Darin Adler.
1989
1990         Removed stream and reader cancel custom binding.
1991         Updated binding generator to correctly handle promise-based APIs with optional parameters.
1992
1993         No behavior changes.
1994
1995         * Modules/streams/ReadableStream.idl: Removed custom
1996         * Modules/streams/ReadableStreamReader.idl: Ditto.
1997         * bindings/js/JSReadableStreamCustom.cpp:
1998         (WebCore::JSReadableStream::cancel): Deleted.
1999         * bindings/js/JSReadableStreamReaderCustom.cpp:
2000         (WebCore::JSReadableStreamReader::cancel): Deleted.
2001         * bindings/scripts/CodeGeneratorJS.pm: Handling of promise parameter in case of optional arguments.
2002         (GenerateParametersCheck):
2003         (GenerateReturnParameters): Utility function to generate return parameters (exception and promise).
2004         * bindings/scripts/test/JS/JSTestObj.cpp:
2005         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
2006         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
2007         * bindings/scripts/test/TestObj.idl:
2008
2009
2010 2015-07-02  Doug Russell  <d_russell@apple.com>
2011
2012         AX: Selection change as a result of focusing an element should include that 
2013         information in the intent
2014         https://bugs.webkit.org/show_bug.cgi?id=146533
2015
2016         Reviewed by Chris Fleizach.
2017
2018         Added focusChange flag to AXTextStateChangeIntent.
2019         Added intent support to selection logic called by Element::updateFocusAppearance().
2020         Added NSAccessibilityTextSelectionChangedFocus to mac notifications.
2021
2022         Test: platform/mac/accessibility/selection-notification-focus-change.html
2023
2024         * accessibility/AXObjectCache.cpp:
2025         (WebCore::AXObjectCache::postTextStateChangeNotification):
2026         * accessibility/AXTextStateChangeIntent.h:
2027         * accessibility/AccessibilityRenderObject.cpp:
2028         (WebCore::setTextSelectionIntent):
2029         (WebCore::AccessibilityRenderObject::setFocused):
2030         * accessibility/mac/AXObjectCacheMac.mm:
2031         (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
2032         * dom/Element.cpp:
2033         (WebCore::Element::updateFocusAppearance):
2034         * dom/Element.h:
2035         (WebCore::Element::defaultFocusTextStateChangeIntent):
2036         * editing/FrameSelection.cpp:
2037         (WebCore::FrameSelection::moveWithoutValidationTo):
2038         (WebCore::FrameSelection::setSelectionByMouseIfDifferent):
2039         (WebCore::FrameSelection::selectAll):
2040         * editing/FrameSelection.h:
2041         * html/HTMLInputElement.cpp:
2042         (WebCore::HTMLInputElement::updateFocusAppearance):
2043         * html/HTMLTextAreaElement.cpp:
2044         (WebCore::HTMLTextAreaElement::updateFocusAppearance):
2045         * html/HTMLTextFormControlElement.cpp:
2046         (WebCore::HTMLTextFormControlElement::select):
2047         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2048         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
2049         * html/HTMLTextFormControlElement.h:
2050         * page/EventHandler.cpp:
2051         (WebCore::setInitialKeyboardSelection):
2052         * page/FocusController.cpp:
2053         (WebCore::FocusController::advanceFocusInDocumentOrder):
2054
2055 2015-07-02  Przemek Piorkowski  <piorkowskiprzemyslaw@gmail.com>
2056
2057         [EFL] test_ewk2_application_cache_manager has been failed since r185527
2058         https://bugs.webkit.org/show_bug.cgi?id=146016
2059
2060         Reviewed by Gyuyoung Kim.
2061
2062         In order to handle properly WebApplicationCacheManagerProxy implementation which use
2063         WebsiteDataRecord it is necessary to enable PUBLIC_SUFFIX_LIST for EFL. 
2064         Implementation of PUBLIC_SUFFIX_LIST already exists for soup so EFL can use it as well.
2065
2066         * PlatformEfl.cmake: PublicSuffixSoup.cpp added to source files.
2067
2068 2015-07-02  Commit Queue  <commit-queue@webkit.org>
2069
2070         Unreviewed, rolling out r186251.
2071         https://bugs.webkit.org/show_bug.cgi?id=146573
2072
2073         caused crashes in webaudio tests (Requested by cdumez on
2074         #webkit).
2075
2076         Reverted changeset:
2077
2078         "Ensure media playback is stopped during page close"
2079         https://bugs.webkit.org/show_bug.cgi?id=146554
2080         http://trac.webkit.org/changeset/186251
2081
2082 2015-07-02  Brent Fulgham  <bfulgham@apple.com>
2083
2084         Ensure media playback is stopped during page close
2085         https://bugs.webkit.org/show_bug.cgi?id=146554
2086         <rdar://problem/18033944>
2087
2088         Reviewed by Zalan Bujtas.
2089
2090         Add new method to Page class to stop all media playback. It just uses the process
2091         MediaSessionManager singleton to inform all hosted in a particular document to stop.
2092
2093         * Modules/webaudio/AudioContext.h:
2094         (WebCore::WebAudio::hostingDocument): Added.
2095         * html/HTMLMediaElement.h:
2096         (WebCore::HTMLMediaElement::hostingDocument): Added.
2097         * dom/Document.cpp:
2098         (WebCore::Document::commonTeardown): Call the new PlatformMediaSessionManager::stopAllMediaPlaybackForDocument
2099         method on document cleanup.
2100         * platform/audio/PlatformMediaSession.h:
2101         Made PlatformMediaSessionManager a friend so it can access the protected 'client' accessor.
2102         Updated PlatformMediaSessionClient to require clients to have a "hostingDocument" member.
2103         * platform/audio/PlatformMediaSessionManager.cpp:
2104         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument): Added. Only pauses
2105         playback on elements that match the provided document.
2106         * platform/audio/PlatformMediaSessionManager.h:
2107
2108 2015-07-02  Dean Jackson  <dino@apple.com>
2109
2110         Tapping a video in Safari causes the video to flash gray for a quick moment
2111         https://bugs.webkit.org/show_bug.cgi?id=146570
2112         <rdar://problem/21325181>
2113
2114         Reviewed by Brent Fulgham.
2115
2116         On iOS, video elements should not show the tap highlight.
2117
2118         * css/html.css:
2119         (video):
2120
2121 2015-07-02  Dean Jackson  <dino@apple.com>
2122
2123         WebKit should use 80% white background for PiP indicator
2124         https://bugs.webkit.org/show_bug.cgi?id=146444
2125         <rdar://problem/21555726>
2126
2127         Reviewed by Brent Fulgham.
2128
2129         The designers wanted 80% white, not 80% black (r186104).
2130         I've also reverted the AirPlay background back to black.
2131
2132         * Modules/mediacontrols/mediaControlsiOS.css:
2133         (audio::-webkit-media-controls-wireless-playback-status):
2134         (audio::-webkit-media-controls-wireless-playback-status.small):
2135         (audio::-webkit-media-controls-wireless-playback-status.picture-in-picture):
2136
2137 2015-07-02  Eric Carlson  <eric.carlson@apple.com>
2138
2139         [Mac] Clear current AirPlay source before setting another
2140         https://bugs.webkit.org/show_bug.cgi?id=145959
2141
2142         Reviewed by Brent Fulgham.
2143
2144         * Modules/mediasession/WebMediaSessionManager.cpp:
2145         (WebCore::WebMediaSessionManager::clientStateDidChange): Don't make a client begin playing 
2146           to the target just because it has paused.
2147         (WebCore::WebMediaSessionManager::configurePlaybackTargetClients): Always select a client that
2148           requrested the picker, and never consider paused clients when choosing a client to begin
2149           playing to the targer. Call setShouldPlayToPlaybackTarget(true) after all of the other 
2150           clients have been told to stop playing to the target.
2151
2152 2015-07-02  Beth Dakin  <bdakin@apple.com>
2153
2154         Allow the UIDelegate to customize an image preview
2155         https://bugs.webkit.org/show_bug.cgi?id=146557
2156         -and corresponding-
2157         rdar://problem/21657424
2158
2159         Reviewed by Tim Horton.
2160
2161         Add WEBCORE_EXPORT to use this in WK2.
2162         * loader/cache/CachedResource.h:
2163         (WebCore::CachedResource::url):
2164
2165 2015-07-02  Brady Eidson  <beidson@apple.com>
2166
2167         Add preference to disable all http-equiv.
2168         <rdar://problem/9091261> and https://bugs.webkit.org/show_bug.cgi?id=146553
2169
2170         Reviewed by Sam Weinig.
2171
2172         No new tests (Covered by existing test)
2173
2174         * dom/Document.cpp:
2175         (WebCore::Document::processHttpEquiv):
2176         * page/Settings.in:
2177
2178 2015-07-02  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2179
2180         [Streams API] Remove ReadableStreamController.enqueue() custom binding
2181         https://bugs.webkit.org/show_bug.cgi?id=146455
2182
2183         Reviewed by Darin Adler.
2184
2185         Made enqueue not custom. Updated error to use Default=Undefined in IDL.
2186
2187         No change in behavior.
2188
2189         * Modules/streams/ReadableStreamController.h:
2190         (WebCore::ReadableStreamController::error): Removed unneeded variation of error.
2191         (WebCore::ReadableStreamController::enqueue): Calling ReadableJSStream enqueue method.
2192         * Modules/streams/ReadableStreamController.idl: Updated error with Default=Undefined and made enqueue not custom.
2193         * bindings/js/JSDOMBinding.cpp:
2194         (WebCore::createDOMException): Adding support for RangeError exceptions.
2195         * bindings/js/JSReadableStreamControllerCustom.cpp:
2196         (WebCore::constructJSReadableStreamController): Deleted.
2197         * bindings/js/ReadableJSStream.cpp:
2198         (WebCore::ReadableJSStream::error): Updated to pass error value as parameter.
2199         (WebCore::ReadableJSStream::enqueue): Added exception throwing through ExceptionCode.
2200         (WebCore::ReadableJSStream::retrieveChunkSize): Ditto.
2201         * bindings/js/ReadableJSStream.h:
2202         * dom/ExceptionCode.h: Adding RangeError.
2203
2204 2015-07-02  Brady Eidson  <beidson@apple.com>
2205
2206         [Content Extensions] Block synchronous XMLHTTPRequest.
2207         <rdar://problem/21573006> and https://bugs.webkit.org/show_bug.cgi?id=146271
2208
2209         Reviewed by Alex Christensen.
2210
2211         Test: http/tests/contentextensions/sync-xhr-blocked.html
2212
2213         * loader/FrameLoader.cpp:
2214         (WebCore::FrameLoader::loadResourceSynchronously): If content blocked, set up an error, clear
2215           the response, and clear the response data.
2216
2217 2015-07-01  Joseph Pecoraro  <pecoraro@apple.com>
2218
2219         Web Inspector: Aggregate profile call information on the backend to drastically reduce profile sizes
2220         https://bugs.webkit.org/show_bug.cgi?id=146536
2221
2222         Reviewed by Timothy Hatcher.
2223
2224         * inspector/TimelineRecordFactory.cpp:
2225         (WebCore::buildAggregateCallInfoInspectorObject):
2226         (WebCore::buildInspectorObject):
2227         Replace the array of Call objects with a single aggregated call info object.
2228
2229 2015-07-01  Brent Fulgham  <bfulgham@apple.com>
2230
2231         [Win] REGRESSION (r185124) CACFLayer handling broken
2232         https://bugs.webkit.org/show_bug.cgi?id=146530
2233         <rdar://problem/21642241>
2234
2235         Reviewed by Tim Horton.
2236
2237         At some point in the past, the set of LayerChange flags
2238         overflowed the default MSVC enum type of 'int'. This caused
2239         Windows rendering code to not receive various update notifications.
2240
2241         Zalan's change moved the DebugIndicatorsChanged flag into that
2242         overflow set, which made it obvious that something was wrong.
2243
2244         The fix is to tell the compiler to use a compatible base type
2245         for the enum.
2246
2247         * platform/graphics/ca/GraphicsLayerCA.h: Prevent overflow.
2248
2249 2015-07-01  Alex Christensen  <achristensen@webkit.org>
2250
2251         Reduce resolution of performance.now.
2252         https://bugs.webkit.org/show_bug.cgi?id=146531
2253         rdar://problem/20116796
2254
2255         Reviewed by Simon Fraser.
2256
2257         Test: http/tests/misc/webtiming-resolution.html
2258
2259         * page/Performance.cpp:
2260         (WebCore::Performance::now):
2261         Floor the time returned by performance.now to the nearest 5 microseconds.
2262
2263 2015-07-01  Eric Carlson  <eric.carlson@apple.com>
2264
2265         [iOS] Build fix
2266
2267         Reviewed by Brent Fulgham.
2268
2269         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2270         (-[WebAVVideoLayer enterPIPModeRedirectingVideoToLayer:]): Renamed from enterOptimizedFullScreenModeRedirectingVideoToLayer.
2271         (-[WebAVVideoLayer leavePIPMode]): Renamed from leaveOptimizedFullScreenMode.
2272         (-[WebAVVideoLayer enterOptimizedFullScreenModeRedirectingVideoToLayer:]): Deleted.
2273         (-[WebAVVideoLayer leaveOptimizedFullScreenMode]): Deleted.
2274
2275 2015-07-01  Myles C. Maxfield  <mmaxfield@apple.com>
2276
2277         [iOS] Support bold and thin italicized system fonts
2278         https://bugs.webkit.org/show_bug.cgi?id=146463
2279         <rdar://problem/20948885>
2280
2281         Reviewed by Darin Adler.
2282
2283         Add the italicized attribute to font descriptors.
2284
2285         Test: fast/text/weighted-italicized-system-font.html
2286
2287         * platform/graphics/ios/FontCacheIOS.mm:
2288         (WebCore::createCTFontWithFamilyNameAndWeight):
2289         * platform/graphics/mac/FontCacheMac.mm:
2290         (WebCore::fontWithFamilySpecialCase):
2291         (WebCore::fontWithFamily):
2292         * platform/spi/cocoa/CoreTextSPI.h:
2293
2294 2015-07-01  Alex Christensen  <achristensen@webkit.org>
2295
2296         Fix ANGLE Windows build after r186169.
2297         https://bugs.webkit.org/show_bug.cgi?id=146532
2298
2299         Reviewed by Brent Fulgham.
2300
2301         * WebCore.vcxproj/WebCore.vcxproj:
2302         * WebCore.vcxproj/WebCore.vcxproj.filters:
2303         Don't compile OpenGLShims.cpp or Extensions3DOpenGL.cpp on Windows 
2304         because Windows uses OpenGLES through ANGLE, not OpenGL.
2305         * platform/graphics/ANGLEWebKitBridge.h:
2306         Use OpenGLESShims.h on Windows instead of OpenGLShims.h.
2307         * platform/graphics/OpenGLESShims.h:
2308         Added needed definitions from OpenGL to compile successfully.
2309         * platform/graphics/win/GL/glext.h: Removed.
2310
2311 2015-07-01  Dean Jackson  <dino@apple.com>
2312
2313         Disable the experimental WebGL2 implementation
2314         https://bugs.webkit.org/show_bug.cgi?id=146526
2315         <rdar://problem/21641235>
2316
2317         Reviewed by Myles Maxfield.
2318
2319         Add (and disable) an ENABLE_WEBGL2 flag. Also protect
2320         anything that is specific to WebGL2.
2321
2322         Covered by running the WebGL 1.0.2 conformance suite
2323         and our LayoutTests.
2324
2325         * Configurations/FeatureDefines.xcconfig:
2326         * bindings/js/JSCanvasRenderingContextCustom.cpp:
2327         (WebCore::toJS):
2328         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2329         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2330         (WebCore::toJS):
2331         * html/HTMLCanvasElement.cpp:
2332         (WebCore::HTMLCanvasElement::is3dType):
2333         * html/canvas/WebGL2RenderingContext.cpp:
2334         * html/canvas/WebGL2RenderingContext.h:
2335         * html/canvas/WebGL2RenderingContext.idl:
2336         * html/canvas/WebGLFramebuffer.cpp:
2337         (WebCore::WebGLFramebuffer::drawBuffersIfNecessary):
2338         * html/canvas/WebGLGetInfo.cpp:
2339         * html/canvas/WebGLGetInfo.h:
2340         * html/canvas/WebGLRenderingContextBase.cpp:
2341         (WebCore::WebGLRenderingContextBase::create):
2342         * html/canvas/WebGLVertexArrayObject.cpp:
2343         * html/canvas/WebGLVertexArrayObject.h:
2344         * html/canvas/WebGLVertexArrayObject.idl:
2345
2346 2015-07-01  Chris Dumez  <cdumez@apple.com>
2347
2348         Regression(183998): Disqus comments take a very long time to load
2349         https://bugs.webkit.org/show_bug.cgi?id=146522
2350         <rdar://problem/21590601>
2351
2352         Reviewed by Simon Fraser.
2353
2354         Stop throttling requestAnimationFrame() in iframes that are not visible
2355         due to them being zero-sized or display:none. Those are usually utility
2356         iframes and throttling them is risky.
2357
2358         Se still throttle requestAnimationFrame() in iframes that would be
2359         visible in theory but are currently not noticeable because they are
2360         outside the viewport.
2361
2362         Test:
2363         - fast/animation/request-animation-frame-throttle-subframe.html
2364         - fast/animation/request-animation-frame-throttle-subframe-display-none.html
2365         - fast/animation/request-animation-frame-throttle-subframe-zero-size.html
2366
2367         * page/FrameView.cpp:
2368         (WebCore::FrameView::updateScriptedAnimationsAndTimersThrottlingState):
2369
2370 2015-06-30  Ryosuke Niwa  <rniwa@webkit.org>
2371
2372         REGRESSION (r179168): Characters overlap after resizing the font on the copy-pasted Japanese text
2373         https://bugs.webkit.org/show_bug.cgi?id=146492
2374
2375         Reviewed by Darin Adler.
2376
2377         The bug was caused by WebKit serializing the used line-height size (e.g. 18px) in the copied content
2378         instead of string "normal" and removeStyleFromRulesAndContext failing to strip it down when text with
2379         a font that influences the line height got pasted. This is because the used value of line-height
2380         property of the context and the pasted content doesn't match when the context doesn't use the same font.
2381
2382         Fixed the bug by not considering line-height as a list of editing properties we try to preserve. This is
2383         fine because we don't provide editing operations to directly manipulate line-height.
2384
2385         Test: editing/pasteboard/cjk-line-height.html
2386
2387         * editing/EditingStyle.cpp:
2388         (WebCore::editingProperties): Removed CSSPropertyLineHeight.
2389
2390 2015-06-30  Brent Fulgham  <bfulgham@apple.com>
2391
2392         REGRESSION (r184296): View keeps scrolling upward
2393         https://bugs.webkit.org/show_bug.cgi?id=146497
2394         <rdar://problem/21524942>
2395
2396         Reviewed by Darin Adler.
2397
2398         Avoid improperly triggering the ScrollController wheel event handling
2399         logic when the wheel event deltaX/deltaY are zero. On certain sites,
2400         this caused a programmatic JavaScript scroll to be triggered unexpectedly,
2401         scrolling the page back to some initial state.
2402
2403         This bug was introduced while trying to make sure scrollbars were notified
2404         when the wheel event had come to an end. Revise that change so that we still
2405         follow the right code path for non-stretchable regions. However, make sure
2406         that for zero-delta wheel events we make sure to properly handle the wheel
2407         event phase. 
2408
2409         * platform/mac/ScrollAnimatorMac.h:
2410         * platform/mac/ScrollAnimatorMac.mm:
2411         (WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent): New helper function
2412         to reduce the complexity of the logic in handleWheelEvent.
2413         (WebCore::ScrollAnimatorMac::handleWheelEvent): When wheel events should be forwarded
2414         to the parent scroll view, if the event was handled or has no change in position
2415         trigger the 'handleWheelEventPhase' logic so that scrollbars are hidden, etc.
2416
2417 2015-06-30  Dean Jackson  <dino@apple.com>
2418
2419         Hide the inline controls when going into PiP
2420         https://bugs.webkit.org/show_bug.cgi?id=146487
2421         <rdar://problem/19881159>
2422
2423         Reviewed by Eric Carlson.
2424
2425         When the presentation mode is PiP, toggle a class
2426         on the container element so that we can completely
2427         hide the control toolbar. The placard should still
2428         remain visible.
2429
2430         * Modules/mediacontrols/mediaControlsiOS.css:
2431         (video::-webkit-media-controls-panel-container.picture-in-picture): Add
2432         a rule that hides the toolbar when PiP is active.
2433         * Modules/mediacontrols/mediaControlsiOS.js:
2434         (ControllerIOS.prototype.showControls):
2435         (ControllerIOS.prototype.handlePresentationModeChange): Toggle a
2436         class. Also fix a bug I noticed where exiting from PiP was
2437         not auto-hiding the controls until the user tapped.
2438
2439 2015-07-01  Matthew Daiter  <mdaiter@apple.com>
2440
2441         Enable MEDIA_STREAM flag
2442         https://bugs.webkit.org/show_bug.cgi?id=145947
2443         <rdar://problem/21365829>
2444
2445         Reviewed by Eric Carlson.
2446
2447         * Configurations/FeatureDefines.xcconfig: Added MEDIA_STREAM flag
2448         * Modules/mediastream/MediaStreamTrack.h:
2449         * WebCore.xcodeproj/project.pbxproj: Changed project headers to
2450         private headers
2451         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
2452         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2453         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
2454         * platform/mediastream/RealtimeMediaSource.h:
2455         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2456         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2457         (WebCore::refreshCaptureDeviceList): Deleted.
2458         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2459         (WebCore::AVMediaCaptureSource::startProducingData):
2460         (WebCore::AVMediaCaptureSource::stopProducingData):
2461
2462 2015-07-01  Brent Fulgham  <bfulgham@apple.com>
2463
2464         REGRESSION (r185016): Intermittent crash in WebCore::TextTrackList::remove
2465         https://bugs.webkit.org/show_bug.cgi?id=146493
2466         <rdar://problem/21511122>
2467
2468         Reviewed by Eric Carlson.
2469
2470         The m_textTracks member is frequently null checked during other operations, but
2471         was not checked during track removal. This needs to be corrected.
2472
2473         * html/HTMLMediaElement.cpp:
2474         (WebCore::HTMLMediaElement::removeTextTrack): Check that m_textTracks is
2475         not null before using it during track removal.
2476
2477 2015-07-01  Antti Koivisto  <antti@apple.com>
2478
2479         PNG mask images are loaded with Accept:image/svg+xml
2480         https://bugs.webkit.org/show_bug.cgi?id=146509
2481         rdar://problem/21584740
2482
2483         Reviewed by Simon Fraser.
2484
2485         For some strange reason MaskImageOperation code loads all mask images, including non-SVG ones
2486         using CachedSVGDocument. Resulting bad accept header may cause server to reject the request.
2487
2488         This is far from ideal but as a quick fix we can override the accept header for mask images to
2489         allow any image type.
2490
2491         Test: http/tests/misc/mask-image-accept.html
2492
2493         * loader/cache/CachedResourceLoader.cpp:
2494         (WebCore::CachedResourceLoader::requestResource):
2495         * loader/cache/CachedResourceRequest.h:
2496         (WebCore::CachedResourceRequest::acceptOverride):
2497         (WebCore::CachedResourceRequest::setAcceptOverride):
2498         * loader/cache/CachedSVGDocumentReference.cpp:
2499         (WebCore::CachedSVGDocumentReference::load):
2500         * loader/cache/CachedSVGDocumentReference.h:
2501         (WebCore::CachedSVGDocumentReference::loadRequested):
2502         (WebCore::CachedSVGDocumentReference::setAcceptsAnyImageType):
2503         (WebCore::CachedSVGDocumentReference::document):
2504         * platform/graphics/MaskImageOperation.cpp:
2505         (WebCore::MaskImageOperation::ensureCachedSVGDocumentReference):
2506
2507 2015-07-01  Jer Noble  <jer.noble@apple.com>
2508
2509         [MSE] Failures on W3C media-source tests regarding MIME types
2510         https://bugs.webkit.org/show_bug.cgi?id=146499
2511
2512         Reviewed by Eric Carlson.
2513
2514         Tests: http/tests/media/media-source/SourceBuffer-abort-readyState.html
2515                http/tests/media/media-source/SourceBuffer-abort-removed.html
2516                http/tests/media/media-source/SourceBuffer-abort-updating.html
2517                http/tests/media/media-source/SourceBuffer-abort.html
2518
2519         Multiple failures in the W3C media-source test suite due to two failures in isTypeSupported MIME type handling:
2520         - MIME types without codec strings were being rejected.
2521         - MIME types with codec strings which are rejected by the system are being reported as supported.
2522
2523         For the first, stop rejecting MIME types with non-existent codec strings. For MIME types which do have non-empty
2524         codec strings, treat a "Maybe" response as unsupported.
2525
2526         * Modules/mediasource/MediaSource.cpp:
2527         (WebCore::MediaSource::isTypeSupported):
2528
2529 2015-06-30  Alex Christensen  <achristensen@webkit.org>
2530
2531         Update ANGLE to b11e2483742db884bd0af41f78f528240577356b.
2532         https://bugs.webkit.org/show_bug.cgi?id=145010
2533
2534         Reviewed by Dean Jackson.
2535
2536         * CMakeLists.txt:
2537         * platform/graphics/ANGLEWebKitBridge.cpp:
2538         (WebCore::appendSymbol):
2539         (WebCore::getStructInfo):
2540         (WebCore::getSymbolInfo):
2541         (WebCore::ANGLEWebKitBridge::cleanupCompilers):
2542         (WebCore::ANGLEWebKitBridge::compileShaderSource):
2543         (WebCore::getValidationResultValue): Deleted.
2544         * platform/graphics/ANGLEWebKitBridge.h:
2545         (WebCore::ANGLEShaderSymbol::isSampler):
2546         * platform/graphics/GraphicsContext3D.h:
2547         (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
2548         * platform/graphics/mac/GraphicsContext3DMac.mm:
2549         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
2550         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2551         (WebCore::GraphicsContext3D::checkVaryingsPacking):
2552         (WebCore::GraphicsContext3D::precisionsMatch):
2553         Update WebCore to reflect changes in ANGLE.
2554
2555 2015-06-30  Zalan Bujtas  <zalan@apple.com>
2556
2557         Frame flattening: Hit-testing an iframe could end up destroying the associated inline tree context.
2558         https://bugs.webkit.org/show_bug.cgi?id=146447
2559         rdar://problem/20613501
2560
2561         Reviewed by Simon Fraser.
2562
2563         This patch ensures that the render tree associated with the document on which
2564         the hit-test is initiated does not get laid out, unless it was directly mutated prior to the hittest.
2565
2566         Hit-test requirements:
2567         1. A clean the render tree before hit-testing gets propagated to the renderers.
2568         Document::updateLayout() ensures it by calling both updateStyleIfNeeded() and layout() not only on the current tree, but also
2569         on the ancestors if needed.
2570
2571         2. No render tree mutation while hit-testing the renderers.
2572
2573         When an iframe is being hit-tested, this hit-test could bubble down to the child frame's render view.
2574         In order to ensure #1, we call Document::updateLayout() on the current (subframe) document.
2575         If updateStyleIfNeeded() mutates the render tree, we mark it dirty for layout(). However frame flattening also
2576         marks the parent renderer (RenderIFrame) dirty.
2577         While calling layout() to clean the current render tree, we end up laying out the parent tree too.
2578         Laying out the parent tree could end up destroying the inline tree context from where the
2579         hittest just bubbled down. (InlineFlowBox -> RenderWidget -> RenderView).
2580
2581         This patch protects the render tree from such unintentional inline tree mutation during hittesting.
2582         After the initial layout we set a layout disallow flag on the frame view to defer subsequent layouts.
2583         This patch only changes behavior when frame flattening is enabled, but in future we may always want to enable this.
2584
2585         Test: fast/frames/flattening/hittest-iframe-while-style-changes-crash.html
2586
2587         * page/FrameView.cpp:
2588         (WebCore::FrameView::layout):
2589         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded): Deleted. -> Assertion in no longer valid.
2590         * page/FrameView.h:
2591         * rendering/RenderView.cpp:
2592         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
2593         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
2594         (WebCore::RenderView::hitTest): Protect the render tree from subsequent layouts.
2595
2596 2015-06-30  Andy VanWagoner  <thetalecrafter@gmail.com>
2597
2598         Implement ECMAScript Internationalization API
2599         https://bugs.webkit.org/show_bug.cgi?id=90906
2600
2601         Reviewed by Benjamin Poulain.
2602
2603         Test: js/intl.html
2604
2605         * Configurations/FeatureDefines.xcconfig: add ENABLE_INTL flag
2606
2607 2015-06-30  Wenson Hsieh  <whsieh@berkeley.edu>
2608
2609         scroll-snap-points do not work very well with mechanical scroll wheel events
2610         https://bugs.webkit.org/show_bug.cgi?id=142501
2611         <rdar://problem/20093511>
2612
2613         Reviewed by Brent Fulgham.
2614
2615         Stateless scroll events generated by scrolling with a mechanical mouse wheel now trigger scroll
2616         snapping after a fixed delay.
2617
2618         Test: platform/mac-wk2/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-overflow-stateless.html
2619
2620         * platform/cocoa/ScrollController.h: Added member to track stateless scrolling.
2621         * platform/cocoa/ScrollController.mm: Added constant for delay for stateless scroll snapping.
2622         (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Triggers timer upon stateless scroll events.
2623         (WebCore::ScrollController::horizontalScrollSnapTimerFired): Timer now handles stateless scrolling updates.
2624         (WebCore::ScrollController::verticalScrollSnapTimerFired): See above.
2625         (WebCore::ScrollController::beginScrollSnapAnimation): Handles stateless scroll snapping.
2626
2627 2015-06-30  Simon Fraser  <simon.fraser@apple.com>
2628
2629         Try to fix Gtk and EFL builds.
2630
2631         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2632         (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
2633         (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
2634         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2635         * platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
2636         (WebCore::CompositingCoordinator::flushPendingLayerChanges):
2637         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2638         (WebCore::CoordinatedGraphicsLayer::flushCompositingState):
2639         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
2640         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2641
2642 2015-06-30  Simon Fraser  <simon.fraser@apple.com>
2643
2644         [iOS] Missing tiles inside position:fixed on scrolling
2645         https://bugs.webkit.org/show_bug.cgi?id=146485
2646         rdar://problem/21226861
2647
2648         Reviewed by Tim Horton.
2649
2650         Layer flushing adjusts the coverage rect for tiled layers, but does so at times
2651         when position:fixed layers are moved around by the scrolling tree. The computed
2652         coverage rect then doesn't reflect the layer's on-screen position, causing missing
2653         tiles.
2654
2655         Fix by pushing the notion of being in a "stable state" onto FrameView, and passing
2656         that state into the layer flush. When not in a stable state, flushing doesn't change
2657         the visible and coverage rects for layers that are viewport-constrained.
2658
2659         * page/FrameView.cpp:
2660         (WebCore::FrameView::reset):
2661         * page/FrameView.h: Remove some velocity-related data members that were unused.
2662         * platform/graphics/GraphicsLayer.h:
2663         (WebCore::GraphicsLayer::flushCompositingState):
2664         (WebCore::GraphicsLayer::flushCompositingStateForThisLayerOnly):
2665         * platform/graphics/ca/GraphicsLayerCA.cpp:
2666         (WebCore::GraphicsLayerCA::flushCompositingState):
2667         (WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
2668         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): If this is a viewport-constrained
2669         layer, and the viewport is not stable, don't touch the rects.
2670         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2671         * platform/graphics/ca/GraphicsLayerCA.h:
2672         (WebCore::GraphicsLayerCA::CommitState::CommitState):
2673         * rendering/RenderLayerCompositor.cpp:
2674         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2675
2676 2015-06-30  Simon Fraser  <simon.fraser@apple.com>
2677
2678         Rename GraphicsLayer's allowsBackingStoreDetachment to isViewportConstrained
2679         https://bugs.webkit.org/show_bug.cgi?id=146483
2680
2681         Reviewed by Tim Horton.
2682
2683         What GraphicsLayer really needs to know is whether some other thread/process
2684         is moving its platform layers around behind its back, and this is is better
2685         expressed as "isViewportConstrained" rather than "allowsBackingStoreDetachment".
2686         
2687         The sense of the flag is flipped, and boolean logic adjusted accordingly.
2688
2689         * platform/graphics/GraphicsLayer.h:
2690         (WebCore::GraphicsLayer::setIsViewportConstrained):
2691         (WebCore::GraphicsLayer::isViewportConstrained):
2692         (WebCore::GraphicsLayer::setAllowsBackingStoreDetachment): Deleted.
2693         (WebCore::GraphicsLayer::allowsBackingStoreDetachment): Deleted.
2694         * platform/graphics/ca/GraphicsLayerCA.cpp:
2695         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
2696         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2697         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2698         * platform/graphics/ca/GraphicsLayerCA.h:
2699         * rendering/RenderLayerBacking.cpp:
2700         (WebCore::RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole):
2701
2702 2015-06-30  Dean Jackson  <dino@apple.com>
2703
2704         CABackdropFilter should set windowServerAware to false
2705         https://bugs.webkit.org/show_bug.cgi?id=146469
2706         <rdar://problem/21618614>
2707
2708         Reviewed by Simon Fraser.
2709
2710         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2711         (PlatformCALayerCocoa::PlatformCALayerCocoa): Set windowServerAware
2712         to false on Mac (it's not available on iOS).
2713
2714 2015-06-30  Chris Dumez  <cdumez@apple.com>
2715
2716         Rolling out r175171
2717         https://bugs.webkit.org/show_bug.cgi?id=146470
2718         <rdar://problem/21349934>
2719
2720         Unreviewed, rolling out <http://trac.webkit.org/changeset/175171>. It
2721         wasn't a huge win and Brady says it caused crash at
2722         <rdar://problem/21349934>.
2723
2724         * platform/network/cf/ResourceRequest.h:
2725         * platform/network/cocoa/ResourceRequestCocoa.mm:
2726         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2727         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
2728
2729 2015-06-30  Matt Baker  <mattbaker@apple.com>
2730
2731         Web Inspector: Reduce rendering frames "Other" time by instrumenting compositing
2732         https://bugs.webkit.org/show_bug.cgi?id=146168
2733
2734         Reviewed by Brian Burg.
2735
2736         Added Inspector instrumentation for measuring CoreAnimation compositing time. We mark the start of a composite
2737         event when the LayerFlushScheduler triggers a scheduled layer flush. InspectorController now exports a function
2738         for marking the end of the composite event, which should be called during the CA transaction post-commit phase
2739         (based on platform support). Lacking platform support, the event is considered complete after CoreAnimation
2740         runloop observers have run.
2741
2742         * inspector/InspectorController.cpp:
2743         (WebCore::InspectorController::didComposite):
2744         * inspector/InspectorController.h:
2745         New export for instrumentation in WebKit2.
2746
2747         * inspector/InspectorInstrumentation.cpp:
2748         (WebCore::InspectorInstrumentation::willCompositeImpl):
2749         (WebCore::InspectorInstrumentation::didCompositeImpl):
2750         * inspector/InspectorInstrumentation.h:
2751         (WebCore::InspectorInstrumentation::willComposite):
2752         (WebCore::InspectorInstrumentation::didComposite):
2753         Plumbing for new instrumentation.
2754
2755         * inspector/InspectorTimelineAgent.cpp:
2756         (WebCore::InspectorTimelineAgent::internalStart):
2757         (WebCore::InspectorTimelineAgent::internalStop):
2758         (WebCore::InspectorTimelineAgent::willComposite):
2759         (WebCore::InspectorTimelineAgent::didComposite):
2760         (WebCore::toProtocol):
2761         * inspector/InspectorTimelineAgent.h:
2762         New Composite event type and instrumentation.
2763
2764         * page/FrameView.cpp:
2765         (WebCore::FrameView::flushCompositingStateIncludingSubframes):
2766         Hook for start of compositing.
2767
2768         * platform/spi/cocoa/QuartzCoreSPI.h:
2769         New header include and interface declaration.
2770
2771 2015-06-30  Beth Dakin  <bdakin@apple.com>
2772
2773         The bounds on InteractionInformationAtPosition should be more precise
2774         https://bugs.webkit.org/show_bug.cgi?id=146468
2775         -and corresponding-
2776         rdar://problem/20739834
2777
2778         Reviewed by Enrica Casucci and Simon Fraser.
2779
2780         Export absoluteContentQuad().
2781         * rendering/RenderBox.h:
2782
2783 2015-06-30  Zalan Bujtas  <zalan@apple.com>
2784
2785         Addressing post-review comments in r185756.
2786
2787         * html/RubyTextElement.cpp:
2788         (WebCore::RubyTextElement::createElementRenderer):
2789
2790 2015-06-30  Zalan Bujtas  <zalan@apple.com>
2791
2792         Addressing post-review comments in r185916
2793
2794         * platform/LayoutUnit.h:
2795         (WebCore::roundToDevicePixel):
2796
2797 2015-06-30  Matt Rajca  <mrajca@apple.com>
2798
2799         MediaSession: Use setSessionInternal to set the default media session in HTMLMediaElement's constructor
2800         https://bugs.webkit.org/show_bug.cgi?id=146465
2801
2802         Reviewed by Eric Carlson.
2803
2804         * html/HTMLMediaElement.cpp:
2805         (WebCore::HTMLMediaElement::HTMLMediaElement):
2806
2807 2015-06-30  Matt Rajca  <mrajca@apple.com>
2808
2809         Media Session: implement algorithm for updating a media element's session (6.1)
2810         https://bugs.webkit.org/show_bug.cgi?id=146460
2811
2812         Reviewed by Darin Adler.
2813
2814         In addition to storing a pointer to the new media session, we now:
2815
2816         - pause the media element if it is 'active' in the current media session
2817         - remove the media element from the current media session
2818         - release the current media session if there are no more active media elements
2819         - set the default media session if the new media session is null
2820         - update the 'kind' attribute to match the kind of the new media session
2821
2822         * Modules/mediasession/MediaSession.cpp:
2823         (WebCore::MediaSession::isMediaElementActive):
2824         (WebCore::MediaSession::hasActiveMediaElements):
2825         * Modules/mediasession/MediaSession.h:
2826         * html/HTMLMediaElement.cpp:
2827         (WebCore::HTMLMediaElement::setSession):
2828         (WebCore::HTMLMediaElement::setSessionInternal):
2829         * html/HTMLMediaElement.h:
2830
2831 2015-06-29  Anders Carlsson  <andersca@apple.com>
2832
2833         Get rid of unused WKSI functions
2834         https://bugs.webkit.org/show_bug.cgi?id=146443
2835
2836         Reviewed by Tim Horton.
2837
2838         * platform/graphics/cg/PathCG.cpp:
2839         (WebCore::Path::platformAddPathForRoundedRect):
2840         Just call CGPathAddRoundedRect directly.
2841
2842         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2843         * platform/mac/WebCoreSystemInterface.h:
2844         * platform/mac/WebCoreSystemInterface.mm:
2845
2846 2015-06-30  Youenn Fablet  <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar  <calvaris@igalia.com>
2847
2848         [Streams API] Finish pulling must always be done asynchronously as it is the expected promise behavior (according to the spec)
2849         https://bugs.webkit.org/show_bug.cgi?id=146408
2850
2851         Reviewed by Darin Adler.
2852
2853         Current tests cover the case already.
2854
2855         * Modules/streams/ReadableStream.cpp:
2856         (WebCore::ReadableStream::pull): Call finishPull() in a postTask to delay it and simulate the promise
2857         resolution.
2858
2859 2015-06-30  Youenn Fablet  <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar  <calvaris@igalia.com>
2860
2861         [Streams API] Synced bad strategy test with reference implementation
2862         https://bugs.webkit.org/show_bug.cgi?id=146411
2863
2864         Reviewed by Darin Adler.
2865
2866         Current tests cover the case.
2867
2868         * bindings/js/ReadableJSStream.cpp:
2869         (WebCore::ReadableJSStream::retrieveChunkSize): Check for negative size then running the JavaScript function.
2870
2871 2015-06-30  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2872
2873         [Streams API] Remove ReadableStream.getReader() custom binding
2874         https://bugs.webkit.org/show_bug.cgi?id=146404
2875
2876         Reviewed by Darin Adler.
2877
2878         Covered by existing tests.
2879
2880         * Modules/streams/ReadableStream.cpp:
2881         (WebCore::ReadableStream::getReader): Updated to take an exception.
2882         * Modules/streams/ReadableStream.h:
2883         * Modules/streams/ReadableStream.idl: Updated to remove custom binding.
2884         * bindings/js/JSReadableStreamCustom.cpp:
2885         (WebCore::JSReadableStream::getReader): Deleted.
2886         * bindings/js/JSReadableStreamReaderCustom.cpp:
2887         (WebCore::constructJSReadableStreamReader): Updated to pass an exception to getReader.
2888
2889 2015-06-29  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2890
2891         [Streams API] ReadableStreamReader.closed should use DOMPromise
2892         https://bugs.webkit.org/show_bug.cgi?id=146406
2893
2894         Reviewed by Darin Adler.
2895
2896         Added storage of ClosedPromise as Optional of ReadableStream.
2897         Updated code accordingly.
2898
2899         Covered by existing tests.
2900
2901         * Modules/streams/ReadableStream.cpp:
2902         (WebCore::ReadableStream::clearCallbacks):
2903         (WebCore::ReadableStream::releaseReader):
2904         (WebCore::ReadableStream::changeStateToErrored):
2905         (WebCore::ReadableStream::closed):
2906         * Modules/streams/ReadableStream.h:
2907         * Modules/streams/ReadableStreamReader.cpp:
2908         (WebCore::ReadableStreamReader::closed):
2909         * Modules/streams/ReadableStreamReader.h:
2910         * bindings/js/JSReadableStreamReaderCustom.cpp:
2911         (WebCore::JSReadableStreamReader::closed):
2912
2913 2015-06-29  Simon Fraser  <simon.fraser@apple.com>
2914
2915         [iOS WK2] WKWebViews in Facebook app start off black
2916         https://bugs.webkit.org/show_bug.cgi?id=146445
2917         rdar://problem/21600433
2918
2919         Reviewed by Tim Horton.
2920
2921         If -isOpaque is toggled on a WKWebView, we failed to make the page tiles non-opaque
2922         for a while. After r183775, RenderLayerCompositor::rootBackgroundTransparencyChanged() was called,
2923         but only considered the computed document background color, and not the view transparency.
2924         
2925         Fix by having rootBackgroundTransparencyChanged() simply use viewHasTransparentBackground(),
2926         which checks the FrameView transparency. Now we just need to store a transparency bool rather
2927         than the old color (we only checked its alpha anyway).
2928
2929         * rendering/RenderLayerCompositor.cpp:
2930         (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged):
2931
2932 2015-06-29  Dean Jackson  <dino@apple.com>
2933
2934         WebKit should use 80% black background for PiP indicator
2935         https://bugs.webkit.org/show_bug.cgi?id=146444
2936         <rdar://problem/21555726>
2937
2938         Reviewed by Sam Weinig.
2939
2940         Change the black background to a slightly less black background.
2941         This also involved making the placard artwork white, in order
2942         to keep it visible against the new grey.
2943
2944         * Modules/mediacontrols/mediaControlsiOS.css:
2945         (audio::-webkit-media-controls-wireless-playback-status):
2946         (audio::-webkit-media-controls-wireless-playback-status.small):
2947         (audio::-webkit-media-controls-wireless-playback-status.picture-in-picture):
2948
2949 2015-06-29  Brady Eidson  <beidson@apple.com>
2950
2951         Flag sync XHRs from the network process so they can be handled appropriately.
2952         <rdar://problem/21579162> and https://bugs.webkit.org/show_bug.cgi?id=146441
2953
2954         Reviewed by Darin Adler.
2955
2956         * platform/network/ResourceHandleClient.h:
2957         (WebCore::ResourceHandleClient::loadingSynchronousXHR): Added so clients of asynchronous
2958           loads can signal they should be treated like synchronous loads at the platform level.
2959
2960         * platform/network/cf/ResourceHandleCFNet.cpp:
2961         (WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.
2962
2963         * platform/network/mac/ResourceHandleMac.mm:
2964         (WebCore::ResourceHandle::start): Adjust SchedulingBehavior based on the client.
2965
2966 2015-06-29  Chris Fleizach  <cfleizach@apple.com>
2967
2968         AX: PlatformSpeechSynthesizer code doesn't catch Objective-C exceptions
2969         https://bugs.webkit.org/show_bug.cgi?id=146419
2970
2971         Reviewed by Simon Fraser.
2972
2973         Make sure ObjC exception resulting from calling into the platform cause problems in WebKit.
2974
2975         * platform/ios/PlatformSpeechSynthesizerIOS.mm:
2976         (-[WebSpeechSynthesisWrapper speakUtterance:]):
2977         (-[WebSpeechSynthesisWrapper pause]):
2978         (-[WebSpeechSynthesisWrapper resume]):
2979         (-[WebSpeechSynthesisWrapper cancel]):
2980         (-[WebSpeechSynthesisWrapper speechSynthesizer:didStartSpeechUtterance:]):
2981         (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
2982         (WebCore::PlatformSpeechSynthesizer::pause):
2983
2984 2015-06-29  Matt Rajca  <mrajca@apple.com>
2985
2986         Removing an element from a media session should also remove it from the sets of active participating elements
2987         https://bugs.webkit.org/show_bug.cgi?id=146420
2988
2989         Reviewed by Eric Carlson.
2990
2991         * Modules/mediasession/MediaSession.cpp:
2992         (WebCore::MediaSession::removeMediaElement):
2993
2994 2015-06-29  Dean Jackson  <dino@apple.com>
2995
2996         Temporarily disable PICTURE_SIZES
2997         https://bugs.webkit.org/show_bug.cgi?id=146435
2998         <rdar://problem/21087013>
2999
3000         Reviewed by Tim Horton.
3001
3002         Temporarily disable PICTURE_SIZES because it causes problems with out
3003         of date <picture> polyfills.
3004
3005         * Configurations/FeatureDefines.xcconfig:
3006
3007 2015-06-29  Tim Horton  <timothy_horton@apple.com>
3008
3009         Fix the build.
3010
3011         * editing/cocoa/HTMLConverter.mm:
3012         * platform/spi/cocoa/NSAttributedStringSPI.h:
3013
3014 2015-06-29  Tim Horton  <timothy_horton@apple.com>
3015
3016         Fix the build.
3017
3018         * platform/spi/cocoa/NSAttributedStringSPI.h:
3019
3020 2015-06-29  Tim Horton  <timothy_horton@apple.com>
3021
3022         Fix the build.
3023
3024         * platform/spi/cocoa/NSAttributedStringSPI.h:
3025
3026 2015-06-27  Ryosuke Niwa  <rniwa@webkit.org>
3027
3028         Font panel doesn't get updated when bolding text via cmd+b in Mail on OS X
3029         https://bugs.webkit.org/show_bug.cgi?id=146379
3030
3031         Reviewed by Darin Adler.
3032
3033         The bug was caused by WebKit not updating the font panel when the typing style changes.
3034         There was also a bug that WebKit never updated font attributes on OS X.
3035
3036         Fixed the bugs by always updating the font panel after applying style instead of only
3037         when the selection changes and setting the font attributes.
3038
3039         I tried really had to write a WebKit API test but I couldn't get it to work so there are
3040         no new tests :(
3041
3042         * WebCore.xcodeproj/project.pbxproj:
3043         * editing/Editor.cpp:
3044         (WebCore::Editor::applyStyle):
3045         (WebCore::Editor::shouldApplyStyle):
3046         (WebCore::Editor::applyParagraphStyle):
3047         (WebCore::Editor::applyStyleToSelection):
3048         (WebCore::Editor::applyParagraphStyleToSelection):
3049         (WebCore::Editor::selectionStartHasStyle):
3050         (WebCore::Editor::document):
3051         (WebCore::Editor::styleForSelectionStart): Deleted.
3052         * editing/Editor.h:
3053         * editing/cocoa/EditorCocoa.h: Added. Shares the declaration for NSUnderlineStyle in iOS.
3054         * editing/cocoa/EditorCocoa.mm: Added.
3055         (WebCore::Editor::styleForSelectionStart): Moved from Editor.cpp
3056         (WebCore::Editor::getTextDecorationAttributesRespectingTypingStyle): Extracted from iOS's
3057         fontAttributesForSelectionStart implementation.
3058         * editing/cocoa/HTMLConverter.mm:
3059         * editing/ios/EditorIOS.mm:
3060         (WebCore::Editor::fontAttributesForSelectionStart):
3061         * editing/mac/EditorMac.mm:
3062         (WebCore::Editor::fontAttributesForSelectionStart):
3063         * loader/EmptyClients.h:
3064         * page/EditorClient.h:
3065
3066 2015-06-29  Matt Rajca  <mrajca@apple.com>
3067
3068         MediaSession: use a HashSet for the collection of participating elements
3069         https://bugs.webkit.org/show_bug.cgi?id=146421
3070
3071         Reviewed by Eric Carlson.
3072
3073         * Modules/mediasession/MediaSession.cpp:
3074         (WebCore::MediaSession::addMediaElement):
3075         (WebCore::MediaSession::removeMediaElement):
3076         * Modules/mediasession/MediaSession.h:
3077
3078 2015-06-29  Dean Jackson  <dino@apple.com>
3079
3080         Setting to enable/disable media controls sizing on page zoom
3081         https://bugs.webkit.org/show_bug.cgi?id=146423
3082         <rdar://problem/18379634>
3083
3084         Reviewed by Eric Carlson.
3085
3086         Add a new setting "MediaControlsScaleWithPageZoom" that can disable
3087         the behaviour we currently implement on iOS, where the media controls
3088         attempt to remain at a fixed size independent of page zoom.
3089
3090         * html/HTMLMediaElement.cpp:
3091         (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor): Do not
3092         set this value to true if the new setting is disabled.
3093         * page/Settings.cpp:
3094         * page/Settings.in: Add the new setting.
3095
3096 2015-06-29  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3097
3098         WebRTC: Update the MediaStream API
3099         https://bugs.webkit.org/show_bug.cgi?id=146313
3100
3101         Reviewed by Eric Carlson.
3102
3103         Update the MediaStream API (MediaStream, MediaStreamTrack and
3104         RealtimeMediaSource) to match the Media Capture and Stream
3105         specification [1]. Notable changes:
3106
3107         Updated event handling to synchronously update corresponding
3108         state/attributes as events are dispatched.
3109
3110         Removed 'new' state from MediaStreamTrack. A track is either 'live' or
3111         'ended'. As a consequence 'started' event is also removed.
3112
3113         MediaStreamTrack always has a source (disconnected source concept was
3114         removed from the spec). Therefore, more state can be kept at the source
3115         without going away.
3116
3117         Calculate MediaStream.active internally, from the track set, instead of
3118         setting it externally.
3119
3120         Updated RealtimeMediaSource Observer interface.
3121
3122         Replaced MediaStream's separate audio and video track lists with a
3123         single track set (more aligned with spec).
3124
3125         Updated MediaStream constructor to adopt instead of clone track
3126         arguments (or tracks from MediaStream argument).
3127
3128         Removed MediaStreamTrack.getSources() and corresponding test (removed
3129         from spec).
3130
3131         Test status: 3 added, 8 existing enabled (some updated) and 1 removed.
3132
3133         [1] http://w3c.github.io/mediacapture-main/archives/20150523/getusermedia.html
3134
3135         Tests: fast/mediastream/MediaStreamTrack-clone.html
3136                fast/mediastream/MediaStreamTrack-kind.html
3137                fast/mediastream/MediaStreamTrack-stop.html
3138
3139         * Modules/mediastream/MediaStream.cpp:
3140         (WebCore::MediaStream::create):
3141         (WebCore::MediaStream::MediaStream):
3142         (WebCore::MediaStream::clone):
3143         (WebCore::MediaStream::addTrack):
3144         (WebCore::MediaStream::removeTrack):
3145         (WebCore::MediaStream::getTrackById):
3146         (WebCore::MediaStream::getAudioTracks):
3147         (WebCore::MediaStream::getVideoTracks):
3148         (WebCore::MediaStream::getTracks):
3149         (WebCore::MediaStream::contextDestroyed):
3150         (WebCore::MediaStream::trackDidEnd):
3151         (WebCore::MediaStream::activeStatusChanged):
3152         (WebCore::MediaStream::didAddTrackToPrivate):
3153         (WebCore::MediaStream::didRemoveTrackFromPrivate):
3154         (WebCore::MediaStream::internalAddTrack):
3155         (WebCore::MediaStream::internalRemoveTrack):
3156         (WebCore::MediaStream::scheduleActiveStateChange):
3157         (WebCore::MediaStream::activityEventTimerFired):
3158         (WebCore::MediaStream::trackVectorForType):
3159         (WebCore::MediaStream::~MediaStream): Deleted.
3160         (WebCore::MediaStream::registry): Deleted.
3161         (WebCore::MediaStream::addObserver): Deleted.
3162         (WebCore::MediaStream::removeObserver): Deleted.
3163         * Modules/mediastream/MediaStream.h:
3164         * Modules/mediastream/MediaStream.idl:
3165         * Modules/mediastream/MediaStreamTrack.cpp:
3166         (WebCore::MediaStreamTrack::MediaStreamTrack):
3167         (WebCore::MediaStreamTrack::~MediaStreamTrack):
3168         (WebCore::MediaStreamTrack::kind):
3169         (WebCore::MediaStreamTrack::id):
3170         (WebCore::MediaStreamTrack::label):
3171         (WebCore::MediaStreamTrack::enabled):
3172         (WebCore::MediaStreamTrack::setEnabled):
3173         (WebCore::MediaStreamTrack::muted):
3174         (WebCore::MediaStreamTrack::readonly):
3175         (WebCore::MediaStreamTrack::remote):
3176         (WebCore::MediaStreamTrack::readyState):
3177         (WebCore::MediaStreamTrack::ended):
3178         (WebCore::MediaStreamTrack::clone):
3179         (WebCore::MediaStreamTrack::stopProducingData):
3180         (WebCore::MediaStreamTrack::states):
3181         (WebCore::MediaStreamTrack::getCapabilities):
3182         (WebCore::MediaStreamTrack::applyConstraints):
3183         (WebCore::MediaStreamTrack::trackEnded):
3184         (WebCore::MediaStreamTrack::trackMutedChanged):
3185         (WebCore::MediaStreamTrack::stop):
3186         (WebCore::MediaStreamTrack::getConstraints): Deleted.
3187         (WebCore::MediaStreamTrack::addObserver): Deleted.
3188         (WebCore::MediaStreamTrack::removeObserver): Deleted.
3189         (WebCore::MediaStreamTrack::configureTrackRendering): Deleted.
3190         (WebCore::MediaStreamTrack::activeDOMObjectName): Deleted.
3191         (WebCore::MediaStreamTrack::canSuspendForPageCache): Deleted.
3192         * Modules/mediastream/MediaStreamTrack.h:
3193         * Modules/mediastream/MediaStreamTrack.idl:
3194         * Modules/mediastream/RTCPeerConnection.cpp:
3195         (WebCore::RTCPeerConnection::didRemoveRemoteStream): Deleted.
3196         * Modules/mediastream/UserMediaRequest.cpp:
3197         (WebCore::UserMediaRequest::didCreateStream):
3198         * platform/mediastream/MediaStreamPrivate.cpp:
3199         (WebCore::MediaStreamPrivate::create):
3200         (WebCore::MediaStreamPrivate::MediaStreamPrivate):
3201         (WebCore::MediaStreamPrivate::tracks):
3202         (WebCore::MediaStreamPrivate::updateActiveState):
3203         (WebCore::MediaStreamPrivate::addTrack):
3204         (WebCore::MediaStreamPrivate::removeTrack):
3205         * platform/mediastream/MediaStreamPrivate.h:
3206         (WebCore::MediaStreamPrivate::active): Deleted.
3207         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3208         (WebCore::MediaStreamTrackPrivate::create):
3209         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
3210         (WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
3211         (WebCore::MediaStreamTrackPrivate::label):
3212         (WebCore::MediaStreamTrackPrivate::setEnabled):
3213         (WebCore::MediaStreamTrackPrivate::endTrack):
3214         (WebCore::MediaStreamTrackPrivate::clone):
3215         (WebCore::MediaStreamTrackPrivate::type):
3216         (WebCore::MediaStreamTrackPrivate::applyConstraints):
3217         (WebCore::MediaStreamTrackPrivate::sourceStopped):
3218         (WebCore::MediaStreamTrackPrivate::sourceMutedChanged):
3219         (WebCore::MediaStreamTrackPrivate::preventSourceFromStopping):
3220         (WebCore::MediaStreamTrackPrivate::muted): Deleted.
3221         (WebCore::MediaStreamTrackPrivate::readonly): Deleted.
3222         (WebCore::MediaStreamTrackPrivate::remote): Deleted.
3223         (WebCore::MediaStreamTrackPrivate::constraints): Deleted.
3224         (WebCore::MediaStreamTrackPrivate::states): Deleted.
3225         (WebCore::MediaStreamTrackPrivate::capabilities): Deleted.
3226         * platform/mediastream/MediaStreamTrackPrivate.h:
3227         (WebCore::MediaStreamTrackPrivate::id):
3228         (WebCore::MediaStreamTrackPrivate::ended):
3229         (WebCore::MediaStreamTrackPrivate::enabled):
3230         (WebCore::MediaStreamTrackPrivate::setClient):
3231         (WebCore::MediaStreamTrackPrivate::source): Deleted.
3232         (WebCore::MediaStreamTrackPrivate::client): Deleted.
3233         * platform/mediastream/RealtimeMediaSource.cpp:
3234         (WebCore::RealtimeMediaSource::RealtimeMediaSource):
3235         (WebCore::RealtimeMediaSource::reset):
3236         (WebCore::RealtimeMediaSource::setMuted):
3237         (WebCore::RealtimeMediaSource::readonly):
3238         (WebCore::RealtimeMediaSource::stop):
3239         (WebCore::RealtimeMediaSource::requestStop):
3240         (WebCore::RealtimeMediaSource::addObserver): Deleted.
3241         (WebCore::RealtimeMediaSource::removeObserver): Deleted.
3242         * platform/mediastream/RealtimeMediaSource.h:
3243         (WebCore::RealtimeMediaSource::stopped):
3244         (WebCore::RealtimeMediaSource::id): Deleted.
3245         (WebCore::RealtimeMediaSource::muted): Deleted.
3246         (WebCore::RealtimeMediaSource::setReadonly): Deleted.
3247         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3248         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Deleted.
3249         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3250         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Deleted.
3251
3252 2015-06-29  Benjamin Poulain  <benjamin@webkit.org>
3253
3254         Make the NFA transitions range-based
3255         https://bugs.webkit.org/show_bug.cgi?id=146338
3256
3257         Reviewed by Alex Christensen.
3258
3259         Change the NFA to use range based transition for any kind of transition.
3260         The fallback transition is also absorbed as ranges.
3261
3262         Previously, the NFA would only have single transitions and a fallback
3263         transition for all cases not covered by single transitions.
3264
3265         The problem with that design was that character ranges (e.g. [a-z]) were
3266         extended as individual transitions. Something like [^a] would cover
3267         most of the alphabet with transitions.
3268         When converting the NFA to DFA, the time is proportional to the number of states
3269         multiplied by the number of transitions. With many individual transitions,
3270         the run time was an order of magnitude higher than what we want.
3271
3272         This patch changes the NFA to only handle ranges of characters. A single transition
3273         becomes a range with the character as first and last character in the range
3274         ('a' becomes 'a' to 'a').
3275         Ranges of characters are handled direclty (e.g. [a-z] becomes a single 'a' to 'z' transition).
3276
3277         In the context of the state machines, ranges have identifies (the target of the transitions).
3278         When two ranges collide, they have to be split such that each part retain its target
3279         except the intersection that gets the union of the targets.
3280
3281         Handling the union of ranges efficiently is critical because we have to do
3282         it for every NFA node in any subset when building the DFA. The helper
3283         class that does that is MutableRange.
3284
3285         The union of ranges is done efficiently because of preconditions on our list of ranges:
3286         -The ranges must be sorted.
3287         -No range in a list can intersect any other range in the same list.
3288
3289         To merge two ranges, we can go over them in order and split them part by part.
3290         It is easy to find what goes where because they are both sorted and we can
3291         compare the characters of each to know how to move forward.
3292         The time to merge 2 range list is proportional to O(n+m) where 'n' and 'm' are
3293         the number of ranges in each list.
3294
3295         Since taking the union of two lists usually create new ranges, we have to allocate
3296         those somewhere efficiently. To do that, MutableRange support an inline capacity,
3297         which is used for the NFAToDFA Convertion.
3298
3299         ---
3300
3301         With ranges, the NFA-to-DFA conversion changes very little:
3302         -Each NFA nodes contains a list of ranges and each range has a list of targets.
3303         -The subset construction select any number of NFA nodes corresponding to
3304          a single deterministic state.
3305         -For the subset, we can use MutableRange to merge the ranges of every
3306          NFA node in the set. The resulting list has rangeis with targets corresponding
3307          to the union of all the transitions.
3308         -We go over all the ranges the same way we used to go over the transitions.
3309          Since the DFA does not support ranges, the ranges are spread as individual
3310          transitions + fallback transition.
3311
3312         ---
3313
3314         With the efficient merging solved, we still need the actual NFA to use ranges
3315         instead of individual transitions.
3316
3317         I could have used MutableRange for that but it is not the most compact
3318         way to represent ranges that do not need merging.
3319
3320         Instead, the NFA uses a custom structure: ImmutableNFA. It is basically
3321         the same thing, but in that one you cannot change a list of range
3322         after creating it.
3323
3324         Consequently, the sorted ranges in ImmutableNFA are also subsequent
3325         in memory, which is really nice to go over them efficiently
3326         when merging ranges in the NFA-to-DFA conversion. :)
3327
3328         When building the NFA, we don't know all the transitions when creating
3329         each node, BUT we know that we have very few node "unfinished" at any
3330         time. Since we build by going depth-first in the prefix-tree, we only
3331         have the max-depth of live nodes in the worst case.
3332
3333         To help building the NFA out of the prefix tree, we have
3334         ImmutableNFANodeBuilder. It keeps all the informations about a NFA node,
3335         but in a non-compact, mutable form. When a ImmutableNFANodeBuilder
3336         is destroyed, it serialize the information into the immutable NFA.
3337
3338         * WebCore.xcodeproj/project.pbxproj:
3339         * contentextensions/CombinedURLFilters.cpp:
3340         (WebCore::ContentExtensions::generateNFAForSubtree):
3341         (WebCore::ContentExtensions::CombinedURLFilters::processNFAs):
3342         * contentextensions/ContentExtensionCompiler.cpp:
3343         (WebCore::ContentExtensions::compileRuleList):
3344         * contentextensions/DFA.cpp:
3345         (WebCore::ContentExtensions::DFA::empty):
3346         * contentextensions/DFA.h:
3347         * contentextensions/ImmutableNFA.h: Added.
3348         (WebCore::ContentExtensions::ImmutableNFA::ConstTargetIterator::operator*):
3349         (WebCore::ContentExtensions::ImmutableNFA::ConstTargetIterator::operator->):
3350         (WebCore::ContentExtensions::ImmutableNFA::ConstTargetIterator::operator==):
3351         (WebCore::ContentExtensions::ImmutableNFA::ConstTargetIterator::operator!=):
3352         (WebCore::ContentExtensions::ImmutableNFA::ConstTargetIterator::operator++):
3353         (WebCore::ContentExtensions::ImmutableNFA::IterableConstTargets::begin):
3354         (WebCore::ContentExtensions::ImmutableNFA::IterableConstTargets::end):
3355         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator*):
3356         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator->):
3357         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator==):
3358         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator!=):
3359         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::operator++):
3360         (WebCore::ContentExtensions::ImmutableNFA::ConstRangeIterator::data):
3361         (WebCore::ContentExtensions::ImmutableNFA::IterableConstRange::begin):
3362         (WebCore::ContentExtensions::ImmutableNFA::IterableConstRange::end):
3363         (WebCore::ContentExtensions::ImmutableNFA::IterableConstRange::debugPrint):
3364         (WebCore::ContentExtensions::ImmutableNFA::transitionsForNode):
3365         (WebCore::ContentExtensions::ImmutableNFA::root):
3366         (WebCore::ContentExtensions::ImmutableNFA::finalize):
3367         (WebCore::ContentExtensions::ImmutableNFA::memoryUsed):
3368         * contentextensions/ImmutableNFANodeBuilder.h: Added.
3369         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::ImmutableNFANodeBuilder):
3370         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::~ImmutableNFANodeBuilder):
3371         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::addTransition):
3372         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::addEpsilonTransition):
3373         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::setActions):
3374         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::operator=):
3375         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::finalize):
3376         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::sinkActions):
3377         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::sinkTransitions):
3378         (WebCore::ContentExtensions::ImmutableNFANodeBuilder::sinkEpsilonTransitions):
3379         * contentextensions/MutableRange.h: Added.
3380         (WebCore::ContentExtensions::MutableRange::MutableRange):
3381         (WebCore::ContentExtensions::MutableRange::operator=):
3382         (WebCore::ContentExtensions::MutableRange::size):
3383         * contentextensions/MutableRangeList.h: Added.
3384         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::operator*):
3385         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::operator->):
3386         (WebCore::ContentExtensions::MutableRangeList::ConstIterator::operator==):