07555a29b9b59477b01e406e714ba49af60842ea
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
2
3         Remove use of std::chrono in WebPage and entrained code
4         https://bugs.webkit.org/show_bug.cgi?id=164967
5
6         Reviewed by Tim Horton.
7
8         Replace std::chrono with Seconds and Monotonic Time.
9
10         Use more C++11 initialization for WebPage data members.
11
12         * page/ChromeClient.h:
13         * page/FrameView.cpp:
14         (WebCore::FrameView::scrollPositionChanged):
15         (WebCore::FrameView::setScrollVelocity):
16         * page/FrameView.h:
17         * platform/Timer.h:
18         (WebCore::TimerBase::startRepeating):
19         (WebCore::TimerBase::startOneShot):
20         (WebCore::TimerBase::augmentFireInterval):
21         (WebCore::TimerBase::augmentRepeatInterval):
22         * platform/graphics/TiledBacking.h:
23         (WebCore::VelocityData::VelocityData):
24         * platform/graphics/ca/TileController.cpp:
25         (WebCore::TileController::adjustTileCoverageRect):
26
27 2016-11-18  Dean Jackson  <dino@apple.com>
28
29         AX: "(inverted-colors)" media query only matches on page reload; should match on change
30         https://bugs.webkit.org/show_bug.cgi?id=163564
31         <rdar://problem/28807350>
32
33         Reviewed by Simon Fraser.
34
35         Mark some media queries as responding to notifications that
36         system accessibility settings have changed. When Page gets told
37         that has happened, check if any of the results have changed.
38
39         Tests: fast/media/mq-inverted-colors-live-update.html
40                fast/media/mq-monochrome-live-update.html
41                fast/media/mq-prefers-reduced-motion-live-update.html
42
43         * css/MediaQueryEvaluator.cpp:
44         (WebCore::isAccessibilitySettingsDependent):
45         (WebCore::MediaQueryEvaluator::evaluate):
46         * css/StyleResolver.cpp:
47         (WebCore::StyleResolver::addAccessibilitySettingsDependentMediaQueryResult):
48         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange):
49         * css/StyleResolver.h:
50         (WebCore::StyleResolver::hasAccessibilitySettingsDependentMediaQueries):
51         * page/Page.cpp:
52         (WebCore::Page::accessibilitySettingsDidChange):
53         * page/Page.h:
54
55 2016-11-18  Anders Carlsson  <andersca@apple.com>
56
57         Rename the 'other' Apple Pay Button type to 'donate'
58         https://bugs.webkit.org/show_bug.cgi?id=164978
59
60         Reviewed by Dean Jackson.
61
62         * DerivedSources.make:
63         * WebCorePrefix.h:
64         * css/CSSPrimitiveValueMappings.h:
65         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
66         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
67         * css/CSSValueKeywords.in:
68         * css/parser/CSSParser.cpp:
69         (WebCore::isValidKeywordPropertyAndValue):
70         * css/parser/CSSParserFastPaths.cpp:
71         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
72         * rendering/RenderThemeCocoa.mm:
73         (WebCore::toPKPaymentButtonType):
74         * rendering/style/RenderStyleConstants.h:
75
76 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
77
78         [WebGL2] Implement texStorage2D()
79         https://bugs.webkit.org/show_bug.cgi?id=164493
80
81         Reviewed by Dean Jackson.
82
83         Create a new validation function which only accepts sized internalFormats.
84         After running texStorage2D(), we also texSubImage2D() to zero-fill it. This
85         is to compensate for potentially buggy drivers.
86
87         Because glTexStorage2D() was only added to OpenGL in version 4.2, not all
88         OpenGL 3.2+ contexts can implement this command. However, according to
89         https://developer.apple.com/opengl/capabilities/ all Apple GPUs have the
90         GL_ARB_texture_storage which implements this call. In the future, we could
91         implement texStorage2D() on top of texImage2D() if there are any ports which
92         want WebGL2 but don't have 4.2 and don't have the extension.
93
94         Also, when calling texStorage2D, callers specify an internalFormat but not a
95         type/format pair. This means that storing the texture's type is only valid
96         for WebGL 1 contexts. This patch surrounds all calls to reading the texture
97         type with guards and adds an ASSERT() at the read site to make sure the
98         right thing is happening.
99
100         Test: fast/canvas/webgl/webgl2-texStorage.html
101
102         * html/canvas/WebGL2RenderingContext.cpp:
103         (WebCore::WebGL2RenderingContext::validateTexStorageFuncParameters):
104         (WebCore::WebGL2RenderingContext::texStorage2D):
105         * html/canvas/WebGL2RenderingContext.h:
106         * html/canvas/WebGLRenderingContext.cpp:
107         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
108         * html/canvas/WebGLRenderingContextBase.cpp:
109         (WebCore::WebGLRenderingContextBase::create):
110         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
111         (WebCore::WebGLRenderingContextBase::validateTexFunc):
112         (WebCore::WebGLRenderingContextBase::validateTexFuncData):
113         (WebCore::WebGLRenderingContextBase::texImage2D):
114         * html/canvas/WebGLTexture.cpp:
115         (WebCore::WebGLTexture::WebGLTexture):
116         (WebCore::WebGLTexture::getType):
117         (WebCore::WebGLTexture::needToUseBlackTexture):
118         (WebCore::WebGLTexture::canGenerateMipmaps):
119         (WebCore::internalFormatIsFloatType):
120         (WebCore::internalFormatIsHalfFloatType):
121         (WebCore::WebGLTexture::update):
122         * html/canvas/WebGLTexture.h:
123         * platform/graphics/GraphicsContext3D.cpp:
124         (WebCore::GraphicsContext3D::texImage2DResourceSafe):
125         (WebCore::GraphicsContext3D::packImageData):
126         (WebCore::GraphicsContext3D::extractImageData):
127         * platform/graphics/GraphicsContext3D.h:
128         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
129         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
130         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
131         (WebCore::GraphicsContext3D::texStorage2D):
132         (WebCore::GraphicsContext3D::texStorage3D):
133
134 2016-11-18  Alex Christensen  <achristensen@webkit.org>
135
136         TextDecoder constructor should not accept replacement encodings
137         https://bugs.webkit.org/show_bug.cgi?id=164903
138
139         Reviewed by Chris Dumez.
140
141         Covered by newly passing web platform tests.
142
143         * dom/TextDecoder.cpp:
144         (WebCore::TextDecoder::create):
145         https://encoding.spec.whatwg.org/#textdecoder says about the constructor:
146         "If label is either not a label or is a label for replacement, throws a RangeError."
147         See https://bugs.webkit.org/show_bug.cgi?id=159180 for the mapping of the replacement
148         codec names to "replacement".
149
150 2016-11-18  Chris Dumez  <cdumez@apple.com>
151
152         Assertion failures in ActiveDOMObject::~ActiveDOMObject under Database destructor
153         https://bugs.webkit.org/show_bug.cgi?id=164955
154         <rdar://problem/29336715>
155
156         Reviewed by Brady Eidson.
157
158         Make sure the Database's DatabaseContext object is destroyed on the context
159         thread given that DatabaseContext is an ActiveDOMObject and there is an
160         assertion in the ActiveDOMObject destructor that it should be destroyed on
161         on the context thread.
162
163         No new tests, already covered by existing tests.
164
165         * Modules/webdatabase/Database.cpp:
166         (WebCore::Database::~Database):
167
168 2016-11-18  Enrica Casucci  <enrica@apple.com>
169
170         Refactor drag and drop for WebKit2 to encode DragData message exchange.
171         https://bugs.webkit.org/show_bug.cgi?id=164945
172
173         Reviewed by Tim Horton.
174
175         No new tests. No change in functionality.
176
177         * loader/EmptyClients.h:
178         * page/DragClient.h:
179         * page/DragController.cpp:
180         (WebCore::createMouseEvent):
181         (WebCore::documentFragmentFromDragData):
182         (WebCore::DragController::dragIsMove):
183         (WebCore::DragController::dragEntered):
184         (WebCore::DragController::dragExited):
185         (WebCore::DragController::dragUpdated):
186         (WebCore::DragController::performDragOperation):
187         (WebCore::DragController::dragEnteredOrUpdated):
188         (WebCore::DragController::tryDocumentDrag):
189         (WebCore::DragController::operationForLoad):
190         (WebCore::DragController::dispatchTextInputEventFor):
191         (WebCore::DragController::concludeEditDrag):
192         (WebCore::DragController::canProcessDrag):
193         (WebCore::DragController::tryDHTMLDrag):
194         * page/DragController.h:
195         * page/efl/DragControllerEfl.cpp:
196         (WebCore::DragController::isCopyKeyDown):
197         (WebCore::DragController::dragOperation):
198         * page/gtk/DragControllerGtk.cpp:
199         (WebCore::DragController::isCopyKeyDown):
200         (WebCore::DragController::dragOperation):
201         * page/mac/DragControllerMac.mm:
202         (WebCore::DragController::isCopyKeyDown):
203         (WebCore::DragController::dragOperation):
204         * page/win/DragControllerWin.cpp:
205         (WebCore::DragController::dragOperation):
206         (WebCore::DragController::isCopyKeyDown):
207         * platform/DragData.h:
208         (WebCore::DragData::DragData):
209
210 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
211
212         Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
213         https://bugs.webkit.org/show_bug.cgi?id=163801
214
215         Reviewed by Simon Fraser.
216
217         These tests now pass with DumpRenderTree.
218         LayoutTests/pointer-lock/lock-already-locked.html
219         LayoutTests/pointer-lock/lock-element-not-in-dom.html
220         LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
221         LayoutTests/pointer-lock/mouse-event-api.html
222
223         PointerLockController::requestPointerLock now protects against synchronous callback
224         to allowPointerLock().
225
226         Add pointerLockEnabled setting.
227
228         * Configurations/FeatureDefines.xcconfig:
229         * dom/Document.cpp:
230         (WebCore::Document::exitPointerLock): Fix existing typo.
231         (WebCore::Document::pointerLockElement):
232         * features.json:
233         * page/EventHandler.cpp:
234         * page/PointerLockController.cpp:
235         (WebCore::PointerLockController::requestPointerLock):
236         (WebCore::PointerLockController::requestPointerUnlock):
237         * page/Settings.in:
238
239 2016-11-17  Alex Christensen  <achristensen@webkit.org>
240
241         Support IDN2008 with UTS #46 instead of IDN2003
242         https://bugs.webkit.org/show_bug.cgi?id=144194
243
244         Reviewed by Darin Adler.
245
246         Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII.
247         It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46.
248         This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing
249         to prevent homograph attacks on german domain names with "ß" and "ss" in them.  These are now treated as separate domains.
250         Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing,
251         but https://github.com/whatwg/url/issues/110 might change the spec.
252         
253         In addition, http://unicode.org/reports/tr46/ says:
254         "implementations are encouraged to apply the Bidi and ContextJ validity criteria"
255         Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain.  Chrome and Firefox do this.
256
257         ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name.
258         Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it.
259
260         ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB,
261         which looks somewhat like a dot.  We can investigate enabling these checks later.
262
263         Covered by new API tests and rebased LayoutTests.
264         The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks.
265
266         * platform/URLParser.cpp:
267         (WebCore::URLParser::domainToASCII):
268         (WebCore::URLParser::internationalDomainNameTranscoder):
269         * platform/URLParser.h:
270         * platform/mac/WebCoreNSURLExtras.mm:
271         (WebCore::mapHostNameWithRange):
272
273 2016-11-18  Dean Jackson  <dino@apple.com>
274
275         Better testing for accessibility media queries
276         https://bugs.webkit.org/show_bug.cgi?id=164954
277         <rdar://problem/29338292>
278
279         Reviewed by Myles Maxfield.
280
281         Provide an override mode for the accessibility media queries
282         that rely on system settings. This way we can test that they
283         are least responding to something.
284
285         Tests: fast/media/mq-inverted-colors-forced-value.html
286                fast/media/mq-monochrome-forced-value.html
287
288         * css/MediaQueryEvaluator.cpp: Query the Settings to see if we're
289         forcing a value.
290         (WebCore::monochromeEvaluate):
291         (WebCore::invertedColorsEvaluate):
292         (WebCore::prefersReducedMotionEvaluate):
293         * page/Settings.h:
294         * testing/InternalSettings.cpp: Add new forcing values for inverted-colors
295         and monochrome.
296         (WebCore::InternalSettings::Backup::Backup):
297         (WebCore::InternalSettings::Backup::restoreTo):
298         (WebCore::settingsToInternalSettingsValue):
299         (WebCore::internalSettingsToSettingsValue):
300         (WebCore::InternalSettings::forcedColorsAreInvertedAccessibilityValue):
301         (WebCore::InternalSettings::setForcedColorsAreInvertedAccessibilityValue):
302         (WebCore::InternalSettings::forcedDisplayIsMonochromeAccessibilityValue):
303         (WebCore::InternalSettings::setForcedDisplayIsMonochromeAccessibilityValue):
304         (WebCore::InternalSettings::forcedPrefersReducedMotionAccessibilityValue):
305         (WebCore::InternalSettings::setForcedPrefersReducedMotionAccessibilityValue):
306         (WebCore::InternalSettings::forcedPrefersReducedMotionValue): Deleted.
307         (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): Deleted.
308         * testing/InternalSettings.h:
309         * testing/InternalSettings.idl:
310
311 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
312
313         Unsupported emoji are invisible
314         https://bugs.webkit.org/show_bug.cgi?id=164944
315         <rdar://problem/28591608>
316
317         Reviewed by Dean Jackson.
318
319         In WidthIterator, we explicitly skip characters which the OS has no font
320         to render with. However, for emoji, we should draw something to show that
321         there is missing content. Because we have nothing to draw, we can draw
322         the .notdef glyph (empty box, or "tofu").
323
324         Test: fast/text/emoji-draws.html
325
326         * platform/graphics/WidthIterator.cpp:
327         (WebCore::characterMustDrawSomething):
328         (WebCore::WidthIterator::advanceInternal):
329
330 2016-11-18  Sam Weinig  <sam@webkit.org>
331
332         [WebIDL] Add support for record types
333         https://bugs.webkit.org/show_bug.cgi?id=164935
334
335         Reviewed by Tim Horton.
336
337         Add support for WebIDLs record types. We map them to HashMap<String, {OtherType}>.
338
339         * bindings/generic/IDLTypes.h:
340         - Add IDLRecord type and helper predicate.
341         - Remove IDLRegExp which is no longer in WebIDL and we never supported.
342
343         * bindings/js/JSDOMBinding.cpp:
344         (WebCore::stringToByteString):
345         (WebCore::identifierToByteString):
346         (WebCore::valueToByteString):
347         (WebCore::hasUnpairedSurrogate):
348         (WebCore::stringToUSVString):
349         (WebCore::identifierToUSVString):
350         (WebCore::valueToUSVString):
351         * bindings/js/JSDOMBinding.h:
352         Refactor ByteString and USVString conversion to support converting from
353         either a JSValue or Identifier.
354
355         * bindings/js/JSDOMConvert.h:
356         (WebCore::DetailConverter<IDLRecord<K, V>>):
357         (WebCore::JSConverter<IDLRecord<K, V>>):
358         Add conversion support for record types. Use Detail::IdentifierConverter helper
359         to convert identifiers to strings using the correct conversion rules.
360
361         (WebCore::Converter<IDLUnion<T...>>::convert):
362         Update comments in union conversion to match current spec. Remove check
363         for regular expressions and add support for record types.
364
365         * bindings/scripts/CodeGenerator.pm:
366         (IsRefPtrType):
367         Add record and union types to the list of things that aren't RefPtrs.
368
369         (IsRecordType):
370         Add predicate for testing if a type is a record.
371
372         (IsWrapperType):
373         Remove check for union. This is now handled in the IsRefPtrType check.
374
375         (SkipIncludeHeader): Deleted.
376         (GetSequenceInnerType): Deleted.
377         (GetFrozenArrayInnerType): Deleted.
378         (GetSequenceOrFrozenArrayInnerType): Deleted.
379         Remove no longer necessary functions.
380
381         * bindings/scripts/CodeGeneratorJS.pm:
382         (AddIncludesForImplementationType):
383         Remove check for includes to skip. This is now only called for interfaces, which should be included
384         unconditionally.
385
386         (AddToIncludesForIDLType):
387         Add includes and recursive includes for record types.
388
389         (GenerateOverloadedFunctionOrConstructor):
390         Update to account for records.
391
392         (GetGnuVTableRefForInterface):
393         (GetGnuVTableNameForInterface):
394         (GetGnuMangledNameForInterface):
395         (GetWinVTableNameForInterface):
396         (GetWinMangledNameForInterface):
397         Strength-reduce GetNativeTypeForConversions and GetNamespaceForInterface into their callers.
398
399         (GetBaseIDLType):
400         Add support for IDLRecord. Remove call to GetIDLInterfaceName now that is simply the type name.
401
402         (GetNativeType):
403         Simplify sequence/FrozenArray support and add record support.
404
405         (GetNativeInnerType):
406         Generalize GetNativeVectorInnerType to work for record types as well.
407
408         (ShouldPassWrapperByReference):
409         Moved so native type accessors can be together.
410
411         (NativeToJSValueDOMConvertNeedsState):
412         (NativeToJSValueDOMConvertNeedsGlobalObject):
413         Add record support.
414
415         (GetNativeTypeForConversions): Deleted.
416         (GetNamespaceForInterface): Deleted.
417         (GetNativeVectorType): Deleted.
418         (GetIDLInterfaceName): Deleted.
419         (GetNativeVectorInnerType): Deleted.
420         Remove unneeded functions.
421
422         * bindings/scripts/IDLParser.pm:
423         (typeDescription):
424         Add helper useful for debugging, that constructs the string form of a type.
425
426         (typeByApplyingTypedefs):
427         Add missing call to typeByApplyingTypedefs (this is noted by a fix in JSTestCallbackFunctionWithTypedefs.h)
428
429         (parseNonAnyType):
430         Remove unused $subtypeName variables and add support for parsing record types.
431
432         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
433         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
434         * bindings/scripts/test/JS/JSTestObj.cpp:
435         * bindings/scripts/test/TestObj.idl:
436         Add tests for records and update results.
437
438         * testing/TypeConversions.h:
439         (WebCore::TypeConversions::testLongRecord):
440         (WebCore::TypeConversions::setTestLongRecord):
441         (WebCore::TypeConversions::testNodeRecord):
442         (WebCore::TypeConversions::setTestNodeRecord):
443         (WebCore::TypeConversions::testSequenceRecord):
444         (WebCore::TypeConversions::setTestSequenceRecord):
445         * testing/TypeConversions.idl:
446         Add record types so it can be tested from layout tests.
447
448 2016-11-18  Dave Hyatt  <hyatt@apple.com>
449
450         [CSS Parser] Support font-variation-settings
451         https://bugs.webkit.org/show_bug.cgi?id=164947
452
453         Reviewed by Myles Maxfield.
454
455         * css/parser/CSSPropertyParser.cpp:
456         (WebCore::consumeFontVariationTag):
457         (WebCore::consumeFontVariationSettings):
458         (WebCore::CSSPropertyParser::parseSingleValue):
459
460 2016-11-17  Jiewen Tan  <jiewen_tan@apple.com>
461
462         Update SubtleCrypto::encrypt to match the latest spec
463         https://bugs.webkit.org/show_bug.cgi?id=164738
464         <rdar://problem/29257812>
465
466         Reviewed by Brent Fulgham.
467
468         This patch does following few things:
469         1. It updates the SubtleCrypto::encrypt method to match the latest spec:
470            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-encrypt.
471            It also refers to the latest Editor's Draft to a certain degree:
472            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-encrypt.
473         2. It implements encrypt operations of the following algorithms: AES-CBC,
474            RSAES-PKCS1-V1_5, and RSA-OAEP.
475         3. It addes ASSERT(parameters) for every method that accepts a
476            std::unique_ptr<CryptoAlgorithmParameters>&& type parameter.
477         4. It changes RefPtr<CryptoKey>&& to Ref<CryptoKey>&& for every method that
478            accepts a CryptoKey.
479
480         Tests: crypto/subtle/aes-cbc-encrypt-malformed-parameters.html
481                crypto/subtle/aes-cbc-import-key-encrypt.html
482                crypto/subtle/encrypt-malformed-parameters.html
483                crypto/subtle/rsa-oaep-encrypt-malformed-parameters.html
484                crypto/subtle/rsa-oaep-import-key-encrypt-label.html
485                crypto/subtle/rsa-oaep-import-key-encrypt.html
486                crypto/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html
487                crypto/workers/subtle/aes-cbc-import-key-encrypt.html
488                crypto/workers/subtle/rsa-oaep-import-key-encrypt.html
489                crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html
490
491         * CMakeLists.txt:
492         * DerivedSources.make:
493         * WebCore.xcodeproj/project.pbxproj:
494         * bindings/js/BufferSource.h:
495         (WebCore::BufferSource::BufferSource):
496         Add a default constructor for initializing an empty BufferSource object.
497         * bindings/js/JSSubtleCryptoCustom.cpp:
498         (WebCore::normalizeCryptoAlgorithmParameters):
499         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
500         (WebCore::JSSubtleCrypto::encrypt):
501         * crypto/CryptoAlgorithm.cpp:
502         (WebCore::CryptoAlgorithm::encrypt):
503         (WebCore::CryptoAlgorithm::exportKey):
504         * crypto/CryptoAlgorithm.h:
505         * crypto/CryptoAlgorithmParameters.h:
506         * crypto/CryptoKey.h:
507         * crypto/SubtleCrypto.cpp:
508         (WebCore::SubtleCrypto::SubtleCrypto):
509         * crypto/SubtleCrypto.h:
510         (WebCore::SubtleCrypto::workQueue):
511         * crypto/SubtleCrypto.idl:
512         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
513         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
514         * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
515         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
516         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
517         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
518         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
519         (WebCore::CryptoKeyRSA::generatePair):
520         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
521         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
522         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
523         (WebCore::CryptoAlgorithmAES_CBC::importKey):
524         (WebCore::CryptoAlgorithmAES_CBC::exportKey):
525         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
526         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
527         (WebCore::CryptoAlgorithmAES_KW::generateKey):
528         (WebCore::CryptoAlgorithmAES_KW::importKey):
529         (WebCore::CryptoAlgorithmAES_KW::exportKey):
530         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
531         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
532         (WebCore::CryptoAlgorithmHMAC::generateKey):
533         (WebCore::CryptoAlgorithmHMAC::importKey):
534         (WebCore::CryptoAlgorithmHMAC::exportKey):
535         * crypto/algorithms/CryptoAlgorithmHMAC.h:
536         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
537         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
538         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey):
539         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
540         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
541         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
542         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
543         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
544         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
545         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
546         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
547         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
548         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
549         (WebCore::CryptoAlgorithmRSA_OAEP::generateKey):
550         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
551         (WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
552         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
553         * crypto/keys/CryptoKeyRSA.h:
554         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
555         (WebCore::transformAES_CBC):
556         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
557         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
558         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
559         (WebCore::encryptRSAES_PKCS1_v1_5):
560         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
561         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
562         (WebCore::encryptRSA_OAEP):
563         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
564         * crypto/mac/CryptoKeyRSAMac.cpp:
565         (WebCore::CryptoKeyRSA::generatePair):
566         * crypto/parameters/AesCbcParams.idl: Added.
567         * crypto/parameters/CryptoAlgorithmAesCbcParams.h: Added.
568         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h:
569         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
570         * crypto/parameters/RsaOaepParams.idl: Added.
571
572 2016-11-18  Ryan Haddad  <ryanhaddad@apple.com>
573
574         Attempt to fix iOS build again.
575         <rdar://problem/29312689>
576
577         Unreviewed build fix.
578
579         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
580         (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
581         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack):
582
583 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
584
585         [CSS Font Loading] FontFaceSet.load() promises don't always fire
586         https://bugs.webkit.org/show_bug.cgi?id=164902
587
588         Reviewed by David Hyatt.
589
590         Test: fast/text/fontfaceset-rebuild-during-loading.html
591
592         We currently handle web fonts in two phases. The first phase is building up
593         StyleRuleFontFace objects which reflect the style on the page. The second is creating
594         CSSFontFace objects from those StyleRuleFontFace objects. When script modifies the
595         style on the page, we can often update the CSSFontFace objects, but there are some
596         modifications which we don't know how to model. For these operations, we destroy the
597         CSSFontFace objects and rebuild them from the newly modified StyleRuleFontFace objects.
598
599         Normally, this is fine. However, with the CSS font loading API, the CSSFontFaces back
600         Javascript objects which will persist across the rebuilding step mentioned above. This
601         means that the FontFace objects need to adopt the new CSSFontFace objects and forget
602         the old CSSFontFace objects.
603
604         There was one bit of state which I forgot to update during this rebuilding phase. The
605         FontFaceSet object contains an internal HashMap where a reference to a CSSFontFace
606         is used as a key. After the rebuilding phase, this reference wasn't updated to point
607         to the new CSSFontFace.
608
609         The solution is to instead use a reference to the higher-level FontFace as the key to
610         the HashMap. This object is persistent across the rebuilding phase (and it adopts
611         the new CSSFontFaces). There is not a lifetime problem because the FontFace holds a
612         strong reference to its backing CSSFontFace object.
613
614         This bug didn't cause a memory problem because the HashMap was keeping the old
615         CSSFontFace alive because the key was a strong reference.
616
617         This patch also adds a lengthy comment explaining how the migration works.
618
619         * css/CSSFontFace.cpp:
620         (WebCore::CSSFontFace::initializeWrapper): This is another bit of state which didn't
621         survive the rebuilding phase. Moving it here causes it to survive.
622         (WebCore::CSSFontFace::wrapper):
623         * css/CSSFontSelector.cpp:
624         (WebCore::CSSFontSelector::addFontFaceRule):
625         * css/FontFaceSet.cpp:
626         (WebCore::FontFaceSet::load):
627         (WebCore::FontFaceSet::faceFinished):
628         * css/FontFaceSet.h:
629
630 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
631
632         [SVG -> OTF Font Converter] Fonts advances are not internally consistent inside the generated font file
633         https://bugs.webkit.org/show_bug.cgi?id=164846
634         <rdar://problem/29031509>
635
636         Reviewed by Darin Adler.
637
638         The fonts I'm generating in the SVG -> OTF converter have fractional FUnit values for their advances.
639         The CFF table can encode that, but hmtx can't, which means the font isn't internally consistent.
640
641         Covered by existing tests.
642
643         * svg/SVGToOTFFontConversion.cpp:
644
645 2016-11-18  Ryan Haddad  <ryanhaddad@apple.com>
646
647         Attempt to fix iOS build.
648         <rdar://problem/29312689>
649
650         Unreviewed build fix.
651
652         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
653         (WebCore::MediaSelectionGroupAVFObjC::updateOptions):
654
655 2016-11-18  Dave Hyatt  <hyatt@apple.com>
656
657         [CSS Parser] Hook up InspectorStyleSheet to the new CSS parser.
658         https://bugs.webkit.org/show_bug.cgi?id=164886
659
660         Reviewed by Dean Jackson.
661
662         * css/CSSGrammar.y.in:
663         Get rid of the CSSRuleSourceData type enum, since StyleRule's type
664         enum is exactly the same.
665
666         * css/CSSPropertySourceData.cpp:
667         (WebCore::CSSPropertySourceData::CSSPropertySourceData):
668         * css/CSSPropertySourceData.h:
669         Add a concept of disabled to CSSPropertySourceData. This is used for
670         commented out properties.
671
672         (WebCore::CSSRuleSourceData::create):
673         (WebCore::CSSRuleSourceData::createUnknown):
674         (WebCore::CSSRuleSourceData::CSSRuleSourceData):
675         Get rid of the CSSRuleSourceData type enum, since StyleRule's type
676         enum is exactly the same.
677
678         * css/parser/CSSParser.cpp:
679         (WebCore::CSSParserContext::CSSParserContext):
680         (WebCore::CSSParser::parseSheetForInspector):
681         (WebCore::CSSParser::parseDeclarationForInspector):
682         (WebCore::CSSParser::markSupportsRuleHeaderStart):
683         (WebCore::CSSParser::markRuleHeaderStart):
684         (WebCore::CSSParser::markPropertyEnd):
685         * css/parser/CSSParser.h:
686         Add functions that represent the new API for inspector sheet
687         and declaration parsing. Patch the old parse code to use StyleRule::Type
688         now that the CSSRuleSourceData type is gone.
689
690         * css/parser/CSSParserObserver.h:
691         Tweak the API for our memory management.
692
693         * inspector/InspectorStyleSheet.cpp:
694         (flattenSourceData):
695         (WebCore::parserContextForDocument):
696         (WebCore::StyleSheetHandler::StyleSheetHandler):
697         (WebCore::StyleSheetHandler::startRuleHeader):
698         (WebCore::StyleSheetHandler::setRuleHeaderEnd):
699         (WebCore::StyleSheetHandler::endRuleHeader):
700         (WebCore::StyleSheetHandler::observeSelector):
701         (WebCore::StyleSheetHandler::startRuleBody):
702         (WebCore::StyleSheetHandler::endRuleBody):
703         (WebCore::StyleSheetHandler::popRuleData):
704         (WebCore::fixUnparsedProperties):
705         (WebCore::StyleSheetHandler::fixUnparsedPropertyRanges):
706         (WebCore::StyleSheetHandler::observeProperty):
707         (WebCore::StyleSheetHandler::observeComment):
708         (WebCore::InspectorStyle::populateAllProperties):
709         (WebCore::isValidSelectorListString):
710         (WebCore::InspectorStyleSheet::ensureSourceData):
711         (WebCore::InspectorStyleSheetForInlineStyle::ensureParsedDataReady):
712         (WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData):
713         (WebCore::createCSSParser): Deleted.
714         (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): Deleted.
715         * inspector/InspectorStyleSheet.h:
716         (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration):
717         Add the new implementation. This involves duplicating most of the old
718         parser code for this into a new class, StyleSheetHandler, that implements
719         the observer interface and builds up the same data structures as the old
720         parser did in response to the callbacks.
721
722 2016-11-18  Dan Bernstein  <mitz@apple.com>
723
724         Tried to fix some non-macOS builds.
725         <rdar://problems/29331425&29331438&29331722>
726
727         * platform/mac/WebPlaybackControlsManager.h:
728
729 2016-11-18  Per Arne Vollan  <pvollan@apple.com>
730
731         [Win32] Start releasing memory earlier when memory is running low.
732         https://bugs.webkit.org/show_bug.cgi?id=164862
733
734         Reviewed by Brent Fulgham.
735
736         On Windows, 32-bit processes have 2GB of memory available, where some is used by the system.
737         Debugging has shown that allocations might fail and cause crashes when memory usage is > ~1GB.
738         We should start releasing memory before we reach 1GB.
739
740         * platform/win/MemoryPressureHandlerWin.cpp:
741         (WebCore::CheckMemoryTimer::fired):
742
743 2016-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
744
745         REGRESSION(r208511): ImageDecoders: Crash decoding GIF images since r208511
746         https://bugs.webkit.org/show_bug.cgi?id=164864
747
748         Reviewed by Simon Fraser.
749
750         This happens sometimes since r208511 because the same decoder is used by more than one thread at the same
751         time and the decoders are not thread-safe. Several methods in ImageDecoder need to decode partially the image,
752         so it's possible that one method calls frameBufferAtIndex at the same times as createFrameImageAtIndex that now
753         can be called from the image decoder thread. Use a Lock in ImageDecoder to protect calls to frameBufferAtIndex.
754
755         * platform/image-decoders/ImageDecoder.cpp:
756         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
757         (WebCore::ImageDecoder::frameDurationAtIndex):
758         (WebCore::ImageDecoder::createFrameImageAtIndex):
759         * platform/image-decoders/ImageDecoder.h:
760
761 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
762
763         Add an experimental API to find elements across shadow boundaries
764         https://bugs.webkit.org/show_bug.cgi?id=164851
765         <rdar://problem/28220092>
766
767         Reviewed by Sam Weinig.
768
769         Add window.collectMatchingElementsInFlatTree(Node node, DOMString selectors)
770         as an experimental API which finds a list of elements that matches the given CSS selectors
771         and expose it to a JSWorld on which WKBundleScriptWorldMakeAllShadowRootsOpen was called.
772
773         No new tests. More test cases are added to WebKit2.InjectedBundleMakeAllShadowRootsOpen.
774
775         * bindings/scripts/CodeGeneratorJS.pm:
776         (NeedsRuntimeCheck): Added. Abstracts checks for EnabledAtRuntime and EnabledForWorld.
777         (OperationShouldBeOnInstance):
778         (GeneratePropertiesHashTable):
779         (GetRuntimeEnableFunctionName): Use worldForDOMObject(this).condition() for EnabledForWorld.
780         Also split the line for EnabledAtRuntime and EnabledAtRuntime for a better readability.
781         (GenerateImplementation):
782         (addIterableProperties):
783         * bindings/scripts/IDLAttributes.txt:
784         * bindings/scripts/preprocess-idls.pl:
785         (GenerateConstructorAttribute):
786         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
787         (WebCore::JSTestGlobalObject::finishCreation):
788         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld):
789         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller):
790         * bindings/scripts/test/JS/JSTestObj.cpp:
791         (WebCore::JSTestObjPrototype::finishCreation):
792         (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod):
793         (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodCaller):
794         * bindings/scripts/test/TestGlobalObject.idl: Added a test case.
795         * bindings/scripts/test/TestObj.idl: Ditto.
796         * page/DOMWindow.cpp:
797         (WebCore::DOMWindow::collectMatchingElementsInFlatTree): Added. Implements the feature by
798         calling SelectorQuery's matches on a node yielded by ComposedTreeIterator.
799         * page/DOMWindow.h:
800         * page/DOMWindow.idl:
801
802 2016-11-17  Sam Weinig  <sam@webkit.org>
803
804         [WebIDL] Add support for ByteString
805         https://bugs.webkit.org/show_bug.cgi?id=164901
806
807         Reviewed by Darin Adler.
808
809         * bindings/generic/IDLTypes.h:
810         Make IDLByteString a IDLString.
811
812         * bindings/js/JSDOMBinding.cpp:
813         (WebCore::valueToByteString):
814         (WebCore::valueToUSVString):
815         * bindings/js/JSDOMBinding.h:
816         Add conversion function for ByteString and fix valueToUSVString to take an ExecState reference.
817
818         * bindings/js/JSDOMConvert.h:
819         (WebCore::Converter<IDLByteString>::convert):
820         (WebCore::JSConverter<IDLByteString>::convert):
821         Add conversion functions for ByteString, using valueToByteString.
822
823         (WebCore::Converter<IDLUSVString>::convert):
824         Update to pass the ExecState by reference.
825
826         * bindings/js/JSMessageEventCustom.cpp:
827         (WebCore::handleInitMessageEvent):
828         Update to pass the ExecState by reference.
829
830         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
831         (WebCore::JSWorkerGlobalScope::importScripts):
832         Update to pass the ExecState by reference.
833
834         * bindings/scripts/CodeGenerator.pm:
835         Add ByteString as a string type.
836
837         * testing/TypeConversions.h:
838         (WebCore::TypeConversions::testByteString):
839         (WebCore::TypeConversions::setTestByteString):
840         * testing/TypeConversions.idl:
841         Add a testByteString attribute for testing.
842
843 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
844
845         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled
846         https://bugs.webkit.org/show_bug.cgi?id=164857
847         <rdar://problem/27721742>
848
849         Reviewed by Wenson Hsieh.
850
851         It turns out that some users want text replacement to be always enabled so change the semantics of
852         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled to only disable everything else.
853
854         Instead of completely disabling spellchecking, remove all text checking options but text replacement
855         when the user types into an input element on which this API is used to disable spellchecking.
856
857         No new tests since we don't have a good facility to test text replacement.
858
859         * dom/Element.h:
860         (WebCore::Element::isSpellCheckingEnabled): Made this non-virtual now that there is no override.
861         * editing/Editor.cpp:
862         (WebCore::Editor::replaceSelectionWithFragment):
863         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Don't call resolveTextCheckingTypeMask twice.
864         (WebCore::Editor::resolveTextCheckingTypeMask): Filter out the text checking options if the root editable
865         element is inside an input element on which isSpellcheckDisabledExceptTextReplacement is set to true.
866         * editing/Editor.h:
867         * html/HTMLInputElement.cpp:
868         (WebCore::HTMLInputElement::HTMLInputElement):
869         (WebCore::HTMLInputElement::isSpellCheckingEnabled): Deleted.
870         * html/HTMLInputElement.h:
871         (WebCore::HTMLInputElement::setSpellcheckDisabledExceptTextReplacement): Renamed from setSpellcheckEnabled
872         to reflect the new semantics.
873         (WebCore::HTMLInputElement::isSpellcheckDisabledExceptTextReplacement): Ditto.
874
875 2016-11-17  John Wilander  <wilander@apple.com>
876
877         Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
878         https://bugs.webkit.org/show_bug.cgi?id=164659
879
880         Reviewed by Andy Estes.
881
882         No new tests. This feature is behind a flag and off by default. Tests require real domain names.
883
884         * loader/ResourceLoadObserver.cpp:
885         (WebCore::ResourceLoadObserver::logFrameNavigation):
886         (WebCore::ResourceLoadObserver::logSubresourceLoading):
887         (WebCore::ResourceLoadObserver::logWebSocketLoading):
888             All three functions are now more conservative in calls to
889             m_store->fireDataModificationHandler(). They only fire when an important statistic has
890             changed or data records have previously been removed for the domain in question.
891         * loader/ResourceLoadStatistics.cpp:
892         (WebCore::ResourceLoadStatistics::encode):
893             Added the dataRecordsRemoved statistic.
894         (WebCore::ResourceLoadStatistics::decode):
895             Now takes a version parameter to control which keys to expect.
896             Added the dataRecordsRemoved statistic.
897         (WebCore::appendHashCountedSet):
898             Removed stray linefeed.
899         (WebCore::ResourceLoadStatistics::toString):
900             Added the dataRecordsRemoved statistic.
901         (WebCore::ResourceLoadStatistics::merge):
902             Added the dataRecordsRemoved statistic.
903         * loader/ResourceLoadStatistics.h:
904             Added the dataRecordsRemoved statistic.
905         * loader/ResourceLoadStatisticsStore.cpp:
906         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
907             Now encodes a version number for the statistics model.
908         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
909             Now tries to decode a version number and passes it on to statistics decoding.
910         (WebCore::ResourceLoadStatisticsStore::processStatistics):
911             No longer gates processing on the number of data captured.
912         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
913             Update function for the new dataRecordsRemoved statistic.
914         (WebCore::ResourceLoadStatisticsStore::hasEnoughDataForStatisticsProcessing): Deleted.
915             No longer needed since we no longer gate processing on the number of data captured.
916         * loader/ResourceLoadStatisticsStore.h:
917
918 2016-11-17  Alex Christensen  <achristensen@webkit.org>
919
920         Fix WinCairo build after r208740
921         https://bugs.webkit.org/show_bug.cgi?id=164749
922
923         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
924         (WebCore::GraphicsContext3D::reshapeFBOs):
925         (WebCore::GraphicsContext3D::validateAttributes):
926         (WebCore::GraphicsContext3D::getExtensions):
927         Use more references instead of pointers, like Myles did in r208740
928
929 2016-11-17  Alex Christensen  <achristensen@webkit.org>
930
931         Implement TextDecoder and TextEncoder
932         https://bugs.webkit.org/show_bug.cgi?id=163771
933
934         Reviewed by Sam Weinig.
935
936         This API is already implemented by Chrome and Firefox
937         as specified in https://encoding.spec.whatwg.org/
938
939         Covered by newly passing web platform tests.
940
941         * features.json:
942         * CMakeLists.txt:
943         * DerivedSources.make:
944         * WebCore.xcodeproj/project.pbxproj:
945         * dom/TextDecoder.cpp: Added.
946         (WebCore::isEncodingWhitespace):
947         (WebCore::TextDecoder::create):
948         (WebCore::TextDecoder::TextDecoder):
949         (WebCore::TextDecoder::ignoreBOMIfNecessary):
950         (WebCore::TextDecoder::prependBOMIfNecessary):
951         (WebCore::codeUnitByteSize):
952         (WebCore::TextDecoder::decode):
953         (WebCore::TextDecoder::encoding):
954         * dom/TextDecoder.h: Added.
955         (WebCore::TextDecoder::fatal):
956         (WebCore::TextDecoder::ignoreBOM):
957         * dom/TextDecoder.idl: Added.
958         * dom/TextEncoder.cpp: Added.
959         (WebCore::TextEncoder::TextEncoder):
960         (WebCore::TextEncoder::encoding):
961         (WebCore::TextEncoder::encode):
962         * dom/TextEncoder.h: Added.
963         (WebCore::TextEncoder::create):
964         * dom/TextEncoder.idl: Added.
965
966 2016-11-17  Sam Weinig  <sam@webkit.org>
967
968         Try to fix the windows build again.
969
970         * svg/SVGStringList.h:
971         * svg/properties/SVGStaticListPropertyTearOff.h:
972         (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff):
973
974 2016-11-17  Sam Weinig  <sam@webkit.org>
975
976         Try to fix the windows build.
977
978         * svg/SVGStringList.h:
979         Remove unnecessary using declarations.
980
981 2016-11-17  Chris Dumez  <cdumez@apple.com>
982
983         Regression(r208672?): ASSERTION FAILED: isMainThread() in WebCore::Node::ref()
984         https://bugs.webkit.org/show_bug.cgi?id=164887
985         <rdar://problem/29319497>
986
987         Reviewed by Brady Eidson.
988
989         Restore pre-r208672 behavior where we do not ref the script execution context in the
990         background thread since this is unsafe. We use WTFMove(m_scriptExecutionContext)
991         instead of m_scriptExecutionContext.copyRef(). Before r208672, it was calling
992         m_scriptExecutionContext.releaseNonNull() because m_scriptExecutionContext was a
993         RefPtr instead of a Ref. Note that copyRef() causes 2 issues here:
994         1. It refs the scriptExecutionContext in a non-main thread which is unsafe and asserts.
995         2. The point of this postTask in the destructor is to make sure the scriptExecutionContext
996            gets destroyed in the main thread so we definitely want to *transfer* ownership of
997            m_scriptExecutionContext to the main thread, not ref it to pass it to the main thread.
998
999         No new tests, already covered by storage/websql/multiple-transactions-on-different-handles.html.
1000
1001         * Modules/webdatabase/Database.cpp:
1002         (WebCore::Database::~Database):
1003
1004 2016-11-17  Brady Eidson  <beidson@apple.com>
1005
1006         Add _WKIconLoadingDelegate SPI.
1007         https://bugs.webkit.org/show_bug.cgi?id=164894
1008
1009         Reviewed by Alex Christensen.
1010
1011         No new tests (Manual testing possible in MiniBrowser now, WKTR tests coming soon in https://bugs.webkit.org/show_bug.cgi?id=164895).
1012
1013         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
1014
1015         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
1016
1017         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
1018
1019         * WebCore.xcodeproj/project.pbxproj:
1020
1021         * dom/Document.cpp:
1022         (WebCore::Document::implicitClose):
1023
1024         * html/LinkIconCollector.cpp:
1025         (WebCore::iconSize):
1026         (WebCore::compareIcons):
1027         * html/LinkIconCollector.h:
1028
1029         * loader/DocumentLoader.cpp:
1030         (WebCore::DocumentLoader::startIconLoading):
1031         (WebCore::DocumentLoader::didGetLoadDecisionForIcon):
1032         (WebCore::DocumentLoader::finishedLoadingIcon):
1033         * loader/DocumentLoader.h:
1034
1035         * loader/FrameLoaderClient.h:
1036
1037         * loader/icon/IconLoader.cpp:
1038         (WebCore::IconLoader::IconLoader):
1039         (WebCore::IconLoader::startLoading):
1040         (WebCore::IconLoader::notifyFinished):
1041         * loader/icon/IconLoader.h:
1042
1043         * platform/LinkIcon.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1044         (WebCore::LinkIcon::encode):
1045         (WebCore::LinkIcon::decode):
1046
1047 2016-11-15  Sam Weinig  <sam@webkit.org>
1048
1049         [SVG] Moving more special casing of SVG out of the bindings - SVG lists
1050         https://bugs.webkit.org/show_bug.cgi?id=164790
1051
1052         Reviewed by Alex Christensen.
1053
1054         - Make SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList and SVGTransformList
1055           real classes and stop special casing them in the bindings generator. This 
1056           removes the remaining SVG specializations for tear offs from the bindings generator.
1057         - Renamed existing SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList, 
1058           SVGPathSegList and SVGTransformList to SVG<Type>ListValues, to make way for the new classes.
1059
1060         * CMakeLists.txt:
1061         * WebCore.xcodeproj/project.pbxproj:
1062         * svg/SVGAllInOne.cpp:
1063         Add new files.
1064
1065         * bindings/scripts/CodeGenerator.pm:
1066         * bindings/scripts/CodeGeneratorJS.pm:
1067         Remove SVG tear off specific code!
1068
1069         * rendering/svg/RenderSVGShape.cpp:
1070         * rendering/svg/RenderSVGText.cpp:
1071         * rendering/svg/RenderSVGTextPath.cpp:
1072         * rendering/svg/SVGRenderTreeAsText.cpp:
1073         * svg/SVGAnimateMotionElement.cpp:
1074         * svg/SVGClipPathElement.cpp:
1075         * svg/SVGLinearGradientElement.cpp:
1076         * svg/SVGRadialGradientElement.cpp:
1077         Remove unnecessary #includes.
1078
1079         * rendering/svg/SVGPathData.cpp:
1080         (WebCore::updatePathFromPolygonElement):
1081         (WebCore::updatePathFromPolylineElement):
1082         * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
1083         (WebCore::updateCharacterData):
1084         (WebCore::SVGTextLayoutAttributesBuilder::fillCharacterDataMap):
1085         * svg/SVGAnimatedLengthList.cpp:
1086         (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
1087         (WebCore::parseLengthListFromString):
1088         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
1089         (WebCore::SVGAnimatedLengthListAnimator::calculateDistance):
1090         * svg/SVGAnimatedLengthList.h:
1091         * svg/SVGAnimatedNumberList.cpp:
1092         (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
1093         (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
1094         (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
1095         (WebCore::SVGAnimatedNumberListAnimator::calculateDistance):
1096         * svg/SVGAnimatedNumberList.h:
1097         * svg/SVGAnimatedPath.cpp:
1098         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
1099         * svg/SVGAnimatedPointList.cpp:
1100         (WebCore::SVGAnimatedPointListAnimator::constructFromString):
1101         (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
1102         (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
1103         (WebCore::SVGAnimatedPointListAnimator::calculateDistance):
1104         * svg/SVGAnimatedPointList.h:
1105         * svg/SVGAnimatedTransformList.cpp:
1106         (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
1107         (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
1108         * svg/SVGAnimatedTransformList.h:
1109         * svg/SVGAnimatedType.cpp:
1110         (WebCore::SVGAnimatedType::createLengthList):
1111         (WebCore::SVGAnimatedType::createNumberList):
1112         (WebCore::SVGAnimatedType::createPointList):
1113         (WebCore::SVGAnimatedType::createTransformList):
1114         * svg/SVGAnimatedType.h:
1115         (WebCore::SVGAnimatedType::lengthList):
1116         (WebCore::SVGAnimatedType::numberList):
1117         (WebCore::SVGAnimatedType::pointList):
1118         (WebCore::SVGAnimatedType::transformList):
1119         * svg/SVGComponentTransferFunctionElement.cpp:
1120         (WebCore::SVGComponentTransferFunctionElement::parseAttribute):
1121         * svg/SVGFEColorMatrixElement.cpp:
1122         (WebCore::SVGFEColorMatrixElement::parseAttribute):
1123         * svg/SVGFEConvolveMatrixElement.cpp:
1124         (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
1125         (WebCore::SVGFEConvolveMatrixElement::build):
1126         * svg/SVGParserUtilities.cpp:
1127         (WebCore::pointsListFromSVGData):
1128         * svg/SVGParserUtilities.h:
1129         * svg/SVGPathElement.cpp:
1130         * svg/SVGPathElement.h:
1131         * svg/SVGPathSegListBuilder.cpp:
1132         * svg/SVGPathSegListBuilder.h:
1133         * svg/SVGPathSegListSource.cpp:
1134         * svg/SVGPathSegListSource.h:
1135         * svg/SVGPathUtilities.cpp:
1136         (WebCore::buildSVGPathByteStreamFromSVGPathSegListValues):
1137         (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
1138         (WebCore::buildSVGPathSegListValuesFromByteStream):
1139         (WebCore::buildStringFromSVGPathSegListValues):
1140         (WebCore::buildSVGPathByteStreamFromSVGPathSegList): Deleted.
1141         (WebCore::buildSVGPathSegListFromByteStream): Deleted.
1142         (WebCore::buildStringFromSVGPathSegList): Deleted.
1143         * svg/SVGPathUtilities.h:
1144         * svg/SVGPolyElement.cpp:
1145         (WebCore::SVGPolyElement::parseAttribute):
1146         (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
1147         (WebCore::SVGPolyElement::points):
1148         (WebCore::SVGPolyElement::animatedPoints):
1149         * svg/SVGPolyElement.h:
1150         (WebCore::SVGPolyElement::pointList):
1151         * svg/SVGTextPositioningElement.cpp:
1152         (WebCore::SVGTextPositioningElement::parseAttribute):
1153         * svg/SVGTransformable.cpp:
1154         (WebCore::SVGTransformable::parseTransformAttribute):
1155         * svg/SVGTransformable.h:
1156         * svg/SVGViewElement.cpp:
1157         (WebCore::SVGViewElement::viewTarget):
1158         (WebCore::SVGViewElement::parseAttribute):
1159         * svg/SVGViewElement.h:
1160         * svg/SVGViewElement.idl:
1161         * svg/SVGViewSpec.cpp:
1162         (WebCore::SVGViewSpec::transformString):
1163         (WebCore::SVGViewSpec::transform):
1164         (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper):
1165         (WebCore::SVGViewSpec::reset):
1166         * svg/SVGViewSpec.h:
1167         Update for name changes.
1168         
1169         * svg/SVGAngle.h:
1170         (WebCore::SVGAngle::create):
1171         (WebCore::SVGAngle::SVGAngle):
1172         * svg/SVGLength.h:
1173         (WebCore::SVGLength::create):
1174         (WebCore::SVGLength::SVGLength):
1175         * svg/SVGMatrix.h:
1176         (WebCore::SVGMatrix::create):
1177         (WebCore::SVGMatrix::SVGMatrix):
1178         * svg/SVGNumber.h:
1179         (WebCore::SVGNumber::create):
1180         (WebCore::SVGNumber::SVGNumber):
1181         * svg/SVGPoint.h:
1182         (WebCore::SVGPoint::create):
1183         (WebCore::SVGPoint::SVGPoint):
1184         * svg/SVGPreserveAspectRatio.h:
1185         (WebCore::SVGPreserveAspectRatio::create):
1186         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio):
1187         * svg/SVGRect.h:
1188         (WebCore::SVGRect::create):
1189         (WebCore::SVGRect::SVGRect):
1190         * svg/SVGTransform.h:
1191         (WebCore::SVGTransform::create):
1192         (WebCore::SVGTransform::SVGTransform):
1193         * svg/properties/SVGPropertyTearOff.h:
1194         (WebCore::SVGPropertyTearOff::create):
1195         Pass the SVGAnimatedProperty parameter by reference.
1196
1197         * svg/SVGAnimationElement.cpp:
1198         (WebCore::SVGAnimationElement::requiredFeatures):
1199         (WebCore::SVGAnimationElement::requiredExtensions):
1200         (WebCore::SVGAnimationElement::systemLanguage):
1201         * svg/SVGAnimationElement.h:
1202         * svg/SVGCursorElement.cpp:
1203         (WebCore::SVGCursorElement::requiredFeatures):
1204         (WebCore::SVGCursorElement::requiredExtensions):
1205         (WebCore::SVGCursorElement::systemLanguage):
1206         * svg/SVGCursorElement.h:
1207         * svg/SVGGradientElement.cpp:
1208         * svg/SVGGraphicsElement.cpp:
1209         (WebCore::SVGGraphicsElement::requiredFeatures):
1210         (WebCore::SVGGraphicsElement::requiredExtensions):
1211         (WebCore::SVGGraphicsElement::systemLanguage):
1212         * svg/SVGGraphicsElement.h:
1213         * svg/SVGMaskElement.cpp:
1214         (WebCore::SVGMaskElement::requiredFeatures):
1215         (WebCore::SVGMaskElement::requiredExtensions):
1216         (WebCore::SVGMaskElement::systemLanguage):
1217         * svg/SVGMaskElement.h:
1218         * svg/SVGPatternElement.cpp:
1219         (WebCore::SVGPatternElement::parseAttribute):
1220         (WebCore::SVGPatternElement::requiredFeatures):
1221         (WebCore::SVGPatternElement::requiredExtensions):
1222         (WebCore::SVGPatternElement::systemLanguage):
1223         * svg/SVGPatternElement.h:
1224         * svg/SVGTests.cpp:
1225         (WebCore::SVGTests::synchronizeAttribute):
1226         (WebCore::SVGTests::synchronizeRequiredFeatures):
1227         (WebCore::SVGTests::synchronizeRequiredExtensions):
1228         (WebCore::SVGTests::synchronizeSystemLanguage):
1229         (WebCore::SVGTests::requiredFeatures):
1230         (WebCore::SVGTests::requiredExtensions):
1231         (WebCore::SVGTests::systemLanguage):
1232         * svg/SVGTests.h:
1233         * svg/SVGTests.idl:
1234         Make SVGTests SVGStringLists work by adding implementations of functions
1235         on the SVGElements that implement SVGTests, passing *this down to SVGTests.
1236
1237         * svg/SVGLengthList.cpp: Removed.
1238         * svg/SVGLengthList.h:
1239         * svg/SVGLengthList.idl:
1240         * svg/SVGLengthListValues.cpp: Copied from svg/SVGLengthList.cpp.
1241         * svg/SVGLengthListValues.h: Copied from svg/SVGLengthList.h.
1242         Rename SVGLengthList to SVGLengthListValues and add an explicit implementation of
1243         the SVGLengthList interface inheriting from SVGListPropertyTearOff<SVGLengthListValues>.
1244
1245         * svg/SVGNumberList.cpp: Removed.
1246         * svg/SVGNumberList.h:
1247         * svg/SVGNumberListValues.cpp: Copied from svg/SVGNumberList.cpp.
1248         * svg/SVGNumberListValues.h: Copied from svg/SVGNumberList.h.
1249         Rename SVGNumberList to SVGNumberListValues and add an explicit implementation of
1250         the SVGNumberList interface inheriting from SVGListPropertyTearOff<SVGNumberListValues>.
1251
1252         * svg/SVGPathSegList.cpp:
1253         * svg/SVGPathSegList.h:
1254         * svg/SVGPathSegListValues.cpp: Copied from svg/SVGPathSegList.cpp.
1255         * svg/SVGPathSegListValues.h: Copied from svg/SVGPathSegList.h.
1256         * svg/properties/SVGPathSegListPropertyTearOff.cpp: Removed.
1257         * svg/properties/SVGPathSegListPropertyTearOff.h: Removed.
1258         Rename SVGPathSegList to SVGPathSegListValues and add an explicit implementation of
1259         the SVGPathSegList interface inheriting from SVGListProperty<SVGPathSegListValues>.
1260
1261         * svg/SVGPointList.cpp: Removed.
1262         * svg/SVGPointList.h:
1263         * svg/SVGPointListValues.cpp: Copied from svg/SVGPointList.cpp.
1264         * svg/SVGPointListValues.h: Copied from svg/SVGPointList.h.
1265         Rename SVGPointList to SVGPointListValues and add an explicit implementation of
1266         the SVGPointList interface inheriting from SVGListPropertyTearOff<SVGPointListValues>.
1267
1268         * svg/SVGStringList.cpp: Removed.
1269         * svg/SVGStringList.h:
1270         * svg/SVGStringListValues.cpp: Copied from svg/SVGStringList.cpp.
1271         * svg/SVGStringListValues.h: Copied from svg/SVGStringList.h.
1272         Rename SVGStringList to SVGStringListValues and add an explicit implementation of
1273         the SVGStringList interface inheriting from SVGStaticListPropertyTearOff<SVGStringListValues>.
1274
1275         * svg/SVGTransformList.cpp: Removed.
1276         * svg/SVGTransformList.h:
1277         * svg/SVGTransformListValues.cpp: Copied from svg/SVGTransformList.cpp.
1278         * svg/SVGTransformListValues.h: Copied from svg/SVGTransformList.h.
1279         * svg/properties/SVGTransformListPropertyTearOff.h: Removed.
1280         Rename SVGTransformList to SVGTransformListValues and add an explicit implementation of
1281         the SVGTransformList interface inheriting from SVGListPropertyTearOff<SVGTransformListValues>.
1282
1283         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1284         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
1285         * svg/properties/SVGAnimatedPropertyTearOff.h:
1286         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
1287         * svg/properties/SVGStaticListPropertyTearOff.h:
1288         Convert to return fully specialized types for baseVal and animVal, removing many unnecessary casts
1289         around the codebase. Also add some uses of Ref.
1290
1291         * svg/properties/SVGListProperty.h:
1292         (WebCore::SVGListProperty::getItemValuesAndWrappers):
1293         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
1294         * svg/properties/SVGListPropertyTearOff.h:
1295         (WebCore::SVGListPropertyTearOff::create):
1296         (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
1297         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff):
1298         Store the AnimatedListPropertyTearOff as a Ref, and pass it around by reference.
1299
1300         * svg/properties/SVGStaticPropertyTearOff.h:
1301         Update to take the ContextElement by reference.
1302
1303 2016-11-17  Brent Fulgham  <bfulgham@apple.com>
1304
1305         Improve URL length handling
1306         https://bugs.webkit.org/show_bug.cgi?id=164884
1307         <rdar://problem/5909143>
1308
1309         Reviewed by David Kilzer.
1310
1311         Make sure the result of re-encoding and other fix-up stays within
1312         expected parameters.
1313
1314         No new tests. No change in behavior.
1315
1316         * platform/URL.cpp:
1317         (WebCore::URL::parse):
1318
1319 2016-11-17  Zalan Bujtas  <zalan@apple.com>
1320
1321         Render tree should be all clean by the end of FrameView::layout().
1322         https://bugs.webkit.org/show_bug.cgi?id=162834
1323
1324         Reviewed by Simon Fraser.
1325
1326         This is a preventive patch to ensure we don't introduce new bugs through
1327         dirty renderers. There are still 3 failing cases and they are skipped for now (debug only).
1328
1329         * page/FrameView.cpp:
1330         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
1331
1332 2016-11-17  Brent Fulgham  <bfulgham@apple.com>
1333
1334         keygen element should not support < 2048 RSA key lengths
1335         https://bugs.webkit.org/show_bug.cgi?id=164874
1336         <rdar://problem/22618141>
1337
1338         Reviewed by Dean Jackson.
1339
1340         Remove the two insecure RSA choices (512-bit and 1024-bit) so that users
1341         do not accidentally select a bad key length.
1342
1343         Tested by fast/html/keygen.html
1344
1345         * platform/LocalizedStrings.cpp:
1346         (WebCore::keygenMenuItem512): Deleted.
1347         (WebCore::keygenMenuItem1024): Deleted.
1348         * platform/LocalizedStrings.h:
1349         * platform/mac/SSLKeyGeneratorMac.mm:
1350         (WebCore::signedPublicKeyAndChallengeString): ASSERT on bad key size.
1351         (WebCore::getSupportedKeySizes): Remove bad key sizes.
1352         (WebCore::signedPublicKeyAndChallengeString): Ditto.
1353         * platform/win/SSLKeyGeneratorWin.cpp:
1354         (WebCore::WebCore::getSupportedKeySizes): Ditto.
1355
1356 2016-11-17  Eric Carlson  <eric.carlson@apple.com>
1357
1358         [MediaStream][Mac] Use AVCapturePreview object for camera/microphone rendering
1359         https://bugs.webkit.org/show_bug.cgi?id=164837
1360         <rdar://problem/29297727>
1361
1362         Reviewed by Jer Noble.
1363
1364         No new tests, the real capture devices can not be used in layout tests.
1365
1366         * WebCore.xcodeproj/project.pbxproj:
1367         
1368         Drive-by fix: clear m_settingMediaStreamSrcObject when the media player is destroyed unless
1369         that happens as a side effect of setting video.srcObject.
1370         * html/HTMLMediaElement.cpp:
1371         (WebCore::HTMLMediaElement::setSrcObject):
1372         (WebCore::HTMLMediaElement::clearMediaPlayer):
1373         * html/HTMLMediaElement.h:
1374
1375         Add support for realtime media source that vend a preview interface, while keeping support
1376         for those that do not (e.g. the mock capture devices).
1377         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1378         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1379         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
1380         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable):
1381         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer):
1382         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack):
1383         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
1384         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
1385         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
1386         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
1387         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
1388         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
1389         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume):
1390         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
1391
1392         * platform/mediastream/MediaStreamPrivate.cpp:
1393         (WebCore::MediaStreamPrivate::platformLayer): Deleted, no longer used.
1394         * platform/mediastream/MediaStreamPrivate.h:
1395
1396         Enable/disable the preview when available.
1397         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1398         (WebCore::MediaStreamTrackPrivate::setEnabled):
1399         (WebCore::MediaStreamTrackPrivate::endTrack):
1400         (WebCore::MediaStreamTrackPrivate::preview):
1401         * platform/mediastream/MediaStreamTrackPrivate.h:
1402
1403         * platform/mediastream/RealtimeMediaSource.h:
1404         (WebCore::RealtimeMediaSource::preview):
1405         (WebCore::RealtimeMediaSource::createWeakPtr):
1406         (WebCore::RealtimeMediaSource::platformLayer): Deleted.
1407
1408         Define a realtime media source preview interface.
1409         * platform/mediastream/RealtimeMediaSourcePreview.h: Added.
1410         (WebCore::RealtimeMediaSourcePreview::~RealtimeMediaSourcePreview):
1411         (WebCore::RealtimeMediaSourcePreview::invalidate):
1412         (WebCore::RealtimeMediaSourcePreview::createWeakPtr):
1413         (WebCore::RealtimeMediaSourcePreview::RealtimeMediaSourcePreview):
1414
1415         Implement the preview interface.
1416         * platform/mediastream/mac/AVAudioCaptureSource.h:
1417         * platform/mediastream/mac/AVAudioCaptureSource.mm:
1418         (WebCore::AVAudioSourcePreview::create):
1419         (WebCore::AVAudioSourcePreview::AVAudioSourcePreview):
1420         (WebCore::AVAudioSourcePreview::invalidate):
1421         (WebCore::AVAudioSourcePreview::play):
1422         (WebCore::AVAudioSourcePreview::pause):
1423         (WebCore::AVAudioSourcePreview::setEnabled):
1424         (WebCore::AVAudioSourcePreview::setVolume):
1425         (WebCore::AVAudioSourcePreview::updateState):
1426         (WebCore::AVAudioCaptureSource::createPreview):
1427         * platform/mediastream/mac/AVMediaCaptureSource.h:
1428         (WebCore::AVMediaCaptureSource::createWeakPtr):
1429         * platform/mediastream/mac/AVMediaCaptureSource.mm:
1430         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
1431         (WebCore::AVMediaCaptureSource::reset):
1432         (WebCore::AVMediaCaptureSource::preview):
1433         (WebCore::AVMediaCaptureSource::removePreview):
1434         (WebCore::AVMediaSourcePreview::AVMediaSourcePreview):
1435         (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview):
1436         (WebCore::AVMediaSourcePreview::invalidate):
1437         * platform/mediastream/mac/AVVideoCaptureSource.h:
1438         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1439         (WebCore::AVVideoSourcePreview::create):
1440         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview):
1441         (WebCore::AVVideoSourcePreview::invalidate):
1442         (WebCore::AVVideoSourcePreview::play):
1443         (WebCore::AVVideoSourcePreview::pause):
1444         (WebCore::AVVideoSourcePreview::setPaused):
1445         (WebCore::AVVideoSourcePreview::setEnabled):
1446         (WebCore::AVVideoCaptureSource::shutdownCaptureSession):
1447         (WebCore::AVVideoCaptureSource::processNewFrame):
1448         (WebCore::AVVideoCaptureSource::createPreview):
1449         (WebCore::AVVideoCaptureSource::platformLayer): Deleted.
1450
1451         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
1452         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1453         (WebCore::MockRealtimeVideoSourceMac::platformLayer): Deleted.
1454         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer): Deleted.
1455         * platform/mock/MockRealtimeVideoSource.cpp:
1456         (WebCore::MockRealtimeVideoSource::applyFrameRate):
1457         (WebCore::MockRealtimeVideoSource::applySize):
1458         (WebCore::MockRealtimeVideoSource::generateFrame):
1459         * platform/mock/MockRealtimeVideoSource.h:
1460         (WebCore::MockRealtimeVideoSource::updatePlatformLayer): Deleted.
1461
1462 2016-11-17  Chris Dumez  <cdumez@apple.com>
1463
1464         Unreviewed, fix build after r208839.
1465
1466         * dom/Node.h:
1467         (WebCore::Node::isDescendantOf):
1468
1469 2016-11-16  Dave Hyatt  <hyatt@apple.com>
1470
1471         [CSS Parser] Add @supports, @keyframe and media query parsing options
1472         https://bugs.webkit.org/show_bug.cgi?id=164821
1473
1474         Reviewed by Sam Weinig and Zalan Bujtas.
1475
1476         * css/CSSKeyframeRule.cpp:
1477         (WebCore::StyleKeyframe::setKeyText):
1478         * css/CSSKeyframeRule.h:
1479         * css/CSSKeyframesRule.cpp:
1480         (WebCore::StyleRuleKeyframes::findKeyframeIndex):
1481         Changed to call into CSSParserImpls implementation. The new parser
1482         is now always used when parsing the key list.
1483
1484         * css/MediaList.cpp:
1485         (WebCore::MediaQuerySet::create):
1486         (WebCore::MediaQuerySet::MediaQuerySet):
1487         (WebCore::MediaQuerySet::set):
1488         (WebCore::MediaQuerySet::add):
1489         (WebCore::MediaQuerySet::remove):
1490         (WebCore::MediaList::setMediaText):
1491         (WebCore::parseMediaDescriptor): Deleted.
1492         (WebCore::MediaQuerySet::internalParse): Deleted.
1493         (WebCore::MediaQuerySet::parse): Deleted.
1494         * css/MediaList.h:
1495         Rewritten to remove fallback descriptor support/parsing, since no other
1496         browser supports it, and this was part of our initial 2005 landing that
1497         nobody else appears to use.  Media queries now call into the new parser always.
1498
1499         * css/MediaQueryExp.cpp:
1500         (WebCore::featureWithValidDensity):
1501         (WebCore::featureWithPositiveNumber):
1502         (WebCore::MediaQueryExpression::MediaQueryExpression):
1503         Make sure to support transform2d, animation and transition.
1504
1505         * css/StyleMedia.cpp:
1506         (WebCore::StyleMedia::matchMedium):
1507         Call the normal create now that fallback descriptor syntax is gone.
1508
1509         * css/parser/CSSParser.cpp:
1510         (WebCore::CSSParser::parseKeyframeRule):
1511         (WebCore::CSSParser::parseSupportsCondition):
1512         (WebCore::CSSParser::parseInlineStyleDeclaration):
1513         (WebCore::CSSParser::parseDeclarationDeprecated):
1514         (WebCore::CSSParser::parseDeclaration):
1515         (WebCore::CSSParser::parseKeyframeKeyList):
1516         (WebCore::CSSParser::parseMediaQuery): Deleted.
1517         (WebCore::CSSParser::parseKeyframeSelector): Deleted.
1518         * css/parser/CSSParser.h:
1519         Patched the old parser to have flags to call into the new parser
1520         for supports conditions and keyframes. Rename the parseDeclaration that
1521         is only used by the old parser to have the word Deprecated in it. Removed
1522         the media query and key list parsing functions, since the new parser
1523         now does it always.
1524
1525         * css/parser/CSSParserIdioms.cpp:
1526         (WebCore::convertToASCIILowercaseInPlace): Deleted.
1527         * css/parser/CSSParserIdioms.h:
1528         * css/parser/CSSParserToken.cpp:
1529         (WebCore::convertToASCIILowercaseInPlace):
1530         (WebCore::CSSParserToken::convertToASCIILowercaseInPlace):
1531         * css/parser/CSSParserToken.h:
1532         (WebCore::CSSParserToken::value):
1533         (WebCore::CSSParserToken::initValueFromStringView):
1534         * css/parser/CSSParserValues.cpp:
1535         (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
1536         * css/parser/CSSPropertyParser.cpp:
1537         (WebCore::consumeAttr):
1538         * css/parser/CSSSelectorParser.cpp:
1539         (WebCore::CSSSelectorParser::consumeId):
1540         (WebCore::CSSSelectorParser::consumeClass):
1541         (WebCore::CSSSelectorParser::consumePseudo):
1542         Moving convertToASCIILowercase to be a CSSParserToken member function instead
1543         of operating on StringView. This saves an extra step, since the token itself
1544         already had all the correct members. Note that converting in-place is bad,
1545         and we'll be removing it once the new parser turns on.
1546
1547         * css/parser/MediaQueryParser.cpp:
1548         (WebCore::MediaQueryParser::readMediaType):
1549         (WebCore::MediaQueryParser::readFeature):
1550         (WebCore::MediaQueryParser::readFeatureEnd):
1551         Require the closing ")" on features. Fix the in-place lowercasing to only
1552         be done for features, not for types. This matches the old parser.
1553
1554         * dom/DOMImplementation.cpp:
1555         (WebCore::DOMImplementation::createCSSStyleSheet):
1556         * dom/InlineStyleSheetOwner.cpp:
1557         (WebCore::InlineStyleSheetOwner::createSheet):
1558         * html/HTMLLinkElement.cpp:
1559         (WebCore::HTMLLinkElement::process):
1560         (WebCore::HTMLLinkElement::initializeStyleSheet):
1561         * html/HTMLSourceElement.cpp:
1562         (WebCore::HTMLSourceElement::parseAttribute):
1563         * html/HTMLStyleElement.cpp:
1564         (WebCore::HTMLStyleElement::parseAttribute):
1565         * html/parser/HTMLPreloadScanner.cpp:
1566         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1567         * html/parser/HTMLResourcePreloader.cpp:
1568         (WebCore::mediaAttributeMatches):
1569         Patched to call the normal MediaQuerySet::create and not the one that had fallback
1570         descriptor support.
1571
1572 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1573
1574         Unreviewed, attempt to fix link error after r208841 part2
1575
1576         Use static_cast to avoid referencing static storage.
1577
1578         * storage/StorageMap.cpp:
1579         (WebCore::StorageMap::setItemIgnoringQuota):
1580
1581 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1582
1583         Unreviewed, attempt to fix link error after r208841
1584
1585         * storage/StorageMap.h:
1586
1587 2016-11-17  Saam Barati  <sbarati@apple.com>
1588
1589         Remove async/await compile time flag and enable tests
1590         https://bugs.webkit.org/show_bug.cgi?id=164828
1591         <rdar://problem/28639334>
1592
1593         Reviewed by Yusuke Suzuki.
1594
1595         * Configurations/FeatureDefines.xcconfig:
1596
1597 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1598
1599         [JSC] WTF::TemporaryChange with WTF::SetForScope
1600         https://bugs.webkit.org/show_bug.cgi?id=164761
1601
1602         Reviewed by Saam Barati.
1603
1604         No behavior change.
1605
1606         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
1607         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
1608         * bindings/js/JSCustomElementRegistryCustom.cpp:
1609         (WebCore::JSCustomElementRegistry::define):
1610         * bindings/js/ScriptController.cpp:
1611         (WebCore::ScriptController::evaluateModule):
1612         * css/ElementRuleCollector.cpp:
1613         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
1614         * css/StyleResolver.cpp:
1615         * css/parser/CSSParser.cpp:
1616         (WebCore::CSSParser::parseFillShorthand):
1617         (WebCore::CSSParser::parseShorthand):
1618         (WebCore::CSSParser::parse4Values):
1619         (WebCore::CSSParser::parseBorderRadius):
1620         * css/parser/SVGCSSParser.cpp:
1621         (WebCore::CSSParser::parseSVGValue):
1622         * dom/CustomElementRegistry.h:
1623         * dom/Document.cpp:
1624         (WebCore::Document::recalcStyle):
1625         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
1626         (WebCore::Document::destroyRenderTree):
1627         * dom/EventTarget.cpp:
1628         (WebCore::EventTarget::fireEventListeners):
1629         * dom/Microtasks.cpp:
1630         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
1631         * history/PageCache.cpp:
1632         (WebCore::PageCache::pruneToSizeNow):
1633         * html/DOMTokenList.cpp:
1634         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
1635         * html/parser/CSSPreloadScanner.cpp:
1636         (WebCore::CSSPreloadScanner::scan):
1637         * html/parser/HTMLConstructionSite.h:
1638         * loader/ContentFilter.cpp:
1639         (WebCore::ContentFilter::handleProvisionalLoadFailure):
1640         * loader/SubresourceLoader.cpp:
1641         * loader/cache/MemoryCache.cpp:
1642         (WebCore::MemoryCache::pruneLiveResourcesToSize):
1643         (WebCore::MemoryCache::pruneDeadResourcesToSize):
1644         * page/Chrome.cpp:
1645         (WebCore::Chrome::runModal):
1646         * page/FrameView.cpp:
1647         (WebCore::FrameView::layout):
1648         (WebCore::FrameView::setScrollPosition):
1649         (WebCore::FrameView::applyRecursivelyWithVisibleRect):
1650         (WebCore::FrameView::autoSizeIfEnabled):
1651         * page/csp/ContentSecurityPolicy.cpp:
1652         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
1653         * page/scrolling/ScrollingTree.cpp:
1654         (WebCore::ScrollingTree::commitTreeState):
1655         * platform/graphics/ca/GraphicsLayerCA.cpp:
1656         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
1657         (WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers):
1658         * platform/graphics/opengl/TemporaryOpenGLSetting.h:
1659         * platform/graphics/texmap/TextureMapperGL.cpp:
1660         (WebCore::TextureMapperGL::drawTexture):
1661         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1662         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
1663         * platform/graphics/win/GraphicsLayerDirect2D.cpp:
1664         * platform/gtk/PasteboardHelper.cpp:
1665         (WebCore::PasteboardHelper::writeClipboardContents):
1666         * platform/mac/ScrollbarThemeMac.mm:
1667         (WebCore::ScrollbarThemeMac::paint):
1668         * rendering/RenderBlock.cpp:
1669         * rendering/RenderGeometryMap.cpp:
1670         (WebCore::RenderGeometryMap::pushMappingsToAncestor):
1671         * rendering/RenderLayer.cpp:
1672         (WebCore::RenderLayer::updateLayerPositions):
1673         * rendering/RenderLayerCompositor.cpp:
1674         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1675         * rendering/RenderView.cpp:
1676         (WebCore::RenderView::hitTest):
1677         * replay/EventLoopInputDispatcher.cpp:
1678         (WebCore::EventLoopInputDispatcher::dispatchInput):
1679         * storage/StorageMap.cpp:
1680         (WebCore::StorageMap::setItemIgnoringQuota):
1681         * svg/SVGPathBlender.cpp:
1682         (WebCore::SVGPathBlender::addAnimatedPath):
1683
1684 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1685
1686         [WebCore] Clean up script loading code in XML
1687         https://bugs.webkit.org/show_bug.cgi?id=161651
1688
1689         Reviewed by Ryosuke Niwa.
1690
1691         This patch cleans up XML document script handling by using PendingScript.
1692         Previously, we directly used CachedScript. But it is not good since we
1693         have PendingScript wrapper.
1694
1695         We also disable ES6 modules for non HTML document. While ES6 modules tag
1696         requires "defer" semantics, "defer" semantics is not implemented in non
1697         HTML documents. And ES6 module tag is only specified in whatwg HTML spec.
1698
1699         * dom/LoadableClassicScript.cpp:
1700         (WebCore::LoadableClassicScript::execute):
1701         * dom/ScriptElement.cpp:
1702         (WebCore::ScriptElement::determineScriptType):
1703         (WebCore::ScriptElement::prepareScript):
1704         (WebCore::ScriptElement::executeClassicScript):
1705         (WebCore::ScriptElement::executePendingScript):
1706         (WebCore::ScriptElement::executeScript): Deleted.
1707         (WebCore::ScriptElement::executeScriptForScriptRunner): Deleted.
1708         * dom/ScriptElement.h:
1709         * dom/ScriptRunner.cpp:
1710         (WebCore::ScriptRunner::timerFired):
1711         * html/parser/HTMLDocumentParser.cpp:
1712         * html/parser/HTMLScriptRunner.cpp:
1713         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
1714         (WebCore::HTMLScriptRunner::runScript):
1715         * xml/parser/XMLDocumentParser.cpp:
1716         (WebCore::XMLDocumentParser::notifyFinished):
1717         * xml/parser/XMLDocumentParser.h:
1718         * xml/parser/XMLDocumentParserLibxml2.cpp:
1719         (WebCore::XMLDocumentParser::XMLDocumentParser):
1720         (WebCore::XMLDocumentParser::~XMLDocumentParser):
1721         (WebCore::XMLDocumentParser::endElementNs):
1722
1723 2016-11-16  Chris Dumez  <cdumez@apple.com>
1724
1725         Add Node::isDescendantOf() overload that takes in a reference
1726         https://bugs.webkit.org/show_bug.cgi?id=164854
1727
1728         Reviewed by Ryosuke Niwa.
1729
1730         Add Node::isDescendantOf() overload that takes in a reference as a lot
1731         of call sites have a reference or a pointer they know is not null.
1732
1733         No new tests, no Web-exposed behavior change.
1734
1735         * accessibility/AccessibilityObject.cpp:
1736         (WebCore::AccessibilityObject::press):
1737         * dom/Document.cpp:
1738         (WebCore::isNodeInSubtree):
1739         (WebCore::Document::removeFullScreenElementOfSubtree):
1740         (WebCore::Document::setAnimatingFullScreen):
1741         * dom/Node.cpp:
1742         (WebCore::Node::isDescendantOf):
1743         (WebCore::Node::isDescendantOrShadowDescendantOf):
1744         (WebCore::Node::contains):
1745         * dom/Node.h:
1746         (WebCore::Node::isDescendantOf):
1747         * dom/NodeIterator.cpp:
1748         (WebCore::NodeIterator::updateForNodeRemoval):
1749         * dom/SelectorQuery.cpp:
1750         (WebCore::SelectorDataList::executeFastPathForIdSelector):
1751         (WebCore::filterRootById):
1752         * dom/TypedElementDescendantIterator.h:
1753         (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::beginAt):
1754         (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from):
1755         (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt):
1756         (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from):
1757         * editing/ApplyStyleCommand.cpp:
1758         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
1759         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
1760         * editing/BreakBlockquoteCommand.cpp:
1761         (WebCore::BreakBlockquoteCommand::doApply):
1762         * editing/CompositeEditCommand.cpp:
1763         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
1764         * editing/DeleteSelectionCommand.cpp:
1765         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
1766         (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
1767         (WebCore::DeleteSelectionCommand::doApply):
1768         * editing/EditingStyle.cpp:
1769         (WebCore::EditingStyle::textDirectionForSelection):
1770         * editing/FormatBlockCommand.cpp:
1771         (WebCore::FormatBlockCommand::formatRange):
1772         * editing/TextIterator.cpp:
1773         (WebCore::TextIterator::advance):
1774         * editing/VisiblePosition.cpp:
1775         (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore):
1776         (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter):
1777         * editing/htmlediting.cpp:
1778         (WebCore::firstEditablePositionAfterPositionInRoot):
1779         (WebCore::lastEditablePositionBeforePositionInRoot):
1780         (WebCore::selectionForParagraphIteration):
1781         * editing/markup.cpp:
1782         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
1783         * html/CachedHTMLCollection.h:
1784         (WebCore::traversalType>::namedItem):
1785         * html/HTMLFormElement.cpp:
1786         (WebCore::HTMLFormElement::formElementIndex):
1787         * html/canvas/CanvasRenderingContext2D.cpp:
1788         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
1789         * page/EventHandler.cpp:
1790         (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent):
1791         * svg/SVGSVGElement.cpp:
1792         (WebCore::SVGSVGElement::getElementById):
1793
1794 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
1795
1796         Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled
1797         https://bugs.webkit.org/show_bug.cgi?id=164845
1798
1799         Reviewed by Dan Bernstein.
1800
1801         Revert r208833 and fix the build by declaring AVFunctionBarMediaSelectionOption and AVThumbnail in AVKitSPI.h
1802
1803         * platform/mac/WebPlaybackControlsManager.h:
1804         * platform/mac/WebPlaybackControlsManager.mm:
1805         (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
1806         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1807         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
1808         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
1809         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
1810         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
1811         * platform/spi/cocoa/AVKitSPI.h:
1812
1813 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
1814
1815         REGRESSION(r208082): 1% Speedometer regression on iOS
1816         https://bugs.webkit.org/show_bug.cgi?id=164852
1817
1818         Reviewed by Chris Dumez.
1819
1820         Temporarily disable CEReactions entirely to recover the regression in Speedometer since
1821         reverting r208082 wouldn't remove CEReactions from other DOM APIs and if r208082 was a regression,
1822         then they're likely causing a regression on Speedometer as well.
1823
1824         * dom/CustomElementReactionQueue.cpp:
1825         (WebCore::CustomElementReactionStack::ElementQueue::add): Removed the release assert added in r208785
1826         since reactions can be inserted into the backup queue while the queue is running.
1827         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): Ditto.
1828         * dom/CustomElementReactionQueue.h:
1829         (WebCore::CustomElementReactionStack::CustomElementReactionStack): Removed all the code so that this
1830         constructor would be optimized away by clang.
1831         (WebCore::CustomElementReactionStack::~CustomElementReactionStack): Ditto.
1832
1833 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
1834
1835         Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled
1836         https://bugs.webkit.org/show_bug.cgi?id=164845
1837
1838         Reviewed by Wenson Hsieh.
1839
1840         Fix builds after r208802 by wrapping code inside USE(APPLE_INTERNAL_SDK).
1841
1842         * platform/mac/WebPlaybackControlsManager.h:
1843         * platform/mac/WebPlaybackControlsManager.mm:
1844         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1845         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
1846         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
1847         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
1848         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
1849
1850 2016-11-16  Chris Dumez  <cdumez@apple.com>
1851
1852         ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary
1853         https://bugs.webkit.org/show_bug.cgi?id=164812
1854         <rdar://problem/29148465>
1855
1856         Reviewed by Geoffrey Garen.
1857
1858         ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary,
1859         meaning when there is not already one pending.
1860
1861         * dom/ScriptExecutionContext.cpp:
1862         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon):
1863         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
1864         * dom/ScriptExecutionContext.h:
1865
1866 2016-11-16  Chris Dumez  <cdumez@apple.com>
1867
1868         Use more references in TreeScope / TreeScopeAdopter
1869         https://bugs.webkit.org/show_bug.cgi?id=164836
1870
1871         Reviewed by Ryosuke Niwa.
1872
1873         Use more references in TreeScope / TreeScopeAdopter and avoid some
1874         unnecessary null checks.
1875
1876         No new tests, no Web-exposed behavior change.
1877
1878         * dom/ContainerNode.cpp:
1879         (WebCore::ContainerNode::takeAllChildrenFrom):
1880         (WebCore::ContainerNode::insertBefore):
1881         (WebCore::ContainerNode::replaceChild):
1882         (WebCore::ContainerNode::removeBetween):
1883         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck):
1884         (WebCore::ContainerNode::parserAppendChild):
1885         * dom/ContainerNodeAlgorithms.cpp:
1886         (WebCore::addChildNodesToDeletionQueue):
1887         * dom/Document.cpp:
1888         (WebCore::Document::adoptNode):
1889         (WebCore::Document::moveNodeIteratorsToNewDocument):
1890         * dom/Document.h:
1891         * dom/Element.cpp:
1892         (WebCore::Element::didMoveToNewDocument):
1893         (WebCore::Element::addShadowRoot):
1894         (WebCore::Element::removeShadowRoot):
1895         (WebCore::Element::setAttributeNode):
1896         (WebCore::Element::setAttributeNodeNS):
1897         (WebCore::Element::ensureAttr):
1898         * dom/Element.h:
1899         * dom/Node.cpp:
1900         (WebCore::Node::didMoveToNewDocument):
1901         * dom/Node.h:
1902         * dom/NodeRareData.h:
1903         (WebCore::NodeListsNodeData::adoptDocument):
1904         * dom/TreeScope.cpp:
1905         (WebCore::TreeScope::TreeScope):
1906         (WebCore::TreeScope::setParentTreeScope):
1907         (WebCore::TreeScope::adoptIfNeeded):
1908         * dom/TreeScope.h:
1909         (WebCore::TreeScope::documentScope):
1910         (WebCore::TreeScope::setDocumentScope):
1911         * dom/TreeScopeAdopter.cpp:
1912         (WebCore::TreeScopeAdopter::moveTreeToNewScope):
1913         (WebCore::TreeScopeAdopter::moveShadowTreeToNewDocument):
1914         (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled):
1915         (WebCore::TreeScopeAdopter::updateTreeScope):
1916         (WebCore::TreeScopeAdopter::moveNodeToNewDocument):
1917         * dom/TreeScopeAdopter.h:
1918         (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled):
1919         (WebCore::TreeScopeAdopter::TreeScopeAdopter):
1920         * html/FormAssociatedElement.cpp:
1921         (WebCore::FormAssociatedElement::didMoveToNewDocument):
1922         * html/FormAssociatedElement.h:
1923         * html/HTMLFieldSetElement.cpp:
1924         (WebCore::HTMLFieldSetElement::didMoveToNewDocument):
1925         * html/HTMLFieldSetElement.h:
1926         * html/HTMLFormControlElement.cpp:
1927         (WebCore::HTMLFormControlElement::didMoveToNewDocument):
1928         * html/HTMLFormControlElement.h:
1929         * html/HTMLFormElement.cpp:
1930         (WebCore::HTMLFormElement::didMoveToNewDocument):
1931         * html/HTMLFormElement.h:
1932         * html/HTMLImageElement.cpp:
1933         (WebCore::HTMLImageElement::didMoveToNewDocument):
1934         * html/HTMLImageElement.h:
1935         * html/HTMLInputElement.cpp:
1936         (WebCore::HTMLInputElement::didMoveToNewDocument):
1937         * html/HTMLInputElement.h:
1938         * html/HTMLMediaElement.cpp:
1939         (WebCore::HTMLMediaElement::didMoveToNewDocument):
1940         * html/HTMLMediaElement.h:
1941         * html/HTMLObjectElement.cpp:
1942         (WebCore::HTMLObjectElement::didMoveToNewDocument):
1943         * html/HTMLObjectElement.h:
1944         * html/HTMLPictureElement.cpp:
1945         (WebCore::HTMLPictureElement::didMoveToNewDocument):
1946         * html/HTMLPictureElement.h:
1947         * html/HTMLPlugInImageElement.cpp:
1948         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
1949         * html/HTMLPlugInImageElement.h:
1950         * html/HTMLTemplateElement.cpp:
1951         (WebCore::HTMLTemplateElement::didMoveToNewDocument):
1952         * html/HTMLTemplateElement.h:
1953         * html/HTMLVideoElement.cpp:
1954         (WebCore::HTMLVideoElement::didMoveToNewDocument):
1955         * html/HTMLVideoElement.h:
1956         * html/ImageDocument.cpp:
1957         (WebCore::ImageDocumentElement::didMoveToNewDocument):
1958         * svg/SVGImageElement.cpp:
1959         (WebCore::SVGImageElement::didMoveToNewDocument):
1960         * svg/SVGImageElement.h:
1961         * svg/SVGSVGElement.cpp:
1962         (WebCore::SVGSVGElement::didMoveToNewDocument):
1963         * svg/SVGSVGElement.h:
1964
1965 2016-11-16  Jon Davis  <jond@apple.com>
1966
1967         Added Web App Manifest to the Feature Status page.
1968         https://bugs.webkit.org/show_bug.cgi?id=162675
1969         
1970         Reviewed by Timothy Hatcher.
1971
1972         * features.json:
1973
1974 2016-11-16  Chris Dumez  <cdumez@apple.com>
1975
1976         Use more references for Document::removeFocusedNodeOfSubtree()
1977         https://bugs.webkit.org/show_bug.cgi?id=164839
1978
1979         Reviewed by Andreas Kling.
1980
1981         Use more references for Document::removeFocusedNodeOfSubtree().
1982
1983         No new tests, no Web-exposed behavior change.
1984
1985         * dom/Document.cpp:
1986         (WebCore::isNodeInSubtree):
1987         (WebCore::Document::removeFocusedNodeOfSubtree):
1988         (WebCore::Document::nodeChildrenWillBeRemoved):
1989         (WebCore::Document::nodeWillBeRemoved):
1990         (WebCore::Document::removeFocusNavigationNodeOfSubtree):
1991         (WebCore::Document::removeFullScreenElementOfSubtree):
1992         * dom/Document.h:
1993         * dom/Element.cpp:
1994         (WebCore::Element::removeShadowRoot):
1995         * loader/FrameLoader.cpp:
1996         (WebCore::FrameLoader::clear):
1997
1998 2016-11-16  Brent Fulgham  <bfulgham@apple.com>
1999
2000         Clear track client when removing a track
2001         https://bugs.webkit.org/show_bug.cgi?id=164842
2002         <rdar://problem/29213621>
2003
2004         Reviewed by Eric Carlson.
2005
2006         Call 'clearClient' when removing a track from an HTMLMediaElement.
2007
2008         Test: media/track/audio-track-add-remove.html
2009               media/track/video-track-add-remove.html
2010
2011         * html/HTMLMediaElement.cpp:
2012         (WebCore::HTMLMediaElement::removeAudioTrack): Call 'clearClient'
2013         (WebCore::HTMLMediaElement::removeVideoTrack): Ditto.
2014
2015 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2016
2017         [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
2018         https://bugs.webkit.org/show_bug.cgi?id=164827
2019
2020         Reviewed by Ryosuke Niwa.
2021
2022         Use Settings.in. And intentionally do not use RuntimeEnabledFeatures.
2023         According to the pointer lock's issue[1], we should use Settings.
2024
2025         [1]: https://bugs.webkit.org/show_bug.cgi?id=163801
2026
2027         * Configurations/FeatureDefines.xcconfig:
2028         * dom/ScriptElement.cpp:
2029         (WebCore::ScriptElement::determineScriptType):
2030         * html/parser/HTMLPreloadScanner.cpp:
2031         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2032         * page/Settings.in:
2033         A bit unfortunate thing is that the setter is named `setEs6ModulesEnabled`
2034         if we use `es6ModulesEnabled` here.
2035
2036 2016-11-16  Chris Dumez  <cdumez@apple.com>
2037
2038         Unreviewed, remove outdated comment about using PassRefPtr.
2039
2040         * dom/ContainerNode.cpp:
2041         (WebCore::ContainerNode::parserAppendChild):
2042
2043 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2044
2045         slotchange event should bubble and dispatched once
2046         https://bugs.webkit.org/show_bug.cgi?id=164770
2047
2048         Reviewed by Antti Koivisto.
2049
2050         Updated our implementation of slotchange event to match the latest specification after:
2051         https://github.com/w3c/webcomponents/issues/571
2052         https://dom.spec.whatwg.org/#signal-a-slot-change
2053         The new behavior matches that of Google Chrome Canary.
2054
2055         In the latest specification, we no longer dispatch a separate event on ancestor slots.
2056         Instead, we fire a single slotchange event to which a new node is assigned or from which
2057         an existing assigned node is removed. This patch mostly removes the code that existed to
2058         locate ancestor slot elements, and makes the event bubble up by changing a single line in
2059         HTMLSlotElement::dispatchSlotChangeEvent.
2060
2061         Test: fast/shadow-dom/slotchange-event-bubbling.html
2062
2063         * dom/ShadowRoot.h:
2064         * dom/SlotAssignment.cpp:
2065         (WebCore::recursivelyFireSlotChangeEvent): Deleted.
2066         (WebCore::SlotAssignment::didChangeSlot): Removed ChangeType from the arguments since we
2067         no longer notify the ancestor slot elements.
2068         (WebCore::SlotAssignment::hostChildElementDidChange):
2069         * dom/SlotAssignment.h:
2070         (WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost):
2071         (WebCore::ShadowRoot::didChangeDefaultSlot):
2072         (WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute):
2073         (WebCore::ShadowRoot::innerSlotDidChange): Deleted.
2074         * html/HTMLDetailsElement.cpp:
2075         (WebCore::DetailsSlotAssignment::hostChildElementDidChange):
2076         * html/HTMLSlotElement.cpp:
2077         (WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Make slotchange event bubble.
2078
2079 2016-11-16  Alex Christensen  <achristensen@webkit.org>
2080
2081         REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out
2082         https://bugs.webkit.org/show_bug.cgi?id=163307
2083
2084         Reviewed by Alexey Proskuryakov.
2085
2086         * platform/URLParser.cpp:
2087         Removed some unnecessary and redundant assertions in iterators, which are inside inner loops.
2088         (WebCore::URLParser::parsedDataView):
2089         (WebCore::URLParser::parse):
2090         Add a parsedDataView that just returns a UChar instead of a StringView for 1-length views.
2091         This speeds up debug builds considerably, which spent most of the time parsing the path
2092         making and destroying these 1-length StringViews.  It can't hurt release builds.
2093         * platform/URLParser.h:
2094
2095 2016-11-16  Chris Dumez  <cdumez@apple.com>
2096
2097         Micro-optimize ContainerNode::removeBetween()
2098         https://bugs.webkit.org/show_bug.cgi?id=164832
2099
2100         Reviewed by Sam Weinig.
2101
2102         Micro-optimize ContainerNode::removeBetween() by updating pointers only
2103         when strictly needed and reducing branching.
2104
2105         No new tests, no Web-exposed behavior change.
2106
2107         * dom/ContainerNode.cpp:
2108         (WebCore::ContainerNode::removeBetween):
2109
2110 2016-11-16  Chris Dumez  <cdumez@apple.com>
2111
2112         Micro-optimize AtomicHTMLToken::initializeAttributes()
2113         https://bugs.webkit.org/show_bug.cgi?id=164826
2114
2115         Reviewed by Sam Weinig.
2116
2117         Micro-optimize AtomicHTMLToken::initializeAttributes():
2118         - Use uncheckedAppend() instead of append() since we reserve capacity
2119           before the loop.
2120         - Use a more efficient findAttribute() that only checks the local names
2121           since this function only adds attributes that have to namespace or
2122           prefix.
2123
2124         No new tests, no Web-exposed behavior change.
2125
2126         * html/parser/AtomicHTMLToken.h:
2127         (WebCore::hasAttribute):
2128         (WebCore::AtomicHTMLToken::initializeAttributes):
2129
2130 2016-11-16  Beth Dakin  <bdakin@apple.com>
2131
2132         Another build fix.
2133
2134         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2135
2136 2016-11-16  Beth Dakin  <bdakin@apple.com>
2137
2138         Attempted build fix.
2139
2140         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2141         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2142         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2143         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2144         (WebCore::WebPlaybackSessionInterfaceMac::beginScrubbing):
2145         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2146         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2147         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2148         (WebCore::WebPlaybackSessionInterfaceMac::ensureControlsManager):
2149
2150 2016-11-16  Brady Eidson  <beidson@apple.com>
2151
2152         Re-indent some old headers.
2153
2154         Rubberstamped by Alex Christensen 
2155
2156         No new tests (No behavior change).
2157
2158         (Also #pragma once a few of them)
2159
2160         * loader/DocumentLoader.h:
2161         * loader/FrameLoaderClient.h:
2162         * page/Frame.h:
2163         * page/FrameTree.h:
2164         * page/PageGroup.h:
2165         * platform/Cursor.h:
2166
2167 2016-11-16  Darin Adler  <darin@apple.com>
2168
2169         REGRESSION (r208672): Crash in com.apple.WebCore: WebCore::DatabaseContext::stopDatabases + 34
2170         https://bugs.webkit.org/show_bug.cgi?id=164820
2171
2172         Reviewed by Sam Weinig.
2173
2174         Crash seen in existing regression tests; reliably reproducible in some test configurations.
2175
2176         * Modules/webdatabase/DatabaseContext.cpp:
2177         (WebCore::DatabaseContext::contextDestroyed): Call through to base class before calling
2178         stopDatabases, since that might cause this object to be deallocated.
2179         (WebCore::DatabaseContext::stopDatabases): Be sure not to clear the possibly-last reference
2180         to this database context until after all code that accesses data members, since it might
2181         cause this object to be deallocated.
2182
2183 2016-11-16  Beth Dakin  <bdakin@apple.com>
2184
2185         Implement WebPlaybackControlsManager
2186         https://bugs.webkit.org/show_bug.cgi?id=164789
2187         -and corresponding-
2188         rdar://problem/29275082
2189
2190         Reviewed by Dan Bernstein.
2191
2192         * platform/mac/WebPlaybackControlsManager.h:
2193         * platform/mac/WebPlaybackControlsManager.mm:
2194         (-[WebPlaybackControlsManager dealloc]):
2195         (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
2196         (-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
2197         (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
2198         (-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
2199         (-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
2200         (-[WebPlaybackControlsManager endFunctionBarScrubbing]):
2201         (-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]):
2202         (-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]):
2203         (-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]):
2204         (-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]):
2205         (-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]):
2206         (-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]):
2207         (-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]):
2208         (-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]):
2209         (mediaSelectionOptions):
2210         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
2211         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
2212         (-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]):
2213         (-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]):
2214         (-[WebPlaybackControlsManager togglePlayback]):
2215         (-[WebPlaybackControlsManager setPlaying:]):
2216         (-[WebPlaybackControlsManager isPlaying]):
2217         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2218         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2219         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2220         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2221         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2222         (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager):
2223
2224 2016-11-16  Jiewen Tan  <jiewen_tan@apple.com>
2225
2226         Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey
2227         https://bugs.webkit.org/show_bug.cgi?id=164815
2228         <rdar://problem/29281660>
2229
2230         Reviewed by Brent Fulgham.
2231
2232         Tests: crypto/subtle/aes-import-jwk-key-export-jwk-key.html
2233                crypto/subtle/aes-import-jwk-key-export-raw-key.html
2234                crypto/subtle/aes-import-raw-key-export-jwk-key.html
2235                crypto/subtle/aes-import-raw-key-export-raw-key.html
2236                crypto/subtle/hmac-import-jwk-key-export-jwk-key.html
2237                crypto/subtle/hmac-import-jwk-key-export-raw-key.html
2238                crypto/subtle/hmac-import-raw-key-export-jwk-key.html
2239                crypto/subtle/hmac-import-raw-key-export-raw-key.html
2240                crypto/subtle/rsa-import-jwk-key-export-jwk-key-private.html
2241                crypto/subtle/rsa-import-jwk-key-export-jwk-key-public.html
2242
2243         * crypto/mac/CryptoKeyRSAMac.cpp:
2244         (WebCore::CryptoKeyRSA::create):
2245         Add a comment.
2246
2247 2016-11-16  Antti Koivisto  <antti@apple.com>
2248
2249         Remove getMutableCachedPseudoStyle
2250         https://bugs.webkit.org/show_bug.cgi?id=164819
2251
2252         Reviewed by Zalan Bujtas.
2253
2254         It is only used by styleForFirstLetter.
2255
2256         * rendering/RenderBlock.cpp:
2257         (WebCore::styleForFirstLetter):
2258
2259             Clone the original style before mutations.
2260
2261         (WebCore::RenderBlock::updateFirstLetterStyle):
2262         (WebCore::RenderBlock::createFirstLetterRenderer):
2263
2264             Since we have a clone already just move it in place.
2265
2266         * rendering/RenderElement.cpp:
2267         (WebCore::RenderElement::getMutableCachedPseudoStyle): Deleted.
2268         * rendering/RenderElement.h:
2269
2270 2016-11-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2271
2272         [Readable Streams API] Implement ReadableByteStreamController close()
2273         https://bugs.webkit.org/show_bug.cgi?id=164413
2274
2275         Reviewed by Darin Adler.
2276
2277         Implemented close() method of ReadableByteStreamController.
2278
2279         Updated test expectations for close() tests and added tests
2280         to ensure errors are thrown in various cases defined by spec.
2281
2282         * Modules/streams/ReadableByteStreamController.js:
2283         (close): Added.
2284         * Modules/streams/ReadableByteStreamInternals.js:
2285         (readableByteStreamControllerClose): Added.
2286         * bindings/js/WebCoreBuiltinNames.h: Added bytesFilled.
2287
2288 2016-11-16  Philippe Normand  <pnormand@igalia.com>
2289
2290         [GStreamer][GL] build broken when using gst-plugins-bad from git
2291         https://bugs.webkit.org/show_bug.cgi?id=164776
2292
2293         Reviewed by Xabier Rodriguez-Calvar.
2294
2295         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2296         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): The
2297         GStreamer GL context GType was renamed, add an ifdef taking this
2298         into account.
2299
2300 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2301
2302         [ES6] Integrate ES6 Modules into WebCore
2303         https://bugs.webkit.org/show_bug.cgi?id=148897
2304
2305         Reviewed by Ryosuke Niwa.
2306
2307         This patch introduces ES6 Modules into WebCore. We integrate JSC's JSModuleLoader into WebCore.
2308         JSC constructs the module loader pipeline by the chains of the promises. To handle this,
2309         the following components are added.
2310
2311             1. CachedModuleScript
2312
2313                 CachedModuleScript wraps the promise based JSModuleLoader pipeline and offers
2314                 similar APIs to CachedScript. ScriptElement and PendingScript interact with
2315                 CachedModuleScript when the script tag is the module tag instead of CachedScript.
2316                 ScriptElement and PendingScript will receive the notification from
2317                 CachedModuleScript by implementing CachedModuleScriptClient.
2318
2319             2. ScriptModuleLoader
2320
2321                 This is the module loader instantiated per document. It manages fetching and
2322                 offers the callbacks for the JSC's JSModuleLoader implementation. ScriptModuleLoader
2323                 will fetch the resource by creating CachedModuleScriptLoader per resource. ScriptModuleLoader
2324                 will receive the notification by implementing CachedModuleScriptLoaderClient. When the
2325                 resource is fetched, the module loader will drive the promise resolve/reject chain.
2326
2327             3. CachedModuleScriptLoader
2328
2329                 This fetches the resource by using CachedScript. Using CachedScript means that it
2330                 automatically reports the resource to the inspector. CachedModuleScriptLoader notify to
2331                 ScriptModuleLoader when the resource is fetched.
2332
2333         One tricky point is that the fetch requests issued from one module-graph should share the same
2334         nonce, crossorigin attributes etc.
2335
2336             Here, we wrote the module graph like `A -> B (A depends on B)`.
2337
2338             <script tag> -> A -> B -> C -> D
2339
2340         When fetching A, B, C, and D modules, we need to set the same nonce, crossorigin etc. configuration
2341         derived from the original script tag. So per module-graph information should be shared throughout
2342         the module loader pipeline. To do so, JSC's module loader implementation can take the value called
2343         `initiator`. Since the loader will propagate & share this `initiator` throughout the pipeline,
2344         we can transfer and share some metadata. Currently, we pass the JSWrapper of the script tag as the
2345         initiator. Each fetch request is created by using this initiator script element.
2346
2347         More integration into the inspector should be done in the subsequent patch.
2348
2349         * CMakeLists.txt:
2350         * WebCore.xcodeproj/project.pbxproj:
2351         * bindings/js/CachedModuleScript.cpp: Added.
2352         CachedModuleScript offers similar interface to CachedScript to make ScriptElement things easier. It encapsulates the
2353         detail of the JSC JSModuleLoader that this module loader is driven by the chain of the promises. CachedModuleScript's
2354         callbacks are called from the promise's handlers configured in ScriptController::loadModuleScript.
2355         (WebCore::CachedModuleScript::create):
2356         (WebCore::CachedModuleScript::CachedModuleScript):
2357         (WebCore::CachedModuleScript::load):
2358         (WebCore::CachedModuleScript::notifyLoadCompleted):
2359         (WebCore::CachedModuleScript::notifyLoadFailed):
2360         (WebCore::CachedModuleScript::notifyLoadWasCanceled):
2361         (WebCore::CachedModuleScript::notifyClientFinished):
2362         (WebCore::CachedModuleScript::addClient):
2363         (WebCore::CachedModuleScript::removeClient):
2364         * bindings/js/CachedModuleScript.h: Added.
2365         (WebCore::CachedModuleScript::moduleKey):
2366         (WebCore::CachedModuleScript::error):
2367         (WebCore::CachedModuleScript::wasCanceled):
2368         (WebCore::CachedModuleScript::isLoaded):
2369         (WebCore::CachedModuleScript::nonce):
2370         (WebCore::CachedModuleScript::crossOriginMode):
2371         Save nonce and crossorigin attributes when we start ScriptElement::prepareScript.
2372         * bindings/js/CachedModuleScriptClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
2373         (WebCore::CachedModuleScriptClient::~CachedModuleScriptClient):
2374         * bindings/js/CachedModuleScriptLoader.cpp: Added.
2375         CachedModuleScriptLoader is responsible to fetching the resource for the module script. It uses propagated `initiator`
2376         to create the request. This initiator is the JS wrapper of the script element issuing this fetching request. The name
2377         `initiator` is derived from the request.setInitiator(). Once the resource is fetched, the fetcher will notify to the
2378         client. Currently, ScriptModuleLoader implements this client interface.
2379         (WebCore::CachedModuleScriptLoader::create):
2380         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
2381         (WebCore::CachedModuleScriptLoader::~CachedModuleScriptLoader):
2382         (WebCore::CachedModuleScriptLoader::load):
2383         Create the request. We call ScriptElement::requestCachedScript to initiate a new fetching request. At that time,
2384         nonce and crossorigin (and charset) attributes of this element are applied to the new request.
2385         (WebCore::CachedModuleScriptLoader::notifyFinished):
2386         * bindings/js/CachedModuleScriptLoader.h: Copied from Source/WebCore/bindings/js/ScriptModuleLoader.h.
2387         * bindings/js/CachedModuleScriptLoaderClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
2388         (WebCore::CachedModuleScriptLoaderClient::~CachedModuleScriptLoaderClient):
2389         * bindings/js/CachedScriptSourceProvider.h:
2390         (WebCore::CachedScriptSourceProvider::create):
2391         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
2392         (WebCore::makeSource):
2393         * bindings/js/JSBindingsAllInOne.cpp:
2394         * bindings/js/JSDOMBinding.cpp:
2395         (WebCore::retrieveErrorMessage):
2396         (WebCore::reportException):
2397         * bindings/js/JSDOMBinding.h:
2398         * bindings/js/JSMainThreadExecState.h:
2399         (WebCore::JSMainThreadExecState::loadModule):
2400         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
2401         * bindings/js/ScriptController.cpp:
2402         (WebCore::ScriptController::evaluateInWorld):
2403         (WebCore::ScriptController::loadModuleScriptInWorld):
2404         (WebCore::ScriptController::loadModuleScript):
2405         This just performs loading and not executing the module graph. Once the module graph is loaded, it is notified to
2406         the given CachedModuleScript.
2407         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2408         (WebCore::ScriptController::linkAndEvaluateModuleScript):
2409         This executes the linking and evaluation of the already instantiated module graph. After loading the module graph,
2410         we call this function for the module to evaluate it. This is called from ScriptElement::executeModuleScript.
2411         (WebCore::ScriptController::evaluateModule):
2412         Every time we evaluate the module, the ScriptModuleLoader::evaluate hook is called. So the loader calls this function
2413         to actually evaluate the module.
2414         (WebCore::jsValueToModuleKey):
2415         (WebCore::ScriptController::setupModuleScriptHandlers):
2416         The JSC's module loader is driven by the chain of the promise. So here, we convert this to CachedModuleScript /
2417         CachedModuleScriptClient style and encapsulate the details. This encapsulation makes CachedModuleScript similar
2418         to CachedScript and it makes things simple in the rest of WebCore. If the propagated error is already reported
2419         to the inspector, we receive moduleLoaderAlreadyReportedErrorSymbol as the error value. So at that case, we
2420         don't report it twice. If the rejection is caused due to the canceled fetching, moduleLoaderFetchingIsCanceledSymbol
2421         appears as the error value. In that case, we will call CachedModuleScript::notifyLoadWasCanceled.
2422         (WebCore::ScriptController::executeScript):
2423         * bindings/js/ScriptController.h:
2424         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol):
2425         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol):
2426         * bindings/js/ScriptModuleLoader.cpp:
2427         We use DeferredWrapper to resolve promises used for the module pipeline. Thus, once the active DOM objects are
2428         suspended, the module loader propagation stops.
2429         (WebCore::ScriptModuleLoader::~ScriptModuleLoader):
2430         Clear the clients of the fetchers issued from this loader.
2431         (WebCore::isRootModule):
2432         (WebCore::ScriptModuleLoader::resolve):
2433         Resolve the module specifier (that is written in `import from "XXX"`) to the unique module key. We use URL
2434         string as module key. The edge case is that the module is inlined one. In that case, we don't have any URL
2435         for that. Instead of URL, we use symbol at that time.
2436         (WebCore::ScriptModuleLoader::fetch):
2437         Start fetching for the requested module. It returns the promise that is resolved when the fetching is done.
2438         The loader creates the fetcher, and the fetcher start loading the resource. Once the fetcher loads the resource,
2439         it notify to the loader through CachedModuleScriptLoaderClient interface. Since we pass the original script
2440         element as the `initiator` here, the fetcher can use this initiator to create the request. While the result of
2441         CachedResource has 3 variations (loaded, canceled, error occurred), Promise only tells us whether it is resolved
2442         or rejected. When CachedModuleScript gets the result from the promise chain, it needs to know which the result is.
2443         To transfer the canceled information, we reject the promise with the special symbol `moduleLoaderAlreadyReportedErrorSymbol`.
2444         This offers the way to distinguish the canceled error from the other errors.
2445         (WebCore::ScriptModuleLoader::evaluate):
2446         This is the hook function that is called when JSC's JSModuleLoader attempts to execute each module.
2447         (WebCore::ScriptModuleLoader::notifyFinished):
2448         This function is called when the fetcher completes. We will resolve the promise with the result of the fetching.
2449         The module loader pipeline is constructed as a chain of promises.
2450         Rejecting a promise when some error occurs is important because the execution flow of
2451         the promise chain is driven by "rejected" or "fulfilled" events.
2452         If the promise is not rejected while error occurs, reject handler won't be executed
2453         and all the subsequent promise chain will wait the result forever.
2454         As a result, even if the error is already reported to the inspector elsewhere,
2455         it should be propagated in the pipeline. For example, the error of loading
2456         CachedResource is already reported to the inspector by the loader. But we still need
2457         to reject the promise to propagate this error to the script element.
2458         At that time, we don't want to report the same error twice. When we propagate the error
2459         that is already reported to the inspector, we throw moduleLoaderAlreadyReportedErrorSymbol
2460         symbol instead. By comparing the thrown error with this symbol, we can distinguish errors raised
2461         when checking syntax of a module script from errors reported already.
2462         In the reject handler of the promise, we only report a error that is not this symbol.
2463         And mime type checking is done here since the module script always require this check.
2464         * bindings/js/ScriptModuleLoader.h:
2465         (WebCore::ScriptModuleLoader::document): Deleted.
2466         * bindings/js/ScriptSourceCode.h:
2467         (WebCore::ScriptSourceCode::ScriptSourceCode):
2468         * dom/CurrentScriptIncrementer.h:
2469         (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
2470         * dom/LoadableClassicScript.cpp:
2471         (WebCore::LoadableClassicScript::error):
2472         (WebCore::LoadableClassicScript::execute):
2473         (WebCore::LoadableClassicScript::wasErrored): Deleted.
2474         * dom/LoadableClassicScript.h:
2475         * dom/LoadableModuleScript.cpp: Copied from Source/WebCore/dom/LoadableScript.h.
2476         This is the derived class from LoadableScript. It is used for the script module graphs.
2477         (WebCore::LoadableModuleScript::create):
2478         (WebCore::LoadableModuleScript::LoadableModuleScript):
2479         (WebCore::LoadableModuleScript::~LoadableModuleScript):
2480         (WebCore::LoadableModuleScript::isLoaded):
2481         (WebCore::LoadableModuleScript::error):
2482         (WebCore::LoadableModuleScript::wasCanceled):
2483         (WebCore::LoadableModuleScript::notifyFinished):
2484         (WebCore::LoadableModuleScript::execute):
2485         * dom/LoadableModuleScript.h: Copied from Source/WebCore/dom/LoadableScript.h.
2486         (isType):
2487         * dom/LoadableScript.h:
2488         (WebCore::LoadableScript::isModuleScript):
2489         (WebCore::LoadableScript::isModuleGraph): Deleted.
2490         * dom/PendingScript.cpp:
2491         (WebCore::PendingScript::error):
2492         (WebCore::PendingScript::wasErrored): Deleted.
2493         * dom/PendingScript.h:
2494         * dom/ScriptElement.cpp:
2495         (WebCore::ScriptElement::ScriptElement):
2496         (WebCore::ScriptElement::determineScriptType):
2497         (WebCore::ScriptElement::prepareScript):
2498         prepareScript is aligned to whatwg spec: the last sequence to setup flags has one-on-one correspondence to
2499         the spec now. And prepareScript recognizes the type="module" case and call the requestModuleScript to setup
2500         the CachedModuleScript.
2501         (WebCore::ScriptElement::requestClassicScript):
2502         (WebCore::ScriptElement::requestModuleScript):
2503         We use the nonce and crossorigin attributes at the time of preparing the script tag. To do so, we store the
2504         above values in CachedModuleScript.
2505         Since inlined module scripts does not have "src" attribute, it is also affected by Content Security Policy's
2506         inline script rules.
2507         (WebCore::ScriptElement::requestScriptWithCacheForModuleScript):
2508         The module loader will construct the fetching request by calling this function. This should be here since we
2509         would like to set this Element to the initiator of the request. And nonce and crossorigin attributes of this
2510         script tag will be used.
2511         (WebCore::ScriptElement::requestScriptWithCache):
2512         (WebCore::ScriptElement::executeScript):
2513         (WebCore::ScriptElement::executeModuleScript):
2514         The entry point to execute the module graph. Since the module graph is beyond the multiple CachedScript code,
2515         we have the different entry point from ScriptElement::executeScript.
2516         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
2517         (WebCore::ScriptElement::executeScriptForScriptRunner):
2518         * dom/ScriptElement.h:
2519         (WebCore::ScriptElement::scriptType):
2520         * html/parser/CSSPreloadScanner.cpp:
2521         (WebCore::CSSPreloadScanner::emitRule):
2522         * html/parser/HTMLPreloadScanner.cpp:
2523         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
2524         According to the spec, the module tag ignores the "charset" attribute as the same to the worker's
2525         importScript. But WebKit supports the "charset" for importScript intentionally. So to be consistent,
2526         even for the module tags, we handle the "charset" attribute. We explicitly note about it in the preloader.
2527         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2528         * html/parser/HTMLResourcePreloader.cpp:
2529         (WebCore::PreloadRequest::resourceRequest):
2530         * html/parser/HTMLResourcePreloader.h:
2531         (WebCore::PreloadRequest::PreloadRequest):
2532         * html/parser/HTMLScriptRunner.h:
2533         * loader/cache/CachedResourceRequest.cpp:
2534         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
2535         * xml/parser/XMLDocumentParser.cpp:
2536         (WebCore::XMLDocumentParser::notifyFinished):
2537
2538 2016-11-15  Alejandro G. Castro  <alex@igalia.com>
2539
2540         Warning added in r208542
2541         https://bugs.webkit.org/show_bug.cgi?id=164636
2542
2543         Reviewed by Eric Carlson.
2544
2545         Deleted the copy constructor, we now explicitly copy the object in
2546         the clone method.
2547
2548         * platform/mediastream/MediaStreamTrackPrivate.cpp: Delete the
2549         copy constructor.
2550         (WebCore::MediaStreamTrackPrivate::clone): Copy the relevant
2551         information for the clone operation in the API.
2552         * platform/mediastream/MediaStreamTrackPrivate.h: Delete the copy
2553         constructor.
2554
2555 2016-11-15  Ryosuke Niwa  <rniwa@webkit.org>
2556
2557         Add more assertions to ElementQueue diagnose a bug
2558         https://bugs.webkit.org/show_bug.cgi?id=164814
2559
2560         Reviewed by Yusuke Suzuki.
2561
2562         Add more assertions to check the sanity of the element queue.
2563         Also made them all release assertions so that we can catch them better.
2564
2565         * dom/CustomElementReactionQueue.cpp:
2566         (WebCore::CustomElementReactionStack::ElementQueue::add):
2567         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
2568
2569 2016-11-15  Chris Dumez  <cdumez@apple.com>
2570
2571         Simplify Element::stripScriptingAttributes()
2572         https://bugs.webkit.org/show_bug.cgi?id=164785
2573
2574         Reviewed by Ryosuke Niwa.
2575
2576         Simplify Element::stripScriptingAttributes() by leveraging
2577         Vector::removeAllMatching().
2578
2579         No new tests, no Web-exposed behavior change.
2580
2581         * dom/Element.cpp:
2582         (WebCore::Element::stripScriptingAttributes):
2583
2584 2016-11-15  Jon Lee  <jonlee@apple.com>
2585
2586         Report active video and audio capture devices separately
2587         https://bugs.webkit.org/show_bug.cgi?id=164769
2588
2589         Reviewed by Eric Carlson.
2590
2591         For UI purposes, separate the notion of any active capture device to
2592         an active audio and video capture device.
2593
2594         * page/MediaProducer.h: Replace HasActiveMediaCaptureDevice with
2595         HasActiveAudioCaptureDevice and HasActiveVideoCaptureDevice.
2596
2597         * Modules/mediastream/MediaStream.cpp:
2598         (WebCore::MediaStream::mediaState): Update the logic for mediaState().
2599         Since it is possible to arbitrarily add tracks from various sources,
2600         check specifically for a local AV source (meaning a capture device) that
2601         is producing data.
2602         * platform/mediastream/MediaStreamPrivate.cpp:
2603         (WebCore::MediaStreamPrivate::hasLocalVideoSource): Iterate over the tracks
2604         and look for video sources that are not remote.
2605         (WebCore::MediaStreamPrivate::hasLocalAudioSource): Ditto for audio.
2606         * platform/mediastream/MediaStreamPrivate.h:
2607         * testing/Internals.cpp:
2608         (WebCore::Internals::pageMediaState): Update internals reporting.
2609
2610 2016-11-15  Chris Dumez  <cdumez@apple.com>
2611
2612         Avoid copying vector of attributes as much as possible in the HTML parser
2613         https://bugs.webkit.org/show_bug.cgi?id=164778
2614
2615         Reviewed by Ryosuke Niwa.
2616
2617         Avoid copying vector of attributes as much as possible in the HTML parser by moving
2618         AtomicHTMLToken around and making it obvious it is safe to move its attributes
2619         vector as well.
2620
2621         No new tests, no Web-exposed behavior change.
2622
2623         * html/parser/AtomicHTMLToken.h:
2624         (WebCore::AtomicHTMLToken::AtomicHTMLToken):
2625         (WebCore::findAttribute):
2626         * html/parser/HTMLConstructionSite.cpp:
2627         (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML):
2628         (WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
2629         (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody):
2630         (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody):
2631         (WebCore::HTMLConstructionSite::insertDoctype):
2632         (WebCore::HTMLConstructionSite::insertComment):
2633         (WebCore::HTMLConstructionSite::insertCommentOnDocument):
2634         (WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement):
2635         (WebCore::HTMLConstructionSite::insertHTMLHeadElement):
2636         (WebCore::HTMLConstructionSite::insertHTMLBodyElement):
2637         (WebCore::HTMLConstructionSite::insertHTMLFormElement):
2638         (WebCore::HTMLConstructionSite::insertHTMLElement):
2639         (WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
2640         (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
2641         (WebCore::HTMLConstructionSite::insertFormattingElement):
2642         (WebCore::HTMLConstructionSite::insertScriptElement):
2643         (WebCore::HTMLConstructionSite::insertForeignElement):
2644         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
2645         (WebCore::HTMLConstructionSite::createElementFromSavedToken):
2646         * html/parser/HTMLConstructionSite.h:
2647         * html/parser/HTMLDocumentParser.cpp:
2648         (WebCore::HTMLDocumentParser::constructTreeFromHTMLToken):
2649         * html/parser/HTMLStackItem.h:
2650         (WebCore::HTMLStackItem::HTMLStackItem):
2651         (WebCore::HTMLStackItem::create):
2652         * html/parser/HTMLTreeBuilder.cpp:
2653         (WebCore::CustomElementConstructionData::CustomElementConstructionData):
2654         (WebCore::HTMLTreeBuilder::constructTree):
2655         (WebCore::HTMLTreeBuilder::processToken):
2656         (WebCore::HTMLTreeBuilder::processDoctypeToken):
2657         (WebCore::HTMLTreeBuilder::processFakeStartTag):
2658         (WebCore::HTMLTreeBuilder::processFakeEndTag):
2659         (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
2660         (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag):
2661         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
2662         (WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
2663         (WebCore::HTMLTreeBuilder::processTemplateStartTag):
2664         (WebCore::HTMLTreeBuilder::processTemplateEndTag):
2665         (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
2666         (WebCore::HTMLTreeBuilder::processStartTagForInTable):
2667         (WebCore::HTMLTreeBuilder::processStartTag):
2668         (WebCore::HTMLTreeBuilder::processHtmlStartTagForInBody):
2669         (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
2670         (WebCore::HTMLTreeBuilder::processAnyOtherEndTagForInBody):
2671         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
2672         (WebCore::HTMLTreeBuilder::processEndTagForInTableBody):
2673         (WebCore::HTMLTreeBuilder::processEndTagForInRow):
2674         (WebCore::HTMLTreeBuilder::processEndTagForInCell):
2675         (WebCore::HTMLTreeBuilder::processEndTagForInBody):
2676         (WebCore::HTMLTreeBuilder::processEndTagForInTable):
2677         (WebCore::HTMLTreeBuilder::processEndTag):
2678         (WebCore::HTMLTreeBuilder::processComment):
2679         (WebCore::HTMLTreeBuilder::processCharacter):
2680         (WebCore::HTMLTreeBuilder::processEndOfFile):
2681         (WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
2682         (WebCore::HTMLTreeBuilder::defaultForBeforeHead):
2683         (WebCore::HTMLTreeBuilder::defaultForInHead):
2684         (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
2685         (WebCore::HTMLTreeBuilder::defaultForAfterHead):
2686         (WebCore::HTMLTreeBuilder::processStartTagForInHead):
2687         (WebCore::HTMLTreeBuilder::processGenericRCDATAStartTag):
2688         (WebCore::HTMLTreeBuilder::processGenericRawTextStartTag):
2689         (WebCore::HTMLTreeBuilder::processScriptStartTag):
2690         (WebCore::HTMLTreeBuilder::shouldProcessTokenInForeignContent):
2691         (WebCore::hasAttribute):
2692         (WebCore::HTMLTreeBuilder::processTokenInForeignContent):
2693         (WebCore::HTMLTreeBuilder::parseError):
2694         * html/parser/HTMLTreeBuilder.h:
2695         * html/parser/TextDocumentParser.cpp:
2696         (WebCore::TextDocumentParser::insertFakePreElement):
2697
2698 2016-11-15  Alex Christensen  <achristensen@webkit.org>
2699
2700         Fix iOS API test assertion after r208534
2701         https://bugs.webkit.org/show_bug.cgi?id=164751
2702
2703         Reviewed by Geoffrey Garen.
2704
2705         This removes a firing assertion in the WebKit1.AudioSessionCategoryIOS API test on the iOS simulator.
2706
2707         * platform/MemoryPressureHandler.h:
2708         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
2709         This assertion is no longer valid because we are using m_installed to determine if m_lowMemoryHandler xor m_releaseMemoryBlock is set,
2710         and we should be setting both right now on iOS and they are both useful in freeing memory. These should be united.
2711
2712 2016-11-15  Brady Eidson  <beidson@apple.com>
2713
2714         IndexedDB 2.0: Key collation during SQLite lookups is insanely slow.
2715         https://bugs.webkit.org/show_bug.cgi?id=164754
2716
2717         Reviewed by Alex Christensen.
2718
2719         No new tests (Covered by *all* existing tests, and unskips a previously-too-slow test)
2720
2721         The new serialization format is straight forward enough to get back with minimal documentation
2722         in a comment with the code itself being the rest of the documentation.
2723         
2724         It handles all current IDB key types and leaves room for future key types.
2725
2726         * Modules/indexeddb/IDBKeyData.cpp:
2727         (WebCore::IDBKeyData::setBinaryValue):
2728         * Modules/indexeddb/IDBKeyData.h:
2729         (WebCore::IDBKeyData::binary):
2730         
2731         * Modules/indexeddb/server/IDBSerialization.cpp:
2732         (WebCore::serializedTypeForKeyType):
2733         (WebCore::writeLittleEndian):
2734         (WebCore::readLittleEndian):
2735         (WebCore::writeDouble):
2736         (WebCore::readDouble):
2737         (WebCore::encodeKey):
2738         (WebCore::serializeIDBKeyData):
2739         (WebCore::decodeKey):
2740         (WebCore::deserializeIDBKeyData):
2741         * Modules/indexeddb/server/IDBSerialization.h:
2742         
2743         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2744         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey): Verify that Type == Invalid 
2745           keys don't get into the database. This was happening before and the previous serialization
2746           supported it, but there's clearly no point in supporting it with the new serialization.
2747
2748 2016-11-15  Brent Fulgham  <bfulgham@apple.com>
2749
2750         Ensure sufficient buffer for worst-case URL encoding
2751         https://bugs.webkit.org/show_bug.cgi?id=164794
2752         <rdar://problem/5905510>
2753
2754         Reviewed by David Kilzer.
2755
2756         Slightly increase the default allocation size for URL parsing to account for
2757         the worst-case parsing case. Under these assumptions, we might need three times
2758         the byte length of the URL, plus nine bytes for fix-up characters.
2759
2760         In short, increase the default buffer size by 9 bytes.
2761
2762         No new tests. No change in behavior.
2763
2764         * platform/URL.cpp:
2765         (WebCore::URL::parse): Slightly increase the default buffer size.
2766
2767 2016-11-15  Joseph Pecoraro  <pecoraro@apple.com>
2768
2769         Web Inspector: Remove unused and untested Page.setTouchEmulationEnabled command
2770         https://bugs.webkit.org/show_bug.cgi?id=164793
2771
2772         Reviewed by Matt Baker.
2773
2774         * inspector/InspectorPageAgent.cpp:
2775         (WebCore::InspectorPageAgent::willDestroyFrontendAndBackend):
2776         (WebCore::InspectorPageAgent::updateTouchEventEmulationInPage): Deleted.
2777         (WebCore::InspectorPageAgent::setTouchEmulationEnabled): Deleted.
2778         * inspector/InspectorPageAgent.h:
2779
2780 2016-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2781
2782         Unreviewed, quick fix for r208751
2783
2784         * bindings/js/JSSubtleCryptoCustom.cpp:
2785         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
2786
2787 2016-11-15  Chris Dumez  <cdumez@apple.com>
2788
2789         Unreviewed, fix build after r208710.
2790
2791         Inline functions should not be marked as WEBCORE_EXPORT.
2792
2793         * dom/QualifiedName.h:
2794
2795 2016-11-15  Brent Fulgham  <bfulgham@apple.com>
2796
2797         strncpy may leave unterminated string in WebCore::URL::init
2798         https://bugs.webkit.org/show_bug.cgi?id=74473
2799         <rdar://problem/10576626>
2800
2801         Reviewed by David Kilzer.
2802
2803         Reviving an old patch by David Kilzer! This should have been integrated years ago.
2804
2805         No new tests. No change in behavior.
2806
2807         * platform/URL.cpp:
2808         (WebCore::URL::init): Make sure we always enter 'parse' with a
2809         null-terminated string.
2810
2811 2016-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2812
2813         Followup patch for r208737
2814
2815         Reviewed by Yusuke Suzuki.
2816
2817         * bindings/js/JSSubtleCryptoCustom.cpp:
2818         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
2819
2820 2016-11-14  Simon Fraser  <simon.fraser@apple.com>
2821
2822         [iOS WK2] Implement support for visual viewports
2823         https://bugs.webkit.org/show_bug.cgi?id=164765
2824
2825         Reviewed by Tim Horton.
2826
2827         Adopt the visual viewport scrolling model in iOS WK2.
2828
2829         This is more complex than the Mac implementation for two primary reasons. First,
2830         WKWebView needs to to able to control the rectangle used for fixed position layout
2831         to get the correct behavior when zooming all the way out, and because iOS displays
2832         pages scaled down, exposing document overflow such that the layout viewport rectangle
2833         has to get larger than the initial containing block size (which does not happen on Mac).
2834
2835         This is achieved by pushing a "layoutViewportOverrideRect" down onto FrameView, in
2836         a similar way to the customFixedPositionRect that's used now. We share that name
2837         for now in code that is agnostic to its use (e.g. VisibleContentRectUpdateInfo).
2838
2839         I tried so hard to write tests, but ran into various problems (webkit.org/b/164762,
2840         webkit.org/b/164764). Will add tests via webkit.org/b/164764.
2841
2842         * page/FrameView.cpp:
2843         (WebCore::FrameView::fixedScrollableAreaBoundsInflatedForScrolling): layoutViewportOrigin()
2844         was removed.
2845         (WebCore::FrameView::setBaseLayoutViewportOrigin): Rename with "base" to make it clearer that
2846         it can be overridden.
2847         (WebCore::FrameView::setLayoutViewportOverrideRect):
2848         (WebCore::FrameView::baseLayoutViewportSize): Renamed.
2849         (WebCore::FrameView::updateLayoutViewport): Logging.
2850         (WebCore::FrameView::layoutViewportRect):
2851         (WebCore::FrameView::scrollPositionForFixedPosition):
2852         (WebCore::FrameView::unscaledMaximumScrollPosition): During page transitions on iOS, it
2853         was possible for unscaledDocumentRect to be empty, but visibleSize() to be non-empty, leading
2854         to odd negative max scroll offsets, so clamp to 0,0.
2855         (WebCore::FrameView::setLayoutViewportOrigin): Deleted.
2856         * page/FrameView.h:
2857         * page/scrolling/AsyncScrollingCoordinator.cpp:
2858         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState): scrollPositionForFixedPosition() already does the
2859         visualViewportEnabled() check.
2860         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2861         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
2862         * platform/graphics/FloatSize.cpp:
2863         (WebCore::FloatSize::constrainedBetween): Added for consistency with the other geometry types.
2864         * platform/graphics/FloatSize.h:
2865         * platform/graphics/LayoutSize.cpp:
2866         (WebCore::LayoutSize::constrainedBetween): Ditto.
2867         * platform/graphics/LayoutSize.h:
2868         * rendering/RenderView.cpp:
2869         (WebCore::RenderView::clientLogicalWidthForFixedPosition): If we have an override layout viewport, its size might be different
2870         from the RenderView's size (the initial containing block), so we need to use the layoutViewportRect here.
2871         (WebCore::RenderView::clientLogicalHeightForFixedPosition):
2872
2873 2016-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
2874
2875         [WebGL] Remove unused Chromium-specific OpenGL extensions
2876         https://bugs.webkit.org/show_bug.cgi?id=164782
2877
2878         Reviewed by Dean Jackson.
2879
2880         No new tests because there is no behavior change.
2881
2882         * html/canvas/WebGL2RenderingContext.cpp:
2883         (WebCore::WebGL2RenderingContext::copyBufferSubData):
2884         (WebCore::WebGL2RenderingContext::clear):
2885         (WebCore::WebGL2RenderingContext::getExtension):
2886         * html/canvas/WebGLCompressedTextureS3TC.cpp:
2887         (WebCore::WebGLCompressedTextureS3TC::supported):
2888         * html/canvas/WebGLDepthTexture.cpp:
2889         (WebCore::WebGLDepthTexture::supported):
2890         * html/canvas/WebGLDrawBuffers.cpp:
2891         (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements):
2892         * html/canvas/WebGLFramebuffer.cpp:
2893         (WebCore::WebGLFramebuffer::onAccess):
2894         * html/canvas/WebGLFramebuffer.h:
2895         * html/canvas/WebGLRenderingContext.cpp:
2896         (WebCore::WebGLRenderingContext::getExtension):
2897         (WebCore::WebGLRenderingContext::clear):
2898         * html/canvas/WebGLRenderingContextBase.cpp:
2899         (WebCore::WebGLRenderingContextBase::setupFlags):
2900         (WebCore::WebGLRenderingContextBase::bufferData):
2901         (WebCore::WebGLRenderingContextBase::bufferSubData):
2902         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
2903         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2904         (WebCore::WebGLRenderingContextBase::validateDrawElements):
2905         (WebCore::WebGLRenderingContextBase::readPixels):
2906         (WebCore::WebGLRenderingContextBase::texImage2DBase):
2907         (WebCore::WebGLRenderingContextBase::copyTexImage2D):
2908         * html/canvas/WebGLRenderingContextBase.h:
2909         (WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict):
2910         (WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted.
2911         (WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted.
2912         * platform/graphics/GraphicsContext3D.cpp:
2913         (WebCore::GraphicsContext3D::texImage2DResourceSafe):
2914         * platform/graphics/GraphicsContext3D.h:
2915         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2916         (WebCore::GraphicsContext3D::isResourceSafe): Deleted.
2917
2918 2016-11-14  Brent Fulgham  <bfulgham@apple.com>
2919
2920         Correct handling of changing input type
2921         https://bugs.webkit.org/show_bug.cgi?id=164759
2922         <rdar://problem/29211174>
2923
2924         Reviewed by Darin Adler.
2925
2926         Test: fast/forms/search-cancel-button-change-input.html
2927
2928         It is possible for JavaScript to change the type property of an input field. WebKit
2929         needs to gracefully handle this case.
2930
2931         Add a type traits specialization so we can properly downcast InputType elements.
2932         Use this to only call search functions on actual search input types.
2933
2934         * html/HTMLInputElement.cpp:
2935         (WebCore::HTMLInputElement::onSearch): Only perform search functions if the
2936         input type is actually a search field.
2937         * html/InputType.h: Add type traits specialization for 'downcast' template.
2938         * html/SearchInputType.h: Ditto.
2939
2940 2016-11-15  Zalan Bujtas  <zalan@apple.com>
2941
2942         CounterNode::insertAfter and ::removeChild should take references.
2943         https://bugs.webkit.org/show_bug.cgi?id=164780
2944
2945         Reviewed by Simon Fraser.
2946
2947         No change in functionality.
2948
2949         * rendering/CounterNode.cpp:
2950         (WebCore::CounterNode::insertAfter):
2951         (WebCore::CounterNode::removeChild):
2952         * rendering/CounterNode.h:
2953         * rendering/RenderCounter.cpp:
2954         (WebCore::makeCounterNode):
2955         (WebCore::destroyCounterNodeWithoutMapRemoval):
2956         (WebCore::updateCounters):
2957
2958 2016-11-15  Antti Koivisto  <antti@apple.com>
2959
2960         slot doesn't work as a flex container
2961         https://bugs.webkit.org/show_bug.cgi?id=160740
2962         <rdar://problem/28605080>
2963
2964         Reviewed by Ryosuke Niwa.
2965
2966         Test: fast/shadow-dom/css-scoping-slot-flex.html
2967
2968         The style adjustment for flex children needs to be based on their parent box style rather
2969         than the composed tree parent. This can be different when display:contents is involved.
2970
2971         * css/MediaQueryMatcher.cpp:
2972         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
2973         * css/StyleMedia.cpp:
2974         (WebCore::StyleMedia::matchMedium):
2975         * css/StyleResolver.cpp:
2976         (WebCore::StyleResolver::StyleResolver):
2977         (WebCore::StyleResolver::styleForElement):
2978
2979             Optionally provide parent box style so we can do adjustments based on it when computing style for rendering.
2980
2981         (WebCore::StyleResolver::styleForKeyframe):
2982         (WebCore::StyleResolver::pseudoStyleForElement):
2983         (WebCore::equivalentBlockDisplay):
2984
2985             Avoid boolean parameters.
2986
2987         (WebCore::StyleResolver::adjustRenderStyle):
2988
2989             Do the display:contents adjustment first and treat 'content' like 'none' later'. We never want to override
2990             'contents' with adjustments.
2991             Use parent box style for flex/grid adjustments instead of the DOM parent style.
2992
2993         * css/StyleResolver.h:
2994         * rendering/RenderNamedFlowFragment.cpp:
2995         (WebCore::RenderNamedFlowFragment::computeStyleInRegion):
2996         * style/StyleTreeResolver.cpp:
2997         (WebCore::Style::TreeResolver::styleForElement):
2998
2999             Call with parent box style.
3000
3001         (WebCore::Style::TreeResolver::parentBoxStyle):
3002
3003             Find the parent box style if any.
3004
3005         * style/StyleTreeResolver.h:
3006         * svg/SVGElementRareData.h:
3007         (WebCore::SVGElementRareData::overrideComputedStyle):
3008
3009 2016-11-15  Joseph Pecoraro  <pecoraro@apple.com>
3010
3011         Misc Inspector backend cleanup
3012         https://bugs.webkit.org/show_bug.cgi?id=164768
3013
3014         Reviewed by Brian Burg.
3015
3016         * inspector/DOMPatchSupport.cpp:
3017         * inspector/InspectorApplicationCacheAgent.cpp:
3018         * inspector/InspectorApplicationCacheAgent.h:
3019         * inspector/InspectorCSSAgent.cpp:
3020         * inspector/InspectorCSSAgent.h:
3021         * inspector/InspectorDOMAgent.cpp:
3022         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3023         * inspector/InspectorDOMAgent.h:
3024         * inspector/InspectorDOMDebuggerAgent.h:
3025         * inspector/InspectorDOMStorageAgent.cpp:
3026         * inspector/InspectorDOMStorageAgent.h:
3027         * inspector/InspectorDatabaseAgent.cpp:
3028         * inspector/InspectorDatabaseAgent.h:
3029         * inspector/InspectorFrontendClientLocal.cpp:
3030         (WebCore::InspectorFrontendClientLocal::frontendLoaded):
3031         * inspector/InspectorIndexedDBAgent.cpp:
3032         (WebCore::ClearObjectStoreListener::create): Deleted.
3033         (WebCore::ClearObjectStoreListener::~ClearObjectStoreListener): Deleted.
3034         (WebCore::ClearObjectStoreListener::ClearObjectStoreListener): Deleted.
3035         (WebCore::ClearObjectStore::create): Deleted.
3036         (WebCore::ClearObjectStore::ClearObjectStore): Deleted.
3037         * inspector/InspectorLayerTreeAgent.cpp:
3038         * inspector/InspectorLayerTreeAgent.h:
3039         * inspector/InspectorNetworkAgent.h:
3040         * inspector/InspectorPageAgent.cpp:
3041         * inspector/InspectorPageAgent.h:
3042         * inspector/InspectorReplayAgent.cpp:
3043         * inspector/InspectorReplayAgent.h:
3044         * inspector/InspectorTimelineAgent.cpp:
3045         (WebCore::InspectorTimelineAgent::stopFromConsole):
3046         * inspector/InspectorTimelineAgent.h:
3047         * inspector/PageRuntimeAgent.h:
3048
3049 2016-11-14  Myles C. Maxfield  <mmaxfield@apple.com>
3050
3051         [WebGL] Migrate construction functions from pointers to references
3052         https://bugs.webkit.org/show_bug.cgi?id=164749
3053
3054         Reviewed by Zalan Bujtas.
3055
3056         Mechanical find/replace.
3057
3058         No new tests because there is no behavior change.
3059
3060         * html/canvas/ANGLEInstancedArrays.cpp:
3061         (WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
3062         (WebCore::ANGLEInstancedArrays::supported):
3063         (WebCore::ANGLEInstancedArrays::drawArraysInstancedANGLE):
3064         (WebCore::ANGLEInstancedArrays::drawElementsInstancedANGLE):
3065         (WebCore::ANGLEInstancedArrays::vertexAttribDivisorANGLE):
3066         * html/canvas/ANGLEInstancedArrays.h:
3067         * html/canvas/EXTBlendMinMax.cpp:
3068         (WebCore::EXTBlendMinMax::EXTBlendMinMax):
3069         * html/canvas/EXTBlendMinMax.h:
3070         * html/canvas/EXTFragDepth.cpp:
3071         (WebCore::EXTFragDepth::EXTFragDepth):
3072         * html/canvas/EXTFragDepth.h:
3073         * html/canvas/EXTShaderTextureLOD.cpp:
3074         (WebCore::EXTShaderTextureLOD::EXTShaderTextureLOD):
3075         * html/canvas/EXTShaderTextureLOD.h:
3076         * html/canvas/EXTTextureFilterAnisotropic.cpp:
3077         (WebCore::EXTTextureFilterAnisotropic::EXTTextureFilterAnisotropic):
3078         * html/canvas/EXTTextureFilterAnisotropic.h:
3079         * html/canvas/EXTsRGB.cpp:
3080         (WebCore::EXTsRGB::EXTsRGB):
3081         * html/canvas/EXTsRGB.h:
3082         * html/canvas/OESElementIndexUint.cpp:
3083         (WebCore::OESElementIndexUint::OESElementIndexUint):
3084         * html/canvas/OESElementIndexUint.h:
3085         * html/canvas/OESStandardDerivatives.cpp:
3086         (WebCore::OESStandardDerivatives::OESStandardDerivatives):
3087         * html/canvas/OESStandardDerivatives.h:
3088         * html/canvas/OESTextureFloat.cpp:
3089         (WebCore::OESTextureFloat::OESTextureFloat):
3090         * html/canvas/OESTextureFloat.h:
3091         * html/canvas/OESTextureFloatLinear.cpp:
3092         (WebCore::OESTextureFloatLinear::OESTextureFloatLinear):
3093         * html/canvas/OESTextureFloatLinear.h:
3094         * html/canvas/OESTextureHalfFloat.cpp:
3095         (WebCore::OESTextureHalfFloat::OESTextureHalfFloat):
3096         * html/canvas/OESTextureHalfFloat.h:
3097         * html/canvas/OESTextureHalfFloatLinear.cpp:
3098         (WebCore::OESTextureHalfFloatLinear::OESTextureHalfFloatLinear):
3099         * html/canvas/OESTextureHalfFloatLinear.h:
3100         * html/canvas/OESVertexArrayObject.cpp:
3101         (WebCore::OESVertexArrayObject::OESVertexArrayObject):
3102         (WebCore::OESVertexArrayObject::createVertexArrayOES):
3103         (WebCore::OESVertexArrayObject::deleteVertexArrayOES):
3104         (WebCore::OESVertexArrayObject::isVertexArrayOES):
3105         (WebCore::OESVertexArrayObject::bindVertexArrayOES):
3106         * html/canvas/WebGL2RenderingContext.cpp:
3107         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
3108         (WebCore::WebGL2RenderingContext::initializeShaderExtensions):
3109         (WebCore::WebGL2RenderingContext::drawBuffers):
3110         (WebCore::WebGL2RenderingContext::createVertexArray):
3111         (WebCore::WebGL2RenderingContext::isVertexArray):
3112         (WebCore::WebGL2RenderingContext::bindVertexArray):
3113         (WebCore::WebGL2RenderingContext::getExtension):
3114         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
3115         * html/canvas/WebGLBuffer.cpp:
3116         (WebCore::WebGLBuffer::create):
3117         (WebCore::WebGLBuffer::WebGLBuffer):
3118         * html/canvas/WebGLBuffer.h:
3119         * html/canvas/WebGLCompressedTextureATC.cpp:
3120         (WebCore::WebGLCompressedTextureATC::WebGLCompressedTextureATC):
3121         (WebCore::WebGLCompressedTextureATC::supported):
3122         * html/canvas/WebGLCompressedTextureATC.h:
3123         * html/canvas/WebGLCompressedTexturePVRTC.cpp:
3124         (WebCore::WebGLCompressedTexturePVRTC::WebGLCompressedTexturePVRTC):
3125         (WebCore::WebGLCompressedTexturePVRTC::supported):
3126         * html/canvas/WebGLCompressedTexturePVRTC.h:
3127         * html/canvas/WebGLCompressedTextureS3TC.cpp:
3128         (WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC):
3129         (WebCore::WebGLCompressedTextureS3TC::supported):
3130         * html/canvas/WebGLCompressedTextureS3TC.h:
3131         * html/canvas/WebGLContextObject.cpp:
3132         (WebCore::WebGLContextObject::WebGLContextObject):
3133         * html/canvas/WebGLContextObject.h:
3134         * html/canvas/WebGLDebugRendererInfo.cpp:
3135         (WebCore::WebGLDebugRendererInfo::WebGLDebugRendererInfo):
3136         * html/canvas/WebGLDebugRendererInfo.h:
3137         * html/canvas/WebGLDebugShaders.cpp:
3138         (WebCore::WebGLDebugShaders::WebGLDebugShaders):
3139         (WebCore::WebGLDebugShaders::getTranslatedShaderSource):
3140         * html/canvas/WebGLDebugShaders.h:
3141         * html/canvas/WebGLDepthTexture.cpp:
3142         (WebCore::WebGLDepthTexture::WebGLDepthTexture):
3143         (WebCore::WebGLDepthTexture::supported):
3144         * html/canvas/WebGLDepthTexture.h:
3145         * html/canvas/WebGLDrawBuffers.cpp:
3146         (WebCore::WebGLDrawBuffers::WebGLDrawBuffers):
3147         (WebCore::WebGLDrawBuffers::supported):
3148         (WebCore::WebGLDrawBuffers::drawBuffersWEBGL):
3149         (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements):
3150         * html/canvas/WebGLDrawBuffers.h:
3151         * html/canvas/WebGLExtension.cpp:
3152         (WebCore::WebGLExtension::WebGLExtension):
3153         * html/canvas/WebGLExtension.h:
3154         (WebCore::WebGLExtension::ref):
3155         (WebCore::WebGLExtension::deref):
3156         (WebCore::WebGLExtension::context):
3157         * html/canvas/WebGLFramebuffer.cpp:
3158         (WebCore::WebGLFramebuffer::create):
3159         (WebCore::WebGLFramebuffer::WebGLFramebuffer):
3160         (WebCore::WebGLFramebuffer::drawBuffersIfNecessary):
3161         * html/canvas/WebGLFramebuffer.h:
3162         * html/canvas/WebGLLoseContext.cpp:
3163         (WebCore::WebGLLoseContext::WebGLLoseContext):
3164         (WebCore::WebGLLoseContext::loseContext):
3165         (WebCore::WebGLLoseContext::restoreContext):
3166         * html/canvas/WebGLLoseContext.h:
3167         * html/canvas/WebGLObject.cpp:
3168         (WebCore::WebGLObject::WebGLObject):
3169         * html/canvas/WebGLObject.h:
3170         * html/canvas/WebGLProgram.cpp:
3171         (WebCore::WebGLProgram::create):
3172         (WebCore::WebGLProgram::WebGLProgram):
3173         * html/canvas/WebGLProgram.h:
3174         * html/canvas/WebGLQuery.cpp:
3175         (WebCore::WebGLQuery::create):
3176         (WebCore::WebGLQuery::WebGLQuery):
3177         * html/canvas/WebGLQuery.h:
3178         * html/canvas/WebGLRenderbuffer.cpp:
3179         (WebCore::WebGLRenderbuffer::create):
3180         (WebCore::WebGLRenderbuffer::WebGLRenderbuffer):
3181         * html/canvas/WebGLRenderbuffer.h:
3182         * html/canvas/WebGLRenderingContext.cpp:
3183         (WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
3184         (WebCore::WebGLRenderingContext::getExtension):
3185         (WebCore::WebGLRenderingContext::getSupportedExtensions):
3186         * html/canvas/WebGLRenderingContextBase.cpp:
3187         (WebCore::WebGLRenderingContextBase::create):
3188         (WebCore::WebGLRenderingContextBase::setupFlags):
3189         (WebCore::WebGLRenderingContextBase::checkObjectToBeBound):
3190         (WebCore::WebGLRenderingContextBase::createBuffer):
3191         (WebCore::WebGLRenderingContextBase::createFramebuffer):
3192         (WebCore::WebGLRenderingContextBase::createTexture):
3193         (WebCore::WebGLRenderingContextBase::createProgram):
3194         (WebCore::WebGLRenderingContextBase::createRenderbuffer):
3195         (WebCore::WebGLRenderingContextBase::createShader):
3196         (WebCore::WebGLRenderingContextBase::deleteObject):
3197         (WebCore::WebGLRenderingContextBase::validateWebGLObject):
3198         (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
3199         (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
3200         (WebCore::WebGLRenderingContextBase::getUniform):
3201         (WebCore::WebGLRenderingContextBase::readPixels):
3202         (WebCore::WebGLRenderingContextBase::loseContextImpl):
3203         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
3204         (WebCore::WebGLRenderingContextBase::supportsDrawBuffers):
3205         * html/canvas/WebGLSampler.cpp:
3206         (WebCore::WebGLSampler::create):
3207         (WebCore::WebGLSampler::WebGLSampler):
3208         * html/canvas/WebGLSampler.h:
3209         * html/canvas/WebGLShader.cpp:
3210         (WebCore::WebGLShader::create):
3211         (WebCore::WebGLShader::WebGLShader):
3212         * html/canvas/WebGLShader.h:
3213         * html/canvas/WebGLSharedObject.cpp:
3214         (WebCore::WebGLSharedObject::WebGLSharedObject):
3215         * html/canvas/WebGLSharedObject.h:
3216         * html/canvas/WebGLSync.cpp:
3217         (WebCore::WebGLSync::create):
3218         (WebCore::WebGLSync::WebGLSync):
3219         * html/canvas/WebGLSync.h:
3220         * html/canvas/WebGLTexture.cpp:
3221         (WebCore::WebGLTexture::create):
3222         (WebCore::WebGLTexture::WebGLTexture):
3223         * html/canvas/WebGLTexture.h:
3224         * html/canvas/WebGLTransformFeedback.cpp:
3225         (WebCore::WebGLTransformFeedback::create):
3226         (WebCore::WebGLTransformFeedback::WebGLTransformFeedback):
3227         * html/canvas/WebGLTransformFeedback.h:
3228         * html/canvas/WebGLVertexArrayObject.cpp:
3229         (WebCore::WebGLVertexArrayObject::create):
3230         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject):
3231         * html/canvas/WebGLVertexArrayObject.h:
3232         * html/canvas/WebGLVertexArrayObjectBase.cpp:
3233         (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase):
3234         * html/canvas/WebGLVertexArrayObjectBase.h:
3235         * html/canvas/WebGLVertexArrayObjectOES.cpp:
3236         (WebCore::WebGLVertexArrayObjectOES::create):
3237         (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES):
3238         (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl):
3239         * html/canvas/WebGLVertexArrayObjectOES.h:
3240         * platform/graphics/GraphicsContext3D.h:
3241         * platform/graphics/gpu/Texture.cpp:
3242         (WebCore::convertFormat):
3243         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
3244         (WebCore::GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary):
3245         (WebCore::GraphicsContext3D::reshapeFBOs):
3246         (WebCore::GraphicsContext3D::getIntegerv):
3247         (WebCore::GraphicsContext3D::getExtensions):
3248         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3249         (WebCore::GraphicsContext3D::validateDepthStencil):
3250         (WebCore::GraphicsContext3D::drawArraysInstanced):
3251         (WebCore::GraphicsContext3D::drawElementsInstanced):
3252         (WebCore::GraphicsContext3D::vertexAttribDivisor):
3253
3254 2016-11-15  Joanmarie Diggs  <jdiggs@igalia.com>
3255
3256         AX: Need to update implicit/default values for aria-valuemin, aria-valuenow, and aria-valuemax
3257         https://bugs.webkit.org/show_bug.cgi?id=164773
3258
3259         Reviewed by Chris Fleizach.
3260
3261         Return the values stated in the ARIA 1.1 spec, namely:
3262         - aria-valuemin is 0 for roles other than spinbutton
3263         - aria-valuemax is 100 for roles other than spinbutton
3264         - aria-valuenow is half way between aria-valuemax and aria-valuemin
3265           for roles other than spinbutton, and 0 for spinbutton
3266
3267         For spinbutton, the spec states that "there is no minimum/maximum value."
3268         But at least in the case of ATK/AT-SPI2, the accessible value interface
3269         is expected to provide a number. Therefore, expose the values we use to
3270         constrain input type="number": -std::numeric_limits<float>::max() and
3271         std::numeric_limits<float>::max().
3272
3273         Test: accessibility/spinbutton-implicit-values.html
3274
3275         * accessibility/AccessibilityNodeObject.cpp:
3276         (WebCore::AccessibilityNodeObject::valueForRange):
3277         (WebCore::AccessibilityNodeObject::maxValueForRange):
3278         (WebCore::AccessibilityNodeObject::minValueForRange):
3279
3280 2016-11-14  Jiewen Tan  <jiewen_tan@apple.com>
3281
3282         Update SubtleCrypto::exportKey to match the latest spec
3283         https://bugs.webkit.org/show_bug.cgi?id=164722
3284         <rdar://problem/29251740>
3285
3286         Reviewed by Brent Fulgham.
3287
3288         This patch does following few things:
3289         1. It updates the SubtleCrypto::exportKey method to match the latest spec:
3290            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-exportKey.
3291            It also refers to the latest Editor's Draft to a certain degree:
3292            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-exportKey.
3293         2. It implements exportKey operations of the following algorithms: AES-CBC, AES-KW,
3294            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
3295         3. It also fixes the following bugs:
3296            https://bugs.webkit.org/show_bug.cgi?id=156114,
3297            <rdar://problem/21773066>.
3298         Note: We currently only support Raw and Jwk key format.
3299
3300         Tests: crypto/subtle/aes-cbc-generate-export-key-jwk-length-128.html
3301                crypto/subtle/aes-cbc-generate-export-key-jwk-length-192.html
3302                crypto/subtle/aes-cbc-generate-export-key-jwk-length-256.html
3303                crypto/subtle/aes-cbc-generate-export-key-raw.html
3304                crypto/subtle/aes-export-key-malformed-parameters.html
3305                crypto/subtle/aes-kw-generate-export-key-jwk-length-128.html
3306                crypto/subtle/aes-kw-generate-export-key-jwk-length-192.html
3307                crypto/subtle/aes-kw-generate-export-key-jwk-length-256.html
3308                crypto/subtle/aes-kw-generate-export-raw-key.html
3309                crypto/subtle/export-key-malformed-parameters.html
3310                crypto/subtle/hmac-export-key-malformed-parameters.html
3311                crypto/subtle/hmac-generate-export-key-jwk-sha1.html
3312                crypto/subtle/hmac-generate-export-key-jwk-sha224.html
3313                crypto/subtle/hmac-generate-export-key-jwk-sha256.html
3314                crypto/subtle/hmac-generate-export-key-jwk-sha384.html
3315                crypto/subtle/hmac-generate-export-key-jwk-sha512.html
3316                crypto/subtle/hmac-generate-export-raw-key.html
3317                crypto/subtle/hmac-import-key-malformed-parameters.html
3318                crypto/subtle/rsa-export-key-malformed-parameters.html
3319                crypto/subtle/rsa-oaep-generate-export-key-jwk-sha1.html
3320                crypto/subtle/rsa-oaep-generate-export-key-jwk-sha224.html
3321                crypto/subtle/rsa-oaep-generate-export-key-jwk-sha256.html
3322                crypto/subtle/rsa-oaep-generate-export-key-jwk-sha384.html
3323                crypto/subtle/rsa-oaep-generate-export-key-jwk-sha512.html
3324                crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-jwk.html
3325                crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha1.html
3326                crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha224.html
3327                crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha256.html
3328                crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha384.html
3329                crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-jwk-sha512.html
3330                crypto/workers/subtle/aes-generate-export-key-jwk.html
3331                crypto/workers/subtle/aes-generate-export-key-raw.html
3332                crypto/workers/subtle/hmac-generate-export-key-jwk.html
3333                crypto/workers/subtle/hmac-generate-export-key-raw.html
3334                crypto/workers/subtle/rsa-generate-export-key-jwk.html
3335
3336         * bindings/js/JSSubtleCryptoCustom.cpp:
3337         (WebCore::toJSValueFromJsonWebKey):
3338         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
3339         (WebCore::JSSubtleCrypto::exportKey):
3340         * crypto/CryptoAlgorithm.cpp:
3341         (WebCore::CryptoAlgorithm::exportKey):
3342         * crypto/CryptoAlgorithm.h:
3343         * crypto/SubtleCrypto.idl:
3344         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3345         (WebCore::CryptoAlgorithmAES_CBC::importKey):
3346         (WebCore::CryptoAlgorithmAES_CBC::exportKey):
3347         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3348         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3349         (WebCore::CryptoAlgorithmAES_KW::importKey):
3350         (WebCore::CryptoAlgorithmAES_KW::exportKey):
3351         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3352         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3353         (WebCore::CryptoAlgorithmHMAC::importKey):
3354         (WebCore::CryptoAlgorithmHMAC::exportKey):
3355         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3356         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3357         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
3358         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
3359         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3360         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3361         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
3362         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
3363         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3364         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3365         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
3366         (WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
3367         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3368         * crypto/keys/CryptoKeyAES.cpp:
3369         (WebCore::CryptoKeyAES::exportJwk):
3370         * crypto/keys/CryptoKeyAES.h:
3371         * crypto/keys/CryptoKeyHMAC.cpp:
3372         (WebCore::CryptoKeyHMAC::exportJwk):
3373         * crypto/keys/CryptoKeyHMAC.h:
3374         * crypto/keys/CryptoKeyRSA.cpp:
3375         (WebCore::CryptoKeyRSA::exportJwk):
3376         * crypto/keys/CryptoKeyRSA.h:
3377
3378 2016-11-15  Jon Lee  <jonlee@apple.com>
3379
3380         Remove HasMediaCaptureDevice
3381         https://bugs.webkit.org/show_bug.cgi?id=164767
3382         <rdar://problem/29263696>
3383
3384         Reviewed by Eric Carlson.
3385
3386         * Modules/mediastream/MediaStream.cpp:
3387         (WebCore::MediaStream::mediaState): Remove HasMediaCaptureDevice in state.
3388         * page/MediaProducer.h:
3389         * testing/Internals.cpp:
3390         (WebCore::Internals::pageMediaState): Remove it in the media string.
3391
3392 2016-11-14  Dave Hyatt  <hyatt@apple.com>
3393
3394         [CSS Parser] Fix font-synthesis and text-decoration-skip parsing
3395         https://bugs.webkit.org/show_bug.cgi?id=164736
3396
3397         Reviewed by Dean Jackson.
3398
3399         Fix the properties to not allow duplicate values, to reject when
3400         garbage values are included, to require that none be a singleton,
3401         and to preserve the declaration order of the properties.
3402
3403         * css/StyleBuilderConverter.h:
3404         (WebCore::StyleBuilderConverter::convertTextDecorationSkip):
3405         * css/parser/CSSParser.cpp:
3406         (WebCore::CSSParser::parseFontSynthesis):
3407         (WebCore::CSSParser::parseTextDecorationSkip):
3408         * css/parser/CSSPropertyParser.cpp:
3409         (WebCore::consumeFontSynthesis):
3410         (WebCore::consumeTextDecorationSkip):
3411         (WebCore::CSSPropertyParser::parseSingleValue):
3412
3413 2016-11-15  Daniel Bates  <dabates@apple.com>
3414
3415         Disallow loads using HTTP 0.9 at the ResourceHandle/NetworkDataTask level
3416         https://bugs.webkit.org/show_bug.cgi?id=164662
3417         <rdar://problem/29268514>
3418
3419         Reviewed by Reviewed by Alex Christensen and Brady Eidson.
3420
3421         Currently we disallow non-default HTTP 0.9 loads at the ResourceLoader level and disallow
3422         subresource loads using HTTP 0.9 on a default port when the embedding page loads using a
3423         different HTTP version. However loads can still be initiated from other loaders (e.g. FrameLoader)
3424         with regards to the first issue. The latter issue does not afford much protection and
3425         increases code complexity. Instead we should simplify our policy and move our code to the
3426         lowest networking abstraction level, ResourceHandle/NetworkDataTask, so that we disallow
3427         all non-default port loads using HTTP 0.9 regardless of the loader used.
3428
3429         Tests: http/tests/security/http-0.9/image-default-port-allowed.html
3430                http/tests/security/http-0.9/xhr-blocked.html
3431
3432         * loader/DocumentLoader.cpp:
3433         (WebCore::DocumentLoader::responseReceived): Remove logic to cancel an HTTP 0.9 load from here.
3434         We will cancel the HTTP 0.9 load at the ResourceHandle/NetworkDataTask level.
3435         * loader/ResourceLoader.cpp:
3436         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
3437         * platform/URL.h: Export stringCenterEllipsizedToLength() so that we can use it in WebKit2.
3438         * platform/network/BlobResourceHandle.cpp:
3439         (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Modified to call ResourceHandle::didReceiveResponse().
3440         (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto.
3441         * platform/network/ResourceHandle.cpp:
3442         (WebCore::ResourceHandle::didReceiveResponse): Added. Fail the load if it is using HTTP 0.9.
3443         Otherwise notify the client that we received a response.
3444         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): Added. Perform any
3445         additional platform-specific logic after notifying the resource handle client of the received
3446         response. Only the libsoup backend overwrites this member function to do something meaningful.
3447         * platform/network/ResourceHandle.h:
3448         * platform/network/ResourceResponseBase.h:
3449         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3450         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): Modified to
3451         call ResourceHandle::didReceiveResponse().
3452         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
3453         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto.
3454         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3455         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): Ditto.
3456         * platform/network/soup/ResourceHandleSoup.cpp:
3457         (WebCore::nextMultipartResponsePartCallback): Ditto.
3458         (WebCore::sendRequestCallback): Ditto.
3459         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse): Added. Turns around and
3460         calls continueAfterDidReceiveResponse().
3461
3462 2016-11-15  Zalan Bujtas  <zalan@apple.com>
3463
3464         [MultiCol] Render tree should be all clean by the end of FrameView::layout().
3465         https://bugs.webkit.org/show_bug.cgi?id=162833
3466
3467         Reviewed by Simon Fraser.
3468
3469         This is a temporary workaround until after we addressed render tree mutation during layout (webkit.org/b/163849).
3470
3471         Test: fast/inline/out-of-flow-quotation-text-with-multicolumn.html
3472
3473         * page/FrameView.cpp:
3474         (WebCore::FrameView::layout):
3475         * rendering/RenderMultiColumnFlowThread.cpp:
3476         (WebCore::RenderMultiColumnFlowThread::populate):
3477         (WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy):
3478         * rendering/RenderQuote.cpp:
3479         (WebCore::RenderQuote::attachQuote): Populating/evacuating the flow should not trigger quotation text changes.
3480         (WebCore::RenderQuote::detachQuote):
3481         * rendering/RenderView.h:
3482         (WebCore::RenderTreeInternalMutationScope::RenderTreeInternalMutationScope):
3483         (WebCore::RenderTreeInternalMutationScope::~RenderTreeInternalMutationScope):
3484
3485 2016-11-15  Eric Carlson  <eric.carlson@apple.com>
3486
3487         REGRESSION (r208606?): LayoutTest fast/mediastream/enumerating-crash.html is a flaky crash
3488         https://bugs.webkit.org/show_bug.cgi?id=164715
3489
3490         Reviewed by Jon Lee.
3491
3492         No new tests, fixes a crash in an existing test.
3493
3494         * Modules/mediastream/UserMediaRequest.cpp:
3495         (WebCore::UserMediaRequest::document): Return nullptr when the script execution context has
3496           been cleared.
3497         * Modules/mediastream/UserMediaRequest.h:
3498         (WebCore::UserMediaRequest::document): Deleted.
3499
3500 2016-11-15  Alejandro G. Castro  <alex@igalia.com>
3501
3502         WebRTC: update MediaStream-MediaElement-srcObject.html test and unskip it
3503         https://bugs.webkit.org/show_bug.cgi?id=159343
3504
3505         Reviewed by Philippe Normand.
3506
3507         Test updated.
3508
3509         We can not initialize the srcObject attribute when creating the mediaplayer
3510         or we would be removing the srcObject we are going to use.
3511
3512         * html/HTMLMediaElement.cpp:
3513         (WebCore::HTMLMediaElement::createMediaPlayer):
3514
3515 2016-11-14  Alex Christensen  <achristensen@webkit.org>
3516
3517         Move SecurityOrigin::createFromDatabaseIdentifier to SecurityOriginData
3518         https://bugs.webkit.org/show_bug.cgi?id=164720
3519
3520         Reviewed by Brady Eidson.
3521
3522         This is adding to r208558 where we moved databaseIdentifier to SecurityOriginData so we
3523         don't have to use SecurityOrigin in the DatabaseProcess.  This is a step towards only using 
3524         SecurityOrigin (and the SchemeRegistry) in the WebProcess. SecurityOriginData is for other 
3525         processes and IPC. There should be no change in behaviour.
3526
3527         * Modules/webdatabase/Database.cpp:
3528         (WebCore::Database::Database):
3529         (WebCore::Database::securityOrigin):
3530         * Modules/webdatabase/Database.h:
3531         * Modules/webdatabase/DatabaseContext.cpp:
3532         (WebCore::DatabaseContext::securityOrigin):
3533         * Modules/webdatabase/DatabaseContext.h:
3534         * Modules/webdatabase/DatabaseManager.cpp:
3535         (WebCore::DatabaseManager::tryToOpenDatabaseBackend):
3536         (WebCore::DatabaseManager::fullPathForDatabase):
3537         (WebCore::DatabaseManager::detailsForNameAndOrigin):
3538         * Modules/webdatabase/DatabaseManager.h:
3539         * Modules/webdatabase/DatabaseManagerClient.h:
3540         (WebCore::DatabaseManagerClient::dispatchDidAddNewOrigin):
3541         * Modules/webdatabase/DatabaseTracker.cpp:
3542         (WebCore::DatabaseTracker::hasAdequateQuotaForOrigin):
3543         (WebCore::DatabaseTracker::canEstablishDatabase):
3544         (WebCore::DatabaseTracker::retryCanEstablishDatabase):
3545         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
3546         (WebCore::DatabaseTracker::hasEntryForDatabase):
3547         (WebCore::DatabaseTracker::maximumSize):
3548         (WebCore::DatabaseTracker::originPath):
3549         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
3550         (WebCore::DatabaseTracker::fullPathForDatabase):
3551         (WebCore::DatabaseTracker::origins):
3552         (WebCore::DatabaseTracker::databaseNamesNoLock):
3553         (WebCore::DatabaseTracker::databaseNames):
3554         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
3555         (WebCore::DatabaseTracker::setDatabaseDetails):
3556         (WebCore::DatabaseTracker::addOpenDatabase):
3557         (WebCore::DatabaseTracker::removeOpenDatabase):
3558         (WebCore::DatabaseTracker::originLockFor):
3559         (WebCore::DatabaseTracker::deleteOriginLockFor):
3560         (WebCore::DatabaseTracker::usage):
3561         (WebCore::DatabaseTracker::quotaNoLock):
3562         (WebCore::DatabaseTracker::quota):
3563         (WebCore::DatabaseTracker::setQuota):
3564         (WebCore::DatabaseTracker::addDatabase):
3565         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
3566         (WebCore::DatabaseTracker::deleteOrigin):
3567         (WebCore::DatabaseTracker::isDeletingDatabaseOrOriginFor):
3568         (WebCore::DatabaseTracker::recordCreatingDatabase):
3569         (WebCore::DatabaseTracker::doneCreatingDatabase):
3570         (WebCore::DatabaseTracker::creatingDatabase):
3571         (WebCore::DatabaseTracker::canDeleteDatabase):
3572         (WebCore::DatabaseTracker::recordDeletingDatabase):
3573         (WebCore::DatabaseTracker::doneDeletingDatabase):
3574         (WebCore::DatabaseTracker::isDeletingDatabase):
3575         (WebCore::DatabaseTracker::canDeleteOrigin):
3576         (WebCore::DatabaseTracker::isDeletingOrigin):
3577         (WebCore::DatabaseTracker::recordDeletingOrigin):
3578         (WebCore::DatabaseTracker::doneDeletingOrigin):
3579         (WebCore::DatabaseTracker::deleteDatabase):
3580         (WebCore::DatabaseTracker::deleteDatabaseFile):
3581         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
3582         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
3583         * Modules/webdatabase/DatabaseTracker.h:
3584         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
3585         (WebCore::getDatabaseIdentifier):
3586         * inspector/InspectorDOMStorageAgent.cpp:
3587         (WebCore::InspectorDOMStorageAgent::findStorageArea):
3588         * loader/EmptyClients.cpp:
3589         * page/DOMWindow.cpp:
3590         (WebCore::DOMWindow::sessionStorage):
3591         * page/SecurityOrigin.cpp:
3592         (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier): Deleted.
3593         (WebCore::SecurityOrigin::createFromDatabaseIdentifier): Deleted.
3594         * page/SecurityOrigin.h:
3595         * page/SecurityOriginData.cpp:
3596         (WebCore::SecurityOriginData::fromDatabaseIdentifier):
3597         * page/SecurityOriginData.h:
3598         (WebCore::SecurityOriginData::SecurityOriginData):
3599         * storage/StorageArea.h:
3600         * storage/StorageEventDispatcher.cpp:
3601         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents):
3602         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents):
3603         (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames):
3604         (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames):
3605         * storage/StorageEventDispatcher.h:
3606         * storage/StorageNamespace.h:
3607         * storage/StorageNamespaceProvider.cpp:
3608         (WebCore::StorageNamespaceProvider::localStorageArea):
3609
3610 2016-11-14  Joseph Pecoraro  <pecoraro@apple.com>
3611
3612         Web Inspector: Worker debugging should pause all targets and view call frames in all targets
3613         https://bugs.webkit.org/show_bug.cgi?id=164305
3614         <rdar://problem/29056192>
3615
3616         Reviewed by Timothy Hatcher.
3617
3618         Tests: inspector/debugger/continueUntilNextRunLoop
3619                inspector/worker/debugger-multiple-targets-pause
3620
3621         * workers/WorkerMessagingProxy.cpp:
3622         (WebCore::WorkerMessagingProxy::postMessageToPageInspector):
3623         Switch from postTask (callOnMainThread) to RunLoop::main().dispatch so
3624         that a paused Worker can send Inspector protocol messages responses
3625         back through the Main Page's InspectorWorkerAgent even if the Page
3626         itself is paused and MainThread callbacks are paused.
3627
3628         * workers/WorkerRunLoop.h:
3629         (WebCore::WorkerRunLoop::isNested):
3630         * workers/WorkerRunLoop.cpp:
3631         (WebCore::WorkerRunLoop::runInMode):
3632         When running a nested WorkerRunLoop, running inspector debugger
3633         commands, we should not fire timers on the Worker. Timers would
3634         then be happening out of order and would not be debuggable.
3635
3636         * dom/EventTarget.cpp:
3637         (WebCore::EventTarget::fireEventListeners):
3638         * inspector/InspectorDOMDebuggerAgent.cpp:
3639         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
3640         (WebCore::InspectorDOMDebuggerAgent::clear):
3641         (WebCore::InspectorDOMDebuggerAgent::didPause): Deleted.
3642         * inspector/InspectorDOMDebuggerAgent.h:
3643         * inspector/InspectorInstrumentation.cpp:
3644         (WebCore::InspectorInstrumentation::willHandleEventImpl):
3645         (WebCore::InspectorInstrumentation::didFireTimerImpl):
3646         (WebCore::InspectorInstrumentation::didHandleEventImpl): Deleted.
3647         (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent): Deleted.
3648         * inspector/InspectorInstrumentation.h:
3649         (WebCore::InspectorInstrumentation::willHandleEvent):
3650         (WebCore::InspectorInstrumentation::didHandleEvent): Deleted.
3651         Remove unnecessary code where WebCore is trying to keep track
3652         of pause on next statement but that state is already more
3653         accurately provided by InspectorDebuggerAgent.
3654
3655 2016-11-14  Myles C. Maxfield  <mmaxfield@apple.com>
3656
3657         [WebGL2] Teach WebGLRenderingContextBase about new texture internal formats
3658         https://bugs.webkit.org/show_bug.cgi?id=164525
3659
3660         Reviewed by Dean Jackson.
3661
3662         Test: fast/canvas/webgl/webgl2-texture-upload-enums.html
3663
3664         This patch migrates the existing WebGL calls texImage2D(), texSubImage2D(),
3665         and readPixels() to understand the new WebGL 2 texture types. In WebGL1, the
3666         format and the internalFormat were required to be the same, and we had this
3667         assumption baked into many places in these functions. In WebGL 2, those two
3668         values are often different, which means I had to fix all of these assumptions
3669         in our code. Also, rather than have two completely separate parallel
3670         implementations of these functions, a more forward-looking approach is to
3671         have one implementation which has a few checks to isWebGL1() in strategic
3672         places. (This way, bugs only have to be fixed in a single place). Therefore,
3673         this patch deletes the WebGL 2 versions of these functions.
3674
3675         * html/canvas/WebGL2RenderingContext.cpp: These functions are moved to
3676         WebGLRenderingContextBase.
3677         (WebCore::WebGL2RenderingContext::isIntegerFormat):
3678         (WebCore::WebGL2RenderingContext::copyTexImage2D): Deleted.
3679         (WebCore::WebGL2RenderingContext::texSubImage2DBase): Deleted.
3680         (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Deleted.
3681         (WebCore::WebGL2RenderingContext::texSubImage2D): Deleted.
3682         (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Deleted.
3683         (WebCore::WebGL2RenderingContext::validateTexFuncFormatAndType): Deleted.
3684         (WebCore::WebGL2RenderingContext::validateTexFuncData): Deleted.
3685         * html/canvas/WebGL2RenderingContext.h: Moved function implementations to
3686         WebGLRenderingContextBase.
3687         * html/canvas/WebGLRenderingContext.cpp: Ditto.
3688         (WebCore::WebGLRenderingContext::copyTexImage2D): Deleted.
3689         (WebCore::WebGLRenderingContext::texSubImage2DBase): Deleted.
3690         (WebCore::WebGLRenderingContext::texSubImage2DImpl): Deleted.
3691         (WebCore::WebGLRenderingContext::texSubImage2D): Deleted.
3692         (WebCore::WebGLRenderingContext::validateTexFuncParameters): Deleted.
3693         (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType): Deleted.
3694         (WebCore::WebGLRenderingContext::validateTexFuncData): Deleted.
3695         * html/canvas/WebGLRenderingContext.h: Moved function implementations to
3696         WebGLRenderingContextBase.
3697         * html/canvas/WebGLRenderingContextBase.cpp:
3698         (WebCore::WebGLRenderingContextBase::validateSettableTexInternalFormat):
3699         Teach about new depth texture formats.
3700         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): Rename
3701         "internalformat" to "internalFormat". Teach about the distinction between
3702         format and internalFormat. When pre-filling textures with 0s to work around
3703         buggy drivers, we need a new way of knowing which format/type arguments to
3704         pass to texSubImage2D() which are compatible with the texture's internal
3705         format. The implementation of this function was added to GraphicsContext3D
3706         and is called here.
3707         (WebCore::WebGLRenderingContextBase::generateMipmap): Teach about the
3708         distinction between format and internalFormat.
3709         (WebCore::internalFormatTheme): This is used so readPixels() knows what
3710         kind of format/type arguments are compatible with the texture's internal
3711         format.
3712         (WebCore::numberOfComponentsForFormat): Ditto.
3713         (WebCore::numberOfComponentsForInternalFormat): Ditto.
3714         (WebCore::WebGLRenderingContextBase::readPixels): Many more format/type
3715         combinations are required in order to test the various new kinds of
3716         textures.
3717         (WebCore::WebGLRenderingContextBase::texImage2DBase): Rename internalformat
3718         to internalFormat, and teach about the distinction between format and
3719         internalFormat.
3720         (WebCore::WebGLRenderingContextBase::validateTexFunc): Ditto.
3721         (WebCore::WebGLRenderingContextBase::texImage2D): Ditto.
3722         (WebCore::WebGLRenderingContextBase::texSubImage2DImpl): Moved from
3723         WebGLRenderingContext.
3724         (WebCore::WebGLRenderingContextBase::texSubImage2D): Ditto.
3725         (WebCore::WebGLRenderingContextBase::validateArrayBufferType): Ditto.
3726         (WebCore::WebGLRenderingContextBase::validateTexFuncData): Ditto.
3727         (WebCore::WebGLRenderingContextBase::validateTexFuncParameters): Ditto.
3728         (WebCore::WebGLRenderingContextBase::validateTexFuncFormatAndType): Ditto.
3729         This is the main function where the new internalFormats are dealt with.
3730         The OpenGL ES spec lists a table of all the internalFormats and all their
3731         compatible format/type values. This table is entered into this function to
3732         check that the combinations are correct.
3733         (WebCore::WebGLRenderingContextBase::texSubImage2DBase): Moved from
3734         WebGLRenderingContext.
3735         (WebCore::WebGLRenderingContextBase::copyTexImage2D): Ditto.
3736         (WebCore::WebGLRenderingContextBase::validateSettableTexFormat): Deleted.
3737         * html/canvas/WebGLRenderingContextBase.h: No longer overrides virtual
3738         functions.
3739         * platform/graphics/GraphicsContext3D.cpp:
3740         (WebCore::GraphicsContext3D::computeFormatAndTypeParameters): Because
3741         this is inside GraphicsContext3D, it doesn't need any isWebGL1() checks.
3742         Teach about new enums.
3743         (WebCore::GraphicsContext3D::possibleFormatAndTypeForInternalFormat):
3744         Ditto.
3745         (WebCore::GraphicsContext3D::packImageData):
3746         (WebCore::GraphicsContext3D::packPixels): It is possible to try to
3747         copy data from a video into one of these new formats. Currently, we
3748         implement this by swizzling on the CPU. Rather than implementing all the
3749         swizzling functions in this patch (which would make this patch much
3750         larger), simply bail in this case. We will implement this later.
3751         (WebCore::GraphicsContext3D::getClearBitsByFormat): Update.
3752         * platform/graphics/GraphicsContext3D.h:
3753         (WebCore::GraphicsContext3D::hasAlpha): Ditto.
3754         (WebCore::GraphicsContext3D::hasColor): Ditto.
3755
3756 2016-11-14  Simon Fraser  <simon.fraser@apple.com>
3757
3758         Scrolling when zoomed doesn't always use the correct layout viewport
3759         https://bugs.webkit.org/show_bug.cgi?id=164756
3760
3761         Reviewed by Dean Jackson.
3762
3763         The scrolling thread was always using the layout viewport rect pushed onto it and
3764         never computing a new one, so when scrolling around after zooming position:fixed
3765         elements would not get the expected visual viewport behavior.
3766
3767         Fix by having ScrollingTreeFrameScrollingNode updating its notion of the layout viewport
3768         on scrolls.
3769
3770         Not testable because we can't dump the scrolling tree on Mac (yet).
3771
3772         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3773         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
3774         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3775         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
3776
3777 2016-11-14  Ryosuke Niwa  <rniwa@webkit.org>
3778
3779         document.createElementNS doesn't construct a custom element
3780         https://bugs.webkit.org/show_bug.cgi?id=164700
3781
3782         Reviewed by Darin Adler.
3783
3784         Fixed the bug that document.createElementNS doesn't create a custom element or enqueue it to upgrade.
3785
3786         Also made constructCustomElementSynchronously not call the custom element constructors with the element's
3787         local name as the first argument, which was a non-standard behavior added during prototyping.
3788
3789         Test: fast/custom-elements/DOMImplementation-createDocument.html
3790               fast/custom-elements/document-createElementNS.html
3791
3792         * bindings/js/JSCustomElementInterface.cpp:
3793         (WebCore::JSCustomElementInterface::constructElementWithFallback): Added a variant that takes QualifiedName
3794         instead of AtomicString.
3795         (WebCore::constructCustomElementSynchronously): Don't add the local name as an argument.
3796         * bindings/js/JSCustomElementInterface.h:
3797
3798         * dom/CustomElementRegistry.cpp:
3799         (WebCore::CustomElementRegistry::findInterface): Just find the interface based on the local name after
3800         checking the namespace URI to be that of the XHTML. We need to ignore the prefix for the purpose of looking
3801         up the custom element definition as specified in the latest HTML specification:
3802         https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-element-definition
3803
3804         * dom/DOMImplementation.cpp:
3805         (WebCore::DOMImplementation::createDocument): Added an assertion to make sure we don't invoke scripts while
3806         constructing the document element.
3807
3808         * dom/Document.cpp:
3809         (WebCore::createUpgradeCandidateElement): Made this function create a HTMLUnknownElement instead of returning
3810         nullptr to share more code. Also added a variant which takes QualifiedName.
3811         (WebCore::isValidHTMLElementName): Added; helpers for createHTMLElementWithNameValidation to call isValidName
3812         on Document with the right argument.
3813         (WebCore::createHTMLElementWithNameValidation): Templatized the function to be called with either AtomicString
3814         or QualifiedName for the name.
3815         (WebCore::createFallbackHTMLElement):
3816         (WebCore::Document::createElementNS): Call createHTMLElementWithNameValidation to create a custom element if
3817         possible. This function ends up re-validating the element name before creating a HTMLUnknownElement but that
3818         shouldn't be a common scenario to matter. In fact, createElementNS is a rarely used API.
3819
3820 2016-11-14  Chris Dumez  <cdumez@apple.com>
3821
3822         Avoid copying attributes vector when constructing a CustomElement in HTMLTreeBuilder
3823         https://bugs.webkit.org/show_bug.cgi?id=164734
3824
3825         Reviewed by Ryosuke Niwa.
3826
3827         Avoid copying attributes vector when constructing a CustomElement in HTMLTreeBuilder.
3828
3829         * html/parser/HTMLConstructionSite.cpp:
3830         (WebCore::HTMLConstructionSite::insertCustomElement):
3831         * html/parser/HTMLConstructionSite.h:
3832         * html/parser/HTMLStackItem.h:
3833         (WebCore::HTMLStackItem::HTMLStackItem):
3834         (WebCore::HTMLStackItem::create):
3835         * html/parser/HTMLTreeBuilder.cpp:
3836         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement):
3837
3838 2016-11-14  Chris Dumez  <cdumez@apple.com>
3839
3840         Inline QualifiedName::toString() method
3841         https://bugs.webkit.org/show_bug.cgi?id=164726
3842
3843         Reviewed by Ryosuke Niwa.
3844
3845         Inline QualifiedName::toString() method to limit performance impact of r208674.
3846
3847         * dom/QualifiedName.cpp:
3848         (WebCore::QualifiedName::toString): Deleted.
3849         * dom/QualifiedName.h:
3850         (WebCore::QualifiedName::toString):
3851
3852 2016-11-14  Dave Hyatt  <hyatt@apple.com>
3853
3854         [CSS Parser] Support the font-synthesis property
3855         https://bugs.webkit.org/show_bug.cgi?id=164728
3856
3857         Reviewed by Dean Jackson.
3858
3859         * css/parser/CSSPropertyParser.cpp:
3860         (WebCore::consumeFontSynthesis):
3861         (WebCore::CSSPropertyParser::parseSingleValue):
3862
3863 2016-11-12  Sam Weinig  <sam@webkit.org>
3864
3865         [SVG] Moving more special casing of SVG out of the bindings - SVGNumber/SVGPoint/SVGRect/SVGLength/SVGTransform/SVGMatrix
3866         https://bugs.webkit.org/show_bug.cgi?id=164696
3867
3868         Reviewed by Darin Adler.
3869
3870         - Make SVGNumber, SVGPoint, SVGRect, SVGLength, SVGTransform and SVGMatrix
3871           real classes and stop special casing them in the bindings generator. This 
3872           removes the remaining non-list SVG specializations from the bindings generator.
3873         - Renamed existing SVGLength, SVGTransform and SVGMatrix to SVGLengthValue, 
3874           SVGTransformValue and SVGMatrixValue. There are no SVNumberValue, SVGPointValue 
3875           and SVGRectValue classes, as float, FloatPoint and FloatRect can be used 
3876           directly. Going forward, we can get rid of SVGMatrixValue as well, and just
3877           use AffineTransform, but that will be done in a separate change.
3878
3879         * WebCore.xcodeproj/project.pbxproj:
3880         * CMakeLists.txt:
3881         Add new files.
3882
3883         * bindings/js/JSSVGLengthCustom.cpp:
3884         (WebCore::JSSVGLength::value): Deleted.
3885         (WebCore::JSSVGLength::setValue): Deleted.
3886         (WebCore::JSSVGLength::convertToSpecifiedUnits): Deleted.
3887         Removed. This can now be generated completely.
3888
3889         * bindings/scripts/CodeGenerator.pm:
3890         (SkipIncludeHeader):
3891         Remove special casing of SVGNumber. A header for it now exists.
3892
3893         (GetSVGWrappedTypeNeedingTearOff):
3894         Remove special casing SVGPropertyTearOffs. None remain.
3895
3896         (ShouldPassWrapperByReference):
3897         Allow all tear off types to be passed by reference.
3898
3899         (IsSVGTypeWithWritablePropertiesNeedingTearOff):
3900         Remove now unused function.
3901
3902         * bindings/scripts/CodeGeneratorJS.pm:
3903         (GetImplClassName):
3904         (GenerateHeader):
3905         (GenerateImplementation):
3906         (GenerateParametersCheck):
3907         (GenerateImplementationFunctionCall):
3908         (GetSVGPropertyTypes):
3909         (NativeToJSValue):
3910         (GenerateConstructorDefinition):
3911         Remove non-property tear off specific code. 
3912         
3913         (IsNativeType): 
3914         Remove unused function.
3915
3916         * css/CSSPropertyNames.in:
3917         * css/SVGCSSComputedStyleDeclaration.cpp:
3918         (WebCore::strokeDashArrayToCSSValueList):
3919         (WebCore::ComputedStyleExtractor::svgPropertyValue):
3920         * css/StyleBuilderConverter.h:
3921         (WebCore::StyleBuilderConverter::convertSVGLengthValue):
3922         (WebCore::StyleBuilderConverter::convertSVGLengthVector):
3923         (WebCore::StyleBuilderConverter::convertStrokeDashArray):
3924         * css/StyleBuilderCustom.h:
3925         (WebCore::StyleBuilderCustom::applyValueBaselineShift):
3926         * page/animation/CSSPropertyAnimation.cpp:
3927         (WebCore::blendFunc):
3928         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
3929         * rendering/style/RenderStyle.h:
3930         (WebCore::RenderStyle::strokeDashArray):
3931         (WebCore::RenderStyle::setStrokeDashArray):
3932         (WebCore::RenderStyle::baselineShiftValue):
3933         (WebCore::RenderStyle::setBaselineShiftValue):
3934         (WebCore::RenderStyle::kerning):
3935         (WebCore::RenderStyle::setKerning):
3936         * rendering/style/SVGRenderStyle.h:
3937         (WebCore::SVGRenderStyle::initialStrokeDashArray):
3938         (WebCore::SVGRenderStyle::initialBaselineShiftValue):
3939         (WebCore::SVGRenderStyle::initialKerning):
3940         (WebCore::SVGRenderStyle::setStrokeDashArray):
3941         (WebCore::SVGRenderStyle::setKerning):
3942         (WebCore::SVGRenderStyle::setBaselineShiftValue):
3943         (WebCore::SVGRenderStyle::strokeDashArray):
3944         (WebCore::SVGRenderStyle::kerning):
3945         (WebCore::SVGRenderStyle::baselineShiftValue):
3946         * rendering/style/SVGRenderStyleDefs.h:
3947         Update for name change of SVGLength to SVGLengthValue.
3948
3949         * rendering/svg/RenderSVGImage.cpp:
3950         Remove unused include.
3951
3952         * html/canvas/DOMPath.h:
3953         Add an overload that takes a DOMMatrix, now that it is distinct from
3954         AffineTransform.
3955
3956         * rendering/svg/RenderSVGRoot.cpp:
3957         (WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
3958         Update for name change of SVGPoint to FloatPoint.
3959