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