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