caf56cc9ac915112afee256ddd05956a37d11578
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-08-18  Sam Weinig  <sam@webkit.org>
2
3         Re-landing:
4
5         Support WebIDL unions (Part 1)
6         https://bugs.webkit.org/show_bug.cgi?id=160769
7
8         Reviewed by Chris Dumez.
9
10         This is the first part of an effort to add support for union types
11         in our code generators. This change:
12         - Adds a domType struct to hold the parsed type information. For now, we only
13           use it temporarily while parsing, and don't expose it to the code generators,
14           but that will change in a later patch.
15         - Remove support for scoped identifiers for types. They are not supported by WebIDL.
16         - Make debugging the parser easier by providing backtraces when asserting.
17
18         There should be no observable changes.
19
20         * bindings/scripts/IDLParser.pm:
21
22 2016-08-18  Chris Dumez  <cdumez@apple.com>
23
24         Move prefix / namespaceURI / localName attributes from Node to Attr / Element
25         https://bugs.webkit.org/show_bug.cgi?id=160988
26
27         Reviewed by Ryosuke Niwa.
28
29         Move prefix / namespaceURI / localName attributes from Node to Attr / Element
30         as per the latest DOM specification:
31         - https://dom.spec.whatwg.org/#element
32         - https://dom.spec.whatwg.org/#attr
33
34         Firefox and Chrome match the specification.
35
36         No new tests, rebaselined existing tests.
37
38         * dom/Attr.h:
39         * dom/Attr.idl:
40         * dom/Element.h:
41         * dom/Element.idl:
42         * dom/Node.idl:
43
44 2016-08-18  Jonathan Bedard  <jbedard@apple.com>
45
46         Binding NULL pointer to reference in WebCore::RenderObject
47         https://bugs.webkit.org/show_bug.cgi?id=160830
48
49         Reviewed by Myles C. Maxfield.
50
51         No new tests needed, existing functionality not changed.
52
53         Fixes a dereferenced NULL pointer bound to a reference through a minor re-factor.
54
55         * rendering/InlineIterator.h:
56         (WebCore::InlineIterator::clear): Explicit clear occurs, instead of a call to moveTo.
57         (WebCore::InlineIterator::moveToStartOf): Swapped pointer for reference.
58         (WebCore::InlineIterator::moveTo): Swapped pointer for reference.
59         (WebCore::InlineIterator::increment): Explicitly call clear for clarity.
60         * rendering/line/BreakingContext.h:
61         (WebCore::BreakingContext::commitLineBreakClear): Commit a line break and clear the iterator.
62         (WebCore::BreakingContext::commitLineBreakAtCurrentWidth): Swapped pointer for reference.
63         (WebCore::BreakingContext::InlineIteratorHistory::moveTo): Swapped pointer for reference.
64         (WebCore::BreakingContext::increment): Explicitly call clear for clarity.
65         (WebCore::BreakingContext::handleBR): Swapped pointer for passed reference.
66         (WebCore::BreakingContext::handleReplaced): Explicitly call clear for clarity.
67         (WebCore::tryHyphenating): Swapped pointer for passed reference.
68         (WebCore::BreakingContext::handleText): Replaced all render object passing with references.  Note that the caller explicitly checks if m_current.renderer() exists before calling this function.
69         (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded): Explicitly call clear for clarity.
70         (WebCore::BreakingContext::handleEndOfLine): Explicitly call clear for clarity.
71
72 2016-08-18  Ryosuke Niwa  <rniwa@webkit.org>
73
74         Windows build fix after r204611. Use the fully qualified name to avoid the ambiguity in VC++.
75
76         * bindings/js/JSCustomElementInterface.cpp:
77         (WebCore::JSCustomElementInterface::invokeCallback):
78         * bindings/js/JSCustomElementInterface.h:
79         (WebCore::JSCustomElementInterface::invokeCallback):
80
81 2016-08-18  Dean Jackson  <dino@apple.com>
82
83         Support passing preferLowPowerToHighPerformance and failIfMajorPerformanceCaveat
84         https://bugs.webkit.org/show_bug.cgi?id=160982
85         <rdar://problem/27915946>
86
87         Reviewed by Simon Fraser.
88
89         Update WebGLContextAttributes to be compliant with the specification,
90         by adding preferLowPowerToHighPerformance and failIfMajorPerformanceCaveat.
91         They are not implemented yet, so asking the created context what
92         values it used should give the default.
93
94         Test: fast/canvas/webgl/context-creation-attributes.html
95
96         * html/canvas/WebGLContextAttributes.cpp:
97         (WebCore::WebGLContextAttributes::preferLowPowerToHighPerformance):
98         (WebCore::WebGLContextAttributes::setPreferLowPowerToHighPerformance):
99         (WebCore::WebGLContextAttributes::failIfMajorPerformanceCaveat):
100         (WebCore::WebGLContextAttributes::setFailIfMajorPerformanceCaveat):
101         * html/canvas/WebGLContextAttributes.h:
102         * html/canvas/WebGLContextAttributes.idl:
103         * html/canvas/WebGLRenderingContextBase.cpp:
104         (WebCore::WebGLRenderingContextBase::create): Deleted.
105         * platform/graphics/GraphicsContext3D.h:
106         (WebCore::GraphicsContext3D::Attributes::Attributes): Deleted.
107
108 2016-08-18  Anders Carlsson  <andersca@apple.com>
109
110         Move an NPAPI-only function from WebCore to WebKit
111         https://bugs.webkit.org/show_bug.cgi?id=160967
112
113         Reviewed by Sam Weinig.
114
115         * WebCore.xcodeproj/project.pbxproj:
116         * bindings/js/ScriptController.cpp:
117         (WebCore::ScriptController::createScriptObjectForPluginElement): Deleted.
118         * bindings/js/ScriptController.h:
119         * bridge/NP_jsobject.h:
120
121 2016-08-18  Ryosuke Niwa  <rniwa@webkit.org>
122
123         Binding test fix after r204611.
124
125         * bindings/scripts/test/TestObj.idl:
126
127 2016-08-18  Chris Dumez  <cdumez@apple.com>
128
129         Unreviewed, nit fix after r204605 reported by Darin.
130
131         * platform/text/TextCodecICU.cpp:
132
133 2016-08-17  Ryosuke Niwa  <rniwa@webkit.org>
134
135         Add basic support for connected and disconnected callbacks
136         https://bugs.webkit.org/show_bug.cgi?id=160950
137
138         Reviewed by Chris Dumez.
139
140         Added the basic support for custom elements' connectedCallback and disconnectedCallback. These callbacks
141         are enqueued by inserting and removing a node as spec'ed by https://dom.spec.whatwg.org/#concept-node-insert
142         and https://dom.spec.whatwg.org/#concept-node-remove
143
144         For now, we only support callbacks on appendChild and removeChild to limit the amount of code changes and
145         tests that need to be included in this patch.
146
147         This patch also renames InvokesCustomElementLifecycleCallbacks IDL attribute to CEReactions to match
148         the latest specification: https://html.spec.whatwg.org/multipage/scripting.html#cereactions
149
150         Tests: fast/custom-elements/connected-callbacks.html
151                fast/custom-elements/disconnected-callbacks.html
152
153         * bindings/js/JSCustomElementInterface.cpp:
154         (WebCore::JSCustomElementInterface::invokeCallback): Extracted from invokeAttributeChangedCallback.
155         (WebCore::JSCustomElementInterface::setConnectedCallback): Added.
156         (WebCore::JSCustomElementInterface::invokeConnectedCallback): Added.
157         (WebCore::JSCustomElementInterface::setDisconnectedCallback): Added.
158         (WebCore::JSCustomElementInterface::invokeDisconnectedCallback): Added.
159         (WebCore::JSCustomElementInterface::setAttributeChangedCallback):
160         (WebCore::JSCustomElementInterface::invokeAttributeChangedCallback): Renamed from attributeChanged.
161         * bindings/js/JSCustomElementInterface.h: Added m_connectedCallback and m_disconnectedCallback as instance
162         variables. Also removed the superfluous mutable qualifier from m_constructor m_attributeChangedCallback.
163         * bindings/js/JSCustomElementsRegistryCustom.cpp:
164         (WebCore::JSCustomElementsRegistry::define): Store connectedCallback and disconnectedCallback.
165         * bindings/scripts/CodeGeneratorJS.pm:
166         (GenerateImplementation):
167         * bindings/scripts/IDLAttributes.txt:
168         * dom/CustomElementsRegistry.idl:
169         * dom/Element.cpp:
170         (WebCore::Element::insertedInto): Call enqueueConnectedCallbackIfNeeded.
171         (WebCore::Element::removedFrom): Call enqueueDisconnectedCallbackIfNeeded.
172         * dom/Element.idl:
173         * dom/LifecycleCallbackQueue.cpp:
174         (WebCore::LifecycleQueueItem::invoke): Added calls to invokeConnectedCallback and invokeDisconnectedCallback.
175         (WebCore::findInterfaceForCustomElement): Extracted from enqueueAttributeChangedCallbackIfNeeded.
176         (WebCore::LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded): Added.
177         (WebCore::LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded): Added.
178         (WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded):
179         (WebCore::CustomElementLifecycleProcessingStack::ensureCurrentQueue):
180         * dom/LifecycleCallbackQueue.h:
181         * dom/Node.idl:
182
183 2016-08-18  Beth Dakin  <bdakin@apple.com>
184
185         Update the accessibility titles for list insertion
186         https://bugs.webkit.org/show_bug.cgi?id=160972
187         -and corresponding-
188         rdar://problem/27750446
189
190         Reviewed by Chris Fleizach.
191
192         Update accessibility titles based on feedback.
193         * English.lproj/Localizable.strings:
194         * platform/LocalizedStrings.cpp:
195         (WebCore::insertListTypeNone):
196         (WebCore::insertListTypeBulleted):
197         (WebCore::insertListTypeBulletedAccessibilityTitle):
198         (WebCore::insertListTypeNumbered):
199         (WebCore::insertListTypeNumberedAccessibilityTitle):
200         (WebCore::insertListTypeNoneAccessibilityTitle): Deleted.
201         * platform/LocalizedStrings.h:
202
203 2016-08-18  Chris Dumez  <cdumez@apple.com>
204
205         Align our encoding labels with the encoding specification
206         https://bugs.webkit.org/show_bug.cgi?id=160931
207
208         Reviewed by Darin Adler.
209
210         Align our encoding labels with the encoding specification:
211         - https://encoding.spec.whatwg.org/#names-and-labels
212
213         This also aligns with Firefox and Chrome.
214
215         No new tests, rebaselined existing test.
216
217         * platform/text/TextCodecICU.cpp:
218         (WebCore::TextCodecICU::registerEncodingNames):
219         * platform/text/TextCodecLatin1.cpp:
220         (WebCore::TextCodecLatin1::registerEncodingNames):
221         (WebCore::newStreamingTextDecoderWindowsLatin1): Deleted.
222         (WebCore::TextCodecLatin1::registerCodecs): Deleted.
223         * platform/text/TextCodecUTF8.cpp:
224         (WebCore::TextCodecUTF8::registerEncodingNames):
225
226 2016-08-18  Andy Estes  <aestes@apple.com>
227
228         [Cocoa] Add SPI to WKProcessPool for enabling cookie storage partitioning
229         https://bugs.webkit.org/show_bug.cgi?id=160964
230
231         Reviewed by Brent Fulgham.
232
233         * page/Settings.cpp:
234         (WebCore::Settings::setCookieStoragePartitioningEnabled): Deleted.
235         * page/Settings.h:
236         (WebCore::Settings::cookieStoragePartitioningEnabled): Deleted.
237         * platform/network/NetworkStorageSession.h:
238         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Defined cookieStoragePartitioningEnabled.
239         (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Set cookieStoragePartitioningEnabled.
240         (WebCore::cookieStoragePartition): Used cookieStoragePartitioningEnabled instead of Settings::cookieStoragePartitioningEnabled().
241
242 2016-08-18  Eric Carlson  <eric.carlson@apple.com>
243
244         AX: Audio Description tracks are not labeled correctly, causing user confusion
245         https://bugs.webkit.org/show_bug.cgi?id=160652
246         <rdar://problem/27742208>
247
248         Reviewed by Antoine Quint.
249
250         * http/tests/media/hls/hls-accessiblity-describes-video-menu-expected.txt: Added.
251         * http/tests/media/hls/hls-accessiblity-describes-video-menu.html: Added.
252
253         * media/trackmenu-test.js:
254         (clickCCButton): Fail immediately if "video" is null or not a media element. Make failure 
255         logging more descriptive.
256
257         * platform/gtk/TestExpectations: Skip new test.
258
259         * platform/ios-simulator/media/video-controls-captions-trackmenu-expected.txt: Updated for
260         clickCCButton error message change.
261         * platform/ios-simulator/media/video-controls-captions-trackmenu-hide-on-click-expected.txt: Ditto.
262         * platform/ios-simulator/media/video-controls-captions-trackmenu-localized-expected.txt: Ditto.
263         * platform/ios-simulator/media/video-controls-captions-trackmenu-sorted-expected.txt: Ditto.
264
265 2016-08-18  Alex Christensen  <achristensen@webkit.org>
266
267         Fix WinCairo build after r204592.
268
269         * PlatformAppleWin.cmake:
270         * PlatformWin.cmake:
271
272 2016-08-18  Eric Carlson  <eric.carlson@apple.com>
273
274         [MediaStream] cleanup MediaConstraints
275         https://bugs.webkit.org/show_bug.cgi?id=160957
276
277         Reviewed by Antoine Quint.
278
279         No new tests, no behavior change.
280
281         * Modules/mediastream/CaptureDeviceManager.cpp:
282         (CaptureDeviceManager::sessionSupportsConstraint): Use MediaConstraint::type
283
284         * bindings/js/JSMediaDevicesCustom.cpp:
285         (WebCore::initializeStringConstraintWithList): MediaConstraint::create now takes the constraint
286         type, not name.
287         (WebCore::createStringConstraint): Ditto.
288         (WebCore::createBooleanConstraint): Ditto.
289         (WebCore::createDoubleConstraint): Ditto.
290         (WebCore::createIntConstraint): Ditto.
291         (WebCore::parseMediaTrackConstraintSetForKey): Pass constraint type.
292
293         * platform/mediastream/MediaConstraints.cpp:
294         (WebCore::MediaConstraint::create): MediaConstraint constructor now takes the constraint.
295         (WebCore::IntConstraint::create): Take type, not name.
296         (WebCore::IntConstraint::setMin): Ditto.
297         (WebCore::DoubleConstraint::create): Ditto.
298         (WebCore::BooleanConstraint::create): Ditto.
299         (WebCore::StringConstraint::create): Ditto.
300         * platform/mediastream/MediaConstraints.h:
301
302         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
303         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint): Make static.
304         (WebCore::RealtimeMediaSourceSupportedConstraints::constraintFromName): Ditto.
305         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
306
307         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
308         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Use MediaConstraint::type
309
310         * platform/mediastream/mac/AVVideoCaptureSource.mm:
311         (WebCore::AVVideoCaptureSource::applyConstraints): nameForConstraint is a static method. Add
312         error logging.
313
314         * platform/mock/MediaConstraintsMock.cpp:
315         (WebCore::isSatisfiable): Use constraint type.
316
317 2016-08-18  Rawinder Singh  <rawinder.singh-webkit@cisra.canon.com.au>
318
319         [web-animations] Add Animatable, AnimationEffect, KeyframeEffect and Animation interface
320         https://bugs.webkit.org/show_bug.cgi?id=156096
321
322         Reviewed by Dean Jackson.
323
324         Adds:
325         - Animatable interface and implementation of getAnimations in Element.
326         - Interface and implementation for Document getAnimations method.
327         - AnimationEffect interface and class stub.
328         - KeyframeEffect interface and constructor implementation.
329         - 'Animation' interface, constructor and query methods for effect and timeline.
330         - Remove runtime condition on Web animation interfaces (compile time flag is specified).
331
332         Test: webanimations/Document.html
333
334         * CMakeLists.txt:
335         * DerivedSources.make:
336         * PlatformGTK.cmake:
337         * WebCore.xcodeproj/project.pbxproj:
338         * animation/Animatable.idl: Copied from Source/WebCore/animation/AnimationTimeline.idl.
339         * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp.
340         (WebCore::AnimationEffect::AnimationEffect):
341         (WebCore::AnimationEffect::~AnimationEffect):
342         (WebCore::AnimationEffect::setAnimation):
343         (WebCore::AnimationEffect::isCurrent):
344         (WebCore::AnimationEffect::isInEffect):
345         * animation/AnimationEffect.h: Copied from Source/WebCore/animation/DocumentTimeline.cpp.
346         * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/DocumentAnimation.idl.
347         * animation/AnimationTimeline.cpp:
348         (WebCore::AnimationTimeline::destroy):
349         (WebCore::AnimationTimeline::attachAnimation):
350         (WebCore::AnimationTimeline::detachAnimation):
351         * animation/AnimationTimeline.h:
352         * animation/AnimationTimeline.idl:
353         * animation/DocumentAnimation.cpp:
354         (WebCore::DocumentAnimation::timeline):
355         (WebCore::DocumentAnimation::getAnimations):
356         (WebCore::DocumentAnimation::addAnimation):
357         (WebCore::DocumentAnimation::removeAnimation):
358         * animation/DocumentAnimation.h:
359         (WebCore::DocumentAnimation::getAnimations):
360         * animation/DocumentAnimation.idl:
361         * animation/DocumentTimeline.cpp:
362         (WebCore::DocumentTimeline::create):
363         (WebCore::DocumentTimeline::DocumentTimeline):
364         (WebCore::DocumentTimeline::attach):
365         (WebCore::DocumentTimeline::detach):
366         * animation/DocumentTimeline.h:
367         * animation/DocumentTimeline.idl:
368         * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/DocumentTimeline.cpp.
369         (WebCore::KeyframeEffect::create):
370         (WebCore::KeyframeEffect::KeyframeEffect):
371         (WebCore::KeyframeEffect::~KeyframeEffect):
372         * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/DocumentTimeline.h.
373         * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
374         * animation/WebAnimation.cpp: Copied from Source/WebCore/animation/DocumentAnimation.cpp.
375         (WebCore::WebAnimation::create):
376         (WebCore::WebAnimation::WebAnimation):
377         (WebCore::WebAnimation::~WebAnimation):
378         * animation/WebAnimation.h: Copied from Source/WebCore/animation/DocumentAnimation.h.
379         * animation/WebAnimation.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
380         * bindings/scripts/CodeGeneratorGObject.pm:
381         * dom/Element.cpp:
382         (WebCore::Element::getAnimations):
383         * dom/Element.h:
384         * dom/Element.idl:
385
386 2016-08-17  Myles C. Maxfield  <mmaxfield@apple.com>
387
388         [Cocoa] Migrate off of deprecated CoreGraphics API CGContextSelectFont() and CGContextShowTextAtPoint()
389         https://bugs.webkit.org/show_bug.cgi?id=160895
390
391         Reviewed by Dean Jackson.
392
393         Migrate to CTLineDraw() instead.
394
395         This patch also adds support for linking to the existing CoreText framework on Windows.
396
397         No new tests because there is no behavior change.
398
399         * PlatformWin.cmake:
400         * page/cocoa/ResourceUsageOverlayCocoa.mm:
401         (WebCore::showText):
402         * platform/graphics/ca/PlatformCALayer.cpp:
403         (WebCore::PlatformCALayer::drawTextAtPoint):
404         * platform/ios/LegacyTileCache.mm:
405         (WebCore::LegacyTileCache::drawLayer):
406         * platform/spi/win/CoreTextSPIWin.cpp: Added.
407         * platform/spi/win/CoreTextSPIWin.h: Added.
408
409 2016-08-17  Benjamin Poulain  <benjamin@webkit.org>
410
411         [CSS] The parser should not get rid of empty namespace specification in front of element name selectors
412         https://bugs.webkit.org/show_bug.cgi?id=160936
413
414         Reviewed by Chris Dumez.
415
416         There are two places where you can specify an empty namespace
417         in selectors:
418             - Element name (e.g. "|name")
419             - Attribute name (e.g. "[|name]")
420         In the first case, if we have an empty namespace, the selector
421         should match that.
422         In the second case, the default namespace of attribute is already
423         empty so it is just the same as "[name]".
424
425         Our code was just discarding any empty namespace. This is fine
426         for attributes but for names that is transforming "|name" into "name"
427         which is invalid.
428
429         This patch updates those cases to differentiate:
430         - Null prefix -> There was no namespace specified.
431         - Empty prefix -> There was a namespace prefix and it is empty.
432
433         Test: fast/selectors/empty-namespace-with-element-selector.html
434
435         * css/CSSGrammar.y.in:
436         * css/CSSParser.cpp:
437         (WebCore::CSSParser::determineNameInNamespace):
438         (WebCore::CSSParser::rewriteSpecifiersWithNamespaceIfNeeded):
439         (WebCore::CSSParser::rewriteSpecifiersWithElementName):
440         * css/CSSParser.h:
441         * css/CSSSelector.cpp:
442         (WebCore::CSSSelector::selectorText):
443         * css/CSSSelectorList.cpp:
444         (WebCore::SelectorNeedsNamespaceResolutionFunctor::operator()):
445         * css/StyleSheetContents.cpp:
446         (WebCore::StyleSheetContents::determineNamespace): Deleted.
447
448 2016-08-17  Chris Dumez  <cdumez@apple.com>
449
450         [Web IDL] Add support for dictionary members of dictionary types
451         https://bugs.webkit.org/show_bug.cgi?id=160902
452
453         Reviewed by Sam Weinig.
454
455         Add support for dictionary members of dictionary types.
456
457         No new tests, updated bindings tests.
458
459         * bindings/scripts/CodeGeneratorJS.pm:
460         (GenerateDictionaryImplementationContent):
461         * bindings/scripts/test/JS/JSTestObj.cpp:
462         (WebCore::convertDictionary<TestObj::Dictionary>):
463         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
464         * bindings/scripts/test/TestObj.idl:
465
466 2016-08-17  Anders Carlsson  <andersca@apple.com>
467
468         Add support for additional networks
469         https://bugs.webkit.org/show_bug.cgi?id=160951
470         rdar://problem/27807479
471
472         Reviewed by Sam Weinig.
473
474         * Modules/applepay/ApplePaySession.cpp:
475         (WebCore::createSupportedNetworks):
476         (WebCore::createPaymentRequest):
477         (WebCore::ApplePaySession::create):
478         * Modules/applepay/PaymentRequest.cpp:
479         (WebCore::isAdditionalValidSupportedNetwork):
480         (WebCore::PaymentRequest::isValidSupportedNetwork):
481         * Modules/applepay/PaymentRequest.h:
482         (WebCore::PaymentRequest::supportedNetworks):
483         (WebCore::PaymentRequest::setSupportedNetworks):
484         * Modules/applepay/PaymentRequestValidator.cpp:
485         (WebCore::PaymentRequestValidator::validateSupportedNetworks):
486         * Modules/applepay/PaymentRequestValidator.h:
487
488 2016-08-17  Anders Carlsson  <andersca@apple.com>
489
490         Remove a couple of unused WKSI function pointers
491         https://bugs.webkit.org/show_bug.cgi?id=160946
492
493         Reviewed by Dan Bernstein.
494
495         * platform/mac/WebCoreSystemInterface.h:
496         * platform/mac/WebCoreSystemInterface.mm:
497
498 2016-08-17  Anders Carlsson  <andersca@apple.com>
499
500         Move WKSignedPublicKeyAndChallengeString into WebCore and make it proper C++
501         https://bugs.webkit.org/show_bug.cgi?id=160945
502
503         Reviewed by Dan Bernstein.
504
505         * platform/mac/SSLKeyGeneratorMac.mm:
506         (WebCore::getSubjectPublicKey):
507         (WebCore::signPublicKeyAndChallenge):
508         (WebCore::signedPublicKeyAndChallengeString):
509
510 2016-08-17  Antti Koivisto  <antti@apple.com>
511
512         Remove CSS_IMAGE_SET feature define
513         https://bugs.webkit.org/show_bug.cgi?id=160944
514
515         Reviewed by Dean Jackson.
516
517         This seems to be enabled everywhere already (except Mac cmake build which it keep breaking).
518
519         * css/CSSCursorImageValue.cpp:
520         (WebCore::CSSCursorImageValue::CSSCursorImageValue):
521         (WebCore::CSSCursorImageValue::cachedImage):
522         (WebCore::CSSCursorImageValue::cachedOrPendingImage):
523         * css/CSSImageSetValue.cpp:
524         (WebCore::CSSImageSetValue::cloneForCSSOM):
525         * css/CSSImageSetValue.h:
526         * css/CSSParser.cpp:
527         (WebCore::CSSParser::parseVariableDependentValue):
528         (WebCore::isImageSetFunctionValue):
529         (WebCore::CSSParser::parseValue):
530         (WebCore::CSSParser::parseContent):
531         (WebCore::CSSParser::parseFillImage):
532         (WebCore::CSSParser::parseBorderImage):
533         (WebCore::CSSParser::parseImageResolution):
534         (WebCore::CSSParser::parseImageSet):
535         * css/CSSParser.h:
536         * css/CSSToStyleMap.cpp:
537         (WebCore::CSSToStyleMap::mapNinePieceImage):
538         * css/CSSValue.cpp:
539         (WebCore::CSSValue::traverseSubresources):
540         (WebCore::CSSValue::equals):
541         (WebCore::CSSValue::cssText):
542         (WebCore::CSSValue::destroy):
543         (WebCore::CSSValue::cloneForCSSOM):
544         * css/CSSValue.h:
545         (WebCore::CSSValue::isImageGeneratorValue):
546         (WebCore::CSSValue::isGradientValue):
547         (WebCore::CSSValue::isNamedImageValue):
548         (WebCore::CSSValue::isImageSetValue):
549         (WebCore::CSSValue::isImageValue):
550         (WebCore::CSSValue::isInheritedValue):
551         * css/StyleBuilderConverter.h:
552         (WebCore::isImageShape):
553         * css/StyleBuilderCustom.h:
554         (WebCore::StyleBuilderCustom::applyValueContent):
555         * css/StyleResolver.cpp:
556         (WebCore::StyleResolver::styleImage):
557         (WebCore::StyleResolver::generatedOrPendingFromValue):
558         (WebCore::StyleResolver::setOrPendingFromValue):
559         (WebCore::StyleResolver::cursorOrPendingFromValue):
560         * css/StyleResolver.h:
561         (WebCore::StyleResolver::applyPropertyToRegularStyle):
562         * css/makeprop.pl:
563         (generateFillLayerPropertyValueSetter):
564         * rendering/style/StyleCachedImage.cpp:
565         (WebCore::StyleCachedImage::cssValue):
566         * rendering/style/StylePendingImage.h:
567         * style/StylePendingResources.cpp:
568         (WebCore::Style::loadPendingImage):
569
570 2016-08-17  Antti Koivisto  <antti@apple.com>
571
572         Try to fix CMake build.
573
574         * rendering/style/StyleCachedImage.cpp:
575         (WebCore::StyleCachedImage::cssValue):
576
577 2016-08-17  Chris Fleizach  <cfleizach@apple.com>
578
579         AX: Support abbreviations in iOS
580         https://bugs.webkit.org/show_bug.cgi?id=160907
581
582         Reviewed by Joanmarie Diggs.
583
584         Expose the expandedTextValue attribute for iOS, so that VoiceOver can speak abbreviations correctly.
585
586         Test: accessibility/ios-simulator/abbreviation.html
587
588         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
589         (-[WebAccessibilityObjectWrapper textMarkersForRange:]):
590         (-[WebAccessibilityObjectWrapper accessibilityExpandedTextValue]):
591         (-[WebAccessibilityObjectWrapper accessibilityIdentifier]):
592         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
593         (AXAttributeStringSetSpelling):
594         (AXAttributeStringSetExpandedTextValue):
595         (AXAttributedStringAppendText):
596         (AXAttributeStringSetexpandedTextValue): Deleted.
597
598 2016-08-17  Antti Koivisto  <antti@apple.com>
599
600         Remove StyleCachedImageSet
601         https://bugs.webkit.org/show_bug.cgi?id=160941
602
603         Reviewed by Simon Fraser.
604
605         It is almost the same as StyleCachedImage. Just use that.
606
607         * CMakeLists.txt:
608         * WebCore.xcodeproj/project.pbxproj:
609         * css/CSSCursorImageValue.cpp:
610         (WebCore::CSSCursorImageValue::cachedImage):
611         * css/CSSImageSetValue.cpp:
612         (WebCore::CSSImageSetValue::detachPendingImage):
613         (WebCore::CSSImageSetValue::~CSSImageSetValue):
614         (WebCore::CSSImageSetValue::fillImageSet):
615         (WebCore::CSSImageSetValue::bestImageForScaleFactor):
616         (WebCore::CSSImageSetValue::bestFitImage):
617         (WebCore::CSSImageSetValue::cachedOrPendingImageSet):
618         (WebCore::CSSImageSetValue::customCSSText):
619         (WebCore::CSSImageSetValue::traverseSubresources):
620         (WebCore::CSSImageSetValue::cachedImageSet): Deleted.
621         * css/CSSImageSetValue.h:
622         (WebCore::CSSImageSetValue::create):
623         (WebCore::CSSImageSetValue::compareByScaleFactor):
624         * css/StyleResolver.cpp:
625         * page/EventHandler.cpp:
626         * rendering/style/ShapeValue.cpp:
627         (WebCore::ShapeValue::isImageValid):
628         * rendering/style/StyleAllInOne.cpp:
629         * rendering/style/StyleCachedImage.cpp:
630         (WebCore::StyleCachedImage::StyleCachedImage):
631
632             Add scale factor and CSSImageSetValue backpointer, the only additional features of StyleCachedImageSet.
633
634         (WebCore::StyleCachedImage::cssValue):
635         (WebCore::StyleCachedImage::imageSize):
636         (WebCore::StyleCachedImage::imageHasRelativeWidth):
637         * rendering/style/StyleCachedImage.h:
638         * rendering/style/StyleCachedImageSet.cpp: Removed.
639         * rendering/style/StyleCachedImageSet.h: Removed.
640         * rendering/style/StyleImage.h:
641         (WebCore::StyleImage::isCachedImage):
642         (WebCore::StyleImage::isPendingImage):
643         (WebCore::StyleImage::isGeneratedImage):
644         (WebCore::StyleImage::StyleImage):
645         (WebCore::StyleImage::isCachedImageSet): Deleted.
646         * style/StylePendingResources.cpp:
647         (WebCore::Style::loadPendingImage):
648
649 2016-08-17  Per Arne Vollan  <pvollan@apple.com>
650
651         [Win] Add tests for linked fonts.
652         https://bugs.webkit.org/show_bug.cgi?id=160898
653
654         Reviewed by Brent Fulgham.
655
656         Add tests for https://trac.webkit.org/changeset/204502.
657
658         * platform/graphics/win/FontCacheWin.cpp:
659         (WebCore::appendLinkedFonts):
660         (WebCore::getLinkedFonts):
661
662 2016-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
663
664         Unreviewed. Fix GObject DOM bindings API break after r204449, r204450 and r204451.
665
666         Attributes designMode, embeds, plugins, scripts and compatMode have been moved from HTMLDocument to Document.
667
668         * bindings/gobject/WebKitDOMDeprecated.cpp:
669         (webkit_dom_html_document_get_design_mode):
670         (webkit_dom_html_document_set_design_mode):
671         (webkit_dom_html_document_get_compat_mode):
672         (webkit_dom_html_document_get_embeds):
673         (webkit_dom_html_document_get_plugins):
674         (webkit_dom_html_document_get_scripts):
675         * bindings/gobject/WebKitDOMDeprecated.h:
676         * bindings/gobject/WebKitDOMDeprecated.symbols:
677         * bindings/gobject/webkitdom.symbols:
678
679 2016-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
680
681         Unreviewed. Fix GObject DOM bindings API break after r204312.
682
683         HTMLInputElement capture attribute now returns the actual capture value, instead of whether it's present or
684         not. This patch renames webkit_dom_html_input_element_get_capture as
685         webkit_dom_html_input_element_get_capture_type and deprecates webkit_dom_html_input_element_get_capture.
686
687         * bindings/gobject/WebKitDOMDeprecated.cpp:
688         (webkit_dom_html_input_element_get_capture):
689         * bindings/gobject/WebKitDOMDeprecated.h:
690         * bindings/gobject/WebKitDOMDeprecated.symbols:
691         * bindings/gobject/webkitdom.symbols:
692         * bindings/scripts/CodeGeneratorGObject.pm:
693         (GenerateProperty):
694         (GetEffectiveFunctionName):
695
696 2016-08-16  Ryosuke Niwa  <rniwa@webkit.org>
697
698         customElements.define should retrieve lifecycle callbacks
699         https://bugs.webkit.org/show_bug.cgi?id=160797
700
701         Reviewed by Chris Dumez.
702
703         Updated JSCustomElementInterface to invoke Get(constructor, "prototype") and Get(prototype, callbackName)
704         for each lifecycle callback as required by the latest specification:
705         https://html.spec.whatwg.org/#dom-customelementsregistry-define
706
707         Also added the support for "observedAttributes" property on the custom elements constructor which defines
708         the list of attributes for which attributeChangedCallback is invoked.
709
710         Test: fast/custom-elements/CustomElementsRegistry.html
711
712         * bindings/js/JSCustomElementInterface.cpp:
713         (WebCore::JSCustomElementInterface::setAttributeChangedCallback): Added.
714         (WebCore::JSCustomElementInterface::attributeChanged): Invoke m_attributeChangedCallback instead of on the
715         result of Get(element, "attributeChangedCallback").
716         * bindings/js/JSCustomElementInterface.h:
717         (WebCore::JSCustomElementInterface::observesAttribute): Added.
718
719         * bindings/js/JSCustomElementsRegistryCustom.cpp:
720         (WebCore::getLifecycleCallback): Added.
721         (WebCore::JSCustomElementsRegistry::define): Invoke Get(prototype, callbackName) for each callback. Also
722         store attributedChangedCallback and observedAttributes to JSCustomElementInterface. Other callbacks will
723         be stored in the future when the support for those callbacks are added.
724
725         * dom/Element.cpp:
726         (WebCore::Element::attributeChanged): Moved more code into enqueueAttributeChangedCallbackIfNeeded.
727
728         * dom/LifecycleCallbackQueue.cpp:
729         (WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded): Added an early exit for when
730         the given attribute is not observed by the custom element. Also moved the logic to retrieve
731         JSCustomElementInterface from Element::attributeChanged and renamed it from enqueueAttributeChangedCallback.
732
733         * bindings/js/JSDOMBinding.h:
734         (WebCore::toNativeArray): Throw a TypeError when the argument is not an object.
735         * bindings/js/JSDOMConvert.h:
736         (WebCore::Converter<Vector<T>>::convert): Removed a FIXME comment.
737
738 2016-08-16  Zalan Bujtas  <zalan@apple.com>
739
740         Subpixel rendering: Cleanup RenderLayerBacking::updateGeometry.
741         https://bugs.webkit.org/show_bug.cgi?id=156860
742         <rdar://problem/25432352>
743
744         Reviewed by Simon Fraser.
745
746         This patch cleans up the subpixel adjustment computation for the graphics layers
747         in RenderLayerBacking::updateGeometry.
748         It also fixes subpixel jiggling with clipping layers (both ancestor and child containment layers). 
749
750         Tests: compositing/hidpi-ancestor-subpixel-clipping.html
751                compositing/hidpi-sibling-composited-content-offset.html
752                compositing/hidpi-subpixel-transform-origin.html
753                fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor.html
754
755         * rendering/RenderLayer.cpp:
756         (WebCore::RenderLayer::beginTransparencyLayers):
757         (WebCore::RenderLayer::paint):
758         (WebCore::RenderLayer::clipToRect):
759         (WebCore::RenderLayer::setupClipPath):
760         (WebCore::RenderLayer::paintLayerByApplyingTransform):
761         (WebCore::RenderLayer::paintBackgroundForFragments):
762         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
763         (WebCore::RenderLayer::paintOutlineForFragments):
764         (WebCore::RenderLayer::paintMaskForFragments):
765         (WebCore::RenderLayer::paintChildClippingMaskForFragments):
766         (WebCore::RenderLayer::paintOverflowControlsForFragments):
767         (WebCore::RenderLayer::calculateClipRects):
768         * rendering/RenderLayer.h:
769         * rendering/RenderLayerBacking.cpp:
770         (WebCore::subpixelOffsetFromRendererChanged):
771         (WebCore::subpixelForLayerPainting):
772         (WebCore::computeOffsetFromRenderer):
773         (WebCore::snappedGraphicsLayerRect):
774         (WebCore::computeOffsetFromAncestorGraphicsLayer):
775         (WebCore::ComputedOffsets::ComputedOffsets): This is a helper class to hold offset values.
776         (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
777         (WebCore::ComputedOffsets::fromParentGraphicsLayer):
778         (WebCore::ComputedOffsets::fromPrimaryGraphicsLayer):
779         (WebCore::RenderLayerBacking::computePrimaryGraphicsLayerRect):
780         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
781         (WebCore::RenderLayerBacking::updateGeometry):
782         (WebCore::RenderLayerBacking::updateMaskingLayerGeometry):
783         (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer):
784         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
785         (WebCore::RenderLayerBacking::paintIntoLayer):
786         (WebCore::RenderLayerBacking::paintContents):
787         (WebCore::devicePixelFractionGapFromRendererChanged): Deleted.
788         (WebCore::pixelFractionForLayerPainting): Deleted.
789         (WebCore::calculateDevicePixelOffsetFromRenderer): Deleted.
790         (WebCore::RenderLayerBacking::adjustAncestorCompositingBoundsForFlowThread): Deleted.
791         * rendering/RenderLayerBacking.h:
792
793 2016-08-16  Commit Queue  <commit-queue@webkit.org>
794
795         Unreviewed, rolling out r204540, r204545, and r204547.
796         https://bugs.webkit.org/show_bug.cgi?id=160932
797
798         Broke Windows builds (Requested by rniwa on #webkit).
799
800         Reverted changesets:
801
802         "customElements.define should retrieve lifecycle callbacks"
803         https://bugs.webkit.org/show_bug.cgi?id=160797
804         http://trac.webkit.org/changeset/204540
805
806         "Windows build fix attempt after r204540."
807         http://trac.webkit.org/changeset/204545
808
809         "Another Windows build fix attempt. The error message doesn't
810         make any sense to me."
811         http://trac.webkit.org/changeset/204547
812
813 2016-08-16  Hunseop Jeong  <hs85.jeong@samsung.com>
814
815         Unreviewed, CMake build fix after r204532
816
817         * PlatformMac.cmake:
818
819 2016-08-16  Hunseop Jeong  <hs85.jeong@samsung.com>
820
821         Unreviewed, CMake build fix
822
823         * PlatformMac.cmake:
824
825 2016-08-16  Ryosuke Niwa  <rniwa@webkit.org>
826
827         Another Windows build fix attempt. The error message doesn't make any sense to me.
828
829         * bindings/js/JSCustomElementsRegistryCustom.cpp:
830         (WebCore::JSCustomElementsRegistry::define):
831
832 2016-08-16  Ryosuke Niwa  <rniwa@webkit.org>
833
834         Windows build fix attempt after r204540.
835
836         * bindings/js/JSBindingsAllInOne.cpp:
837
838 2016-08-16  Alex Christensen  <achristensen@webkit.org>
839
840         URLParser should parse URLs without credentials
841         https://bugs.webkit.org/show_bug.cgi?id=160913
842
843         Reviewed by Brady Eidson.
844
845         When parsing a URL, after the scheme we do not know if we are parsing a username and password
846         or if we are parsing the host until we hit a '@' indicating the end of the credentials or a /, ?, or #
847         indicating the end of the host.  Because there are significantly different rules for serializing usernames,
848         passwords, and hosts (all of which have yet to be implemented in URLParser) we put the code points after the 
849         scheme in a special buffer that will be processed once we know what we are parsing.
850         
851         In the future, this could be optimized by assuming that we are parsing the host and if we encounter a '@' character,
852         then do some extra work.  This would save us the effort of copying the host twice because most URLs don't have credentials.
853
854         This is covered by a new URLParser API test.
855
856         * platform/Logging.h:
857         * platform/URLParser.cpp:
858         (WebCore::isC0Control):
859         (WebCore::isC0ControlOrSpace):
860         (WebCore::isTabOrNewline):
861         (WebCore::isSpecialScheme):
862         (WebCore::URLParser::parse):
863         (WebCore::URLParser::authorityEndReached):
864         (WebCore::URLParser::hostEndReached):
865         (WebCore::URLParser::allValuesEqual):
866         (WebCore::isASCIIDigit): Deleted.
867         (WebCore::isASCIIAlpha): Deleted.
868         (WebCore::isASCIIAlphanumeric): Deleted.
869         * platform/URLParser.h:
870         (WebCore::URLParser::parse):
871
872 2016-08-16  Chris Dumez  <cdumez@apple.com>
873
874         Add support for ShadowRoot.mode attribute
875         https://bugs.webkit.org/show_bug.cgi?id=160919
876
877         Reviewed by Ryosuke Niwa.
878
879         Add support for ShadowRoot.mode attribute:
880         - https://dom.spec.whatwg.org/#interface-shadowroot
881
882         Test: fast/shadow-dom/ShadowRoot-mode.html
883
884         * css/ElementRuleCollector.cpp:
885         (WebCore::ElementRuleCollector::collectMatchingRules):
886         * css/SelectorChecker.cpp:
887         (WebCore::SelectorChecker::matchRecursively):
888         * dom/Element.cpp:
889         (WebCore::Element::bindingsOffsetParent):
890         (WebCore::Element::addShadowRoot):
891         (WebCore::Element::attachShadow):
892         (WebCore::Element::shadowRootForBindings):
893         (WebCore::Element::userAgentShadowRoot):
894         (WebCore::Element::ensureUserAgentShadowRoot):
895         * dom/Node.cpp:
896         (WebCore::Node::isUnclosedNode):
897         (WebCore::Node::assignedSlotForBindings):
898         (WebCore::Node::isInUserAgentShadowTree):
899         * dom/ShadowRoot.cpp:
900         (WebCore::ShadowRoot::ShadowRoot):
901         (WebCore::ShadowRoot::styleResolver):
902         * dom/ShadowRoot.h:
903         * dom/ShadowRoot.idl:
904         * dom/SlotAssignment.cpp:
905         (WebCore::SlotAssignment::didChangeSlot):
906         * html/HTMLSummaryElement.cpp:
907         (WebCore::HTMLSummaryElement::create):
908         * inspector/InspectorDOMAgent.cpp:
909         (WebCore::shadowRootType):
910         (WebCore::InspectorDOMAgent::buildObjectForNode):
911         * rendering/HitTestResult.cpp:
912         (WebCore::moveOutOfUserAgentShadowTree):
913         * rendering/RenderElement.cpp:
914         (WebCore::RenderElement::selectionPseudoStyle):
915         * rendering/RenderLayer.cpp:
916         (WebCore::rendererForScrollbar):
917         * svg/SVGElement.cpp:
918         (WebCore::SVGElement::correspondingUseElement):
919         * testing/Internals.cpp:
920         (WebCore::Internals::shadowRootType):
921
922 2016-08-16  Ryosuke Niwa  <rniwa@webkit.org>
923
924         customElements.define should retrieve lifecycle callbacks
925         https://bugs.webkit.org/show_bug.cgi?id=160797
926
927         Reviewed by Chris Dumez.
928
929         Updated JSCustomElementInterface to invoke Get(constructor, "prototype") and Get(prototype, callbackName)
930         for each lifecycle callback as required by the latest specification:
931         https://html.spec.whatwg.org/#dom-customelementsregistry-define
932
933         Also added the support for "observedAttributes" property on the custom elements constructor which defines
934         the list of attributes for which attributeChangedCallback is invoked.
935
936         Test: fast/custom-elements/CustomElementsRegistry.html
937
938         * bindings/js/JSCustomElementInterface.cpp:
939         (WebCore::JSCustomElementInterface::setAttributeChangedCallback): Added.
940         (WebCore::JSCustomElementInterface::attributeChanged): Invoke m_attributeChangedCallback instead of on the
941         result of Get(element, "attributeChangedCallback").
942         * bindings/js/JSCustomElementInterface.h:
943         (WebCore::JSCustomElementInterface::observesAttribute): Added.
944
945         * bindings/js/JSCustomElementsRegistryCustom.cpp:
946         (WebCore::getLifecycleCallback): Added.
947         (WebCore::JSCustomElementsRegistry::define): Invoke Get(prototype, callbackName) for each callback. Also
948         store attributedChangedCallback and observedAttributes to JSCustomElementInterface. Other callbacks will
949         be stored in the future when the support for those callbacks are added.
950
951         * dom/Element.cpp:
952         (WebCore::Element::attributeChanged): Moved more code into enqueueAttributeChangedCallbackIfNeeded.
953
954         * dom/LifecycleCallbackQueue.cpp:
955         (WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded): Added an early exit for when
956         the given attribute is not observed by the custom element. Also moved the logic to retrieve
957         JSCustomElementInterface from Element::attributeChanged and renamed it from enqueueAttributeChangedCallback.
958
959         * bindings/js/JSDOMBinding.h:
960         (WebCore::toNativeArray): Throw a TypeError when the argument is not an object.
961         * bindings/js/JSDOMConvert.h:
962         (WebCore::Converter<Vector<T>>::convert): Removed a FIXME comment.
963
964 2016-08-16  Anders Carlsson  <andersca@apple.com>
965
966         Fix build.
967
968         * Configurations/WebCore.xcconfig:
969
970 2016-08-16  Chris Dumez  <cdumez@apple.com>
971
972         Align isDefaultNamespace() / lookupPrefix() / lookupNamespaceURI() with the specification
973         https://bugs.webkit.org/show_bug.cgi?id=160911
974
975         Reviewed by Ryosuke Niwa.
976
977         Align isDefaultNamespace() / lookupPrefix() / lookupNamespaceURI() with the specification:
978         - https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
979         - https://dom.spec.whatwg.org/#dom-node-lookupprefix
980         - https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
981
982         Our implementation now matches closely the text of the DOM specification
983         and we pass more W3C tests as it fixes the following bug:
984         - isDefaultNamespace(null) / isDefaultNamespace('') was not returning true for in cases
985           where the node's default namespace was null. Our implementation was returning false
986           instead of comparing the node's default namespace (in this case null) with the input
987           namespace (in this case null).
988
989         No new tests, rebaselined existing test.
990
991         * dom/Node.cpp:
992         (WebCore::locateDefaultNamespace):
993         (WebCore::Node::isDefaultNamespace):
994         (WebCore::Node::lookupNamespaceURI):
995         (WebCore::locateNamespacePrefix):
996         (WebCore::Node::lookupPrefix):
997         (WebCore::appendTextContent): Deleted.
998         (WebCore::Node::textContent): Deleted.
999         (WebCore::Node::setTextContent): Deleted.
1000         * dom/Node.h:
1001         * xml/NativeXPathNSResolver.cpp:
1002         (WebCore::NativeXPathNSResolver::lookupNamespaceURI):
1003
1004 2016-08-15  Ada Chan  <adachan@apple.com>
1005
1006         Placeholder does not show the first time going into picture-in-picture on video without controls
1007         https://bugs.webkit.org/show_bug.cgi?id=160868
1008
1009         Reviewed by Eric Carlson.
1010
1011         Test: media/controls/pip-placeholder-without-video-controls.html
1012
1013         If the media controls script is not injected by the time webkitpresentationmodechanged
1014         event fires, the script that updates the stylesheet to show the placeholder won't execute.
1015
1016         To fix this, doing one of the following would work:
1017         - Ensure the shadow dom for the video is set up when we schedule the
1018         webkitpresentationmodechanged event.
1019         - Make sure the styles are set up correctly to show the placeholder if needed
1020         when the Controller object (in mediaControlsApple.js) is created.
1021
1022         Doing both here following what we did for the wireless playback status.
1023
1024         * Modules/mediacontrols/mediaControlsApple.js:
1025         (Controller):
1026         Call updatePictureInPicturePlaceholder() so it updates the styles to show the
1027         placeholder if needed.
1028         (Controller.prototype.updatePictureInPicturePlaceholder):
1029         Extract the logic that updates the placeholder into a separate method so it can
1030         be called when we initialize Controller.
1031         (Controller.prototype.handlePresentationModeChange):
1032         Call updatePictureInPicturePlaceholder().
1033         * Modules/mediacontrols/mediaControlsiOS.js:
1034         (ControllerIOS.prototype.updatePictureInPicturePlaceholder):
1035         Renamed from handlePresentationModeChange().
1036         (ControllerIOS.prototype.handlePresentationModeChange): Deleted.
1037         * html/HTMLMediaElement.cpp:
1038         (WebCore::HTMLMediaElement::enterFullscreen):
1039         Call configureMediaControls() which ensures the shadow root gets added if needed.
1040
1041 2016-08-16  Simon Fraser  <simon.fraser@apple.com>
1042
1043         Rename FrameView::m_layoutDisallowed to m_layoutDisallowedCount
1044         https://bugs.webkit.org/show_bug.cgi?id=160918
1045
1046         Reviewed by Zalan Bujtas.
1047
1048         m_layoutDisallowedCount makes it clearer that it's accumulated.
1049
1050         * page/FrameView.h:
1051
1052 2016-08-16  Anders Carlsson  <andersca@apple.com>
1053
1054         Rename SSLKeyGeneratorMac.cpp to SSLKeyGeneratorMac.mm.
1055         
1056         Rubber-stamped by Dan Bernstein.
1057
1058         * platform/mac/SSLKeyGeneratorMac.mm: Renamed from platform/mac/SSLKeyGeneratorMac.cpp.
1059
1060 2016-08-16  Myles C. Maxfield  <mmaxfield@apple.com>
1061
1062         Migrate line breaking code from ints to Optional<unsigned>s
1063         https://bugs.webkit.org/show_bug.cgi?id=160859
1064
1065         Reviewed by Darin Adler.
1066
1067         Previously, we were using -1 to mean "before the beginning of the string". Now,
1068         Nullopt means that.
1069
1070         This patch also renames break_lines.{h,cpp} to BreakLines.{h.cpp}. This file was
1071         originally named during the KHTML days.
1072
1073         No new tests because there is no behavior change.
1074
1075         * CMakeLists.txt:
1076         * WebCore.xcodeproj/project.pbxproj:
1077         * rendering/BreakLines.cpp: Renamed from Source/WebCore/rendering/break_lines.cpp.
1078         * rendering/BreakLines.h: Renamed from Source/WebCore/rendering/break_lines.h.
1079         (WebCore::isBreakableSpace):
1080         (WebCore::shouldBreakAfter):
1081         (WebCore::needsLineBreakIterator):
1082         (WebCore::nextBreakablePositionNonLoosely):
1083         (WebCore::nextBreakablePositionLoosely):
1084         (WebCore::nextBreakablePositionKeepingAllWords):
1085         (WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP):
1086         (WebCore::nextBreakablePosition):
1087         (WebCore::nextBreakablePositionIgnoringNBSP):
1088         (WebCore::nextBreakablePositionLoose):
1089         (WebCore::nextBreakablePositionIgnoringNBSPLoose):
1090         (WebCore::isBreakable):
1091         * rendering/InlineIterator.h:
1092         (WebCore::InlineIterator::moveTo):
1093         (WebCore::InlineIterator::nextBreakablePosition):
1094         (WebCore::InlineIterator::setNextBreakablePosition):
1095         (WebCore::InlineIterator::InlineIterator): Deleted.
1096         * rendering/InlineTextBox.cpp:
1097         * rendering/RenderText.cpp:
1098         (WebCore::RenderText::computePreferredLogicalWidths):
1099         * rendering/RenderingAllInOne.cpp:
1100         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1101         * rendering/break_lines.h:
1102         (WebCore::isBreakableSpace): Deleted.
1103         (WebCore::shouldBreakAfter): Deleted.
1104         (WebCore::needsLineBreakIterator): Deleted.
1105         (WebCore::nextBreakablePositionNonLoosely): Deleted.
1106         (WebCore::nextBreakablePositionLoosely): Deleted.
1107         (WebCore::nextBreakablePositionKeepingAllWords): Deleted.
1108         (WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP): Deleted.
1109         (WebCore::nextBreakablePosition): Deleted.
1110         (WebCore::nextBreakablePositionIgnoringNBSP): Deleted.
1111         (WebCore::nextBreakablePositionLoose): Deleted.
1112         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
1113         (WebCore::isBreakable): Deleted.
1114         * rendering/line/BreakingContext.h:
1115         (WebCore::BreakingContext::commitLineBreakAtCurrentWidth):
1116         (WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition):
1117         (WebCore::BreakingContext::InlineIteratorHistory::moveTo):
1118         (WebCore::tryHyphenating):
1119         (WebCore::BreakingContext::handleText):
1120         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
1121
1122 2016-08-16  Chris Dumez  <cdumez@apple.com>
1123
1124         DOM4: getElementsByClassName should include non StyledElements
1125         https://bugs.webkit.org/show_bug.cgi?id=94718
1126
1127         Reviewed by Ryosuke Niwa.
1128
1129         getElementsByClassName() now includes non StyledElements as per the latest
1130         DOM specification:
1131         - https://dom.spec.whatwg.org/#concept-getelementsbyclassname
1132
1133         The new behavior is consistent with Firefox and Chrome.
1134
1135         Test: fast/dom/getElementsByClassName/non-styled-element.html
1136
1137         * dom/ClassCollection.h:
1138         (WebCore::ClassCollection::elementMatches):
1139
1140 2016-08-16  Brady Eidson  <beidson@apple.com>
1141
1142         Cleanup WK2 platform gamepad handling.
1143         https://bugs.webkit.org/show_bug.cgi?id=160871
1144
1145         Reviewed by Alex Christensen.
1146
1147         No new tests (No currently testable change in behavior).
1148
1149         This patch does a few things:
1150         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
1151         2 - Uses this new concept to much more cleanly handle the case where we are not currently
1152             monitoring gamepad inputs because an interested WKWebView is not front and center.
1153         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
1154
1155         * platform/gamepad/GamepadProviderClient.h:
1156         (WebCore::GamepadProviderClient::setInitialConnectedGamepads):
1157
1158         * platform/gamepad/mac/HIDGamepadProvider.cpp:
1159         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
1160         (WebCore::HIDGamepadProvider::stopMonitoringInput):
1161         (WebCore::HIDGamepadProvider::startMonitoringInput):
1162         (WebCore::HIDGamepadProvider::connectionDelayTimerFired):
1163         * platform/gamepad/mac/HIDGamepadProvider.h:
1164
1165 2016-08-16  Chris Dumez  <cdumez@apple.com>
1166
1167         querySelector() / querySelectorAll() should always throw a SyntaxError when failing to parse selector string
1168         https://bugs.webkit.org/show_bug.cgi?id=160906
1169
1170         Reviewed by Ryosuke Niwa.
1171
1172         querySelector() / querySelectorAll() should always throw a SyntaxError
1173         when failing to parse selector string:
1174         - https://dom.spec.whatwg.org/#dom-parentnode-queryselector
1175         - https://dom.spec.whatwg.org/#scope-match-a-selectors-string
1176
1177         In some cases, WebKit was throwing a NamespaceError instead.
1178
1179         No new tests, rebaselined existing tests.
1180
1181         * dom/SelectorQuery.cpp:
1182         (WebCore::SelectorQueryCache::add):
1183
1184 2016-08-16  Brent Fulgham  <bfulgham@apple.com>
1185
1186         Upgrade-Insecure-Request state is improperly retained between navigations
1187         https://bugs.webkit.org/show_bug.cgi?id=160905
1188         <rdar://problem/27075526>
1189
1190         Reviewed by Andy Estes.
1191
1192         Correct the handling of Upgrade-Insecure-Request state to match the specification, so that
1193         performing top-level navigation to sites that do not have the Upgrade-Insecure-Request header
1194         does not automatically upgrade insecure loads. The same loads performed in an iframe should
1195         be upgraded.
1196
1197         The iframe case was already handled in our tests, but a new test is added that models the top-level
1198         navigation and confirms that an upgrade is not performed.
1199
1200         Tests: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-uir-on-navigation.html
1201
1202         * dom/Document.cpp:
1203         (WebCore::Document::initContentSecurityPolicy): Properly inherit Upgrade-Insecure-Request state for children
1204         of existing frames.
1205         * loader/DocumentWriter.cpp:
1206         (WebCore::DocumentWriter::begin): Retain the history of upgraded resources (per the specification) so that
1207         we continue to upgrade resources that were upgraded during earlier navigations. Note that we do NOT want to
1208         retain the state of the Upgrade-Insecure-Requests header itself.
1209         * page/csp/ContentSecurityPolicy.cpp:
1210         (WebCore::ContentSecurityPolicy::copyStateFrom): Update to use new helper function.
1211         (WebCore::ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom): New helper function.
1212         * page/csp/ContentSecurityPolicy.h:
1213
1214 2016-08-16  Chris Dumez  <cdumez@apple.com>
1215
1216         ctx.drawImage should clip source rect if it is outside the source image
1217         https://bugs.webkit.org/show_bug.cgi?id=160804
1218
1219         Reviewed by Simon Fraser.
1220
1221         According to the specification [1]"
1222         "When the source rectangle is outside the source image, the source rectangle
1223         must be clipped to the source image and the destination rectangle must be
1224         clipped in the same proportion."
1225
1226         Firefox and Chrome behave according to the specification. This patch aligns
1227         our behavior.
1228
1229         [1] https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
1230
1231         Test: fast/canvas/drawImage-srcRect-clipping.html
1232
1233         * html/canvas/CanvasRenderingContext2D.cpp:
1234         (WebCore::CanvasRenderingContext2D::drawImage):
1235
1236 2016-08-16  George Ruan  <gruan@apple.com>
1237
1238         ⛱ : Implement parsing of Media Constraints for getUserMedia algorithm in Media Capture and Streaming Spec
1239         https://bugs.webkit.org/show_bug.cgi?id=160533
1240         <rdar://problem/27688483>
1241
1242         Reviewed by Chris Dumez.
1243
1244         Two getUserMedia tests have been updated to reflect changes and cover limited
1245         testing of the parsing of media constraints when given to getUserMedia().
1246         Current testing infrastructure doesn't support full testing of the parsing
1247         of media constraints. Either a mock needs to be created or the selectSettings()
1248         algorithm will need to be implemented so we can see the constraints reflected
1249         by the settings of media stream tracks. See https://bugs.webkit.org/show_bug.cgi?id=160791.
1250
1251         The specification on media constraints and how they are provided to getUserMedia() and 
1252         applyConstraints() has changed. These constraints are parsed in the bindings and are
1253         stored in a new class MediaConstraint with derived classes LongConstraint, DoubleConstraint,
1254         BooleanConstraint, and StringConstraint, each holding their respective type of constraint
1255         value.
1256
1257         * CMakeLists.txt: Add JSMediaDevicesCustom.cpp and MediaConstraints.cpp.
1258         * Modules/mediastream/CaptureDeviceManager.cpp:
1259         (CaptureDeviceManager::verifyConstraintsForMediaType): Make changes according
1260         to how format of MediaConstraint was changed.
1261         (CaptureDeviceManager::sessionSupportsConstraint): Ditto.
1262         (CaptureDeviceManager::isSupportedFrameRate): Ditto. Also for the time being
1263         support constraint validation with a static acceptable frame rate range of 0-60.
1264         See relevant https://bugs.webkit.org/show_bug.cgi?id=160794 for supporting
1265         constraint validation of frame rate dynamically.
1266         * Modules/mediastream/CaptureDeviceManager.h: Make changes according to how
1267         format of MediaConstraint was changed.
1268         * Modules/mediastream/MediaConstraintsImpl.cpp: Remove code for parsing media
1269         constraints in the legacy format with keys 'mandatory' and 'optional'. Removal
1270         of legacy code is fine since MEDIA_STREAM feature flag is not enabled for any port.
1271         (WebCore::MediaConstraintsImpl::create): Ditto
1272         (WebCore::MediaConstraintsImpl::initialize): Still used by applyConstraints().
1273         Added FIXME to remove after applyConstraints implementation is changed according
1274         to w3c spec changes.
1275         (WebCore::MediaConstraintsImpl::mandatoryConstraints): Make changes according to
1276         how media constraint data is now stored.
1277         (WebCore::MediaConstraintsImpl::advancedConstraints): Ditto.
1278         (WebCore::MediaConstraintsImpl::getMandatoryConstraints): Deleted.
1279         (WebCore::MediaConstraintsImpl::getOptionalConstraints): Deleted.
1280         (WebCore::MediaConstraintsImpl::getMandatoryConstraintValue): Deleted.
1281         (WebCore::MediaConstraintsImpl::getOptionalConstraintValue): Deleted.
1282         * Modules/mediastream/MediaConstraintsImpl.h:
1283         (WebCore::MediaConstraintsImpl::MediaConstraintsImpl): Add a constructor to allow
1284         construction of MediaConstraintsImpl object based on how the custom binding code
1285         for MediaDevices would parse the media constraints given to getUserMedia().
1286         * Modules/mediastream/MediaDevices.cpp:
1287         (WebCore::MediaDevices::getUserMedia): Make changes according to how media constraint
1288         data is now stored.
1289         * Modules/mediastream/MediaDevices.h: Ditto.
1290         * Modules/mediastream/MediaDevices.idl: Add custom binding to parse media constraints,
1291         since we do not have support for automatic binding generation of sequence of dictionaries,
1292         dictionary inheritance, dictionaries inside of dictionaries, disjunctions, or dictionaries
1293         without an interface.
1294         * Modules/mediastream/MediaStreamTrack.cpp: Add FIXME with related bug.
1295         (WebCore::MediaStreamTrack::applyConstraints): Ditto.
1296         * Modules/mediastream/UserMediaRequest.cpp: Make changes according to how media constraint
1297         data is now parsed and stored.
1298         (WebCore::UserMediaRequest::start): Ditto.
1299         (WebCore::UserMediaRequest::UserMediaRequest): Ditto.
1300         (WebCore::UserMediaRequest::didCreateStream): Ditto.
1301         (WebCore::parseOptions): Deleted.
1302         * Modules/mediastream/UserMediaRequest.h: Ditto.
1303         * WebCore.xcodeproj/project.pbxproj:
1304         * bindings/js/JSBindingsAllInOne.cpp: Added JSMediaDevicesCustom.cpp.
1305         * bindings/js/JSMediaDevicesCustom.cpp: Added. Custom bindings to parse media constraints.
1306         (WebCore::initializeStringConstraintWithList): Initialize string constraint 'exact' or 'ideal'
1307         value according to an ArrayValue.
1308         (WebCore::createStringConstraint): Given a dictionary acting as a 'MediaTrackConstraintSet'
1309         and a string constraint key (e.g for facingMode), creates a native StringConstraint class to hold
1310         the data.
1311         (WebCore::createBooleanConstraint): Ditto but for constraints of type boolean.
1312         (WebCore::createDoubleConstraint): Ditto but for constraints of type double.
1313         (WebCore::createIntConstraint): Ditto but for constraints of type long.
1314         (WebCore::parseMediaTrackConstraintSetForKey): Parses a given dictionary acting as a
1315         'MediaTrackConstraintSet' for a constraint as the key and creates the correct native object to hold
1316         the data.
1317         (WebCore::parseAdvancedConstraints): Parses the advanced constraints.
1318         (WebCore::parseConstraints): Parses the constraints of a Dictionary acting as a
1319         'MediaTrackConstraints'.
1320         (WebCore::JSMediaDevices::getUserMedia): Parses the constraint input to getUserMedia.
1321         * platform/mediastream/MediaConstraints.cpp: Added. Add MediaConstraint classes with derived
1322         classes IntConstraint, DoubleConstraint, BooleanConstraint, and StringConstraint to act as
1323         containers for the parsed data from getUserMedia().
1324         (WebCore::MediaConstraint::create): Factory that creates the correct derived class based on the
1325         name of a media constraint.
1326         (WebCore::MediaConstraint::getMin): Interface for getting the min value for a constraint.
1327         ASSERT checks are in place to prevent calling getMin with the incorrect constraint type.
1328         (WebCore::MediaConstraint::getMax): Ditto but for max value of constraint.
1329         (WebCore::MediaConstraint::getExact): Ditto but for exact value of constraint.
1330         (WebCore::MediaConstraint::getIdeal): Ditto but for ideal value of constraint.
1331         (WebCore::IntConstraint::create): Creates a long constraint.
1332         (WebCore::IntConstraint::setMin): Sets min value of constraint.
1333         (WebCore::IntConstraint::setMax): Sets max value of constraint.
1334         (WebCore::IntConstraint::setExact): Sets exact value of constraint.
1335         (WebCore::IntConstraint::setIdeal): Sets ideal value of constraint.
1336         (WebCore::IntConstraint::getMin): Overrides interface function and gets min value of constraint.
1337         (WebCore::IntConstraint::getMax): Ditto but for max value of constraint.
1338         (WebCore::IntConstraint::getExact): Ditto but for exact value of constraint.
1339         (WebCore::IntConstraint::getIdeal): Ditto but for ideal value of constraint.
1340         (WebCore::DoubleConstraint::create): Ditto, DoubleConstraint instead of IntConstraint.
1341         (WebCore::DoubleConstraint::setMin): Ditto.
1342         (WebCore::DoubleConstraint::setMax): Ditto.
1343         (WebCore::DoubleConstraint::setExact): Ditto.
1344         (WebCore::DoubleConstraint::setIdeal): Ditto.
1345         (WebCore::DoubleConstraint::getMin): Ditto.
1346         (WebCore::DoubleConstraint::getMax): Ditto.
1347         (WebCore::DoubleConstraint::getExact): Ditto.
1348         (WebCore::DoubleConstraint::getIdeal): Ditto.
1349         (WebCore::BooleanConstraint::create): Ditto, BooleanConstraint instead of IntConstraint.
1350         (WebCore::BooleanConstraint::setExact): Ditto.
1351         (WebCore::BooleanConstraint::setIdeal): Ditto.
1352         (WebCore::BooleanConstraint::getExact): Ditto.
1353         (WebCore::BooleanConstraint::getIdeal): Ditto.
1354         (WebCore::StringConstraint::create): Ditto, StringConstraint instead of IntConstraint.
1355         (WebCore::StringConstraint::setExact): Ditto.
1356         (WebCore::StringConstraint::appendExact): Appends string to 'exact' value of StringConstraint.
1357         (WebCore::StringConstraint::setIdeal): Ditto.
1358         (WebCore::StringConstraint::appendIdeal): Appends string to 'ideal' value of StringConstraint.
1359         (WebCore::StringConstraint::getExact): Ditto.
1360         (WebCore::StringConstraint::getIdeal): Ditto.
1361         * platform/mediastream/MediaConstraints.h: Add MediaConstraint classes with derived
1362         classes IntConstraint, DoubleConstraint, BooleanConstraint, and StringConstraint to act as
1363         containers for the parsed data from getUserMedia().
1364         (WebCore::MediaConstraint::~MediaConstraint):
1365         (WebCore::MediaConstraint::name): Get name of constraint.
1366         (WebCore::MediaConstraint::MediaConstraint): Constructor.
1367         (WebCore::NumericConstraint::NumericConstraint): Base class of DoubleConstraint and IntConstraint.
1368         (WebCore::NumericConstraint::setHasMin): Sets whether object has min vlaue.
1369         (WebCore::NumericConstraint::setHasMax): Ditto but for max.
1370         (WebCore::NumericConstraint::setHasExact): Ditto but for exact.
1371         (WebCore::NumericConstraint::setHasIdeal): Ditto but for ideal.
1372         (WebCore::NumericConstraint::hasMin): Gets whether object has min value.
1373         (WebCore::NumericConstraint::hasMax): Ditto but for max.
1374         (WebCore::NumericConstraint::hasExact): Ditto but for exact.
1375         (WebCore::NumericConstraint::hasIdeal): Ditto but for ideal.
1376         * platform/mediastream/RealtimeMediaSourceCenter.h: Parameters can be reference since
1377         lifetime is guaranteed and ownership is not taken.
1378         * platform/mediastream/mac/AVCaptureDeviceManager.h: Ditto.
1379         * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto.
1380         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Ditto.
1381         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Make changes according to
1382         how media constraint data is stored.
1383         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
1384         Ditto.
1385         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Ditto.
1386         * platform/mediastream/mac/AVVideoCaptureSource.h: Change frame rate from 'float' to 'double'.
1387         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1388         (WebCore::AVVideoCaptureSource::setFrameRateConstraint): Ditto.
1389         (WebCore::AVVideoCaptureSource::applyConstraints): Make changes according to how media constraint
1390         data is stored. The implementation of applyConstraints has also drastically changed, and a FIXME
1391         is associated.
1392         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1393         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
1394         The bindings will always pass a non-null MediaConstraints object to
1395         getUserMedia() so a pointer MediaConstraints parameter is not necessary.
1396         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream): Ditto.
1397         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Change 'override' to 'final'
1398         since RealtimeMediaSourceCenterMac is a 'final' class.
1399         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: Ditto to
1400         RealtimeMediaSourceCenterMac.
1401         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Ditto.
1402         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
1403         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h: Ditto.
1404         * platform/mock/MediaConstraintsMock.cpp: Change how constraint validation is mocked.
1405         (WebCore::isLongMediaConstraintSatisfiable): Sets arbitrary min and max supported value to be 0 and 10,
1406         respectively. Then checks if constraint is satisfiable.
1407         (WebCore::isDoubleMediaConstraintSatisfiable): Ditto but with double.
1408         (WebCore::isBooleanMediaConstraintSatisfiable): Mock a boolean constraint to only be satisfiable if the
1409         'exact' value is true.
1410         (WebCore::isStringMediaConstraintSatisfiable): Mock a string constraint to only be satisfiable if the
1411         'exact' value has the string 'valid'
1412         (WebCore::isSatisfiable): Checks if a certain constraint is satisfiable.
1413         (WebCore::MediaConstraintsMock::verifyConstraints): Verifies if the constraints are satisfiable.
1414         (WebCore::isSupported): Deleted.
1415         (WebCore::isValid): Deleted.
1416         * platform/mock/MediaConstraintsMock.h: Change argument of MediaConstraints to raw pointer.
1417         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Change arguments of MediaConstraints to a raw pointer
1418         and make changes according to how the MediaConstraint was changed.
1419         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
1420         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
1421         * platform/mock/MockRealtimeMediaSourceCenter.h: Change argument of MediaConstraints to raw pointer.
1422
1423 2016-08-16  Alex Christensen  <achristensen@webkit.org>
1424
1425         Fix WinCairo build after r204512.
1426
1427         * platform/network/curl/SocketStreamHandleImpl.h:
1428         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
1429         (WebCore::createCopy):
1430         (WebCore::SocketStreamHandleImpl::createCopy): Deleted.
1431
1432 2016-08-16  Alex Christensen  <achristensen@webkit.org>
1433
1434         Clean up WebSockets
1435         https://bugs.webkit.org/show_bug.cgi?id=160889
1436
1437         Reviewed by Darin Adler.
1438
1439         We should use size_t's instead of ints for data lengths.
1440         SocketStreamHandleClient is now purely virtual.
1441         A few places that will need SocketStreamHandleImpls instead of SocketStreamHandles now have them.
1442         This patch doesn't change behavior.
1443
1444         * Modules/websockets/WebSocketChannel.cpp:
1445         (WebCore::WebSocketChannel::didCloseSocketStream):
1446         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
1447         * Modules/websockets/WebSocketChannel.h:
1448         * platform/network/SocketStreamHandle.cpp:
1449         (WebCore::SocketStreamHandle::state):
1450         (WebCore::SocketStreamHandle::send):
1451         * platform/network/SocketStreamHandle.h:
1452         (WebCore::SocketStreamHandle::~SocketStreamHandle):
1453         (WebCore::SocketStreamHandle::bufferedAmount):
1454         (WebCore::SocketStreamHandle::client): Deleted.
1455         * platform/network/SocketStreamHandleClient.h:
1456         (WebCore::SocketStreamHandleClient::~SocketStreamHandleClient):
1457         (WebCore::SocketStreamHandleClient::didOpenSocketStream): Deleted.
1458         (WebCore::SocketStreamHandleClient::didCloseSocketStream): Deleted.
1459         (WebCore::SocketStreamHandleClient::didReceiveSocketStreamData): Deleted.
1460         (WebCore::SocketStreamHandleClient::didUpdateBufferedAmount): Deleted.
1461         (WebCore::SocketStreamHandleClient::didFailSocketStream): Deleted.
1462         * platform/network/cf/SocketStreamHandleImpl.h:
1463         (WebCore::SocketStreamHandleImpl::create):
1464         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1465         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
1466         (WebCore::SocketStreamHandleImpl::platformSend):
1467         (WebCore::SocketStreamHandleImpl::platformClose):
1468         * platform/network/curl/SocketStreamHandleImpl.h:
1469         (WebCore::SocketStreamHandleImpl::create):
1470         * platform/network/soup/SocketStreamHandleImpl.h:
1471         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1472         (WebCore::SocketStreamHandleImpl::create):
1473
1474 2016-08-16  Chris Dumez  <cdumez@apple.com>
1475
1476         Unreviewed, rolling out r204506.
1477
1478         Broke the build
1479
1480         Reverted changeset:
1481
1482         "Cleanup WK2 platform gamepad handling."
1483         https://bugs.webkit.org/show_bug.cgi?id=160871
1484         http://trac.webkit.org/changeset/204506
1485
1486 2016-08-16  Darin Adler  <darin@apple.com>
1487
1488         [Cocoa] Remove dependency on Objective-C bindings in WebKit2 editing code
1489         https://bugs.webkit.org/show_bug.cgi?id=160891
1490
1491         Reviewed by Anders Carlsson.
1492
1493         * WebCore.xcodeproj/project.pbxproj: Removed EditorCocoa.h.
1494
1495         * editing/Editor.cpp: Removed member initialization for members now
1496         initialized in the class definition.
1497
1498         * editing/Editor.h: Added FragmentAndResources struct, createFragment
1499         member function, and _WebCreateFragment function. Also initialize all the
1500         scalar data members here instead of in the constructor.
1501
1502         * editing/cocoa/EditorCocoa.h: Removed. This was unused.
1503
1504         * editing/cocoa/EditorCocoa.mm:
1505         (WebCore::Editor::createFragment): Added. Calls through to WebKitLegacy
1506         using soft linking for now, but later should be implemented here in WebCore.
1507
1508         * editing/ios/EditorIOS.mm:
1509         (WebCore::Editor::createFragmentAndAddResources): Call createFragment.
1510
1511         * editing/mac/EditorMac.mm:
1512         (WebCore::Editor::createFragmentAndAddResources): Call createFragment.
1513
1514         * loader/EmptyClients.h: Removed documentFragmentFromAttributedString
1515         implementation.
1516
1517         * page/EditorClient.h: Removed documentFragmentFromAttributedString.
1518         Two reasons: The first is that this is now implemented in WebCore. While
1519         there is a call through to WebKitLegacy, it's a temporary thing and done
1520         with soft linking. The second reason is that this returned a raw pointer,
1521         which is not safe in general. Was safe here because it was returning a
1522         pointer owned by an autoreleased Objective-C object.
1523
1524 2016-08-16  Brady Eidson  <beidson@apple.com>
1525
1526         Cleanup WK2 platform gamepad handling.
1527         https://bugs.webkit.org/show_bug.cgi?id=160871
1528
1529         Reviewed by Alex Christensen.
1530
1531         No new tests (No currently testable change in behavior).
1532
1533         This patch does a few things:
1534         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
1535         2 - Uses this new concept to much more cleanly handle the case where we are not currently
1536             monitoring gamepad inputs because an interested WKWebView is not front and center.
1537         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
1538
1539         * platform/gamepad/GamepadProviderClient.h:
1540         (WebCore::GamepadProviderClient::setInitialConnectedGamepads):
1541
1542         * platform/gamepad/mac/HIDGamepadProvider.cpp:
1543         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
1544         (WebCore::HIDGamepadProvider::stopMonitoringInput):
1545         (WebCore::HIDGamepadProvider::startMonitoringInput):
1546         (WebCore::HIDGamepadProvider::connectionDelayTimerFired):
1547         * platform/gamepad/mac/HIDGamepadProvider.h:
1548
1549 2016-08-16  Commit Queue  <commit-queue@webkit.org>
1550
1551         Unreviewed, rolling out r204494.
1552         https://bugs.webkit.org/show_bug.cgi?id=160901
1553
1554         Broke the iOS build (Requested by cdumez on #webkit).
1555
1556         Reverted changeset:
1557
1558         "Drop unused EventTarget::hasActiveEventListeners()"
1559         https://bugs.webkit.org/show_bug.cgi?id=160869
1560         http://trac.webkit.org/changeset/204494
1561
1562 2016-08-16  Darin Adler  <darin@apple.com>
1563
1564         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1565         Regenerated results, which were affected by the sequence<T> change last night.
1566
1567 2016-08-16  Per Arne Vollan  <pvollan@apple.com>
1568
1569         [Win] Hardening of getLinkedFonts function.
1570         https://bugs.webkit.org/show_bug.cgi?id=160850
1571
1572         The SUCCEEDED macro should only be used for functions returning a HRESULT type.
1573         Also, make sure a string array index will not exceed the string length.
1574
1575         * platform/graphics/win/FontCacheWin.cpp:
1576         (WebCore::getLinkedFonts):
1577
1578 2016-08-16  Alex Christensen  <achristensen@webkit.org>
1579
1580         Simplify SocketStreamError
1581         https://bugs.webkit.org/show_bug.cgi?id=160888
1582
1583         Reviewed by Darin Adler.
1584
1585         SocketStreamErrorBase and platform-specific SocketStreamError were overly complicated.
1586         They had many functions that were never used.  There's no reason to have two separate classes.
1587
1588         * WebCore.xcodeproj/project.pbxproj:
1589         * platform/network/SocketStreamError.h: Copied from Source/WebCore/platform/network/SocketStreamErrorBase.h.
1590         (WebCore::SocketStreamError::SocketStreamError):
1591         (WebCore::SocketStreamError::isNull):
1592         (WebCore::SocketStreamError::errorCode):
1593         (WebCore::SocketStreamError::failingURL):
1594         (WebCore::SocketStreamError::localizedDescription):
1595         (WebCore::SocketStreamErrorBase::isNull): Deleted.
1596         (WebCore::SocketStreamErrorBase::errorCode): Deleted.
1597         (WebCore::SocketStreamErrorBase::failingURL): Deleted.
1598         (WebCore::SocketStreamErrorBase::localizedDescription): Deleted.
1599         (WebCore::SocketStreamErrorBase::SocketStreamErrorBase): Deleted.
1600         (WebCore::operator==): Deleted.
1601         (WebCore::operator!=): Deleted.
1602         * platform/network/SocketStreamErrorBase.cpp: Removed.
1603         * platform/network/SocketStreamErrorBase.h: Removed.
1604         * platform/network/cf/SocketStreamError.h: Removed.
1605         * platform/network/curl/SocketStreamError.h: Removed.
1606         * platform/network/soup/SocketStreamError.h: Removed.
1607
1608 2016-08-15  Ryosuke Niwa  <rniwa@webkit.org>
1609
1610         Conversion to sequence<T> is broken for iterable objects
1611         https://bugs.webkit.org/show_bug.cgi?id=160801
1612
1613         Reviewed by Darin Adler.
1614
1615         Added the proper iterator support for sequence<T> with one caveat that we don't check for RegExp object
1616         per https://github.com/heycam/webidl/issues/145.
1617
1618         See http://heycam.github.io/webidl/#es-sequence and http://heycam.github.io/webidl/#es-overloads
1619
1620         Tests: bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl
1621
1622         * bindings/js/JSDOMBinding.cpp:
1623         (WebCore::hasIteratorMethod): Added. A helper function for checking whether a JSValue is iterable or not.
1624         * bindings/js/JSDOMBinding.h:
1625         (WebCore::NativeValueTraits<unsigned>::nativeValue): Removed the check for isNumber to match the spec'ed
1626         behavior at http://heycam.github.io/webidl/#es-unsigned-long which calls ToNumber first without checking
1627         whether the value is a number or not.
1628         (WebCore::toRefPtrNativeArray): Replaced isJSArray check by isObject check and throw a TypeError. Deployed
1629         forEachInIterable to support non-JSArray iterable objects. Also removed the function pointer from the third
1630         argument since we were always calling JSCT::toWrapped.
1631         (WebCore::toNativeArray): Ditto.
1632         * bindings/js/JSDOMConvert.h:
1633         (WebCore::Converter<Vector<T>>::convert): Removed the comment about toNativeArray not throwing when value
1634         is not an object.
1635         * bindings/scripts/CodeGeneratorJS.pm:
1636         (GenerateOverloadedFunctionOrConstructor): Removed the check for isJSArray for sequence<T> as an iterable
1637         object is not necessary a JSArray.
1638         (WillConvertUndefinedToDefaultParameterValue): Don't return 1 for all sequences since toNativeArray and
1639         toRefPtrNativeArray now throws on undefined due to isObject check.
1640         (JSValueToNative): Removed the third argument from toRefPtrNativeArray.
1641
1642         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp: Added.
1643         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h: Added.
1644         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h: Added.
1645         * bindings/scripts/test/JS/JSTestObj.cpp:
1646         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty):
1647         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: Added.
1648         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: Added.
1649         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1650         (WebCore::jsTestTypedefsPrototypeFunctionFunc):
1651         * bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl: Added.
1652
1653 2016-08-15  Chris Dumez  <cdumez@apple.com>
1654
1655         Rename RegisteredEventListener::listener() to callback() for clarity
1656         https://bugs.webkit.org/show_bug.cgi?id=160873
1657
1658         Reviewed by Darin Adler.
1659
1660         Rename RegisteredEventListener::listener() to callback() for clarity
1661         and to match the specification:
1662         - https://dom.spec.whatwg.org/#concept-event-listener
1663
1664         Always calling listener->listener() seems wrong.
1665
1666         * bindings/js/JSCommandLineAPIHostCustom.cpp:
1667         (WebCore::getJSListenerFunctions):
1668         * dom/EventListenerMap.cpp:
1669         (WebCore::findListener):
1670         (WebCore::removeFirstListenerCreatedFromMarkup):
1671         (WebCore::copyListenersNotCreatedFromMarkupToTarget):
1672         (WebCore::EventListenerIterator::nextListener):
1673         * dom/EventTarget.cpp:
1674         (WebCore::EventTarget::getAttributeEventListener):
1675         (WebCore::EventTarget::fireEventListeners):
1676         * dom/RegisteredEventListener.h:
1677         (WebCore::RegisteredEventListener::callback):
1678         (WebCore::RegisteredEventListener::RegisteredEventListener):
1679         (WebCore::RegisteredEventListener::listener): Deleted.
1680         * inspector/InspectorDOMAgent.cpp:
1681         (WebCore::InspectorDOMAgent::getEventListeners):
1682         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1683
1684 2016-08-15  Chris Dumez  <cdumez@apple.com>
1685
1686         Add support for dictionary members of non nullable wrapper types
1687         https://bugs.webkit.org/show_bug.cgi?id=160876
1688
1689         Reviewed by Darin Adler.
1690
1691         Add support for dictionary members of non nullable wrapper types. We
1692         only supported nullable wrapper types as dictionary members so far.
1693
1694         No new tests, updated bindings tests.
1695
1696         * bindings/js/JSDOMConvert.h:
1697         * bindings/scripts/CodeGeneratorJS.pm:
1698         (GenerateDictionaryImplementationContent):
1699         (GenerateParametersCheck):
1700         (JSValueToNative):
1701         (GenerateConstructorDefinition):
1702         * bindings/scripts/test/JS/JSTestInterface.cpp:
1703         (WebCore::JSTestInterfaceConstructor::construct):
1704         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1705         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
1706         * bindings/scripts/test/JS/JSTestObj.cpp:
1707         (WebCore::convertDictionary<TestObj::Dictionary>):
1708         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1709         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1710         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
1711         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1712         (WebCore::constructJSTestOverloadedConstructors4):
1713         (WebCore::constructJSTestOverloadedConstructors5):
1714         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1715         (WebCore::JSTestTypedefsConstructor::construct):
1716         * bindings/scripts/test/TestObj.idl:
1717
1718 2016-08-15  Chris Dumez  <cdumez@apple.com>
1719
1720         Drop unused EventTarget::hasActiveEventListeners()
1721         https://bugs.webkit.org/show_bug.cgi?id=160869
1722
1723         Reviewed by Alex Christensen.
1724
1725         * dom/EventListenerMap.cpp:
1726         (WebCore::EventListenerMap::containsActive): Deleted.
1727         * dom/EventListenerMap.h:
1728         * dom/EventTarget.cpp:
1729         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
1730         * dom/EventTarget.h:
1731
1732 2016-08-15  Sam Weinig  <sam@webkit.org>
1733
1734         Speed up compile times by not including wtf/Variant.h so much
1735         https://bugs.webkit.org/show_bug.cgi?id=160847
1736
1737         Reviewed by Alex Christensen and Saam Barati.
1738
1739         "using std::experimental::variant" caused internal compiler errors in MSVC2015, 
1740         so we are just writing std::experimental where we use it for now.
1741         We should move variant into the std::experimental namespace.
1742
1743         * bindings/js/JSNodeOrString.cpp:
1744         (WebCore::toNodeOrStringVector):
1745         * bindings/js/JSNodeOrString.h:
1746         * dom/ContainerNode.cpp:
1747         (WebCore::ContainerNode::childElementCount):
1748         (WebCore::ContainerNode::append):
1749         (WebCore::ContainerNode::prepend):
1750         * dom/ContainerNode.h:
1751         * dom/Node.cpp:
1752         (WebCore::Node::appendChild):
1753         (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
1754         (WebCore::firstFollowingSiblingNotInNodeSet):
1755         (WebCore::Node::convertNodesOrStringsIntoNode):
1756         (WebCore::Node::before):
1757         (WebCore::Node::after):
1758         (WebCore::Node::replaceWith):
1759         * dom/Node.h:
1760         (WebCore::Node::setStyleChange):
1761         (WebCore::Node::customPseudoId):
1762
1763 2016-08-15  Daniel Bates  <dabates@apple.com>
1764
1765         ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
1766         https://bugs.webkit.org/show_bug.cgi?id=160433
1767
1768         Reviewed by Eric Carlson.
1769
1770         Early return from WebAVPlayerLayerView_videoView() if the PiP layer does not have a non-nil delegate view.
1771
1772         Test: media/controls/close-page-with-picture-in-picture-video-assertion-failure.html
1773
1774         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1775         (WebAVPlayerLayerView_videoView):
1776
1777 2016-08-15  Alex Christensen  <achristensen@webkit.org>
1778
1779         Rename SocketStreamHandleBase to SocketStreamHandle and SocketStreamHandle to SocketStreamHandleImpl
1780         https://bugs.webkit.org/show_bug.cgi?id=160858
1781
1782         Reviewed by Brady Eidson.
1783
1784         No new tests.  No change in behavior, except GTK's SocketStreamHandleImpl is now safely ThreadSafeRefCounted.
1785         This is preparation for making a new kind of SocketStreamHandle which is a proxy that communicates with the NetworkProcess in WebKit2.
1786
1787         * CMakeLists.txt:
1788         * PlatformAppleWin.cmake:
1789         * PlatformEfl.cmake:
1790         * PlatformGTK.cmake:
1791         * PlatformMac.cmake:
1792         * PlatformWinCairo.cmake:
1793         * WebCore.xcodeproj/project.pbxproj:
1794         * page/SocketProvider.cpp:
1795         (WebCore::SocketProvider::createSocketStreamHandle):
1796         * platform/network/SocketStreamHandle.cpp: Copied from Source/WebCore/platform/network/SocketStreamHandleBase.cpp.
1797         (WebCore::SocketStreamHandle::SocketStreamHandle):
1798         (WebCore::SocketStreamHandle::state):
1799         (WebCore::SocketStreamHandle::send):
1800         (WebCore::SocketStreamHandle::close):
1801         (WebCore::SocketStreamHandle::disconnect):
1802         (WebCore::SocketStreamHandle::sendPendingData):
1803         (WebCore::SocketStreamHandleBase::SocketStreamHandleBase): Deleted.
1804         (WebCore::SocketStreamHandleBase::state): Deleted.
1805         (WebCore::SocketStreamHandleBase::send): Deleted.
1806         (WebCore::SocketStreamHandleBase::close): Deleted.
1807         (WebCore::SocketStreamHandleBase::disconnect): Deleted.
1808         (WebCore::SocketStreamHandleBase::sendPendingData): Deleted.
1809         * platform/network/SocketStreamHandle.h: Copied from Source/WebCore/platform/network/SocketStreamHandleBase.h.
1810         (WebCore::SocketStreamHandle::~SocketStreamHandle):
1811         (WebCore::SocketStreamHandle::client):
1812         (WebCore::SocketStreamHandleBase::~SocketStreamHandleBase): Deleted.
1813         (WebCore::SocketStreamHandleBase::client): Deleted.
1814         * platform/network/SocketStreamHandleBase.cpp: Removed.
1815         * platform/network/SocketStreamHandleBase.h: Removed.
1816         * platform/network/cf/SocketStreamHandle.h: Removed.
1817         * platform/network/cf/SocketStreamHandleCFNet.cpp: Removed.
1818         * platform/network/cf/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/cf/SocketStreamHandle.h.
1819         (WebCore::SocketStreamHandleImpl::create):
1820         (WebCore::SocketStreamHandle::create): Deleted.
1821         * platform/network/cf/SocketStreamHandleImplCFNet.cpp: Copied from Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp.
1822         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1823         (WebCore::SocketStreamHandleImpl::scheduleStreams):
1824         (WebCore::SocketStreamHandleImpl::retainSocketStreamHandle):
1825         (WebCore::SocketStreamHandleImpl::releaseSocketStreamHandle):
1826         (WebCore::SocketStreamHandleImpl::copyPACExecutionDescription):
1827         (WebCore::SocketStreamHandleImpl::pacExecutionCallback):
1828         (WebCore::SocketStreamHandleImpl::executePACFileURL):
1829         (WebCore::SocketStreamHandleImpl::removePACRunLoopSource):
1830         (WebCore::SocketStreamHandleImpl::chooseProxy):
1831         (WebCore::SocketStreamHandleImpl::chooseProxyFromArray):
1832         (WebCore::SocketStreamHandleImpl::createStreams):
1833         (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
1834         (WebCore::authenticationSchemeFromAuthenticationMethod):
1835         (WebCore::SocketStreamHandleImpl::addCONNECTCredentials):
1836         (WebCore::SocketStreamHandleImpl::copyCFStreamDescription):
1837         (WebCore::SocketStreamHandleImpl::readStreamCallback):
1838         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
1839         (WebCore::SocketStreamHandleImpl::reportErrorToClient):
1840         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
1841         (WebCore::SocketStreamHandleImpl::platformSend):
1842         (WebCore::SocketStreamHandleImpl::platformClose):
1843         (WebCore::SocketStreamHandleImpl::port):
1844         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
1845         (WebCore::SocketStreamHandle::scheduleStreams): Deleted.
1846         (WebCore::SocketStreamHandle::retainSocketStreamHandle): Deleted.
1847         (WebCore::SocketStreamHandle::releaseSocketStreamHandle): Deleted.
1848         (WebCore::SocketStreamHandle::copyPACExecutionDescription): Deleted.
1849         (WebCore::SocketStreamHandle::pacExecutionCallback): Deleted.
1850         (WebCore::SocketStreamHandle::executePACFileURL): Deleted.
1851         (WebCore::SocketStreamHandle::removePACRunLoopSource): Deleted.
1852         (WebCore::SocketStreamHandle::chooseProxy): Deleted.
1853         (WebCore::SocketStreamHandle::chooseProxyFromArray): Deleted.
1854         (WebCore::SocketStreamHandle::createStreams): Deleted.
1855         (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials): Deleted.
1856         (WebCore::SocketStreamHandle::addCONNECTCredentials): Deleted.
1857         (WebCore::SocketStreamHandle::copyCFStreamDescription): Deleted.
1858         (WebCore::SocketStreamHandle::readStreamCallback): Deleted.
1859         (WebCore::SocketStreamHandle::writeStreamCallback): Deleted.
1860         (WebCore::SocketStreamHandle::reportErrorToClient): Deleted.
1861         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
1862         (WebCore::SocketStreamHandle::platformSend): Deleted.
1863         (WebCore::SocketStreamHandle::platformClose): Deleted.
1864         (WebCore::SocketStreamHandle::port): Deleted.
1865         * platform/network/curl/SocketStreamHandle.h: Removed.
1866         * platform/network/curl/SocketStreamHandleCurl.cpp: Removed.
1867         * platform/network/curl/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/curl/SocketStreamHandle.h.
1868         (WebCore::SocketStreamHandleImpl::create):
1869         (WebCore::SocketStreamHandle::create): Deleted.
1870         * platform/network/curl/SocketStreamHandleImplCurl.cpp: Copied from Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp.
1871         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1872         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
1873         (WebCore::SocketStreamHandleImpl::platformSend):
1874         (WebCore::SocketStreamHandleImpl::platformClose):
1875         (WebCore::SocketStreamHandleImpl::readData):
1876         (WebCore::SocketStreamHandleImpl::sendData):
1877         (WebCore::SocketStreamHandleImpl::waitForAvailableData):
1878         (WebCore::SocketStreamHandleImpl::startThread):
1879         (WebCore::SocketStreamHandleImpl::stopThread):
1880         (WebCore::SocketStreamHandleImpl::didReceiveData):
1881         (WebCore::SocketStreamHandleImpl::didOpenSocket):
1882         (WebCore::SocketStreamHandleImpl::createCopy):
1883         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
1884         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
1885         (WebCore::SocketStreamHandle::platformSend): Deleted.
1886         (WebCore::SocketStreamHandle::platformClose): Deleted.
1887         (WebCore::SocketStreamHandle::readData): Deleted.
1888         (WebCore::SocketStreamHandle::sendData): Deleted.
1889         (WebCore::SocketStreamHandle::waitForAvailableData): Deleted.
1890         (WebCore::SocketStreamHandle::startThread): Deleted.
1891         (WebCore::SocketStreamHandle::stopThread): Deleted.
1892         (WebCore::SocketStreamHandle::didReceiveData): Deleted.
1893         (WebCore::SocketStreamHandle::didOpenSocket): Deleted.
1894         (WebCore::SocketStreamHandle::createCopy): Deleted.
1895         * platform/network/soup/SocketStreamHandle.h: Removed.
1896         * platform/network/soup/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/soup/SocketStreamHandle.h.
1897         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Copied from Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp.
1898         (WebCore::SocketStreamHandleImpl::create):
1899         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1900         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
1901         (WebCore::SocketStreamHandleImpl::connected):
1902         (WebCore::SocketStreamHandleImpl::connectedCallback):
1903         (WebCore::SocketStreamHandleImpl::readBytes):
1904         (WebCore::SocketStreamHandleImpl::readReadyCallback):
1905         (WebCore::SocketStreamHandleImpl::didFail):
1906         (WebCore::SocketStreamHandleImpl::writeReady):
1907         (WebCore::SocketStreamHandleImpl::platformSend):
1908         (WebCore::SocketStreamHandleImpl::platformClose):
1909         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
1910         (WebCore::SocketStreamHandleImpl::stopWaitingForSocketWritability):
1911         (WebCore::SocketStreamHandleImpl::writeReadyCallback):
1912         (WebCore::SocketStreamHandle::create): Deleted.
1913         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
1914         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
1915         (WebCore::SocketStreamHandle::connected): Deleted.
1916         (WebCore::SocketStreamHandle::connectedCallback): Deleted.
1917         (WebCore::SocketStreamHandle::readBytes): Deleted.
1918         (WebCore::SocketStreamHandle::readReadyCallback): Deleted.
1919         (WebCore::SocketStreamHandle::didFail): Deleted.
1920         (WebCore::SocketStreamHandle::writeReady): Deleted.
1921         (WebCore::SocketStreamHandle::platformSend): Deleted.
1922         (WebCore::SocketStreamHandle::platformClose): Deleted.
1923         (WebCore::SocketStreamHandle::beginWaitingForSocketWritability): Deleted.
1924         (WebCore::SocketStreamHandle::stopWaitingForSocketWritability): Deleted.
1925         (WebCore::SocketStreamHandle::writeReadyCallback): Deleted.
1926         * platform/network/soup/SocketStreamHandleSoup.cpp: Removed.
1927
1928 2016-08-15  Jiewen Tan  <jiewen_tan@apple.com>
1929
1930         Expose crypto.getRandomValues to Web Workers
1931         https://bugs.webkit.org/show_bug.cgi?id=104851
1932         <rdar://problem/27285714>
1933
1934         Reviewed by Darin Adler.
1935
1936         Tests: crypto/webkitSubtle/disallowed-in-worker.html
1937                crypto/workers/crypto-gc-worker.html
1938                crypto/workers/crypto-random-values-limits-worker.html
1939                crypto/workers/crypto-random-values-types-worker.html
1940                crypto/workers/crypto-random-values-worker.html
1941
1942         Expose both crypto and crypto.getRandomValues to Web Workers. However, webkitSubtle is
1943         disabled in Web Workers. This change also refactors a bit on IDLs related to Crypto
1944         interface.
1945
1946         * CMakeLists.txt:
1947         * DerivedSources.cpp:
1948         * DerivedSources.make:
1949         * WebCore.xcodeproj/project.pbxproj:
1950         Introduce GlobalCrypto Interface which is used to repalace the partial IDL in both
1951         DOMWindow and WorkerGlobalScope with sub-implememtations.
1952         * bindings/js/JSDocumentCustom.cpp:
1953         (WebCore::JSDocument::visitAdditionalChildren):
1954         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
1955         (WebCore::JSWorkerGlobalScope::visitAdditionalChildren):
1956         * bindings/scripts/CodeGeneratorJS.pm:
1957         (GenerateImplementation):
1958         * bindings/scripts/IDLAttributes.txt:
1959         * dom/Document.idl:
1960         Add support of GenerateIsReachable=ImplScriptExecutionContext, which allow registered
1961         JS Objects to live as long as ScriptExecutionContext lives, i.e. Document and
1962         WorkerGlobalScope.
1963         * page/Crypto.cpp:
1964         (WebCore::Crypto::Crypto):
1965         (WebCore::Crypto::webkitSubtle):
1966         (WebCore::Crypto::document): Deleted.
1967         * page/Crypto.h:
1968         (WebCore::Crypto::create):
1969         * page/Crypto.idl:
1970         Change the opaque root of Crypto to ScriptExecutionContext such that it perserves
1971         the same live time in both Window and Web Worker. And disable WebKitSubtle in Web
1972         Workers.
1973         * page/DOMWindow.idl:
1974         * page/GlobalCrypto.idl: Added.
1975         Replace partial IDL to sub-implementation of crypto attribute.
1976         * workers/WorkerGlobalScope.cpp:
1977         (WebCore::WorkerGlobalScope::crypto):
1978         * workers/WorkerGlobalScope.h:
1979         * workers/WorkerGlobalScope.idl:
1980         Introduce crypto attribute to Web Workers.
1981
1982 2016-08-15  Joseph Pecoraro  <pecoraro@apple.com>
1983
1984         Use #pragma once in inspector headers
1985         https://bugs.webkit.org/show_bug.cgi?id=160861
1986
1987         Reviewed by Mark Lam.
1988
1989         * inspector/*.h:
1990
1991 2016-08-15  Keith Rollin  <krollin@apple.com>
1992
1993         Rename LOG_ALWAYS
1994         https://bugs.webkit.org/show_bug.cgi?id=160768
1995
1996         Rename LOG_ALWAYS and friends, given that the first parameter to it is
1997         a boolean expression that determines whether or not logging should be
1998         performed.
1999
2000         Reviewed by Chris Dumez.
2001
2002         No new tests. No new functionality is added. Only some macro names
2003         have been changed.
2004
2005         * loader/FrameLoader.cpp:
2006         (WebCore::FrameLoader::prepareForLoadStart):
2007         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2008         * platform/MemoryPressureHandler.cpp:
2009         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
2010         * platform/graphics/cocoa/IOSurface.mm:
2011         (WebCore::IOSurface::IOSurface):
2012
2013 2016-08-15  Daniel Bates  <dabates@apple.com>
2014
2015         Cannot build WebKit for iOS device using Xcode 7.3/iOS 9.3 public SDK due to missing
2016         private frameworks and libraries
2017         https://bugs.webkit.org/show_bug.cgi?id=155931
2018         <rdar://problem/25807989>
2019
2020         Reviewed by Dan Bernstein.
2021
2022         Add directory WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/X to the framework search path
2023         where X is the major version of the active iOS SDK.
2024
2025         * Configurations/WebCore.xcconfig:
2026
2027 2016-08-15  Simon Fraser  <simon.fraser@apple.com>
2028
2029         Add a setting and preferences to enable visual viewport mode
2030         https://bugs.webkit.org/show_bug.cgi?id=160843
2031
2032         Reviewed by Sam Weinig.
2033
2034         Add a visualViewportEnabled setting, in the start of a group at the bottom
2035         of the file which is intended as the future home for all runtime-enabled
2036         settings.
2037
2038         * page/Settings.in:
2039
2040 2016-08-15  Alex Christensen  <achristensen@webkit.org>
2041
2042         Fix WinCairo build after r204466.
2043
2044         * platform/network/curl/SocketStreamHandleCurl.cpp:
2045
2046 2016-08-15  Alex Christensen  <achristensen@webkit.org>
2047
2048         Fix GTK build after r204466.
2049
2050         * platform/gtk/DataObjectGtk.h:
2051
2052 2016-08-15  Joseph Pecoraro  <pecoraro@apple.com>
2053
2054         Remove unused includes of wtf headers
2055         https://bugs.webkit.org/show_bug.cgi?id=160839
2056
2057         Reviewed by Alex Christensen.
2058
2059         * Lots of files.
2060
2061 2016-08-15  Alex Christensen  <achristensen@webkit.org>
2062
2063         Remove unused WebSocketChannel::willOpenSocketStream
2064         https://bugs.webkit.org/show_bug.cgi?id=160851
2065
2066         Reviewed by Daniel Bates.
2067
2068         * Modules/websockets/WebSocketChannel.cpp:
2069         (WebCore::WebSocketChannel::willOpenSocketStream): Deleted.
2070         * Modules/websockets/WebSocketChannel.h:
2071         * platform/network/SocketStreamHandleClient.h:
2072         (WebCore::SocketStreamHandleClient::willOpenSocketStream): Deleted.
2073
2074 2016-08-12  Anders Carlsson  <andersca@apple.com>
2075
2076         Move the plug-in and WebGL blacklist code to WebCore
2077         https://bugs.webkit.org/show_bug.cgi?id=160831
2078
2079         Reviewed by Sam Weinig.
2080
2081         * WebCore.xcodeproj/project.pbxproj:
2082         * platform/mac/BlacklistUpdater.h: Added.
2083         (WebCore::BlacklistUpdater::queue):
2084         (WebCore::BlacklistUpdater::pluginBlacklist):
2085         (WebCore::BlacklistUpdater::webGLBlacklist):
2086         * platform/mac/BlacklistUpdater.mm: Added.
2087         (WebCore::BlacklistUpdater::readBlacklistData):
2088         (WebCore::BlacklistUpdater::reloadIfNecessary):
2089         (WebCore::BlacklistUpdater::initializeQueue):
2090         * platform/mac/PluginBlacklist.h: Added.
2091         * platform/mac/PluginBlacklist.mm: Added.
2092         (WebCore::PluginBlacklist::loadPolicyForPluginVersion):
2093         (WebCore::PluginBlacklist::isPluginUpdateAvailable):
2094         (WebCore::PluginBlacklist::create):
2095         (WebCore::PluginBlacklist::~PluginBlacklist):
2096         (WebCore::PluginBlacklist::splitOSVersion):
2097         (WebCore::PluginBlacklist::loadPolicyForPlugin):
2098         (WebCore::PluginBlacklist::isUpdateAvailable):
2099         (WebCore::PluginBlacklist::PluginBlacklist):
2100         * platform/mac/WebGLBlacklist.h: Added.
2101         * platform/mac/WebGLBlacklist.mm: Added.
2102         (WebCore::OSBuildInfo::OSBuildInfo):
2103         (WebCore::OSBuildInfo::operator==):
2104         (WebCore::OSBuildInfo::operator>):
2105         (WebCore::OSBuildInfo::operator<=):
2106         (WebCore::OSBuildInfo::operator<):
2107         (WebCore::buildInfoFromOSBuildString):
2108         (WebCore::WebGLBlacklist::shouldBlockWebGL):
2109         (WebCore::WebGLBlacklist::shouldSuggestBlockingWebGL):
2110         (WebCore::matchesGPU):
2111         (WebCore::gpuMaskFromString):
2112         (WebCore::matchesBuildInfo):
2113         (WebCore::WebGLBlacklist::create):
2114         (WebCore::WebGLBlacklist::shouldBlock):
2115         (WebCore::WebGLBlacklist::shouldSuggestBlocking):
2116         (WebCore::WebGLBlacklist::WebGLBlacklist):
2117         (WebCore::WebGLBlacklist::~WebGLBlacklist):
2118         * platform/spi/cf/CFUtilitiesSPI.h: Added.
2119
2120 2016-08-14  Chris Dumez  <cdumez@apple.com>
2121
2122         Align the event listener firing code with the latest DOM Specification and simplify it
2123         https://bugs.webkit.org/show_bug.cgi?id=160828
2124
2125         Reviewed by Darin Adler.
2126
2127         Align the event listener firing code with the latest DOM specification:
2128         - https://dom.spec.whatwg.org/#concept-event-listener-invoke
2129         - https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke
2130         - https://dom.spec.whatwg.org/#concept-event-listener
2131
2132         The following changes were made:
2133         1. RegisteredEventListener (equivalent to "event listener" in the spec)
2134            is now RefCounted
2135         2. RegisteredEventListener now has a wasRemoved flag as in specification.
2136         3. fireEventListeners() is now iterating over a copy of the event
2137            listeners, as in the specification. We rely on the wasRemoved removed
2138            flag to avoid executing event listeners that were removed while we
2139            iterate.
2140
2141         Previously, the code was modifying the event listeners vector we were
2142         iterating on. Doing so safely lead to complicated and error prone code.
2143         The new code is much simpler and easier to reason about.
2144
2145         This change seems to be perf-neutral on Speedometer.
2146
2147         No new tests, no web-exposed behavior change.
2148
2149         * CMakeLists.txt:
2150         * WebCore.xcodeproj/project.pbxproj:
2151         * bindings/js/JSCommandLineAPIHostCustom.cpp:
2152         (WebCore::getJSListenerFunctions):
2153         * dom/DOMAllInOne.cpp:
2154         * dom/EventListenerMap.cpp:
2155         (WebCore::EventListenerMap::assertNoActiveIterators):
2156         (WebCore::EventListenerMap::containsCapturing):
2157         (WebCore::EventListenerMap::containsActive):
2158         (WebCore::findListener):
2159         (WebCore::EventListenerMap::add):
2160         (WebCore::removeListenerFromVector):
2161         (WebCore::EventListenerMap::remove):
2162         (WebCore::EventListenerMap::find):
2163         (WebCore::removeFirstListenerCreatedFromMarkup):
2164         (WebCore::copyListenersNotCreatedFromMarkupToTarget):
2165         (WebCore::EventListenerMap::copyEventListenersNotCreatedFromMarkupToTarget):
2166         (WebCore::EventListenerIterator::nextListener):
2167         (WebCore::EventListenerMap::clear): Deleted.
2168         * dom/EventListenerMap.h:
2169         (WebCore::EventListenerMap::contains):
2170         (WebCore::EventListenerMap::assertNoActiveIterators):
2171         * dom/EventTarget.cpp:
2172         (WebCore::EventTarget::removeEventListener):
2173         (WebCore::EventTarget::getAttributeEventListener):
2174         (WebCore::FiringEventListenersScope::FiringEventListenersScope):
2175         (WebCore::FiringEventListenersScope::~FiringEventListenersScope):
2176         (WebCore::EventTarget::fireEventListeners):
2177         (WebCore::EventTarget::setAttributeEventListener): Deleted.
2178         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
2179         (WebCore::EventTarget::dispatchEventForBindings): Deleted.
2180         (WebCore::EventTarget::getEventListeners): Deleted.
2181         * dom/EventTarget.h:
2182         (WebCore::EventTarget::isFiringEventListeners):
2183         * dom/RegisteredEventListener.cpp: Removed.
2184         * dom/RegisteredEventListener.h:
2185         (WebCore::RegisteredEventListener::Options::Options):
2186         (WebCore::RegisteredEventListener::create):
2187         (WebCore::RegisteredEventListener::listener):
2188         (WebCore::RegisteredEventListener::useCapture):
2189         (WebCore::RegisteredEventListener::isPassive):
2190         (WebCore::RegisteredEventListener::isOnce):
2191         (WebCore::RegisteredEventListener::wasRemoved):
2192         (WebCore::RegisteredEventListener::markAsRemoved):
2193         (WebCore::RegisteredEventListener::RegisteredEventListener):
2194         * inspector/InspectorDOMAgent.cpp:
2195         (WebCore::InspectorDOMAgent::getEventListenersForNode):
2196         (WebCore::InspectorDOMAgent::getEventListeners):
2197         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
2198         * inspector/InspectorDOMAgent.h:
2199         (WebCore::EventListenerInfo::EventListenerInfo):
2200         * svg/SVGElement.cpp:
2201         (WebCore::hasLoadListener):
2202
2203 2016-08-14  Daniel Bates  <dabates@apple.com>
2204
2205         Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
2206         https://bugs.webkit.org/show_bug.cgi?id=160725
2207
2208         Reviewed by Sam Weinig.
2209
2210         * platform/cocoa/ThemeCocoa.mm: Unconditionally include header dlfcn.h as it
2211         exists in both the public iOS 9.3 SDK and iOS 10 beta SDK.
2212         * platform/spi/cocoa/CoreTextSPI.h: Add SPI declarations for constants that were
2213         used in r204107.
2214         * platform/spi/cocoa/PassKitSPI.h: Remove unnecessary #import statements when
2215         building with the Apple Internal SDK. Include header PassKit/PassKit.h when
2216         building for iOS.
2217         * platform/spi/cocoa/QuartzCoreSPI.h: No need to define CLayer.contentsFormat
2218         when building with the iOS 10 beta SDK as it is now part of the public API.
2219
2220 2016-08-14  Jonathan Bedard  <jbedard@apple.com>
2221
2222         Dereferenced NULL pointer in StyleResolver
2223         https://bugs.webkit.org/show_bug.cgi?id=160823
2224
2225         Reviewed by Darin Adler.
2226
2227         No behavior changed, new tests unneeded.
2228
2229         This change was initiated by a NULL pointer dereference to provide this unused argument.
2230
2231         * css/StyleResolver.cpp:
2232         (WebCore::StyleResolver::CascadedProperties::addStyleProperties): Removed unused function argument.
2233         (WebCore::StyleResolver::CascadedProperties::addMatch): Ditto.
2234         * css/StyleResolver.h: Ditto.
2235
2236 2016-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
2237
2238         Fix GTK Debug bots after r204400
2239         https://bugs.webkit.org/show_bug.cgi?id=160818
2240
2241         Reviewed by Carlos Garcia Campos.
2242
2243         Because the GTK EWS bot doesn't run tests, I missed this.
2244
2245         No new tests because there is no behavior change.
2246
2247         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2248         (WebCore::HarfBuzzShaper::selectionRect):
2249
2250 2016-08-13  Chris Dumez  <cdumez@apple.com>
2251
2252         'compatMode' property should be on Document, not HTMLDocument
2253         https://bugs.webkit.org/show_bug.cgi?id=160819
2254
2255         Reviewed by Sam Weinig.
2256
2257         'compatMode' property should be on Document, not HTMLDocument:
2258         - https://dom.spec.whatwg.org/#dom-document-compatmode
2259
2260         WebKit had it on both. Firefox and Chrome have it on Document only.
2261
2262         Test: fast/dom/Document/compatMode-location.html
2263
2264         * html/HTMLDocument.idl:
2265
2266 2016-08-13  Chris Dumez  <cdumez@apple.com>
2267
2268         Move 'embeds' / 'plugins'/ 'scripts' attributes from HTMLDocument to Document
2269         https://bugs.webkit.org/show_bug.cgi?id=160829
2270
2271         Reviewed by Sam Weinig.
2272
2273         Move 'embeds' / 'plugins'/ 'scripts' attributes from HTMLDocument to Document
2274         to match the latest specification:
2275         - https://html.spec.whatwg.org/multipage/dom.html#the-document-object
2276
2277         This also matches Chrome.
2278
2279         No new tests, rebaselined existing test.
2280
2281         * dom/Document.idl:
2282         * html/HTMLDocument.idl:
2283
2284 2016-08-13  Chris Dumez  <cdumez@apple.com>
2285
2286         Move designMode attribute from HTMLDocument to Document
2287         https://bugs.webkit.org/show_bug.cgi?id=160838
2288
2289         Reviewed by Sam Weinig.
2290
2291         Move designMode attribute from HTMLDocument to Document to match the
2292         latest HTML specification:
2293         - https://html.spec.whatwg.org/multipage/interaction.html#designMode
2294
2295         This also matches Chrome.
2296
2297         No new tests, rebaselined existing test.
2298
2299         * dom/Document.cpp:
2300         (WebCore::Document::designMode):
2301         (WebCore::Document::setDesignMode):
2302         * dom/Document.h:
2303         * dom/Document.idl:
2304         * html/HTMLDocument.cpp:
2305         (WebCore::HTMLDocument::bgColor): Deleted.
2306         (WebCore::HTMLDocument::setBgColor): Deleted.
2307         (WebCore::HTMLDocument::fgColor): Deleted.
2308         * html/HTMLDocument.h:
2309         * html/HTMLDocument.idl:
2310
2311 2016-08-12  Chris Dumez  <cdumez@apple.com>
2312
2313         getElementsByTagName() should take a qualifiedName in parameter
2314         https://bugs.webkit.org/show_bug.cgi?id=160682
2315
2316         Reviewed by Ryosuke Niwa.
2317
2318         getElementsByTagName() should take a qualifiedName in parameter, not a
2319         localName, according to the latest DOM specification:
2320         - https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
2321         - https://dom.spec.whatwg.org/#concept-getelementsbytagname
2322
2323         The new behavior matches Firefox and Edge. There is a slight
2324         compatiblity risk but we should give it a try.
2325
2326         No new tests, rebaselined existing tests.
2327
2328         * WebCore.xcodeproj/project.pbxproj:
2329         * dom/AllDescendantsCollection.h: Added.
2330         * dom/ContainerNode.cpp:
2331         (WebCore::ContainerNode::getElementsByTagName):
2332         (WebCore::ContainerNode::getElementsByTagNameNS):
2333         * dom/Node.cpp:
2334         (WebCore::NodeListsNodeData::invalidateCaches):
2335         * dom/NodeRareData.h:
2336         (WebCore::NodeListsNodeData::addCachedTagCollectionNS):
2337         (WebCore::NodeListsNodeData::removeCachedTagCollectionNS):
2338         (WebCore::NodeListsNodeData::adoptDocument):
2339         (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList):
2340         * dom/TagCollection.cpp:
2341         (WebCore::makeQualifiedName):
2342         (WebCore::splitQualifiedName):
2343         (WebCore::TagCollectionNS::TagCollectionNS):
2344         (WebCore::TagCollectionNS::~TagCollectionNS):
2345         (WebCore::TagCollection::TagCollection):
2346         (WebCore::TagCollection::~TagCollection):
2347         (WebCore::HTMLTagCollection::HTMLTagCollection):
2348         (WebCore::HTMLTagCollection::~HTMLTagCollection):
2349         * dom/TagCollection.h:
2350         (WebCore::TagCollection::elementMatches):
2351         (WebCore::TagCollectionNS::elementMatches):
2352         (WebCore::HTMLTagCollection::elementMatches):
2353         * html/CollectionType.h:
2354         * html/GenericCachedHTMLCollection.cpp:
2355         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
2356         * html/HTMLCollection.cpp:
2357         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
2358
2359 2016-08-12  Alex Christensen  <achristensen@webkit.org>
2360
2361         Make URLParser work with URLs missing URL parts
2362         https://bugs.webkit.org/show_bug.cgi?id=160824
2363
2364         Reviewed by Brady Eidson.
2365
2366         My initial implementation of URLParser didn't work correctly with URLs missing parts,
2367         like a URL with no fragment, or a URL with no query.  This fixes and tests parsing such URLS.
2368         Covered by new API tests.
2369
2370         * platform/URLParser.cpp:
2371         (WebCore::URLParser::parse):
2372         (WebCore::URLParser::allValuesEqual):
2373         * platform/URLParser.h:
2374         (WebCore::URLParser::parse):
2375
2376 2016-08-12  Johan K. Jensen  <johan_jensen@apple.com>
2377
2378         Rename DocumentLoadTiming and ResourceLoadTiming
2379         https://bugs.webkit.org/show_bug.cgi?id=160821
2380
2381         Reviewed by Alex Christensen.
2382
2383         Renames ResourceLoadTiming to NetworkLoadTiming.
2384         Renames DocumentLoadTiming to LoadTiming as well as
2385         navigationStart() to startTime(), so it's generic for
2386         both the main resource and subresources.
2387
2388         * CMakeLists.txt:
2389         * Modules/gamepad/NavigatorGamepad.cpp:
2390         (WebCore::NavigatorGamepad::from):
2391         * PlatformMac.cmake:
2392         * WebCore.xcodeproj/project.pbxproj:
2393         * inspector/InspectorNetworkAgent.cpp:
2394         (WebCore::buildObjectForTiming):
2395         (WebCore::buildObjectForResourceResponse):
2396         * loader/DocumentLoader.cpp:
2397         (WebCore::DocumentLoader::startLoadingMainResource):
2398         * loader/DocumentLoader.h:
2399         (WebCore::DocumentLoader::timing):
2400         (WebCore::DocumentLoader::resetTiming):
2401         * loader/FrameLoader.cpp:
2402         (WebCore::FrameLoader::dispatchUnloadEvents):
2403         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
2404         * loader/LoadTiming.cpp: Renamed from Source/WebCore/loader/DocumentLoadTiming.cpp.
2405         (WebCore::LoadTiming::LoadTiming):
2406         (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime):
2407         (WebCore::LoadTiming::monotonicTimeToPseudoWallTime):
2408         (WebCore::LoadTiming::markStartTime):
2409         (WebCore::LoadTiming::addRedirect):
2410         * loader/LoadTiming.h: Renamed from Source/WebCore/loader/DocumentLoadTiming.h.
2411         (WebCore::LoadTiming::markUnloadEventStart):
2412         (WebCore::LoadTiming::markUnloadEventEnd):
2413         (WebCore::LoadTiming::markRedirectStart):
2414         (WebCore::LoadTiming::markRedirectEnd):
2415         (WebCore::LoadTiming::markFetchStart):
2416         (WebCore::LoadTiming::setResponseEnd):
2417         (WebCore::LoadTiming::markLoadEventStart):
2418         (WebCore::LoadTiming::markLoadEventEnd):
2419         (WebCore::LoadTiming::setHasSameOriginAsPreviousDocument):
2420         (WebCore::LoadTiming::startTime):
2421         (WebCore::LoadTiming::unloadEventStart):
2422         (WebCore::LoadTiming::unloadEventEnd):
2423         (WebCore::LoadTiming::redirectStart):
2424         (WebCore::LoadTiming::redirectEnd):
2425         (WebCore::LoadTiming::redirectCount):
2426         (WebCore::LoadTiming::fetchStart):
2427         (WebCore::LoadTiming::responseEnd):
2428         (WebCore::LoadTiming::loadEventStart):
2429         (WebCore::LoadTiming::loadEventEnd):
2430         (WebCore::LoadTiming::hasCrossOriginRedirect):
2431         (WebCore::LoadTiming::hasSameOriginAsPreviousDocument):
2432         (WebCore::LoadTiming::referenceMonotonicTime):
2433         (WebCore::LoadTiming::referenceWallTime):
2434         * page/DOMWindow.cpp:
2435         (WebCore::DOMWindow::dispatchLoadEvent):
2436         * page/PerformanceNavigation.cpp:
2437         (WebCore::PerformanceNavigation::redirectCount):
2438         * page/PerformanceResourceTiming.cpp:
2439         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2440         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
2441         * page/PerformanceResourceTiming.h:
2442         * page/PerformanceTiming.cpp:
2443         (WebCore::PerformanceTiming::navigationStart):
2444         (WebCore::PerformanceTiming::unloadEventStart):
2445         (WebCore::PerformanceTiming::unloadEventEnd):
2446         (WebCore::PerformanceTiming::redirectStart):
2447         (WebCore::PerformanceTiming::redirectEnd):
2448         (WebCore::PerformanceTiming::fetchStart):
2449         (WebCore::PerformanceTiming::domainLookupStart):
2450         (WebCore::PerformanceTiming::domainLookupEnd):
2451         (WebCore::PerformanceTiming::connectStart):
2452         (WebCore::PerformanceTiming::connectEnd):
2453         (WebCore::PerformanceTiming::secureConnectionStart):
2454         (WebCore::PerformanceTiming::requestStart):
2455         (WebCore::PerformanceTiming::responseStart):
2456         (WebCore::PerformanceTiming::responseEnd):
2457         (WebCore::PerformanceTiming::loadEventStart):
2458         (WebCore::PerformanceTiming::loadEventEnd):
2459         (WebCore::PerformanceTiming::loadTiming):
2460         (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
2461         * page/PerformanceTiming.h:
2462         * platform/network/NetworkLoadTiming.h: Renamed from Source/WebCore/platform/network/ResourceLoadTiming.h.
2463         (WebCore::NetworkLoadTiming::NetworkLoadTiming):
2464         (WebCore::NetworkLoadTiming::operator=):
2465         (WebCore::NetworkLoadTiming::isolatedCopy):
2466         (WebCore::NetworkLoadTiming::operator==):
2467         (WebCore::NetworkLoadTiming::operator!=):
2468         (WebCore::NetworkLoadTiming::encode):
2469         (WebCore::NetworkLoadTiming::decode):
2470         * platform/network/ResourceHandle.h:
2471         * platform/network/ResourceResponseBase.cpp:
2472         (WebCore::ResourceResponseBase::crossThreadData):
2473         (WebCore::ResourceResponseBase::fromCrossThreadData):
2474         (WebCore::ResourceResponseBase::compare):
2475         * platform/network/ResourceResponseBase.h:
2476         (WebCore::ResourceResponseBase::networkLoadTiming):
2477         (WebCore::ResourceResponseBase::encode):
2478         (WebCore::ResourceResponseBase::decode):
2479         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2480         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2481         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2482         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
2483         * platform/network/cocoa/NetworkLoadTiming.mm: Renamed from Source/WebCore/platform/network/cocoa/ResourceLoadTiming.mm.
2484         (WebCore::timingValue):
2485         (WebCore::copyTimingData):
2486         (WebCore::setCollectsTimingData):
2487         * platform/network/curl/ResourceHandleManager.cpp:
2488         (WebCore::calculateWebTimingInformations):
2489         * platform/network/mac/ResourceHandleMac.mm:
2490         (WebCore::ResourceHandle::getConnectionTimingData):
2491         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2492         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
2493         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2494         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2495         * platform/network/soup/ResourceHandleSoup.cpp:
2496         (WebCore::sendRequestCallback):
2497         (WebCore::ResourceHandle::didStartRequest):
2498         (WebCore::networkEventCallback):
2499
2500 2016-08-12  Joseph Pecoraro  <pecoraro@apple.com>
2501
2502         Remove unused includes of RefCountedLeakCounter.h
2503         https://bugs.webkit.org/show_bug.cgi?id=160817
2504
2505         Reviewed by Mark Lam.
2506
2507         * bindings/js/JSEventListener.cpp:
2508         * rendering/RenderBlockLineLayout.cpp:
2509
2510 2016-08-12  Alex Christensen  <achristensen@webkit.org>
2511
2512         Initial URLParser implementation
2513         https://bugs.webkit.org/show_bug.cgi?id=160811
2514
2515         Reviewed by Brady Eidson.
2516
2517         There are a lot of missing parts, but it works in one case, so I test that one case.
2518
2519         * platform/URLParser.cpp:
2520         (WebCore::isC0Control):
2521         (WebCore::isC0ControlOrSpace):
2522         (WebCore::isTabOrNewline):
2523         (WebCore::isASCIIDigit):
2524         (WebCore::isASCIIAlpha):
2525         (WebCore::isASCIIAlphanumeric):
2526         (WebCore::isSpecialScheme):
2527         (WebCore::URLParser::parse):
2528
2529 2016-08-12  Commit Queue  <commit-queue@webkit.org>
2530
2531         Unreviewed, rolling out r204404.
2532         https://bugs.webkit.org/show_bug.cgi?id=160805
2533
2534         "Broke the build for some Apple Internal projects" (Requested
2535         by bradee-oh on #webkit).
2536
2537         Reverted changeset:
2538
2539         "Support WebIDL unions (Part 1)"
2540         https://bugs.webkit.org/show_bug.cgi?id=160769
2541         http://trac.webkit.org/changeset/204404
2542
2543 2016-08-12  Philippe Normand  <pnormand@igalia.com>
2544
2545         [GStreamer] Performance problems with bigger video resolution in the webrtc media player
2546         https://bugs.webkit.org/show_bug.cgi?id=153826
2547
2548         Reviewed by Alejandro G. Castro.
2549
2550         Keep the OpenWebRTC video renderer size synchronized with the Media element size.
2551
2552         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
2553         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize):
2554         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
2555
2556 2016-08-12  Philippe Normand  <pnormand@igalia.com>
2557
2558         [GStreamer][OWR] Video rendering fixes
2559         https://bugs.webkit.org/show_bug.cgi?id=160764
2560
2561         Reviewed by Xabier Rodriguez-Calvar.
2562
2563         The video renderer of OpenWebRTC now uses OpenGL so we have two
2564         options to correctly handle this in WebKit:
2565
2566         - if USE_GSTREAMER_GL is enabled then we simply pass our GL
2567           appsink to the renderer and there is no need to create glupload
2568           and glcolorconvert element on WebKit side because those elements
2569           are already created on OpenWebRTC side.
2570         - if USE_GSTREAMER_GL is disabled then we need our sink to download
2571           frames from the GPU so that rendering can be done with the WebKit
2572           video sink in main memory.
2573
2574         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2575         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Split out GL appsink management
2576         to a separate method that can be used by sub-classes.
2577         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Use new createGLAppSink method.
2578         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2579         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
2580         (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): handle GStreamer-GL configurations
2581         and pass a different element to the renderer depending on the configuration.
2582
2583 2016-08-11  Sam Weinig  <sam@webkit.org>
2584
2585         Support WebIDL unions (Part 1)
2586         https://bugs.webkit.org/show_bug.cgi?id=160769
2587
2588         Reviewed by Chris Dumez.
2589
2590         This is the first part of an effort to add support for union types
2591         in our code generators. This change:
2592         - Adds a domType struct to hold the parsed type information. For now, we only
2593           use it temporarily while parsing, and don't expose it to the code generators,
2594           but that will change in a later patch.
2595         - Remove support for scoped identifiers for types. They are not supported by WebIDL.
2596         - Make debugging the parser easier by providing backtraces when asserting.
2597
2598         There should be no observable changes.
2599
2600         * bindings/scripts/IDLParser.pm:
2601
2602 2016-08-11  Myles C. Maxfield  <mmaxfield@apple.com>
2603
2604         Migrate from ints to unsigneds when referring to indices into strings
2605         https://bugs.webkit.org/show_bug.cgi?id=160735
2606
2607         Reviewed by Simon Fraser.
2608
2609         There are a few cases where we use ints to refer to indices into strings:
2610         - A simple historical accident. These were migrated to unsigneds directly.
2611         - Where we use -1 as a sentinal value. These were migrated to Optional<unsigned>.
2612
2613         This patch only modifies rendering code (rather than DOM code). There are a few
2614         places in DOM code (such as Position and Node::maxCharacterOffset()) which also
2615         erroneously use ints; however, I didn't want this change to be observable from
2616         script and I wanted to keep this patch to a reasonable size.
2617
2618         No new tests because there is no behavior change.
2619
2620         * editing/FrameSelection.cpp:
2621         (WebCore::FrameSelection::updateAppearance):
2622         (WebCore::FrameSelection::setCaretVisibility):
2623         * platform/DragImage.cpp:
2624         (WebCore::createDragImageForRange):
2625         * platform/graphics/FontCascade.cpp:
2626         (WebCore::FontCascade::glyphBufferForTextRun):
2627         (WebCore::FontCascade::drawText):
2628         (WebCore::FontCascade::drawEmphasisMarks):
2629         (WebCore::FontCascade::adjustSelectionRectForText):
2630         (WebCore::computeUnderlineType):
2631         (WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
2632         (WebCore::FontCascade::drawEmphasisMarksForSimpleText):
2633         (WebCore::FontCascade::drawGlyphBuffer):
2634         (WebCore::offsetToMiddleOfGlyphAtIndex):
2635         (WebCore::FontCascade::adjustSelectionRectForSimpleText):
2636         * platform/graphics/FontCascade.h:
2637         * platform/graphics/GlyphBuffer.h:
2638         (WebCore::GlyphBuffer::size):
2639         (WebCore::GlyphBuffer::glyphs):
2640         (WebCore::GlyphBuffer::advances):
2641         (WebCore::GlyphBuffer::fontAt):
2642         (WebCore::GlyphBuffer::glyphAt):
2643         (WebCore::GlyphBuffer::advanceAt):
2644         (WebCore::GlyphBuffer::offsetAt):
2645         (WebCore::GlyphBuffer::reverse):
2646         (WebCore::GlyphBuffer::offsetInString):
2647         (WebCore::GlyphBuffer::shrink):
2648         (WebCore::GlyphBuffer::swap):
2649         * platform/graphics/GraphicsContext.cpp:
2650         (WebCore::GraphicsContext::drawText):
2651         (WebCore::GraphicsContext::drawGlyphs):
2652         (WebCore::GraphicsContext::drawEmphasisMarks):
2653         * platform/graphics/GraphicsContext.h:
2654         * platform/graphics/Latin1TextIterator.h:
2655         (WebCore::Latin1TextIterator::Latin1TextIterator):
2656         (WebCore::Latin1TextIterator::currentCharacter):
2657         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
2658         (WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
2659         * platform/graphics/SurrogatePairAwareTextIterator.h:
2660         (WebCore::SurrogatePairAwareTextIterator::currentCharacter):
2661         * platform/graphics/WidthIterator.cpp:
2662         (WebCore::WidthIterator::applyFontTransforms):
2663         (WebCore::WidthIterator::advanceInternal):
2664         (WebCore::WidthIterator::advance):
2665         (WebCore::WidthIterator::advanceOneCharacter):
2666         * platform/graphics/WidthIterator.h:
2667         * platform/graphics/cairo/FontCairo.cpp:
2668         (WebCore::drawGlyphsToContext):
2669         (WebCore::drawGlyphsShadow):
2670         (WebCore::FontCascade::drawGlyphs):
2671         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2672         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
2673         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
2674         (WebCore::FontCascade::adjustSelectionRectForComplexText):
2675         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2676         (WebCore::fillVectorWithHorizontalGlyphPositions):
2677         (WebCore::showLetterpressedGlyphsWithAdvances):
2678         (WebCore::showGlyphsWithAdvances):
2679         (WebCore::FontCascade::drawGlyphs):
2680         (WebCore::FontCascade::dashesForIntersectionsWithRect):
2681         (WebCore::FontCascade::adjustSelectionRectForComplexText):
2682         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
2683         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
2684         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2685         (WebCore::DisplayList::Recorder::drawGlyphs):
2686         * platform/graphics/displaylists/DisplayListRecorder.h:
2687         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2688         (WebCore::HarfBuzzShaper::selectionRect):
2689         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
2690         * platform/graphics/mac/ComplexTextController.h:
2691         * platform/graphics/win/FontCGWin.cpp:
2692         (WebCore::FontCascade::drawGlyphs):
2693         * platform/graphics/win/FontWin.cpp:
2694         (WebCore::FontCascade::adjustSelectionRectForComplexText):
2695         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
2696         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
2697         * rendering/EllipsisBox.cpp:
2698         (WebCore::EllipsisBox::paintSelection):
2699         * rendering/InlineTextBox.cpp:
2700         (WebCore::InlineTextBox::isSelected):
2701         (WebCore::InlineTextBox::selectionState):
2702         (WebCore::InlineTextBox::localSelectionRect):
2703         (WebCore::InlineTextBox::paint):
2704         (WebCore::InlineTextBox::clampedOffset):
2705         (WebCore::InlineTextBox::selectionStartEnd):
2706         (WebCore::InlineTextBox::paintSelection):
2707         (WebCore::InlineTextBox::paintCompositionBackground):
2708         (WebCore::InlineTextBox::paintDocumentMarker):
2709         (WebCore::InlineTextBox::paintTextMatchMarker):
2710         (WebCore::InlineTextBox::positionForOffset):
2711         * rendering/InlineTextBox.h:
2712         (WebCore::InlineTextBox::offsetRun):
2713         (WebCore::InlineTextBox::InlineTextBox): Deleted.
2714         * rendering/RenderBlock.cpp:
2715         (WebCore::RenderBlock::localCaretRect):
2716         * rendering/RenderBlock.h:
2717         * rendering/RenderBox.cpp:
2718         (WebCore::RenderBox::localCaretRect):
2719         * rendering/RenderBox.h:
2720         * rendering/RenderInline.cpp:
2721         (WebCore::RenderInline::localCaretRect):
2722         * rendering/RenderInline.h:
2723         * rendering/RenderLineBreak.cpp:
2724         (WebCore::RenderLineBreak::localCaretRect):
2725         * rendering/RenderLineBreak.h:
2726         * rendering/RenderObject.cpp:
2727         (WebCore::RenderObject::selectionStartEnd):
2728         (WebCore::RenderObject::localCaretRect):
2729         * rendering/RenderObject.h:
2730         * rendering/RenderReplaced.cpp:
2731         (WebCore::RenderReplaced::isSelected):
2732         * rendering/RenderText.cpp:
2733         (WebCore::RenderText::localCaretRect):
2734         (WebCore::RenderText::collectSelectionRectsForLineBoxes):
2735         * rendering/RenderText.h:
2736         * rendering/RenderTextLineBoxes.cpp:
2737         (WebCore::RenderTextLineBoxes::setSelectionState):
2738         * rendering/RenderView.cpp:
2739         (WebCore::RenderView::subtreeSelectionBounds):
2740         (WebCore::RenderView::repaintSubtreeSelection):
2741         (WebCore::RenderView::setSelection):
2742         (WebCore::RenderView::splitSelectionBetweenSubtrees):
2743         (WebCore::RenderView::clearSubtreeSelection):
2744         (WebCore::RenderView::applySubtreeSelection):
2745         (WebCore::RenderView::getSelection):
2746         (WebCore::RenderView::clearSelection):
2747         (WebCore::RenderView::RenderView): Deleted.
2748         * rendering/RenderView.h:
2749         * rendering/SelectionSubtreeRoot.cpp:
2750         (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
2751         (WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot): Deleted.
2752         * rendering/SelectionSubtreeRoot.h:
2753         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData):
2754         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos):
2755         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos):
2756         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionClear):
2757         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartEndPositions):
2758         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionStartPos):
2759         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionEndPos):
2760         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection):
2761         (WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData): Deleted.
2762         * rendering/TextPainter.cpp:
2763         (WebCore::TextPainter::drawTextOrEmphasisMarks):
2764         (WebCore::TextPainter::paintTextWithShadows):
2765         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
2766         (WebCore::TextPainter::paintText):
2767         * rendering/TextPainter.h:
2768         (WebCore::TextPainter::addEmphasis):
2769         * rendering/svg/RenderSVGInlineText.cpp:
2770         (WebCore::RenderSVGInlineText::localCaretRect):
2771         * rendering/svg/RenderSVGInlineText.h:
2772         * rendering/svg/SVGInlineTextBox.cpp:
2773         (WebCore::SVGInlineTextBox::positionForOffset):
2774         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
2775         (WebCore::SVGInlineTextBox::localSelectionRect):
2776         (WebCore::SVGInlineTextBox::paintSelectionBackground):
2777         (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates):
2778         (WebCore::SVGInlineTextBox::paintTextWithShadows):
2779         (WebCore::SVGInlineTextBox::paintText):
2780         * rendering/svg/SVGInlineTextBox.h:
2781         * rendering/svg/SVGTextQuery.cpp:
2782         (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates):
2783         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures):
2784         (WebCore::SVGTextQuery::subStringLengthCallback):
2785         (WebCore::SVGTextQuery::startPositionOfCharacterCallback):
2786         (WebCore::SVGTextQuery::endPositionOfCharacterCallback):
2787         (WebCore::SVGTextQuery::rotationOfCharacterCallback):
2788         (WebCore::calculateGlyphBoundaries):
2789         (WebCore::SVGTextQuery::extentOfCharacterCallback):
2790         (WebCore::SVGTextQuery::characterNumberAtPositionCallback):
2791         * rendering/svg/SVGTextQuery.h:
2792
2793 2016-08-11  Alex Christensen  <achristensen@webkit.org>
2794
2795         Don't use a NetworkingContext when creating SocketStreamHandles
2796         https://bugs.webkit.org/show_bug.cgi?id=160732
2797
2798         Reviewed by Brady Eidson.
2799
2800         No change in behavior.  After r204327 a SessionID is all we need to get the NetworkStorageSession,
2801         and we pass the SessionID to the SocketStreamHandle constructor, so use that instead.
2802         SessionIDs can be serialized and sent over IPC.  NetworkingContexts can't.
2803
2804         * Modules/websockets/WebSocketChannel.cpp:
2805         (WebCore::WebSocketChannel::connect):
2806         * page/SocketProvider.cpp:
2807         (WebCore::SocketProvider::createSocketStreamHandle):
2808         * page/SocketProvider.h:
2809         * platform/network/cf/SocketStreamHandle.h:
2810         (WebCore::SocketStreamHandle::create):
2811         * platform/network/cf/SocketStreamHandleCFNet.cpp:
2812         (WebCore::SocketStreamHandle::SocketStreamHandle):
2813         (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials):
2814         * platform/network/curl/SocketStreamHandle.h:
2815         (WebCore::SocketStreamHandle::create):
2816         * platform/network/soup/SocketStreamHandle.h:
2817         * platform/network/soup/SocketStreamHandleSoup.cpp:
2818         (WebCore::SocketStreamHandle::create):
2819
2820 2016-08-11  Alex Christensen  <achristensen@webkit.org>
2821
2822         Use StringBuilder::appendLiteral when possible don't append result of makeString
2823         https://bugs.webkit.org/show_bug.cgi?id=160772
2824
2825         Reviewed by Sam Weinig.
2826
2827         StringBuilder::append does an unnecessary strlen call.
2828         append(makeString(...)) always does unnecessary allocations and copies.
2829         It's currently only used in debug logging, but we shouldn't have this pattern in WebKit.
2830
2831         * Modules/indexeddb/server/IndexValueStore.cpp:
2832         (WebCore::IDBServer::IndexValueStore::loggingString):
2833         * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
2834         (WebCore::IDBDatabaseInfo::loggingString):
2835         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
2836         (WebCore::IDBObjectStoreInfo::loggingString):
2837         * contentextensions/CombinedURLFilters.cpp:
2838         (WebCore::ContentExtensions::prefixTreeVertexToString):
2839         (WebCore::ContentExtensions::recursivePrint):
2840         * html/HTMLMediaElement.cpp:
2841         (WebCore::actionName):
2842         * html/MediaElementSession.cpp:
2843         (WebCore::restrictionName):
2844         * loader/ResourceLoadStatistics.cpp:
2845         (WebCore::appendBoolean):
2846         (WebCore::appendHashCountedSet):
2847         (WebCore::ResourceLoadStatistics::toString):
2848         * platform/PODInterval.h:
2849         (WebCore::PODInterval::toString):
2850         * platform/URL.cpp:
2851         (WebCore::URL::setHost):
2852         (WebCore::URL::setHostAndPort):
2853         (WebCore::URL::serialize):
2854         * testing/Internals.cpp:
2855         (WebCore::appendOffsets):
2856         (WebCore::Internals::scrollSnapOffsets):
2857
2858 2016-08-11  Chris Dumez  <cdumez@apple.com>
2859
2860         Align Range.surroundContents() with the latest DOM specification
2861         https://bugs.webkit.org/show_bug.cgi?id=160777
2862
2863         Reviewed by Ryosuke Niwa.
2864
2865         Align Range.surroundContents() with the latest DOM specification:
2866         - https://dom.spec.whatwg.org/#dom-range-surroundcontents
2867
2868         In particular, the following changes were made:
2869         1. Drop early check to see if startContainer() accepts children like
2870            newParent. This check is not in the specification. Let the later
2871            call to Range.insertNode() take care of doing the check and
2872            throwing.
2873         2. Drop early check to see if newParent contains the range's start
2874            node, for the same reasons as above.
2875         3. Move extractContents() call *before* removing newParent's children
2876            to match the order in the specification (steps 3 & 4).
2877
2878         This makes our behavior much closer to Firefox's as well.
2879
2880         No new tests, rebaselined existing W3C test.
2881
2882         * dom/Range.cpp:
2883         (WebCore::Range::surroundContents):
2884
2885 2016-08-11  Alex Christensen  <achristensen@webkit.org>
2886
2887         Add URLParser stub
2888         https://bugs.webkit.org/show_bug.cgi?id=160770
2889
2890         Reviewed by Sam Weinig.
2891
2892         Added API test stub.
2893
2894         * CMakeLists.txt:
2895         * WebCore.xcodeproj/project.pbxproj:
2896         * platform/URL.h:
2897         * platform/URLParser.cpp: Added.
2898         (WebCore::URLParser::parse):
2899         * platform/URLParser.h: Added.
2900         (WebCore::URLParser::parse):
2901
2902 2016-08-11  Chris Dumez  <cdumez@apple.com>
2903
2904         Move dataset attribute from Element to HTMLElement / SVGElement
2905         https://bugs.webkit.org/show_bug.cgi?id=160766
2906
2907         Reviewed by Alex Christensen.
2908
2909         Move dataset attribute from Element to HTMLElement / SVGElement as per
2910         the specifications:
2911         - https://html.spec.whatwg.org/multipage/dom.html#htmlelement
2912         - https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement
2913
2914         Firefox and Chrome seem to have dataset on HTMLElement but not on
2915         SVGElement (yet).
2916
2917         No new tests, rebaselined existing test.
2918
2919         * dom/Element.idl:
2920         * html/HTMLElement.idl:
2921         * svg/SVGElement.idl:
2922
2923 2016-08-11  Eric Carlson  <eric.carlson@apple.com>
2924
2925         Unreviewed, update MediaRemoteSPI.h after r204082.
2926
2927         * platform/spi/mac/MediaRemoteSPI.h:
2928
2929 2016-08-10  Joseph Pecoraro  <pecoraro@apple.com>
2930
2931         Web Inspector: Should be able to Edit Node Attributes and Styles for non-UserAgent Shadow DOM nodes
2932         https://bugs.webkit.org/show_bug.cgi?id=160762
2933         <rdar://problem/27798271>
2934
2935         Reviewed by Ryosuke Niwa.
2936
2937         * inspector/InspectorDOMAgent.cpp:
2938         (WebCore::InspectorDOMAgent::assertEditableNode):
2939         (WebCore::InspectorDOMAgent::assertEditableElement):
2940         * inspector/PageConsoleAgent.cpp:
2941         (WebCore::PageConsoleAgent::addInspectedNode):
2942         Allow editing shadow DOM nodes as long as they are not in a UserAgent shadow tree.
2943
2944 2016-08-10  Chris Dumez  <cdumez@apple.com>
2945
2946         Optimization in Node.insertBefore() is not spec-compliant
2947         https://bugs.webkit.org/show_bug.cgi?id=160746
2948
2949         Reviewed by Ryosuke Niwa.
2950
2951         We have an optimization in Node.insertBefore(newNode, refChild) to avoid
2952         doing any work when newNode == refChild or newNode.nextSibling == refChild.
2953
2954         This optimization is not in the specification:
2955         - https://dom.spec.whatwg.org/#concept-node-replace
2956
2957         The issue is that this optimization is observable with DOM mutation
2958         observers / listeners or DOM ranges.
2959
2960         This patch addresses the issue by dropping the optimization. This case
2961         does not seem common enough to be worth optimizing for. However, if it
2962         turns out to regress the performance of things we care about, we could
2963         fallback to doing the optimization only when it is not observable.
2964
2965         Test: fast/dom/Node/insertBefore-no-op-mutationobserver.html
2966
2967         * dom/ContainerNode.cpp:
2968         (WebCore::checkAcceptChild):
2969         Move refChild->parent() == parent check from insertBefore() to our
2970         pre-insertion check function, right after checking if newNode contains
2971         parent. This was done in order to match more closely the specification
2972         and to make sure that exception are thrown in the correct order:
2973         - https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity (steps 2 and 3)
2974
2975         (WebCore::ContainerNode::insertBefore):
2976         1. Drop the (refChild->previousSibling() == &newChild || refChild == &newChild)
2977            optimization as it is not spc-compliant.
2978         2. If refChild is newNode, then set refChild to newChild.nextSibling as per:
2979            - https://dom.spec.whatwg.org/#concept-node-pre-insert (step 3)
2980
2981 2016-08-10  Ryosuke Niwa  <rniwa@webkit.org>
2982
2983         Move document.defineElement to customElements.define
2984         https://bugs.webkit.org/show_bug.cgi?id=160731
2985
2986         Reviewed by Chris Dumez.
2987
2988         Replaced Document.prototype.defineElement by CustomElementsRegistry.prototype.define to match
2989         the latest HTML specification: https://html.spec.whatwg.org/#custom-elements-api 
2990
2991         This patch renames the existing CustomElementDefinitions to CustomElementsRegistry and exposes
2992         it on window.customElements. CustomElementDefinitions is now owned by DOMWindow instead of
2993         Document to match the spec's new semantics.
2994
2995         No new tests. The existing tests have been updated to reflect the change.
2996
2997         * DerivedSources.cpp:
2998         * DerivedSources.make:
2999         * WebCore.xcodeproj/project.pbxproj:
3000         * bindings/js/JSCustomElementsRegistryCustom.cpp: Added.
3001         (WebCore::JSCustomElementsRegistry::define): Moved from JSDocumentCustom. Removed the check for
3002         the existence of DOMWindow since CustomElementsRegistry is an attribute on DOMWindow itself.
3003         * bindings/js/JSDocumentCustom.cpp:
3004         (WebCore::JSDocument::defineElement): Deleted.
3005         * bindings/js/JSHTMLElementCustom.cpp: Added the code to check the existence of DOMWindow since
3006         the registry is associated with DOMWindow, not Document.
3007         (WebCore::constructJSHTMLElement):
3008         * dom/CustomElementsRegistry.cpp: Renamed from Source/WebCore/dom/CustomElementDefinitions.cpp.
3009         (WebCore::CustomElementsRegistry::create): Added.
3010         (WebCore::CustomElementsRegistry::CustomElementsRegistry): Added.
3011         (WebCore::CustomElementsRegistry::~CustomElementsRegistry): Added.
3012         (WebCore::CustomElementsRegistry::addElementDefinition): Moved from CustomElementDefinitions.
3013         (WebCore::CustomElementsRegistry::addUpgradeCandidate): Ditto.
3014         (WebCore::CustomElementsRegistry::findInterface): Ditto.
3015         (WebCore::CustomElementsRegistry::containsConstructor): Ditto.
3016         * dom/CustomElementsRegistry.h: Renamed from Source/WebCore/dom/CustomElementDefinitions.h.
3017         * dom/CustomElementsRegistry.idl: Added.
3018         * dom/Document.cpp:
3019         (WebCore::createUpgradeCandidateElement): Extracted out of createHTMLElementWithNameValidation
3020         and createFallbackHTMLElement to share code.
3021         (WebCore::createHTMLElementWithNameValidation):
3022         (WebCore::createFallbackHTMLElement): This function was missing a check for the runtime flag.
3023         Sharing code with createHTMLElementWithNameValidation via createUpgradeCandidateElement fixes it.
3024         (WebCore::Document::ensureCustomElementDefinitions): Deleted.
3025         * dom/Document.h:
3026         (WebCore::Document::customElementDefinitions): Deleted.
3027         * dom/Document.idl:
3028         * dom/Element.cpp:
3029         (WebCore::Element::attributeChanged):
3030         * html/parser/HTMLConstructionSite.cpp:
3031         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
3032         * page/DOMWindow.cpp:
3033         (WebCore::DOMWindow::ensureCustomElementsRegistry): Added. Moved from Document.
3034         * page/DOMWindow.h:
3035         * page/DOMWindow.idl: Added customElements on DOMWindow.
3036
3037 2016-08-10  Alex Christensen  <achristensen@webkit.org>
3038
3039         Fix WinCairo build after r204327.
3040
3041         * platform/network/NetworkStorageSessionStub.cpp:
3042         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Renamed from create...
3043         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
3044
3045 2016-08-10  Nan Wang  <n_wang@apple.com>
3046
3047         AX: Media controls timeline should have percentage value description
3048         https://bugs.webkit.org/show_bug.cgi?id=160619
3049
3050         Reviewed by Eric Carlson.
3051
3052         Added aria-valuetext attribute to the timeline slider and set its value to
3053         the percentage format. Also formatted the elapsed/remaining timer's description
3054         so that it's more human readable.
3055
3056         Test: http/tests/media/hls/video-duration-accessibility.html
3057
3058         * English.lproj/mediaControlsLocalizedStrings.js:
3059         * Modules/mediacontrols/mediaControlsApple.js:
3060         (Controller.prototype.drawVolumeBackground):
3061         (Controller.prototype.formatTimeDescription):
3062         (Controller.prototype.formatTime):
3063         (Controller.prototype.updateTime):
3064         (Controller.prototype.updateControlsWhileScrubbing):
3065
3066 2016-08-10  Anders Carlsson  <andersca@apple.com>
3067
3068         Revert back to the old style member function state machine for callbacks
3069         https://bugs.webkit.org/show_bug.cgi?id=160756
3070
3071         Reviewed by Tim Horton.
3072
3073         This is another step towards merging SQLTransactionBackend and SQLTransaction,
3074         and using a single state machine for both sides.
3075
3076         * Modules/webdatabase/SQLTransaction.cpp:
3077         (WebCore::SQLTransaction::SQLTransaction):
3078         (WebCore::SQLTransaction::performPendingCallback):
3079         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
3080         (WebCore::SQLTransaction::scheduleCallback):
3081         (WebCore::SQLTransaction::openTransactionAndPreflight):
3082         (WebCore::SQLTransaction::runCurrentStatement):
3083         (WebCore::SQLTransaction::handleCurrentStatementError):
3084         (WebCore::SQLTransaction::handleTransactionError):
3085         (WebCore::SQLTransaction::postflightAndCommit):
3086         (WebCore::SQLTransaction::debugStepName):
3087         * Modules/webdatabase/SQLTransaction.h:
3088
3089 2016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
3090
3091         [ES2016] Implement Object.values
3092         https://bugs.webkit.org/show_bug.cgi?id=160410
3093
3094         Reviewed by Saam Barati, Yusuke Suzuki.
3095
3096         No new tests because all tests are implemented in JavaScriptCore 
3097         and there is no behavior change.
3098
3099         * ForwardingHeaders/runtime/IterationKind.h: Added.
3100         * bindings/js/SerializedScriptValue.cpp:
3101         (WebCore::CloneSerializer::serialize):
3102
3103 2016-08-10  Anders Carlsson  <andersca@apple.com>
3104
3105         Move more functions to from SQLTransactionBackend to SQLTransaction
3106         https://bugs.webkit.org/show_bug.cgi?id=160752
3107
3108         Reviewed by Tim Horton.
3109
3110         * Modules/webdatabase/SQLTransaction.cpp:
3111         (WebCore::SQLTransaction::acquireLock):
3112         (WebCore::SQLTransaction::openTransactionAndPreflight):
3113         (WebCore::SQLTransaction::runStatements):
3114         (WebCore::SQLTransaction::cleanupAndTerminate):
3115         (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
3116         * Modules/webdatabase/SQLTransaction.h:
3117         * Modules/webdatabase/SQLTransactionBackend.cpp:
3118         (WebCore::SQLTransactionBackend::acquireLock):
3119         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
3120         (WebCore::SQLTransactionBackend::runStatements):
3121         (WebCore::SQLTransactionBackend::cleanupAndTerminate):
3122         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
3123
3124 2016-08-10  Anders Carlsson  <andersca@apple.com>
3125
3126         Begin moving member functions from SQLTransactionBackend to SQLTransaction
3127         https://bugs.webkit.org/show_bug.cgi?id=160747
3128
3129         Reviewed by Tim Horton.
3130
3131         * Modules/webdatabase/Database.cpp:
3132         (WebCore::Database::performClose):
3133         * Modules/webdatabase/DatabaseTask.cpp:
3134         (WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
3135         (WebCore::DatabaseTransactionTask::doPerformTask):
3136         * Modules/webdatabase/SQLTransaction.cpp:
3137         (WebCore::SQLTransaction::executeSQL):
3138         (WebCore::SQLTransaction::lockAcquired):
3139         (WebCore::SQLTransaction::performNextStep):
3140         (WebCore::SQLTransaction::performPendingCallback):
3141         (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown):
3142         (WebCore::SQLTransaction::enqueueStatement):
3143         (WebCore::SQLTransaction::getNextStatement):
3144         (WebCore::SQLTransaction::runCurrentStatement):
3145         (WebCore::SQLTransaction::handleCurrentStatementError):
3146         (WebCore::SQLTransaction::handleTransactionError):
3147         (WebCore::SQLTransaction::postflightAndCommit):
3148         (WebCore::SQLTransaction::acquireOriginLock):
3149         (WebCore::SQLTransaction::releaseOriginLockIfNeeded):
3150         * Modules/webdatabase/SQLTransaction.h:
3151         (WebCore::SQLTransaction::backend): Deleted.
3152         * Modules/webdatabase/SQLTransactionBackend.cpp:
3153         (WebCore::SQLTransactionBackend::doCleanup):
3154         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
3155         (WebCore::SQLTransactionBackend::runStatements):
3156         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
3157         (WebCore::SQLTransactionBackend::enqueueStatement): Deleted.
3158         (WebCore::SQLTransactionBackend::performNextStep): Deleted.
3159         (WebCore::SQLTransactionBackend::executeSQL): Deleted.
3160         (WebCore::SQLTransactionBackend::lockAcquired): Deleted.
3161         (WebCore::SQLTransactionBackend::getNextStatement): Deleted.
3162         (WebCore::SQLTransactionBackend::runCurrentStatement): Deleted.
3163         (WebCore::SQLTransactionBackend::handleCurrentStatementError): Deleted.
3164         (WebCore::SQLTransactionBackend::handleTransactionError): Deleted.
3165         (WebCore::SQLTransactionBackend::postflightAndCommit): Deleted.
3166         (WebCore::SQLTransactionBackend::acquireOriginLock): Deleted.
3167         (WebCore::SQLTransactionBackend::releaseOriginLockIfNeeded): Deleted.
3168         * Modules/webdatabase/SQLTransactionBackend.h:
3169         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
3170         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
3171         (WebCore::SQLTransactionCoordinator::shutdown):
3172
3173 2016-08-10  Anders Carlsson  <andersca@apple.com>
3174
3175         Move all SQLTransactionBackend member variables to SQLTransaction
3176         https://bugs.webkit.org/show_bug.cgi?id=160745
3177
3178         Reviewed by Tim Horton.
3179
3180         * Modules/webdatabase/ChangeVersionWrapper.cpp:
3181         (WebCore::ChangeVersionWrapper::performPreflight):
3182         (WebCore::ChangeVersionWrapper::performPostflight):
3183         (WebCore::ChangeVersionWrapper::handleCommitFailedAfterPostflight):
3184         * Modules/webdatabase/ChangeVersionWrapper.h:
3185         (WebCore::ChangeVersionWrapper::sqlError): Deleted.
3186         * Modules/webdatabase/SQLTransaction.cpp:
3187         (WebCore::SQLTransaction::SQLTransaction):
3188         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
3189         (WebCore::SQLTransaction::deliverStatementCallback):
3190         (WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
3191         (WebCore::SQLTransaction::hasCallback): Deleted.
3192         (WebCore::SQLTransaction::hasSuccessCallback): Deleted.
3193         (WebCore::SQLTransaction::hasErrorCallback): Deleted.
3194         * Modules/webdatabase/SQLTransaction.h:
3195         (WebCore::SQLTransaction::isReadOnly):
3196         * Modules/webdatabase/SQLTransactionBackend.cpp:
3197         (WebCore::SQLTransactionBackend::SQLTransactionBackend):
3198         (WebCore::SQLTransactionBackend::~SQLTransactionBackend):
3199         (WebCore::SQLTransactionBackend::doCleanup):
3200         (WebCore::SQLTransactionBackend::enqueueStatement):
3201         (WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
3202         (WebCore::SQLTransactionBackend::executeSQL):
3203         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
3204         (WebCore::SQLTransactionBackend::acquireLock):
3205         (WebCore::SQLTransactionBackend::lockAcquired):
3206         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
3207         (WebCore::SQLTransactionBackend::runStatements):
3208         (WebCore::SQLTransactionBackend::getNextStatement):
3209         (WebCore::SQLTransactionBackend::runCurrentStatement):
3210         (WebCore::SQLTransactionBackend::handleCurrentStatementError):
3211         (WebCore::SQLTransactionBackend::handleTransactionError):
3212         (WebCore::SQLTransactionBackend::postflightAndCommit):
3213         (WebCore::SQLTransactionBackend::cleanupAndTerminate):
3214         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
3215         (WebCore::SQLTransactionBackend::requestTransitToState):
3216         (WebCore::SQLTransactionBackend::acquireOriginLock):
3217         (WebCore::SQLTransactionBackend::releaseOriginLockIfNeeded):
3218         (WebCore::SQLTransactionBackend::currentStatement): Deleted.
3219         (WebCore::SQLTransactionBackend::transactionError): Deleted.
3220         (WebCore::SQLTransactionBackend::setShouldRetryCurrentStatement): Deleted.
3221         (WebCore::SQLTransactionBackend::enqueueStatementBackend): Deleted.
3222         * Modules/webdatabase/SQLTransactionBackend.h:
3223         (WebCore::SQLTransactionBackend::database): Deleted.
3224         (WebCore::SQLTransactionBackend::isReadOnly): Deleted.
3225         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
3226         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
3227         (WebCore::SQLTransactionCoordinator::releaseLock):
3228
3229 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
3230
3231         Sort the project file.
3232
3233         * WebCore.xcodeproj/project.pbxproj:
3234
3235 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
3236
3237         Sort the feature flags in the FEATURE_DEFINES lines
3238         https://bugs.webkit.org/show_bug.cgi?id=160742
3239
3240         Reviewed by Anders Carlsson.
3241
3242         * Configurations/FeatureDefines.xcconfig:
3243
3244 2016-08-10  Anders Carlsson  <andersca@apple.com>
3245
3246         Make SQLTransactionBackend a member of SQLTransaction
3247         https://bugs.webkit.org/show_bug.cgi?id=160741
3248
3249         Reviewed by Tim Horton.
3250
3251         This is another step towards merging SQLTransaction and SQLTransactionBackend.
3252
3253         * Modules/webdatabase/Database.cpp:
3254         (WebCore::Database::performClose):
3255         (WebCore::Database::scheduleTransaction):
3256         (WebCore::Database::scheduleTransactionStep):
3257         (WebCore::Database::runTransaction):
3258         * Modules/webdatabase/Database.h:
3259         * Modules/webdatabase/DatabaseTask.cpp:
3260         (WebCore::DatabaseTransactionTask::DatabaseTransactionTask):
3261         (WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
3262         (WebCore::DatabaseTransactionTask::doPerformTask):
3263         * Modules/webdatabase/DatabaseTask.h:
3264         (WebCore::DatabaseTransactionTask::transaction):
3265         * Modules/webdatabase/DatabaseThread.cpp:
3266         * Modules/webdatabase/SQLTransaction.cpp:
3267         (WebCore::SQLTransaction::SQLTransaction):
3268         (WebCore::SQLTransaction::deliverTransactionCallback):
3269         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
3270         (WebCore::SQLTransaction::deliverStatementCallback):
3271         (WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
3272         (WebCore::SQLTransaction::deliverSuccessCallback):
3273         (WebCore::SQLTransaction::executeSQL):
3274         (WebCore::SQLTransaction::computeNextStateAndCleanupIfNeeded):
3275         (WebCore::SQLTransaction::setBackend): Deleted.
3276         * Modules/webdatabase/SQLTransaction.h:
3277         (WebCore::SQLTransaction::backend):
3278         * Modules/webdatabase/SQLTransactionBackend.cpp:
3279         (WebCore::SQLTransactionBackend::SQLTransactionBackend):
3280         (WebCore::SQLTransactionBackend::doCleanup):
3281         (WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
3282         (WebCore::SQLTransactionBackend::acquireLock):
3283         (WebCore::SQLTransactionBackend::lockAcquired):
3284         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
3285         (WebCore::SQLTransactionBackend::runCurrentStatement):
3286         (WebCore::SQLTransactionBackend::handleCurrentStatementError):
3287         (WebCore::SQLTransactionBackend::handleTransactionError):
3288         (WebCore::SQLTransactionBackend::postflightAndCommit):
3289         (WebCore::SQLTransactionBackend::requestTransitToState):
3290         (WebCore::SQLTransactionBackend::create): Deleted.
3291         * Modules/webdatabase/SQLTransactionBackend.h:
3292         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
3293         (WebCore::getDatabaseIdentifier):
3294         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
3295         (WebCore::SQLTransactionCoordinator::acquireLock):
3296         (WebCore::SQLTransactionCoordinator::releaseLock):
3297         (WebCore::SQLTransactionCoordinator::shutdown):
3298         * Modules/webdatabase/SQLTransactionCoordinator.h:
3299
3300 2016-08-08  Simon Fraser  <simon.fraser@apple.com>
3301
3302         child-transform-with-anchor-point-expected.html renders incorrectly
3303         https://bugs.webkit.org/show_bug.cgi?id=160616
3304
3305         Reviewed by Zalan Bujtas.
3306         
3307         If a layer has perspective, we need to ensure that its bounds don't collapse to 0x0 when clipped out,
3308         otherwise the sublayerTransform geometry gets messed up.
3309
3310         Test: compositing/geometry/clipped-out-perspective.html
3311
3312         * rendering/RenderLayerBacking.cpp:
3313         (WebCore::RenderLayerBacking::updateCompositedBounds):
3314
3315 2016-08-09  Sam Weinig  <sam@webkit.org>
3316
3317         Remove support for array types in IDLs
3318         https://bugs.webkit.org/show_bug.cgi?id=160729
3319
3320         Reviewed by Anders Carlsson.
3321
3322         Array types have been removed from WebIDL in favor of sequence<> and FrozenArray<>.
3323
3324         - Replace all current uses of Array types with sequences. This causes
3325           no functional change.
3326
3327         * bindings/scripts/CodeGenerator.pm:
3328         * bindings/scripts/CodeGeneratorGObject.pm:
3329         * bindings/scripts/CodeGeneratorJS.pm:
3330         * bindings/scripts/IDLParser.pm:
3331         Remove array support from the generators.
3332
3333         * Modules/gamepad/Gamepad.idl:
3334         * Modules/gamepad/NavigatorGamepad.idl:
3335         * Modules/gamepad/deprecated/Gamepad.idl:
3336         * Modules/mediacontrols/MediaControlsHost.idl:
3337         * Modules/mediastream/MediaStream.idl:
3338         * Modules/mediastream/MediaTrackConstraints.idl:
3339         * Modules/mediastream/RTCConfiguration.idl:
3340         * Modules/mediastream/RTCIceServer.idl:
3341         * Modules/mediastream/RTCTrackEvent.idl:
3342         * crypto/CryptoKey.idl:
3343         * dom/MessageEvent.idl:
3344         * testing/Internals.idl:
3345         Switch from array to sequence.
3346
3347 2016-08-10  Alex Christensen  <achristensen@webkit.org>
3348
3349         Use unsigned for locations in URL
3350         https://bugs.webkit.org/show_bug.cgi?id=160706
3351
3352         Reviewed by Sam Weinig.
3353
3354         No change in behavior.
3355
3356         * platform/URL.cpp:
3357         (WebCore::isSchemeFirstChar):
3358         (WebCore::findFirstOf):
3359         (WebCore::checkEncodedString):
3360         (WebCore::URL::host):
3361         (WebCore::URL::protocolIs):
3362         (WebCore::URL::setPort):
3363         (WebCore::URL::setUser):
3364         (WebCore::URL::setPass):
3365         (WebCore::escapeAndAppendNonHierarchicalPart):
3366         (WebCore::copyPathRemovingDots):
3367         (WebCore::URL::serialize):
3368         (WebCore::isDefaultPortForScheme):
3369         (WebCore::hostPortIsEmptyButCredentialsArePresent):
3370         (WebCore::URL::parse):
3371         (WebCore::protocolHostAndPortAreEqual):
3372         (WebCore::hostsAreEqual):
3373         (WebCore::protocolIs):
3374         (WebCore::findHostnamesInMailToURL):
3375         (WebCore::findHostnameInHierarchicalURL):
3376         (WebCore::encodeHostnames):
3377         (WebCore::encodeRelativeString):
3378         * platform/URL.h:
3379
3380 2016-08-09  Anders Carlsson  <andersca@apple.com>
3381
3382         Move SQLTransactionBackend construction inside SQLTransaction
3383         https://bugs.webkit.org/show_bug.cgi?id=160726
3384
3385         Reviewed by Tim Horton.
3386
3387         This is the first step towards re-merging SQLTransactionBackend and SQLTransaction and clean up the code.
3388
3389         * Modules/webdatabase/ChangeVersionWrapper.cpp:
3390         * Modules/webdatabase/ChangeVersionWrapper.h:
3391         * Modules/webdatabase/Database.cpp:
3392         (WebCore::Database::performClose):
3393         (WebCore::Database::scheduleTransactionStep):
3394         (WebCore::Database::changeVersion):
3395         (WebCore::Database::transaction):
3396         (WebCore::Database::readTransaction):
3397         (WebCore::Database::runTransaction):
3398         * Modules/webdatabase/Database.h:
3399         * Modules/webdatabase/DatabaseTask.cpp:
3400         * Modules/webdatabase/SQLTransaction.cpp:
3401         (WebCore::SQLTransaction::create):
3402         (WebCore::SQLTransaction::SQLTransaction):
3403         * Modules/webdatabase/SQLTransaction.h:
3404         (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper):
3405         (WebCore::SQLTransaction::backend):
3406         * Modules/webdatabase/SQLTransactionBackend.cpp:
3407         (WebCore::SQLTransactionBackend::lockAcquired):
3408         (WebCore::SQLTransactionBackend::requestTransitToState):
3409         * Modules/webdatabase/SQLTransactionBackend.h:
3410         (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper): Deleted.
3411
3412 2016-08-10  Chris Dumez  <cdumez@apple.com>
3413
3414         It should be possible to re-initialize a MutationEvent after it's been dispatched
3415         https://bugs.webkit.org/show_bug.cgi?id=160703
3416
3417         Reviewed by Sam Weinig.
3418
3419         It should be possible to re-initialize a MutationEvent after it's been dispatched,
3420         similarly to Event:
3421         - https://www.w3.org/TR/2015/WD-uievents-20151215/#widl-MutationEvent-initMutationEvent
3422
3423         Test: fast/events/initMutationEvent-after-dispatch.html
3424
3425         * dom/MutationEvent.cpp:
3426         (WebCore::MutationEvent::initMutationEvent):
3427
3428 2016-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3429
3430         [ES6] Add ModuleLoaderPrototype and move methods to it
3431         https://bugs.webkit.org/show_bug.cgi?id=160633
3432
3433         Reviewed by Saam Barati.
3434
3435         No behavior change.
3436
3437         * ForwardingHeaders/runtime/JSModuleLoader.h: Added.
3438         * bindings/js/JSDOMWindowBase.cpp:
3439         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
3440         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
3441         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
3442         * bindings/js/JSDOMWindowBase.h:
3443         * bindings/js/JSModuleLoader.cpp:
3444         (WebCore::JSModuleLoader::resolve):
3445         (WebCore::JSModuleLoader::fetch):
3446         (WebCore::JSModuleLoader::evaluate):
3447         * bindings/js/JSModuleLoader.h:
3448
3449 2016-08-10  Per Arne Vollan  <pvollan@apple.com>
3450
3451         [Win] Warning fix.
3452         https://bugs.webkit.org/show_bug.cgi?id=160687
3453
3454         Reviewed by Sam Weinig.
3455
3456         Avoid forward declarations with different dll linkage.
3457
3458         * platform/spi/cf/CFNetworkSPI.h:
3459
3460 2016-08-10  Per Arne Vollan  <pvollan@apple.com>
3461
3462         [Win] Warning fix.
3463         https://bugs.webkit.org/show_bug.cgi?id=160690
3464
3465         Reviewed by Sam Weinig.
3466
3467         Use static cast to convert from enum to unsigned.
3468
3469         * platform/network/ProtectionSpaceHash.h:
3470         (WebCore::ProtectionSpaceHash::hash):
3471
3472 2016-08-09  Alex Christensen  <achristensen@webkit.org>
3473
3474         Move NetworkStorageSession management to WebCore
3475         https://bugs.webkit.org/show_bug.cgi?id=160173
3476
3477         Reviewed by Brady Eidson.
3478
3479         No new tests.  No change in behaviour.
3480         Just moving the mapping from SessionID to NetworkStorageSession so we can use it from WebCore.
3481         I need this so we can get to the NetworkStorageSession from SocketStreamHandle without requiring a NetworkingContext.
3482
3483         * CMakeLists.txt:
3484         * WebCore.xcodeproj/project.pbxproj:
3485         * loader/CookieJar.cpp:
3486         * platform/network/NetworkStorageSession.cpp: Added.
3487         (WebCore::globalSessionMap):
3488         (WebCore::NetworkStorageSession::storageSession):
3489         (WebCore::NetworkStorageSession::destroySession):
3490         (WebCore::NetworkStorageSession::forEach):
3491         Moved from forEachNetworkStorageSession and fixed the FIXME.  This function now includes the default NetworkStorageSession.
3492         * platform/network/NetworkStorageSession.h:
3493         * platform/network/NetworkingContext.h:
3494         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3495         (WebCore::NetworkStorageSession::defaultStorageSession):
3496         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3497         (WebCore::NetworkStorageSession::cookieStorage):
3498         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
3499         * platform/network/cf/SocketStreamHandleCFNet.cpp:
3500         * platform/network/soup/CookieJarSoup.cpp:
3501         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3502         (WebCore::NetworkStorageSession::defaultStorageSession):
3503         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3504         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3505         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
3506         * platform/network/soup/ResourceHandleSoup.cpp:
3507
3508 2016-08-09  Chris Dumez  <cdumez@apple.com>
3509
3510         Optimization in Node.replaceChild() is not spec-compliant
3511         https://bugs.webkit.org/show_bug.cgi?id=160730
3512
3513         Reviewed by Ryosuke Niwa.
3514
3515         We have an optimization in Node.replaceChild() to avoid doing any work
3516         when the reference child and the new child are the same node. This
3517         optimization is not spec-compliant:
3518         - https://dom.spec.whatwg.org/#concept-node-replace
3519
3520         This is an issue because it is observable via Mutation observers /
3521         listeners or DOM ranges.
3522
3523         To address the issue, this patch drops the optimization. This is
3524         probably not common enough to be worth optimizing for. However,
3525         if it turns out to regress performance of things we care about,
3526         we can fall back to do the optimization only in cases where it
3527         is not observable.
3528
3529         No new tests, rebaselined existing tests.
3530
3531         * dom/ContainerNode.cpp:
3532         (WebCore::ContainerNode::replaceChild):
3533         1. Drop the oldChild == newChild optimization which is not in the
3534            specification.
3535         2. Add a null check for oldChild.parentNode() before trying to
3536            remove it from its parent, as per step 12 of the specification.
3537            oldChild.parentNode() is null when oldChild is newChild.
3538         3. Make sure we enqueue separate mutation records for the adoption
3539            of newNode into parent's node document and for the removal of
3540            oldChild / insertion of newChild. This is mandated by the
3541            specification (steps 10 and 15). Without this change, the
3542            following test would still not pass after dropping the
3543            optimization:
3544            imported/w3c/web-platform-tests/dom/nodes/MutationObserver-childList.html
3545
3546 2016-08-09  Chris Dumez  <cdumez@apple.com>
3547
3548         Optimization in Node::appendChild() is not spec-compliant
3549         https://bugs.webkit.org/show_bug.cgi?id=160728
3550
3551         Reviewed by Ryosuke Niwa.
3552
3553         We have an optimization in Node::appendChild() that avoid doing any work
3554         if the node to be appended is already the last child. This optimization
3555         is not spec-compliant:
3556         - https://dom.spec.whatwg.org/#dom-node-appendchild
3557
3558         The issue is that this is observable via DOM Mutation observers / listeners
3559         or DOM ranges.
3560
3561         To address the issue, this patch drops the optimization in appendChild().
3562         This seems like an odd case to optimize for as I am not convinced it is
3563         common to call parent.appendChild(parent.lastChild). If it turns out to
3564         regress the performance of things we care about though, we could fall
3565         back to do the optimization only when it is not observable.
3566
3567         Test: fast/dom/Node/appendChild-no-op-mutationobserver.html
3568
3569         * dom/ContainerNode.cpp:
3570         (WebCore::ContainerNode::appendChild): Deleted.
3571
3572 2016-08-09  Anders Carlsson  <andersca@apple.com>
3573
3574         Instantiate WebKit plug-ins at layout time, instead of at style resolution time
3575         https://bugs.webkit.org/show_bug.cgi?id=160715
3576
3577         Reviewed by Tim Horton.
3578
3579         This gets rid of the differentiation of WebKit plug-ins and Netscape plug-ins, and
3580         always instantiates plug-ins at layout time.
3581         
3582         Initially, plug-ins were always instantiated after style recalc, but that lead to bugs
3583         where plug-ins wouldn't be instantiated with their correct size. Fixing that bug lead
3584         to a regression in the Web Clip widget which is why the special casing was introduced.
3585         
3586         The Web Clip widget has now been fixed, so we can get rid of the special case.
3587
3588         * html/HTMLAppletElement.cpp:
3589         (WebCore::HTMLAppletElement::updateWidget):
3590         * html/HTMLAppletElement.h:
3591         * html/HTMLEmbedElement.cpp:
3592         (WebCore::HTMLEmbedElement::updateWidget):
3593         * html/HTMLEmbedElement.h:
3594         * html/HTMLObjectElement.cpp:
3595         (WebCore::HTMLObjectElement::updateWidget):
3596         * html/HTMLObjectElement.h:
3597         * html/HTMLPlugInImageElement.cpp:
3598         (WebCore::HTMLPlugInImageElement::isImageType):
3599         (WebCore::HTMLPlugInImageElement::wouldLoadAsPlugIn):
3600         (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
3601         (WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin): Deleted.
3602         * html/HTMLPlugInImageElement.h:
3603         * loader/EmptyClients.h:
3604         * loader/FrameLoaderTypes.h:
3605         * loader/SubframeLoader.cpp:
3606         (WebCore::SubframeLoader::shouldUsePlugin):
3607         * page/FrameView.cpp:
3608         (WebCore::FrameView::updateEmbeddedObject):
3609
3610 2016-08-09  Chris Dumez  <cdumez@apple.com>
3611
3612         Unreviewed, fix assertions after r204311.
3613
3614         Range::textNodeSplit() can now get called with a node that
3615         does not have a nextSibling(), in the case where this node
3616         does not have a parent.
3617
3618         * dom/Range.cpp:
3619         (WebCore::Range::textNodeSplit):
3620
3621 2016-08-09  Chris Dumez  <cdumez@apple.com>
3622
3623         CharacterData.data setter optimization is not spec-compliant and is observable
3624         https://bugs.webkit.org/show_bug.cgi?id=160712
3625
3626         Reviewed by Ryosuke Niwa.
3627
3628         We have an optimization in CharacterData.setData() that avoid doing any
3629         work if the new data is identical to the old data. However, this
3630         optimization is not spec-compliant:
3631         - https://dom.spec.whatwg.org/#dom-characterdata-data
3632
3633         This is an issue because this is observable using DOM mutation observer
3634         or ranges.
3635
3636         To address the issue, we now:
3637         1. Only use the optimization if there are not DOM mutation observers /
3638            listeners on the page.
3639         2. We now update the associated range when we use the fast path as well.
3640
3641         Test: fast/dom/Text/setData-no-op-mutation.html
3642
3643         * dom/CharacterData.cpp:
3644         (WebCore::canUseSetDataOptimization):
3645         (WebCore::CharacterData::setData):
3646
3647 2016-08-09  George Ruan  <gruan@apple.com>
3648
3649         Implement functionality of media capture on iOS
3650         https://bugs.webkit.org/show_bug.cgi?id=158945
3651         <rdar://problem/26893343>
3652
3653         Reviewed by Tim Horton.
3654
3655         No new tests, feature requires user gesture which we are unable to
3656         test currently.
3657
3658         * Configurations/FeatureDefines.xcconfig: Enable Media Capture feature
3659         for iOS.
3660         * html/FileInputType.cpp:
3661         (WebCore::FileInputType::handleDOMActivateEvent): Modified call for
3662         mediaCaptureType property.
3663         * html/HTMLInputElement.cpp:
3664         (WebCore::HTMLInputElement::mediaCaptureType): Returns
3665         MediaCaptureType according to the value of the capture attribute on
3666         the HTMLInputElement.
3667         (WebCore::HTMLInputElement::shouldUseMediaCapture): Deleted.
3668         * html/HTMLInputElement.h:
3669         * html/HTMLInputElement.idl: As the capture attribute is specified as
3670         a boolean attribute in the Media Capture spec, this is a non-standard
3671         web-facing change with accordance to the proposal #1102. We would like
3672         to be able to specify a capture device to pull up upon interaction
3673         with the input type file element. In favor of not introducing a new
3674         attribute to specify the capture device, we reuse the capture
3675         attribute with a set of enumerated values (user, environment, none) to
3676         specify the desired media capture behavior.
3677         * platform/FileChooser.h: Created enum MediaCaptureType representing
3678         whether the front or rear camera shoul dbe shown when the capture
3679         attribute is specified.
3680
3681 2016-08-09  Chris Dumez  <cdumez@apple.com>
3682
3683         Calling splitText() on a parent-less Text node should update associated ranges
3684         https://bugs.webkit.org/show_bug.cgi?id=160710
3685
3686         Reviewed by Ryosuke Niwa.
3687
3688         Calling splitText() on a parent-less Text node should update associated ranges:
3689         - https://dom.spec.whatwg.org/#concept-text-split (Step 9)
3690
3691         Previously, we would only update ranges for Text nodes that have a parent.
3692
3693         No new tests, rebaselined existing test.
3694
3695         * dom/Range.cpp:
3696         (WebCore::boundaryTextNodesSplit):
3697         (WebCore::Range::textNodeSplit): Deleted.
3698         * dom/Text.cpp:
3699         (WebCore::Text::splitText):
3700
3701 2016-08-09  Chris Dumez  <cdumez@apple.com>
3702
3703         Drop unused NodeListsNodeData::isEmpty()
3704         https://bugs.webkit.org/show_bug.cgi?id=160704
3705
3706         Reviewed by Ryosuke Niwa.
3707
3708         Drop unused NodeListsNodeData::isEmpty(). Its implementation is incorrect
3709         anyway because it fails to check if the m_childNodeList / m_emptyChildNodeList
3710         members are null.
3711
3712         * dom/NodeRareData.h:
3713         (WebCore::NodeListsNodeData::isEmpty): Deleted.
3714
3715 2016-08-06  Sam Weinig  <sam@webkit.org>
3716
3717         Replace NodeOrString with std::variant<Ref<Node>, String>
3718         https://bugs.webkit.org/show_bug.cgi?id=160638
3719
3720         Reviewed by Anders Carlsson.
3721
3722         * WebCore.xcodeproj/project.pbxproj:
3723         Remove NodeOrString.h/cpp
3724
3725         * bindings/js/JSNodeOrString.cpp:
3726         * bindings/js/JSNodeOrString.h:
3727         * dom/ContainerNode.cpp:
3728         (WebCore::ContainerNode::append):
3729         (WebCore::ContainerNode::prepend):
3730         * dom/ContainerNode.h:
3731         * dom/Node.cpp:
3732         (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
3733         (WebCore::firstFollowingSiblingNotInNodeSet):
3734         (WebCore::Node::convertNodesOrStringsIntoNode):
3735         (WebCore::Node::before):
3736         (WebCore::Node::after):
3737         (WebCore::Node::replaceWith):
3738         * dom/Node.h:
3739         Replace NodeOrString with std::variant<Ref<Node>, String> and move convertNodesOrStringsIntoNode
3740         into Node.
3741
3742         * dom/NodeOrString.cpp: Removed.
3743         * dom/NodeOrString.h: Removed.
3744
3745 2016-08-09  Chris Dumez  <cdumez@apple.com>
3746
3747         It should be possible to re-initialize a CustomEvent after it's been dispatched
3748         https://bugs.webkit.org/show_bug.cgi?id=160664
3749
3750         Reviewed by Darin Adler.
3751
3752         It should be possible to re-initialize a CustomEvent after it's been dispatched:
3753         - https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
3754
3755         Test: fast/events/initCustomEvent-after-dispatch.html
3756
3757         * dom/CustomEvent.cpp:
3758         (WebCore::CustomEvent::initCustomEvent):
3759
3760 2016-08-09  Anders Carlsson  <andersca@apple.com>
3761
3762         Get rid of PluginStrategy
3763         https://bugs.webkit.org/show_bug.cgi?id=160696
3764
3765         Reviewed by Dan Bernstein.
3766
3767         * WebCore.xcodeproj/project.pbxproj:
3768         * loader/EmptyClients.cpp:
3769         * platform/PlatformStrategies.h:
3770         (WebCore::PlatformStrategies::pluginStrategy): Deleted.
3771         * plugins/PluginInfoProvider.h:
3772         * plugins/PluginStrategy.h: Removed.
3773         (WebCore::PluginStrategy::~PluginStrategy): Deleted.
3774
3775 2016-08-08  Myles C. Maxfield  <mmaxfield@apple.com>
3776
3777         Ensure StringView lifetime is correct inside InlineTextBox
3778         https://bugs.webkit.org/show_bug.cgi?id=160584
3779
3780         Reviewed by Darin Adler.
3781
3782         A TextRun contains a StringView. Previously, we had a helper function which
3783         could possibly create a new string, and then create a TextRun whose StringView
3784         pointed inside this new string. Then, the string would be destroyed because it
3785         was on the stack.
3786
3787         Luckily, this is benign because this new string would always share a
3788         StringImpl with the string passed into the function (and the StringView
3789         would point into this StringImpl). However, relying on this is dangerous
3790         and we are trying to enforce StringView lifetime checks in
3791         https://bugs.webkit.org/show_bug.cgi?id=160384.
3792
3793         The solution is to make a helper function which returns this built string
3794         so that the caller can own this built string, thereby extending its lifetime.
3795         Unfortunately, this built string can't be a StringView because the same
3796         mechanism must be used for text-combine, which returns originalText(), which
3797         may return a built string if it is a RenderCounter. Perhaps it would be
3798         valuable to migrate RenderCounter::originalText() to something else, or to
3799         divorce text-combine from originalText(), but that is out of scope for this
3800         patch. Similarly, hyphenation uses this same mechanism, but because the
3801         hyphenated string needs to be created, we must own the string storage (so
3802         StringView is incorrect here).
3803
3804         Another reason is for performance: StringView::substring() is faster to use
3805         than String::substringSharingImpl(), since it does not allocate and destroy a
3806         StringImpl on the heap. This patch migrates away from
3807         String::substringSharingImpl() and onto StringView::substring().
3808
3809         No new tests because there is no behavior change.
3810
3811         * rendering/InlineTextBox.cpp:
3812         (WebCore::InlineTextBox::localSelectionRect):
3813         (WebCore::InlineTextBox::paint):
3814         (WebCore::InlineTextBox::selectionStartEnd):
3815         (WebCore::InlineTextBox::paintSelection):
3816         (WebCore::InlineTextBox::hyphenatedStringForTextRun):
3817         (WebCore::InlineTextBox::constructTextRun):
3818         * rendering/InlineTextBox.h:
3819         * rendering/RenderCombineText.cpp:
3820         (WebCore::RenderCombineText::maybeGetCombinedStringForRendering):
3821         (WebCore::RenderCombineText::getStringToRender): Deleted.
3822         * rendering/RenderCombineText.h:
3823
3824 2016-08-08  Jeremy Jones  <jeremyj@apple.com>
3825
3826         Clear fullscreen mode state after exiting fullscreen mode to keep state in sync.
3827         https://bugs.webkit.org/show_bug.cgi?id=160668
3828
3829         Reviewed by Jon Lee.
3830
3831         When exiting fullscreen while in auto picture in picture mode, fullscreen mode gets
3832         out of sync, causing exit fullscreen to fail. This change updates the state 
3833         to keep it correct.
3834
3835         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3836         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
3837
3838 2016-08-08  Chris Dumez  <cdumez@apple.com>
3839
3840         [Web IDL] We should resolve typedefs for dictionary members
3841         https://bugs.webkit.org/show_bug.cgi?id=160675
3842
3843         Reviewed by Sam Weinig.
3844
3845         Resolve typedefs for dictionary member types.
3846
3847         Added bindings test coverage.
3848
3849         * bindings/scripts/IDLParser.pm:
3850         (applyTypedefs):
3851         * bindings/scripts/test/JS/JSTestObj.cpp:
3852         (WebCore::convert<TestObj::Dictionary>):
3853         * bindings/scripts/test/TestObj.idl:
3854
3855 2016-08-08  Anders Carlsson  <andersca@apple.com>
3856
3857         Fix the Windows build.
3858
3859         * plugins/PluginInfoProvider.h:
3860
3861 2016-08-08  Anders Carlsson  <andersca@apple.com>
3862
3863         Add a new PluginInfoProvider class, to replace PluginStrategy
3864         https://bugs.webkit.org/show_bug.cgi?id=160670
3865
3866         Reviewed by Sam Weinig.
3867
3868         Add a per page PluginInfoProvider class that's going to ultimately replace the plug-in strategy.
3869
3870         * WebCore.xcodeproj/project.pbxproj:
3871         * loader/EmptyClients.cpp:
3872         (WebCore::fillWithEmptyClients):
3873         * page/Page.cpp:
3874         (WebCore::Page::Page):
3875         (WebCore::Page::~Page):
3876         (WebCore::Page::refreshPlugins):
3877         (WebCore::Page::pluginData):
3878         (WebCore::Page::pluginInfoProvider):
3879         * page/Page.h:
3880         * page/PageConfiguration.cpp:
3881         * page/PageConfiguration.h:
3882         * plugins/DOMPluginArray.cpp:
3883         (WebCore::DOMPluginArray::refresh):
3884         * plugins/DOMPluginArray.h:
3885         * plugins/PluginData.cpp:
3886         (WebCore::PluginData::PluginData):
3887         (WebCore::PluginData::webVisiblePlugins):
3888         (WebCore::PluginData::publiclyVisiblePlugins):
3889         (WebCore::PluginData::initPlugins):
3890         (WebCore::PluginData::refresh): Deleted.
3891         * plugins/PluginData.h:
3892         (WebCore::PluginData::create):
3893         (WebCore::PluginData::PluginData): Deleted.
3894         * plugins/PluginInfoProvider.cpp: Added.
3895         (WebCore::PluginInfoProvider::~PluginInfoProvider):
3896         (WebCore::PluginInfoProvider::addPage):
3897         (WebCore::PluginInfoProvider::removePage):
3898         * plugins/PluginInfoProvider.h: Added.
3899         * replay/SerializationMethods.cpp:
3900         (JSC::EncodingTraits<PluginData>::decodeValue):
3901         (JSC::DeserializedPluginData::DeserializedPluginData): Deleted.
3902
3903 2016-08-08  John Wilander  <wilander@apple.com>
3904
3905         Popups opened from a sandboxed iframe should themselves be sandboxed
3906         https://bugs.webkit.org/show_bug.cgi?id=134850
3907         <rdar://problem/27375388>
3908
3909         Reviewed by Brent Fulgham.
3910
3911         Test: http/tests/security/window-opened-from-sandboxed-iframe-should-inherit-sandbox.html
3912
3913         * loader/FrameLoader.cpp:
3914         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
3915             Now copies the opener's frame loader effective sandbox flags to the
3916             new frame loader.
3917
3918 2016-08-08  Chris Dumez  <cdumez@apple.com>
3919
3920         Align Selection API with the specification
3921         https://bugs.webkit.org/show_bug.cgi?id=160663
3922
3923         Reviewed by Ryosuke Niwa.
3924
3925         Align Selection API with the specification:
3926         - https://www.w3.org/TR/selection-api/#idl-def-Selection
3927
3928         In particular, the following changes were made:
3929         - Mark parameters as non-nullable when they should be.
3930         - Mark parameters as mandatory when they should be.
3931         - Use "unsigned long" type for offsets instead of "long".
3932
3933         This aligns our behavior with Firefox and Chrome.
3934
3935         Note that the Node parameters to setBaseAndExtent() operation were kept
3936         nullable, which does not match the specification. This is intentional
3937         as I worry about compatibility risk, especially considering they are
3938         still nullable in Chrome. Only Firefox marks them as non-nullable.
3939
3940         Test: editing/selection/bad-input.html
3941
3942         * dom/Position.h:
3943         (WebCore::Position::LegacyEditingOffset::value):
3944         (WebCore::Position::LegacyEditingOffset::LegacyEditingOffset):
3945         (WebCore::createLegacyEditingPosition):
3946         * page/DOMSelection.cpp:
3947         (WebCore::DOMSelection::anchorOffset):
3948         (WebCore::DOMSelection::focusOffset):
3949         (WebCore::DOMSelection::baseOffset):
3950         (WebCore::DOMSelection::extentOffset):
3951         (WebCore::DOMSelection::rangeCount):
3952         (WebCore::DOMSelection::collapse):
3953         (WebCore::DOMSelection::setBaseAndExtent):
3954         (WebCore::DOMSelection::setPosition):
3955         (WebCore::DOMSelection::extend):
3956         (WebCore::DOMSelection::getRangeAt):
3957         (WebCore::DOMSelection::addRange):
3958         (WebCore::DOMSelection::deleteFromDocument):
3959         (WebCore::DOMSelection::containsNode):
3960         (WebCore::DOMSelection::selectAllChildren):
3961         (WebCore::DOMSelection::shadowAdjustedOffset):
3962         (WebCore::DOMSelection::modify): Deleted.
3963         (WebCore::DOMSelection::shadowAdjustedNode): Deleted.
3964         (WebCore::DOMSelection::isValidForPosition): Deleted.
3965         * page/DOMSelection.h:
3966         * page/DOMSelection.idl:
3967
3968 2016-08-08  Chris Dumez  <cdumez@apple.com>
3969
3970         Regression(r204239): Caused flaky crashes under ~Database()
3971         https://bugs.webkit.org/show_bug.cgi?id=160665
3972         <rdar://problem/27748065>
3973
3974         Reviewed by Brady Eidson.
3975
3976         Make sure the scriptExecution context only gets ref'd / deref'd
3977         on the context thread. Document / WorkerGlobalScope are not
3978         ThreadSafeRefCounted.
3979
3980         No new tests, already covered by:
3981         storage/websql/open-database-creation-callback.html
3982
3983         * Modules/webdatabase/Database.cpp:
3984         (WebCore::Database::~Database):
3985
3986 2016-08-08  John Wilander  <wilander@apple.com>
3987
3988         Don't set document.domain to an IP address fragment
3989         https://bugs.webkit.org/show_bug.cgi?id=126045
3990         <rdar://problem/27331794>
3991
3992         Reviewed by Daniel Bates.
3993
3994         This patch matches the following Blink one:
3995         https://chromium.googlesource.com/chromium/blink//b19a57fdb323d5a80d3a1cb0a6b343558c4237b0
3996
3997         IP address octets should not be treated as subdomains when setting
3998         document.domain. The specs say:
3999         'The domain attribute's setter must run these steps: ...
4000         7. If host is not equal to effectiveDomain, then run these substeps:
4001             1. If host or effectiveDomain is not a domain, then throw a
4002             "SecurityError" DOMException.'
4003         https://html.spec.whatwg.org/multipage/browsers.html#relaxing-the-same-origin-restriction
4004         Last Updated 5 August 2016
4005
4006         'A host is a domain, an IPv4 address, or an IPv6 address.'
4007         https://url.spec.whatwg.org/#concept-domain
4008         Last Updated 28 July 2016
4009
4010         Test: http/tests/security/set-domain-remove-subdomain-for-ip-address.html
4011
4012         * dom/Document.cpp:
4013         (WebCore::Document::setDomain):
4014             Now checks whether the security origin is allowed to remove
4015             subdomains. If not, it throws a security error.
4016         * page/OriginAccessEntry.cpp:
4017         (WebCore::OriginAccessEntry::OriginAccessEntry):
4018             Constructor now expects an IP address setting.
4019         (WebCore::OriginAccessEntry::matchesOrigin):