e85db715ec922fc167a221431ecd54805715b771
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-05-10  Zalan Bujtas  <zalan@apple.com>
2
3         REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
4         https://bugs.webkit.org/show_bug.cgi?id=157445
5
6         Reviewed by Simon Fraser.
7
8         When we don't run transitions (becasuse of to/from 'auto' values) we should also not
9         report the 'from' value and behave as if we finished the transition already.
10
11         Test: fast/animation/height-auto-transition-computed-value.html
12
13         * page/animation/KeyframeAnimation.cpp:
14         (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): This is a revert of
15         looping the 'to' value back to the first keyframe when reverse animation is at the start value (last keyframe).
16
17         * platform/Length.cpp:
18         (WebCore::blend):
19
20 2016-05-09  Dean Jackson  <dino@apple.com>
21
22         [iOS] <select> elements should render right-aligned when in RTL mode
23         https://bugs.webkit.org/show_bug.cgi?id=157501
24         <rdar://problem/26187870>
25
26         Reviewed by Antoine Quint.
27
28         This is the equivalent of http://webkit.org/b/157112 for iOS.
29         Handle <select> elements when we're in RTL mode. This means
30         drawing the button with the drop-down arrow on the left
31         side, and the button text right-aligned.
32
33         Test: fast/forms/select-non-native-rendering-direction.html
34         plus a bunch of other ones that needed rebaselining.
35
36         * rendering/RenderThemeIOS.mm: Rename MenuListButtonPaddingRight to MenuListButtonPaddingAfter.
37         (WebCore::RenderThemeIOS::popupInternalPaddingBox): Handle both directions.
38         (WebCore::adjustInputElementButtonStyle):
39         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Handle drawing in
40         RTL mode.
41
42 2016-05-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
43
44         NodeList should be iterable
45         https://bugs.webkit.org/show_bug.cgi?id=131443
46         <rdar://problem/25731519>
47
48         Reviewed by Darin Adler.
49
50         Test: fast/dom/nodeListIterator.html
51
52         Updating JSKeyValueIterator to support map and set iterators,
53         depending on the signature of the result type of DOMClass::Iterator::next method.
54         Symbol.iterator method is made the same as values method for set iterators.
55
56         Adding support for NodeList.
57         Updating FontFaceSet to take benefit of that. 
58
59         * bindings/js/JSDOMBinding.h:
60         (WebCore::jsPair):.
61         * bindings/js/JSKeyValueIterator.h:
62         (WebCore::IteratorInspector::decltype): IteratorInspector detects whether the iterator is a set or map iterator.
63         (WebCore::IteratorInspector::test):
64         (WebCore::fillForEachArgumentsWithIteratorValue): Specializing according set/map iterator.
65         (WebCore::iteratorValueToJS): Ditto.
66         (WebCore::keyValueIteratorForEach):
67         (WebCore::JSKeyValueIterator<JSWrapper>::next):
68         * bindings/scripts/CodeGeneratorJS.pm:
69         (GenerateImplementationIterableFunctions): Removed the line forbidding set iterators.
70         Making Symbol.iterator function equal to values for set iterators.
71         * bindings/scripts/test/JS/JSTestNode.cpp: Rebasing with set iterator functions.
72         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing according updated function names.
73         * bindings/scripts/test/TestNode.idl: Making TestNode set iterable.
74         * css/FontFaceSet.cpp:
75         (WebCore::FontFaceSet::Iterator::next): Refactoring to make it a set iterator.
76         * css/FontFaceSet.h:
77         * css/FontFaceSet.idl:
78         * dom/NodeList.h: Making NodeList iterable.
79         (WebCore::NodeList::Iterator::Iterator):
80         (WebCore::NodeList::Iterator::next):
81         (WebCore::NodeList::createIterator):
82         * dom/NodeList.idl:
83
84 2016-05-09  Sergio Villar Senin  <svillar@igalia.com>
85
86         [css-grid] Implement auto-repeat computation
87         https://bugs.webkit.org/show_bug.cgi?id=157473
88
89         Reviewed by Darin Adler.
90
91         We added support for parsing and style for the new auto-repeat syntax. This patch actually
92         implements the feature by computing the number of auto-repeat tracks that will be part of
93         the explicit grid depending on the available size on the corresponding axis.
94
95         Note that we still do not drop the empty tracks, i.e., auto-fit will work exactly as
96         auto-fill until the empty track removal is implemented.
97
98         Some test results are not totally correct yet because we need to add the line names to the
99         computed style. As that requires a rather large piece of code it will be done in a follow up
100         patch. Track sizes are correct though.
101
102         Tests: fast/css-grid-layout/grid-auto-fill-columns.html
103                fast/css-grid-layout/grid-auto-fill-rows.html
104                fast/css-grid-layout/grid-change-auto-repeat-tracks.html
105                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-001.html
106                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-002.html
107                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-003.html
108                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-004.html
109                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-005.html
110
111         * css/CSSParser.cpp:
112         (WebCore::CSSParser::parseGridTrackRepeatFunction): Add the CSSAutoRepeatValue directly
113         instead of adding the track size.
114         * css/StyleBuilderCustom.h: Store the insertion point in style.
115         * rendering/RenderGrid.cpp:
116         (WebCore::RenderGrid::guttersSize): Replaced size_t by unsigned.
117         (WebCore::RenderGrid::rawGridTrackSize): New function which retrieves the track size from
118         either explicit (including auto-repeat tracks) or implicit tracks.
119         (WebCore::RenderGrid::gridTrackSize): Use rawGridTrackSize().
120         (WebCore::RenderGrid::computeAutoRepeatTracksCount): This is the core of the patch. This
121         method computes the number of auto-repeat tracks that fits on the available size for a given
122         axis (or 1 if that's indefinite).
123         * rendering/RenderGrid.h:
124
125 2016-05-09  Alex Christensen  <achristensen@webkit.org>
126
127         Fix GTK build after r200607
128
129         * Modules/notifications/Notification.h:
130         dir and replaceId are used in WebNotificationManager with NOTIFICATIONS and with LEGACY_NOTIFICATIONS
131
132 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
133
134         Fix the Windows build after r200602, and do some minor tidyup.
135
136         * platform/graphics/ca/PlatformCALayer.h:
137         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
138         (PlatformCALayerCocoa::contentsHidden):
139         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
140         (PlatformCALayerWin::contentsHidden):
141         (PlatformCALayerWin::setContentsHidden):
142         * platform/graphics/ca/win/PlatformCALayerWin.h:
143
144 2016-05-09  Darin Adler  <darin@apple.com>
145
146         Change Notification constructor to take an IDL dictionary instead of a WebCore::Dictionary
147         https://bugs.webkit.org/show_bug.cgi?id=157466
148
149         Reviewed by Alex Christensen.
150
151         * Modules/notifications/Notification.cpp: Got rid of unneeded includes.
152         (WebCore::Notification::Notification): Deleted the unused default constructor. Changed
153         NotificationCenter argument to be reference rather than PassRefPtr. Changed one of the
154         ScriptExecutionContext arguments to be a Document since the code relies on that already.
155         Used the lambda form of timer creation instead of the class member form. Added a FIXME
156         about when m_notificationCenter can be null.
157         (WebCore::Notification::create): Changed NotificationCenter argument to be reference
158         rather than PassRefPtr. Changed options argument to be Options rather than Dictionary.
159         (WebCore::directionString): Added. Helper because the class still wants to store the
160         direction as a string, at least for now.
161         (WebCore::Notification::show): Streamlined the code a bit.
162         (WebCore::Notification::taskTimerFired): Deleted. Not needed now that we use a lambda
163         inside the constructor.
164         (WebCore::Notification::permission): Removed unneeded const from return type.
165         (WebCore::Notification::permissionString): Ditto.
166
167         * Modules/notifications/Notification.h: Used pragma once, updated for changes above.
168         Removed a number of unused functions, including cancel, setIconURL, setLang,
169         stopLoadingIcon, detachPresenter, setBody, startLoadingIcon, finishLoadingIcon, and
170         taskTimerFired.
171
172         * Modules/notifications/Notification.idl: Add NotificationOptions and pass it instead
173         of Dictionary to the constructor. Note that this is only a subset of what is
174         currently specified in the Notifications API document. The latest document specifies
175         a much more complex feature with lots more options.
176
177         * Modules/notifications/NotificationCenter.cpp:
178         (WebCore::NotificationCenter::createNotification): Pass a reference rather than a
179         pointer to this.
180         * Modules/notifications/NotificationClient.h: Use pragma once. Removed unneeded
181         includes and forward declarations. Fixed #if to be easier to read.
182
183         * bindings/js/JSDOMConvert.h: Reworked the convert functions to use Converter and
184         DefaultConverter structs so we can do partial specialization in the future and so
185         we can get custom types for optional values. Used this to make an optional String
186         just be a null String, so it won't try to use Optional<String> instead. Might get
187         more complex latter when we add support for nullable.
188
189         * bindings/scripts/CodeGeneratorJS.pm:
190         (GenerateEnumerationImplementationContent): Generate a blank line to make the output
191         slightly clearer. Tweaked a comment.
192         (GenerateDefaultValue): Added. Converts the default syntax from IDL into the syntax
193         needed in C++ code.
194         (GenerateDefaultValueWithLeadingComma): Added. Helper for use below.
195         (GenerateDictionaryImplementationContent): Use GenerateDefaultValue and
196         GenerateDefaultValueWithLeadingComma to make default values.
197         (GenerateParametersCheck): Use GenerateDefaultValue here in the enumeration code
198         path. This is a step in the direction of being able to make the whole thing more
199         generic in the future.
200
201         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
202         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
203         * bindings/scripts/test/JS/JSTestObj.cpp:
204         * bindings/scripts/test/ObjC/DOMTestObj.h:
205         * bindings/scripts/test/ObjC/DOMTestObj.mm:
206         Regenerated.
207
208         * bindings/scripts/test/TestObj.idl: Simplified and extended some of the test cases
209         to cover more combinations of the dictionary and enumeration support.
210
211 2016-05-09  Brady Eidson  <beidson@apple.com>
212
213         Modern IDB: Have server database connections remember the OpenDB request that spawned them.
214         https://bugs.webkit.org/show_bug.cgi?id=157498
215
216         Reviewed by Tim Horton.
217
218         No new tests (No testable change in behavior, debug only for now).
219
220         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
221         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
222         
223         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
224         (WebCore::IDBServer::UniqueIDBDatabaseConnection::create):
225         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
226         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
227         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didFireVersionChangeEvent):
228         (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
229         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
230         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
231         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
232         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
233         (WebCore::IDBServer::UniqueIDBDatabaseConnection::openRequestIdentifier):
234
235 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
236
237         [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
238         https://bugs.webkit.org/show_bug.cgi?id=157496
239
240         Reviewed by Tim Horton.
241
242         UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
243         with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.
244
245         Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
246         user interaction on these views.
247
248         Test: fast/scrolling/ios/touch-scroll-visibility-hidden.html
249
250         * platform/graphics/ca/GraphicsLayerCA.cpp:
251         (WebCore::GraphicsLayerCA::updateContentsVisibility): We have to tell the scrolling layer
252         if we have visibility:hidden.
253         * platform/graphics/ca/PlatformCALayer.h:
254         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
255         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
256         (PlatformCALayerCocoa::contentsHidden):
257         (PlatformCALayerCocoa::setContentsHidden):
258         * rendering/RenderLayerBacking.cpp:
259         (WebCore::RenderLayerBacking::updateAfterDescendants):
260
261 2016-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
262
263         Web Font is downloaded even when all the characters in the document are outside its unicode-range
264         https://bugs.webkit.org/show_bug.cgi?id=42154
265         <rdar://problem/17779042>
266
267         Reviewed by Darin Adler.
268
269         Fonts are requested in two stages:
270         - For a given font family, all the relevant @font-face rules are consulted. We build up a
271         mapping of unicode-range -> Font object. This result is cached.
272         - Then, when we have the mapping, we look up the character we are trying to render to
273         find the appropriate Font object.
274
275         However, we are not supposed to create any Font objects (because that causes a download to
276         be triggered) until we consult with the character we're trying to render. Therefore, this
277         patch swaps out the Font objects with a FontAccessor. This FontAccessor is essentially a
278         lazily-created Font. When step 2 starts looking up the appropriate character, the
279         FontAccessor will be asked to start the download.
280
281         Test: fast/text/unicode-range-download.html
282
283         * css/CSSFontFace.cpp:
284         (WebCore::CSSFontFace::removeClient): 
285         as a client from all its CSSFontFaces.
286         * css/CSSFontFaceSet.cpp:
287         (WebCore::CSSFontFaceSet::clear): Clearing the CSSFontFaceSet needs to remove itself as a
288         client from all its CSSFontFaces.
289         * css/CSSSegmentedFontFace.cpp:
290         (WebCore::CSSFontAccessor::create): The lazy Font object.
291         (WebCore::CSSFontAccessor::CSSFontAccessor): Ditto.
292         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Appends a FontAccessor.
293         (WebCore::CSSSegmentedFontFace::fontRanges): Create the FontAccessor and use it instead.
294         * platform/graphics/FontCascadeFonts.cpp:
295         (WebCore::FontCascadeFonts::determinePitch): Use the fontForFirstRange() convenience
296         function.
297         (WebCore::glyphPageFromFontRanges): font() may now return nullptr. Update this function to
298         handle that.
299         * platform/graphics/FontRanges.cpp:
300         (WebCore::FontRanges::Range::font): Trigger the lazy initialization.
301         (WebCore::TrivialFontAccessor::create): Used in the case where there is only one font in
302         the Ranges object and it has a full unicode-range.
303         (WebCore::TrivialFontAccessor::TrivialFontAccessor):
304         (WebCore::FontRanges::FontRanges): Use TrivialFontAccessor.
305         (WebCore::FontRanges::glyphDataForCharacter): font() may now return nullptr. Update this
306         function to handle that. This is where the magic happens: this is where we trigger
307         downloads only if the character falls within the unicode-range.
308         (WebCore::FontRanges::fontForFirstRange): Add ASSERT.
309         (WebCore::FontRanges::isLoading): Update to use the new FontAccessor.
310         * platform/graphics/FontRanges.h: Ditto.
311         (WebCore::FontRanges::Range::Range):
312         (WebCore::FontRanges::Range::fontAccessor):
313         (WebCore::FontRanges::appendRange):
314         (WebCore::FontRanges::Range::font): Deleted.
315         * platform/graphics/FontSelector.h: The virtual base class of FontAccessor. This is
316         necessary because it must be shared between platform code and non-platform code.
317         (WebCore::FontAccessor::~FontAccessor):
318
319 2016-05-09  Brady Eidson  <beidson@apple.com>
320
321         Modern IDB: Prevent the same transaction from being commited/aborted twice.
322         https://bugs.webkit.org/show_bug.cgi?id=157494
323
324         Reviewed by Tim Horton.
325
326         When a page navigates or a worker terminates, in rare cases with specific unfortunate timing, the IDBServer
327         might receive a request to commit/abort a transaction that is already in the process of committing/aborting.
328         
329         By moving transactions that are finishing into their own map we can at least detect this situation and
330         return an error. This seems like an improvement over some mysterious ASSERTs/timeouts.
331
332         No new tests:
333         While apparent that this is at least partially to blame for some existing timeouts/ASSERTs, I could not nail 
334         down a reliable way to reproduce this with a dedicated test.
335         
336         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
337         (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase):
338         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
339         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
340         (WebCore::IDBServer::UniqueIDBDatabase::prepareToFinishTransaction):
341         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
342         (WebCore::IDBServer::UniqueIDBDatabase::didPerformCommitTransaction):
343         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
344         (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction):
345         (WebCore::IDBServer::UniqueIDBDatabase::hasUnfinishedTransactions):
346         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
347         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
348         (WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted): Renamed from inProgressTransactionCompleted.
349         (WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted.
350         * Modules/indexeddb/server/UniqueIDBDatabase.h:
351
352 2016-05-09  Tim Horton  <timothy_horton@apple.com>
353
354         Draw border and correct icon for placeholder attachments
355         https://bugs.webkit.org/show_bug.cgi?id=157495
356         rdar://problem/19982510
357
358         Reviewed by Anders Carlsson.
359
360         * Resources/AttachmentPlaceholder.png: Added.
361         * Resources/AttachmentPlaceholder@2x.png: Added.
362         * WebCore.xcodeproj/project.pbxproj:
363         * rendering/RenderThemeMac.mm:
364         (WebCore::attachmentPlaceholderBorderColor):
365         (WebCore::paintAttachmentIconPlaceholder):
366         (WebCore::paintAttachmentProgress):
367         (WebCore::paintAttachmentPlaceholderBorder):
368         (WebCore::RenderThemeMac::paintAttachment):
369         If progress is set, but set to 0, draw a dashed border around the attachment
370         and use the placeholder "download" artwork.
371
372 2016-05-09  Ada Chan  <adachan@apple.com>
373
374         Introduce WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen() and use it in WebVideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen()
375         https://bugs.webkit.org/show_bug.cgi?id=157493
376
377         Reviewed by Dan Bernstein.
378
379         * platform/mac/WebVideoFullscreenInterfaceMac.h:
380         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
381         (WebCore::WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen):
382
383 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
384
385         Clean up iOS text autosizing code
386         https://bugs.webkit.org/show_bug.cgi?id=157489
387
388         Reviewed by Zalan Bujtas.
389
390         Change the TraverseNextInclusionFunction and HeightTypeTraverseNextInclusionFunction
391         to take references.
392         
393         Use downcast<> more.
394         
395         Whitespace cleanup.
396
397         * rendering/RenderBlockFlow.cpp:
398         (WebCore::isNonBlocksOrNonFixedHeightListItems):
399         * rendering/RenderElement.cpp:
400         (WebCore::includeNonFixedHeight):
401         * rendering/RenderObject.cpp:
402         (WebCore::RenderObject::traverseNext):
403         * rendering/RenderObject.h:
404         * rendering/TextAutoSizing.cpp:
405         (WebCore::TextAutoSizingValue::adjustNodeSizes):
406         (WebCore::TextAutoSizingValue::reset):
407
408 2016-05-09  Anders Carlsson  <andersca@apple.com>
409
410         Add injected bundle SPI for getting favicon and touch icon URLs
411         https://bugs.webkit.org/show_bug.cgi?id=157435
412
413         Reviewed by Darin Adler.
414
415         * CMakeLists.txt:
416         Add new files.
417
418         * WebCore.xcodeproj/project.pbxproj:
419         Add new files.
420
421         * html/HTMLLinkElement.cpp:
422         (WebCore::HTMLLinkElement::iconType):
423         * html/HTMLLinkElement.h:
424         Rename LinkRelAttribute::IconType to LinkIconType.
425
426         * html/LinkIconCollector.cpp: Added.
427         (WebCore::iconSize):
428         New helper function that returns the icon size for an icon.
429
430         (WebCore::compareIcons):
431         Icon comparison function, to be used by for sorting.
432
433         (LinkIconCollector::iconsOfTypes):
434         Gather the right icons, sort them (descending by size) and return them.
435
436         * html/LinkIconCollector.h:
437         Added.
438
439         * html/LinkIconType.h:
440         Move icon type declarations here and arrange them so we can use them in an OptionSet.
441
442         * html/LinkRelAttribute.cpp:
443         (WebCore::LinkRelAttribute::LinkRelAttribute):
444         * html/LinkRelAttribute.h:
445         * loader/icon/IconController.cpp:
446         (WebCore::iconFromLinkElements):
447         Rename IconType to LinkIconType.
448
449 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
450
451         [iOS WK2] Font size increases on some pages after navigating then going back
452         https://bugs.webkit.org/show_bug.cgi?id=157441
453         rdar://problem/22873240
454
455         Reviewed by Darin Adler.
456
457         Sometimes I want to dump ViewportConfigurations from WebKit2 so export dump().
458
459         Test: fast/text-autosizing/ios/text-autosizing-after-back.html
460
461         * page/ViewportConfiguration.h:
462
463 2016-05-09  Eric Carlson  <eric.carlson@apple.com>
464
465         "Main content" restrictions should not apply to media documents
466         https://bugs.webkit.org/show_bug.cgi?id=157479
467         <rdar://problem/25840861>
468
469         Reviewed by Jer Noble.
470
471         No new tests, this change only applies to media documents in a top level document so it
472         isn't possible to have a layout test.
473
474         * html/HTMLMediaElement.cpp:
475         (WebCore::HTMLMediaElement::HTMLMediaElement): Don't apply restrictions to a media document.
476
477 2016-05-09  Dean Jackson  <dino@apple.com>
478
479         Update Picture-in-picture artwork
480         https://bugs.webkit.org/show_bug.cgi?id=157484
481         <rdar://problem/26177784>
482
483         Reviewed by Eric Carlson.
484
485         We have new artwork for the picture-in-picture presentation mode. I
486         also converted it to use SVG (and moved the button style to a
487         more consistent part of the file).
488
489         * Modules/mediacontrols/mediaControlsApple.css:
490         (video::-webkit-media-controls-panel .picture-in-picture-button):
491         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture):
492         (video::-webkit-media-controls-panel .picture-in-picture-button:active):
493         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture:active):
494
495 2016-05-09  Chris Dumez  <cdumez@apple.com>
496
497         Optimize [StrictTypeChecking] on IDL operations
498         https://bugs.webkit.org/show_bug.cgi?id=157467
499
500         Reviewed by Darin Adler.
501
502         Optimize [StrictTypeChecking] on IDL operations so that:
503         - Only generate extra code for nullable parameters because for non-nullable
504           parameters, JSXXX::toWrapped() will return null in case of a bad input
505           type. We will then throw a TypeError when null-checking it already.
506         - After the JSValue::isNullOrUndefined() check, avoid calling
507           JSXXX::toWrapped() and set nativeValue to nullptr directly.
508         - Drop the check for JSValue::inherits(JSXXX::info()) and just do a null
509           check on the value returned by JSXXX::toWrapped(). toWrapped() already
510           does a JSValue::inherits(JSXXX::info() check. Since we only call
511           toWrapped() if the JSValue is not null/undefined, a null return value
512           always indicates a bad input type.
513
514         Also update the TypeError message to be more useful when passing null
515         for non-nullable parameters or assigning null to a non-nullable
516         attribute. The message is now consistent with the one used for strict
517         type checking.
518
519         No new tests, rebaselined existing tests.
520
521         * bindings/js/JSDOMBinding.h:
522         * bindings/scripts/CodeGeneratorJS.pm:
523         (GenerateImplementation):
524         (GenerateParametersCheck):
525         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
526         (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
527         * bindings/scripts/test/JS/JSTestInterface.cpp:
528         (WebCore::setJSTestInterfaceImplementsNode):
529         (WebCore::setJSTestInterfaceSupplementalNode):
530         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
531         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
532         * bindings/scripts/test/JS/JSTestObj.cpp:
533         (WebCore::setJSTestObjTestObjAttr):
534         (WebCore::setJSTestObjLenientTestObjAttr):
535         (WebCore::setJSTestObjXMLObjAttr):
536         (WebCore::setJSTestObjTypedArrayAttr):
537         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
538         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
539         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
540         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
541         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
542         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
543         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
544         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
545         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
546         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
547         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
548         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
549         (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
550         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
551         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
552         (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
553         (WebCore::jsTestObjPrototypeFunctionConvert1):
554         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
555         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
556         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
557         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
558         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
559         (WebCore::constructJSTestOverloadedConstructors1):
560         (WebCore::constructJSTestOverloadedConstructors2):
561         (WebCore::constructJSTestOverloadedConstructors3):
562         * bindings/scripts/test/TestObj.idl:
563
564 2016-05-09  Tim Horton  <timothy_horton@apple.com>
565
566         Download progress on attachment elements sometimes exceeds element bounds
567         https://bugs.webkit.org/show_bug.cgi?id=157440
568         <rdar://problem/25245440>
569
570         Reviewed by Darin Adler.
571
572         In the case of very large dynamic type sizes, we can overflow the
573         bounds of the attachment. It turns out that we used to limit to one
574         line in many cases anyway, so only wrap if we have only a title and/or icon.
575         This looks better when you have many of the other elements even in
576         non-large-type modes.
577
578         * rendering/RenderThemeIOS.mm:
579         (WebCore::AttachmentInfo::buildTitleLines):
580         (WebCore::AttachmentInfo::AttachmentInfo):
581         Limit the title to a single line if we have anything
582         other than a title and icon.
583
584         (WebCore::attachmentBorderPath):
585         (WebCore::paintAttachmentBorder):
586         (WebCore::RenderThemeIOS::paintAttachment):
587         Clip to the border, so that even if somehow we paint outside of
588         the bounds, we don't paint over other parts of the page.
589
590 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
591
592         REGRESSION (198056): Unable to use edit buttons on WordPress
593         https://bugs.webkit.org/show_bug.cgi?id=157475
594
595         Reviewed by Antti Koivisto.
596
597         Renamed Event.prototype.deepPath() to composedPath() per discussions on
598         https://github.com/whatwg/dom/issues/242 as the old name was not Web compatible.
599
600         Test: fast/shadow-dom/Extensions-to-Event-Interface.html
601
602         * dom/Event.cpp:
603         (WebCore::Event::composedPath): Renamed from deepPath.
604         * dom/Event.h:
605         * dom/Event.idl:
606
607 2016-05-09  Alex Christensen  <achristensen@webkit.org>
608
609         Don't use DiskCache for media resource loads
610         https://bugs.webkit.org/show_bug.cgi?id=157405
611
612         Reviewed by Darin Adler.
613
614         http/tests/security/video-cross-origin-caching.html was loading from the disk cache.
615         This patch adds an assertion that fires in that test without this fix.
616
617         * loader/MediaResourceLoader.cpp:
618         (WebCore::MediaResourceLoader::requestResource):
619         * platform/graphics/PlatformMediaResourceLoader.h:
620         * platform/network/ResourceRequestBase.h:
621         (WebCore::ResourceRequestBase::hiddenFromInspector):
622         (WebCore::ResourceRequestBase::setHiddenFromInspector):
623         (WebCore::ResourceRequestBase::requester):
624         (WebCore::ResourceRequestBase::setRequester):
625         * platform/network/cocoa/WebCoreNSURLSession.mm:
626         (-[WebCoreNSURLSessionDataTask _restart]):
627         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
628
629 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
630
631         Refactor FocusController::findFocusableElementRecursively
632         https://bugs.webkit.org/show_bug.cgi?id=157415
633
634         Reviewed by Darin Adler.
635
636         Refactor FocusController::findFocusableElementRecursively and related functions. Extracted two functions:
637         nextFocusableElementWithinScope and previousFocusableElementWithinScope out of it since they didn't really share
638         any code other than calling findFocusableElement at the beginning.
639
640         Also renamed internal variant of nextFocusableElement and previousFocusableElement to nextFocusableElementOrScopeOwner
641         and previousFocusableElementOrScopeOwner. It was confusing to have these internal functions in addition to public
642         member functions that are used in Objective-C DOM API.
643
644         No new tests are added since there should be no behavioral change.
645
646         * page/FocusController.cpp:
647         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): Added a FIXME.
648         (WebCore::FocusController::advanceFocusInDocumentOrder): Use findFocusableElementAcrossFocusScope instead of manually
649         calling findFocusableElementRecursively and findFocusableElementDescendingDownIntoFrameDocument separately.
650         (WebCore::FocusController::findFocusableElementAcrossFocusScope): Now that findFocusableElementWithinScope calls
651         findFocusableElementDescendingDownIntoFrameDocument internally, there is no need to keep around "found" local variable.
652         Introduce a few early exists for a better clarity.
653         (WebCore::FocusController::findFocusableElementWithinScope): Renamed from findFocusableElementRecursively. Also call
654         findFocusableElementDescendingDownIntoFrameDocument here instead of findFocusableElementAcrossFocusScope.
655         (WebCore::FocusController::nextFocusableElementWithinScope): Extracted from findFocusableElementRecursively.
656         (WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
657         (WebCore::FocusController::findFocusableElement):
658         (WebCore::FocusController::nextFocusableElement): Added a FIXME.
659         (WebCore::FocusController::previousFocusableElement): Ditto.
660         (WebCore::FocusController::findFocusableElementOrScopeOwner): Renamed from findFocusableElement for clarity.
661         (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
662         (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
663         * page/FocusController.h:
664
665 2016-05-09  Manuel Rego Casasnovas  <rego@igalia.com>
666
667         [css-grid] Fix static position for positioned grid items
668         https://bugs.webkit.org/show_bug.cgi?id=157417
669
670         Reviewed by Darin Adler.
671
672         The spec was updated to define properly the static position
673         for positioned grid items, but we didn't update the implementation yet:
674         https://drafts.csswg.org/css-grid-1/issues-wd-20150108#issue-1
675
676         We were only setting the static position when the start line
677         was not auto. Otherwise we were using the default one
678         which includes the padding.
679         With the spec change we need to set it always,
680         even if the start line is auto.
681
682         * rendering/RenderGrid.cpp:
683         (WebCore::RenderGrid::layoutPositionedObject):
684         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
685
686 2016-05-08  Frederic Wang  <fwang@igalia.com>
687
688         RenderMathMLOperator: refactor management of stretchy data and italic correction
689         https://bugs.webkit.org/show_bug.cgi?id=156913
690
691         Reviewed by Darin Adler.
692
693         No new tests, behavior is not changed.
694
695         The stretchy data uses a shared space to describe horizontal / vertical directions and
696         unstretched / size variant / glyph assembly. We use a simple struct with some unions to
697         represent it instead of the current implementation with a class.
698         We also modify the signature of some functions to retrieve display operator and stretchy
699         data to use that new structure and prepare the move to a separate MathOperator class.
700         Finally, we introduce some helper functions to easily set the stretchy data.
701
702         * rendering/mathml/RenderMathMLOperator.cpp:
703         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use the new data members and
704         function signatures.
705         (WebCore::RenderMathMLOperator::setSizeVariant): New helper function to set a size variant.
706         (WebCore::RenderMathMLOperator::setGlyphAssembly): New helper function to set a glyph
707         assembly.
708         (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): We change the signature to use a
709         GlyphAssemblyData.
710         (WebCore::RenderMathMLOperator::findDisplayStyleLargeOperator): We rename the function and
711         change its signature to remove the return value. We now also set the italic correction when
712         a display operator is found.
713         (WebCore::RenderMathMLOperator::findStretchyData): We change the signature to introduce a
714         target size and remove the return value. This also does the early return when the base glyph
715         is large enough.
716         (WebCore::RenderMathMLOperator::updateStyle): We use the new data members and function
717         signatures. The check for the base glyph size is now done in findStretchyData, so we just
718         check whether m_stretchType is Unstretched to do an early return.
719         (WebCore::RenderMathMLOperator::firstLineBaseline): We use m_stretchType.
720         (WebCore::RenderMathMLOperator::computeLogicalHeight): Ditto.
721         (WebCore::RenderMathMLOperator::fillWithVerticalExtensionGlyph): Use the new class members.
722         (WebCore::RenderMathMLOperator::fillWithHorizontalExtensionGlyph): Ditto.
723         (WebCore::RenderMathMLOperator::paint): Ditto.
724         (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): Ditto.
725         (WebCore::RenderMathMLOperator::paintHorizontalGlyphAssembly): Ditto.
726         (WebCore::RenderMathMLOperator::paintChildren): Ditto.
727         (WebCore::RenderMathMLOperator::trailingSpaceError): Ditto.
728         (WebCore::RenderMathMLOperator::italicCorrection): Moved to RenderMathMLOperator.h.
729         (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): Deleted.
730         * rendering/mathml/RenderMathMLOperator.h:
731         (WebCore::RenderMathMLOperator::italicCorrection): We just return m_italicCorrection.
732         (WebCore::RenderMathMLOperator::GlyphAssemblyData::GlyphAssemblyData): New class to store an
733         assembly of GlyphData.
734         (WebCore::RenderMathMLOperator::StretchyData::mode): Deleted.
735         (WebCore::RenderMathMLOperator::StretchyData::variant): Deleted.
736         (WebCore::RenderMathMLOperator::StretchyData::top): Deleted.
737         (WebCore::RenderMathMLOperator::StretchyData::extension): Deleted.
738         (WebCore::RenderMathMLOperator::StretchyData::bottom): Deleted.
739         (WebCore::RenderMathMLOperator::StretchyData::middle): Deleted.
740         (WebCore::RenderMathMLOperator::StretchyData::left): Deleted.
741         (WebCore::RenderMathMLOperator::StretchyData::right): Deleted.
742         (WebCore::RenderMathMLOperator::StretchyData::setNormalMode): Deleted.
743         (WebCore::RenderMathMLOperator::StretchyData::setSizeVariantMode): Deleted.
744         (WebCore::RenderMathMLOperator::StretchyData::setGlyphAssemblyMode): Deleted.
745         (WebCore::RenderMathMLOperator::StretchyData::StretchyData): Deleted.
746
747 2016-05-08  Zalan Bujtas  <zalan@apple.com>
748
749         iOS selection: Use inflow containing block for positioned <br>.
750         https://bugs.webkit.org/show_bug.cgi?id=157115
751         <rdar://problem/25969295>
752
753         Reviewed by Ryosuke Niwa.
754
755         Similarly to RenderText, we should just use the inflow containing block for
756         selected <br> even when it is positioned out of flow. This visually matches Mac OS X
757         behaviour (selection painting does not get extended to the positioned <br>).
758
759         Test: fast/text/fixed-positioned-br-crash.html
760
761         * rendering/RenderLineBreak.cpp:
762         (WebCore::RenderLineBreak::collectSelectionRects):
763
764 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
765
766         [iOS] Build fix after r200563
767
768         Unreviewed.
769
770         * editing/cocoa/HTMLConverter.mm:
771         (_font):
772
773 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
774
775         [OS X] Migrate our Font classes entirely off of NSFont
776         https://bugs.webkit.org/show_bug.cgi?id=157464
777
778         Reviewed by Darin Adler.
779
780         Because NSFont and CTFont are toll-free-bridged, we don't need NSFont at all anywhere.
781
782         No new tests because there is no behavior change.
783
784         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
785         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
786         (textMarkerRangeFromRange):
787         (visiblePositionForStartOfTextMarkerRange):
788         (visiblePositionForEndOfTextMarkerRange):
789         (AXAttributedStringRangeIsValid):
790         (AXAttributeStringSetFont):
791         (CreateCGColorIfDifferent):
792         (AXAttributeStringSetStyle):
793         (textMarkerRangeFromVisiblePositions):
794         * bindings/objc/DOM.mm:
795         (-[DOMElement _font]):
796         * bindings/objc/DOMPrivate.h:
797         * editing/cocoa/HTMLConverter.mm:
798         (_font):
799         (WebCore::editingAttributedStringFromRange):
800         * editing/mac/EditorMac.mm:
801         (WebCore::Editor::fontAttributesForSelectionStart):
802         * platform/graphics/Font.h:
803         (WebCore::Font::getCTFont):
804         (WebCore::Font::getNSFont): Deleted.
805         * platform/graphics/FontPlatformData.h:
806         (WebCore::FontPlatformData::nsFont): Deleted.
807         * platform/graphics/cocoa/FontCocoa.mm:
808         (WebCore::Font::determinePitch):
809         (WebCore::advanceForColorBitmapFont):
810         (WebCore::Font::platformWidthForGlyph):
811         (WebCore::renderingStyle): Deleted.
812         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
813
814 2016-05-08  Chris Dumez  <cdumez@apple.com>
815
816         [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
817         https://bugs.webkit.org/show_bug.cgi?id=157465
818
819         Reviewed by Darin Adler.
820
821         Simplify [RequiresExistingAtomicString] IDL extended attribute handling
822         in the bindings generator.
823
824         * bindings/scripts/CodeGeneratorJS.pm:
825         (GenerateParametersCheck):
826         Drop code specific to [RequiresExistingAtomicString].
827
828         (JSValueToNative):
829         Deal with [RequiresExistingAtomicString] IDL extended attribute,
830         similarly to [AtomicString] and [TreatNullAs].
831
832         * bindings/scripts/test/JS/JSTestObj.cpp:
833         * bindings/scripts/test/TestObj.idl:
834         Add bindings test coverage.
835
836         * dom/DocumentFragment.cpp:
837         (WebCore::DocumentFragment::getElementById):
838         * svg/SVGSVGElement.cpp:
839         (WebCore::SVGSVGElement::getElementById):
840         Add null check for the id parameter. The generated bindings used to do
841         this null check for us but it is no longer the case (to make the bindings
842         generator a bit simpler). This extended attribute is not commonly used
843         and is meant as a micro-optimization for getElementById().
844
845 2016-05-08  David Kilzer  <ddkilzer@apple.com>
846
847         Roll out: ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
848         <https://webkit.org/b/157462>
849
850         This reverts commit r200554.
851
852         This doesn't fix the data race, and the thread leak is a
853         separate issue.
854
855         * page/scrolling/ScrollingThread.cpp:
856         (WebCore::ScrollingThread::createThreadIfNeeded): Roll out the
857         change.
858
859 2016-05-08  Darin Adler  <darin@apple.com>
860
861         Follow-up to that last patch (missed review comments).
862
863         * page/EventSource.cpp:
864         (WebCore::EventSource::parseEventStream): Pre-increment, not post-increment.
865         (WebCore::EventSource::dispatchMessageEvent): More elegant form without explicit StringView.
866
867 2016-05-08  Darin Adler  <darin@apple.com>
868
869         Change EventSource constructor to take an IDL dictionary instead of a WebCore::Dictionary
870         https://bugs.webkit.org/show_bug.cgi?id=157459
871
872         Reviewed by Chris Dumez.
873
874         Patch also includes some updating of EventSource class to modern idioms.
875
876         * page/EventSource.cpp:
877         (WebCore::EventSource::EventSource): Initialize based on Init.
878         (WebCore::EventSource::create): Take/pass Init instead of Dictionary.
879
880         * bindings/js/SerializedScriptValue.cpp:
881         (WebCore::CloneSerializer::serialize): Take a StringView instead of a string
882         so callers don't have to allocate a String just to use this.
883         (WebCore::SerializedScriptValue::create): Ditto.
884         * bindings/js/SerializedScriptValue.h: Ditto.
885
886         * page/EventSource.cpp: Changed defaultReconnectDelay to be a uint64_t
887         instead of an unsigned long long.
888         (WebCore::EventSource::EventSource): Changed constructor to take a struct
889         instead of a Dictionary for eventSourceInit. Also moved initialization of
890         data members to the header and used ASCIILiteral.
891         (WebCore::EventSource::create): Changed type to Init and streamlined code
892         a little bit using auto.
893         (WebCore::EventSource::connect): Used a reference instead of a pointer.
894         Also added a FIXME since I noticed that m_requestInFlight is probably not
895         needed, since it's basically the same thing as "is m_loader null".
896         (WebCore::EventSource::url): Moved to the header and made it inline.
897         (WebCore::EventSource::networkRequestEnded): Removed unneeded check that
898         is already done by all callers and turned it into an assertion.
899         (WebCore::EventSource::withCredentials): Ditto.
900         (WebCore::EventSource::readyState): Ditto.
901         (WebCore::EventSource::responseIsValid): Added. Helper function to make
902         the logic in didReceiveResponse easier to read. Fixed logic to compare
903         MIME type ignoring ASCII case, since that's how MIME types work.
904         (WebCore::EventSource::didReceiveResponse): Use the helper above, and also
905         move the m_eventStreamOrigin set up code into the valid response case,
906         since there is no point doing it if the response is not valid. Also use
907         the early return idiom.
908         (WebCore::EventSource::didReceiveData): Removed the unneeded explicit
909         conversion to StringView here. Also removed a FIXME that I fixed.
910         (WebCore::EventSource::didFinishLoading): Added code to flush the decoder
911         as mentioned in didReceiveData. Added FIXME about peculiar clearing code
912         that exists only here. Removed check for empty receive buffer and data
913         that is not needed since parseEventStream does sufficient checking.
914         (WebCore::EventSource::didFail): Added FIXME because of things that
915         didFinishLoading does that seem equally valuable here.
916         (WebCore::EventSource::parseEventStream): Tweaked types and names of local
917         variables, and changed to use Optional instead of magic number -1. Also
918         added a FIXME about how the buffer type is probably not right since we
919         keep moving the characters in the buffer as we consume the start of it.
920         (WebCore::EventSource::parseEventStreamLine): Refactor and reorganize so
921         this doesn't do so much string allocation and is easier to read
922         (WebCore::EventSource::canSuspendForDocumentSuspension): Tweaked comment.
923         (WebCore::EventSource::dispatchMessageEvent): Renamed this from
924         createMessageEvent, and moved more code in here. We now don't have to
925         allocate a temporary string just to pass it to SerializedScriptValue.
926
927         * page/EventSource.h: Updated for changes above. Use pragma once.
928         Define and use EventSource::Init struct. Other small cleanup.
929
930         * page/EventSource.idl: Define EventSourceInit dictionary and use it.
931         Other small cleanup.
932
933 2016-05-07  Darin Adler  <darin@apple.com>
934
935         Change HTMLSlotElement::assignedNodes to take a IDL dictionary instead of a WebCore::Dictionary
936         https://bugs.webkit.org/show_bug.cgi?id=157457
937
938         Reviewed by Chris Dumez.
939
940         * html/HTMLSlotElement.cpp:
941         (WebCore::HTMLSlotElement::removedFrom): Fixed typo in comment.
942         (WebCore::HTMLSlotElement::assignedNodes): Renamed assignedNodesForBindings back to this
943         and changed the argument type to Optional<AssignedNodesOptions> instead of Dictionary.
944         Also streamlined the logic a bit.
945         (WebCore::HTMLSlotElement::enqueueSlotChangeEvent): Changed to use a pointer to the
946         enqueued event instead of a boolean. With only a boolean, we could end up clearing the
947         flag in cases where we don't really want to.
948         (WebCore::HTMLSlotElement::dispatchEvent): Ditto.
949         (WebCore::HTMLSlotElement::assignedNodesForBindings): Deleted.
950         * html/HTMLSlotElement.h: Use pragma once. Added AssignedNodeOptions. Changed for the
951         above, including changing the data member.
952         * html/HTMLSlotElement.idl: Removed use of ImplementedAs. Fixed the type of the options
953         dictionary.
954
955 2016-05-08  Chris Dumez  <cdumez@apple.com>
956
957         [Bindings] Add convert<>() template specializations for integer types
958         https://bugs.webkit.org/show_bug.cgi?id=157458
959
960         Reviewed by Darin Adler.
961
962         Add convert<>() template specializations for integer types and use them
963         in the JS bindings. Also, treat non-32bit types the same way as the
964         32bit ones, allowing the compiler to optimize out branching based on
965         the IntegerConversionConfiguration.
966
967         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
968
969         * bindings/js/JSDOMBinding.cpp:
970         (WebCore::enforceRange):
971         (WebCore::toSmallerInt):
972         (WebCore::toSmallerUInt):
973         (WebCore::toInt8EnforceRange):
974         (WebCore::toUInt8EnforceRange):
975         (WebCore::toInt8Clamp):
976         (WebCore::toUInt8Clamp):
977         (WebCore::toInt8):
978         (WebCore::toUInt8):
979         (WebCore::toInt16EnforceRange):
980         (WebCore::toUInt16EnforceRange):
981         (WebCore::toInt16Clamp):
982         (WebCore::toUInt16Clamp):
983         (WebCore::toInt16):
984         (WebCore::toUInt16):
985         (WebCore::toInt32EnforceRange):
986         (WebCore::toInt32Clamp):
987         (WebCore::toUInt32Clamp):
988         (WebCore::toUInt32EnforceRange):
989         (WebCore::toInt64EnforceRange):
990         (WebCore::toUInt64EnforceRange):
991         (WebCore::toInt64Clamp):
992         (WebCore::toUInt64Clamp):
993         (WebCore::toInt64):
994         (WebCore::toUInt64):
995         * bindings/js/JSDOMBinding.h:
996         - Splt some integer conversion functions into 3 Normal / Clamp /
997           Enforce versions, similarly to what was done for 32bit types already.
998           This is so that these can be called from the inline functions in
999           JSDOMConvert.h, allowing the compiler to optimize out the branches.
1000         - Get rid of some unnecessary state.hadException() checks.
1001
1002         * bindings/js/JSDOMConvert.h:
1003         Add convert<> specializations for integer types.
1004
1005         * bindings/js/JSNodeFilterCustom.cpp:
1006         (WebCore::JSNodeFilter::acceptNode):
1007
1008         * bindings/scripts/CodeGenerator.pm:
1009         - Add utility function to distinguish integer types.
1010         - Have IsNumericType() using the integerType / floatingPointType
1011           hashes to avoid duplication.
1012         - Stop int / unsigned int from integer types as those are not
1013           in Web IDL and they are not used.
1014
1015         * bindings/scripts/CodeGeneratorJS.pm:
1016         (GetIntegerConversionType):
1017         (JSValueToNative):
1018         Use convert<>() for converting JSValue to integer types.
1019
1020         * bindings/scripts/IDLParser.pm:
1021         Stop allowing int / unsigned int types as those are not in Web IDL.
1022
1023         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1024         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1025         * bindings/scripts/test/JS/JSTestObj.cpp:
1026         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1027         Rebaseline bindings tests.
1028
1029 2016-05-08  Darin Adler  <darin@apple.com>
1030
1031         Correct dictionary bindings handling of optional, null, and undefined
1032         https://bugs.webkit.org/show_bug.cgi?id=157463
1033
1034         Reviewed by Chris Dumez.
1035
1036         * bindings/js/JSDOMBinding.cpp:
1037         (WebCore::propertyValue): Deleted.
1038         * bindings/js/JSDOMBinding.h: Deleted propertyValue, not all that helpful for now.
1039
1040         * bindings/scripts/CodeGeneratorJS.pm:
1041         (GenerateDictionaryImplementationContent): Added a new early exit for convert to
1042         a dictionary type when the value is undefined or null and all members are either
1043         optional or have a default value. This returns the default values for everything
1044         without raising an exception. Added checking that requires that the dictionary
1045         argument is an object and not a regular expression, since that's also called for
1046         in the latest draft of the Web IDL specification. This ends up speeding up the
1047         code a bit since we now use JSObject::get for properties instead of JSValue::get.
1048         (GenerateParametersCheck): Renamed some local variables. Taught the code that
1049         optional dictionaries all have a default value; before it was doing that for the
1050         type "Dictionary" but not the real dictionary types (IsDictionaryType).
1051
1052         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1053
1054         * css/FontFace.cpp:
1055         (WebCore::FontFace::create): Changed argument to be Descriptors instead of
1056         Optional<Descriptors>. It would have compiled the other way, but there is now
1057         no caller that will pass a null. Because the IDL dictionary support was new,
1058         this was the only place that was doing it wrong. Good that we "nipped it in the bud"
1059         before doing this in more places.
1060         * css/FontFace.h: Ditto.
1061
1062 2016-05-08  David Kilzer  <ddkilzer@apple.com>
1063
1064         ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
1065         <https://webkit.org/b/157462>
1066
1067         Reviewed by Darin Adler.
1068
1069         Reproduced with multiple existing tests.
1070
1071         * page/scrolling/ScrollingThread.cpp:
1072         (WebCore::ScrollingThread::createThreadIfNeeded): Use a
1073         std::once_flag to initialize Scrolling Thread since this may be
1074         called from background threads.
1075
1076 2016-05-08  Darin Adler  <darin@apple.com>
1077
1078         Try to fix build without rolling out that last change.
1079
1080         * bindings/js/JSDOMConvert.h:
1081         (WebCore::convert<Vector<String>>): Make this an inline. Just call toNativeArray.
1082
1083 2016-05-07  Darin Adler  <darin@apple.com>
1084
1085         Change MutationObserver::observe to take an IDL dictionary, rather than WebCore::Dictionary
1086         https://bugs.webkit.org/show_bug.cgi?id=157456
1087
1088         Reviewed by Chris Dumez.
1089
1090         * bindings/js/JSDOMConvert.h:
1091         (WebCore::convertOptional): Use a specific Optional null rather than Nullopt so we
1092         can compile the ternary operator.
1093         (WebCore::convert<bool>): Added.
1094         (WebCore::convert<Vector<String>>): Added. Later we probably need to change convert to use
1095         a member function of a class template rather than a function template so we can make partial
1096         specialization work and do this just once for all Vector<T>.
1097
1098         * bindings/js/JSMutationObserverCustom.cpp:
1099         (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots): Streamlined code and removed
1100         some local variables. Changed to call the new observedNodes rather than getObservedNodes.
1101
1102         * bindings/scripts/CodeGeneratorJS.pm:
1103         (GenerateDictionaryImplementationContent): Fixed bug where we tried to call the version of
1104         the convert function with a default value even when there was none.
1105
1106         * bindings/scripts/test/TestObj.idl: Added a test case basically identical to what's needed
1107         in MutationObserver.idl.
1108         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1109
1110         * dom/MutationObserver.cpp:
1111         (WebCore::MutationObserver::observe): Chagned function to take a MutationObserver::Init
1112         instead of a Dictionary.
1113         (WebCore::MutationObserver::observationStarted): Changed argument type to a reference.
1114         (WebCore::MutationObserver::observationEnded): Ditto.
1115         (WebCore::MutationObserverMicrotask): Removed unneeded explicit constructor and destructor.
1116         (WebCore::queueMutationObserverCompoundMicrotask): Got rid of unnneeded local variable.
1117         (WebCore::MutationObserver::observedNodes): Renamed to remove the "get" prefix.
1118
1119         * dom/MutationObserver.h: Reduced includes. Added MutationObserver::Init struct and
1120         used it for the type of the argument to the observe function. Changed a few argument
1121         types and removed unused forward declarations.
1122
1123         * dom/MutationObserver.idl: Added MutationObserverInit and used it instead of Dictionary.
1124
1125         * dom/MutationObserverRegistration.cpp:
1126         (WebCore::MutationObserverRegistration::MutationObserverRegistration): Pass a reference.
1127         (WebCore::MutationObserverRegistration::~MutationObserverRegistration): Ditto.
1128
1129 2016-05-07  Chris Dumez  <cdumez@apple.com>
1130
1131         Reduce special handling of XPathNSResolver type in the bindings
1132         https://bugs.webkit.org/show_bug.cgi?id=157454
1133
1134         Reviewed by Darin Adler.
1135
1136         Reduce special handling of XPathNSResolver type in the bindings.
1137
1138         * CMakeLists.txt:
1139         * WebCore.xcodeproj/project.pbxproj:
1140         * bindings/js/JSBindingsAllInOne.cpp:
1141         Add new JSXPathNSResolverCustom.cpp file.
1142
1143         * bindings/js/JSDOMStringListCustom.cpp:
1144         (WebCore::JSDOMStringList::toWrapped):
1145         Take the ExecState by reference instead of pointer.
1146
1147         * bindings/js/JSDOMWindowCustom.cpp:
1148         (WebCore::JSDOMWindow::toWrapped):
1149         Update to take an ExecState& parameter. The bindings now pass
1150         an ExecState to all custom toWrapped() methods for consistency
1151         and flexibility.
1152
1153         * bindings/js/JSDictionary.cpp:
1154         (WebCore::JSDictionary::convertValue):
1155         Pass an ExecState now that those toWrapped() methods expect
1156         it.
1157
1158         * bindings/js/JSEventTargetCustom.cpp:
1159         (WebCore::JSEventTarget::toWrapped):
1160         Update to take an ExecState& parameter.
1161
1162         * bindings/js/JSIDBDatabaseCustom.cpp:
1163         (WebCore::JSIDBDatabase::transaction):
1164         Pass ExecState by reference instead of pointer.
1165
1166         * bindings/js/JSMessageEventCustom.cpp:
1167         (WebCore::handleInitMessageEvent):
1168         Pass ExecState to JSDOMWindow::toWrapped().
1169
1170         * bindings/js/JSXPathNSResolverCustom.cpp: Added.
1171         (WebCore::JSXPathNSResolver::toWrapped):
1172         Provide a custom implementation of JSXPathNSResolver::toWrapped()
1173         instead of having the custom code in the bindings generator.
1174
1175         * bindings/scripts/CodeGeneratorJS.pm:
1176         (AddIncludesForType):
1177         Drop special includes for XPathNSResolver as they are no longer needed.
1178
1179         (GenerateHeader):
1180         Drop special casing of certain types for generating the toWrapped()
1181         declaration by:
1182         1. Relying on GetNativeType() for the return value as certain types
1183            return a RefPtr instead of a raw pointer.
1184         2. Adding an extra ExecState parameter when a custom implementation of
1185            toWrapped() is provided, given that some of them need it.
1186
1187         (GenerateParametersCheck):
1188         Drop custom code for XPathNSResolver and use the normal code path for
1189         this type now. The custom code now resides in the custom implementation
1190         of JSXPathNSResolver::toWrapped(), in custom bindings.
1191
1192         (JSValueToNative):
1193         - Drop NodeFilter from the nativeType hash map as it was updated to
1194           be a callback interface a while back.
1195         - Add XPathNSResolver to nativeType hash map so that we now to use
1196           a RefPtr<> instead of a raw pointer in the bindings. We should
1197           probably add an IDL extended attribute for this at some point.
1198         - Drop special casing for DOMStringList which was outdated since there
1199           is no toDOMStringList() function. DOMStringList has a custom
1200           toWrapped() function instead nowadays so we now call this one
1201           instead. We apparently do not have any DOMStringList parameters
1202           outside our bindings tests at the moment, which is why no one
1203           noticed.
1204         - Pass an ExecState to toWrapped() if the interface has the
1205           JSCustomToNativeObject IDL extended attribute.
1206
1207         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
1208         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
1209         * bindings/scripts/test/JS/JSTestObj.cpp:
1210         * bindings/scripts/test/ObjC/DOMTestObj.h:
1211         * bindings/scripts/test/ObjC/DOMTestObj.mm:
1212         * bindings/scripts/test/TestObj.idl:
1213         Add bindings test coverage for having an operation with an
1214         XPathNSResolver parameter.
1215
1216         * dom/Document.idl:
1217         * xml/XPathEvaluator.idl:
1218         Drop some unnecessary default parameter values.
1219
1220         * xml/XPathNSResolver.idl:
1221         Add JSCustomToNativeObject IDL extended attribute so that we can
1222         provide our own custom implementation of JSXPathNSResolver::toWrapped(),
1223         instead of having the custom code in the bindings generator.
1224
1225         * dom/Document.cpp:
1226         (WebCore::Document::createExpression):
1227         (WebCore::Document::evaluate):
1228         * dom/Document.h:
1229         * inspector/InspectorNodeFinder.cpp:
1230         * xml/XPathEvaluator.cpp:
1231         (WebCore::XPathEvaluator::createExpression):
1232         (WebCore::XPathEvaluator::evaluate):
1233         * xml/XPathEvaluator.h:
1234         * xml/XPathExpression.cpp:
1235         (WebCore::XPathExpression::createExpression):
1236         * xml/XPathExpression.h:
1237         * xml/XPathParser.cpp:
1238         (WebCore::XPath::Parser::Parser):
1239         (WebCore::XPath::Parser::parseStatement):
1240         * xml/XPathParser.h:
1241         Take XPathNSResolver parameter as a Ref<XPathNSResolver>&& as this is
1242         what the generated bindings now provide us, given that this sometimes
1243         have to create a wrapper around a JSObject.
1244
1245 2016-05-07  Darin Adler  <darin@apple.com>
1246
1247         Fix crash introduced by the last patch.
1248
1249         Fix suggested by Chris Dumez.
1250
1251         * css/FontFace.cpp:
1252         (WebCore::FontFace::FontFace): Roll out incorrect change. Things were getting
1253         initialized in the wrong order in a change I had made to the FontFace constructor
1254         that takes a CSSFontSelector.
1255
1256 2016-05-07  Chris Dumez  <cdumez@apple.com>
1257
1258         Unreviewed, rebaseline bindings tests after r200547.
1259
1260         * bindings/scripts/test/JS/JSTestObj.cpp:
1261         (WebCore::convert<TestObj::FontFaceDescriptors>):
1262
1263 2016-05-07  Darin Adler  <darin@apple.com>
1264
1265         Next step on dictionary bindings, along with other bindings refinements
1266         https://bugs.webkit.org/show_bug.cgi?id=157451
1267
1268         Reviewed by Chris Dumez.
1269
1270         Converted one dictionary, the one passed to the constructor in FontFace.
1271
1272         * WebCore.xcodeproj/project.pbxproj: Updated for name change of JSDOMBuild.h to
1273         JSDOMConvert.h and also let Xcode update a file type.
1274
1275         * bindings/js/JSDOMBinding.cpp:
1276         (WebCore::propertyValue): Added.
1277         * bindings/js/JSDOMBinding.h: Use pragma once. Remove unnecessary forward declaration.
1278         Move all declarations to the top of the file, separating them from definitions. This
1279         is a small step toward better overview of what's in this file and paves the way for
1280         future simplifications and improvements we can make after we observe patterns.
1281         Also removed a couple unused functions.
1282
1283         * bindings/js/JSDOMConvert.h: Renamed from JSDOMBuild.h.
1284         Renamed function templates from build to convert. Added convertOptional.
1285
1286         * bindings/js/ReadableStreamController.cpp:
1287         (WebCore::callFunction): Use auto and remove some unneeded namespacing.
1288         (WebCore::ReadableStreamController::invoke): Ditto. Also remove use of helper function
1289         getPropertyFromObject, since this was the only call site and it was not very helpful.
1290         (WebCore::ReadableStreamController::isControlledReadableStreamLocked): Ditto.
1291         (WebCore::createReadableStream): Ditto.
1292         (WebCore::getReadableStreamReader): Ditto.
1293
1294         * bindings/scripts/CodeGeneratorJS.pm:
1295         (GenerateEnumerationImplementationContent): Updated for name change from build to
1296         convert and JSDOMBuild.h to JSDOMConvert.h.
1297         (GenerateDictionaryImplementationContent): Ditto. Also added code to handle optional
1298         and added explicit exception checking, using local variables. Not clear longer term
1299         if the local variable approach is OK since this will unnecessarily change types like
1300         const String& to String.
1301         (GenerateParametersCheck): Removed local variable $optional and use $parameter->isOptional
1302         directly consistently. This is slightly clearer because the old code used a mix of the
1303         two, and also is a better pattern for when we refactor this into smaller functions.
1304         Note that this function name is not good any more--this is a lot more then parameter checks.
1305         (GetNativeType): Return appropriate name for dictionary types.
1306         (JSValueToNative): Updated for name change from build to convert and JSDOMBuild.h to
1307         JSDOMConvert.h.
1308
1309         * bindings/scripts/test/JS/JSTestObj.cpp:
1310         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1311         Regenerated results.
1312
1313         * bindings/scripts/test/TestObj.idl: Added another dictionary test case, just a copy
1314         of the current state of the one in FontFace.idl.
1315
1316         * css/CSSFontFace.cpp:
1317         (WebCore::CSSFontFace::setUnicodeRange): Update for simplified UnicodeRange struct.
1318         (WebCore::CSSFontFace::setFeatureSettings): Fix to correctly handle being called
1319         with "normal". Also fix so it doesn't call fontPropertyChanged if nothing changed.
1320         Also got rid of return value, which had no real value: it was returning false for
1321         some bad inputs, but others would just lead to assertions, and the real reason this
1322         was OK is that this function is only passed known-valid values.
1323
1324         * css/CSSFontFace.h: Used prama once. Tweaked formatting. Removed return value from
1325         the setFeatureSettings function. Changed UnicodeRange to be struct with public data
1326         members instead a struct with a constructor and getter functions.
1327
1328         * css/CSSFontSelector.cpp:
1329         (WebCore::CSSFontSelector::addFontFaceRule): Updated since setFeatureSettings no
1330         longer has a boolean return value.
1331
1332         * css/CSSSegmentedFontFace.cpp:
1333         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Updated for simplified
1334         UnicodeRange struct.
1335
1336         * css/FontFace.cpp:
1337         (WebCore::valueFromDictionary): Deleted.
1338         (WebCore::FontFace::create): Updated to take the descriptors as a struct instead of
1339         a WebCore::Dictionary. Also made that argument optional as specified in the current
1340         specification draft.
1341         (WebCore::FontFace::setFeatureSettings): Updated since setFeatureSettings no longer
1342         has a boolean return value.
1343         (WebCore::FontFace::unicodeRange): Updated for simplified UnicodeRange struct.
1344
1345         * css/FontFace.h: Used pragma once. Removed unneeded includes and forward declarations.
1346         Derived privately from CSSFontFace::Client. Added a FontFace::Descriptors struct and
1347         used it as an argument to the create function as described above.
1348
1349         * css/FontFace.idl: Added FontFaceDescriptors and changed the argument to the
1350         constructor to be an optional FontFaceDescriptors instead of a Dictionary.
1351
1352 2016-05-07  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1353
1354         Rework FontFace promise attribute handling
1355         https://bugs.webkit.org/show_bug.cgi?id=157310
1356
1357         Reviewed by Myles C. Maxfield.
1358
1359         Making promise attributes cached attributes, so that they are created only once.
1360         They are created in the custom binding code and passed to DOM class as needed.
1361
1362         Removed usage of ExecState& from DOM iterators.
1363
1364         No change should be visible from user scripts.
1365
1366         * Modules/fetch/FetchHeaders.cpp:
1367         (WebCore::FetchHeaders::Iterator::next): Removing ExecState parameter.
1368         * Modules/fetch/FetchHeaders.h:
1369         * bindings/js/JSDOMIterator.h:
1370         (WebCore::keyValueIteratorForEach):
1371         (WebCore::JSDOMIterator<JSWrapper>::next): Ditto.
1372         * bindings/js/JSDOMPromise.cpp:
1373         (WebCore::DeferredWrapper::promise): Removed deferred() and added access to promise directly.
1374         * bindings/js/JSDOMPromise.h:
1375         * bindings/js/JSFontFaceCustom.cpp:
1376         (WebCore::JSFontFace::loaded): Using cached attribute to call FontFace::loaded only once.
1377         * bindings/js/JSFontFaceSetCustom.cpp:
1378         (WebCore::JSFontFaceSet::ready): Using cached attribute to call FontFaceSet::ready only once.
1379         * css/CSSFontFace.cpp:
1380         (WebCore::CSSFontFace::wrapper): Removing ExecState parameter.
1381         * css/CSSFontFace.h:
1382         * css/FontFace.cpp:
1383         (WebCore::FontFace::create): Ditto.
1384         (WebCore::FontFace::FontFace): Ditto.
1385         (WebCore::FontFace::fontStateChanged): Updating promise handling.
1386         (WebCore::FontFace::registerLoaded): Resolving/rejecting promise if backing CSSFontFace loading is ended.
1387         (WebCore::FontFace::load): Calling backing load.
1388         * css/FontFace.h:
1389         * css/FontFaceSet.cpp:
1390         (WebCore::FontFaceSet::Iterator::next): Removing ExecState parameter.
1391         (WebCore::FontFaceSet::load): Removing ExecState and ExceptionCode parameter.
1392         (WebCore::FontFaceSet::registerReady): Resolving promise if ready otherwise storing it for resolving it later.
1393         (WebCore::FontFaceSet::completedLoading): Resolving promise if any is stored.
1394         (WebCore::FontFaceSet::create): Deleted.
1395         * css/FontFaceSet.h:
1396         * css/FontFaceSet.idl:
1397
1398 2016-05-07  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1399
1400         Fix an incorrect usage of OS(DARWIN) with PLATFORM(COCOA)
1401         https://bugs.webkit.org/show_bug.cgi?id=157167
1402
1403         Reviewed by Myles C. Maxfield.
1404
1405         * platform/graphics/FontPlatformData.h:
1406         (WebCore::FontPlatformData::hash):
1407
1408 2016-05-07  Joanmarie Diggs  <jdiggs@igalia.com>
1409
1410         REGRESSION(r196222): [AX][GTK] accessibility/gtk/caret-offsets.html failing
1411         https://bugs.webkit.org/show_bug.cgi?id=153956
1412
1413         Reviewed by Chris Fleizach.
1414
1415         The reason the test began failing is that it was checking the new caret offset
1416         synchronously. For most of the test cases, this was not a problem. But when the
1417         caret was moved out of a focused link, the focus change (and associated repainting)
1418         delayed the caret-moved event long enough to cause the associated test case to fail.
1419         The test now uses shouldBecomeEqualToString() instead of shouldBeEqualToString().
1420
1421         The test also had a supposedly-correct expectation which was wrong: When moving the
1422         caret to a valid accessible offset, the caret-moved event should be for that offset.
1423         This was not the case for the list item test case because emitTextSelectionChange()
1424         was not adjusting the offset for the RenderListMarker, the text of which is exposed
1425         as part of the ATK_ROLE_LIST_ITEM object. This bug was also fixed and the test case
1426         updated accordingly.
1427
1428         No new tests are needed. The previously-failing test is now passing.
1429
1430         * editing/atk/FrameSelectionAtk.cpp:
1431         (WebCore::emitTextSelectionChange):
1432
1433 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1434
1435         Rename HitTestRequest DisallowShadowContent to DisallowUserAgentShadowContent
1436         https://bugs.webkit.org/show_bug.cgi?id=157447
1437
1438         Reviewed by Ryosuke Niwa.
1439
1440         HitTesting is intended to reach nodes inside shadow content. This property
1441         on the HitTestRequest is intended to avoid hit testing in UserAgent shadow
1442         content. Rename the enum value, and cascading methods for clarity.
1443
1444         * html/MediaElementSession.cpp:
1445         (WebCore::isMainContent):
1446         * page/EventHandler.cpp:
1447         (WebCore::EventHandler::eventMayStartDrag):
1448         (WebCore::EventHandler::updateSelectionForMouseDrag):
1449         (WebCore::EventHandler::hitTestResultAtPoint):
1450         (WebCore::EventHandler::handleMousePressEvent):
1451         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1452         (WebCore::EventHandler::mouseMoved):
1453         (WebCore::EventHandler::handleMouseMoveEvent):
1454         (WebCore::EventHandler::handleMouseReleaseEvent):
1455         (WebCore::EventHandler::handleMouseForceEvent):
1456         (WebCore::EventHandler::updateDragAndDrop):
1457         (WebCore::EventHandler::isInsideScrollbar):
1458         (WebCore::EventHandler::sendContextMenuEvent):
1459         (WebCore::EventHandler::sendContextMenuEventForKey):
1460         (WebCore::EventHandler::hoverTimerFired):
1461         (WebCore::EventHandler::dragSourceEndedAt):
1462         (WebCore::EventHandler::handleDrag):
1463         (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
1464         * page/EventHandler.h:
1465         * page/FocusController.cpp:
1466         (WebCore::updateFocusCandidateIfNeeded):
1467         * rendering/HitTestRequest.h:
1468         (WebCore::HitTestRequest::HitTestRequest):
1469         (WebCore::HitTestRequest::disallowsUserAgentShadowContent):
1470         (WebCore::HitTestRequest::disallowsShadowContent): Deleted.
1471         * rendering/HitTestResult.cpp:
1472         (WebCore::HitTestResult::setToNonUserAgentShadowAncestor):
1473         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
1474         (WebCore::HitTestResult::setToNonShadowAncestor): Deleted.
1475         * rendering/HitTestResult.h:
1476         * rendering/RenderEmbeddedObject.cpp:
1477         (WebCore::RenderEmbeddedObject::isReplacementObscured):
1478         * rendering/RenderLayer.cpp:
1479         (WebCore::RenderLayer::calculateClipRects):
1480         * rendering/svg/RenderSVGResourceClipper.cpp:
1481         (WebCore::RenderSVGResourceClipper::hitTestClipContent):
1482         * testing/Internals.cpp:
1483         (WebCore::Internals::nodesFromRect):
1484
1485 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1486
1487         Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
1488         https://bugs.webkit.org/show_bug.cgi?id=157446
1489         <rdar://problem/24688447>
1490
1491         Reviewed by Ryosuke Niwa.
1492
1493         * inspector/InspectorDOMAgent.cpp:
1494         (WebCore::InspectorDOMAgent::innerParentNode):
1495         The Inspector backend was informing the frontend that all ShadowRoots
1496         were floating and had no parent. Get the host element for ShadowRoots.
1497
1498         * rendering/HitTestResult.cpp:
1499         (WebCore::moveOutOfUserAgentShadowTree):
1500         (WebCore::HitTestResult::setToNonShadowAncestor):
1501         EventHandler::mouseMoved is calling setToNonShadowAncestor before
1502         notifying Page::chrome / Inspector about the moused over element.
1503         This should be the deepest non-user-agent-shadow node.
1504
1505 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1506
1507         Web Inspector: Misc CommandLineAPI cleanup
1508         https://bugs.webkit.org/show_bug.cgi?id=157450
1509
1510         Reviewed by Ryosuke Niwa.
1511
1512         * inspector/CommandLineAPIModuleSource.js:
1513         (bind):
1514
1515 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
1516
1517         Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
1518         https://bugs.webkit.org/show_bug.cgi?id=157432
1519         rdar://problem/16406720
1520
1521         Reviewed by Dean Jackson.
1522
1523         Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
1524
1525         Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
1526         preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
1527         These two settings are shared with TEXT_AUTOSIZING.
1528
1529         Add a TextAutosizing log channel, which is useful for generated -expected.html results.
1530
1531         Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
1532         without changes.
1533
1534         An implication of this set of changes is that the way clients enable text autosizing
1535         has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
1536         Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
1537         on iPhone only, not iPad.
1538
1539         Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
1540         instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
1541
1542         UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
1543         which will now always return 15, but had no other code that toggled this. So it's safe to just rely
1544         on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
1545
1546         Test: fast/text-autosizing/ios/autosize-width.html
1547
1548         * Configurations/FeatureDefines.xcconfig:
1549         * dom/Document.cpp:
1550         (WebCore::Document::addAutoSizingNode):
1551         * page/FrameView.cpp:
1552         (WebCore::FrameView::layout):
1553         * page/Settings.cpp:
1554         (WebCore::Settings::Settings): Deleted.
1555         (WebCore::Settings::setTextAutosizingEnabled): Deleted.
1556         (WebCore::Settings::setTextAutosizingWindowSizeOverride): Deleted.
1557         * page/Settings.h:
1558         (WebCore::Settings::textAutosizingEnabled): Deleted.
1559         (WebCore::Settings::textAutosizingWindowSizeOverride): Deleted.
1560         * page/Settings.in:
1561         * page/cocoa/SettingsCocoa.mm:
1562         (WebCore::Settings::defaultMinimumZoomFontSize):
1563         (WebCore::Settings::defaultTextAutosizingEnabled):
1564         * platform/Logging.h:
1565         * rendering/RenderBlockFlow.cpp:
1566         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
1567         * rendering/RenderElement.cpp:
1568         (WebCore::includeNonFixedHeight):
1569         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
1570         (WebCore::RenderElement::resetTextAutosizing):
1571         * rendering/RenderElement.h:
1572         * rendering/RenderObject.cpp:
1573         (WebCore::includeNonFixedHeight): Deleted.
1574         (WebCore::RenderObject::adjustComputedFontSizesOnBlocks): Deleted.
1575         (WebCore::RenderObject::resetTextAutosizing): Deleted.
1576         * rendering/RenderObject.h:
1577         * rendering/TextAutoSizing.cpp:
1578         (WebCore::TextAutoSizingValue::adjustNodeSizes):
1579         * testing/InternalSettings.cpp:
1580         (WebCore::InternalSettings::Backup::Backup):
1581         (WebCore::InternalSettings::Backup::restoreTo):
1582         (WebCore::InternalSettings::setTextAutosizingEnabled):
1583         (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
1584         * testing/InternalSettings.h:
1585
1586 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1587
1588         Web Inspector: Console: Variables defined with let/const aren't accessible outside of console's scope
1589         https://bugs.webkit.org/show_bug.cgi?id=150752
1590         <rdar://problem/23343385>
1591
1592         Reviewed by Mark Lam.
1593
1594         Test: inspector/runtime/evaluate-CommandLineAPI.html
1595
1596         * inspector/CommandLineAPIModuleSource.js:
1597         (bind):
1598         (this.member.toString):
1599         (CommandLineAPI):
1600         (CommandLineAPIImpl.prototype):
1601         (slice): Deleted.
1602         (bound): Deleted.
1603         (bound.toString): Deleted.
1604         (inScopeVariables): Deleted.
1605         (customToStringMethod): Deleted.
1606         Simplify now that we don't need to do our own variable shadow checking.
1607
1608 2016-05-06  Tim Horton  <timothy_horton@apple.com>
1609
1610         <attachment> element should understand UTIs
1611         https://bugs.webkit.org/show_bug.cgi?id=157425
1612         <rdar://problem/25585401>
1613
1614         Reviewed by Anders Carlsson.
1615
1616         UTIs are often much more specific than MIME types, so we should allow
1617         clients of <attachment> to use them to get more accurate icons.
1618
1619         Test: fast/attachment/attachment-uti.html
1620
1621         * platform/graphics/Icon.h:
1622         * platform/graphics/mac/IconMac.mm:
1623         (WebCore::Icon::createIconForMIMEType): Deleted.
1624         Remove the now-unused createIconForMIMEType.
1625
1626         * platform/network/mac/UTIUtilities.h:
1627         * platform/network/mac/UTIUtilities.mm:
1628         (WebCore::isDeclaredUTI):
1629         Expose UTTypeIsDeclared as isDeclaredUTI.
1630
1631         * rendering/RenderThemeIOS.mm:
1632         (WebCore::iconForAttachment):
1633         * rendering/RenderThemeMac.mm:
1634         (WebCore::iconForAttachment):
1635         If the attachment's type is a UTI, request the icon for it directly.
1636         If it's a MIME type, convert to a UTI before requesting.
1637
1638 2016-05-06  Chris Dumez  <cdumez@apple.com>
1639
1640         Clean up converting from JSValue to float / double in the bindings generator
1641         https://bugs.webkit.org/show_bug.cgi?id=157407
1642
1643         Reviewed by Darin Adler.
1644
1645         Clean up converting from JSValue to float / double in the bindings generator:
1646         - Handle all aspects of converting to float / double inside JSValueToNative()
1647           instead of relying partly on the call sites.
1648         - Add a build<>() template function to JSDOMBuild.h that is now
1649           called from the bindings to convert to float / double and deal with
1650           non-finite values.
1651         - Provide a better message with the TypeError that is thrown for non-finite
1652           values.
1653
1654         No new tests, rebaselined existing tests.
1655
1656         * bindings/js/JSDOMBinding.cpp:
1657         (WebCore::throwSequenceTypeError):
1658         (WebCore::throwNonFiniteTypeError):
1659         * bindings/js/JSDOMBinding.h:
1660         * bindings/js/JSDOMBuild.h:
1661         (WebCore::build):
1662         * bindings/scripts/CodeGenerator.pm:
1663         (IsFloatingPointType):
1664         * bindings/scripts/CodeGeneratorJS.pm:
1665         (JSValueToNative):
1666         (GenerateImplementation): Deleted.
1667         (GenerateParametersCheck): Deleted.
1668         (GenerateReturnParameters): Deleted.
1669         * bindings/scripts/test/JS/JSTestObj.cpp:
1670         (WebCore::setJSTestObjStrictFloat):
1671         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
1672         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
1673         (WebCore::jsTestObjPrototypeFunctionStrictFunction):
1674         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1675         (WebCore::jsTestObjPrototypeFunctionAny):
1676         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
1677         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
1678         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1679         (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
1680
1681 2016-05-06  Dean Jackson  <dino@apple.com>
1682
1683         Regions, Shapes and Tracks don't need runtime features
1684         https://bugs.webkit.org/show_bug.cgi?id=157426
1685         <rdar://problem/26146262>
1686
1687         Reviewed by Simon Fraser.
1688
1689         The following RuntimeEnabledFeatures can be removed since
1690         we have no need to disable them (they are stable and have
1691         shipped for a while):
1692         - CSS Regions
1693         - CSS Shapes
1694         - Media tracks
1695
1696         * bindings/generic/RuntimeEnabledFeatures.cpp:
1697         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Deleted.
1698         * bindings/generic/RuntimeEnabledFeatures.h:
1699         (WebCore::RuntimeEnabledFeatures::setCSSShapesEnabled): Deleted.
1700         (WebCore::RuntimeEnabledFeatures::cssShapesEnabled): Deleted.
1701         (WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled): Deleted.
1702         (WebCore::RuntimeEnabledFeatures::cssRegionsEnabled): Deleted.
1703         (WebCore::RuntimeEnabledFeatures::setCSSCompositingEnabled): Deleted.
1704         (WebCore::RuntimeEnabledFeatures::cssCompositingEnabled): Deleted.
1705         (WebCore::RuntimeEnabledFeatures::webkitVideoTrackEnabled): Deleted.
1706         (WebCore::RuntimeEnabledFeatures::setWebkitVideoTrackEnabled): Deleted.
1707         * css/CSSParser.cpp:
1708         (WebCore::isSimpleLengthPropertyID):
1709         (WebCore::isValidKeywordPropertyAndValue):
1710         (WebCore::CSSParser::parseValue):
1711         (WebCore::CSSParser::parseFillProperty):
1712         (WebCore::CSSParser::createRegionRule):
1713         (WebCore::CSSParserContext::CSSParserContext): Deleted.
1714         (WebCore::operator==): Deleted.
1715         (WebCore::CSSParser::parseShapeProperty): Deleted.
1716         (WebCore::CSSParser::cssRegionsEnabled): Deleted.
1717         (WebCore::CSSParser::cssCompositingEnabled): Deleted.
1718         (WebCore::CSSParser::parseFlowThread): Deleted.
1719         (WebCore::CSSParser::parseRegionThread): Deleted.
1720         * css/CSSParser.h:
1721         * css/CSSParserMode.h:
1722         * dom/Document.cpp:
1723         (WebCore::Document::webkitGetNamedFlows):
1724         (WebCore::Document::cssRegionsEnabled): Deleted.
1725         (WebCore::Document::cssCompositingEnabled): Deleted.
1726         * dom/Document.h:
1727         * dom/Element.cpp:
1728         (WebCore::Element::unregisterNamedFlowContentElement):
1729         (WebCore::Element::webkitRegionOverset):
1730         (WebCore::Element::webkitGetRegionFlowRanges): Deleted.
1731         * html/HTMLMediaElement.cpp:
1732         (WebCore::HTMLMediaElement::scheduleDelayedAction):
1733         (WebCore::HTMLMediaElement::pendingActionTimerFired):
1734         (WebCore::HTMLMediaElement::prepareForLoad):
1735         (WebCore::HTMLMediaElement::loadInternal):
1736         (WebCore::HTMLMediaElement::setReadyState):
1737         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
1738         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1739         (WebCore::HTMLMediaElement::userCancelledLoad):
1740         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
1741         (WebCore::HTMLMediaElement::hasClosedCaptions):
1742         (WebCore::HTMLMediaElement::setClosedCaptionsVisible):
1743         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
1744         (WebCore::HTMLMediaElement::finishParsingChildren): Deleted.
1745         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Deleted.
1746         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Deleted.
1747         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Deleted.
1748         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Deleted.
1749         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Deleted.
1750         (WebCore::HTMLMediaElement::addAudioTrack): Deleted.
1751         (WebCore::HTMLMediaElement::addTextTrack): Deleted.
1752         (WebCore::HTMLMediaElement::addVideoTrack): Deleted.
1753         (WebCore::HTMLMediaElement::removeAudioTrack): Deleted.
1754         (WebCore::HTMLMediaElement::removeTextTrack): Deleted.
1755         (WebCore::HTMLMediaElement::removeVideoTrack): Deleted.
1756         (WebCore::HTMLMediaElement::audioTracks): Deleted.
1757         (WebCore::HTMLMediaElement::textTracks): Deleted.
1758         (WebCore::HTMLMediaElement::videoTracks): Deleted.
1759         (WebCore::HTMLMediaElement::didAddTextTrack): Deleted.
1760         (WebCore::HTMLMediaElement::didRemoveTextTrack): Deleted.
1761         * html/HTMLTrackElement.cpp:
1762         (WebCore::HTMLTrackElement::parseAttribute):
1763         (WebCore::HTMLTrackElement::scheduleLoad): Deleted.
1764         (WebCore::HTMLTrackElement::canLoadURL): Deleted.
1765         * rendering/RenderBlockFlow.cpp:
1766         (WebCore::RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded):
1767         * testing/InternalSettings.cpp:
1768         (WebCore::InternalSettings::Backup::Backup):
1769         (WebCore::InternalSettings::Backup::restoreTo): Deleted.
1770         (WebCore::InternalSettings::setCSSShapesEnabled): Deleted.
1771         * testing/InternalSettings.h:
1772         * testing/InternalSettings.idl:
1773
1774 2016-05-06  Brady Eidson  <beidson@apple.com>
1775
1776         Modern IDB (Workers): Start running a lot of the workers tests.
1777         https://bugs.webkit.org/show_bug.cgi?id=157424
1778
1779         Reviewed by Sam Weinig.
1780
1781         No new tests (Covered by enabling a whole bunch of existing tests).
1782
1783         * Modules/indexeddb/IDBDatabase.cpp:
1784         (WebCore::IDBDatabase::stop): Call removeAllEventListeners() to clean up the Worker VM
1785           before it shuts down.
1786
1787         * Modules/indexeddb/IDBRequest.cpp:
1788         (WebCore::IDBRequest::stop): Call removeAllEventListeners()
1789
1790         * Modules/indexeddb/IDBTransaction.cpp:
1791         (WebCore::IDBTransaction::IDBTransaction): Initialize with the correct VM.
1792         (WebCore::IDBTransaction::stop): Call removeAllEventListeners()
1793         (WebCore::IDBTransaction::operationDidComplete):
1794
1795         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1796         (WebCore::IDBClient::IDBConnectionProxy::takeIDBOpenDBRequest):
1797         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): Don't take the request from
1798           the map, but rather let the request take itself from its appropriate thread.
1799         * Modules/indexeddb/client/IDBConnectionProxy.h:
1800
1801         * Modules/indexeddb/client/TransactionOperation.h:
1802         (WebCore::IDBClient::TransactionOperation::completed): Rework clearing out the completion 
1803           handler, as the handler itself might hold the last reference to `this`.
1804
1805         * page/SecurityOrigin.h:
1806         (WebCore::SecurityOrigin::hasUniversalAccess):
1807
1808         * workers/WorkerGlobalScope.cpp:
1809         (WebCore::WorkerGlobalScope::WorkerGlobalScope): If the parent context's SecurityOrigin had
1810           universal access, grant it to this one.
1811
1812 2016-05-06  Ryosuke Niwa  <rniwa@webkit.org>
1813
1814         FKA: No way to get focus from DOM to shadow DOM components (Was: HTML5 media controls not keyboard accessible)
1815         https://bugs.webkit.org/show_bug.cgi?id=117857
1816
1817         Reviewed by Jer Noble.
1818
1819         The bug was caused by hasCustomFocusLogic returning true on media elements.
1820
1821         Fix the bug by removing this function so that FocusController will walk into the shadow tree of media elements
1822         to look for focusable elements. This will allow AT such as Voice Over to iterate through controls.
1823
1824         We don't seem to draw focus rings inside the media elements but that could be tweaked in a separate patch.
1825
1826         Test: media/tab-focus-inside-media-elements.html
1827
1828         * html/HTMLMediaElement.cpp:
1829         (WebCore::HTMLMediaElement::hasCustomFocusLogic): Deleted.
1830         * html/HTMLMediaElement.h:
1831
1832 2016-05-06  Anders Carlsson  <andersca@apple.com>
1833
1834         Tidy up the LinkRelAttribute code
1835         https://bugs.webkit.org/show_bug.cgi?id=157429
1836
1837         Reviewed by Sam Weinig.
1838
1839         Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
1840         Remove the InvalidIcon enum declaration and use WTF::Optional instead.
1841
1842         * WebCore.xcodeproj/project.pbxproj:
1843         * dom/IconURL.h: Removed.
1844         * html/HTMLLinkElement.cpp:
1845         (WebCore::HTMLLinkElement::iconType):
1846         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
1847         * html/HTMLLinkElement.h:
1848         * html/LinkRelAttribute.cpp:
1849         (WebCore::LinkRelAttribute::LinkRelAttribute):
1850         * html/LinkRelAttribute.h:
1851         * html/parser/HTMLPreloadScanner.cpp:
1852         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
1853         * loader/FrameLoader.h:
1854         * loader/FrameLoaderClient.h:
1855         * loader/icon/IconController.cpp:
1856         (WebCore::iconFromLinkElements):
1857
1858 2016-05-06  Jer Noble  <jer.noble@apple.com>
1859
1860         Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
1861         https://bugs.webkit.org/show_bug.cgi?id=157404
1862         <rdar://problem/26016802>
1863
1864         Reviewed by Eric Carlson.
1865
1866         Test: media/audio-playback-restriction-play-muted.html
1867
1868         Add element.muted() as a critera of whether playback is permitted when
1869         RequireUserGestureForAudioRateChange is set. Also, make sure to re-evaluate whether the
1870         element should be playing when muted is changed without a user gesture.
1871
1872         * html/HTMLMediaElement.cpp:
1873         (WebCore::HTMLMediaElement::setMuted):
1874         * html/MediaElementSession.cpp:
1875         (WebCore::MediaElementSession::playbackPermitted):
1876
1877 2016-05-06  Brent Fulgham  <bfulgham@apple.com>
1878
1879         Don't use invalidated ResourceLoadStatistics iterators
1880         https://bugs.webkit.org/show_bug.cgi?id=157412
1881         <rdar://problem/26133153>
1882
1883         Reviewed by Chris Dumez.
1884
1885         ResourceLoadObserver::logFrameNavigation was using references bound to the 'value'
1886         member of iterators from the ResourceLoadStatistics HashMap. When new entries were
1887         added, these iterators were invalidated causing the references to refer to invalid
1888         memory.
1889
1890         Renamed 'resourceStatisticsForPrimaryDomain' to 'ensureResourceStatisticsForPrimaryDomain'
1891         to clarify that it may mutate the underlying HashMap, thereby invalidating any
1892         existing iterators.
1893
1894         * loader/ResourceLoadObserver.cpp:
1895         (WebCore::ResourceLoadObserver::logFrameNavigation): Protect against HashMap
1896         elements being copied/moved when new intries are added.
1897         * loader/ResourceLoadStatisticsStore.cpp:
1898         (WebCore::ResourceLoadStatisticsStore::setResourceStatisticsForPrimaryDomain): Added.
1899         * loader/ResourceLoadStatisticsStore.h:
1900
1901 2016-05-06  Manuel Rego Casasnovas  <rego@igalia.com>
1902
1903         [css-grid] Unprefix CSS Grid Layout properties
1904         https://bugs.webkit.org/show_bug.cgi?id=157137
1905
1906         Reviewed by Simon Fraser.
1907
1908         Remove "-webkit" prefix from all the grid layout properties,
1909         including the display value.
1910         Update the source code to remove the prefix where it was used too.
1911
1912         * css/CSSComputedStyleDeclaration.cpp:
1913         (WebCore::isLayoutDependent):
1914         (WebCore::ComputedStyleExtractor::propertyValue):
1915         * css/CSSParser.cpp:
1916         (WebCore::isSimpleLengthPropertyID):
1917         (WebCore::isValidKeywordPropertyAndValue):
1918         (WebCore::CSSParser::parseValue):
1919         (WebCore::CSSParser::parseGridGapShorthand):
1920         (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
1921         (WebCore::CSSParser::parseGridTemplateShorthand):
1922         (WebCore::CSSParser::parseGridShorthand):
1923         (WebCore::CSSParser::parseGridAreaShorthand):
1924         * css/CSSPrimitiveValueMappings.h:
1925         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1926         * css/CSSPropertyNames.in:
1927         * css/CSSValueKeywords.in:
1928         * css/StyleBuilderCustom.h:
1929         (WebCore::StyleBuilderCustom::applyInitialGridTemplateAreas):
1930         (WebCore::StyleBuilderCustom::applyInheritGridTemplateAreas):
1931         (WebCore::StyleBuilderCustom::applyValueGridTemplateAreas):
1932         (WebCore::StyleBuilderCustom::applyInitialGridTemplateColumns):
1933         (WebCore::StyleBuilderCustom::applyInheritGridTemplateColumns):
1934         (WebCore::StyleBuilderCustom::applyValueGridTemplateColumns):
1935         (WebCore::StyleBuilderCustom::applyInitialGridTemplateRows):
1936         (WebCore::StyleBuilderCustom::applyInheritGridTemplateRows):
1937         (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
1938         * css/StyleProperties.cpp:
1939         (WebCore::StyleProperties::getPropertyValue):
1940
1941 2016-05-06  Nan Wang  <n_wang@apple.com>
1942
1943         AX: <attachment> element should have a replacement character
1944         https://bugs.webkit.org/show_bug.cgi?id=157406
1945
1946         Reviewed by Chris Fleizach.
1947
1948         Make sure attachment element is considered as a replaced node.
1949
1950         Test: accessibility/mac/attachment-element-replacement-character.html
1951
1952         * editing/TextIterator.cpp:
1953         (WebCore::isRendererReplacedElement):
1954
1955 2016-05-06  Nan Wang  <n_wang@apple.com>
1956
1957         AX: String for document range is empty if end visible position anchors to a ignored replaced node
1958         https://bugs.webkit.org/show_bug.cgi?id=157403
1959
1960         Reviewed by Chris Fleizach.
1961
1962         The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
1963         to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in 
1964         such case.
1965
1966         Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
1967
1968         * accessibility/AXObjectCache.cpp:
1969         (WebCore::characterOffsetsInOrder):
1970         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
1971         (WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
1972
1973 2016-05-05  David Kilzer  <ddkilzer@apple.com>
1974
1975         [iOS] WebCore does not need to link to CoreAudio, GraphicsServices, SystemConfiguration frameworks
1976         <https://webkit.org/b/157413>
1977         <rdar://problem/26104189>
1978
1979         Reviewed by Gavin Barraclough.
1980
1981         * Configurations/WebCore.xcconfig:
1982         (OTHER_LDFLAGS_BASE_ios): Remove "-framework GraphicsServices".
1983         (OTHER_LDFLAGS_PLATFORM[sdk=macosx*]): Add "-framework CoreAudio"
1984         and "-framework SystemConfiguration".
1985         * WebCore.xcodeproj/project.pbxproj: Remove CoreAudio.framework
1986         and SystemConfiguration.framework from the project file.
1987
1988 2016-05-05  Brady Eidson  <beidson@apple.com>
1989
1990         Modern IDB (Workers): Get everything to the right threads.
1991         https://bugs.webkit.org/show_bug.cgi?id=157398
1992
1993         Reviewed by Alex Christensen.
1994
1995         No new tests (No current change in behavior, will be tested as bug 149953 is resolved, enabling IDB in workers).
1996
1997         * dom/ScriptExecutionContext.h:
1998         (WebCore::ScriptExecutionContext::postCrossThreadTask): Add a helper to post a CrossThreadTask to a context.
1999                 
2000         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2001         (WebCore::IDBClient::performCallbackOnCorrectThread): Helper to perform an IDB callback on either the main thread
2002           or Worker thread as necessary.
2003         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2004         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2005         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2006         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2007         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2008         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2009         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2010         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2011         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2012         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2013         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2014         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2015         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2016         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2017         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2018         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2019         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2020         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2021         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2022         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2023         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2024         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2025         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2026         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2027         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2028         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2029         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2030         (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks):
2031         (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks):
2032         * Modules/indexeddb/client/IDBConnectionProxy.h:
2033         (WebCore::IDBClient::IDBConnectionProxy::callConnectionOnMainThread): Helper to marshall IDB operations from the
2034           Worker thread to the main thread.
2035         (WebCore::IDBClient::IDBConnectionProxy::postMainThreadTask):
2036
2037         * Modules/indexeddb/IDBTransaction.cpp:
2038         (WebCore::IDBTransaction::originThreadID):
2039         * Modules/indexeddb/IDBTransaction.h:
2040         
2041         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2042         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2043         * Modules/indexeddb/client/IDBConnectionToServer.h:
2044
2045         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2046
2047         * Modules/indexeddb/client/TransactionOperation.cpp:
2048         (WebCore::IDBClient::TransactionOperation::scriptExecutionContext):
2049         * Modules/indexeddb/client/TransactionOperation.h:
2050
2051         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2052         (WebCore::nextClientResourceNumber):
2053
2054         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2055         (WebCore::InProcessIDBServer::putOrAdd):
2056         * Modules/indexeddb/shared/InProcessIDBServer.h:
2057
2058 2016-05-05  Dean Jackson  <dino@apple.com>
2059
2060         4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
2061         https://bugs.webkit.org/show_bug.cgi?id=157402
2062         <rdar://problem/26131142>
2063
2064         Reviewed by Simon Fraser.
2065
2066         Noel and Tab from Google alerted me to the fact I broke some legacy
2067         HTML color attributes when I added support for 4 and 8 digit hex colors
2068         in CSS. The fix is to favor the "crazy" parsing unless we know it is a 3 or 6
2069         digit hex value (in which case we try the CSS algorithm first).
2070
2071         Covered by reverting an existing test.
2072
2073         * html/HTMLElement.cpp:
2074         (WebCore::HTMLElement::addHTMLColorToStyle):
2075
2076 2016-05-05  Brady Eidson  <beidson@apple.com>
2077
2078         Modern IDB (Workers): Remove the need for IDBConnectionProxy to expose its IDBConnectionToServer.
2079         https://bugs.webkit.org/show_bug.cgi?id=157394
2080
2081         Reviewed by Alex Christensen.
2082
2083         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2084
2085         * Modules/indexeddb/IDBDatabase.cpp:
2086         (WebCore::IDBDatabase::transaction):
2087         (WebCore::IDBDatabase::fireVersionChangeEvent):
2088         (WebCore::IDBDatabase::dispatchEvent):
2089         * Modules/indexeddb/IDBDatabase.h:
2090         (WebCore::IDBDatabase::serverConnection): Deleted.
2091
2092         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2093         (WebCore::IDBOpenDBRequest::requestCompleted):
2094
2095         * Modules/indexeddb/IDBRequest.cpp:
2096         (WebCore::IDBRequest::IDBRequest):
2097
2098         * Modules/indexeddb/IDBTransaction.cpp:
2099         (WebCore::IDBTransaction::connectionProxy):
2100         (WebCore::IDBTransaction::serverConnection): Deleted.
2101         * Modules/indexeddb/IDBTransaction.h:
2102
2103         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2104         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2105         (WebCore::IDBClient::IDBConnectionProxy::connectionToServer): Deleted.
2106         * Modules/indexeddb/client/IDBConnectionProxy.h:
2107
2108         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2109         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
2110
2111         * Modules/indexeddb/client/TransactionOperation.h:
2112         (WebCore::IDBClient::TransactionOperation::TransactionOperation):
2113
2114         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2115         (WebCore::IDBCursorInfo::IDBCursorInfo):
2116
2117         * Modules/indexeddb/shared/IDBRequestData.cpp:
2118         (WebCore::IDBRequestData::IDBRequestData):
2119
2120         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2121         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2122         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2123
2124         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
2125         (WebCore::IDBTransactionInfo::clientTransaction):
2126         * Modules/indexeddb/shared/IDBTransactionInfo.h:
2127
2128 2016-05-05  Commit Queue  <commit-queue@webkit.org>
2129
2130         Unreviewed, rolling out r200479.
2131         https://bugs.webkit.org/show_bug.cgi?id=157397
2132
2133         A LayoutTest added with this change is crashing on Mac WK1
2134         test runs. (Requested by ryanhaddad on #webkit).
2135
2136         Reverted changeset:
2137
2138         "For keyboard users, activating a fragment URL should transfer
2139         focus and caret to the destination"
2140         https://bugs.webkit.org/show_bug.cgi?id=116046
2141         http://trac.webkit.org/changeset/200479
2142
2143 2016-05-05  Chris Dumez  <cdumez@apple.com>
2144
2145         CORS check is sometimes incorrectly failing for media loads
2146         https://bugs.webkit.org/show_bug.cgi?id=157370
2147         <rdar://problem/26071607>
2148
2149         Reviewed by Alex Christensen.
2150
2151         When the media library is issuing a conditional request for a media
2152         element that had the 'crossorigin' attribute, we would fail the CORS
2153         check and log an error if the server were to respond with a "304 Not
2154         Modified" response because the 304 response usually does not have
2155         the necessary "Access-Control-Allow-Origin: *" header (At least for
2156         Apache) and we cannot use the cached headers either since WebKit
2157         does not have them.
2158
2159         To work around the problem in the short term, we now drop the
2160         conditional headers from the request that the media library is
2161         giving us when the media element has the 'crossorigin' attribute
2162         set. As a result, the server will never respond with a 304 and we
2163         will be able to do a CORS check on the full (e.g. 206) response.
2164
2165         In the long term, we need to deal with this better as this means
2166         we may sometimes fail to reuse cached data. For now, this is only
2167         potentially inefficient in the cases that were broken (i.e. no
2168         video would play and we would log an error in the console).
2169
2170         Test: http/tests/security/video-cross-origin-caching.html
2171
2172         * loader/MediaResourceLoader.cpp:
2173         (WebCore::MediaResourceLoader::requestResource):
2174         Make the request unconditional if the media element has the
2175         'crossorigin' attribute set.
2176
2177         * platform/network/ResourceRequestBase.cpp:
2178         (WebCore::ResourceRequestBase::isConditional):
2179         (WebCore::ResourceRequestBase::makeUnconditional):
2180         When fixing the bug above, I noticed that those method do not do
2181         the right thing if the m_httpHeaderFields data member has not
2182         been populated yet. m_httpHeaderFields is lazily initialized so
2183         we need to call updateResourceRequest() before using it.
2184
2185 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2186
2187         Stop traversing at the container block when computing RTL inline static distance.
2188         https://bugs.webkit.org/show_bug.cgi?id=157349
2189         <rdar://problem/25994087>
2190
2191         Reviewed by David Hyatt.
2192
2193         When computing the inline static distance for a child renderer, we start at its enclosing box
2194         and traverse up all the way to the container block.
2195         However when the enclosing box is the ancestor of the container block, we
2196         should just bail out right away since there's no container to use to adjust the position.
2197
2198         Test: fast/multicol/positioned-rtl-column-crash.html
2199
2200         * rendering/RenderBox.cpp:
2201         (WebCore::computeInlineStaticDistance):
2202
2203 2016-05-05  Ada Chan  <adachan@apple.com>
2204
2205         Add WebKitAdditions extension points in media controls related code in RenderThemeMac
2206         https://bugs.webkit.org/show_bug.cgi?id=157390
2207
2208         Reviewed by Anders Carlsson.
2209
2210         * rendering/RenderThemeMac.mm:
2211         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2212         (WebCore::RenderThemeMac::mediaControlsScript):
2213
2214 2016-05-05  Jer Noble  <jer.noble@apple.com>
2215
2216         [WK2] Media controls don't update if controller is created after the interface is created
2217         https://bugs.webkit.org/show_bug.cgi?id=157376
2218
2219         Reviewed by Beth Dakin.
2220
2221         Add getter methods to WebPlaybackSessionModel so that the model's values can be retrieved
2222         if those values were missed before the equivalent WebPlaybackSessionInterface methods were
2223         called. This necessatates a bunch of changes in HTMLMediaElement and related classes to
2224         change PassRefPtr<TimeRanges> types to Ref<TimeRanges> (and one change in TimeRanges itself).
2225         WebPlaybackSessionModelMediaElement can implement these new getter methods by querying the
2226         values from the HTMLMediaElement, something it was doing already, so most of those changes
2227         are simple refactoring.
2228
2229         There's no reason any longer for WebVideoFullscreenModel to inherit from WebPlaybackSessionModel,
2230         so remove that superclass.
2231
2232         In WebPlaybackSessionInterfaceMac, when a new WebPlaybackControlsManager is set, use the new
2233         getter methods on WebPlaybackSessionModel to update the values in the manager.
2234
2235         * html/HTMLMediaElement.cpp:
2236         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2237         (WebCore::HTMLMediaElement::maxBufferedTime):
2238         (WebCore::HTMLMediaElement::played):
2239         (WebCore::HTMLMediaElement::buffered): Deleted.
2240         (WebCore::HTMLMediaElement::seekable): Deleted.
2241         * html/HTMLMediaElement.h:
2242         * html/MediaController.cpp:
2243         (MediaController::buffered):
2244         (MediaController::seekable):
2245         (MediaController::played):
2246         * html/MediaController.h:
2247         * html/MediaControllerInterface.h:
2248         * html/TimeRanges.cpp:
2249         (WebCore::TimeRanges::copy):
2250         * html/TimeRanges.h:
2251         * platform/cocoa/WebPlaybackSessionModel.h:
2252         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2253         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2254         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface):
2255         (WebPlaybackSessionModelMediaElement::updateForEventName):
2256         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
2257         (WebPlaybackSessionModelMediaElement::observedEventNames):
2258         (WebPlaybackSessionModelMediaElement::eventNameAll):
2259         (WebPlaybackSessionModelMediaElement::duration):
2260         (WebPlaybackSessionModelMediaElement::currentTime):
2261         (WebPlaybackSessionModelMediaElement::bufferedTime):
2262         (WebPlaybackSessionModelMediaElement::isPlaying):
2263         (WebPlaybackSessionModelMediaElement::playbackRate):
2264         (WebPlaybackSessionModelMediaElement::seekableRanges):
2265         (WebPlaybackSessionModelMediaElement::canPlayFastReverse):
2266         (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
2267         (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
2268         (WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions):
2269         (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
2270         (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
2271         (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
2272         * platform/cocoa/WebVideoFullscreenModel.h:
2273         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2274         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2275         (WebVideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
2276         (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
2277         (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
2278         (WebVideoFullscreenModelVideoElement::observedEventNames): Deleted.
2279         (WebVideoFullscreenModelVideoElement::eventNameAll): Deleted.
2280         (WebVideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
2281         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
2282         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2283         (WebVideoFullscreenControllerContext::play): Deleted.
2284         (WebVideoFullscreenControllerContext::pause): Deleted.
2285         (WebVideoFullscreenControllerContext::togglePlayState): Deleted.
2286         (WebVideoFullscreenControllerContext::beginScrubbing): Deleted.
2287         (WebVideoFullscreenControllerContext::endScrubbing): Deleted.
2288         (WebVideoFullscreenControllerContext::seekToTime): Deleted.
2289         (WebVideoFullscreenControllerContext::fastSeek): Deleted.
2290         (WebVideoFullscreenControllerContext::beginScanningForward): Deleted.
2291         (WebVideoFullscreenControllerContext::beginScanningBackward): Deleted.
2292         (WebVideoFullscreenControllerContext::endScanning): Deleted.
2293         (WebVideoFullscreenControllerContext::selectAudioMediaOption): Deleted.
2294         (WebVideoFullscreenControllerContext::selectLegibleMediaOption): Deleted.
2295         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2296         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2297         (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2298         (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2299         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2300         (WebCore::timeRangesToArray):
2301         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
2302         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2303         * platform/mac/WebVideoFullscreenInterfaceMac.h:
2304
2305 2016-05-05  Brady Eidson  <beidson@apple.com>
2306
2307         Modern IDB (Workers): Move TransactionOperation management from IDBConnectionToServer to IDBConnectionProxy.
2308         https://bugs.webkit.org/show_bug.cgi?id=157392
2309
2310         Reviewed by Alex Christensen.
2311
2312         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2313
2314         Set up TransactionOperations on the IDBConnectionProxy instead of the IDBConnectionToServer:
2315         * Modules/indexeddb/IDBTransaction.cpp:
2316         (WebCore::IDBTransaction::createObjectStoreOnServer):
2317         (WebCore::IDBTransaction::createIndexOnServer):
2318         (WebCore::IDBTransaction::openCursorOnServer):
2319         (WebCore::IDBTransaction::iterateCursorOnServer):
2320         (WebCore::IDBTransaction::getRecordOnServer):
2321         (WebCore::IDBTransaction::getCountOnServer):
2322         (WebCore::IDBTransaction::deleteRecordOnServer):
2323         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2324         (WebCore::IDBTransaction::putOrAddOnServer):
2325         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2326         (WebCore::IDBTransaction::deleteIndexOnServer):
2327         
2328         IDBConnectionProxy is now the owner of dispatched TransactionOperations:
2329         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2330         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2331         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2332         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2333         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2334         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2335         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2336         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2337         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2338         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2339         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2340         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2341         (WebCore::IDBClient::IDBConnectionProxy::saveOperation):
2342         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2343         * Modules/indexeddb/client/IDBConnectionProxy.h:
2344         
2345         Proxy this in-and-out calls to the ConnectionProxy:
2346         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2347         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
2348         (WebCore::IDBClient::IDBConnectionToServer::didCreateObjectStore):
2349         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
2350         (WebCore::IDBClient::IDBConnectionToServer::didDeleteObjectStore):
2351         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
2352         (WebCore::IDBClient::IDBConnectionToServer::didClearObjectStore):
2353         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
2354         (WebCore::IDBClient::IDBConnectionToServer::didCreateIndex):
2355         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
2356         (WebCore::IDBClient::IDBConnectionToServer::didDeleteIndex):
2357         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2358         (WebCore::IDBClient::IDBConnectionToServer::didPutOrAdd):
2359         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
2360         (WebCore::IDBClient::IDBConnectionToServer::didGetRecord):
2361         (WebCore::IDBClient::IDBConnectionToServer::getCount):
2362         (WebCore::IDBClient::IDBConnectionToServer::didGetCount):
2363         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
2364         (WebCore::IDBClient::IDBConnectionToServer::didDeleteRecord):
2365         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
2366         (WebCore::IDBClient::IDBConnectionToServer::didOpenCursor):
2367         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
2368         (WebCore::IDBClient::IDBConnectionToServer::didIterateCursor):
2369         (WebCore::IDBClient::IDBConnectionToServer::saveOperation): Deleted.
2370         (WebCore::IDBClient::IDBConnectionToServer::completeOperation): Deleted.
2371         * Modules/indexeddb/client/IDBConnectionToServer.h:
2372
2373         - Give TransactionOperation a ThreadIdentifier member
2374         - Privatize most public methods from TransactionOperation
2375         - Make IDBRequestData a friend so it can get at the private methods
2376         * Modules/indexeddb/client/TransactionOperation.h:
2377         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
2378         (WebCore::IDBClient::TransactionOperation::perform):
2379         (WebCore::IDBClient::TransactionOperation::completed):
2380         (WebCore::IDBClient::TransactionOperation::originThreadID):
2381         (WebCore::IDBClient::TransactionOperation::transactionIdentifier):
2382         (WebCore::IDBClient::TransactionOperation::objectStoreIdentifier):
2383         (WebCore::IDBClient::TransactionOperation::indexIdentifier):
2384         (WebCore::IDBClient::TransactionOperation::cursorIdentifier):
2385         (WebCore::IDBClient::TransactionOperation::transaction):
2386         (WebCore::IDBClient::TransactionOperation::indexRecordType):
2387
2388 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2389
2390         Do not attempt to compute min/max width.
2391         https://bugs.webkit.org/show_bug.cgi?id=157320
2392
2393         Reviewed by David Hyatt.
2394
2395         Replaced elements with no intrinsic size (only with ratio) should not call the containing
2396         block to compute the min/max width when the containing block's min/max width
2397         depends on the children's intrinsic size. It could lead to infinite recursion.
2398
2399         Test: fast/replaced/before-content-intrinsic-crash.html
2400
2401         * rendering/RenderBox.cpp:
2402         (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): Unrelated code change.
2403         * rendering/RenderImage.cpp: Unrelated code change.
2404         (WebCore::RenderImage::RenderImage): Deleted.
2405         * rendering/RenderImage.h:
2406         * rendering/RenderReplaced.cpp:
2407         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
2408
2409 2016-05-04  Brady Eidson  <beidson@apple.com>
2410
2411         Modern IDB: Move all IDB DOM object management from IDBConnectionToServer to IDBConnectionProxy.
2412         https://bugs.webkit.org/show_bug.cgi?id=157348
2413
2414         Reviewed by Alex Christensen.
2415
2416         No new tests (Refactor, no change in behavior yet).
2417
2418         This is in-progress IDB-in-Workers code that is isolated enough to land right now.
2419         
2420         The goal is to have IDBConnectionToServer be a main-thread-only object, leaving IDBConnectionProxy
2421         as the threading bridge between the worker thread and the main thread.
2422         
2423         As such, IDBConnectionToServer no longer maintains maps of IDB DOM objects, but instead the proxy
2424         does and guards that access with locks.
2425         
2426         No threading changes takes place in this patch but it does scatter some isMainThread() checks and FIXMEs 
2427         accurately representing where threading changes will take place once I can return to this.
2428         
2429         * Modules/indexeddb/IDBDatabase.cpp:
2430         (WebCore::IDBDatabase::IDBDatabase):
2431         (WebCore::IDBDatabase::~IDBDatabase):
2432         (WebCore::IDBDatabase::maybeCloseInServer):
2433
2434         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2435         (WebCore::IDBOpenDBRequest::dispatchEvent):
2436
2437         * Modules/indexeddb/IDBTransaction.cpp:
2438         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2439         (WebCore::IDBTransaction::commitOnServer):
2440         (WebCore::IDBTransaction::establishOnServer):
2441
2442         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2443         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2444         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2445         (WebCore::IDBClient::IDBConnectionProxy::didOpenDatabase):
2446         (WebCore::IDBClient::IDBConnectionProxy::didDeleteDatabase):
2447         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2448         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2449         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2450         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2451         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2452         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2453         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2454         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2455         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2456         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2457         (WebCore::IDBClient::IDBConnectionProxy::hasRecordOfTransaction):
2458         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2459         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2460         (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection):
2461         (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection):
2462         * Modules/indexeddb/client/IDBConnectionProxy.h:
2463         
2464         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2465         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
2466         (WebCore::IDBClient::IDBConnectionToServer::didDeleteDatabase):
2467         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
2468         (WebCore::IDBClient::IDBConnectionToServer::didOpenDatabase):
2469         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
2470         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
2471         (WebCore::IDBClient::IDBConnectionToServer::didCommitTransaction):
2472         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
2473         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
2474         (WebCore::IDBClient::IDBConnectionToServer::didAbortTransaction):
2475         (WebCore::IDBClient::IDBConnectionToServer::fireVersionChangeEvent):
2476         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
2477         (WebCore::IDBClient::IDBConnectionToServer::didStartTransaction):
2478         (WebCore::IDBClient::IDBConnectionToServer::notifyOpenDBRequestBlocked):
2479         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
2480         (WebCore::IDBClient::IDBConnectionToServer::registerDatabaseConnection): Deleted.
2481         (WebCore::IDBClient::IDBConnectionToServer::unregisterDatabaseConnection): Deleted.
2482         (WebCore::IDBClient::IDBConnectionToServer::hasRecordOfTransaction): Deleted.
2483         * Modules/indexeddb/client/IDBConnectionToServer.h:
2484         
2485         * Modules/indexeddb/shared/IDBRequestData.cpp:
2486         (WebCore::IDBRequestData::IDBRequestData):
2487         * Modules/indexeddb/shared/IDBRequestData.h:
2488         
2489         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2490         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2491         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2492
2493 2016-05-04  Brady Eidson  <beidson@apple.com>
2494
2495         Modern IDB: Add isolatedCopy to a few more objects.
2496         https://bugs.webkit.org/show_bug.cgi?id=157330
2497
2498         Reviewed by Alex Christensen.
2499
2500         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2501
2502         * Modules/indexeddb/shared/IDBRequestData.cpp:
2503         (WebCore::IDBRequestData::IDBRequestData):
2504         (WebCore::IDBRequestData::isolatedCopy):
2505         * Modules/indexeddb/shared/IDBRequestData.h:
2506
2507         * Modules/indexeddb/shared/IDBResultData.cpp:
2508         (WebCore::IDBResultData::IDBResultData):
2509         (WebCore::IDBResultData::isolatedCopy):
2510         * Modules/indexeddb/shared/IDBResultData.h:
2511
2512 2016-05-04  Brady Eidson  <beidson@apple.com>
2513
2514         Modern IDB: Add thread identifiers and assertions to IDB DOM objects.
2515         https://bugs.webkit.org/show_bug.cgi?id=157329
2516
2517         Reviewed by Alex Christensen.
2518
2519         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2520
2521         * Modules/indexeddb/IDBCursor.cpp:
2522         (WebCore::IDBCursor::IDBCursor):
2523         (WebCore::IDBCursor::~IDBCursor):
2524         (WebCore::IDBCursor::sourcesDeleted):
2525         (WebCore::IDBCursor::transaction):
2526         (WebCore::IDBCursor::direction):
2527         (WebCore::IDBCursor::update):
2528         (WebCore::IDBCursor::advance):
2529         (WebCore::IDBCursor::continueFunction):
2530         (WebCore::IDBCursor::uncheckedIterateCursor):
2531         (WebCore::IDBCursor::deleteFunction):
2532         (WebCore::IDBCursor::setGetResult):
2533         
2534         * Modules/indexeddb/IDBDatabase.cpp:
2535         (WebCore::IDBDatabase::~IDBDatabase):
2536         (WebCore::IDBDatabase::hasPendingActivity):
2537         (WebCore::IDBDatabase::name):
2538         (WebCore::IDBDatabase::version):
2539         (WebCore::IDBDatabase::objectStoreNames):
2540         (WebCore::IDBDatabase::createObjectStore):
2541         (WebCore::IDBDatabase::transaction):
2542         (WebCore::IDBDatabase::deleteObjectStore):
2543         (WebCore::IDBDatabase::close):
2544         (WebCore::IDBDatabase::maybeCloseInServer):
2545         (WebCore::IDBDatabase::activeDOMObjectName):
2546         (WebCore::IDBDatabase::canSuspendForDocumentSuspension):
2547         (WebCore::IDBDatabase::stop):
2548         (WebCore::IDBDatabase::startVersionChangeTransaction):
2549         (WebCore::IDBDatabase::didStartTransaction):
2550         (WebCore::IDBDatabase::willCommitTransaction):
2551         (WebCore::IDBDatabase::didCommitTransaction):
2552         (WebCore::IDBDatabase::willAbortTransaction):
2553         (WebCore::IDBDatabase::didAbortTransaction):
2554         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
2555         (WebCore::IDBDatabase::fireVersionChangeEvent):
2556         (WebCore::IDBDatabase::dispatchEvent):
2557         (WebCore::IDBDatabase::didCreateIndexInfo):
2558         (WebCore::IDBDatabase::didDeleteIndexInfo):
2559         * Modules/indexeddb/IDBDatabase.h:
2560         (WebCore::IDBDatabase::originThreadID):
2561         
2562         * Modules/indexeddb/IDBIndex.cpp:
2563         (WebCore::IDBIndex::IDBIndex):
2564         (WebCore::IDBIndex::~IDBIndex):
2565         (WebCore::IDBIndex::name):
2566         (WebCore::IDBIndex::objectStore):
2567         (WebCore::IDBIndex::keyPath):
2568         (WebCore::IDBIndex::unique):
2569         (WebCore::IDBIndex::multiEntry):
2570         (WebCore::IDBIndex::openCursor):
2571         (WebCore::IDBIndex::doCount):
2572         (WebCore::IDBIndex::openKeyCursor):
2573         (WebCore::IDBIndex::doGet):
2574         (WebCore::IDBIndex::doGetKey):
2575         (WebCore::IDBIndex::markAsDeleted):
2576         
2577         * Modules/indexeddb/IDBObjectStore.cpp:
2578         (WebCore::IDBObjectStore::IDBObjectStore):
2579         (WebCore::IDBObjectStore::~IDBObjectStore):
2580         (WebCore::IDBObjectStore::name):
2581         (WebCore::IDBObjectStore::keyPath):
2582         (WebCore::IDBObjectStore::indexNames):
2583         (WebCore::IDBObjectStore::transaction):
2584         (WebCore::IDBObjectStore::autoIncrement):
2585         (WebCore::IDBObjectStore::openCursor):
2586         (WebCore::IDBObjectStore::get):
2587         (WebCore::IDBObjectStore::putOrAdd):
2588         (WebCore::IDBObjectStore::doDelete):
2589         (WebCore::IDBObjectStore::clear):
2590         (WebCore::IDBObjectStore::createIndex):
2591         (WebCore::IDBObjectStore::index):
2592         (WebCore::IDBObjectStore::deleteIndex):
2593         (WebCore::IDBObjectStore::doCount):
2594         (WebCore::IDBObjectStore::markAsDeleted):
2595         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
2596         
2597         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2598         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
2599         (WebCore::IDBOpenDBRequest::onError):
2600         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
2601         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
2602         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
2603         (WebCore::IDBOpenDBRequest::dispatchEvent):
2604         (WebCore::IDBOpenDBRequest::onSuccess):
2605         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
2606         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
2607         (WebCore::IDBOpenDBRequest::requestCompleted):
2608         (WebCore::IDBOpenDBRequest::requestBlocked):
2609         
2610         * Modules/indexeddb/IDBRequest.cpp:
2611         (WebCore::IDBRequest::~IDBRequest):
2612         (WebCore::IDBRequest::errorCode):
2613         (WebCore::IDBRequest::error):
2614         (WebCore::IDBRequest::setSource):
2615         (WebCore::IDBRequest::setVersionChangeTransaction):
2616         (WebCore::IDBRequest::transaction):
2617         (WebCore::IDBRequest::readyState):
2618         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
2619         (WebCore::IDBRequest::sourceIndexIdentifier):
2620         (WebCore::IDBRequest::requestedIndexRecordType):
2621         (WebCore::IDBRequest::eventTargetInterface):
2622         (WebCore::IDBRequest::activeDOMObjectName):
2623         (WebCore::IDBRequest::canSuspendForDocumentSuspension):
2624         (WebCore::IDBRequest::hasPendingActivity):
2625         (WebCore::IDBRequest::stop):
2626         (WebCore::IDBRequest::enqueueEvent):
2627         (WebCore::IDBRequest::dispatchEvent):
2628         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
2629         (WebCore::IDBRequest::setResult):
2630         (WebCore::IDBRequest::setResultToStructuredClone):
2631         (WebCore::IDBRequest::clearResult):
2632         (WebCore::IDBRequest::setResultToUndefined):
2633         (WebCore::IDBRequest::resultCursor):
2634         (WebCore::IDBRequest::willIterateCursor):
2635         (WebCore::IDBRequest::didOpenOrIterateCursor):
2636         (WebCore::IDBRequest::requestCompleted):
2637         (WebCore::IDBRequest::onError):
2638         (WebCore::IDBRequest::onSuccess):
2639         * Modules/indexeddb/IDBRequest.h:
2640         (WebCore::IDBRequest::originThreadID):
2641         
2642         * Modules/indexeddb/IDBTransaction.cpp:
2643         (WebCore::IDBTransaction::IDBTransaction):
2644         (WebCore::IDBTransaction::~IDBTransaction):
2645         (WebCore::IDBTransaction::mode):
2646         (WebCore::IDBTransaction::db):
2647         (WebCore::IDBTransaction::serverConnection):
2648         (WebCore::IDBTransaction::error):
2649         (WebCore::IDBTransaction::objectStore):
2650         (WebCore::IDBTransaction::abortDueToFailedRequest):
2651         (WebCore::IDBTransaction::transitionedToFinishing):
2652         (WebCore::IDBTransaction::abort):
2653         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2654         (WebCore::IDBTransaction::activeDOMObjectName):
2655         (WebCore::IDBTransaction::canSuspendForDocumentSuspension):
2656         (WebCore::IDBTransaction::hasPendingActivity):
2657         (WebCore::IDBTransaction::stop):
2658         (WebCore::IDBTransaction::isActive):
2659         (WebCore::IDBTransaction::isFinishedOrFinishing):
2660         (WebCore::IDBTransaction::addRequest):
2661         (WebCore::IDBTransaction::removeRequest):
2662         (WebCore::IDBTransaction::scheduleOperation):
2663         (WebCore::IDBTransaction::scheduleOperationTimer):
2664         (WebCore::IDBTransaction::operationTimerFired):
2665         (WebCore::IDBTransaction::commit):
2666         (WebCore::IDBTransaction::commitOnServer):
2667         (WebCore::IDBTransaction::finishAbortOrCommit):
2668         (WebCore::IDBTransaction::didStart):
2669         (WebCore::IDBTransaction::notifyDidAbort):
2670         (WebCore::IDBTransaction::didAbort):
2671         (WebCore::IDBTransaction::didCommit):
2672         (WebCore::IDBTransaction::fireOnComplete):
2673         (WebCore::IDBTransaction::fireOnAbort):
2674         (WebCore::IDBTransaction::enqueueEvent):
2675         (WebCore::IDBTransaction::dispatchEvent):
2676         (WebCore::IDBTransaction::createObjectStore):
2677         (WebCore::IDBTransaction::createObjectStoreOnServer):
2678         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
2679         (WebCore::IDBTransaction::createIndex):
2680         (WebCore::IDBTransaction::createIndexOnServer):
2681         (WebCore::IDBTransaction::didCreateIndexOnServer):
2682         (WebCore::IDBTransaction::requestOpenCursor):
2683         (WebCore::IDBTransaction::doRequestOpenCursor):
2684         (WebCore::IDBTransaction::openCursorOnServer):
2685         (WebCore::IDBTransaction::didOpenCursorOnServer):
2686         (WebCore::IDBTransaction::iterateCursor):
2687         (WebCore::IDBTransaction::iterateCursorOnServer):
2688         (WebCore::IDBTransaction::didIterateCursorOnServer):
2689         (WebCore::IDBTransaction::requestGetRecord):
2690         (WebCore::IDBTransaction::requestGetValue):
2691         (WebCore::IDBTransaction::requestGetKey):
2692         (WebCore::IDBTransaction::requestIndexRecord):
2693         (WebCore::IDBTransaction::getRecordOnServer):
2694         (WebCore::IDBTransaction::didGetRecordOnServer):
2695         (WebCore::IDBTransaction::requestCount):
2696         (WebCore::IDBTransaction::getCountOnServer):
2697         (WebCore::IDBTransaction::didGetCountOnServer):
2698         (WebCore::IDBTransaction::requestDeleteRecord):
2699         (WebCore::IDBTransaction::deleteRecordOnServer):
2700         (WebCore::IDBTransaction::didDeleteRecordOnServer):
2701         (WebCore::IDBTransaction::requestClearObjectStore):
2702         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2703         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
2704         (WebCore::IDBTransaction::requestPutOrAdd):
2705         (WebCore::IDBTransaction::putOrAddOnServer):
2706         (WebCore::IDBTransaction::didPutOrAddOnServer):
2707         (WebCore::IDBTransaction::deleteObjectStore):
2708         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2709         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
2710         (WebCore::IDBTransaction::deleteIndex):
2711         (WebCore::IDBTransaction::deleteIndexOnServer):
2712         (WebCore::IDBTransaction::didDeleteIndexOnServer):
2713         (WebCore::IDBTransaction::operationDidComplete):
2714         (WebCore::IDBTransaction::establishOnServer):
2715         (WebCore::IDBTransaction::activate):
2716         (WebCore::IDBTransaction::deactivate):
2717
2718 2016-05-05  Nan Wang  <n_wang@apple.com>
2719
2720         For keyboard users, activating a fragment URL should transfer focus and caret to the destination
2721         https://bugs.webkit.org/show_bug.cgi?id=116046
2722
2723         Reviewed by Ryosuke Niwa.
2724
2725         Added a sequential focus navigation starting node to document. When TAB or SHIFT-TAB is pressed
2726         and there is no focused element, we start searching for next focus candidates at the sequential
2727         focus navigation node.
2728
2729         Test: fast/events/sequential-focus-navigation-starting-point.html
2730
2731         * dom/Document.cpp:
2732         (WebCore::Document::removedLastRef):
2733         (WebCore::Document::destroyRenderTree):
2734         (WebCore::Document::removeFocusedNodeOfSubtree):
2735         (WebCore::Document::hoveredElementDidDetach):
2736         (WebCore::Document::setFocusedElement):
2737         (WebCore::isNodeFrameOrDocument):
2738         (WebCore::Document::setFocusNavigationStartingNode):
2739         (WebCore::Document::focusNavigationStartingNode):
2740         (WebCore::Document::setCSSTarget):
2741         (WebCore::Document::nodeChildrenWillBeRemoved):
2742         (WebCore::Document::nodeWillBeRemoved):
2743         (WebCore::fallbackFocusNavigationStartingNodeAfterRemoval):
2744         (WebCore::Document::updateFocusNavigationStartingNodeWithNodeRemoval):
2745         (WebCore::Document::textInserted):
2746         * dom/Document.h:
2747         (WebCore::Document::userActionElements):
2748         * page/EventHandler.cpp:
2749         (WebCore::EventHandler::handleMousePressEvent):
2750         * page/FocusController.cpp:
2751         (WebCore::FocusController::advanceFocusInDocumentOrder):
2752         * page/FrameView.cpp:
2753         (WebCore::FrameView::scrollToAnchor):
2754
2755 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
2756
2757         Another iOS debug build fix after r200464.
2758
2759         * dom/EventContext.h:
2760         (WebCore::EventContext::isUnreachableNode):
2761
2762 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
2763
2764         iOS debug build fix after r200464.
2765
2766         * dom/EventContext.cpp:
2767         (WebCore::TouchEventContext::checkReachability):
2768
2769 2016-05-05  Simon Fraser  <simon.fraser@apple.com>
2770
2771         Revert r200390, thus putting r199259 and r200161 and back.
2772
2773         * loader/HistoryController.cpp:
2774         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
2775         * page/FrameView.cpp:
2776         (WebCore::FrameView::adjustTiledBackingScrollability):
2777         * page/Page.h:
2778         (WebCore::Page::obscuredInset):
2779         (WebCore::Page::setObscuredInset):
2780         (WebCore::Page::enclosedInScrollableAncestorView):
2781         (WebCore::Page::setEnclosedInScrollableAncestorView):
2782         * platform/ScrollView.h:
2783         (WebCore::ScrollView::platformObscuredInset): Deleted.
2784         (WebCore::ScrollView::platformSetObscuredInset): Deleted.
2785
2786 2016-05-05  Sam Weinig  <sam@webkit.org>
2787
2788         Fix the build.
2789
2790         * platform/network/cf/CertificateInfo.h:
2791
2792 2016-05-05  Eric Carlson  <eric.carlson@apple.com>
2793
2794         [iOS] Media information is sometimes not shown in Control Center
2795         https://bugs.webkit.org/show_bug.cgi?id=157377
2796
2797         Reviewed by Jer Noble.
2798
2799         * platform/audio/ios/MediaSessionManagerIOS.h:
2800         * platform/audio/ios/MediaSessionManagerIOS.mm:
2801         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Store values passed to MPNowPlayingInfoCenter
2802           individually instead of in a dictionary.
2803
2804 2016-05-04  Simon Fraser  <simon.fraser@apple.com>
2805
2806         Comments on wired.com are blurry
2807         https://bugs.webkit.org/show_bug.cgi?id=148630
2808         rdar://problem/22499655
2809
2810         Reviewed by Tim Horton.
2811
2812         Make sure to set -rasterizationScale on TileGrid container layers to avoid blurry layers
2813         with some configurations of transforms, perspective and clipping.
2814
2815         Test: compositing/contents-scale/rasterization-scale.html
2816
2817         * platform/graphics/ca/TileController.cpp:
2818         (WebCore::TileController::TileController): Initialize m_deviceScaleFactor before m_tileGrid,
2819         because TileGrid's constructor needs to read the device scale.
2820         * platform/graphics/ca/TileController.h:
2821         * platform/graphics/ca/TileGrid.cpp:
2822         (WebCore::TileGrid::TileGrid): Push a contentsScale (which also sets rasterizationScale) onto 
2823         the tile grid container layer on constructions, and in setScale().
2824         (WebCore::TileGrid::setScale):
2825
2826 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
2827
2828         event.target shouldn't be retargeted as the event bubbles into a slot
2829         https://bugs.webkit.org/show_bug.cgi?id=157369
2830
2831         Reviewed by Antti Koivisto.
2832
2833         When an event bubbles up from an assigned node to its assigned slot, we shouldn't be adjusting
2834         event.target to point to the slot. Since a shadow tree should have access to nodes outside
2835         the shadow tree, event.target is accessible inside the shadow tree of such a slot.
2836
2837         New behavior matches the behavior of Google Chrome Canary as well as the shadow DOM specification:
2838         http://w3c.github.io/webcomponents/spec/shadow/#dfn-retargeting-algorithm
2839
2840         Test: fast/shadow-dom/event-inside-slotted-node.html
2841
2842         * dom/Event.cpp:
2843         (WebCore::Event::deepPath):
2844         * dom/EventContext.h:
2845         (WebCore::EventContext::isUnreachableNode): Use Node::isUnclosedNode instead of isReachable.
2846         (WebCore::EventContext::isReachable): Deleted.
2847         * dom/EventPath.cpp:
2848         (WebCore::EventPath::EventPath): Don't set the target to the slot when entering a slot. Also moved
2849         the code to adjust the target as we exit a shadow tree to the end of the outer loop for clarity.
2850         (WebCore::isUnclosedNodeOf): Deleted. Renamed to Node::isUnclosedNode.
2851         (WebCore::EventPath::setRelatedTarget):
2852         (WebCore::EventPath::computePathUnclosedToTarget): Renamed from computePathDisclosedToTarget.
2853         (WebCore::moveOutOfAllShadowRoots): Extracted from RelatedNodeRetargeter::RelatedNodeRetargeter.
2854         (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): Fixed a bug that we were exiting early
2855         without setting m_hasDifferentTreeRoot true when target and relatedNode are disconnected from
2856         a document.
2857         (WebCore::RelatedNodeRetargeter::currentNode):
2858         (WebCore::RelatedNodeRetargeter::checkConsistency): Updated to match the spec with one exception.
2859         We don't use null as the adjusted related target when the (original) related target and the target
2860         are in two distinct disconnected trees since such a behavior is not Web compatible. This spec bug is
2861         tracked by https://github.com/w3c/webcomponents/issues/494
2862         * dom/EventPath.h:
2863         (WebCore::EventPath::eventTargetRespectingTargetRules): Returns Node* instead of EventTarget* since
2864         we need a Node in RelatedNodeRetargeter::checkConsistency.
2865         * dom/Node.cpp:
2866         (WebCore::Node::isUnclosedNode): Moved from RelatedNodeRetargeter.cpp
2867         * dom/Node.h:
2868
2869 2016-05-02  Sam Weinig  <sam@webkit.org>
2870
2871         On platforms that support it, use a SecTrustRef as the basis of CertificateInfo instead of a chain of SecCertificateRefs.
2872         https://bugs.webkit.org/show_bug.cgi?id=157220
2873
2874         Reviewed by Darin Adler.
2875
2876         * platform/network/cf/CertificateInfo.h:
2877         (WebCore::CertificateInfo::CertificateInfo):
2878         (WebCore::CertificateInfo::trust):
2879         (WebCore::CertificateInfo::isEmpty):
2880         (WebCore::CertificateInfo::setCertificateChain): Deleted.
2881         (WebCore::CertificateInfo::certificateChain): Deleted.
2882         * platform/network/mac/CertificateInfoMac.mm:
2883         (WebCore::CertificateInfo::type):
2884         (WebCore::CertificateInfo::certificateChain):
2885         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate):
2886         (WebCore::CertificateInfo::dump):
2887         When supported, allow CertificateInfo to contain a SecTrustRef instead of a certificate chain. We keep
2888         support for holding on to a certificate chain as well, since there is API that depends on this.
2889
2890         * platform/network/cocoa/ResourceResponseCocoa.mm:
2891         (WebCore::ResourceResponse::platformCertificateInfo):
2892         When supported, use the SecTrustRef from the error instead of extracting it's certificate chain.
2893
2894 2016-05-04  Ada Chan  <adachan@apple.com>
2895
2896         When exiting fullscreen, call a JS method immediately to implement the style changes for the presentation mode change right away
2897         https://bugs.webkit.org/show_bug.cgi?id=157359
2898
2899         Reviewed by Eric Carlson.
2900
2901         No new tests as this is done to just mitigate a visual glitch.
2902
2903         * html/HTMLMediaElement.cpp:
2904         (WebCore::HTMLMediaElement::exitFullscreen):
2905         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
2906         * html/HTMLMediaElement.h:
2907
2908 2016-05-04  Alex Christensen  <achristensen@webkit.org>
2909
2910         Blocked redirected main resource requests need descriptive errors
2911         https://bugs.webkit.org/show_bug.cgi?id=156828
2912         rdar://problem/25711316
2913
2914         Reviewed by Daniel Bates.
2915
2916         Test: http/tests/contentextensions/main-resource-redirect-error.html
2917
2918         * loader/DocumentLoader.cpp:
2919         (WebCore::DocumentLoader::startLoadingMainResource):
2920         Call cancelMainResourceLoad() so that InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame()
2921         is called to be consistent with blocked redirected main resource requests.
2922         * loader/ResourceLoader.cpp:
2923         (WebCore::ResourceLoader::willSendRequestInternal):
2924         (WebCore::ResourceLoader::blockedError):
2925         (WebCore::ResourceLoader::blockedByContentBlockerError):
2926         (WebCore::ResourceLoader::cannotShowURLError):
2927         * loader/ResourceLoader.h:
2928         Use a blockedByContentBlockerError() instead of a cannotShowURLError() when we blocked the load.
2929
2930 2016-05-05  Zan Dobersek  <zdobersek@igalia.com>
2931
2932         Fix assertions in debug builds for the GTK+ port.
2933
2934         Rubber-stamped by Carlos Garcia Campos.
2935
2936         * platform/graphics/texmap/TextureMapperGL.cpp:
2937         (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
2938         Switch back to the find() + add() combo for retrieving the pointer
2939         to the SharedGLData object stored for the specific GraphicsContext3D.
2940         add() + isNewEntry is causing assertions in debug builds when adding
2941         the first entry.
2942
2943 2016-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2944
2945         [GStreamer] Adaptive streaming issues
2946         https://bugs.webkit.org/show_bug.cgi?id=144040
2947
2948         Reviewed by Philippe Normand.
2949
2950         In the case of adaptive streaming, the GST URI downloader object is creating the source object, in our case
2951         WebKitWebSrc, without taking its ownership. This is breaking the lifetime of the WebKitWebSrc element. We are
2952         using GRefPtr in WebKitWebSrc to ref/unref the object when sending notifications to the main thread, ensuring
2953         that the object is not destroyed before the main thread dispatches the message. But our smart pointers are so
2954         smart that in case of receiving a floating reference, it's converted to a full reference, so that the first time
2955         we try to take a ref of a WebKitWebSrc having a floating reference we are actually taking the ownership
2956         instead. When we try to release the reference, we are actuallty destroying the object, something that the actual
2957         owner is not expecting and causing runtime critical warnings and very often web process crashes.
2958
2959             (WebKitWebProcess:6863): GStreamer-CRITICAL **:
2960             Trying to dispose element appsrc1, but it is in READY instead of the NULL state.
2961             You need to explicitly set elements to the NULL state before
2962             dropping the final reference, to allow them to clean up.
2963             This problem may also be caused by a refcounting bug in the
2964             application or some element.
2965
2966             (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_handler_get_uri: assertion 'GST_IS_URI_HANDLER(handler)' failed
2967
2968             (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_get_protocol: assertion 'uri != NULL' failed
2969
2970         This should be fixed in GST, but we can workaround it in WebKit while it's fixed in GST or to prevent this from
2971         happening if other users make the same mistake. The idea is to add a ensureGRef() only available for GRefPtr
2972         when using WebKitWebSrc objects that consumes the floating reference if needed before taking the actual reference.
2973
2974         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2975         (WTF::ensureGRef): Consume the floating ref if needed.
2976         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2977         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2978         (webKitWebSrcChangeState): Use ensureGRef().
2979
2980 2016-05-05  Csaba Osztrogonác  <ossy@webkit.org>
2981
2982         [Mac][cmake] Unreviewed speculative buildfix after r200433, just for fun.
2983
2984         * PlatformMac.cmake:
2985
2986 2016-05-04  Zan Dobersek  <zdobersek@igalia.com>
2987
2988         [TexMap] Clean up TextureMapperShaderProgram
2989         https://bugs.webkit.org/show_bug.cgi?id=157302
2990
2991         Reviewed by Carlos Garcia Campos.
2992
2993         Clean up the header and the implementation file of the
2994         TextureMapperShaderProgram class. Reference the GraphicsContext3D
2995         object through a Ref<>, and have the context() return a reference,
2996         not a pointer.
2997
2998         Sort the parts of the implementation file into something more
2999         sensible. StringBuilder usage in create() is improved. getLocation()
3000         only needs to do one lookup in the m_variables map by using ensure().
3001
3002         No new tests -- no change in behavior.
3003
3004         * platform/graphics/surfaces/GLTransportSurface.cpp:
3005         (WebCore::GLTransportSurface::initializeShaderProgram):
3006         * platform/graphics/texmap/TextureMapperGL.cpp:
3007         (WebCore::TextureMapperGLData::SharedGLData::getShaderProgram):
3008         (WebCore::prepareFilterProgram):
3009         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
3010         (WebCore::TextureMapperShaderProgram::create):
3011         (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
3012         (WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
3013         (WebCore::TextureMapperShaderProgram::setMatrix):
3014         (WebCore::TextureMapperShaderProgram::getLocation):
3015         * platform/graphics/texmap/TextureMapperShaderProgram.h:
3016         (WebCore::TextureMapperShaderProgram::context):
3017
3018 2016-05-03  Darin Adler  <darin@apple.com>
3019
3020         Start on dictionary support for IDL, getting enough to work for one dictionary
3021         https://bugs.webkit.org/show_bug.cgi?id=157336
3022
3023         Reviewed by Alex Christensen.
3024
3025         * bindings/js/JSDOMBinding.h: Return RefPtr instead of PassRefPtr for the return
3026         value of toArrayBufferView. Not only is this the correct modern idiom, it also
3027         works properly with auto, and PassRefPtr does not.
3028
3029         * bindings/js/JSDOMBuild.h: Added. This has the build function template in it.
3030         It's used to build values like dictionaries. We specialize and call the tempate
3031         in generated code. This is only the initial simplistic version; will be refining
3032         for exception handling, optional handling, default value handling, and lots of
3033         other things not yet needed for this first dictionary.
3034
3035         * bindings/scripts/CodeGenerator.pm:
3036         (ProcessDocument): Handle dictionaries much like how we handle enumerations.
3037         (SkipIncludeHeader): Moved small list of special types here from CodeGeneratorJS.
3038         (IsDictionaryType): Added.
3039         (IsRefPtrType): Make this return 0 for dictionary types.
3040
3041         * bindings/scripts/CodeGeneratorJS.pm:
3042         (GenerateInterface): Added handling for dictionaries.
3043         (SkipIncludeHeader): Deleted.
3044         (AddIncludesForType): Call the the SkipIncludeHeader from CodeGenerator.pm directly.
3045         (GetNestedClassName): Factored out the work that was previously in
3046         GetEnumerationClassName so we could reuse it for dictionaries too.
3047         (GetEnumerationClassName): Changed to call GetNestedClassName.
3048         (GetEnumerationClassIdentifier): Deleted. Instead of using this, we now use templates
3049         so we can use the actual class name.
3050         (GenerateEnumerationImplementationContent): Changed parse and expectedEnumerationValues
3051         to use function template specialization instead of functions. This cleans up the code
3052         a bit and makes it eaiser to use from other templates. Later we may want to merge the
3053         parse function template build function template from JSDOMBuild.h. Added specialization
3054         of the build function template.
3055         (GetDictionaryClassName): Added. Calls GetNestedClassName.
3056         (GenerateDictionaryImplementationContent): Added. Generates the build function for each
3057         dictionary type. Initial simplistic version to be refined.
3058         (GenerateImplementation): Added dictionaries argument and called the
3059         GenerateDictionaryImplementationContent function. Also changed many functions to take
3060         interface arguments and also removed redundant interfaceName arguments from functions
3061         that formerly took both.
3062         (GenerateParametersCheck): Updated for changes above. That includes calling the new
3063         parse function template. Also changed to use auto and WTFMove, which makes the code
3064         both more generic and potentially more efficient and obviates the need for a special
3065         case for dictionary types.
3066         (GenerateCallbackHeader): Updated for changes above.
3067         (GenerateCallbackImplementation): Ditto.
3068         (GenerateImplementationFunctionCall): Ditto.
3069         (GetNativeTypeFromSignature): Ditto.
3070         (GetNativeType): Changed this function to take the interface because that's needed to
3071         get the type name right for enumeration types rather than returning "auto". Made that
3072         change as well. Moved one type, DOMStringList, into the nativeType hash instead of
3073         having explicit code here for it. Didn't add a dictionary type case here yet, but
3074         probably will need to do that in the next patch.
3075         (ShouldPassWrapperByReference): Pass interface in to GetNativeType.
3076         (GetNativeVectorInnerType): Removed unneeded special case for DOMString.
3077         (GetNativeTypeForCallbacks): Changed to take the interface.
3078         (GetNativeTypeForMemoization): Ditto.
3079         (JSValueToNative): Changed expression for Dictionary (the thing I am working to make
3080         obsolete) to name the type so it will work with auto. Added a case for dictionary
3081         types and updated the case for enumeration types.
3082         (NativeToJSValue): Updated to take an interface rather than an interface name, and to
3083         pass that along as needed.
3084
3085         * bindings/scripts/IDLParser.pm:
3086         (Parse): Add dictionaries to a list.
3087         (parseDictionary): Put name, extended attributes, and members into the dictionary.
3088         (parseDictionaryMembers): Build up a members array.
3089         (parseDictionaryMember): Put isOptional, type, name, and default value into the
3090         dictionary member.
3091
3092         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
3093         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
3094         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3095         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
3096         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3097         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3098         * bindings/scripts/test/JS/JSTestInterface.cpp:
3099         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3100         * bindings/scripts/test/JS/JSTestNode.cpp:
3101         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
3102         * bindings/scripts/test/JS/JSTestObj.cpp:
3103         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3104         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3105         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3106         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3107         * bindings/scripts/test/ObjC/DOMTestObj.h:
3108         * bindings/scripts/test/ObjC/DOMTestObj.mm:
3109         Regenerated.
3110
3111         * bindings/scripts/test/TestObj.idl: Added some test cases that I was using to
3112         get the bindings script to work. Right now this is basically identical to the
3113         actual use of this in Element.idl, but over time I will modify it to cover more
3114         features of dictionaries. Also fixed some incorrect test cases trying to use
3115         the type "bool", which doesn't exist in IDL.
3116
3117         * dom/Element.cpp:
3118         (WebCore::Element::canHaveUserAgentShadowRoot): Added. The existing code used a
3119         combination of a virtual function on HTMLElement and type checking. It's better
3120         to just use a virtual function on Element.
3121         (WebCore::Element::attachShadow): Updated to take a ShadowRootInit struct instead
3122         of a Dictionary. Also tweaked the code in a couple other minor ways.
3123
3124         * dom/Element.h: Added the ShadowRootMode enum class and the ShadowRootInit struct,
3125         and changed attachShadow to take ShadowRootInit instead of Dictionary. Also added
3126         the private canHaveUserAgentShadowRoot virtual function.
3127
3128         * dom/Element.idl: Added ShadowRootMode, ShadowRootInit, and used them in as the
3129         arguemnt type for attachShadow.
3130
3131         * html/HTMLElement.h: Made canHaveUserAgentShadowRoot a private override instead
3132         of a public virtual function.
3133
3134 2016-05-04  Eric Carlson  <eric.carlson@apple.com>
3135
3136         [iOS] Playback does not pause when locking screen after playing to AirPlay.
3137         https://bugs.webkit.org/show_bug.cgi?id=157366
3138         <rdar://problem/22100651>
3139
3140         Reviewed by Dean Jackson.
3141
3142         * platform/audio/PlatformMediaSession.cpp:
3143         (WebCore::PlatformMediaSession::isPlayingToWirelessPlaybackTargetChanged): Save and restore
3144           m_interruptionCount around calling sessionIsPlayingToWirelessPlaybackTargetChanged because
3145           it will call beginInterruption if we are already in the background and the counter will
3146           get out of sync.
3147
3148 2016-05-04  Daniel Bates  <dabates@apple.com>
3149
3150         CSP: Perform case sensitive match against path portion of source expression URL that ends in '/'
3151         https://bugs.webkit.org/show_bug.cgi?id=157275
3152
3153         Reviewed by Darin Adler.
3154
3155         Merged from Blink:
3156         <https://chromium.googlesource.com/chromium/src/+/7bd0a75e3f71a10e71ded31ea5905d5ee3d992eb>
3157
3158         Perform a case-sensitive prefix match of the path portion a source expression that ends in '/'
3159         against the path portion of a request URL as per step 8.5.4 of section Does url match expression
3160         in origin with redirect count of the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp>
3161         (Editor's Draft, 27 April 2016).
3162
3163         * page/csp/ContentSecurityPolicySource.cpp:
3164         (WebCore::ContentSecurityPolicySource::pathMatches):
3165
3166 2016-05-04  Aaron Chu  <aaron_chu@apple.com>
3167
3168         AX: Nonfunctional controls appear before every HTML5 video when using VoiceOver
3169         https://bugs.webkit.org/show_bug.cgi?id=153089
3170         <rdar://problem/24050668>
3171
3172         Reviewed by Dean Jackson.
3173
3174         Test: media/video-controls-show-on-kb-or-ax-event.html
3175
3176         * Modules/mediacontrols/mediaControlsApple.js:
3177         (Controller):
3178         (Controller.prototype.createControls):
3179         (Controller.prototype.updateControls):
3180         (Controller.prototype.handlePlayButtonClicked):
3181         (Controller.prototype.setPlaying):
3182         (Controller.prototype.showShowControlsButton):
3183         (Controller.prototype.showControls):
3184         (Controller.prototype.hideControls):
3185         * Modules/mediacontrols/mediaControlsiOS.js:
3186         (ControllerIOS.prototype.addStartPlaybackControls):
3187         (ControllerIOS.prototype.handleStartPlaybackButtonTouchEnd):
3188         (ControllerIOS.prototype.showControls):
3189
3190         Fix to make sure the showControls button in a media player behaves correctly.
3191
3192 2016-05-04  Dean Jackson  <dino@apple.com>
3193
3194         Disabling WebGL2 should mean no context is created
3195         https://bugs.webkit.org/show_bug.cgi?id=157352
3196         <rdar://problem/26096346>
3197
3198         Reviewed by Eric Carlson.
3199
3200         If WebGL2 is disabled by the runtime flag, we should
3201         not create a context.
3202
3203         Test: fast/canvas/webgl/webgl2-runtime-flag.html
3204
3205         * html/canvas/WebGLRenderingContextBase.cpp:
3206         (WebCore::WebGLRenderingContextBase::create):
3207         * testing/Internals.cpp: Added some helpers to toggle the runtime setting.
3208         (WebCore::Internals::webGL2Enabled):
3209         (WebCore::Internals::setWebGL2Enabled):
3210         * testing/Internals.h:
3211         * testing/Internals.idl:
3212
3213 2016-05-04  Anders Carlsson  <andersca@apple.com>
3214
3215         Add an override point for drawing named images in ThemeCocoa
3216         https://bugs.webkit.org/show_bug.cgi?id=157357
3217         rdar://problem/25878445
3218
3219         Reviewed by Dean Jackson.
3220
3221         Rename ThemeCocoa.cpp to ThemeCocoa.mm and rearrange the code that draws the wireless-playback image
3222         so we can import ThemeCocoaDrawNamedImage.mm below.
3223
3224         * WebCore.xcodeproj/project.pbxproj:
3225         * platform/cocoa/ThemeCocoa.cpp:
3226         (WebCore::fitContextToBox): Deleted.
3227         (WebCore::ThemeCocoa::drawNamedImage): Deleted.
3228         * platform/cocoa/ThemeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/ThemeCocoa.cpp.
3229         (WebCore::fitContextToBox):
3230         (WebCore::ThemeCocoa::drawNamedImage):
3231
3232 2016-05-04  Jeremy Jones  <jeremyj@apple.com>
3233
3234         Don't disconnect WebAVPlayerController from its delegate since there is no way to reconnect it.
3235         https://bugs.webkit.org/show_bug.cgi?id=157337
3236
3237         Reviewed by Jer Noble.
3238
3239         WebAVPlayerController used to be deleted and recreated each time we begin fullscreen video mode.
3240         Since it is now preserved, we shouldn't paritally tear it down in cleanupFullscreen by disconnecting it
3241         from its delegate, especially since we have no way to reconnect it.
3242
3243         The side effect of leaving it connected is that it can continue to make callbacks during cleanup.
3244         Of importance is that it sets the audio and legible media selctions to nil. We don't want to change 
3245         the selection as a result of teardown. Nil selection is unsupported by WebVideoFullscreenModelVideoElement
3246         and causes an assert. This transition to nil selection is now ignored.
3247
3248         * platform/ios/WebAVPlayerController.mm:
3249         (-[WebAVPlayerController setCurrentAudioMediaSelectionOption:]):
3250         (-[WebAVPlayerController setCurrentLegibleMediaSelectionOption:]):
3251         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3252         (WebVideoFullscreenInterfaceAVKit::cleanupFullscreen):
3253
3254 2016-05-04  Chris Dumez  <cdumez@apple.com>
3255
3256         Media elements should not be paused right away when removed from the document
3257         https://bugs.webkit.org/show_bug.cgi?id=157347
3258         <rdar://problem/25888758>
3259
3260         Reviewed by Alex Christensen.
3261
3262         Media elements should not be paused right away when removed from the document.
3263         Instead we should allow the task that removed the media element from the
3264         document to finish because considering pausing.
3265
3266         This avoid inadvertently pausing media elements when the JS merely moves them
3267         on the page (e.g. using Node.replaceChild()).
3268
3269         Text from the HTML specification:
3270         """
3271         When a media element is removed from a Document, the user agent must run the
3272         following steps:
3273         1.  Await a stable state, allowing the task that removed the media element
3274             from the Document to continue. The synchronous section consists of all the
3275             remaining steps of this algorithm. (Steps in the synchronous section are
3276             marked with ⌛.)
3277         2. ⌛ If the media element is in a Document, abort these steps.
3278         3. ⌛ Run the internal pause steps for the media element.
3279         """
3280
3281         c.f. https://html.spec.whatwg.org/multipage/embedded-content.html#htmlmediaelement
3282
3283         Test: media/replaceChild-should-not-pause-video.html
3284
3285         * dom/GenericEventQueue.cpp:
3286         (WebCore::GenericEventQueue::sharedTimerFired):
3287         Copy the queue of events before processing it so that we don't fire events that
3288         get scheduled by the event handlers as a result of us firing the pending events.
3289         Otherwise, we end up firing events synchronously right after they've been queued,
3290         which is wrong. This was causing several W3C tests to fail.
3291
3292         * html/HTMLMediaElement.cpp:
3293         (WebCore::HTMLMediaElement::HTMLMediaElement):
3294         (WebCore::HTMLMediaElement::pauseAfterDetachedTimerFired):
3295         (WebCore::HTMLMediaElement::removedFrom):
3296         * html/HTMLMediaElement.h:
3297         After the media element gets removed from the document, schedule a 0 timer before
3298         pausing the media element, to give the task that removed us a chance to finish.
3299         When the timer fires, we check if we were added back into an active document and
3300         avoid pausing in such case.
3301
3302 2016-05-04  Filip Pizlo  <fpizlo@apple.com>
3303
3304         Speed up JSGlobalObject initialization by making some properties lazy
3305         https://bugs.webkit.org/show_bug.cgi?id=157045
3306
3307         Reviewed by Keith Miller.
3308
3309         No new tests because no change in behavior.
3310         
3311         This adapts JSHTMLElementCustom.cpp to the new JSWithScope API. Note that this revealed
3312         that this was using a curious choice of global object, which may not be right. I decided
3313         to do a very literal refactoring that exactly preserves what this code got before, but I
3314         added a FIXME to reconsider this later.
3315
3316         * bindings/js/JSHTMLElementCustom.cpp:
3317         (WebCore::JSHTMLElement::pushEventHandlerScope):
3318
3319 2016-05-04  Manuel Rego Casasnovas  <rego@igalia.com>
3320
3321         [css-grid] Refactor information stored related to column positions
3322         https://bugs.webkit.org/show_bug.cgi?id=157342
3323
3324         Reviewed by Darin Adler.
3325
3326         In m_columnPositions we were storing position of each column
3327         including the alignment offset, always from the logical left,
3328         and the border and padding, depending on the direction.
3329
3330         This was really confusing as in the case of RTL direction
3331         we were adding the offset from the left and
3332         the right border and padding.
3333
3334         This patches changes it to store always the info from the left,
3335         so even in RTL direction we use the left border and padding.
3336
3337         This allows us to simplify translateRTLCoordinate() as
3338         it doesn't need to care about border and padding anymore.
3339         And also to refactor offsetAndBreadthForPositionedChild()
3340         which became really complex after adding RTL support.
3341
3342         No new tests, no change of behavior.
3343
3344         * rendering/RenderGrid.cpp:
3345         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
3346         (WebCore::RenderGrid::populateGridPositions):
3347         (WebCore::RenderGrid::translateRTLCoordinate):
3348
3349 2016-05-04  Mark Lam  <mark.lam@apple.com>
3350
3351         ES6 Function.name inferred from property names of literal objects can break some websites.
3352         https://bugs.webkit.org/show_bug.cgi?id=157246
3353
3354         Reviewed by Geoffrey Garen.
3355
3356         Test: js/dom/regress-157246.html
3357
3358         * bindings/js/JSDOMWindowBase.cpp:
3359         (WebCore::JSDOMWindowBase::finishCreation):
3360         - Set the needsSiteSpecificQuirks flag in the JSGlobalObject if needed.
3361
3362 2016-05-04  Konstantin Tokarev  <annulen@yandex.ru>
3363
3364         Deduplicated initializer lists of BitmapImage constructors.
3365         https://bugs.webkit.org/show_bug.cgi?id=157249
3366
3367         Reviewed by Darin Adler.