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