[Modern Media Controls] Media Controller: update controls based on fullscreen playbac...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-10  Antoine Quint  <graouts@apple.com>
2
3         [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
4         https://bugs.webkit.org/show_bug.cgi?id=164554
5         <rdar://problem/29183439>
6
7         Reviewed by Dean Jackson.
8
9         When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
10         To facilitate this, support objects are created and destroyed when changing the controls in order for the
11         right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
12         subclasses can be overridden to remove event listeners added by support objects in their constructor.
13
14         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html
15
16         * Modules/modern-media-controls/media/fullscreen-support.js:
17         (FullscreenSupport.prototype.destroy):
18         * Modules/modern-media-controls/media/media-controller-support.js:
19         (MediaControllerSupport.prototype.destroy):
20         * Modules/modern-media-controls/media/media-controller.js:
21         (MediaController):
22         (MediaController.prototype.get layoutTraits):
23         (MediaController.prototype.handleEvent):
24         (MediaController.prototype._updateControlsIfNeeded):
25         (MediaController.prototype._controlsClass):
26
27 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
28
29         [Linux] Memory values shown by memory pressure handler logger are not useful
30         https://bugs.webkit.org/show_bug.cgi?id=164589
31
32         Reviewed by Michael Catanzaro.
33
34         We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
35         and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
36         time we see that there's no changes in memory usage in the logs.
37         We should use the actual memory used by the process, memory that the process can release and then it's relevant
38         for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
39         (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
40         different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
41         multiply by the size of the page.
42         This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
43         memory sampler that is incorrectly parsing /proc/self/statm.
44
45         * platform/Linux.cmake: Add new files to compilation.
46         * platform/linux/CurrentProcessMemoryStatus.cpp: Added.
47         (WebCore::systemPageSize): Return the page size.
48         (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
49         * platform/linux/CurrentProcessMemoryStatus.h: Added.
50         * platform/linux/MemoryPressureHandlerLinux.cpp:
51         (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
52         in bytes.
53         (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().
54
55 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
56
57         MemoryPressureHandler shouldn't know how to release WebCore memory
58         https://bugs.webkit.org/show_bug.cgi?id=160497
59
60         Reviewed by Michael Catanzaro.
61
62         All processes should set their own low memory handler, instead of leaving the web process using the default one
63         that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
64         MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
65         WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.
66
67         * CMakeLists.txt: Add new files to compilation.
68         * PlatformMac.cmake: Ditto.
69         * WebCore.xcodeproj/project.pbxproj: Ditto.
70         * loader/FrameLoader.cpp:
71         (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
72         * page/MemoryRelease.cpp: Added.
73         (WebCore::releaseNoncriticalMemory):
74         (WebCore::releaseCriticalMemory):
75         (WebCore::releaseMemory):
76         (WebCore::platformReleaseMemory):
77         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
78         (WebCore::registerMemoryReleaseNotifyCallbacks):
79         * page/MemoryRelease.h: Added.
80         * page/cocoa/MemoryReleaseCocoa.mm: Added.
81         (WebCore::platformReleaseMemory):
82         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
83         (WebCore::registerMemoryReleaseNotifyCallbacks):
84         * platform/MemoryPressureHandler.cpp:
85         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
86         (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
87         (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
88         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
89         * platform/MemoryPressureHandler.h:
90         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
91         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
92         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
93         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
94         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
95         * platform/linux/MemoryPressureHandlerLinux.cpp:
96         * platform/win/MemoryPressureHandlerWin.cpp:
97         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
98
99 2016-11-08  Sergio Villar Senin  <svillar@igalia.com>
100
101         [css-grid] Fix fr tracks sizing under min|max-size constraints
102         https://bugs.webkit.org/show_bug.cgi?id=150674
103
104         Reviewed by Darin Adler.
105
106         The min|max-sizes must be used to compute the flex fraction for indefinite free
107         spaces. According to the spec "If using this flex fraction would cause the grid to be
108         smaller than the grid container’s min-width/height (or larger than the grid container’s
109         max-width/height), then redo this step, treating the free space as definite and the
110         available grid space as equal to the grid container’s content box size when it’s sized to
111         its min-width/height (max-width/height)."
112
113         This only affects indefinite heights because during layout both definite sizes and any kind
114         of widths are properly constrained by min|max-width restrictions.
115
116         Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
117                fast/css-grid-layout/flex-sizing-rows-min-max-height.html
118
119         * rendering/RenderGrid.cpp:
120         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
121         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
122         * rendering/RenderGrid.h:
123
124 2016-11-10  Alejandro G. Castro  <alex@igalia.com>
125
126         [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
127         https://bugs.webkit.org/show_bug.cgi?id=164541
128
129         Reviewed by Philippe Normand.
130
131         Fixed typo in refactoring.
132
133         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
134         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
135
136 2016-11-08  Philippe Normand  <pnormand@igalia.com>
137
138         [WebRTC] white-list turns urls from the RTCConfiguration
139         https://bugs.webkit.org/show_bug.cgi?id=164506
140
141         Reviewed by Alejandro G. Castro.
142
143         * Modules/mediastream/RTCConfiguration.cpp:
144         (WebCore::validateIceServerURL): Add the turns URL scheme to the
145         list of supported relay and signaling server protocols.
146
147 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
148
149         Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
150         https://bugs.webkit.org/show_bug.cgi?id=161951
151         <rdar://problem/28295767>
152
153         Reviewed by Brian Burg.
154
155         Covered by existing tests that would ASSERT otherwise.
156
157         * inspector/InspectorClient.cpp:
158         (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
159         When paused on an exception in the inspected page and evaluating
160         commands in the inspector frontend page (which evaluates JavaScript)
161         we ASSERT when entering the Global DOM VM with an existing exception.
162         This makes it so when we evaluate JavaScript in the frontend we
163         suspend / ignore the state of the VM for the inspected page, and
164         restore it when we return from the inspector.
165
166 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
167
168         Web Inspector: Associate Worker Resources with the Worker and not the Page
169         https://bugs.webkit.org/show_bug.cgi?id=164342
170         <rdar://problem/29075775>
171
172         Reviewed by Timothy Hatcher.
173
174         Test: inspector/worker/resources-in-worker.html
175
176         Provide a way to associate an initiator identifier with a ResourceRequest.
177         This will allow Web Inspector to identify who started particular resource
178         loads. This is important to associate Worker(...), importScript(...), and
179         XMLHttpRequest / Fetch loads with that specific Worker.
180
181         * platform/network/ResourceRequestBase.cpp:
182         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
183         * platform/network/ResourceRequestBase.h:
184         (WebCore::ResourceRequestBase::initiatorIdentifier):
185         (WebCore::ResourceRequestBase::setInitiatorIdentifier):
186         Optional initiator identifier. Currently used only be Web Inspector.
187
188         * dom/ScriptExecutionContext.h:
189         (WebCore::ScriptExecutionContext::resourceRequestIdentifier):
190         Non-page execution contexts, like WorkerGlobalScope, should provide
191         a unique identifier that may be used to distinguish loads initiated
192         from within that context.
193
194         * xml/XMLHttpRequest.cpp:
195         (WebCore::XMLHttpRequest::createRequest):
196         * Modules/fetch/FetchLoader.cpp:
197         (WebCore::FetchLoader::start):
198         * Modules/fetch/FetchRequest.cpp:
199         (WebCore::FetchRequest::initializeWith):
200         XHR / Fetch loads should include the ScriptExecutionContext's
201         initiator identifier.
202
203         * workers/WorkerScriptLoader.cpp:
204         (WebCore::WorkerScriptLoader::WorkerScriptLoader):
205         (WebCore::WorkerScriptLoader::loadSynchronously):
206         (WebCore::WorkerScriptLoader::loadAsynchronously):
207         (WebCore::WorkerScriptLoader::createResourceRequest):
208         * workers/WorkerScriptLoader.h:
209         Provide a way to provide initiator identifier information for
210         Worker script loads. Currently this is `new Worker(...)` and
211         `importScripts(...)` resource loads.
212
213         * workers/Worker.cpp:
214         (WebCore::Worker::Worker):
215         (WebCore::Worker::create):
216         * workers/Worker.h:
217         * workers/WorkerGlobalScope.cpp:
218         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
219         (WebCore::WorkerGlobalScope::importScripts):
220         * workers/WorkerGlobalScope.h:
221         Give Worker itself the unique identifier, because `new Worker(...)`
222         loads happen before the WorkerGlobalScript (ScriptExecutionContext)
223         is actually created, but we want to associate it with this Worker.
224
225         * workers/DedicatedWorkerGlobalScope.cpp:
226         (WebCore::DedicatedWorkerGlobalScope::create):
227         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
228         * workers/DedicatedWorkerGlobalScope.h:
229         * workers/DedicatedWorkerThread.cpp:
230         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
231         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
232         * workers/DedicatedWorkerThread.h:
233         * workers/WorkerInspectorProxy.cpp:
234         (WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
235         * workers/WorkerInspectorProxy.h:
236         * workers/WorkerMessagingProxy.cpp:
237         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
238         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
239         * workers/WorkerThread.cpp:
240         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
241         (WebCore::WorkerThread::WorkerThread):
242         (WebCore::WorkerThread::workerThread):
243         * workers/WorkerThread.h:
244         Pass the MainThread's Worker identifier through to the WorkerGlobalScope
245         created on the WorkerThread. They should be the same identifier.
246
247         * inspector/InspectorNetworkAgent.cpp:
248         (WebCore::InspectorNetworkAgent::willSendRequest):
249         * inspector/InspectorPageAgent.cpp:
250         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
251         Pass the initiator identifier data to the frontend. This identifier is
252         equivalent to a "target identifier" in the frontend. Currently the only
253         non-Page targets are Workers.
254
255         * loader/cache/CachedResourceLoader.cpp:
256         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
257         When using the memory cache we create a new resource request. Be sure
258         to copy over useful inspector data, like the initiator identifier,
259         from the original request.
260
261         * platform/network/cf/ResourceRequestCFNet.cpp:
262         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
263         When rebuilding a ResourceRequest from NSURLRequest, copy over the
264         initiator identifier property that wouldn't otherwise have survived
265         the transition.
266
267 2016-11-09  Brady Eidson  <beidson@apple.com>
268
269         IndexedDB 2.0: Clean up some exception ordering.
270         https://bugs.webkit.org/show_bug.cgi?id=164566
271
272         Reviewed by Alex Christensen.
273
274         No new tests (Covered by existing tests).
275
276         * Modules/indexeddb/IDBCursor.cpp:
277         (WebCore::IDBCursor::advance):
278         (WebCore::IDBCursor::continueFunction):
279
280         * Modules/indexeddb/IDBObjectStore.cpp:
281         (WebCore::IDBObjectStore::createIndex):
282
283 2016-11-09  Alex Christensen  <achristensen@webkit.org>
284
285         Unreviewed, rolling out r208438.
286
287         crashes
288
289         Reverted changeset:
290
291         "[WK2][NETWORK_SESSION] Add support for downloading file
292         backed blobs"
293         https://bugs.webkit.org/show_bug.cgi?id=164458
294         http://trac.webkit.org/changeset/208438
295
296 2016-11-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
297
298         Change the decoding for some animated images to be asynchronous
299         https://bugs.webkit.org/show_bug.cgi?id=161566
300
301         Reviewed by Simon Fraser.
302
303         Tests: fast/images/slower-animation-than-decoding-image.html
304                fast/images/slower-decoding-than-animation-image.html
305                fast/images/stopped-animation-deleted-image.html
306                
307         Request the next frame before firing the animation timer. The asynchronous
308         image decoding work queue notifies the BitmapImage when the frame finishes
309         decoding. If the timer fires before the frame is decoded, no repaint will
310         be requested. Only when the image frame is ready, the animation will be
311         advanced and the image will be repainted.
312
313         * loader/cache/CachedImage.cpp:
314         (WebCore::CachedImage::load): Cache the image settings in CachedImage.
315         (WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver().
316         (WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer.
317         * loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader.
318         * platform/graphics/BitmapImage.cpp:
319         (WebCore::BitmapImage::dataChanged): Fix a logging message.
320         (WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame.
321         Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on.
322         (WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file.
323         (WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the
324         result of starting the animation.
325         (WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded
326         and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn.
327         (WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation().
328         (WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started.
329         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame.
330         * platform/graphics/BitmapImage.h:
331         (WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation().
332         * platform/graphics/Color.h: Define a constant for the yellow color.
333         * platform/graphics/ImageFrameCache.cpp:
334         (WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member.
335         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding.
336         * platform/graphics/ImageFrameCache.h:
337         * platform/graphics/ImageObserver.h:  Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground.
338         * platform/graphics/ImageSource.cpp:
339         (WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw().
340         * platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver().
341         (WebCore::ImageSource::setAllowSubsampling): Deleted.
342         * rendering/RenderImageResource.cpp:
343         (WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource.
344         * rendering/RenderImageResourceStyleImage.cpp:
345         (WebCore::RenderImageResourceStyleImage::shutdown): Ditto.
346         svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer.
347         (WebCore::SVGImageChromeClient::invalidateContentsAndRootView):
348         * testing/Internals.cpp:
349         (WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing.
350         * testing/Internals.h:
351         * testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration.
352
353 2016-11-04  Brent Fulgham  <bfulgham@apple.com>
354
355         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
356         https://bugs.webkit.org/show_bug.cgi?id=155185
357         <rdar://problem/11101440>
358
359         Reviewed by Brady Eidson.
360
361         Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that
362         localStorage access should be granted, without needing to grant universal file access.
363
364         If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
365         grants universal file access.
366
367         Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html
368                storage/domstorage/localstorage/blocked-file-access.html
369
370         * dom/Document.cpp:
371         (WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings.
372         * page/SecurityOrigin.cpp:
373         (WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers.
374         (WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in
375         localStorage quirks mode, and we have not been granted universal file access, prevent access
376         to DOM localStorage.
377         (WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added.
378         * page/SecurityOrigin.h:
379         (WebCore::SecurityOrigin::needsLocalStorageQuirk): Added.
380         * page/Settings.in:
381         * workers/WorkerGlobalScope.cpp:
382         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the
383         localStorage quirks mode is set to.
384
385 2016-11-09  Alex Christensen  <achristensen@webkit.org>
386
387         URLParser should not consider path of URLs with no host to start at the first slash after the colon
388         https://bugs.webkit.org/show_bug.cgi?id=164555
389
390         Reviewed by Tim Horton.
391
392         When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
393         but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
394         URL::parse, and I added this to URLParser in r206783 which this effectively reverts.
395
396         Covered by API and layout tests.
397
398         * platform/URLParser.cpp:
399         (WebCore::URLParser::parse):
400         Don't move m_userStart to m_pathStart back by two when we see an empty host.
401
402 2016-11-09  Alex Christensen  <achristensen@webkit.org>
403
404         Simplify logic of SecurityOrigin::databaseIdentifier
405         https://bugs.webkit.org/show_bug.cgi?id=164565
406
407         Reviewed by Brady Eidson.
408
409         No change in behavior.
410
411         SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
412         Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
413         making the database identifier, just determine whether we need this quirk when making the database identifier.
414         I'm planning to move this logic to SecurityOriginData in another patch.
415
416         * page/SecurityOrigin.cpp:
417         (WebCore::SecurityOrigin::SecurityOrigin):
418         (WebCore::SecurityOrigin::create):
419         (WebCore::SecurityOrigin::databaseIdentifier):
420         * page/SecurityOrigin.h:
421
422 2016-11-09  Jaehun Lim  <ljaehun.lim@samsung.com>
423
424         Unreviewed, build fix after r208460
425
426         isValidColorString() was renamed isValidSimpleColorString().
427
428         * html/ColorInputType.cpp:
429         (WebCore::ColorInputType::suggestions):
430
431 2016-11-09  Anders Carlsson  <andersca@apple.com>
432
433         Fix STP build.
434
435         * WebCorePrefix.h:
436
437 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
438
439         Implement visual-viewport based position:fixed handling for Mac async scrolling
440         https://bugs.webkit.org/show_bug.cgi?id=164495
441
442         Reviewed by Tim Horton.
443
444         Educate the scrolling tree about visual and layout viewports. This is runtime-switchable,
445         so we push the enable flag to via the root state node, then push the layout viewport,
446         and the min/max scroll position that contstrain it, through frame state nodes.
447
448         When a scroll happens, we compute a new layout viewport when the visual viewport hits
449         an edge, and push that down through setScrollLayerPosition() since it's used to position
450         fixed and sticky layers.
451
452         When the main thread gets notified about an async scroll, we set the new layout viewport
453         on the FrameView, but do so in such a way that does not trigger layout. This is OK because
454         we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is
455         necessary to avoid repaints every main thread update.
456
457         The iOS code is made to compile, but not work yet.
458
459         Tests: compositing/tiling/visiblerect-accumulated-offset.html
460                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html
461                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html
462                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html
463
464         * page/FrameView.cpp:
465         (WebCore::FrameView::setLayoutViewportOrigin):
466         (WebCore::FrameView::updateLayoutViewport):
467         (WebCore::FrameView::visualViewportRect):
468         (WebCore::FrameView::unscaledMinimumScrollPosition):
469         (WebCore::FrameView::scrollPositionChanged):
470         * page/FrameView.h:
471         * page/scrolling/AsyncScrollingCoordinator.cpp:
472         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
473         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
474         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
475         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
476         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
477         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled):
478         * page/scrolling/AsyncScrollingCoordinator.h:
479         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
480         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
481         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
482         (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport):
483         (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin):
484         (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin):
485         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled):
486         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
487         * page/scrolling/ScrollingStateFrameScrollingNode.h:
488         * page/scrolling/ScrollingTree.cpp:
489         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
490         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
491         (WebCore::ScrollingTree::commitTreeState):
492         * page/scrolling/ScrollingTree.h:
493         (WebCore::ScrollingTree::visualViewportEnabled):
494         (WebCore::ScrollingTree::setVisualViewportEnabled):
495         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
496         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
497         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
498         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
499         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport):
500         (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin):
501         (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin):
502         * page/scrolling/ScrollingTreeScrollingNode.cpp:
503         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints):
504         * page/scrolling/ScrollingTreeScrollingNode.h:
505         * page/scrolling/ThreadedScrollingTree.cpp:
506         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
507         * page/scrolling/ThreadedScrollingTree.h:
508         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
509         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
510         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
511         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
512         * page/scrolling/ios/ScrollingTreeIOS.cpp:
513         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
514         * page/scrolling/ios/ScrollingTreeIOS.h:
515         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
516         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
517         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
518         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
519
520 2016-11-09  Brady Eidson  <beidson@apple.com>
521
522         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
523         https://bugs.webkit.org/show_bug.cgi?id=164528
524
525         Reviewed by Alex Christensen.
526
527         No new tests (Covered by existing test).
528
529         * Modules/indexeddb/IDBDatabase.cpp:
530         (WebCore::IDBDatabase::transaction): De-dupe the input names.
531
532 2016-11-09  Brady Eidson  <beidson@apple.com>
533
534         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
535         https://bugs.webkit.org/show_bug.cgi?id=164404
536
537         Reviewed by Alex Christensen.
538
539         Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html
540                storage/indexeddb/modern/idbcursor-continue-primary-key-1.html
541                Also covered by existing tests.
542
543         * Modules/indexeddb/IDBCursor.cpp:
544         (WebCore::IDBCursor::continuePrimaryKey):
545         (WebCore::IDBCursor::uncheckedIterateCursor):
546         * Modules/indexeddb/IDBCursor.h:
547         * Modules/indexeddb/IDBCursor.idl:
548
549         * Modules/indexeddb/IDBKeyData.h:
550         (WebCore::IDBKeyData::operator>):
551         (WebCore::IDBKeyData::operator<=):
552         (WebCore::IDBKeyData::operator>=):
553
554         * Modules/indexeddb/server/MemoryCursor.h:
555
556         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
557         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
558
559         * Modules/indexeddb/server/MemoryIndexCursor.cpp:
560         (WebCore::IDBServer::MemoryIndexCursor::iterate):
561         * Modules/indexeddb/server/MemoryIndexCursor.h:
562
563         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
564         (WebCore::IDBServer::MemoryObjectStoreCursor::iterate):
565         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
566
567         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
568         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
569
570         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
571         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
572         * Modules/indexeddb/server/SQLiteIDBCursor.h:
573
574         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
575         (WebCore::IDBIterateCursorData::isolatedCopy):
576         * Modules/indexeddb/shared/IDBIterateCursorData.h:
577         (WebCore::IDBIterateCursorData::encode):
578         (WebCore::IDBIterateCursorData::decode):
579
580 2016-11-09  Antoine Quint  <graouts@apple.com>
581
582         [Modern Media Controls] Media Controller: set status label according to media state
583         https://bugs.webkit.org/show_bug.cgi?id=164557
584         <rdar://problem/29184097>
585
586         Reviewed by Dean Jackson.
587
588         Correctly set the StatusLabel text based on the media loading and network state.
589
590         Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html
591                http/tests/media/modern-media-controls/status-support/status-support-loading.html
592                media/modern-media-controls/status-support/status-support-error.html
593
594         * Modules/modern-media-controls/js-files:
595         * Modules/modern-media-controls/media/media-controller.js:
596         (MediaController):
597         * Modules/modern-media-controls/media/status-support.js: Added.
598         (StatusSupport.prototype.get control):
599         (StatusSupport.prototype.get mediaEvents):
600         (StatusSupport.prototype.syncControl):
601         (StatusSupport):
602         * WebCore.xcodeproj/project.pbxproj:
603
604 2016-11-09  Zalan Bujtas  <zalan@apple.com>
605
606         No need to set setFlowThreadState on RenderText in createTextRenderer.
607         https://bugs.webkit.org/show_bug.cgi?id=164559
608
609         Reviewed by Antti Koivisto.
610
611        setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
612        styleWillChange/styleDidChange through initializeStyle, the state is already set.
613        However since RenderText does not have its own style, it's sufficient to have the flow state set
614        through the normal RenderElement::insertChildInternal code path.
615
616         No change in functionality.
617
618         * style/RenderTreeUpdater.cpp:
619         (WebCore::createTextRenderer):
620
621 2016-11-09  Brady Eidson  <beidson@apple.com>
622
623         IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
624         https://bugs.webkit.org/show_bug.cgi?id=164504
625
626         Reviewed by Darin Adler.
627
628         No new tests (Refactor, no behavior change).
629
630         This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
631         That struct will then be easily expandable in the future (e.g. bug 164404).
632
633         * Modules/indexeddb/IDBCursor.cpp:
634         (WebCore::IDBCursor::uncheckedIterateCursor):
635         
636         * Modules/indexeddb/IDBTransaction.cpp:
637         (WebCore::IDBTransaction::iterateCursor):
638         (WebCore::IDBTransaction::iterateCursorOnServer):
639         * Modules/indexeddb/IDBTransaction.h:
640         
641         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
642         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
643         * Modules/indexeddb/client/IDBConnectionProxy.h:
644         
645         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
646         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
647         * Modules/indexeddb/client/IDBConnectionToServer.h:
648         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
649         
650         * Modules/indexeddb/server/IDBBackingStore.h:
651         
652         * Modules/indexeddb/server/IDBServer.cpp:
653         (WebCore::IDBServer::IDBServer::iterateCursor):
654         * Modules/indexeddb/server/IDBServer.h:
655         
656         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
657         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
658         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
659         
660         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
661         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
662         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
663         
664         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
665         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
666         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
667         * Modules/indexeddb/server/UniqueIDBDatabase.h:
668         
669         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
670         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
671         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
672         
673         * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
674         (WebCore::IDBIterateCursorData::isolatedCopy):
675         * Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
676         (WebCore::IDBIterateCursorData::encode):
677         (WebCore::IDBIterateCursorData::decode):
678
679         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
680         (WebCore::InProcessIDBServer::iterateCursor):
681         * Modules/indexeddb/shared/InProcessIDBServer.h:
682
683         * CMakeLists.txt:
684         * WebCore.xcodeproj/project.pbxproj:
685
686 2016-11-09  Ryosuke Niwa  <rniwa@webkit.org>
687
688         StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
689         https://bugs.webkit.org/show_bug.cgi?id=129476
690
691         Reviewed by Andreas Kling.
692
693         Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
694         when the attribute value didn't change as in r164856.
695
696         * dom/StyledElement.cpp:
697         (WebCore::StyledElement::attributeChanged):
698
699 2016-11-09  Yusuke Suzuki  <utatane.tea@gmail.com>
700
701         [DOMJIT] Implement Node::ownerDocument
702         https://bugs.webkit.org/show_bug.cgi?id=164004
703
704         Reviewed by Darin Adler.
705
706         Test: js/dom/domjit-accessor-owner-document.html
707
708         Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
709         This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
710         if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
711         document() won't return nullptr and access the member of it.
712
713         This patch aligns the DOMJIT implementation strictly to the C++ one.
714
715         * dom/Node.idl:
716         * domjit/JSNodeDOMJIT.cpp:
717         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
718         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
719
720 2016-11-09  Sam Weinig  <sam@webkit.org>
721
722         [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
723         https://bugs.webkit.org/show_bug.cgi?id=164496
724
725         Reviewed by Darin Adler.
726
727         There is quite a bit of special casing of SVG types in the bindings that adds
728         a lot of complexity and is relatively fragile, as it is based on type naming.
729
730         Instead of keeping the complexity in the bindings, I am going to move it into
731         the implementation, where it has also longed to be. 
732
733         Starting small, with just SVGAngle. It has been split in two, with the existing
734         SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
735         SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from 
736         SVGPropertyTearOff<SVGAngleValue>).
737
738         * CMakeLists.txt:
739         * WebCore.xcodeproj/project.pbxproj:
740         Add SVGAngleValue.cpp
741
742         * bindings/scripts/CodeGenerator.pm:
743         Remove SVGAngle as a special case.
744
745         * svg/SVGAngle.cpp: Removed.
746         * svg/SVGAngle.h:
747         Added. Implements the SVGAngle interface explicitly, getting to
748         the SVGAngleValue through propertyReference().
749
750         * svg/SVGAngle.idl:
751         * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
752         * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
753         Move old SVGAngle implementation to SVGAngleValue.
754
755         * svg/SVGAnimatedAngle.cpp:
756         Replace SVGAngle usage with SVGAngleValue.
757
758         * svg/SVGAnimatedAngle.h:
759         Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
760         as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
761
762         * svg/SVGAnimatedLength.h:
763         * svg/SVGAnimatedPreserveAspectRatio.h:
764         * svg/SVGAnimatedRect.h:
765         Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
766
767         * svg/SVGAnimatedType.cpp:
768         (WebCore::SVGAnimatedType::createAngleAndEnumeration):
769         * svg/SVGAnimatedType.h:
770         (WebCore::SVGAnimatedType::angleAndEnumeration):
771         Use SVGAngleValue.
772
773         * svg/SVGComponentTransferFunctionElement.h:
774         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
775
776         * svg/SVGMarkerElement.cpp:
777         (WebCore::SVGMarkerElement::parseAttribute):
778         (WebCore::SVGMarkerElement::setOrient):
779         Switch to take an SVGAngleValue.
780
781         (WebCore::SVGMarkerElement::setOrientToAngle):
782         Update to pull the value out via propertyReference().
783
784         * svg/SVGMarkerElement.h:
785         Switch to take an SVGAngleValue.
786
787         * svg/SVGLengthList.h:
788         * svg/SVGNumberList.h:
789         * svg/SVGPathSegList.h:
790         * svg/SVGPointList.h:
791         * svg/SVGStringList.h:
792         * svg/SVGTransformList.h:
793         Switch to using type aliases in SVGPropertyTraits and add an alias for
794         ListItemTearOff.
795
796         * svg/SVGSVGElement.cpp:
797         (WebCore::SVGSVGElement::createSVGAngle):
798         * svg/SVGSVGElement.h:
799         Change createSVGAngle to return a Ref<SVGAngle> and create one.
800
801         * svg/SVGSVGElement.idl:
802         Annotate IDL to indicate that a new value is being returned.
803
804         * svg/SVGTransform.cpp:
805         Remove unnecessary include of SVGAngle.h.
806
807         * svg/SVGViewSpec.cpp:
808         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
809
810         * svg/properties/SVGAnimatedPropertyTearOff.h:
811         Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
812         Property type from the TearOffType.
813
814         * svg/properties/SVGListProperty.h:
815         * svg/properties/SVGListPropertyTearOff.h:
816         Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
817         type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
818
819         * svg/properties/SVGPropertyTearOff.h:
820         Make the PropertyType available by exposing it as a type alias.
821
822 2016-11-09  Darin Adler  <darin@apple.com>
823
824         Move Range from ExceptionCode to ExceptionOr
825         https://bugs.webkit.org/show_bug.cgi?id=164457
826
827         Reviewed by Alex Christensen.
828
829         * accessibility/AXObjectCache.cpp:
830         (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
831         keeping behavior the same.
832         (WebCore::characterOffsetsInOrder): Ditto.
833         (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
834         reference instead of a pointer. Use a boolean return value to indicate
835         success rather than an exception, since the callers don't need to know
836         which exception it is.
837         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
838         the above.
839         (WebCore::AXObjectCache::nextBoundary): Ditto.
840         (WebCore::AXObjectCache::previousBoundary): Ditto.
841
842         * accessibility/AccessibilityObject.cpp:
843         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
844         Update to use ExceptionOr, keeping behavior the same.
845         * accessibility/AccessibilityRenderObject.cpp:
846         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
847         * accessibility/atk/WebKitAccessibleUtil.cpp:
848         (selectionBelongsToObject): Ditto.
849         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
850         (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
851         * dom/Node.cpp:
852         (WebCore::Node::textRects): Ditto.
853
854         * dom/Range.cpp:
855         (WebCore::Range::~Range): Remove old comment that no longer makes sense now
856         that the detach function no longer does anything.
857         (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
858         keeping behavior the same.
859         (WebCore::Range::setStart): Ditto.
860         (WebCore::Range::setEnd): Ditto.
861         (WebCore::Range::isPointInRange): Ditto.
862         (WebCore::Range::comparePoint): Ditto.
863         (WebCore::Range::compareNode): Ditto.
864         (WebCore::top): Added helper function so that compareBoundaryPoints doesn't
865         need to have two identical loops in it.
866         (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
867         keeping behavior the same.
868         (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
869         instead of relying on the order of the values to check for unsupported values.
870         (WebCore::Range::boundaryPointsValid): Ditto.
871         (WebCore::Range::deleteContents): Ditto.
872         (WebCore::Range::intersectsNode): Ditto.
873         (WebCore::Range::processContents): Ditto.
874         (WebCore::deleteCharacterData): Ditto.
875         (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
876         non-member function and private to this file instead of in the class.
877         (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
878         since the code relies on using it after mutating the DOM.
879         (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
880         to use ExceptionOr so the caller doesn't have to check the exception first.
881         (WebCore::Range::extractContents): Ditto.
882         (WebCore::Range::cloneContents): Ditto.
883         (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
884         instead of three times.
885         (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
886         per node instead of twice, to use downcast instead of static_cast, and to
887         use the word "node" instead of "n" for the local variable name.
888         (WebCore::Range::createContextualFragment): Ditto.
889         (WebCore::Range::checkNodeWOffset): Ditto.
890         (WebCore::Range::setStartAfter): Ditto.
891         (WebCore::Range::setEndBefore): Ditto.
892         (WebCore::Range::setEndAfter): Ditto.
893         (WebCore::Range::selectNode): Ditto.
894         (WebCore::Range::selectNodeContents): Ditto.
895         (WebCore::Range::surroundContents): Ditto.
896         (WebCore::Range::setStartBefore): Ditto.
897         (WebCore::Range::contains): Ditto. Except added code to handle exception
898         case to return false without asserting because I saw at least one crash
899         that seemed to imply this behavior was needed.
900         (WebCore::rangesOverlap): Ditto.
901         (WebCore::rangeOfContents): Ditto.
902         (WebCore::Range::expand): Ditto.
903         (WebCore::Range::getClientRects): Ditto.
904         (WebCore::Range::getBoundingClientRect): Ditto.
905         (WebCore::Range::borderAndTextQuads): Changed to use return value
906         instead of out argument, since it's a private function used only
907         within this class so it was easy to update all call sites.
908         (WebCore::Range::boundingRect): Updated for above. Also renamed since
909         there was no need for the name "internal" in this.
910         (WebCore::Range::absoluteBoundingRect): Ditto.
911         * dom/Range.h: Updated for above.
912         * dom/Range.idl: Use non-legacy exceptions. Also changed the default value
913         of the string argument to the expand function to the empty string rather
914         than "undefined", because the function silently does nothing when passed
915         any unrecognized string, and so this leaves behavior unchanged. I removed
916         the comment saying that the "undefined" default is wrong.
917
918         * editing/AlternativeTextController.cpp:
919         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
920         to use ExceptionOr but behave the same.
921         * editing/Editor.cpp:
922         (WebCore::Editor::advanceToNextMisspelling): Ditto.
923         (WebCore::Editor::markAndReplaceFor): Ditto.
924         (WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
925         (WebCore::Editor::countMatchesForText): Ditto.
926         * editing/EditorCommand.cpp:
927         (WebCore::unionDOMRanges): Ditto.
928         * editing/FrameSelection.cpp:
929         (WebCore::FrameSelection::respondToNodeModification): Ditto.
930         * editing/InsertListCommand.cpp:
931         (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
932         * editing/TextCheckingHelper.cpp:
933         (WebCore::TextCheckingParagraph::offsetTo): Ditto.
934         * editing/TextCheckingHelper.h: Updated for above and also deleted
935         unneeded private function checkingRange, which just churned the
936         reference count unnecessarily; instead use m_checkingRange directly.
937         * editing/TextIterator.cpp:
938         (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
939         * editing/VisiblePosition.cpp:
940         (WebCore::setStart): Ditto.
941         (WebCore::setEnd): Ditto.
942         * editing/VisibleSelection.cpp:
943         (WebCore::makeSearchRange): Ditto.
944
945         * editing/VisibleUnits.cpp:
946         (WebCore::suffixLengthForRange): Changed argument from RefPtr to
947         a reference.
948         (WebCore::prefixLengthForRange): Ditto.
949         (WebCore::previousBoundary): Updated for ExceptionOr and the change
950         above.
951         (WebCore::nextBoundary): Ditto.
952         * editing/VisibleUnits.h: Updated for above.
953
954         * editing/htmlediting.cpp:
955         (WebCore::comparePositions): Updated to use ExceptionOr but behave
956         the same.
957         (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
958         (WebCore::isNodeVisiblyContainedWithin): Ditto.
959         * editing/ios/EditorIOS.mm:
960         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
961         (WebCore::Editor::setTextAsChildOfElement): Ditto.
962         * editing/mac/EditorMac.mm:
963         (WebCore::Editor::adjustedSelectionRange): Ditto.
964         * editing/markup.cpp:
965         (WebCore::createMarkupInternal): Ditto.
966         * page/ContextMenuController.cpp:
967         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
968         * page/DOMSelection.cpp:
969         (WebCore::DOMSelection::addRange): Ditto.
970         (WebCore::DOMSelection::deleteFromDocument): Ditto.
971         (WebCore::DOMSelection::containsNode): Ditto.
972
973         * page/EventHandler.cpp:
974         (WebCore::EventHandler::dispatchMouseEvent): Updated for change to
975         use ExceptionOr in Ragne::compareNode. Also refactored the function
976         to make the logic a little mroe straightforward and nest less of it
977         inside a loop.
978
979         * page/Page.cpp:
980         (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
981         without changing behavior.
982         * page/TextIndicator.cpp:
983         (WebCore::hasNonInlineOrReplacedElements): Ditto.
984         * rendering/RenderNamedFlowThread.cpp:
985         (WebCore::RenderNamedFlowThread::getRanges): Ditto.
986
987 2016-11-09  Dave Hyatt  <hyatt@apple.com>
988
989         [CSS Parser] Fix grid layout parsing
990         https://bugs.webkit.org/show_bug.cgi?id=164489
991
992         Reviewed by Dean Jackson.
993
994         * css/CSSValueKeywords.in:
995         * css/parser/CSSPropertyParser.cpp:
996         (WebCore::consumeFitContent):
997         (WebCore::isGridTrackFixedSized):
998         (WebCore::consumeGridTrackSize):
999         (WebCore::consumeGridTrackRepeatFunction):
1000         (WebCore::consumeGridTrackList):
1001         (WebCore::isCustomIdentValue):
1002         (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
1003         (WebCore::CSSPropertyParser::consumeGridAreaShorthand):
1004         (WebCore::consumeImplicitGridAutoFlow):
1005         (WebCore::CSSPropertyParser::consumeGridShorthand):
1006
1007 2016-11-09  Darin Adler  <darin@apple.com>
1008
1009         Move EventTarget from ExceptionCode to ExceptionOr
1010         https://bugs.webkit.org/show_bug.cgi?id=164465
1011
1012         Reviewed by Youenn Fablet.
1013
1014         * Modules/indexeddb/IDBRequest.h: Added now-needed forward
1015         class declarations.
1016         * Modules/webaudio/AudioContext.h: Ditto.
1017
1018         * bindings/js/JSEventListener.cpp:
1019         (WebCore::eventHandlerAttribute): Updated for name change of the
1020         attributeEventListener function.
1021         (WebCore::documentEventHandlerAttribute): Ditto.
1022         * dom/Document.cpp:
1023         (WebCore::Document::getWindowAttributeEventListener): Ditto.
1024
1025         * dom/EventTarget.cpp:
1026         (WebCore::EventTarget::setAttributeEventListener): Updated for
1027         name change.
1028         (WebCore::EventTarget::attributeEventListener): Ditto.
1029         (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
1030         (WebCore::legacyType): Use null instead of empty for no type, since
1031         it's more efficient to check for null.
1032         (WebCore::EventTarget::fireEventListeners): Check for null.
1033         Also streamlined logic a little bit and removed a very old comment.
1034         (WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
1035         * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
1036         some functions to remove get prefix. Updated for above changes.
1037         Moved one inline function out of the class header. Made the destructor
1038         for EventTarget be inline to make the destructors for derived classes
1039         slightly more efficient.
1040         * dom/EventTarget.idl: Use non-legacy exception.
1041
1042         * dom/Node.cpp:
1043         (WebCore::Node::didMoveToNewDocument): Updated for name change.
1044         * editing/ReplaceSelectionCommand.cpp:
1045         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
1046
1047         * inspector/InspectorCSSAgent.h: Added now-needed forward declaration.
1048
1049         * inspector/InspectorDOMAgent.cpp:
1050         (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.
1051
1052         * inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
1053         * page/DOMWindow.h: Ditto.
1054         * xml/XMLHttpRequest.h: Ditto.
1055
1056 2016-11-09  Daniel Bates  <dabates@apple.com>
1057
1058         Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
1059         https://bugs.webkit.org/show_bug.cgi?id=164389
1060         <rdar://problem/29101072>
1061
1062         Reviewed by Alex Christensen.
1063
1064         Add test infrastructure to support registering an arbitrary port as the default port
1065         for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
1066         can be effected by whether the resource request was made using the default port for
1067         the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
1068         a test to override the default port associated with a protocol so as to support
1069         testing these code paths using the existing port 8000 server started by run-webkit-httpd.
1070         Without window.internals.registerDefaultPortForProtocol() we would need to teach
1071         run-webkit-httpd to run a web server on port 80, which requires superuser privileges
1072         (since it is a privileged port number) and is more likely to interfere with an
1073         existing web server setup.
1074
1075         Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
1076                http/tests/security/http-0.9/default-port-script-blocked.html
1077                http/tests/security/http-0.9/iframe-blocked.html
1078                http/tests/security/http-0.9/image-blocked.html
1079                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
1080                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
1081                http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
1082                http/tests/security/http-0.9/worker-connect-src-blocked.html
1083                http/tests/security/http-0.9/worker-importScripts-blocked.html
1084                http/tests/security/http-0.9/xhr-asynchronous-blocked.html
1085
1086         * platform/URL.cpp:
1087         (WebCore::defaultPortForProtocolMapForTesting): Added.
1088         (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
1089         mapping used for testing.
1090         (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
1091         We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
1092         test runs.
1093         (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
1094         before consulting URLParser::defaultPortForProtocol().
1095         * platform/URL.h:
1096         * testing/Internals.cpp:
1097         (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
1098         (WebCore::Internals::registerDefaultPortForProtocol): Added.
1099         * testing/Internals.h:
1100         * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
1101
1102 2016-11-09  Sam Weinig  <sam@webkit.org>
1103
1104         [WebIDL] Add proper parsing for Promises
1105         https://bugs.webkit.org/show_bug.cgi?id=164497
1106
1107         Reviewed by Tim Horton.
1108
1109         * bindings/scripts/IDLParser.pm:
1110         (parseNonAnyType):
1111         (parseStringType):
1112         Require Promise types to declare the type they resolve to.
1113         
1114         * bindings/js/JSDOMPromise.h:
1115         Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
1116         overload of resolve that takes no arguments when in a DOMPromise<void>.
1117
1118         * Modules/applepay/ApplePaySession.idl:
1119         * Modules/fetch/DOMWindowFetch.idl:
1120         * Modules/fetch/FetchBody.idl:
1121         * Modules/fetch/FetchResponse.idl:
1122         * Modules/fetch/WorkerGlobalScopeFetch.idl:
1123         * Modules/mediastream/MediaDevices.idl:
1124         * Modules/mediastream/MediaStreamTrack.idl:
1125         * Modules/mediastream/RTCPeerConnection.idl:
1126         * Modules/mediastream/RTCRtpSender.idl:
1127         * Modules/mediastream/RTCStatsReport.idl:
1128         * Modules/streams/ReadableStream.idl:
1129         * Modules/streams/ReadableStreamDefaultReader.idl:
1130         * Modules/streams/ReadableStreamSource.idl:
1131         * Modules/streams/WritableStream.idl:
1132         * Modules/webaudio/AudioContext.idl:
1133         * bindings/scripts/test/TestNode.idl:
1134         * bindings/scripts/test/TestObj.idl:
1135         * crypto/SubtleCrypto.idl:
1136         * crypto/WebKitSubtleCrypto.idl:
1137         * css/FontFace.idl:
1138         * css/FontFaceSet.idl:
1139         * dom/CustomElementRegistry.idl:
1140         * html/HTMLMediaElement.idl:
1141         Update IDLs to specify the resolve type of promise types.
1142
1143         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1144         (WebCore::MediaEndpointPeerConnection::replaceTrack):
1145         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
1146         * Modules/mediastream/MediaStreamTrack.cpp:
1147         (WebCore::MediaStreamTrack::applyConstraints):
1148         * Modules/mediastream/MediaStreamTrack.h:
1149         * Modules/mediastream/PeerConnectionBackend.cpp:
1150         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1151         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1152         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1153         * Modules/mediastream/PeerConnectionBackend.h:
1154         * Modules/streams/ReadableStreamSource.h:
1155         (WebCore::ReadableStreamSource::start):
1156         (WebCore::ReadableStreamSource::pull):
1157         (WebCore::ReadableStreamSource::startFinished):
1158         (WebCore::ReadableStreamSource::pullFinished):
1159         * Modules/webaudio/AudioContext.cpp:
1160         (WebCore::AudioContext::addReaction):
1161         (WebCore::AudioContext::setState):
1162         (WebCore::AudioContext::suspend):
1163         (WebCore::AudioContext::resume):
1164         (WebCore::AudioContext::close):
1165         * Modules/webaudio/AudioContext.h:
1166         * html/HTMLMediaElement.cpp:
1167         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
1168         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
1169         (WebCore::HTMLMediaElement::play):
1170         * html/HTMLMediaElement.h:
1171         Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
1172         and use the new resolve() overload.
1173
1174 2016-11-07  Brady Eidson  <beidson@apple.com>
1175
1176         Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&
1177
1178         Rubberstamped by Alex Christensen.
1179
1180         No new tests (No behavior change).
1181
1182         * Modules/indexeddb/IDBObjectStore.cpp:
1183         (WebCore::IDBObjectStore::IDBObjectStore):
1184         (WebCore::IDBObjectStore::~IDBObjectStore):
1185         (WebCore::IDBObjectStore::hasPendingActivity):
1186         (WebCore::IDBObjectStore::name):
1187         (WebCore::IDBObjectStore::setName):
1188         (WebCore::IDBObjectStore::keyPath):
1189         (WebCore::IDBObjectStore::indexNames):
1190         (WebCore::IDBObjectStore::transaction):
1191         (WebCore::IDBObjectStore::autoIncrement):
1192         (WebCore::IDBObjectStore::openCursor):
1193         (WebCore::IDBObjectStore::openKeyCursor):
1194         (WebCore::IDBObjectStore::get):
1195         (WebCore::IDBObjectStore::putOrAdd):
1196         (WebCore::IDBObjectStore::doDelete):
1197         (WebCore::IDBObjectStore::clear):
1198         (WebCore::IDBObjectStore::createIndex):
1199         (WebCore::IDBObjectStore::index):
1200         (WebCore::IDBObjectStore::deleteIndex):
1201         (WebCore::IDBObjectStore::doCount):
1202         (WebCore::IDBObjectStore::getAll):
1203         (WebCore::IDBObjectStore::getAllKeys):
1204         (WebCore::IDBObjectStore::markAsDeleted):
1205         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1206         (WebCore::IDBObjectStore::ref):
1207         (WebCore::IDBObjectStore::deref):
1208         * Modules/indexeddb/IDBObjectStore.h:
1209
1210 2016-11-09  Zalan Bujtas  <zalan@apple.com>
1211
1212         Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
1213         https://bugs.webkit.org/show_bug.cgi?id=164503
1214
1215         Reviewed by Antti Koivisto.
1216
1217         When we insert a renderer into the render tree, we need to know both its parent
1218         and its next sibling. Normally the parent and the sibling are based on the DOM, but
1219         when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling.
1220         To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement().
1221         RenderNamedFlowThread keeps track of its children so that it can compute the next sibling
1222         for the insertion point.
1223
1224         This patch eliminates the need for keeping track of the child renderers of each
1225         flow by moving the 'next sibling' logic to RenderTreePosition.
1226
1227         No change in functionality.
1228
1229         * rendering/RenderElement.cpp:
1230         (WebCore::RenderElement::insertedIntoTree):
1231         (WebCore::RenderElement::willBeDestroyed):
1232         (WebCore::RenderElement::removeFromRenderFlowThread):
1233         (WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted.
1234         * rendering/RenderElement.h:
1235         * rendering/RenderNamedFlowThread.cpp:
1236         (WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted.
1237         (WebCore::RenderNamedFlowThread::addFlowChild): Deleted.
1238         (WebCore::RenderNamedFlowThread::removeFlowChild): Deleted.
1239         * rendering/RenderNamedFlowThread.h:
1240         * style/RenderTreePosition.cpp:
1241         (WebCore::RenderTreePosition::previousSiblingRenderer):
1242         (WebCore::RenderTreePosition::flowThreadInsertionContext):
1243         * style/RenderTreePosition.h:
1244         (WebCore::RenderTreePosition::RenderTreePosition):
1245         (WebCore::RenderTreePosition::parent):
1246         * style/RenderTreeUpdater.cpp:
1247         (WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none).
1248         (WebCore::RenderTreeUpdater::createRenderer):
1249         (WebCore::moveToFlowThreadIfNeeded): Deleted.
1250
1251 2016-11-09  Per Arne Vollan  <pvollan@apple.com>
1252
1253         [Win][Direct2D] Incomplete image decoding.
1254         https://bugs.webkit.org/show_bug.cgi?id=164511
1255
1256         Reviewed by Darin Adler.
1257
1258         Create native decoder when all image data has been received.
1259
1260         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1261         (WebCore::ImageDecoder::setData):
1262
1263 2016-11-09  Beth Dakin  <bdakin@apple.com>
1264
1265         Attempted build fix.
1266
1267         * platform/spi/cocoa/AVKitSPI.h:
1268
1269 2016-11-09  Brady Eidson  <beidson@apple.com>
1270
1271         IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime.
1272         https://bugs.webkit.org/show_bug.cgi?id=164466
1273
1274         Reviewed by Alex Christensen.
1275
1276         No new tests (Covered by existing tests that now pass).
1277         
1278         Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive.
1279         Now, IDBObjectStore ref/deref do the same thing for the owning transaction.
1280         
1281         Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted"
1282         set and get promoted back up into the "referenced" set.
1283         
1284         Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back
1285         to the owning objects.
1286
1287         * CMakeLists.txt:
1288         * WebCore.xcodeproj/project.pbxproj:
1289
1290         * Modules/indexeddb/IDBIndex.cpp:
1291         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
1292
1293         * Modules/indexeddb/IDBObjectStore.cpp:
1294         (WebCore::IDBObjectStore::IDBObjectStore):
1295         (WebCore::IDBObjectStore::indexNames):
1296         (WebCore::IDBObjectStore::transaction):
1297         (WebCore::IDBObjectStore::openCursor):
1298         (WebCore::IDBObjectStore::openKeyCursor):
1299         (WebCore::IDBObjectStore::deleteIndex):
1300         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1301         (WebCore::IDBObjectStore::visitReferencedIndexes):
1302         (WebCore::IDBObjectStore::ref):
1303         (WebCore::IDBObjectStore::deref):
1304         (WebCore::IDBObjectStore::create): Deleted.
1305         * Modules/indexeddb/IDBObjectStore.h:
1306
1307         * Modules/indexeddb/IDBTransaction.cpp:
1308         (WebCore::IDBTransaction::objectStore):
1309         (WebCore::IDBTransaction::transitionedToFinishing):
1310         (WebCore::IDBTransaction::internalAbort):
1311         (WebCore::IDBTransaction::createObjectStore):
1312         (WebCore::IDBTransaction::deleteObjectStore):
1313         (WebCore::IDBTransaction::visitReferencedObjectStores):
1314         * Modules/indexeddb/IDBTransaction.h:
1315         * Modules/indexeddb/IDBTransaction.idl:
1316
1317         * bindings/js/JSIDBTransactionCustom.cpp: Added.
1318         (WebCore::JSIDBTransaction::visitAdditionalChildren):
1319
1320 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
1321
1322         Allow customization of TextStream-based logging for geometry types
1323         https://bugs.webkit.org/show_bug.cgi?id=164460
1324
1325         Reviewed by Zalan Bujtas.
1326
1327         TextStream-based logging was constrained by the requirement to maintain compatibility
1328         with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40")
1329         and dumping LayoutRects as IntRects.
1330         
1331         Add some formatting flags so that other TextStream clients (e.g. logging) can have
1332         more readable output, and opt into automatic FormatNumberRespectingIntegers behavior.
1333         
1334         TextStreams whose output appears in test results are given flags to avoid behavior
1335         changes, but in the longer term test results should be updated.
1336
1337         * html/canvas/CanvasRenderingContext2D.cpp:
1338         (WebCore::CanvasRenderingContext2D::replayDisplayListAsText):
1339         * page/scrolling/ScrollingStateNode.cpp:
1340         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
1341         * platform/graphics/FloatPoint.cpp:
1342         (WebCore::operator<<):
1343         * platform/graphics/FloatRect.cpp:
1344         (WebCore::operator<<):
1345         * platform/graphics/GraphicsLayer.cpp:
1346         (WebCore::GraphicsLayer::layerTreeAsText):
1347         * platform/graphics/IntRect.cpp:
1348         (WebCore::operator<<):
1349         * platform/graphics/LayoutPoint.cpp:
1350         (WebCore::operator<<):
1351         * platform/graphics/LayoutRect.cpp:
1352         (WebCore::operator<<):
1353         * platform/graphics/ca/GraphicsLayerCA.cpp:
1354         (WebCore::GraphicsLayerCA::replayDisplayListAsText):
1355         * platform/graphics/displaylists/DisplayList.cpp:
1356         (WebCore::DisplayList::DisplayList::asText):
1357         * platform/text/TextStream.cpp:
1358         (WebCore::TextStream::operator<<):
1359         * platform/text/TextStream.h:
1360         (WebCore::TextStream::TextStream):
1361         (WebCore::TextStream::formattingFlags):
1362         (WebCore::TextStream::setFormattingFlags):
1363         (WebCore::TextStream::hasFormattingFlag):
1364         (WebCore::TextStream::increaseIndent):
1365         (WebCore::TextStream::decreaseIndent):
1366         * rendering/RenderTreeAsText.cpp:
1367         (WebCore::externalRepresentation):
1368         (WebCore::counterValueForElement):
1369
1370 2016-11-09  Zalan Bujtas  <zalan@apple.com>
1371
1372         RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject*
1373         https://bugs.webkit.org/show_bug.cgi?id=164543
1374
1375         Reviewed by Simon Fraser.
1376
1377         No change in functionality.
1378
1379         * rendering/RenderBlockFlow.cpp:
1380         (WebCore::RenderBlockFlow::removeChild):
1381         * rendering/RenderFlowThread.h:
1382         * rendering/RenderMultiColumnFlowThread.cpp:
1383         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
1384         (WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved):
1385         * rendering/RenderMultiColumnFlowThread.h:
1386
1387 2016-11-09  Jer Noble  <jer.noble@apple.com>
1388
1389         REGRESSION (r208149): Media scrubber is not displayed in media controls
1390         https://bugs.webkit.org/show_bug.cgi?id=164514
1391
1392         Reviewed by Darin Adler.
1393
1394         Fixes broken Media Controls API tests.
1395
1396         Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of 
1397         MediaElementSession.h so that is<> and downcast<> work correctly.
1398
1399         * html/MediaElementSession.h:
1400         (isType):
1401
1402 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1403
1404         When editing IME, `compositionend` events should fire after input events
1405         https://bugs.webkit.org/show_bug.cgi?id=164324
1406         <rdar://problem/29050438>
1407
1408         Reviewed by Darin Adler.
1409
1410         Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or
1411         `input` events. Also augments existing layout tests to verify the change.
1412
1413         * editing/Editor.cpp:
1414         (WebCore::Editor::setComposition):
1415
1416 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1417
1418         Setting foreground color when text is selected should fire an input event with color data
1419         https://bugs.webkit.org/show_bug.cgi?id=164241
1420         <rdar://problem/29032759>
1421
1422         Reviewed by Darin Adler.
1423
1424         Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch.
1425         Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to
1426         return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle,
1427         in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command.
1428
1429         Test: fast/events/input-events-selection-forecolor-data.html
1430
1431         * editing/ApplyStyleCommand.h:
1432         * editing/Editor.cpp:
1433         (WebCore::inputEventDataForEditingStyleAndAction):
1434         (WebCore::Editor::applyStyle):
1435         (WebCore::Editor::applyParagraphStyle):
1436         (WebCore::Editor::computeAndSetTypingStyle):
1437
1438 2016-11-08  Dean Jackson  <dino@apple.com>
1439
1440         Rendering support for ExtendedColors
1441         https://bugs.webkit.org/show_bug.cgi?id=164443
1442         <rdar://problems/29123243>
1443
1444         Reviewed by Simon Fraser and Darin Adler.
1445
1446         Add support for rendering the new color() syntax, which
1447         ends up as an ExtendedColor.
1448
1449         In order to make rendering code a little more readable, I
1450         changed Color::hasAlpha to Color::isOpaque (since an alpha
1451         of 100% is still an alpha), and added a Color::isVisible
1452         helper (the color isn't completely transparent). These new
1453         helpers support ExtendedColor forms.
1454
1455         Support for painting gradients and blending between colors
1456         is still to come. I also added some FIXME comments
1457         to show other places that don't handle ExtendedColors yet.
1458
1459         Tests: css3/color/backgrounds-and-borders.html
1460                css3/color/box-shadows.html
1461                css3/color/canvas.html
1462                css3/color/composited-solid-backgrounds.html
1463                css3/color/text.html
1464
1465         * css/CSSGradientValue.cpp: Add some notes that this is broken.
1466         (WebCore::interpolate):
1467         (WebCore::CSSGradientValue::knownToBeOpaque):
1468
1469         * editing/EditingStyle.cpp: Use new Color helpers.
1470         (WebCore::isTransparentColorValue):
1471
1472         * editing/mac/EditorMac.mm: Use new Color helpers.
1473         (WebCore::Editor::fontAttributesForSelectionStart):
1474
1475         * html/ColorInputType.cpp: No need to use the Color class at all here.
1476         (WebCore::isValidSimpleColorString): Renamed from isValidColorString.
1477         (WebCore::ColorInputType::sanitizeValue):
1478         (WebCore::ColorInputType::typeMismatchFor):
1479         (WebCore::isValidColorString): Deleted.
1480
1481         * html/canvas/CanvasRenderingContext2D.cpp: New helpers.
1482         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
1483         (WebCore::CanvasRenderingContext2D::didDraw):
1484
1485         * page/FrameView.cpp: Ditto.
1486         (WebCore::FrameView::recalculateScrollbarOverlayStyle):
1487         (WebCore::FrameView::hasOpaqueBackground):
1488         (WebCore::FrameView::setBaseBackgroundColor):
1489
1490         * platform/graphics/Color.cpp:
1491         (WebCore::differenceSquared): Support ExtendedColor, but also
1492         add a note to indicate that this method and its call sites
1493         should use floats.
1494         (WebCore::Color::serialized): New helper.
1495         (WebCore::Color::cssText): Ditto.
1496         (WebCore::Color::blend): Ditto.
1497         (WebCore::Color::blendWithWhite):
1498         (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function.
1499         (WebCore::Color::colorWithAlpha): Ditto.
1500         (WebCore::Color::opaqueColor): New method to return an opaque version of the given color.
1501         (WebCore::blend):
1502         * platform/graphics/Color.h:
1503         (WebCore::Color::isOpaque): New helper that is !hasAlpha().
1504         (WebCore::Color::isVisible): New helper.
1505         (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces
1506         a bunch of places that were calculating it manually each time. Meanwhile, we
1507         might consider always exposing the primaries as floats... or at least
1508         have that option.
1509         (WebCore::isBlackColor): New helper - it was used in a couple of places.
1510         (WebCore::isWhiteColor): Ditto.
1511         (WebCore::Color::hasAlpha): Deleted.
1512
1513         * platform/graphics/Gradient.cpp: Add FIXME.
1514         (WebCore::Gradient::addColorStop):
1515         * platform/graphics/Gradient.h:
1516
1517         * platform/graphics/GraphicsContext.cpp: Use new helpers.
1518         (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
1519         * platform/graphics/GraphicsContext.h:
1520         (WebCore::GraphicsContext::hasVisibleShadow):
1521
1522         * platform/graphics/Image.cpp: Ditto.
1523         (WebCore::Image::fillWithSolidColor):
1524
1525         * platform/graphics/ShadowBlur.cpp: Ditto.
1526         (WebCore::ShadowBlur::updateShadowBlurValues):
1527
1528         * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto.
1529         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
1530
1531         * platform/graphics/cg/GradientCG.cpp:
1532         (WebCore::Gradient::platformGradient): Add a FIXME to note that we can
1533         add ExtendedColor support simply by using CGColors, rather than fetching
1534         the components ourselves.
1535
1536         * platform/graphics/cg/GraphicsContextCG.cpp: New helpers.
1537         (WebCore::calculateDrawingMode):
1538
1539         * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers.
1540         (WebCore::FontCascade::drawGlyphs):
1541
1542         * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash().
1543         (WebCore::nsColor):
1544
1545         * platform/graphics/texmap/TextureMapperGL.cpp: New helpers.
1546         (WebCore::TextureMapperGL::drawBorder):
1547
1548         * rendering/BorderEdge.cpp: Ditto.
1549         (WebCore::BorderEdge::obscuresBackgroundEdge):
1550         (WebCore::BorderEdge::obscuresBackground):
1551
1552         * rendering/RenderBox.cpp: Ditto.
1553         (WebCore::RenderBox::getBackgroundPaintedExtent):
1554         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
1555         (WebCore::RenderBox::backgroundHasOpaqueTopLayer):
1556
1557         * rendering/RenderBoxModelObject.cpp: Ditto.
1558         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1559         (WebCore::colorNeedsAntiAliasAtCorner):
1560         (WebCore::willBeOverdrawn):
1561         (WebCore::RenderBoxModelObject::paintTranslucentBorderSides):
1562         (WebCore::RenderBoxModelObject::paintBorder):
1563         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
1564         (WebCore::RenderBoxModelObject::paintBoxShadow):
1565         * rendering/RenderElement.cpp:
1566         (WebCore::RenderElement::paintOutline):
1567         * rendering/RenderInline.cpp:
1568         (WebCore::RenderInline::paintOutline):
1569         * rendering/RenderLayerBacking.cpp:
1570         (WebCore::canCreateTiledImage):
1571         * rendering/RenderLayerCompositor.cpp:
1572         (WebCore::RenderLayerCompositor::viewHasTransparentBackground):
1573         * rendering/RenderMenuList.cpp:
1574         (RenderMenuList::getItemBackgroundColor):
1575         * rendering/RenderTheme.cpp:
1576         (WebCore::RenderTheme::disabledTextColor):
1577         * rendering/RenderView.cpp:
1578         (WebCore::RenderView::paintBoxDecorations):
1579         * rendering/TextDecorationPainter.cpp:
1580         (WebCore::TextDecorationPainter::paintTextDecoration):
1581         * rendering/TextPainter.cpp:
1582         (WebCore::TextPainter::paintTextWithShadows):
1583         * rendering/style/BorderValue.h:
1584         (WebCore::BorderValue::isTransparent):
1585         * rendering/style/RenderStyle.cpp:
1586         (WebCore::RenderStyle::visitedDependentColor):
1587         * rendering/style/RenderStyle.h:
1588         (WebCore::RenderStyle::hasBackground):
1589         * rendering/svg/RenderSVGResource.cpp:
1590         (WebCore::requestPaintingResource):
1591         * rendering/svg/SVGInlineTextBox.cpp:
1592         (WebCore::SVGInlineTextBox::paintSelectionBackground):
1593
1594         * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken.
1595         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
1596
1597 2016-11-09  Antoine Quint  <graouts@apple.com>
1598
1599         [Modern Media Controls] UI Library: StatusLabel
1600         https://bugs.webkit.org/show_bug.cgi?id=164544
1601         <rdar://problem/29179541>
1602
1603         Reviewed by Dean Jackson.
1604
1605         We add a new StatusLabel class to display a string of text in place of the TimeControl.
1606         A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast"
1607         test under the right media state.
1608
1609         Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html
1610                media/modern-media-controls/status-label/status-label.html
1611
1612         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1613         (.media-controls.mac.inline .time-label,):
1614         (.media-controls.mac.inline .time-label): Deleted.
1615         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1616         (MacOSInlineMediaControls.prototype.layout):
1617         * Modules/modern-media-controls/controls/media-controls.js:
1618         (MediaControls.):
1619         * Modules/modern-media-controls/controls/status-label.css: Added.
1620         (.status-label):
1621         * Modules/modern-media-controls/controls/status-label.js: Added.
1622         (StatusLabel.prototype.get text):
1623         (StatusLabel.prototype.set text):
1624         (StatusLabel.prototype.commitProperty):
1625         * Modules/modern-media-controls/js-files:
1626         * WebCore.xcodeproj/project.pbxproj:
1627
1628 2016-11-09  Chris Dumez  <cdumez@apple.com>
1629
1630         [Mac] Stop using deprecated AppKit enumeration values
1631         https://bugs.webkit.org/show_bug.cgi?id=164494
1632
1633         Reviewed by Darin Adler.
1634
1635         Stop using deprecated AppKit enumeration values.
1636
1637         * editing/cocoa/HTMLConverter.mm:
1638         (HTMLConverter::computedAttributesForElement):
1639         (HTMLConverter::_processElement):
1640         (HTMLConverter::_addMarkersToList):
1641         * page/mac/EventHandlerMac.mm:
1642         (WebCore::EventHandler::keyEvent):
1643         (WebCore::lastEventIsMouseUp):
1644         (WebCore::EventHandler::passSubframeEventToSubframe):
1645         (WebCore::EventHandler::widgetDidHandleWheelEvent):
1646         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
1647         * page/mac/TextIndicatorWindow.mm:
1648         (WebCore::TextIndicatorWindow::setTextIndicator):
1649         * platform/graphics/mac/IconMac.mm:
1650         (WebCore::Icon::paint):
1651         * platform/mac/CursorMac.mm:
1652         (WebCore::createCustomCursor):
1653         * platform/mac/DragImageMac.mm:
1654         (WebCore::dissolveDragImageToFraction):
1655         (WebCore::createDragImageFromImage):
1656         * platform/mac/EventLoopMac.mm:
1657         (WebCore::EventLoop::cycle):
1658         * platform/mac/PasteboardMac.mm:
1659         (WebCore::Pasteboard::setDragImage):
1660         * platform/mac/PlatformEventFactoryMac.mm:
1661         (WebCore::globalPointForEvent):
1662         (WebCore::pointForEvent):
1663         (WebCore::mouseButtonForEvent):
1664         (WebCore::mouseEventTypeForEvent):
1665         (WebCore::clickCountForEvent):
1666         (WebCore::isKeypadEvent):
1667         (WebCore::windowsKeyCodeForKeyEvent):
1668         (WebCore::isKeyUpEvent):
1669         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
1670         * platform/mac/ScrollbarThemeMac.mm:
1671         (WebCore::scrollbarControlSizeToNSControlSize):
1672         * platform/mac/ThemeMac.mm:
1673         (-[WebCoreThemeView window]):
1674         (WebCore::controlSizeForFont):
1675         (WebCore::controlSizeFromPixelSize):
1676         (WebCore::setUpButtonCell):
1677         (WebCore::stepperControlSizeForFont):
1678         (WebCore::paintStepper):
1679         (WebCore::ThemeMac::minimumControlSize):
1680         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
1681         (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
1682         (-[WebVideoFullscreenHUDWindow performKeyEquivalent:]):
1683         (-[WebVideoFullscreenHUDWindowController init]):
1684         (-[WebVideoFullscreenHUDWindowController keyDown:]):
1685         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
1686         * platform/mac/WebWindowAnimation.mm:
1687         (WebWindowAnimationDurationFromDuration):
1688         * rendering/RenderThemeMac.mm:
1689         (WebCore::RenderThemeMac::updateCachedSystemFontDescription):
1690         (WebCore::RenderThemeMac::controlSizeForFont):
1691         (WebCore::RenderThemeMac::controlSizeForCell):
1692         (WebCore::RenderThemeMac::controlSizeForSystemFont):
1693         (WebCore::RenderThemeMac::paintProgressBar):
1694         (WebCore::RenderThemeMac::popupMenuSize):
1695         (WebCore::RenderThemeMac::sliderThumbHorizontal):
1696         (WebCore::RenderThemeMac::sliderThumbVertical):
1697
1698 2016-11-08  Antoine Quint  <graouts@apple.com>
1699
1700         [Modern Media Controls] UI Library: iOS inline controls
1701         https://bugs.webkit.org/show_bug.cgi?id=164513
1702         <rdar://problem/27989475>
1703
1704         Reviewed by Dean Jackson.
1705
1706         We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls
1707         for inline playback on iOS.
1708
1709         Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html
1710                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html
1711                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
1712                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html
1713                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html
1714                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html
1715
1716         * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added.
1717         (.media-controls.ios.inline > .controls-bar):
1718         (.media-controls.ios.inline .time-control):
1719         (.media-controls.ios.inline button):
1720         (.media-controls.ios.inline button:active):
1721         (.media-controls.ios.inline > .controls-bar button):
1722         (.media-controls.ios.inline .buttons-container.right):
1723         (.media-controls.ios.inline button.play-pause):
1724         (.media-controls.ios.inline button.skip-back):
1725         (.media-controls.ios.inline .scrubber.slider):
1726         (.media-controls.ios.inline button.airplay):
1727         (.media-controls.ios.inline button.pip):
1728         (.media-controls.ios.inline button.fullscreen):
1729         (.media-controls.ios.inline .time-label):
1730         (.media-controls.ios.inline .scrubber.slider > .fill):
1731         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
1732         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added.
1733         (IOSInlineMediaControls.prototype.layout):
1734         (IOSInlineMediaControls):
1735         * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added.
1736         * Modules/modern-media-controls/js-files:
1737         * WebCore.xcodeproj/project.pbxproj:
1738
1739 2016-11-09  Beth Dakin  <bdakin@apple.com>
1740
1741         Support TouchBar in WebKit
1742         https://bugs.webkit.org/show_bug.cgi?id=164437
1743         -and corresponding-
1744         rdar://problem/28876524
1745
1746         Reviewed by Darin Adler.
1747
1748         * WebCore.xcodeproj/project.pbxproj:
1749         * platform/spi/cocoa/AVKitSPI.h:
1750         * platform/spi/cocoa/NSTouchBarSPI.h: Added.
1751         * platform/spi/mac/NSSpellCheckerSPI.h:
1752
1753 2016-11-09  Chris Dumez  <cdumez@apple.com>
1754
1755         Use Blob URL instead of webkit-fake-url when pasting an image
1756         https://bugs.webkit.org/show_bug.cgi?id=49141
1757
1758         Reviewed by Darin Adler.
1759
1760         Use Blob URL instead of webkit-fake-url when pasting an image.
1761
1762         Tests: editing/pasteboard/paste-image-as-blob-url.html
1763                editing/pasteboard/paste-image-using-image-data.html
1764
1765         * editing/Editor.h:
1766         * editing/mac/EditorMac.mm:
1767         (WebCore::Editor::WebContentReader::readImage):
1768         (WebCore::Editor::createFragmentForImageAndURL):
1769
1770 2016-11-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1771
1772         Fix error message when SQLite initialization fails
1773         https://bugs.webkit.org/show_bug.cgi?id=164462
1774
1775         Reviewed by Darin Adler.
1776
1777         * platform/sql/SQLiteDatabase.cpp:
1778         (WebCore::initializeSQLiteIfNecessary):
1779
1780 2016-11-08  Antoine Quint  <graouts@apple.com>
1781
1782         [Modern Media Controls] UI Library: macOS fullscreen controls
1783         https://bugs.webkit.org/show_bug.cgi?id=164414
1784         <rdar://problem/27989474>
1785
1786         Reviewed by Dean Jackson.
1787
1788         We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls
1789         for fullscreen playback on macOS. These controls can be dragged by the user.
1790
1791         Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html
1792                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html
1793                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html
1794                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html
1795                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html
1796                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
1797                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html
1798
1799         * Modules/modern-media-controls/controls/button.js:
1800         (Button.prototype.set enabled):
1801
1802             Correctly notify the layoutDelegate when the enabled property changes, regardless of whether
1803             the flag is on.
1804
1805         * Modules/modern-media-controls/controls/icon-button.js:
1806         (IconButton.prototype._updateImage):
1807         (IconButton):
1808
1809             Correctly notify the layout delegate when the image metrics have changed so that it may perform
1810             a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness.
1811
1812         * Modules/modern-media-controls/controls/icon-service.js:
1813         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
1814         (const.iconService.new.IconService):
1815
1816             Fix a typo.
1817
1818         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added.
1819         (.media-controls.mac.fullscreen > .controls-bar):
1820         (.media-controls.mac.fullscreen .volume.slider):
1821         (.media-controls.mac.fullscreen .buttons-container):
1822         (.media-controls.mac.fullscreen .buttons-container.center):
1823         (.media-controls.mac.fullscreen > .controls-bar button):
1824         (.media-controls.mac.fullscreen button.rewind):
1825         (.media-controls.mac.fullscreen button.play-pause):
1826         (.media-controls.mac.fullscreen button.forward):
1827         (.media-controls.mac.fullscreen .buttons-container.right):
1828         (.media-controls.mac.fullscreen button.airplay):
1829         (.media-controls.mac.fullscreen button.aspect-ratio):
1830         (.media-controls.mac.fullscreen button.pip):
1831         (.media-controls.mac.fullscreen button.tracks):
1832         (.media-controls.mac.fullscreen button.fullscreen):
1833         (.media-controls.mac.fullscreen .time-control):
1834         (.media-controls.mac.fullscreen .time-label):
1835         (.media-controls.mac.fullscreen .scrubber):
1836         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added.
1837         (MacOSFullscreenMediaControls.prototype.layout):
1838         (MacOSFullscreenMediaControls):
1839         * Modules/modern-media-controls/controls/macos-media-controls.js:
1840         (MacOSMediaControls):
1841         
1842             Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS
1843             so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit.
1844         
1845         * Modules/modern-media-controls/js-files:
1846         
1847             Add a reference to the new macos-fullscreen-media-controls.js file.
1848         
1849         * WebCore.xcodeproj/project.pbxproj:
1850
1851             Add references to the new macos-fullscreen-media-controls.js and
1852             macos-fullscreen-media-controls.css files.
1853
1854 2016-11-09  Chris Dumez  <cdumez@apple.com>
1855
1856         Shave 16 bytes off HTMLInputElement
1857         https://bugs.webkit.org/show_bug.cgi?id=164488
1858
1859         Reviewed by Sam Weinig.
1860
1861         Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members
1862         better.
1863
1864         * html/HTMLFormControlElement.h:
1865         * html/HTMLTextFormControlElement.cpp:
1866         (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
1867         * html/HTMLTextFormControlElement.h:
1868
1869 2016-11-09  Youenn Fablet  <youenn@apple.com>
1870
1871         [WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
1872         https://bugs.webkit.org/show_bug.cgi?id=164409
1873
1874         Reviewed by Eric Carlson.
1875
1876         Covered by existing tests.
1877
1878         Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate.
1879         Also refactored ICE candidate event generation (done at PeerConnectionBackend).
1880         Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend.
1881
1882         The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/.
1883         Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend.
1884         This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend.
1885
1886         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1887         (WebCore::MediaEndpointPeerConnection::createOfferTask):
1888         (WebCore::MediaEndpointPeerConnection::doCreateAnswer):
1889         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
1890         (WebCore::MediaEndpointPeerConnection::doSetLocalDescription):
1891         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
1892         (WebCore::MediaEndpointPeerConnection::doSetRemoteDescription):
1893         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
1894         (WebCore::MediaEndpointPeerConnection::doAddIceCandidate):
1895         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
1896         (WebCore::MediaEndpointPeerConnection::doStop):
1897         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
1898         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
1899         (WebCore::MediaEndpointPeerConnection::createAnswer): Deleted.
1900         (WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted.
1901         (WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted.
1902         (WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted.
1903         (WebCore::MediaEndpointPeerConnection::stop): Deleted.
1904         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted.
1905         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted.
1906         * Modules/mediastream/MediaEndpointPeerConnection.h:
1907         * Modules/mediastream/PeerConnectionBackend.cpp:
1908         (WebCore::PeerConnectionBackend::createOffer):
1909         (WebCore::PeerConnectionBackend::createOfferFailed):
1910         (WebCore::PeerConnectionBackend::createAnswer):
1911         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1912         (WebCore::PeerConnectionBackend::createAnswerFailed):
1913         (WebCore::isLocalDescriptionTypeValidForState):
1914         (WebCore::PeerConnectionBackend::setLocalDescription):
1915         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1916         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1917         (WebCore::isRemoteDescriptionTypeValidForState):
1918         (WebCore::PeerConnectionBackend::setRemoteDescription):
1919         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1920         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1921         (WebCore::PeerConnectionBackend::addIceCandidate):
1922         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1923         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1924         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
1925         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1926         (WebCore::PeerConnectionBackend::stop):
1927         * Modules/mediastream/PeerConnectionBackend.h:
1928
1929 2016-11-09  Eric Carlson  <eric.carlson@apple.com>
1930
1931         [MediaStream][Mac] Mark captured video frames as ready for display immediately
1932         https://bugs.webkit.org/show_bug.cgi?id=164482
1933         <rdar://problem/29139073>
1934
1935         Reviewed by Jer Noble.
1936
1937         * platform/cf/CoreMediaSoftLink.cpp: Add new constant.
1938         * platform/cf/CoreMediaSoftLink.h:
1939
1940         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1941         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1942         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData):
1943           New, ask register for a callback when the sample buffer display layer is ready
1944           for more media data.
1945         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change
1946           the sample timestamps, assume the caller has configured the sample correctly.
1947         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't
1948           drop frames when the display layer isn't ready.
1949         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData.
1950         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
1951         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted.
1952
1953         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1954         (WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard
1955           late video frames, we don't need them.
1956         (WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately
1957           attachment.
1958
1959 2016-11-09  Joanmarie Diggs  <jdiggs@igalia.com>
1960
1961         AX: [ATK] Wrong selected element at a given index in a list box (redux)
1962         https://bugs.webkit.org/show_bug.cgi?id=164430
1963
1964         Reviewed by Darin Adler.
1965
1966         This essentially undoes the implementation change resulting from r164577.
1967         As stated in the ATK documentation, atk_selection_ref_selection() takes
1968         "a gint specifying the index in the selection set. (e.g. the ith selection
1969         as opposed to the ith child)." r164577 deliberately modified that, causing
1970         atk_selection_ref_selection() to treat the index as if it were the position
1971         with respect to all of the children. There is different API in ATK, namely
1972         atk_object_ref_accessible_child(), when the ith child from the set of all
1973         children is sought.
1974
1975         Tests: accessibility/aria-listbox-no-selection.html
1976                accessibility/native-listbox-no-selection.html
1977
1978         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
1979         (optionFromSelection):
1980
1981 2016-11-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1982
1983         [EFL] Use libgcrypt instead of GnuTLS for CryptoDigest
1984         https://bugs.webkit.org/show_bug.cgi?id=164461
1985
1986         Reviewed by Michael Catanzaro.
1987
1988         As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well.
1989
1990         No new tests, no behavior change.
1991
1992         * PlatformEfl.cmake:
1993
1994 2016-11-09  Ryan Haddad  <ryanhaddad@apple.com>
1995
1996         Unreviewed, rolling out r208422.
1997
1998         Roll r208382 back in since it was not responsible for the API
1999         test failures seen on macOS.
2000
2001         Reverted changeset:
2002
2003         "Unreviewed, rolling out r208382."
2004         https://bugs.webkit.org/show_bug.cgi?id=164319
2005         http://trac.webkit.org/changeset/208422
2006
2007 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
2008
2009         One more URTBF after r208361.
2010
2011         * PlatformMac.cmake:
2012
2013 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
2014
2015         Typo fix after r162782
2016         https://bugs.webkit.org/show_bug.cgi?id=164473
2017
2018         Unreviewed trivial fix.
2019
2020         * platform/ThreadGlobalData.cpp:
2021
2022 2016-11-07  Ryan Haddad  <ryanhaddad@apple.com>
2023
2024         Unreviewed, rolling out r208382.
2025
2026         This change appears to have caused 3
2027         SerializedCryptoKeyWrapTest API tests to fail on macOS.
2028
2029         Reverted changeset:
2030
2031         "[Readable Streams API] Implement ByteStreamController
2032         error()"
2033         https://bugs.webkit.org/show_bug.cgi?id=164319
2034         http://trac.webkit.org/changeset/208382
2035
2036 2016-11-04  Filip Pizlo  <fpizlo@apple.com>
2037
2038         WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
2039         https://bugs.webkit.org/show_bug.cgi?id=152045
2040
2041         Reviewed by Andy Estes.
2042
2043         No new layout tests because no new behavior. The new WTF time classes have some unit tests
2044         in TestWebKitAPI.
2045
2046         * fileapi/ThreadableBlobRegistry.cpp:
2047         (WebCore::ThreadableBlobRegistry::blobSize):
2048         * platform/MainThreadSharedTimer.h:
2049         * platform/SharedTimer.h:
2050         * platform/ThreadTimers.cpp:
2051         (WebCore::ThreadTimers::updateSharedTimer):
2052         * platform/cf/MainThreadSharedTimerCF.cpp:
2053         (WebCore::MainThreadSharedTimer::setFireInterval):
2054         * platform/efl/MainThreadSharedTimerEfl.cpp:
2055         (WebCore::MainThreadSharedTimer::setFireInterval):
2056         * platform/glib/MainThreadSharedTimerGLib.cpp:
2057         (WebCore::MainThreadSharedTimer::setFireInterval):
2058         * platform/win/MainThreadSharedTimerWin.cpp:
2059         (WebCore::MainThreadSharedTimer::setFireInterval):
2060         * workers/WorkerRunLoop.cpp:
2061         (WebCore::WorkerRunLoop::runInMode):
2062
2063 2016-11-04  Zalan Bujtas  <zalan@apple.com>
2064
2065         RenderFlowThread state reset cleanup.
2066         https://bugs.webkit.org/show_bug.cgi?id=164426
2067
2068         Reviewed by Simon Fraser.
2069
2070         RenderFlowThread state reset is spread across several functions. This patch groups them
2071         together in RenderObject::resetFlowThreadState().
2072
2073         No change in functionality.
2074
2075         * rendering/RenderBlock.cpp:
2076         (WebCore::RenderBlock::removeLeftoverAnonymousBlock):
2077         (WebCore::RenderBlock::dropAnonymousBoxChild): This is now part of resetFlowThreadState() since resetFlowThreadState
2078         gets called even when NotifyChildren is false.
2079         * rendering/RenderElement.cpp:
2080         (WebCore::RenderElement::insertChildInternal): Initialize the thread state before we notify the child.
2081         (WebCore::RenderElement::removeChildInternal): Reset the state even when NotifyChildren is false.
2082         (WebCore::RenderElement::willBeRemovedFromTree): This code is moved to removeFromRenderFlowThread().
2083         (WebCore::RenderElement::removeFromRenderFlowThread):
2084         * rendering/RenderObject.cpp:
2085         (WebCore::RenderObject::initializeFlowThreadState): This is in transition for webkit.org/b/164428 (RenderFlowThread state initialization cleanup.)
2086         (WebCore::RenderObject::resetFlowThreadState):
2087         (WebCore::RenderObject::setParent): This was seemingly a random place to put flow state initialization. 
2088         (WebCore::RenderObject::willBeRemovedFromTree): resetFlowThreadState() takes care of it now.
2089         * rendering/RenderObject.h:
2090
2091 2016-11-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2092
2093         [DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById
2094         https://bugs.webkit.org/show_bug.cgi?id=164356
2095
2096         Reviewed by Filip Pizlo.
2097
2098         This patch implements DOMJIT::Signature annotation for getElementById.
2099         Since getElementById is also implemented in DocumentFragment, we implement
2100         the branchIfDocumentFragment/branchIfNotDocumentFragment for that.
2101
2102         In dromaeo, we have a test like this.
2103
2104         test( "getElementById", function(){
2105             for ( var i = 0; i < num * 30; i++ ) {
2106                 ret = document.getElementById("testA" + num).nodeType;
2107                 ret = document.getElementById("testB" + num).nodeType;
2108                 ret = document.getElementById("testC" + num).nodeType;
2109                 ret = document.getElementById("testD" + num).nodeType;
2110                 ret = document.getElementById("testE" + num).nodeType;
2111                 ret = document.getElementById("testF" + num).nodeType;
2112             }
2113         });
2114
2115         In the above test, JSC already knows the following things.
2116
2117         1. Since nodeType is now handled as CallDOMGetter, we know that it is pure.
2118         2. getElementById look up becomes PureGetById since document is impure object. But it is kept as PureGetById. So it does not write DOMState.
2119         3. `"testA" + num` will be converted to constant string.
2120         4. CallDOM for getElementById said it just reads(DOMState:DOM). And it saids that it returns the same value as long as DOMState is not clobbered.
2121         5. CheckCell leading CallDOM ensures the inlined getElementById node. (CallDOM node).
2122
2123         The key thing is that no node clobbers DOMState during the loop. So CallDOM & CallDOMGetter can be hoisted.
2124         This improves dom-query significantly. Dromaeo dom-query getElementById becomes 40x faster (247796 v.s. 6197).
2125         Dromaeo dom-query getElementById (not in document) becomes 89x faster (630317.8 v.s. 7066.).
2126
2127         Tests: js/dom/domjit-function-get-element-by-id-changed.html
2128                js/dom/domjit-function-get-element-by-id-licm.html
2129                js/dom/domjit-function-get-element-by-id.html
2130
2131         * dom/NonElementParentNode.idl:
2132         * domjit/DOMJITCheckDOM.h:
2133         (WebCore::DOMJIT::TypeChecker<DocumentFragment>::branchIfFail):
2134         * domjit/DOMJITHelpers.h:
2135         (WebCore::DOMJIT::branchIfDocumentFragment):
2136         (WebCore::DOMJIT::branchIfNotDocumentFragment):
2137
2138 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2139
2140         Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
2141         https://bugs.webkit.org/show_bug.cgi?id=164438
2142
2143         Reviewed by Tim Horton.
2144
2145         unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
2146         of confusion.
2147         
2148         Functions with "VisibleContent" in the name are usually expected to return document coordinates (affected by zooming),
2149         so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of "unscaled" vs "visibleContent", and
2150         "unobscured" vs "visible".
2151         
2152         So rename:
2153             unscaledUnobscuredVisibleContentSize -> sizeForUnobscuredContent
2154             unscaledVisibleContentSizeIncludingObscuredArea -> sizeForVisibleContent
2155         
2156         sizeForUnobscuredContent() can also be private to ScrollView.
2157
2158         * inspector/InspectorOverlay.cpp:
2159         (WebCore::InspectorOverlay::update):
2160         * platform/ScrollView.cpp:
2161         (WebCore::ScrollView::unobscuredContentRectInternal):
2162         (WebCore::ScrollView::sizeForVisibleContent):
2163         (WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
2164         before testing whether we have a platform widget.
2165         (WebCore::ScrollView::layoutSize):
2166         (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
2167         (WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
2168         * platform/ScrollView.h:
2169         * rendering/RenderBoxModelObject.cpp:
2170         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
2171         * rendering/RenderLayerCompositor.cpp:
2172         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2173         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
2174         (WebCore::RenderLayerCompositor::updateRootLayerPosition):
2175         (WebCore::RenderLayerCompositor::ensureRootLayer):
2176
2177 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2178
2179         Layout viewport wrong with RTL documents
2180         https://bugs.webkit.org/show_bug.cgi?id=164434
2181
2182         Reviewed by Tim Horton.
2183
2184         The layoutViewportRect was computed incorrectly in RTL documents, because 
2185         FrameView::unscaledMaximumScrollPosition() was wrong; it erroneously mapped
2186         what it thought was a scrollOffset to a scrollPosition.
2187
2188         Unscaled scroll positions are in the same coordinate space as unscaledDocumentRect,
2189         so we should not call scrollPositionFromOffset() in FrameView::unscaledMaximumScrollPosition().
2190
2191         Changed FrameView::unscaledMinimumScrollPosition() to also just grab the location of
2192         unscaledDocumentRect, for symmetry.
2193
2194         Finally fixed the tiled scrolling indicator's viewport rect for zoomed RTL documents
2195         by using the unscaled scroll origin.
2196
2197         Tests: fast/visual-viewport/rtl-nonzoomed-rects.html
2198                fast/visual-viewport/rtl-zoomed-rects.html
2199
2200         * page/FrameView.cpp:
2201         (WebCore::FrameView::setLayoutViewportOrigin):
2202         (WebCore::FrameView::unscaledScrollOrigin):
2203         (WebCore::FrameView::unscaledMinimumScrollPosition):
2204         (WebCore::FrameView::unscaledMaximumScrollPosition):
2205         * page/FrameView.h:
2206
2207 2016-11-04  Sam Weinig  <sam@webkit.org>
2208
2209         [WebIDL] Add support for modern callback syntax
2210         https://bugs.webkit.org/show_bug.cgi?id=164435
2211
2212         Reviewed by Chris Dumez.
2213
2214         Support new callback syntax:
2215             callback Function = void (DOMString arg1, long arg2);
2216
2217         This replaces "callback interface" types with a Callback=FunctionOnly
2218         extended attribute.
2219
2220         * Modules/geolocation/PositionCallback.idl:
2221         * Modules/geolocation/PositionErrorCallback.idl:
2222         * Modules/notifications/NotificationPermissionCallback.idl:
2223         * Modules/quota/StorageErrorCallback.idl:
2224         * Modules/quota/StorageQuotaCallback.idl:
2225         * Modules/quota/StorageUsageCallback.idl:
2226         * Modules/webaudio/AudioBufferCallback.idl:
2227         * Modules/webdatabase/DatabaseCallback.idl:
2228         * Modules/webdatabase/SQLStatementCallback.idl:
2229         * Modules/webdatabase/SQLStatementErrorCallback.idl:
2230         * Modules/webdatabase/SQLTransactionCallback.idl:
2231         * Modules/webdatabase/SQLTransactionErrorCallback.idl:
2232         * dom/RequestAnimationFrameCallback.idl:
2233         * dom/StringCallback.idl:
2234         * html/VoidCallback.idl:
2235         * page/IntersectionObserverCallback.idl:
2236         * css/MediaQueryListListener.idl:
2237         Update to new syntax.
2238
2239         * css/MediaQueryListListener.h:
2240         * css/MediaQueryMatcher.cpp:
2241         (WebCore::MediaQueryMatcher::styleResolverChanged):
2242         Switch to using the now required 'handleEvent' name. This is an implementation detail
2243         that we should change.
2244
2245         * bindings/scripts/CodeGenerator.pm:
2246         Update document processing to allow a callback only file. Update callback
2247         type checks to look for a regex that matches in the new format.
2248
2249         * bindings/scripts/CodeGeneratorJS.pm:
2250         (AddToImplIncludesForIDLType):
2251         (AddToIncludesForIDLType):
2252         (AddToImplIncludes):
2253         (AddToIncludes):
2254         Abstract includes functions to allow passing in an include hash.
2255
2256         (GenerateCallbackFunctionHeader):
2257         (GenerateCallbackFunctionImplementation):
2258         (GenerateCallbackInterfaceHeader):
2259         (GenerateCallbackInterfaceImplementation):
2260         (GenerateCallbackHeaderContent):
2261         (GenerateCallbackImplementationContent):
2262         Refactor callback generation code into GenerateCallbackHeaderContent and GenerateCallbackImplementationContent
2263         to allow using it for both the new callbacks as well as the old callback interfaces.
2264
2265         * bindings/scripts/IDLParser.pm:
2266         (Parse):
2267         (applyTypedefs):
2268         (applyTypedefsToOperation):
2269         (parseCallbackRest):
2270         Parse callbacks into the new IDLCallbackFunction type. Ensure that typedefs are applied as well.
2271
2272         * bindings/scripts/IDLAttributes.txt:
2273         Remove support for Callback=FunctionOnly.
2274
2275         * bindings/scripts/test/JS/JSTestCallback.cpp: Removed.
2276         * bindings/scripts/test/JS/JSTestCallback.h: Removed.
2277         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2278         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
2279         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: Added.
2280         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: Added.
2281         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp.
2282         * bindings/scripts/test/JS/JSTestCallbackInterface.h: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h.
2283         * bindings/scripts/test/JS/JSTestObj.cpp:
2284         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2285         * bindings/scripts/test/TestCallback.idl: Removed.
2286         * bindings/scripts/test/TestCallbackFunction.idl:
2287         * bindings/scripts/test/TestCallbackFunctionWithTypedefs.idl: Added.
2288         * bindings/scripts/test/TestCallbackInterface.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallback.idl.
2289         * bindings/scripts/test/TestObj.idl:
2290         * bindings/scripts/test/TestTypedefs.idl:
2291         Update existing tests and add new ones to test callback functions specifically.
2292
2293 2016-11-04  Alex Christensen  <achristensen@webkit.org>
2294
2295         Move isDefaultPortForProtocol from URLParser.cpp back to URL.cpp
2296         https://bugs.webkit.org/show_bug.cgi?id=164439
2297
2298         Reviewed by Daniel Bates.
2299
2300         No change in behaviour.
2301
2302         * platform/URL.cpp:
2303         (WebCore::defaultPortForProtocol):
2304         (WebCore::isDefaultPortForProtocol):
2305         * platform/URLParser.cpp:
2306         (WebCore::URLParser::defaultPortForProtocol):
2307         (WebCore::URLParser::parsePort):
2308         (WebCore::defaultPortForProtocol): Deleted.
2309         (WebCore::isDefaultPortForProtocol): Deleted.
2310         * platform/URLParser.h:
2311
2312 2016-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2313
2314         Safari does not emit composition end if blurred for dead key / Japanese IME
2315         https://bugs.webkit.org/show_bug.cgi?id=164369
2316         <rdar://problem/29050439>
2317
2318         Reviewed by Ryosuke Niwa.
2319
2320         On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
2321         This is because the focused element may have changed after performing the selection change, so we would
2322         otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
2323         of the element with the composition.
2324
2325         Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
2326         clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
2327         calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
2328         accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
2329         that discards the marked text, and then updates the editor state. This patch splits this into two separate
2330         steps -- see the WebKit2 ChangeLog for more details.
2331
2332         Test: fast/events/ime-compositionend-on-selection-change.html
2333
2334         * editing/Editor.cpp:
2335         (WebCore::Editor::selectionWillChange):
2336         * editing/Editor.h:
2337         * editing/FrameSelection.cpp:
2338         (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
2339         * editing/mac/EditorMac.mm:
2340         (WebCore::Editor::selectionWillChange):
2341         * loader/EmptyClients.h:
2342         * page/EditorClient.h:
2343
2344 2016-11-04  Brady Eidson  <beidson@apple.com>
2345
2346         IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.
2347         https://bugs.webkit.org/show_bug.cgi?id=164424
2348
2349         Reviewed by Alex Christensen.
2350
2351         No new tests (Covered by existing tests).
2352
2353         This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the
2354         spec in flux/under discussion.
2355
2356         We'll update either source or the tests as things are resolved.
2357
2358         * Modules/indexeddb/IDBIndex.cpp:
2359         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
2360
2361         * Modules/indexeddb/IDBObjectStore.cpp:
2362         (WebCore::IDBObjectStore::get):
2363         (WebCore::IDBObjectStore::putOrAdd):
2364         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2365
2366 2016-11-04  Ryosuke Niwa  <rniwa@webkit.org>
2367
2368         Load stylesheets in link elements inside a connected shadow tree
2369         https://bugs.webkit.org/show_bug.cgi?id=160683
2370         <rdar://problem/29040652>
2371
2372         Reviewed by Antti Koivisto.
2373
2374         Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement
2375         when it's connected to a document instead of always talking to document's style scope.
2376
2377         Tests: fast/shadow-dom/link-element-in-shadow-tree.html
2378                fast/shadow-dom/selected-stylesheet-in-shadow-tree.html
2379
2380        * html/HTMLLinkElement.cpp:
2381        (WebCore::HTMLLinkElement::HTMLLinkElement):
2382        (WebCore::HTMLLinkElement::~HTMLLinkElement):
2383        (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking
2384        didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits
2385        early when inDocument() is false.
2386        (WebCore::HTMLLinkElement::parseAttribute):
2387        (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree.
2388        (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to
2389        a document instead of whenever its self-inclusive ancestor is inserted into a container.
2390        (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after
2391        calling removePendingSheet since the latter depends on m_styleScope being not null.
2392        (WebCore::HTMLLinkElement::addPendingSheet):
2393        (WebCore::HTMLLinkElement::removePendingSheet):
2394        * html/HTMLLinkElement.h:
2395        * html/HTMLStyleElement.cpp:
2396        (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this
2397        element has just become connected to a document.
2398        (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal.
2399        * style/StyleScope.h:
2400        * svg/SVGStyleElement.cpp:
2401        (WebCore::SVGStyleElement::insertedInto): Ditto.
2402        (WebCore::SVGStyleElement::removedFrom): Ditto for the removal.
2403
2404 2016-11-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
2405
2406         Add a setting and preferences to enable/disable async image decoding
2407         https://bugs.webkit.org/show_bug.cgi?id=164417
2408
2409         Reviewed by Simon Fraser.
2410
2411         Add an asyncImageDecodingEnabled setting. This setting controls whether an
2412         image "can" be asynchronously decoded on a separate thread or not. The
2413         function ImageSource::isAsyncDecodingRequired() will be used in conjunction
2414         with this setting to decide whether an image "should" be asynchronously
2415         decoded or not.
2416
2417         * page/Settings.in:
2418
2419 2016-11-04  Tim Horton  <timothy_horton@apple.com>
2420
2421         Apply post-landing review comments for r208347
2422
2423         * dom/Element.cpp:
2424         (WebCore::Element::findAnchorElementForLink):
2425         Use attributeWithoutSynchronization.
2426
2427         * page/PrintContext.cpp:
2428         (WebCore::PrintContext::spoolPage):
2429         (WebCore::PrintContext::spoolRect):
2430         (WebCore::PrintContext::collectLinkedDestinations):
2431         (WebCore::PrintContext::outputLinkedDestinations):
2432         * page/PrintContext.h:
2433         Pass Document by reference instead of Node by pointer,
2434         use ElementTraversal instead of NodeTraversal to avoid
2435         having to locally check the type, and null-check renderers.
2436
2437 2016-11-04  Myles C. Maxfield  <mmaxfield@apple.com>
2438
2439         Implement WebGL2RenderingContext::copyBufferSubData()
2440         https://bugs.webkit.org/show_bug.cgi?id=164008
2441
2442         Reviewed by Dean Jackson.
2443
2444         Similar to previous work regarding WebGL 2 buffers, this method implements
2445         the ability to copy from one buffer to another without the data leaving
2446         the GPU.
2447
2448         Test: fast/canvas/webgl/copyBufferSubData.html
2449
2450         * html/canvas/WebGL2RenderingContext.cpp:
2451         (WebCore::WebGL2RenderingContext::copyBufferSubData):
2452         * html/canvas/WebGLBuffer.cpp:
2453         (WebCore::WebGLBuffer::associateCopyBufferSubData):
2454         * html/canvas/WebGLBuffer.h:
2455         * platform/graphics/GraphicsContext3D.h:
2456         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2457         (WebCore::GraphicsContext3D::copyBufferSubData):
2458
2459 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2460
2461         Rename some ScrollingTree/Node-related functions to reduce the number of uses of "update"
2462         https://bugs.webkit.org/show_bug.cgi?id=164420
2463
2464         Reviewed by Tim Horton.
2465
2466         Rename:
2467             commitNewTreeState -> commitTreeState ("new" was redundant)
2468             updateBeforeChildren -> commitStateBeforeChildren
2469             updateAfterChildren -> commitStateAfterChildren
2470
2471         * page/scrolling/ScrollingTree.cpp:
2472         (WebCore::ScrollingTree::commitTreeState):
2473         (WebCore::ScrollingTree::updateTreeFromStateNode):
2474         (WebCore::ScrollingTree::commitNewTreeState): Deleted.
2475         * page/scrolling/ScrollingTree.h:
2476         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2477         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
2478         (WebCore::ScrollingTreeFrameScrollingNode::updateBeforeChildren): Deleted.
2479         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2480         * page/scrolling/ScrollingTreeNode.h:
2481         (WebCore::ScrollingTreeNode::commitStateAfterChildren):
2482         (WebCore::ScrollingTreeNode::updateAfterChildren): Deleted.
2483         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2484         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
2485         (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
2486         (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Deleted.
2487         (WebCore::ScrollingTreeScrollingNode::updateAfterChildren): Deleted.
2488         * page/scrolling/ScrollingTreeScrollingNode.h:
2489         * page/scrolling/ThreadedScrollingTree.cpp:
2490         (WebCore::ThreadedScrollingTree::commitTreeState):
2491         (WebCore::ThreadedScrollingTree::commitNewTreeState): Deleted.
2492         * page/scrolling/ThreadedScrollingTree.h:
2493         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
2494         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2495         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
2496         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateAfterChildren):
2497         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateBeforeChildren): Deleted.
2498         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateAfterChildren): Deleted.
2499         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2500         (WebCore::ScrollingTreeIOS::commitNewTreeState): Deleted.
2501         * page/scrolling/ios/ScrollingTreeIOS.h:
2502         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2503         (WebCore::ScrollingCoordinatorMac::commitTreeState):
2504         * page/scrolling/mac/ScrollingTreeFixedNode.h:
2505         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2506         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
2507         (WebCore::ScrollingTreeFixedNode::updateBeforeChildren): Deleted.
2508         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2509         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2510         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2511         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
2512         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Deleted.
2513         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateAfterChildren): Deleted.
2514         * page/scrolling/mac/ScrollingTreeStickyNode.h:
2515         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
2516         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
2517         (WebCore::ScrollingTreeStickyNode::updateBeforeChildren): Deleted.
2518
2519 2016-11-03  Anders Carlsson  <andersca@apple.com>
2520
2521         Add new 'other' Apple Pay button style
2522         https://bugs.webkit.org/show_bug.cgi?id=164384
2523         rdar://problem/28302528
2524
2525         Reviewed by Dean Jackson.
2526
2527         * DerivedSources.make:
2528         * WebCorePrefix.h:
2529         Add extension points.
2530
2531         * css/CSSPrimitiveValueMappings.h:
2532         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2533         Add ApplePayButtonType::Other.
2534
2535         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
2536         Add CSSValueOther.
2537
2538         * css/CSSValueKeywords.in:
2539         Add other.
2540
2541         * css/parser/CSSParser.cpp:
2542         (WebCore::isValidKeywordPropertyAndValue):
2543         Add CSSValueOther.
2544
2545         * css/parser/CSSParserFastPaths.cpp:
2546         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2547         Add CSSValueOther.
2548
2549         * rendering/RenderThemeCocoa.mm:
2550         (WebCore::toPKPaymentButtonType):
2551         Handle ApplePayButtonType::Other.
2552
2553         * rendering/style/RenderStyleConstants.h:
2554         Add ApplePayButtonType::Other.
2555
2556 2016-11-04  Antti Koivisto  <antti@apple.com>
2557
2558         slotted() pseudo does not work with ID selector
2559         https://bugs.webkit.org/show_bug.cgi?id=160538
2560         <rdar://problem/28534529>
2561
2562         Reviewed by Andreas Kling.
2563
2564         When we saw an id selector while addin rules we immediately threw it into the m_idRules
2565         optimization bucket and bailed out. However selectors containing ::slotted must always end
2566         up in m_slottedPseudoElementRules list no matter what else is there.
2567
2568         Fix by treating id like other selectors and only choosing the bucket after analysing all
2569         the selector components.
2570
2571         Test: fast/shadow-dom/css-scoping-slot-with-id.html
2572
2573         * css/RuleSet.cpp:
2574         (WebCore::RuleSet::addRule): Also made this use switch instead of a series of ifs.
2575
2576 2016-11-04  Brady Eidson  <beidson@apple.com>
2577
2578         IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
2579         https://bugs.webkit.org/show_bug.cgi?id=164416
2580
2581         Reviewed by Beth Dakin.
2582
2583         No new tests (Covered by existing tests).
2584
2585         * Modules/indexeddb/IDBObjectStore.cpp:
2586         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2587
2588 2016-11-04  Keith Rollin  <krollin@apple.com>
2589
2590         NetworkSession: Add NetworkDataTask implementation for blobs
2591         https://bugs.webkit.org/show_bug.cgi?id=163939
2592
2593         Reviewed by Alex Christensen.
2594
2595         * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
2596         * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
2597         * platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
2598         * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
2599         * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().
2600
2601 2016-11-04  Brady Eidson  <beidson@apple.com>
2602
2603         IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
2604         https://bugs.webkit.org/show_bug.cgi?id=164406
2605
2606         Reviewed by Alex Christensen.
2607
2608         No new tests (Covered by existing tests).
2609
2610         * Modules/indexeddb/IDBIndex.cpp:
2611         (WebCore::IDBIndex::setName):
2612
2613         * Modules/indexeddb/IDBObjectStore.cpp:
2614         (WebCore::IDBObjectStore::setName):
2615
2616 2016-11-04  Joanmarie Diggs  <jdiggs@igalia.com>
2617
2618         AX: [ATK] Attempting to clear selection on ARIA listboxes results in crash
2619         https://bugs.webkit.org/show_bug.cgi?id=164331
2620
2621         Reviewed by Chris Fleizach.
2622
2623         The ATK code is using is<AccessibilityListBox>() to identify native listboxes.
2624         But is<AccessibilityListBox>() returns the value of isListBox() which returns
2625         true both for AccessibilityListBox instances as well as for AccessibilityObject
2626         instances which have an AccessibilityRole value of ListBoxRole. Because only
2627         native listboxes should be AccessibilityListBoxes, add isNativeListBox() so
2628         that we can distinguish native and ARIA listboxes.
2629
2630         Tests: accessibility/aria-listbox-clear-selection-crash.html
2631                accessibility/listbox-clear-selection.html
2632
2633         * accessibility/AccessibilityListBox.h:
2634         * accessibility/AccessibilityObject.h:
2635         (WebCore::AccessibilityObject::isNativeListBox):
2636         (WebCore::AccessibilityObject::isListBox):
2637
2638 2016-11-04  Brady Eidson  <beidson@apple.com>
2639
2640         IndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming.
2641         https://bugs.webkit.org/show_bug.cgi?id=164405
2642
2643         Reviewed by Alex Christensen.
2644
2645         No new tests (Covered by existing tests).
2646
2647         * Modules/indexeddb/IDBIndex.cpp:
2648         (WebCore::IDBIndex::setName):
2649
2650         * Modules/indexeddb/IDBObjectStore.cpp:
2651         (WebCore::IDBObjectStore::setName):
2652
2653 2016-11-04  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2654
2655         [Readable Streams API] Implement ByteStreamController error()
2656         https://bugs.webkit.org/show_bug.cgi?id=164319
2657
2658         Reviewed by Youenn Fablet.
2659
2660         Implemented error() method of ReadableByteStreamController.
2661
2662         Updated test expectations for error() and added IDL-related tests.
2663
2664         * Modules/streams/ReadableByteStreamController.js:
2665         (error): Implemented.
2666         * Modules/streams/ReadableByteStreamInternals.js:
2667         (privateInitializeReadableByteStreamController):
2668         (isReadableByteStreamController): Added.
2669         (readableByteStreamControllerError): Added.
2670         (readableByteStreamControllerClearPendingPullIntos): Added.
2671         * Modules/streams/ReadableStream.js:
2672         (initializeReadableStream): More detailed error message.
2673         * Modules/streams/ReadableStreamDefaultController.js:
2674         (error): Removed unnecessary variable declaration.
2675         * bindings/js/WebCoreBuiltinNames.h: Added totalQueuedBytes.
2676
2677 2016-11-03  Brady Eidson  <beidson@apple.com>
2678
2679         IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
2680         https://bugs.webkit.org/show_bug.cgi?id=164403
2681
2682         Reviewed by Alex Christensen.
2683
2684         No new tests (Covered by existing test).
2685
2686         * Modules/indexeddb/IDBIndex.cpp:
2687         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
2688           already existed before this version change transaction.
2689
2690 2016-11-03  Youenn Fablet  <youenn@apple.com>
2691
2692         [WebRTC] Introduce asynchronous backend createOffer API
2693         https://bugs.webkit.org/show_bug.cgi?id=164365
2694
2695         Reviewed by Sam Weinig.
2696
2697         Covered by existing tests.
2698
2699         Removing PeerEndpointBackendClient as it is only RTCPeerConnection.
2700         This allows removing virtual for some functions.
2701
2702         Moving MediaEndpointPeerClient::m_client to PeerEndpointBackendClient::m_peerConnection and making it a reference.
2703
2704         Implementing createOffer at PeerConnectionBackend by splitting it in four sub-functions:
2705         - main createOffer, implemented at PeerConnectionBackend.
2706         - doCreateOffer implemented by subclasses (MediaEndpointPeerConnection).
2707         - createOfferSucceeded/createOfferFailed implemented by PeerConnectionBackend.
2708
2709         * CMakeLists.txt:
2710         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2711         (WebCore::createMediaEndpointPeerConnection):
2712         (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
2713         (WebCore::MediaEndpointPeerConnection::doCreateOffer):
2714         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2715         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
2716         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2717         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2718         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
2719         (WebCore::MediaEndpointPeerConnection::createReceiver):
2720         (WebCore::MediaEndpointPeerConnection::replaceTrack):
2721         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
2722         (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
2723         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState):
2724         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState):
2725         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
2726         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
2727         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
2728         (WebCore::MediaEndpointPeerConnection::createOffer): Deleted.
2729         * Modules/mediastream/MediaEndpointPeerConnection.h:
2730         * Modules/mediastream/PeerConnectionBackend.cpp:
2731         (WebCore::PeerConnectionBackend::createOffer):
2732         (WebCore::PeerConnectionBackend::createOfferSucceeded):
2733         (WebCore::PeerConnectionBackend::createOfferFailed):
2734         (WebCore::createPeerConnectionBackend): Deleted.
2735         * Modules/mediastream/PeerConnectionBackend.h:
2736         (WebCore::PeerConnectionBackend::PeerConnectionBackend):
2737         (WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient): Deleted.
2738         * Modules/mediastream/RTCPeerConnection.cpp:
2739         (WebCore::RTCPeerConnection::RTCPeerConnection):
2740         * Modules/mediastream/RTCPeerConnection.h:
2741         * WebCore.xcodeproj/project.pbxproj:
2742
2743 2016-11-03  Antti Koivisto  <antti@apple.com>
2744
2745         REGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style::Scope::flushPendingUpdate + 16
2746         https://bugs.webkit.org/show_bug.cgi?id=164397
2747         <rdar://problem/29100135>
2748
2749         Reviewed by Ryosuke Niwa.
2750
2751         The problem here was that we were leaving stale pointers to Document::m_inDocumentShadowRoots set when
2752         using fast-path document teardown.
2753
2754         (Patch and stories mostly by rniwa).
2755
2756         * dom/Document.cpp:
2757         (WebCore::Document::~Document):
2758         (WebCore::Document::didInsertInDocumentShadowRoot):
2759         (WebCore::Document::didRemoveInDocumentShadowRoot):
2760
2761             Improve asserts.
2762
2763         * dom/Element.cpp:
2764         (WebCore::Element::removeShadowRoot):
2765
2766             Remove the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to
2767             avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that
2768             ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer()
2769             since the latter function tears down nodes via the deletion queue during a document destruction and use
2770             notifyChildNodeRemoved() on nodes that outlive the shadow root.
2771
2772         * dom/ShadowRoot.cpp:
2773         (WebCore::ShadowRoot::~ShadowRoot):
2774
2775             Take care to clean up inDocumentShadowRoots for fast-pathed destruction too.
2776
2777         (WebCore::ShadowRoot::insertedInto):
2778         (WebCore::ShadowRoot::removedFrom):
2779
2780             Improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from
2781             m_inDocumentShadowRoots when the connected-ness changes.
2782
2783 2016-11-03  Simon Fraser  <simon.fraser@apple.com>
2784
2785         Give all the geometry classes a single-argument scale() function for consistency
2786         https://bugs.webkit.org/show_bug.cgi?id=164400
2787
2788         Reviewed by Zalan Bujtas.
2789
2790         Add single-argument scale() to FloatPoint, FloatQuad, FloatSize and LayoutPoint, as well
2791         as adding one to GraphicsContext. Switch callers who passed the same value for sx and sy
2792         to the new functions.
2793
2794         * dom/Document.cpp:
2795         (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale):
2796         * dom/MouseRelatedEvent.cpp:
2797         (WebCore::MouseRelatedEvent::init):
2798         (WebCore::MouseRelatedEvent::computeRelativePosition):
2799         * dom/TreeScope.cpp:
2800         (WebCore::TreeScope::nodeFromPoint):
2801         * page/PrintContext.cpp:
2802         (WebCore::PrintContext::spoolPage):
2803         * platform/cocoa/ThemeCocoa.mm:
2804         (WebCore::fitContextToBox):
2805         * platform/graphics/FloatPoint.h:
2806         (WebCore::FloatPoint::scale):
2807         * platform/graphics/FloatQuad.h:
2808         (WebCore::FloatQuad::scale):
2809         * platform/graphics/FloatSize.h:
2810         (WebCore::FloatSize::scale):
2811         * platform/graphics/GraphicsContext.cpp:
2812         (WebCore::GraphicsContext::applyDeviceScaleFactor):
2813         * platform/graphics/GraphicsContext.h:
2814         (WebCore::GraphicsContext::scale):
2815         * platform/graphics/LayoutPoint.h:
2816         (WebCore::LayoutPoint::scale):
2817         * platform/graphics/ca/TileCoverageMap.cpp:
2818         (WebCore::TileCoverageMap::update):
2819         * platform/graphics/ca/TileGrid.cpp:
2820         (WebCore::TileGrid::platformCALayerPaintContents):
2821         * platform/graphics/cg/ImageBufferCG.cpp:
2822         (WebCore::ImageBuffer::drawConsuming):
2823         (WebCore::ImageBuffer::draw):
2824         (WebCore::ImageBuffer::drawPattern):
2825         * platform/mac/ThemeMac.mm:
2826         (WebCore::paintToggleButton):
2827         (WebCore::paintButton):
2828         (WebCore::paintStepper):
2829         * rendering/RenderImage.cpp:
2830         (WebCore::RenderImage::nodeAtPoint):
2831         * rendering/RenderMediaControls.cpp:
2832         (WebCore::getUnzoomedRectAndAdjustCurrentContext):
2833         * rendering/RenderThemeMac.mm:
2834         (WebCore::RenderThemeMac::paintMenuList):
2835         (WebCore::RenderThemeMac::paintSliderThumb):
2836         (WebCore::RenderThemeMac::paintSearchField):
2837         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
2838         (WebCore::RenderThemeMac::paintSearchFieldResultsButton):
2839         * rendering/svg/SVGInlineTextBox.cpp:
2840         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
2841         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
2842         (WebCore::SVGInlineTextBox::paintTextWithShadows):
2843         * svg/SVGPathBlender.cpp:
2844         (WebCore::SVGPathBlender::blendAnimatedFloatPoint):
2845         (WebCore::SVGPathBlender::blendArcToSegment):
2846         * svg/SVGPathParser.cpp:
2847         (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment):
2848         (WebCore::SVGPathParser::parseCurveToQuadraticSegment):
2849         (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment):
2850         (WebCore::SVGPathParser::decomposeArcToCubic):
2851         * svg/SVGSVGElement.cpp:
2852         (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
2853
2854 2016-11-03  Antti Koivisto  <antti@apple.com>
2855
2856         REGRESSION (r207669): Crash under media controls shadow root construction
2857         https://bugs.webkit.org/show_bug.cgi?id=164381
2858         <rdar://problem/28935401>
2859
2860         Reviewed by Simon Fraser.
2861
2862         The problem is that we are running a script for media control UA shadow tree in HTMLMediaElement::insertedInto.
2863         It is not safe to run scripts in insertedInto as the tree is in inconsistent state. Instead finishedInsertingSubtree
2864         callback should be used.
2865
2866         Test: media/media-controls-shadow-construction-crash.html
2867
2868         Seen on https://www.theguardian.com/artanddesign/video/2013/oct/14/banksy-central-park-new-york-video
2869
2870         * html/HTMLMediaElement.cpp:
2871         (WebCore::HTMLMediaElement::insertedInto):
2872         (WebCore::HTMLMediaElement::finishedInsertingSubtree):
2873
2874             Move configureMediaControls() to finishedInsertingSubtree().
2875
2876         * html/HTMLMediaElement.h:
2877         * style/StyleTreeResolver.cpp:
2878         (WebCore::Style::TreeResolver::resolveComposedTree):
2879
2880             Add an assert to make the bad state easier to hit in tests.
2881
2882 2016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2883
2884         Add an assertion to diagnose stress GC bots test failures
2885         https://bugs.webkit.org/show_bug.cgi?id=164396
2886
2887         Reviewed by Antti Koivisto.
2888
2889         Added an assertion for calling ElementQueue::add while ElementQueue::invokeAll is in progress.
2890         This should never happen as long as all DOM API has an appropriate CEReactions IDL attribute.
2891
2892         * dom/CustomElementReactionQueue.cpp:
2893         (WebCore::CustomElementReactionStack::ElementQueue::add):
2894         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
2895         * dom/CustomElementReactionQueue.h:
2896
2897 2016-11-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
2898
2899         Add the asynchronous image decoding mode
2900         https://bugs.webkit.org/show_bug.cgi?id=155546
2901
2902         Reviewed by Simon Fraser.
2903
2904         The asynchronous image decoding feature targets enhancing the rendering
2905         in two scenarios: the animated images and scrolling a page which large
2906         images. Enabling this feature for these two scenarios will be landed
2907         separately. 
2908
2909         The goal of the asynchronous image decoding is to have the decoded image
2910         frame ready before it has to be drawn. Drawing an image does not have to
2911         wait the image frame to be decoded.
2912
2913         * platform/graphics/BitmapImage.cpp:
2914         (WebCore::BitmapImage::frameImageAtIndex): Use the negation of frameHasValidNativeImageAtIndex().
2915         * platform/graphics/BitmapImage.h:
2916         (WebCore::BitmapImage::frameIsBeingDecodedAtIndex): Answers whether a frame is being decoded.
2917         (WebCore::BitmapImage::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2918         (WebCore::BitmapImage::frameHasInvalidNativeImageAtIndex): Deleted.
2919         * platform/graphics/Image.h:
2920         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Notifies the image with the availability of a frame NativeImage.
2921         * platform/graphics/ImageFrame.h:
2922         (WebCore::ImageFrame::isBeingDecoded): Answers whether the frame is being decoded.
2923         (WebCore::ImageFrame::hasValidNativeImage): Checks the validity of the frame.
2924         (WebCore::ImageFrame::hasInvalidNativeImage): Deleted.
2925         * platform/graphics/ImageFrameCache.cpp:
2926         (WebCore::ImageFrameCache::~ImageFrameCache): Asserts the decoding loop was ended before deleting the ImageFrameCache.
2927         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Rename this function to matches the other which take the frame index.
2928         (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Ditto.
2929         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): It setts the ImageFrame's members and updates the decoded size.
2930         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Replaces the frame NativeImage and notifies the Image with the new frame.
2931         (WebCore::ImageFrameCache::decodingQueue): Ensures the decoding WorkQueue is created and returns it.
2932         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Starts a decoding WorkQueue which loops until m_frameRequestQueue is closed.
2933         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Allows ImageSource to send a request to start asynchronous frame image decoding.
2934         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Stops the decoding WorkQueue by closing m_frameRequestQueue.
2935         (WebCore::ImageFrameCache::frameAtIndex): Call replaceFrameNativeImageAtIndex().
2936         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Returns true if a request for the image frame is issued but not finished yet.
2937         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2938         (WebCore::ImageFrameCache::setFrameNativeImage): Deleted. Was renamed to be setFrameNativeImageAtIndex.
2939         (WebCore::ImageFrameCache::setFrameMetadata): Deleted. Was renamed to be setFrameMetadataAtIndex
2940         (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
2941         * platform/graphics/ImageFrameCache.h:
2942         (WebCore::ImageFrameCache::create): The decoding queue needs to hold a reference to this class so it can stop decoding safely without blocking.
2943         (WebCore::ImageFrameCache::hasDecodingQueue): Returns true if a decoding queue has started.
2944         * platform/graphics/ImageSource.cpp:
2945         (WebCore::ImageSource::ImageSource): Call ImageFrameCache::create().
2946         (WebCore::ImageSource::clear): Deleting the decoder is unnecessary for asynchronous decoding because ImageFrameCache manages all the memory.
2947         
2948         (WebCore::ImageSource::destroyDecodedData):
2949         (WebCore::ImageSource::destroyDecodedDataIfNecessary):
2950         (WebCore::ImageSource::ensureDecoderAvailable):
2951         (WebCore::ImageSource::dataChanged):
2952         (WebCore::ImageSource::isAllDataReceived):
2953         (WebCore::ImageSource::isAsyncDecodingRequired): Answers the question whether the async image decoding is required for this ImageSource.
2954         (WebCore::ImageSource::frameImageAtIndex):
2955         * platform/graphics/ImageSource.h:
2956         (WebCore::ImageSource::decodedSize):
2957         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
2958         (WebCore::ImageSource::stopAsyncDecodingQueue):
2959         (WebCore::ImageSource::isSizeAvailable):
2960         (WebCore::ImageSource::frameCount):
2961         (WebCore::ImageSource::repetitionCount):
2962         (WebCore::ImageSource::filenameExtension):
2963         (WebCore::ImageSource::hotSpot):
2964         (WebCore::ImageSource::size):
2965         (WebCore::ImageSource::sizeRespectingOrientation):
2966         (WebCore::ImageSource::singlePixelSolidColor):
2967         (WebCore::ImageSource::frameIsBeingDecodedAtIndex):
2968         (WebCore::ImageSource::frameIsCompleteAtIndex):
2969         (WebCore::ImageSource::frameHasAlphaAtIndex):
2970         (WebCore::ImageSource::frameHasImageAtIndex):
2971         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
2972         (WebCore::ImageSource::frameSizeAtIndex):
2973         (WebCore::ImageSource::frameBytesAtIndex):
2974         (WebCore::ImageSource::frameDurationAtIndex):
2975         (WebCore::ImageSource::frameOrientationAtIndex):
2976          Make m_frameCache a type Ref<ImageFrameCache>. Use '->' instead of '.' when accessing its members.
2977
2978         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2979         (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
2980
2981 2016-11-03  Myles C. Maxfield  <mmaxfield@apple.com>
2982
2983         [WebGL2] Implement getBufferSubData()
2984         https://bugs.webkit.org/show_bug.cgi?id=164111
2985
2986         Reviewed by Dean Jackson.
2987
2988         The call exists in OpenGL 3.2 but in order to have parity with
2989         OpenGL ES 3 we back it with glMapBufferRange() instead.
2990
2991         This patch simply adds surface area to GraphicsContext3D
2992         until we can get an ANGLE implementation of it.
2993
2994         When testing this patch I discovered that r207649 incorrectly
2995         interpreted arguments to bufferData() and bufferSubData() as
2996         byte offsets. Instead, they should be element indices. This
2997         patch fixes those functions to work correctly so that
2998         getBufferSubData() can be tested correctly.
2999
3000         Tests: fast/canvas/webgl/webgl2-buffers.html
3001                fast/canvas/webgl/getBufferSubData-webgl1.html
3002
3003         * html/canvas/WebGL2RenderingContext.cpp:
3004         (WebCore::arrayBufferViewElementSize):
3005         (WebCore::WebGL2RenderingContext::bufferData):
3006         (WebCore::WebGL2RenderingContext::bufferSubData):
3007         (WebCore::WebGL2RenderingContext::getBufferSubData):
3008         * html/canvas/WebGL2RenderingContext.h:
3009         * html/canvas/WebGL2RenderingContext.idl:
3010         * platform/graphics/GraphicsContext3D.h:
3011         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3012         (WebCore::GraphicsContext3D::getBufferSubData):
3013         (WebCore::GraphicsContext3D::mapBufferRange):
3014         (WebCore::GraphicsContext3D::unmapBuffer):
3015
3016 2016-11-03  Chris Dumez  <cdumez@apple.com>
3017
3018         Unreviewed, mark support for the 'download' attribute as 'Done'.
3019
3020         * features.json:
3021
3022 2016-11-03  Chris Dumez  <cdumez@apple.com>
3023
3024         [WK2][Cocoa] Implement user interface for HTML form validation
3025         https://bugs.webkit.org/show_bug.cgi?id=164143
3026         <rdar://problem/28944652>
3027
3028         Reviewed by Simon Fraser.
3029
3030         Add ValidationBubble class to show HTML form validation messages
3031         using native dialogs. It currently has an implementation for both
3032         Mac and iOS. It is in WebCore under platform/ so that it can be
3033         used by both WebKit1 and WebKit2.
3034
3035         Update ownership of ValidationMessageClient so that is is owned
3036         by the Page using a unique_ptr<>, which seems to be the modern
3037         way of handling lifetime for page clients.
3038
3039         Test: fast/forms/validation-messages.html
3040
3041         * WebCore.xcodeproj/project.pbxproj:
3042         * html/HTMLFormControlElement.cpp:
3043         (WebCore::HTMLFormControlElement::focusAndShowValidationMessage):
3044         * html/ValidationMessage.cpp:
3045         (WebCore::ValidationMessage::updateValidationMessage):
3046         * page/Page.cpp:
3047         (WebCore::Page::Page):
3048         (WebCore::Page::~Page):
3049         * page/Page.h:
3050         (WebCore::Page::validationMessageClient):
3051         * page/PageConfiguration.cpp:
3052         * page/PageConfiguration.h:
3053         * platform/ValidationBubble.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm.
3054         (WebCore::ValidationBubble::message):
3055         * platform/ios/ValidationBubbleIOS.mm: Added.
3056         (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]):
3057         (WebCore::ValidationBubble::ValidationBubble):
3058         (WebCore::ValidationBubble::~ValidationBubble):
3059         (WebCore::ValidationBubble::show):
3060         (WebCore::ValidationBubble::setAnchorRect):
3061         * platform/mac/ValidationBubbleMac.mm: Added.
3062         (WebCore::ValidationBubble::ValidationBubble):
3063         (WebCore::ValidationBubble::~ValidationBubble):
3064         (WebCore::ValidationBubble::showRelativeTo):
3065
3066 2016-11-03  Brady Eidson  <beidson@apple.com>
3067
3068         IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes.
3069         https://bugs.webkit.org/show_bug.cgi?id=164383
3070
3071         Reviewed by Beth Dakin.
3072
3073         No new tests (Updated existing tests).
3074
3075         * Modules/indexeddb/IDBKeyRange.cpp:
3076         (WebCore::IDBKeyRange::includes):
3077         (WebCore::IDBKeyRange::contains): Deleted.
3078         * Modules/indexeddb/IDBKeyRange.h:
3079         * Modules/indexeddb/IDBKeyRange.idl:
3080
3081 2016-11-03  Ryan Haddad  <ryanhaddad@apple.com>
3082
3083         Unreviewed, rolling out r208302.
3084
3085         This change causes LayoutTest crashes under GuardMalloc.
3086
3087         Reverted changeset:
3088
3089         "Load stylesheets in link elements inside a connected shadow
3090         tree"
3091         https://bugs.webkit.org/show_bug.cgi?id=160683
3092         http://trac.webkit.org/changeset/208302
3093
3094 2016-11-03  Chris Dumez  <cdumez@apple.com>
3095
3096         Unreviewed, add HTML5 specification for HTML Interactive Form Validation feature.
3097
3098         * features.json:
3099
3100 2016-11-03  Chris Dumez  <cdumez@apple.com>
3101
3102         Unreviewed, add HTML Interactive Form Validation to features.json
3103
3104         * features.json:
3105
3106 2016-11-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3107
3108         Unreviewed, rolling out due to crash in Amazon web site
3109         https://bugs.webkit.org/show_bug.cgi?id=164380
3110         <rdar://problem/29094221>
3111
3112         * dom/Node.idl:
3113         * domjit/JSNodeDOMJIT.cpp:
3114         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
3115         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): Deleted.
3116
3117 2016-11-03  Brady Eidson  <beidson@apple.com>
3118
3119         IndexedDB 2.0: Support binary keys.
3120         <rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359
3121
3122         Reviewed by Alex Christensen.
3123
3124         Tests: storage/indexeddb/modern/binary-keys-1-private.html
3125                storage/indexeddb/modern/binary-keys-1.html
3126                Changes to other existing tests.
3127
3128         * Modules/indexeddb/IDBKey.cpp:
3129         (WebCore::IDBKey::createBinary):
3130         (WebCore::IDBKey::IDBKey):
3131         (WebCore::IDBKey::compare):
3132         * Modules/indexeddb/IDBKey.h:
3133         (WebCore::IDBKey::binary):
3134         (WebCore::compareBinaryKeyData):
3135
3136         * Modules/indexeddb/IDBKeyData.cpp:
3137         (WebCore::IDBKeyData::IDBKeyData):
3138         (WebCore::IDBKeyData::maybeCreateIDBKey):
3139         (WebCore::IDBKeyData::isolatedCopy):
3140         (WebCore::IDBKeyData::encode):
3141         (WebCore::IDBKeyData::decode):
3142         (WebCore::IDBKeyData::compare):
3143         (WebCore::IDBKeyData::loggingString):
3144         (WebCore::IDBKeyData::operator==):
3145         * Modules/indexeddb/IDBKeyData.h:
3146         (WebCore::IDBKeyData::hash):
3147         (WebCore::IDBKeyData::encode):
3148         (WebCore::IDBKeyData::decode):
3149
3150         * Modules/indexeddb/IndexedDB.h: Add new enum for the new key type.
3151
3152         * bindings/js/IDBBindingUtilities.cpp:
3153         (WebCore::toJS):
3154         (WebCore::createIDBKeyFromValue):
3155
3156         * platform/ThreadSafeDataBuffer.h:
3157         (WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl):
3158         (WebCore::ThreadSafeDataBuffer::copyData):
3159         (WebCore::ThreadSafeDataBuffer::size):
3160         (WebCore::ThreadSafeDataBuffer::operator==):
3161         (WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer):
3162
3163 2016-11-03  Tim Horton  <timothy_horton@apple.com>
3164
3165         Printing to PDF should produce internal links when HTML has internal links
3166         https://bugs.webkit.org/show_bug.cgi?id=112081
3167         <rdar://problem/5955705>
3168
3169         Reviewed by Simon Fraser.
3170         Patch originally by David Lattimore.
3171
3172         No new tests, as it's unclear how to test PDF output.
3173
3174         * dom/Element.cpp:
3175         (WebCore::Element::findAnchorElementForLink):
3176         * dom/Element.h:
3177         Add findAnchorElementForLink, which looks up the anchor element corresponding
3178         to the current element's href, and also returns the fragment name as an out parameter.
3179
3180         * page/PrintContext.cpp:
3181         (WebCore::PrintContext::PrintContext):
3182         (WebCore::PrintContext::spoolPage):
3183         (WebCore::PrintContext::spoolRect):
3184         (WebCore::PrintContext::end):
3185         (WebCore::PrintContext::collectLinkedDestinations):
3186         (WebCore::PrintContext::outputLinkedDestinations):
3187         * rendering/RenderObject.cpp:
3188         (WebCore::RenderObject::addPDFURLRect):
3189         Plumb internal links (fragment links) through to GraphicsContext, using
3190         the fragment name from the page.
3191
3192         * page/PrintContext.h:
3193         * platform/graphics/GraphicsContext.cpp:
3194         (WebCore::GraphicsContext::supportsInternalLinks):
3195         (WebCore::GraphicsContext::setDestinationForRect):
3196         (WebCore::GraphicsContext::addDestinationAtPoint):
3197         * platform/graphics/GraphicsContext.h:
3198         * platform/graphics/cg/GraphicsContextCG.cpp:
3199         (WebCore::GraphicsContext::supportsInternalLinks):
3200         (WebCore::GraphicsContext::setDestinationForRect):
3201         (WebCore::GraphicsContext::addDestinationAtPoint):
3202         Plumb internal links through to the CGContext. Apply the CTM, because
3203         these functions expect positions in global coordinates.
3204
3205         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3206         (WebCore::GraphicsContext::setURLForRect):
3207         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3208         (WebCore::GraphicsContext::setURLForRect):
3209         Adjust setURLForRect to take a FloatRect, like everything else, and
3210         stop rounding.
3211
3212 2016-11-03  Alex Christensen  <achristensen@webkit.org>
3213
3214         Unreviewed, rolling out r208298.
3215         https://bugs.webkit.org/show_bug.cgi?id=163939
3216
3217         caused asan crashes
3218
3219         Reverted changeset:
3220
3221         "NetworkSession: Add NetworkDataTask implementation for blobs"
3222         https://bugs.webkit.org/show_bug.cgi?id=163939
3223         http://trac.webkit.org/changeset/208298
3224
3225 2016-11-03  Brent Fulgham  <bfulgham@apple.com>
3226
3227         [Win][Direct2D] Native Windows widgets are drawn upside-down
3228         https://bugs.webkit.org/show_bug.cgi?id=164370
3229
3230         Reviewed by Alex Christensen.
3231
3232         When we return from drawing in GDI code, we need to flip the resulting
3233         bitmap so that it draws in the proper orientation in Direct2D.
3234
3235         Tested by existing widget tests.
3236
3237         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3238         (WebCore::GraphicsContext::releaseWindowsContext): Flip before drawing
3239         to our Direct2D context.
3240
3241 2016-11-01  Gavin Barraclough  <barraclough@apple.com>
3242
3243         Remove PageThrottler & all related code
3244         https://bugs.webkit.org/show_bug.cgi?id=164302
3245
3246         Reviewed by Ryosuke Niwa.
3247
3248         All relevant information now available from the ActivityState.
3249
3250         * CMakeLists.txt:
3251         * WebCore.xcodeproj/project.pbxproj:
3252         * html/HTMLMediaElement.cpp:
3253         (WebCore::HTMLMediaElement::setMuted):
3254         (WebCore::HTMLMediaElement::updateVolume):
3255         (WebCore::HTMLMediaElement::updatePlayState):
3256         (WebCore::HTMLMediaElement::updateAudioAssertionState): Deleted.
3257         * html/HTMLMediaElement.h:
3258         * loader/FrameLoader.cpp:
3259         (WebCore::FrameLoader::completed):
3260         (WebCore::FrameLoader::started):
3261         * loader/FrameLoader.h:
3262         * page/ChromeClient.h:
3263         * page/Page.cpp:
3264         (WebCore::Page::Page):
3265         * page/Page.h:
3266         (WebCore::Page::pageActivityStateChanged): Deleted.
3267         (WebCore::Page::pageThrottler): Deleted.
3268         * page/PageThrottler.cpp: Removed.
3269         * page/PageThrottler.h: Removed.
3270
3271 2016-11-03  Dan Bernstein  <mitz@apple.com>
3272
3273         REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
3274         https://bugs.webkit.org/show_bug.cgi?id=164340
3275         <rdar://problem/29074344>
3276
3277         Reviewed by Tim Horton.
3278
3279         To give WebKit a chance to deliver the painting milestones to its client after the commit,
3280         we must tell it about them before or during the commit. To that end, we should not defer
3281         the call to firePaintRelatedMilestonesIfNeeded until after the commit.
3282
3283         * rendering/RenderLayerCompositor.cpp:
3284         (WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed
3285           m_paintRelatedMilestonesTimer initializer.
3286         (WebCore::RenderLayerCompositor::didPaintBacking): Call
3287           FrameView::firePaintRelatedMilestonesIfNeeded directly from here.
3288         (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted.
3289         * rendering/RenderLayerCompositor.h:
3290
3291 2016-11-03  Antti Koivisto  <antti@apple.com>
3292
3293         imported/mozilla/svg/paint-order-01.svg and imported/mozilla/svg/paint-order-02.svg are flaky failures
3294         https://bugs.webkit.org/show_bug.cgi?id=164355
3295
3296         Reviewed by Ryosuke Niwa.
3297
3298         Revert one change from https://trac.webkit.org/changeset/207669 to see if it is causing flakiness in
3299         some XML based tests.
3300
3301         * xml/parser/XMLDocumentParser.cpp:
3302         (WebCore::XMLDocumentParser::end):
3303
3304 2016-11-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3305
3306         Unreviewed, fix CLoop build after r208320.
3307         https://bugs.webkit.org/show_bug.cgi?id=162980
3308
3309         Guard with ENABLE(JIT).
3310
3311         * bindings/scripts/CodeGeneratorJS.pm:
3312         (GenerateImplementation):
3313         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3314
3315 2016-11-02  Brady Eidson  <beidson@apple.com>
3316
3317         Expand upon IndexedDB status in features.json.
3318         
3319         * features.json:
3320
3321 2016-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
3322
3323         CSS.supports("font-variation-settings", "'wght' 500") erroneously returns false
3324         https://bugs.webkit.org/show_bug.cgi?id=164244
3325
3326         Reviewed by Michael Catanzaro.
3327
3328         Because we weren't passing a Document into CSSParserContext's constructor,
3329         there was no way for our parser to know whether the runtime switch was on
3330         or not. Instead, we can use the CallWith attribute in the IDL file to pass
3331         in a Document.
3332
3333         Test: fast/text/variations/css-supports-runtime-switch.html
3334
3335         * css/DOMCSSNamespace.cpp:
3336         (WebCore::DOMCSSNamespace::supports):
3337         * css/DOMCSSNamespace.h:
3338         * css/DOMCSSNamespace.idl:
3339
3340 2016-11-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3341
3342         [DOMJIT] Add DOMJIT::Signature
3343         https://bugs.webkit.org/show_bug.cgi?id=162980
3344
3345         Reviewed by Saam Barati and Sam Weinig.
3346
3347         We introduce DOMJIT::Signature. This signature object is automatically generated by IDL code generator.
3348         It holds (1) types, (2) pointer to the unsafe function (the function without checks), and (3) the effect
3349         of the function. We use constexpr to initialize DOMJIT::Signature without invoking global constructors.
3350         Thus the content is embedded into the binary as the constant values.
3351
3352         We also clean up the IDL code generator related to DOMJIT part. Instead of switching things inside IDL
3353         code generator, we use C++ template to dispatch things at compile time. This template meta programming
3354         is highly utilized in IDL these days.
3355
3356         To make DOMJIT::Signature constexpr, we also need to define DOMJIT abstract heap things in the build time.
3357         To do so, we introduce a tiny Ruby script to calculate the range of abstract heaps. We can offer the abstract
3358         heap tree as YAML format and the script will produce a C++ header holding the calculated abstract heap ranges
3359
3360         * CMakeLists.txt:
3361         * DerivedSources.make:
3362         * ForwardingHeaders/bytecode/SpeculatedType.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.h.
3363         * ForwardingHeaders/domjit/DOMJITSignature.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.cpp.
3364         * WebCore.xcodeproj/project.pbxproj:
3365         * bindings/js/JSDOMGlobalObject.h:
3366         * bindings/scripts/CodeGeneratorJS.pm:
3367         (GenerateHeader):
3368         (GeneratePropertiesHashTable):
3369         (GetUnsafeArgumentType):
3370         (GetArgumentTypeFilter):
3371         (GetResultTypeFilter):
3372         (GenerateImplementation):
3373         (UnsafeToNative):
3374         (GenerateHashTableValueArray):
3375         (ComputeFunctionSpecial):
3376         * bindings/scripts/IDLAttributes.txt:
3377         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3378         (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation):
3379         (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT):
3380         (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT):
3381         (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT):
3382         (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT):
3383         (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT):
3384         (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT):
3385         (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT):
3386         (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT):
3387         (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT):
3388         (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT):
3389         (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT):
3390         (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT):
3391         (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT):
3392         (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT):
3393         (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT):
3394         (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT):
3395         (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT):
3396         (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT):
3397         (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT):
3398         (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT):
3399         (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT):
3400         (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT):
3401         (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT):
3402         (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT):
3403         (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT):
3404         (WebCore::TestDO