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