WebKit-https.git
4 years agoRemove Heap::setMarked()
fpizlo@apple.com [Wed, 14 Sep 2016 20:41:31 +0000 (20:41 +0000)]
Remove Heap::setMarked()

Rubber stamped by Keith Miller.

Nobody uses this function.

* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::setMarked): Deleted.
* heap/LargeAllocation.h:
(JSC::LargeAllocation::testAndSetMarked):
(JSC::LargeAllocation::setMarked): Deleted.
* heap/MarkedBlock.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRename parseColorParameters and clean up conditional
dino@apple.com [Wed, 14 Sep 2016 20:12:14 +0000 (20:12 +0000)]
Rename parseColorParameters and clean up conditional
https://bugs.webkit.org/show_bug.cgi?id=161941
<rdar://problem/28292750>

Reviewed by Dan Bates.

In preparation for adding color() support, rename the existing
parseColorParameters to parseRGBParameters.

Also clean up the logic in the parseColorFromValue function.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseRGBParameters):
(WebCore::CSSParser::parseColorFromValue):
(WebCore::CSSParser::parseColorParameters): Deleted.
* css/parser/CSSParser.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd support hr.color IDL attribute
cdumez@apple.com [Wed, 14 Sep 2016 19:56:03 +0000 (19:56 +0000)]
Add support hr.color IDL attribute
https://bugs.webkit.org/show_bug.cgi?id=161977

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/dom/reflection-grouping-expected.txt:

Source/WebCore:

Add support hr.color IDL attribute as per:
- https://html.spec.whatwg.org/#HTMLHRElement-partial

Even though this is a legacy attribute, it is still part of the HTML specification
and it is still supported by Firefox and Chrome.

Also note that even though WebKit does not currently support the 'color' IDL
attribute on <hr>, it does support the 'color' content attribute on <hr>.
Therefore, we only need to reflect the 'color' content attribute.

No new tests, rebaselined existing test.

* html/HTMLHRElement.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser: Add fast path for hosts containing no non-ASCII or percent characters
achristensen@apple.com [Wed, 14 Sep 2016 19:34:53 +0000 (19:34 +0000)]
URLParser: Add fast path for hosts containing no non-ASCII or percent characters
https://bugs.webkit.org/show_bug.cgi?id=161970

Reviewed by Daniel Bates.

Covered by existing tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
(WebCore::URLParser::parseHost):
* platform/URLParser.h:
When parsing the host of a URL, if it contains non-ASCII characters or percent-encoded values,
we need to do additional encoding.  Many URLs, including all already-parsed URLs, do not have
such characters in their host, and therefore do not need the additional encoding.  Skipping
the additional encoding significantly speeds up my URL parsing benchmark.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205922 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAtomics on ARM don't require full-system fencing, and other minutiae
jfbastien@apple.com [Wed, 14 Sep 2016 18:51:26 +0000 (18:51 +0000)]
Atomics on ARM don't require full-system fencing, and other minutiae
https://bugs.webkit.org/show_bug.cgi?id=161928

Reviewed by Geoffrey Garen.

Add cmpxchg versions with both success and failure memory
ordering. In some interesting cases we can craft code which needs
barriers which aren't as strong.

weakCompareAndSwap is super dubious, its 3 uses seem
questionable... but for now I'm just adding debug asserts.

Rename armv7_dmb* functions to arm_dmb* because they apply to v7
and v8 (or more precisely; to ARMv7's ARM and Thumb2, as well as
ARMv8's aarch32 A32/T32 and aarch64).

Use inner-shareability domain for ARM barriers instead of
full-system. This is what C++ uses.

The default case for barriers simply used a compiler barrier. This
is generally wrong, e.g. for MIPS.

* wtf/Atomics.h:
(WTF::Atomic::compareExchangeWeak): offer two-order version
(WTF::Atomic::compareExchangeStrong): offer two-order version
(WTF::weakCompareAndSwap): a few assertions
(WTF::arm_dmb): rename since it applies to ARMv7 and v8; make it innser-shareable
(WTF::arm_dmb_st): rename since it applies to ARMv7 and v8; make it innser-shareable
(WTF::loadLoadFence): incorrect generally
(WTF::loadStoreFence): incorrect generally
(WTF::storeLoadFence): incorrect generally
(WTF::storeStoreFence): incorrect generally
(WTF::memoryBarrierAfterLock): incorrect generally
(WTF::memoryBarrierBeforeUnlock): incorrect generally
(WTF::armV7_dmb): Deleted.
(WTF::armV7_dmb_st): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205921 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoShowRenderTree should take position offset into account when printing inflow position...
zalan@apple.com [Wed, 14 Sep 2016 18:46:32 +0000 (18:46 +0000)]
ShowRenderTree should take position offset into account when printing inflow positioned renderers.
https://bugs.webkit.org/show_bug.cgi?id=161978

Reviewed by Simon Fraser.

Adjust (x, y) with the inflow positioned renderer's offset.

Not testable.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::showRenderObject):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser: Add fast path for utf8 encoding queries
achristensen@apple.com [Wed, 14 Sep 2016 18:16:29 +0000 (18:16 +0000)]
URLParser: Add fast path for utf8 encoding queries
https://bugs.webkit.org/show_bug.cgi?id=161968

Reviewed by Daniel Bates.

No change in behavior.  Covered by existing tests.

* platform/URLParser.cpp:
(WebCore::utf8PercentEncodeQuery):
(WebCore::URLParser::parse):
If the text encoding is UTF-8 (which is quite common), then we can encode the query
as we iterate its code points. This reduces memory allocation and significantly speeds
up my URL parsing benchmark.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUse Options::validateExceptionChecks() instead of VM::m_verifyExceptionEvents.
mark.lam@apple.com [Wed, 14 Sep 2016 17:55:15 +0000 (17:55 +0000)]
Use Options::validateExceptionChecks() instead of VM::m_verifyExceptionEvents.
https://bugs.webkit.org/show_bug.cgi?id=161975

Reviewed by Keith Miller.

This makes it less burdensome (no longer needs a rebuild to enable checks) to do
incremental work towards enabling checks all the time.

* runtime/Options.h:
* runtime/VM.cpp:
(JSC::VM::verifyExceptionCheckNeedIsSatisfied):
* runtime/VM.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205917 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoTaggedTemplateString function calls should emit tail position calls
commit-queue@webkit.org [Wed, 14 Sep 2016 17:48:13 +0000 (17:48 +0000)]
TaggedTemplateString function calls should emit tail position calls
https://bugs.webkit.org/show_bug.cgi?id=161948

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-14
Reviewed by Yusuke Suzuki.

JSTests:

* stress/tail-call-recognize.js:
(runTests):
Ensure a tagged template string function call is tail call.

* test262.yaml:
These now pass.

Source/JavaScriptCore:

* bytecompiler/NodesCodegen.cpp:
(JSC::TaggedTemplateNode::emitBytecode):
The tagged template string function call can be a tail call:
https://tc39.github.io/ecma262/#sec-tagged-templates-runtime-semantics-evaluation

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205916 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoLong tap menu on an image link no longer includes "Save Image" button
commit-queue@webkit.org [Wed, 14 Sep 2016 17:44:31 +0000 (17:44 +0000)]
Long tap menu on an image link no longer includes "Save Image" button
https://bugs.webkit.org/show_bug.cgi?id=161761
<rdar://27202717>

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-09-14
Reviewed by Beth Dakin.

* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant defaultActionsForImageSheet:]):
Added share to image sheet as to not regress current functionality
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
Gather information for images as well as links, and they can be both

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAlwasys inline atomic operations
jfbastien@apple.com [Wed, 14 Sep 2016 17:11:57 +0000 (17:11 +0000)]
Alwasys inline atomic operations
https://bugs.webkit.org/show_bug.cgi?id=155371

Reviewed by Geoffrey Garen.

Fixes "build fails with memory model cannot be stronger than
success memory model for ‘__atomic_compare_exchange’".

Pre-5 revisions of GCC at Os only generated an error message
related to invalid failure memory ordering. The reason is that
libstdc++ tries to be clever about enforcing the C++ standard's
clause [atomics.types.operations.req] ¶21 which states:

    Requires: The failure argument shall not be
    `memory_order_release` nor `memory_order_acq_rel`. The failure
    argument shall be no stronger than the success argument.

It fails at doing this because its inlining heuristics are
modified by Os, and they're not quite as dumb as O0 but not smart
enough to get to the good code at O1. Adding ALWAYS_INLINE fixes
the silliness at Os, leaves O1 great, and makes O0 slightly less
bad but still pretty bad.

The other good news is that I'm going to get this particular
problem fixed in the version of C++ which will come after C++17:

https://github.com/jfbastien/papers/blob/master/source/P0418r1.bs

While we're at it we should always inline all of these wrapped
functions because the generated code is horrendous if the memory
order isn't known at compile time.

* wtf/Atomics.h:
(WTF::Atomic::load):
(WTF::Atomic::store):
(WTF::Atomic::compareExchangeWeak):
(WTF::Atomic::compareExchangeStrong):
(WTF::Atomic::exchangeAndAdd):
(WTF::Atomic::exchange):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRegression(r152725): generate-bindings.pl --write-dependencies does not work
cdumez@apple.com [Wed, 14 Sep 2016 16:56:34 +0000 (16:56 +0000)]
Regression(r152725): generate-bindings.pl --write-dependencies does not work
https://bugs.webkit.org/show_bug.cgi?id=161897

Reviewed by Darin Adler.

r152725 inadvertently dropped the code generating the JS*.dep files when
--write-dependencies is passed to the bindings generator. As a result,
our dependency tracking was broken. This patch restores the code that
was dropped in r152725.

* bindings/scripts/CodeGeneratorJS.pm:
(new):
(GenerateHeader):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoinput.type cannot be set to "file" after being set to another type
cdumez@apple.com [Wed, 14 Sep 2016 16:56:06 +0000 (16:56 +0000)]
input.type cannot be set to "file" after being set to another type
https://bugs.webkit.org/show_bug.cgi?id=161943

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Rebaseline a couple of W3C tests now that more checks are passing.

* web-platform-tests/html/dom/reflection-forms-expected.txt:
* web-platform-tests/html/semantics/forms/the-input-element/type-change-state-expected.txt:

Source/WebCore:

input.type cannot be set to "file" after being set to another type.
This behavior does not match the HTML specification or the behavior
of Firefox and Chrome. This patch drops this restriction and aligns
our behavior with other browsers.

Test: fast/dom/HTMLInputElement/input-type-change-to-file.html

* html/FileInputType.cpp:
(WebCore::FileInputType::canChangeFromAnotherType): Deleted.
* html/FileInputType.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateType):
* html/InputType.cpp:
(WebCore::InputType::canChangeFromAnotherType): Deleted.
* html/InputType.h:

LayoutTests:

* fast/dom/HTMLInputElement/input-type-change-to-file-expected.txt: Added.
* fast/dom/HTMLInputElement/input-type-change-to-file.html: Added.
* fast/dom/HTMLInputElement/input-type-file-security-expected.txt: Added
* fast/dom/HTMLInputElement/input-type-file-security.html: Added
Add layout test coverage. I have verified that these tests are passing in both
Firefox and Chrome.

* fast/forms/input-type-change3-expected.txt:
* fast/forms/input-type-change3.html:
* fast/forms/input-valueasnumber-unsupported-expected.txt:
* fast/forms/input-valueasnumber-unsupported.html:
Update existing tests to reflect behavior change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205912 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRebaseline tests added with r205905 for ios-simulator.
ryanhaddad@apple.com [Wed, 14 Sep 2016 16:55:15 +0000 (16:55 +0000)]
Rebaseline tests added with r205905 for ios-simulator.

Unreviewed test gardening.

* platform/ios-simulator/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1-expected.txt: Added.
* platform/ios-simulator/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2-expected.txt: Added.
* platform/ios-simulator/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3-expected.txt: Added.
* platform/ios-simulator/fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205911 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agotest262: Array.prototype.slice should always set length
commit-queue@webkit.org [Wed, 14 Sep 2016 16:47:01 +0000 (16:47 +0000)]
test262: Array.prototype.slice should always set length
https://bugs.webkit.org/show_bug.cgi?id=161953

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-14
Reviewed by Mark Lam.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSplice):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205910 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK][Wayland] Implement clipboard support
commit-queue@webkit.org [Wed, 14 Sep 2016 16:45:48 +0000 (16:45 +0000)]
[GTK][Wayland] Implement clipboard support
https://bugs.webkit.org/show_bug.cgi?id=146574

Patch by Carlos Garnacho <carlosg@gnome.org> on 2016-09-14
Reviewed by Carlos Garcia Campos.

Source/WebCore:

Implement PlatformPasteboard in the GTK+ platform, and move Pasteboard
to using PasteboardStrategy so clipboard management is left to the
UIProcess.

DataObjectGtk is still used in the Pasteboard GTK implementation, it's
now just never backed by a GtkClipboard, this object is instead
serialized through PasteboardStrategy, so the UIProcess side can mirror
the content in a GtkClipboard-backed DataObjectGtk, which is then
exposed to the windowing through PlatformPasteboard/PasteboardHelper.

When requesting clipboard content, it works similarly, the UIProcess
side first updates its DataObjectGtk, which is then mirrored by the
WebProcess through the PasteboardStrategy requests.

* PlatformGTK.cmake: Added PlatformPasteboardGtk.cpp
* editing/gtk/EditorGtk.cpp:
(WebCore::Editor::writeSelectionToPasteboard): Eliminate usage of
PasteboardWebContent callback argument. This is done differently as
we have to signal back the WebProcess.
* platform/Pasteboard.h: Cleaned up of direct GTK+ dependency.
* platform/PasteboardStrategy.h: Added plumbing towards the pasteboard
proxy.
* platform/PlatformPasteboard.h:
* platform/gtk/DataObjectGtk.cpp:
(WebCore::DataObjectGtk::clearAllExceptFilenames): Clear the "smart
paste" flag if set, now that this is DataObjectGtk data.
* platform/gtk/DataObjectGtk.h:
(WebCore::DataObjectGtk::canSmartReplace):
(WebCore::DataObjectGtk::setCanSmartReplace): Added functions, in order
to flag whether a DataObjectGtk has the "smart paste" feature enabled
or not.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::createForCopyAndPaste):
(WebCore::Pasteboard::createForGlobalSelection):
(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::writeToClipboard):
(WebCore::Pasteboard::readFromClipboard):
(WebCore::Pasteboard::writePlainText):
(WebCore::Pasteboard::write):
(WebCore::Pasteboard::writePasteboard):
(WebCore::Pasteboard::clear):
(WebCore::Pasteboard::canSmartReplace):
(WebCore::Pasteboard::read):
(WebCore::Pasteboard::hasData):
(WebCore::Pasteboard::types):
(WebCore::Pasteboard::readString):
(WebCore::Pasteboard::readFilenames): Made to use the
PasteboardStrategy instead of PasteboardHelper/GTK+ API.
* platform/gtk/PasteboardHelper.cpp:
(WebCore::PasteboardHelper::~PasteboardHelper):
(WebCore::ClipboardSetData::ClipboardSetData):
(WebCore::clearClipboardContentsCallback):
(WebCore::PasteboardHelper::writeClipboardContents): Remove the GClosure
to notify whether the global selection has been replaced. Use std:function
instead. Remove SmartPasteInclusion argument, now figured out through
DataObjectGtk canSmartPaste() member.
* platform/gtk/PasteboardHelper.h:
* platform/gtk/PlatformPasteboardGtk.cpp: Added.
(WebCore::PlatformPasteboard::PlatformPasteboard):
(WebCore::PlatformPasteboard::writeToClipboard):
(WebCore::PlatformPasteboard::readFromClipboard): Implemented
PlatformPasteboard using PasteboardHelper/GTK+ API.

Source/WebKit2:

Add the necessary plumbing for the GTK+ backend to use the
PlatformPasteboard in WebCore. All selection data is transmitted
at once through the serialization of PasteboardContentGtk/DataObjectGtk.

* PlatformGTK.cmake: Add PasteboardContentGtk.cpp and
WebPasteboardProxyGtk.cpp
* Shared/gtk/ArgumentCodersGtk.cpp:
(IPC::encode):
(IPC::decode): Renamed from encodeDataObject/decodeDataObject
and made public.
(IPC::ArgumentCoder<DragData>::encode):
(IPC::ArgumentCoder<DragData>::decode): Update DataObjectGtk
encode/decode callers. Encode the extra canSmartReplace field.
* Shared/gtk/ArgumentCodersGtk.h: Expose encode/decode methods for
DataObjectGtk.
* Shared/gtk/PasteboardContent.cpp: Added. Wraps a DataObjectGtk
so it can be serialized on WebProcess/UIProcess messaging.
(WebKit::PasteboardContent::PasteboardContent):
(WebKit::PasteboardContent::encode):
(WebKit::PasteboardContent::decode): Methods to encode/decode a
PasteboardContent.
* Shared/gtk/PasteboardContent.h: Added.
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::collapseSelection): Added plumbing to allow
collapsing the global selection from the UI process side.
* UIProcess/WebFrameProxy.h:
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in: Added plumbing for the
GTK+ pasteboard proxy functions.
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/gtk/WebPasteboardProxyGtk.cpp: Added.
(WebKit::WebPasteboardProxy::writeToClipboard):
(WebKit::WebPasteboardProxy::readFromClipboard): Implemented functions
hooking into the PlatformPasteboard. Per-selection (ie.
primary/clipboard) PlatformPasteboards are kept at this level, so those
are independently set and dealt with.
(WebKit::WebPasteboardProxy::setPrimarySelectionOwner):
(WebKit::WebPasteboardProxy::didDestroyFrame): Implemented functions
to manage the frame currently being currently interacted, so we can
signal back when the global selection has been replaced.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::writeToClipboard):
(WebKit::WebPlatformStrategies::readFromClipboard): Added methods to
send the WebProcess->UIProcess messages.
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::updateGlobalSelection): Remove GClosure to
get notifications about changes in global selection ownership. This
is done through a WebPage message now, as the UI process manages the
clipboard.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::collapseSelectionInFrame): Added methods to send
the UIProcess->WebProcess notification that the global selection has
been replaced.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205909 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoLayoutTest http/tests/security/cross-origin-cached-scripts-parallel.html is a flaky...
commit-queue@webkit.org [Wed, 14 Sep 2016 16:40:13 +0000 (16:40 +0000)]
LayoutTest http/tests/security/cross-origin-cached-scripts-parallel.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=161912

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-14
Reviewed by Alexey Proskuryakov.

* TestExpectations: Removing flaky expectation.
* http/tests/security/cross-origin-cached-scripts-parallel-expected.txt:
* http/tests/security/cross-origin-cached-scripts-parallel.html: Increase timeout to ensure load is made in parallel.
Fixed flakiness by doing parallel loads in two shots of two, in lieu of 1 shot of 4.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205908 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarking inspector/console/messagesCleared.html as flaky on mac-debug.
ryanhaddad@apple.com [Wed, 14 Sep 2016 16:23:00 +0000 (16:23 +0000)]
Marking inspector/console/messagesCleared.html as flaky on mac-debug.
https://bugs.webkit.org/show_bug.cgi?id=152025

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205907 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarking fast/scrolling/arrow-key-scroll-in-rtl-document.html as flaky on mac-wk2.
ryanhaddad@apple.com [Wed, 14 Sep 2016 16:22:57 +0000 (16:22 +0000)]
Marking fast/scrolling/arrow-key-scroll-in-rtl-document.html as flaky on mac-wk2.
https://bugs.webkit.org/show_bug.cgi?id=161549

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205906 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[CSS Parser] Enable the new sizes parser by default
hyatt@apple.com [Wed, 14 Sep 2016 15:54:54 +0000 (15:54 +0000)]
[CSS Parser] Enable the new sizes parser by default
https://bugs.webkit.org/show_bug.cgi?id=161931

Reviewed by Zalan Bujtas.

Source/WebCore:

Added new tests in fast/dom/HTMLImageElement/sizes.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSGrammar.y.in:
Remove the old code that parsed source size lists.

* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
* css/MediaQueryEvaluator.h:
Change to take a const Document&, since the Document is not modified.

* css/SourceSizeList.cpp: Removed.
* css/SourceSizeList.h: Removed.
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSizesAttribute): Deleted.
(WebCore::CSSParser::SourceSize::SourceSize): Deleted.
(WebCore::CSSParser::sourceSize): Deleted.
* css/parser/CSSParser.h:
Remove the old sizes processing code.

* css/parser/MediaQueryParser.cpp:
(WebCore::MediaQueryParser::skipUntilComma):
(WebCore::MediaQueryParser::parseInternal):
Fix a bug I introduced when modifying this code from Blink. The Nones should have been Nots.

* css/parser/SizesAttributeParser.cpp:
(WebCore::SizesAttributeParser::computeLength):
(WebCore::SizesAttributeParser::SizesAttributeParser):
(WebCore::SizesAttributeParser::calculateLengthInPixels):
(WebCore::SizesAttributeParser::mediaConditionMatches):
(WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
* css/parser/SizesAttributeParser.h:
* css/parser/SizesCalcParser.cpp:
(WebCore::SizesCalcParser::SizesCalcParser):
(WebCore::SizesCalcParser::appendLength):
* css/parser/SizesCalcParser.h:
Make the sizes parsers take a Document, since having separate style and view arguments made
no sense, given that the style used is always the view's.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
(WebCore::HTMLImageElement::selectImageSource):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
Switch image elements and the preload scanner over to the new code.

LayoutTests:

* fast/dom/HTMLImageElement/resources/green-16x16.png: Added.
* fast/dom/HTMLImageElement/resources/green-1x1.png: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-invalids-expected.txt:
* fast/dom/HTMLImageElement/sizes/image-sizes-invalids.html:
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1-expected.txt: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-1.html: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2-expected.txt: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-2.html: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3-expected.txt: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-3.html: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4-expected.txt: Added.
* fast/dom/HTMLImageElement/sizes/image-sizes-w3c-4.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205905 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix mastercfg_unittest
jbedard@apple.com [Wed, 14 Sep 2016 15:16:04 +0000 (15:16 +0000)]
Fix mastercfg_unittest
https://bugs.webkit.org/show_bug.cgi?id=161816

Reviewed by Daniel Bates.

(RunWebKitTests.start):
* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py: Fixed broken unit tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205904 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarking imported/w3c/web-platform-tests/XMLHttpRequest/response-method.htm as failing...
ryanhaddad@apple.com [Wed, 14 Sep 2016 06:06:34 +0000 (06:06 +0000)]
Marking imported/w3c/web-platform-tests/XMLHttpRequest/response-method.htm as failing on ios-simulator.
https://bugs.webkit.org/show_bug.cgi?id=161949

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205901 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRebaseline imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content...
ryanhaddad@apple.com [Wed, 14 Sep 2016 06:02:31 +0000 (06:02 +0000)]
Rebaseline imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm for ios-simulator.

Unreviewed test gardening.

* platform/ios-simulator/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205900 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMore unreviewed test gardening for iOS 10.
ryanhaddad@apple.com [Wed, 14 Sep 2016 05:58:15 +0000 (05:58 +0000)]
More unreviewed test gardening for iOS 10.

* platform/ios-simulator/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205899 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed test gardening for iOS 10.
ryanhaddad@apple.com [Wed, 14 Sep 2016 05:26:57 +0000 (05:26 +0000)]
Unreviewed test gardening for iOS 10.

* platform/ios-simulator/TestExpectations:
* platform/ios-simulator/editing/deleting/delete-emoji-expected.txt:
* platform/ios-simulator/fast/text/font-weights-expected.txt:
* platform/ios-simulator/fast/text/system-font-weight-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, rolling out r205887.
cdumez@apple.com [Wed, 14 Sep 2016 04:56:56 +0000 (04:56 +0000)]
Unreviewed, rolling out r205887.

Broke the Windows build

Reverted changeset:

"Merge Element::ScrollToOptions and
DOMWindow::ScrollToOptions"
https://bugs.webkit.org/show_bug.cgi?id=161932
http://trac.webkit.org/changeset/205887

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205897 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRebaseline js/dom/global-constructors-attributes.html for Yosemite.
ryanhaddad@apple.com [Wed, 14 Sep 2016 04:11:51 +0000 (04:11 +0000)]
Rebaseline js/dom/global-constructors-attributes.html for Yosemite.

Unreviewed test gardening.

* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoPromises aren't resolved properly when making a ObjC API callback
msaboff@apple.com [Wed, 14 Sep 2016 02:29:22 +0000 (02:29 +0000)]
Promises aren't resolved properly when making a ObjC API callback
https://bugs.webkit.org/show_bug.cgi?id=161929

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

When we go to call out to an Objective C function registered via the API,
we first drop all JSC locks to make the call.  As part of dropping the locks,
we drain the microtask queue that is used among other things for handling deferred
promise resolution.  The DropAllLocks scope class that drops the locks while in
scope, resets the current thread's AtomicStringTable to the default table.  This
is wrong for two reasons, first it happens before we drain the microtask queue and
second it isn't needed as JSLock::willReleaseLock() restores the current thread's
AtomicStringTable to the table before the lock was acquired.

In fact, the manipulation of the current thread's AtomicStringTable is already
properly handled as a stack in JSLock::didAcquireLock() and willReleaseLock().
Therefore the manipulation of the AtomicStringTable in DropAllLocks constructor
and destructor should be removed.

* API/tests/testapi.mm:
(testObjectiveCAPIMain): Added a new test.
* runtime/JSLock.cpp:
(JSC::JSLock::DropAllLocks::DropAllLocks):
(JSC::JSLock::DropAllLocks::~DropAllLocks):

Source/WTF:

Removed resetCurrentAtomicStringTable() which is no longer referenced.

* wtf/WTFThreadData.h:
(WTF::WTFThreadData::resetCurrentAtomicStringTable): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205895 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove a .rej file.
dino@apple.com [Wed, 14 Sep 2016 02:22:35 +0000 (02:22 +0000)]
Remove a .rej file.

* animation/DocumentTimeline.h.rej: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205894 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoImplement URLSearchParams
achristensen@apple.com [Wed, 14 Sep 2016 01:34:27 +0000 (01:34 +0000)]
Implement URLSearchParams
https://bugs.webkit.org/show_bug.cgi?id=161920

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/send-usp-expected.txt:
* web-platform-tests/fetch/api/request/request-init-002-expected.txt:
* web-platform-tests/fetch/api/response/response-init-002-expected.txt:
* web-platform-tests/url/interfaces-expected.txt:
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/urlsearchparams-append-expected.txt:
* web-platform-tests/url/urlsearchparams-constructor-expected.txt:
* web-platform-tests/url/urlsearchparams-delete-expected.txt:
* web-platform-tests/url/urlsearchparams-get-expected.txt:
* web-platform-tests/url/urlsearchparams-getall-expected.txt:
* web-platform-tests/url/urlsearchparams-has-expected.txt:
* web-platform-tests/url/urlsearchparams-set-expected.txt:
* web-platform-tests/url/urlsearchparams-stringifier-expected.txt:

Source/WebCore:

Covered by newly passing web platform tests.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* html/DOMURL.cpp:
(WebCore::DOMURL::setQuery):
(WebCore::DOMURL::searchParams):
* html/DOMURL.h:
* html/URLSearchParams.cpp: Added.
(WebCore::URLSearchParams::URLSearchParams):
(WebCore::URLSearchParams::get):
(WebCore::URLSearchParams::has):
(WebCore::URLSearchParams::set):
(WebCore::URLSearchParams::append):
(WebCore::URLSearchParams::getAll):
(WebCore::URLSearchParams::remove):
(WebCore::URLSearchParams::toString):
(WebCore::URLSearchParams::updateURL):
(WebCore::URLSearchParams::Iterator::Iterator):
* html/URLSearchParams.h: Added.
(WebCore::URLSearchParams::create):
(WebCore::URLSearchParams::createIterator):
* html/URLSearchParams.idl: Added.
* html/URLUtils.idl:
* platform/URLParser.cpp:
(WebCore::percentDecode):
(WebCore::URLParser::parseHost):
(WebCore::formURLDecode):
(WebCore::serializeURLEncodedForm):
(WebCore::URLParser::serialize):
* platform/URLParser.h:

Source/WTF:

* wtf/text/StringView.h:
(WTF::StringView::split): Added.

LayoutTests:

* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205893 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoReplace RGBA32 with Color in member variables
dino@apple.com [Wed, 14 Sep 2016 00:38:57 +0000 (00:38 +0000)]
Replace RGBA32 with Color in member variables
https://bugs.webkit.org/show_bug.cgi?id=161856
<rdar://problem/28254324>

Reviewed by Simon Fraser.

In preparation for the Color class to become more than
just a 4-byte RGBA value, I went through a few places
that were using the RGBA32 type directly, and replaced
them with Color. This will make some objects a little
bigger e.g. BorderValue and its friends.

I mostly looked at the places that were using RGBA32 as
a member variable. There is still a lot of RGBA32 use
around the project, in particular the CSS parser.

There should be no behaviour change.

Source/WebCore:

* html/canvas/CanvasRenderingContext2D.cpp: Shadows now use Color.
(WebCore::CanvasRenderingContext2D::setShadow):
(WebCore::CanvasRenderingContext2D::shouldDrawShadows):
(WebCore::CanvasRenderingContext2D::didDraw):
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasStyle.cpp: Canvas style uses Color for fills and strokes.
(WebCore::CanvasStyle::CanvasStyle):
(WebCore::CanvasStyle::isEquivalentColor):
(WebCore::CanvasStyle::isEquivalentRGBA):
(WebCore::CanvasStyle::applyStrokeColor):
(WebCore::CanvasStyle::applyFillColor):
* html/canvas/CanvasStyle.h:
(WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
(WebCore::CanvasStyle::color):

* html/track/TextTrackCueGeneric.h: Foreground, background and
highlight colors.
* platform/graphics/InbandTextTrackPrivateClient.h:
(WebCore::GenericCueData::setForegroundColor):
(WebCore::GenericCueData::setBackgroundColor):
(WebCore::GenericCueData::setHighlightColor):

* page/PageOverlay.cpp: Background color.
(WebCore::PageOverlay::setBackgroundColor):
* page/PageOverlay.h:

* platform/graphics/mac/ColorMac.h: Random function that returned RGBA32.
* platform/graphics/mac/ColorMac.mm:
(WebCore::oldAquaFocusRingColor):

* rendering/RenderTableCell.cpp: Update the size of CollapsedBorderValue.

* rendering/RenderTheme.h: Use a NeverDestroyed Color rather than a static RGBA32.

* rendering/style/BorderValue.h: Use a Color.
(WebCore::BorderValue::BorderValue):
(WebCore::BorderValue::isTransparent):
(WebCore::BorderValue::operator==):
(WebCore::BorderValue::setColor):
(WebCore::BorderValue::color):
* rendering/style/CollapsedBorderValue.h:
(WebCore::CollapsedBorderValue::CollapsedBorderValue):
(WebCore::CollapsedBorderValue::color):
* rendering/style/OutlineValue.h:
(WebCore::OutlineValue::operator==):

* rendering/style/RenderStyle.cpp: Update to match new BorderValue.

Source/WebKit/mac:

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Explicitly
call a Color constructor, rather than passing an RGBA32.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205892 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[media-source] MediaSource.addSourceBuffer(null) should throw an exception
jer.noble@apple.com [Wed, 14 Sep 2016 00:11:42 +0000 (00:11 +0000)]
[media-source] MediaSource.addSourceBuffer(null) should throw an exception
https://bugs.webkit.org/show_bug.cgi?id=161884

Reviewed by Eric Carlson.

Source/WebCore:

Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer.html

* Modules/mediasource/MediaSource.idl: The addSourceBuffer() parameter is not optional
    and not nullable.

LayoutTests:

* platform/mac/TestExpectations:
* platform/mac/imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205890 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove Chrome app-specific CSS property -webkit-app-region
dbates@webkit.org [Wed, 14 Sep 2016 00:10:50 +0000 (00:10 +0000)]
Remove Chrome app-specific CSS property -webkit-app-region
https://bugs.webkit.org/show_bug.cgi?id=161935

Reviewed by Simon Fraser.

* css/parser/CSSParserFastPaths.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoTreat some CSS properties as keyword properties
dbates@webkit.org [Wed, 14 Sep 2016 00:10:21 +0000 (00:10 +0000)]
Treat some CSS properties as keyword properties
https://bugs.webkit.org/show_bug.cgi?id=161934

Reviewed by Simon Fraser.

Move validation of the following CSS keyword properties from CSSParser::parseValue() to
WebCore::isValidKeywordPropertyAndValue():

CSSPropertyColumnProgression
CSSPropertyFontStretch
CSSPropertyTextAlign
CSSPropertyUnicodeBidi
CSSPropertyWebkitColumnAxis
CSSPropertyWebkitCursorVisibility
CSSPropertyWebkitTextDecorationStyle
CSSPropertyWebkitTextOrientation
CSSPropertyWebkitTextZoom
CSSPropertyWebkitTouchCallout

Among other benefits, this will make it more straightforward to migrate from CSSParser::is{KeywordPropertyID, ValidKeywordPropertyAndValue}()
to CSSParserFastPaths::is{KeywordPropertyID, ValidKeywordPropertyAndValue}(), respectively.

* css/parser/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205888 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMerge Element::ScrollToOptions and DOMWindow::ScrollToOptions
cdumez@apple.com [Tue, 13 Sep 2016 23:27:47 +0000 (23:27 +0000)]
Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
https://bugs.webkit.org/show_bug.cgi?id=161932

Reviewed by Simon Fraser.

Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
Ideally we would merge them on IDL side as well but this is for
another patch.

* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
(WebCore::convertDictionary<AlternateDictionaryName>):
* dom/Element.h:
* dom/Element.idl:
* dom/ScrollToOptions.h: Added.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::scrollTo):
* page/DOMWindow.h:
* page/DOMWindow.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205887 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove Heap::isLive()
fpizlo@apple.com [Tue, 13 Sep 2016 23:19:48 +0000 (23:19 +0000)]
Remove Heap::isLive()
https://bugs.webkit.org/show_bug.cgi?id=161933

Reviewed by Mark Lam.

Before I put any more effort into maintaining this weird function, I decided to check how it
was used. It turns out it's not.

* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::isLive): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoLanding optimized .png files, forgot to do it initially.
ap@apple.com [Tue, 13 Sep 2016 23:13:51 +0000 (23:13 +0000)]
Landing optimized .png files, forgot to do it initially.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10@2x.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10Simulator.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSDevice.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSDevice@2x.png:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205885 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSwitch build.webkit.org to iOS 10
ap@apple.com [Tue, 13 Sep 2016 23:08:54 +0000 (23:08 +0000)]
Switch build.webkit.org to iOS 10
https://bugs.webkit.org/show_bug.cgi?id=161930

Reviewed by Daniel Bates.

* BuildSlaveSupport/build.webkit.org-config/config.json:
* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(RunWebKitTests.start):
* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10@2x.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10Simulator.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOS10Simulator@2x.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSDevice.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSDevice@2x.png:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSSimulator.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Images/IOSSimulator@2x.png: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueServer.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
* BuildSlaveSupport/build.webkit.org-config/wkbuild.py:
* BuildSlaveSupport/build.webkit.org-config/wkbuild_unittest.py:
* Scripts/webkitpy/port/ios.py:
* TestResultServer/static-dashboards/builders.jsonp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205884 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS
mmaxfield@apple.com [Tue, 13 Sep 2016 22:38:46 +0000 (22:38 +0000)]
[Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS
https://bugs.webkit.org/show_bug.cgi?id=161877

Reviewed by Simon Fraser.

Source/WebCore:

macOS and iOS have slightly different handling of ascent, descent, and x-height.
This patch migrates them to have the same handling of them.

There are slight behavior changes here because our previous code converted between
floats and doubles in unnecessary places, and does not handle rounding in
consistent ways. The differences are all miniscule, but nevertheless lead to test
results needing to be updated.

Coincidentally, by performing this unification, there are no longer any places
on macOS Sierra which are using the CGFontRef member of PlatformFontData. This
patch removes the member on that operating system for memory savings as well as
clarity.

Covered by existing tests.

* platform/graphics/FontPlatformData.cpp:
* platform/graphics/FontPlatformData.h:
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformInit):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::platformIsEqual):
(WebCore::FontPlatformData::ctFont):

LayoutTests:

Updating expected results.

* imported/blink/svg/text/obb-paintserver-expected.html: Covered tiny unrelated 1px difference.
* imported/blink/svg/text/obb-paintserver.html: Ditto.
* platform/ios-simulator/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.txt:
* platform/ios-simulator/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.txt:
* platform/ios-simulator/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.txt:
* platform/ios-simulator/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.txt:
* platform/ios-simulator/fast/text/whitespace/pre-wrap-spaces-after-newline-expected.txt:
* platform/ios-simulator/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt:
* platform/ios-simulator/svg/custom/glyph-transformation-with-hkern-expected.txt: Copied from LayoutTests/svg/custom/glyph-transformation-with-hkern-expected.txt.
* platform/ios-simulator/svg/custom/repaint-shadow-expected.txt: Copied from LayoutTests/svg/custom/repaint-shadow-expected.txt.
* platform/ios-simulator/svg/text/text-hkern-on-vertical-text-expected.txt: Copied from LayoutTests/svg/text/text-hkern-on-vertical-text-expected.txt.
* platform/ios-simulator/svg/text/text-vkern-on-horizontal-text-expected.txt: Copied from LayoutTests/svg/text/text-vkern-on-horizontal-text-expected.txt.
* platform/ios-simulator/tables/mozilla/bugs/bug55527-expected.txt:
* platform/mac-yosemite/fast/text/emoji-expected.txt:
* platform/mac-yosemite/svg/W3C-SVG-1.1-SE/text-intro-05-t-expected.txt:
* platform/mac/css2.1/t1202-counter-04-b-expected.txt:
* platform/mac/css2.1/t1202-counters-04-b-expected.txt:
* platform/mac/fast/text/emoji-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/color-prop-05-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-03-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-04-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-units-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/filters-image-03-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/interact-pointer-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/painting-marker-07-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/paths-dom-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-17-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/pservers-grad-20-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-03-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/struct-use-14-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/styling-css-04-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/styling-pres-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/svgdom-over-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/text-intro-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/text-intro-05-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/text-intro-09-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/text-tref-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/text-tspan-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-05-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-06-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-24-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-36-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-light-04-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-turb-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/fonts-elem-05-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/fonts-elem-06-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/fonts-glyph-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/fonts-glyph-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/render-elems-06-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/render-elems-07-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/render-elems-08-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-align-08-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-fonts-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt:
* platform/mac/svg/batik/text/xmlSpace-expected.txt:
* platform/mac/svg/custom/glyph-selection-bidi-mirror-expected.txt:
* platform/mac/svg/custom/glyph-setting-d-attribute-expected.txt:
* platform/mac/svg/foreignObject/text-tref-02-b-expected.txt:
* platform/mac/svg/text/kerning-expected.txt:
* platform/mac/svg/text/multichar-glyph-expected.txt:
* svg/custom/glyph-transformation-with-hkern-expected.txt:
* svg/custom/repaint-shadow-expected.txt:
* svg/text/text-hkern-on-vertical-text-expected.txt:
* svg/text/text-vkern-on-horizontal-text-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205883 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoDFG NewArrayBuffer node should watch for "have a bad time" state change.
mark.lam@apple.com [Tue, 13 Sep 2016 22:16:25 +0000 (22:16 +0000)]
DFG NewArrayBuffer node should watch for "have a bad time" state change.
https://bugs.webkit.org/show_bug.cgi?id=161927
<rdar://problem/27995222>

Reviewed by Geoffrey Garen.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Unreviewed build fix.
bfulgham@apple.com [Tue, 13 Sep 2016 21:56:55 +0000 (21:56 +0000)]
[Win] Unreviewed build fix.

Based on a suggestion by Simon Fraser, I have corrected the
headers to avoid including <d2d1.h> directly, relying instead
on forward declarations.

* platform/graphics/FloatPoint.h:
* platform/graphics/FloatRect.h:
* platform/graphics/FloatSize.h:
* platform/graphics/IntPoint.h:
* platform/graphics/IntRect.h:
* platform/graphics/IntSize.h:
* platform/graphics/transforms/AffineTransform.h:
* platform/graphics/transforms/TransformationMatrix.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205881 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSupport jsc shell builtin `read`
jfbastien@apple.com [Tue, 13 Sep 2016 21:53:11 +0000 (21:53 +0000)]
Support jsc shell builtin `read`
https://bugs.webkit.org/show_bug.cgi?id=161662

Reviewed by Keith Miller.

JSTests:

* stress/jsc-read.js: Added.
(test): test `read` and `readFile` shell builtins, in string and binary mode.

Source/JavaScriptCore:

The jsc shell currently supports a `readFile` method which returns
a string. SpiderMonkey's js shell and V8's d8 shell both support
similar file-to-string functions, as well as a
binary-file-to-Uint8Array function. jsc should support a similar
binary file method to simplify testing, including testing of
WebAssembly blobs.

Emscripten's shell.js (which is also used for some WebAssembly
things) has a polyfill [1] for a builtin called `read`. jsc should
therefore have a builtin with the same name if we want things to
"Just Work".

  [1]: https://github.com/kripken/emscripten/blob/5f0918409a1407dd168f57cfa34b109cd1770a8a/src/shell.js#L138

* jsc.cpp:
(GlobalObject::finishCreation): add `read`, make `readFile` take up to 2 arguments.
(functionReadFile): support binary files, as per SpiderMonkey.
* runtime/Error.h:
(JSC::throwVMError): convenience function, I'll add more uses in a follow-up
* runtime/JSTypedArrays.cpp:
(JSC::createUint8TypedArray): JS private export of JSUint8Array::create.
* runtime/JSTypedArrays.h: expose private export.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205880 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoProvide a mechanism to specify the maximum size of WKThumbnailView snapshots
timothy_horton@apple.com [Tue, 13 Sep 2016 21:09:35 +0000 (21:09 +0000)]
Provide a mechanism to specify the maximum size of WKThumbnailView snapshots
https://bugs.webkit.org/show_bug.cgi?id=161896
<rdar://problem/28229827>

Reviewed by Simon Fraser.

Some clients know that their thumbnail views will only be displayed up to
a specific size that is significantly smaller than the WKView size. Allow
them to avoid wasting lots of memory on unnecessarily large snapshots.

* UIProcess/API/Cocoa/_WKThumbnailView.h:
* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView requestSnapshot]):
(-[_WKThumbnailView _requestSnapshotIfNeeded]):
(-[_WKThumbnailView setMaximumSnapshotSize:]):
Add a maximumSnapshotSize property which can be changed dynamically.

* TestWebKitAPI/Tests/WebKit2/WKThumbnailView.mm:
(TestWebKitAPI::TEST):
Add a test for the new property.
Also fix the old new test to run on arbitrary scale displays without failing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205878 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoGet rid of the m_premultiplyAlpha flag of the ImageFrame class
commit-queue@webkit.org [Tue, 13 Sep 2016 20:56:22 +0000 (20:56 +0000)]
Get rid of the m_premultiplyAlpha flag of the ImageFrame class
https://bugs.webkit.org/show_bug.cgi?id=159721

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-09-13
Reviewed by Simon Fraser.

This flag was only needed when calling ImageBackingStore::create() in
ImageFrame::setSize(). Instead we can pass ImageDecoder::m_premultiplyAlpha
to ImageFrame::setSize(), which is renamed ImageFrame::initializeBackingStore().
The passed premultiplyAlpha can then be passed to ImageBackingStore::create().

* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageFrame::ImageFrame):
(WebCore::ImageFrame::operator=):
(WebCore::ImageFrame::initializeBackingStore):
(WebCore::ImageFrame::copyBitmapData): Deleted.
(WebCore::ImageFrame::setSize): Deleted.
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageFrame::disposalMethod):
(WebCore::ImageFrame::setDisposalMethod):
(WebCore::ImageDecoder::premultiplyAlpha):
(WebCore::ImageFrame::premultiplyAlpha): Deleted.
(WebCore::ImageFrame::setPremultiplyAlpha): Deleted.
* platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::frameBufferAtIndex):
* platform/image-decoders/bmp/BMPImageReader.cpp:
(WebCore::BMPImageReader::decodeBMP):
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::decode):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::frameCount):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::frameBufferAtIndex):
(WebCore::JPEGImageDecoder::outputScanlines):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::frameBufferAtIndex):
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::readChunks):
(WebCore::PNGImageDecoder::initFrameBuffer):
(WebCore::setPixelRGB): Deleted.
(WebCore::setPixelRGBA): Deleted.
(WebCore::setPixelPremultipliedRGBA): Deleted.
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::frameBufferAtIndex):
(WebCore::WEBPImageDecoder::decode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoREGRESSION (r196321): Amazon Videos are all black in Fullscreen
andersca@apple.com [Tue, 13 Sep 2016 20:14:04 +0000 (20:14 +0000)]
REGRESSION (r196321): Amazon Videos are all black in Fullscreen
https://bugs.webkit.org/show_bug.cgi?id=161924
rdar://problem/28208208

Reviewed by Dan Bernstein.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(main):
Set AppleMagnifiedMode to true.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205873 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Use Array.shallowEqual instead of Object.shallowEqual in more places
mattbaker@apple.com [Tue, 13 Sep 2016 20:12:07 +0000 (20:12 +0000)]
Web Inspector: Use Array.shallowEqual instead of Object.shallowEqual in more places
https://bugs.webkit.org/show_bug.cgi?id=161867
<rdar://problem/28261328>

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

* UserInterface/Base/Utilities.js:
(value):
Array.shallowEqual should return false if passed a non-array.

* UserInterface/Models/CSSRule.js:
(WebInspector.CSSRule.prototype.update):
* UserInterface/Models/Color.js:
(WebInspector.Color.prototype.isKeyword):
* UserInterface/Models/DOMNodeStyles.js:
(WebInspector.DOMNodeStyles.prototype.refresh.fetchedComputedStyle):
(WebInspector.DOMNodeStyles.prototype.refresh):
* UserInterface/Models/Geometry.js:
(WebInspector.CubicBezier.prototype.toString):
* UserInterface/Views/GeneralTreeElement.js:
(WebInspector.GeneralTreeElement.prototype.set classNames):
* UserInterface/Views/NewTabContentView.js:
(WebInspector.NewTabContentView.prototype._updateShownTabs):
Prefer Array.shallowEqual over Obejct.shallowEqual if the arguments
will always be arrays.

LayoutTests:

* inspector/unit-tests/array-utilities-expected.txt:
* inspector/unit-tests/array-utilities.html:
Add test coverage for Array.shallowEqual.
Use Array.shallowEqual instead of JSON.stringify in tests.
Use expectFalse and expectEqual in tests where appropriate.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205872 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
bfulgham@apple.com [Tue, 13 Sep 2016 19:54:53 +0000 (19:54 +0000)]
[Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
https://bugs.webkit.org/show_bug.cgi?id=161818

Reviewed by Dean Jackson.

Source/WebCore:

Tested by new TestWebKitAPI tests.

Add new casting operators to and from various Direct2D data types.

* PlatformWin.cmake:
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::FloatPoint):
* platform/graphics/FloatRect.h:
* platform/graphics/FloatSize.h:
(WebCore::FloatSize::FloatSize):
* platform/graphics/IntPoint.h:
* platform/graphics/IntRect.h:
* platform/graphics/IntSize.h:
* platform/graphics/transforms/AffineTransform.h:
* platform/graphics/transforms/TransformationMatrix.h:
* platform/graphics/win/FloatPointDirect2D.cpp:
* platform/graphics/win/FloatRectDirect2D.cpp:
* platform/graphics/win/FloatSizeDirect2D.cpp:
* platform/graphics/win/IntPointWin.cpp:
(WebCore::IntPoint::IntPoint):
(WebCore::IntPoint::operator D2D1_POINT_2F):
(WebCore::IntPoint::operator D2D1_POINT_2U):
* platform/graphics/win/IntRectWin.cpp:
(WebCore::IntRect::IntRect):
(WebCore::IntRect::operator D2D1_RECT_F):
(WebCore::IntRect::operator D2D1_RECT_U):
* platform/graphics/win/IntSizeWin.cpp:
(WebCore::IntSize::IntSize):
(WebCore::IntSize::operator D2D1_SIZE_U):
(WebCore::IntSize::operator D2D1_SIZE_F):
* platform/graphics/win/TransformationMatrixDirect2D.cpp: Added.
(WebCore::TransformationMatrix::TransformationMatrix):
(WebCore::TransformationMatrix::operator D2D1_MATRIX_3X2_F):
(WebCore::AffineTransform::AffineTransform):
(WebCore::AffineTransform::operator D2D1_MATRIX_3X2_F):

Source/WebKit:

* PlatformWin.cmake: Link to Direct2D on Windows.

Tools:

Add several new test suites for the various geometric primitives in WebCore.

* TestWebKitAPI/PlatformWin.cmake: Add new files for test cases.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Ditto.
* TestWebKitAPI/Tests/WebCore/AffineTransform.cpp: Added.
* TestWebKitAPI/Tests/WebCore/FloatPoint.cpp: Added.
* TestWebKitAPI/Tests/WebCore/FloatRect.cpp: Added.
* TestWebKitAPI/Tests/WebCore/FloatSize.cpp: Added.
* TestWebKitAPI/Tests/WebCore/IntPoint.cpp: Added.
* TestWebKitAPI/Tests/WebCore/IntRect.cpp: Added.
* TestWebKitAPI/Tests/WebCore/IntSize.cpp: Added.
* TestWebKitAPI/Tests/WebCore/TransformationMatrix.cpp: Add some new
Windows-focused test cases.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205871 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUndoing a candidate insertion results in the replaced text being selected
timothy_horton@apple.com [Tue, 13 Sep 2016 19:44:42 +0000 (19:44 +0000)]
Undoing a candidate insertion results in the replaced text being selected
https://bugs.webkit.org/show_bug.cgi?id=161894
<rdar://problem/28225774>

Reviewed by Simon Fraser.

Test: editing/mac/spelling/accept-candidate-undo-does-not-select.html

* WebCore.xcodeproj/project.pbxproj:
* editing/ReplaceRangeWithTextCommand.cpp: Added.
(WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
(WebCore::ReplaceRangeWithTextCommand::doApply):
* editing/ReplaceRangeWithTextCommand.h: Added.
(WebCore::ReplaceRangeWithTextCommand::create):
Add a editor command that replaces a range with the given text.

* editing/Editor.cpp:
(WebCore::Editor::rangeForTextCheckingResult):
(WebCore::Editor::handleAcceptedCandidate):
(WebCore::Editor::selectTextCheckingResult): Deleted.
* editing/Editor.h:
Make use of the new editor command to do candidate insertion as a single
composite operation, so that it is undone as a unit. Otherwise, undo ends up
undoing the insertion, but not the selection, and we are left with the old
text, selected, which is undesirable.

* editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word-expected.txt:
* editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt:
* editing/mac/spelling/accept-candidate-undo-does-not-select-expected.txt: Copied from LayoutTests/editing/mac/spelling/accept-candidate-replacing-multiple-words-expected.txt.
* editing/mac/spelling/accept-candidate-undo-does-not-select.html: Added.
* editing/mac/spelling/accept-candidate-without-adding-space-expected.txt:
* editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt:
Adjust some test results, and add a new test that ensures that undoing
a candidate insertion does not select the replaced text.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205870 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[CSS Parser] Add CSS Variable Parsing support
hyatt@apple.com [Tue, 13 Sep 2016 19:08:30 +0000 (19:08 +0000)]
[CSS Parser] Add CSS Variable Parsing support
https://bugs.webkit.org/show_bug.cgi?id=161916

Reviewed by Dean Jackson.

This patch not only adds the parser for CSS variables (from Blink), but it also brings in
all of the data structures used to store variables and custom property declarations. We
will be abandoning our old data structures eventually in favor of these new ones. They
are not significantly different other than operating on the CSSParserTokenRanges rather
than the soon-to-be-removed parser value lists.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSCustomIdentValue.cpp: Added.
(WebCore::CSSCustomIdentValue::CSSCustomIdentValue):
(WebCore::CSSCustomIdentValue::customCSSText):
* css/CSSCustomIdentValue.h: Added.
(WebCore::CSSCustomIdentValue::create):
(WebCore::CSSCustomIdentValue::value):
(WebCore::CSSCustomIdentValue::isKnownPropertyID):
(WebCore::CSSCustomIdentValue::valueAsPropertyID):
(WebCore::CSSCustomIdentValue::equals):
* css/CSSCustomPropertyDeclaration.cpp: Added.
(WebCore::CSSCustomPropertyDeclaration::customCSSText):
* css/CSSCustomPropertyDeclaration.h: Added.
(WebCore::CSSCustomPropertyDeclaration::create):
(WebCore::CSSCustomPropertyDeclaration::name):
(WebCore::CSSCustomPropertyDeclaration::value):
(WebCore::CSSCustomPropertyDeclaration::id):
(WebCore::CSSCustomPropertyDeclaration::equals):
(WebCore::CSSCustomPropertyDeclaration::CSSCustomPropertyDeclaration):
* css/CSSCustomPropertyValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isCustomPropertyDeclaration):
(WebCore::CSSValue::isCustomIdentValue):
(WebCore::CSSValue::isVariableReferenceValue):
* css/CSSValueKeywords.in:
* css/CSSVariableData.cpp: Added.
(WebCore::CSSVariableData::updateTokens):
(WebCore::CSSVariableData::operator==):
(WebCore::CSSVariableData::consumeAndUpdateTokens):
(WebCore::CSSVariableData::CSSVariableData):
* css/CSSVariableData.h: Added.
(WebCore::CSSVariableData::create):
(WebCore::CSSVariableData::createResolved):
(WebCore::CSSVariableData::tokenRange):
(WebCore::CSSVariableData::tokens):
(WebCore::CSSVariableData::needsVariableResolution):
(WebCore::CSSVariableData::CSSVariableData):
* css/CSSVariableDependentValue.h:
* css/CSSVariableReferenceValue.cpp: Added.
(WebCore::CSSVariableReferenceValue::customCSSText):
* css/CSSVariableReferenceValue.h: Added.
(WebCore::CSSVariableReferenceValue::create):
(WebCore::CSSVariableReferenceValue::variableDataValue):
(WebCore::CSSVariableReferenceValue::equals):
(WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
* css/CSSVariableValue.h:
* css/parser/CSSParserImpl.cpp:
(WebCore::filterProperties):
(WebCore::CSSParserImpl::consumeDeclaration):
(WebCore::CSSParserImpl::consumeVariableValue):
* css/parser/CSSVariableParser.cpp: Added.
(WebCore::CSSVariableParser::isValidVariableName):
(WebCore::classifyBlock):
(WebCore::isValidVariableReference):
(WebCore::classifyVariableRange):
(WebCore::CSSVariableParser::containsValidVariableReferences):
(WebCore::CSSVariableParser::parseDeclarationValue):
* css/parser/CSSVariableParser.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove CSS keyword properties from CSSParser::parseValue(CSSPropertyID, bool)
dbates@webkit.org [Tue, 13 Sep 2016 19:01:32 +0000 (19:01 +0000)]
Remove CSS keyword properties from CSSParser::parseValue(CSSPropertyID, bool)
https://bugs.webkit.org/show_bug.cgi?id=161918

Reviewed by Simon Fraser.

CSSParser::parseValue(CSSPropertyID, bool) calls ASSERT_NOT_REACHED() when processing a CSS property
that is known to accept only keyword values as a means to guide a person to add such a CSS property
to the switch block in WebCore::isValidKeywordPropertyAndValue(). In theory this sounds good, but
in practice it does not work out and the list of such properties is stale. We should remove the
case statements for such properties and the maintenance burden they required, which was manual and
error prone. We should think about a better way to enforce that all CSS properties are parsed/validated.

The approach of calling ASSERT_NOT_REACHED is not beneficial to catching coding mistakes because
CSSParser::parseValue() has a default case statement to parse/validate SVG CSS properties and hence
does not allow the C++ compiler to validate that the switch block covers all CSSPropertyIDs.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205868 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoOrganize CSS keyword properties in WebCore::isKeywordPropertyID()
dbates@webkit.org [Tue, 13 Sep 2016 19:01:04 +0000 (19:01 +0000)]
Organize CSS keyword properties in WebCore::isKeywordPropertyID()
https://bugs.webkit.org/show_bug.cgi?id=161917

Reviewed by Simon Fraser.

Group and sort compile-time feature keywords and move them to the end of the switch block
to avoid the distraction of preprocessor statements scattered throughout the list. Sort
all the other keyword properties to make it straightforward to find a property by name.

* css/parser/CSSParser.cpp:
(WebCore::isKeywordPropertyID):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205867 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Should be able to pretty print module code (import / export statements)
commit-queue@webkit.org [Tue, 13 Sep 2016 18:37:12 +0000 (18:37 +0000)]
Web Inspector: Should be able to pretty print module code (import / export statements)
https://bugs.webkit.org/show_bug.cgi?id=161891
<rdar://problem/28272784>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-13
Reviewed by Yusuke Suzuki.

Source/WebInspectorUI:

* Tools/Formatting/EsprimaFormatterDebug.js:
* Tools/Formatting/index.html:
Update the formatting tool to toggle between source type modes.

* UserInterface/Proxies/FormatterWorkerProxy.js:
* UserInterface/Workers/Formatter/FormatterWorker.js:
(FormatterWorker.prototype.formatJavaScript):
Provide a flag to parse the input as a module instead of a script/program.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype._startWorkerPrettyPrint):
Using the formatter here, we may have module scripts in the future.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction.didGetDetails):
Using the formatter for a function is not module source.

* UserInterface/Workers/Formatter/ESTreeWalker.js:
(ESTreeWalker.prototype._walkChildren):
Visit children of Export/Import nodes.

* UserInterface/Workers/Formatter/EsprimaFormatter.js:
(EsprimaFormatter.prototype._handleTokenAtNode):
Output tokens with appropriate whitespace.

LayoutTests:

* inspector/formatting/formatting-javascript-expected.txt:
* inspector/formatting/formatting-javascript.html:
* inspector/formatting/resources/javascript-tests/modules-expected.js: Added.
* inspector/formatting/resources/javascript-tests/modules.js: Added.
Include a new test for modules.

* inspector/formatting/formatting-json.html:
All of these are non-module source code.

* inspector/formatting/resources/utilities.js:
Determine if module or not based on the test name.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAX: Crash at AccessibilityRenderObject::computeAccessibilityIsIgnored const + 552
n_wang@apple.com [Tue, 13 Sep 2016 18:20:28 +0000 (18:20 +0000)]
AX: Crash at AccessibilityRenderObject::computeAccessibilityIsIgnored const  + 552
https://bugs.webkit.org/show_bug.cgi?id=161276

Reviewed by Chris Fleizach.

Sometimes when calling JavaScript removeChild or setAttribute on a node, it seems like
the renderer is deallocated during the process of computeAccessibilityIsIgnored. It's
causing a crash when we are accessing the renderer after that. Since RenderObject is not ref
counted and we cannot hold onto it for the duration of the function, fixed it by adding
more nil checks.

Despite my best efforts, I couldn't make a layout test that destroys the renderer within
the computeAccessibilityIsIgnored function.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarking http/tests/security/cross-origin-cached-scripts-parallel.html as flaky.
ryanhaddad@apple.com [Tue, 13 Sep 2016 17:53:25 +0000 (17:53 +0000)]
Marking http/tests/security/cross-origin-cached-scripts-parallel.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=161912

Unreviewed test gardening.

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205864 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMedia-source backed elements block load event; cause web-platform-test flakiness
jer.noble@apple.com [Tue, 13 Sep 2016 17:43:05 +0000 (17:43 +0000)]
Media-source backed elements block load event; cause web-platform-test flakiness
https://bugs.webkit.org/show_bug.cgi?id=161881

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-delaying-load-event.html

The MSE specification has added an explicit step to their "attaching to media element"
algorithm which tells the media element to stop delaying the load event. And indeed,
the HTMLMediaElement blocks the load event when a MediaSource is attached but its data
is never loaded.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setPrivateAndOpen):
* html/HTMLMediaElement.h:

LayoutTests:

* media/media-source/media-source-delaying-load-event-expected.txt: Added.
* media/media-source/media-source-delaying-load-event.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205863 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed gardening; removed duplicate entry for mediasource-config-change-mp4-v...
jer.noble@apple.com [Tue, 13 Sep 2016 17:33:20 +0000 (17:33 +0000)]
Unreviewed gardening; removed duplicate entry for mediasource-config-change-mp4-v-bitrate.html.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoInput type object and the associated render can go out of sync.
zalan@apple.com [Tue, 13 Sep 2016 17:05:39 +0000 (17:05 +0000)]
Input type object and the associated render can go out of sync.
https://bugs.webkit.org/show_bug.cgi?id=161871
<rdar://problem/28178094>

Reviewed by Antti Koivisto.

Source/WebCore:

Bail out when we've got a mismatched renderer.

Test: fast/forms/assert-on-input-type-change.html

* html/ImageInputType.cpp:
(WebCore::ImageInputType::altAttributeChanged):

LayoutTests:

* fast/forms/assert-on-input-type-change-expected.txt: Added.
* fast/forms/assert-on-input-type-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205861 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
carlosgc@webkit.org [Tue, 13 Sep 2016 16:13:38 +0000 (16:13 +0000)]
[GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
https://bugs.webkit.org/show_bug.cgi?id=161907

Reviewed by Michael Catanzaro.

Source/WebCore:

We don't really need to keep a DataObjectGtk for every clipboard, we could simply pass the DataObjectGtk to read
and write methods of PasteboardHelper.

* editing/gtk/EditorGtk.cpp:
(WebCore::createFragmentFromPasteboardData): Update for DataObjectGtk API changes.
* platform/Pasteboard.h:
* platform/gtk/DataObjectGtk.cpp: Remove forClipboard() static method.
* platform/gtk/DataObjectGtk.h: Ditto.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::Pasteboard): Always create a new DataObjectGtk.
(WebCore::Pasteboard::dataObject): Return a const reference instead of a pointer.
(WebCore::Pasteboard::writePlainText): Pass the DataObjectGtk to PasteboardHelper.
(WebCore::Pasteboard::write): Ditto.
(WebCore::Pasteboard::writePasteboard): Ditto.
(WebCore::Pasteboard::clear): Ditto.
(WebCore::Pasteboard::read): Ditto.
(WebCore::Pasteboard::hasData): Ditto.
(WebCore::Pasteboard::types): Ditto.
(WebCore::Pasteboard::readString): Ditto.
(WebCore::Pasteboard::readFilenames): Ditto.
* platform/gtk/PasteboardHelper.cpp:
(WebCore::PasteboardHelper::getClipboardContents): Update the given DataObjectGtk.
(WebCore::PasteboardHelper::fillSelectionData): Use a const reference to DataObjectGtk instead of a pointer.
(WebCore::PasteboardHelper::targetListForDataObject): Ditto.
(WebCore::PasteboardHelper::fillDataObjectFromDropData): Use a reference to DataObjectGtk instead of a pointer.
(WebCore::ClipboardSetData::ClipboardSetData): Helper struct to pass DataObjectGtk and callback to clipboard callbacks.
(WebCore::ClipboardSetData::~ClipboardSetData):
(WebCore::getClipboardContentsCallback): Get the DataObjectGtk from ClipboardSetData struct passed as user data.
(WebCore::clearClipboardContentsCallback): Get the DataObjectGtk and callback from ClipboardSetData struct
passed as user data.
(WebCore::PasteboardHelper::writeClipboardContents): Write the given DataObjectGtk.
* platform/gtk/PasteboardHelper.h:

Source/WebKit2:

Update to DataObjectGtk and PasteboardHelper API changes.

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::startDrag):
(WebKit::DragAndDropHandler::fillDragData):
(WebKit::DragAndDropHandler::dataObjectForDropData):
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
(WebKit::WebDragClient::startDrag):
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::collapseSelection):
(WebKit::WebEditorClient::updateGlobalSelection): Remove wrong X11 guards, since that code is not X11 specific.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205860 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoParkingLot is going to have a bad time with threads dying
fpizlo@apple.com [Tue, 13 Sep 2016 15:59:25 +0000 (15:59 +0000)]
ParkingLot is going to have a bad time with threads dying
https://bugs.webkit.org/show_bug.cgi?id=161893

Reviewed by Michael Saboff.

If a thread dies right as it falls out of parkConditionally, then unparkOne() and friends
might die because they will dereference a deallocated ThreadData.

The solution is to ref-count ThreadData's. When unparkOne() and friends want to hold onto a
ThreadData past the queue lock, they can use RefPtr<>.

* wtf/ParkingLot.cpp:
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkAll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205859 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoDrop support for <isindex>
cdumez@apple.com [Tue, 13 Sep 2016 15:02:44 +0000 (15:02 +0000)]
Drop support for <isindex>
https://bugs.webkit.org/show_bug.cgi?id=7139

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import layout test coverage from W3C web-platform-tests. We used to fail
the last check but we now pass it. Chrome also passes this last check.

* web-platform-tests/html/semantics/forms/historical-expected.txt: Added.
* web-platform-tests/html/semantics/forms/historical.html: Added.
* web-platform-tests/html/semantics/forms/w3c-import.log: Added.

Source/WebCore:

Drop support for <isindex> and <input name=isindex>. Those are no longer
in the HTML specification and Chrome / Edge have already dropped their
support. Firefox is also planning on dropping this.

Test: imported/w3c/web-platform-tests/html/semantics/forms/historical.html

* css/StyleResolver.cpp:
(WebCore::elementTypeHasAppearanceFromUAStyle):
* css/html.css:
(input, textarea, keygen, select, button, meter, progress):
(input, textarea, keygen, select, button):
(#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
(input::placeholder):
(input:focus, textarea:focus, keygen:focus, select:focus):
* dom/Element.cpp:
(WebCore::Element::ieForbidsInsertHTML):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
* html/HTMLTagNames.in:
* html/parser/HTMLStackItem.h:
(WebCore::isSpecialNode):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):
(WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): Deleted.
(WebCore::createCaseMap): Deleted.
* html/parser/HTMLTreeBuilder.h:
* platform/network/FormData.cpp:
(WebCore::FormData::appendKeyValuePairItems):

Source/WebInspectorUI:

Drop references to isindex.

* UserInterface/Views/DOMTreeElement.js:

Source/WebKit/mac:

Drop references to isindex.

* WebCoreSupport/WebEditorClient.mm:
(attributesForAttributedStringConversion):
* WebView/WebHTMLView.mm:
(+[WebHTMLView _excludedElementsForAttributedStringConversion]):

LayoutTests:

Drop outdated tests / checks.

* dom/html/level2/html/HTMLIsIndexElement01-expected.txt: Removed.
* dom/html/level2/html/HTMLIsIndexElement01.html: Removed.
* dom/html/level2/html/HTMLIsIndexElement01.js: Removed.
* dom/html/level2/html/HTMLIsIndexElement02-expected.txt: Removed.
* dom/html/level2/html/HTMLIsIndexElement02.html: Removed.
* dom/html/level2/html/HTMLIsIndexElement02.js: Removed.
* dom/html/level2/html/HTMLIsIndexElement03-expected.txt: Removed.
* dom/html/level2/html/HTMLIsIndexElement03.html: Removed.
* dom/html/level2/html/HTMLIsIndexElement03.js: Removed.
* fast/dom/HTMLIsIndexElement/prototype-chain-expected.txt: Removed.
* fast/dom/HTMLIsIndexElement/prototype-chain.html: Removed.
* fast/dom/HTMLIsIndexElement/script-tests/prototype-chain.js: Removed.
* fast/dom/isindex-001.html: Removed.
* fast/dom/isindex-002.html: Removed.
* fast/events/resources/tabindex-focus-blur-all-frame1.html:
* fast/events/resources/tabindex-focus-blur-all-frame2.html:
* fast/events/resources/tabindex-focus-blur-all-iframe1.html:
* fast/events/resources/tabindex-focus-blur-all-iframe2.html:
* fast/forms/isindex-name-expected.txt: Removed.
* fast/forms/isindex-name.html: Removed.
* fast/forms/isindex-placeholder-expected.html: Removed.
* fast/forms/isindex-placeholder.html: Removed.
* fast/forms/text-style-color.html: Removed.
* fast/parser/fragment-parser-expected.txt:
* fast/parser/script-tests/fragment-parser.js:
* fast/replaced/table-percent-height-text-controls-expected.txt:
* fast/replaced/table-percent-height-text-controls.html:
* html5lib/generated/run-isindex-data-expected.txt: Removed.
* html5lib/generated/run-isindex-data.html: Removed.
* html5lib/generated/run-isindex-write-expected.txt: Removed.
* html5lib/generated/run-isindex-write.html: Removed.
* html5lib/resources/isindex.dat:
* html5lib/resources/tests19.dat:
* html5lib/resources/tests2.dat:
* html5lib/resources/webkit02.dat:
* http/tests/misc/isindex-formdata-expected.txt: Removed.
* http/tests/misc/isindex-formdata.html: Removed.
* http/tests/misc/isindex-with-no-form-base-href-expected.txt: Removed.
* http/tests/misc/isindex-with-no-form-base-href.html: Removed.
* http/tests/misc/isindex-with-no-form-expected.txt: Removed.
* http/tests/misc/isindex-with-no-form.html: Removed.
* http/tests/misc/resources/isindex-with-no-form-base-href-submit.html: Removed.
* http/tests/misc/resources/isindex-with-no-form-base-href.html: Removed.
* platform/efl/fast/dom/isindex-001-expected.png: Removed.
* platform/efl/fast/dom/isindex-001-expected.txt: Removed.
* platform/efl/fast/dom/isindex-002-expected.png: Removed.
* platform/efl/fast/dom/isindex-002-expected.txt: Removed.
* platform/efl/fast/forms/text-style-color-expected.png: Removed.
* platform/efl/fast/forms/text-style-color-expected.txt: Removed.
* platform/gtk/fast/dom/isindex-001-expected.png: Removed.
* platform/gtk/fast/dom/isindex-001-expected.txt: Removed.
* platform/gtk/fast/dom/isindex-002-expected.png: Removed.
* platform/gtk/fast/dom/isindex-002-expected.txt: Removed.
* platform/gtk/fast/forms/text-style-color-expected.png: Removed.
* platform/gtk/fast/forms/text-style-color-expected.txt: Removed.
* platform/ios-simulator/fast/dom/isindex-001-expected.txt: Removed.
* platform/ios-simulator/fast/dom/isindex-002-expected.txt: Removed.
* platform/ios-simulator/fast/forms/text-style-color-expected.txt: Removed.
* platform/mac-elcapitan/fast/dom/isindex-001-expected.txt: Removed.
* platform/mac-elcapitan/fast/dom/isindex-002-expected.txt: Removed.
* platform/mac-elcapitan/fast/forms/text-style-color-expected.txt: Removed.
* platform/mac/fast/dom/isindex-001-expected.png: Removed.
* platform/mac/fast/dom/isindex-001-expected.txt: Removed.
* platform/mac/fast/dom/isindex-002-expected.png: Removed.
* platform/mac/fast/dom/isindex-002-expected.txt: Removed.
* platform/mac/fast/forms/text-style-color-expected.png: Removed.
* platform/mac/fast/forms/text-style-color-expected.txt: Removed.
* platform/win/fast/dom/isindex-001-expected.txt: Removed.
* platform/win/fast/dom/isindex-002-expected.txt: Removed.
* platform/win/fast/forms/text-style-color-expected.txt: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205858 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSkip media source tests since the feature is not enabled on Windows.
pvollan@apple.com [Tue, 13 Sep 2016 11:52:15 +0000 (11:52 +0000)]
Skip media source tests since the feature is not enabled on Windows.

Unreviewed test gardening.

* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205857 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoES6: Classes: Should be allowed to create a static method with name "arguments"
gskachkov@gmail.com [Tue, 13 Sep 2016 08:17:39 +0000 (08:17 +0000)]
ES6: Classes: Should be allowed to create a static method with name "arguments"
https://bugs.webkit.org/show_bug.cgi?id=152985

Reviewed by Keith Miller.

Source/JavaScriptCore:

Current patch covered 16.2 Forbidden Extensions - first topic
(https://tc39.github.io/ecma262/#sec-forbidden-extensions) ECMAScript Functions
should not have own properties named "caller" or "arguments".
Also added possibility to declare static methods and getters with
name 'arguments' and 'caller' for classes. i.e.:
class A { static arguments() { return 'value'; } }
A.arguments() === 'value';
To implement this patch 'caller' and 'arguments' were put to the FunctionPrototype
object. Also was changed approach to init throwTypeErrorArgumentsCalleeAndCallerGetterSetter
property from Lazy to common because it necessary to use execState during init of the accessors
properties.

* runtime/Executable.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::initRestrictedProperties):
(JSC::FunctionPrototype::addFunctionProperties): Deleted.
* runtime/FunctionPrototype.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::getOwnNonIndexPropertyNames):
(JSC::JSFunction::put):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::defineOwnProperty):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::throwTypeErrorArgumentsCalleeAndCallerGetterSetter):

JSTests:

* test262.yaml:

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/basic-strict-mode-expected.txt:
* js/class-method-and-constructor-properties-expected.txt: Removed.
* js/class-syntax-method-names-expected.txt:
* js/es6-function-properties-expected.txt: Added.
* js/es6-function-properties.html: Copied from LayoutTests/js/class-method-and-constructor-properties.html.
* js/kde/script-tests/function_arguments.js:
(f):
* js/non-strict-function-properties-expected.txt: Added.
* js/non-strict-function-properties.html: Renamed from LayoutTests/js/class-method-and-constructor-properties.html.
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/basic-strict-mode.js:
* js/script-tests/class-method-and-constructor-properties.js: Removed.
(shouldThrow): Deleted.
(shouldBe): Deleted.
(A): Deleted.
(B): Deleted.
(C): Deleted.
(D): Deleted.
(E.prototype.getItem): Deleted.
(E): Deleted.
(F.prototype.getElement): Deleted.
(F): Deleted.
(G.prototype.get item): Deleted.
(G): Deleted.
(H.prototype.caller): Deleted.
(H.prototype.arguments): Deleted.
(H): Deleted.
* js/script-tests/class-syntax-method-names.js:
* js/script-tests/es6-function-properties.js: Added.
(shouldThrow):
(shouldBe):
(A):
(B):
(C):
(D):
(E.prototype.getItem):
(E):
(F.prototype.getElement):
(F):
(G.prototype.get item):
(G):
(check):
(arr):
(H.prototype.caller):
(H.prototype.arguments):
(H):
(J.prototype.gen):
(J.gen):
(J):
* js/script-tests/non-strict-function-properties.js: Added.
(foo):
(boo):
(f):
(g):
(doSetCaller):
(doSetArguments):
* js/script-tests/strict-throw-type-error.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205856 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Win] Warning fix.
pvollan@apple.com [Tue, 13 Sep 2016 06:52:32 +0000 (06:52 +0000)]
[Win] Warning fix.
https://bugs.webkit.org/show_bug.cgi?id=161858

Reviewed by Brent Fulgham.

Use exported constants from CoreText.dll, instead of creating copies.

* PlatformAppleWin.cmake:
* platform/spi/win/CoreTextSPIWin.cpp: Removed.
* platform/spi/win/CoreTextSPIWin.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205855 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoScriptElement should use FetchOptions::mode according its crossOrigin attribute
commit-queue@webkit.org [Tue, 13 Sep 2016 06:46:15 +0000 (06:46 +0000)]
ScriptElement should use FetchOptions::mode according its crossOrigin attribute
https://bugs.webkit.org/show_bug.cgi?id=161686

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-12
Reviewed by Darin Adler.

Source/WebCore:

Setting ScriptElement fetch mode according its crossOrigin attribute.
Removing LoadableClassicScriptchecking of CORS since this is now done at ResourceLoader/CachedResource level.

Updating CachedResourceLoader to ensure that a resource that matches an on-going resource load but with different fetch mode/origin,
always gets its loading started if the resource state is not Cached.

Tests: fast/dom/script-crossorigin-loads-fail-origin.html
       http/tests/security/cross-origin-cached-images-parallel.html
       http/tests/security/cross-origin-cached-images.html
       http/tests/security/cross-origin-cached-scripts-parallel.html
       http/tests/security/cross-origin-cached-scripts.html
       http/tests/security/script-crossorigin-loads-correctly-credentials.html
       http/tests/security/script-with-dataurl.html

* dom/LoadableClassicScript.cpp:
(WebCore::LoadableClassicScript::create):
(WebCore::LoadableClassicScript::notifyFinished): Checking CORS failures using the resource state.
(WebCore::LoadableClassicScript::~LoadableClassicScript): Deleted.
(WebCore::LoadableClassicScript::isLoaded): Deleted.
* dom/LoadableClassicScript.h:
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestClassicScript):
(WebCore::ScriptElement::requestScriptWithCache): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode according crossOrigin attribute.
* dom/ScriptElement.h:
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::setBodyDataFrom):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Adding support for script resources.
(WebCore::CachedResourceLoader::requestResource): Ensuring that 'updated' resources gets actually loaded.
* loader/cache/CachedScript.cpp:
(WebCore::CachedScript::setBodyDataFrom): Implementing specific data copy from another CachedScript.
* loader/cache/CachedScript.h:

LayoutTests:

Added new tests.
Updated cookie test for robustness as the order of the cookie items when more than one may not be preserved.

Moved one of the blink test to http/tests as it requires HTTP to run properly.
Updated blink test expectation as it is run from file, while it should be run from http.

Copied a similar test to http/tests/local to ensure that script load fails when served from the filesystem , CORS check failing.
The test was previously passing in WebKit as the test file was served from filesystem and was granted universal access.
The CORS checks were done through SecurityOrigin::canRequest which was testing that first.
With the patch, CORS checks are done at a lower level and do not take in to account universal access.
This aligns with Chrome and Firefox behavior.

* http/tests/local/script-crossorigin-loads-fail-origin-expected.txt: Added.
* http/tests/local/script-crossorigin-loads-fail-origin.html: Copied from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials.html.
* http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html: Sorting the cookie to make the test more resistant.
* http/tests/security/cross-origin-cached-images-expected.txt: Added.
* http/tests/security/cross-origin-cached-images-parallel-expected.txt: Added.
* http/tests/security/cross-origin-cached-images-parallel.html: Renamed from LayoutTests/http/tests/security/cross-origin-cached-resource-parallel.html.
* http/tests/security/cross-origin-cached-images.html: Renamed from LayoutTests/http/tests/security/cross-origin-cached-resource.html.
* http/tests/security/cross-origin-cached-resource-parallel-expected.txt: Removed.
* http/tests/security/cross-origin-cached-scripts-expected.txt: Added.
* http/tests/security/cross-origin-cached-scripts-parallel-expected.txt: Added.
* http/tests/security/cross-origin-cached-scripts-parallel.html: Added.
* http/tests/security/cross-origin-cached-scripts.html: Added.
* http/tests/security/resources/cors-script.php: Updated according chromium script to activate CORS credentials header if requested.
* http/tests/security/resources/cross-origin-cached-resource-iframe.html:
* http/tests/security/resources/notify-loaded.js: Added.
* http/tests/security/script-crossorigin-loads-correctly-credentials-expected.txt: Renamed from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials-expected.txt.
* http/tests/security/script-crossorigin-loads-correctly-credentials.html: Renamed from LayoutTests/imported/blink/http/tests/security/script-crossorigin-loads-correctly-credentials.html.
* http/tests/security/script-with-dataurl-expected.txt: Added.
* http/tests/security/script-with-dataurl.html: Added.
* http/tests/security/script-with-failed-cors-check-fails-to-load-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205854 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Scrollbar too large
carlosgc@webkit.org [Tue, 13 Sep 2016 06:15:09 +0000 (06:15 +0000)]
[GTK] Scrollbar  too large
https://bugs.webkit.org/show_bug.cgi?id=161735

Reviewed by Michael Catanzaro.

We were not calculating the total scrollbar size correctly when the theme defines a minimum width/height. In
that case we need to take the extra size into account (border, margin, padding), but not adding the minimum
size. We were also adjusting the thumb position when rendering in indicator mode, but we really need to adjust
the whole rectangle. This worked in Adwaita because it uses a transparent track when in indicator mode. We are
also now taking into account the text direction when doing this adjustment for the indicator mode.

* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::paint):
(WebCore::ScrollbarThemeGtk::scrollbarThickness):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205853 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Crash of WebProcess on the last WebView disconnect (take two)
carlosgc@webkit.org [Tue, 13 Sep 2016 06:12:42 +0000 (06:12 +0000)]
[GTK] Crash of WebProcess on the last WebView disconnect (take two)
https://bugs.webkit.org/show_bug.cgi?id=161842

Reviewed by Michael Catanzaro.

The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor
makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native
X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL
context is deleted before the native X11 display is closed.

* platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected.
* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display.
(WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with
nviedia closed drivers.
(WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display.
(WebCore::GLContextGLX::makeContextCurrent): Ditto.
(WebCore::GLContextGLX::swapBuffers): Ditto.
(WebCore::GLContextGLX::swapInterval): Ditto.
(WebCore::GLContextGLX::cairoDevice): Ditto.
* platform/graphics/glx/GLContextGLX.h:
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205852 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarkedBlock should be able to use flipIfNecessary() as the "I'm not empty" trigger
fpizlo@apple.com [Tue, 13 Sep 2016 04:33:19 +0000 (04:33 +0000)]
MarkedBlock should be able to use flipIfNecessary() as the "I'm not empty" trigger
https://bugs.webkit.org/show_bug.cgi?id=161869

Reviewed by Saam Barati.

In bug 161581, I'm going to use flipIfNecessary() during marking to trigger the "I'm not
empty" hook, which will set a bit in the markingNotEmpty bitvector.

For this to work, we need to ensure that nobody else uses flipIfNecessary() during marking.
If anyone else does it but they aren't marking new objects, then this prevents
flipIfNecessary() from triggering when the first object is marked, which means we won't
always detect when a block became non-empty.

I addressed this by adding a isMarking flag, and asserting in flipIfNecessary() that the flag
isn't set. flipIfNecessaryDuringMarking() is used only on the marking path, so that code
knows that it can trigger something like noteMarked(). The only places that were using
flipIfNecessary() should have been using needsFlip() anyway.

* heap/CellContainer.h:
* heap/CellContainerInlines.h:
(JSC::CellContainer::needsFlip):
* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::beginMarking):
(JSC::Heap::endMarking):
(JSC::Heap::clearLivenessData): Deleted.
(JSC::Heap::converge): Deleted.
(JSC::Heap::resetVisitors): Deleted.
* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::testAndSetMarked):
* heap/LargeAllocation.h:
(JSC::LargeAllocation::flipIfNecessaryDuringMarking):
(JSC::LargeAllocation::flipIfNecessaryConcurrently): Deleted.
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::flipIfNecessarySlow):
(JSC::MarkedBlock::flipIfNecessaryDuringMarkingSlow):
(JSC::MarkedBlock::flipIfNecessaryConcurrentlySlow): Deleted.
* heap/MarkedBlock.h:
(JSC::MarkedBlock::flipIfNecessaryDuringMarking):
(JSC::MarkedBlock::Handle::flipIfNecessaryDuringMarking):
(JSC::MarkedBlock::flipIfNecessaryConcurrently): Deleted.
(JSC::MarkedBlock::Handle::flipIfNecessaryConcurrently): Deleted.
* heap/MarkedSpace.h:
(JSC::MarkedSpace::isMarking):
(JSC::MarkedSpace::setIsMarking):
(JSC::MarkedSpace::largeAllocationsForThisCollectionSize): Deleted.
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::setMarkedAndAppendToMarkStack):
* heap/WeakBlock.cpp:
(JSC::WeakBlock::visit):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205850 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[GTK] Fix lint warnings of LayoutTests/platform/gtk/TestExpectations
commit-queue@webkit.org [Tue, 13 Sep 2016 04:32:06 +0000 (04:32 +0000)]
[GTK] Fix lint warnings of LayoutTests/platform/gtk/TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=161890

Unreviewed test gardening.

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2016-09-12

* platform/gtk/TestExpectations: Removed deleted test cases
js/regress/nested-function-parsing.html, js/regress/new-array-buffer-dead.html
and js/regress/method-on-number.html.
Skip imported/w3c/web-platform-tests/media-source/

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205849 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSpeed up Function.prototype.bind a bit by making it a builtin
sbarati@apple.com [Tue, 13 Sep 2016 02:57:37 +0000 (02:57 +0000)]
Speed up Function.prototype.bind a bit by making it a builtin
https://bugs.webkit.org/show_bug.cgi?id=161879

Reviewed by Filip Pizlo.

JSTests:

* microbenchmarks/function-bind-inlining.js: Added.
(assert):
(test):
(test2):
(foo):
* microbenchmarks/function-bind-no-inlining.js: Added.
(assert):
(test):
(test2):
(foo):

LayoutTests:

* js/dom/function-bind-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205848 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix post-landing review comments after r205787
cdumez@apple.com [Tue, 13 Sep 2016 02:12:51 +0000 (02:12 +0000)]
Fix post-landing review comments after r205787
https://bugs.webkit.org/show_bug.cgi?id=161885

Reviewed by Darin Adler.

Source/WebCore:

Leverage new StringBuilder::append(CFStringRef) overload.

* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTTPRefreshInternal):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
(WebCore::buildDisplayStringForTrackBase):
* platform/network/mac/CookieJarMac.mm:
(WebCore::cookiesForSession):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::mediaControlsStyleSheet):
(WebCore::RenderThemeIOS::mediaControlsScript):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):

Source/WTF:

Add new StringBuilder::append(CFStringRef) / append(NSString*)
overloads to avoid an extra string copy when possible.

* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::append):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::append):

Tools:

Leverage new StringBuilder::append(CFStringRef) overload.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::dumpDOMAsWebArchive):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser: Correctly ignore spaces before relative URLs with no scheme
achristensen@apple.com [Tue, 13 Sep 2016 01:25:08 +0000 (01:25 +0000)]
URLParser: Correctly ignore spaces before relative URLs with no scheme
https://bugs.webkit.org/show_bug.cgi?id=161889

Reviewed by Daniel Bates.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205846 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCor...
n_wang@apple.com [Tue, 13 Sep 2016 00:58:22 +0000 (00:58 +0000)]
AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
https://bugs.webkit.org/show_bug.cgi?id=161878

Reviewed by Chris Fleizach.

Source/WebCore:

In function characterOffsetsInOrder(const CharacterOffset&, const CharacterOffset&), we are creating two
ranges based on the nodes that are associated to the passed in CharacterOffsets. When the first node is a doctype
node, the first range will be a nullptr, and dereferencing it leads to a crash. Fixed this by adding a
NULL check.

Test: accessibility/mac/doctype-node-in-text-marker-crash.html

* accessibility/AXObjectCache.cpp:
(WebCore::characterOffsetsInOrder):
(WebCore::resetNodeAndOffsetForReplacedNode):

LayoutTests:

* accessibility/mac/doctype-node-in-text-marker-crash-expected.txt: Added.
* accessibility/mac/doctype-node-in-text-marker-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205845 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoHashMapImpl should take into account m_deleteCount in its load factor and it should...
sbarati@apple.com [Tue, 13 Sep 2016 00:14:59 +0000 (00:14 +0000)]
HashMapImpl should take into account m_deleteCount in its load factor and it should be able to rehash the table to be smaller
https://bugs.webkit.org/show_bug.cgi?id=161640

Reviewed by Geoffrey Garen.

JSTests:

* microbenchmarks/map-rehash.js: Added.
* stress/map-delete.js: Added.
(assert):
* stress/map-rehash-2.js: Added.
(assert):
* stress/map-rehash.js: Added.
(assert):

Source/JavaScriptCore:

HashMapImpl now takes into account m_deleteCount in its load factor.
It now knows how to rehash to either decrease its capacity, stay at
the same capacity, or increase its capacity. The reason we can sometimes
stay at the same capacity is that we can reduce the load factor enough
by rehashing that growing isn't warranted. The reason for this is that
anytime we rehash, we remove all deleted sentinels from the buffer.
Therefore, staying at the same same capacity, when there are deleted entries,
can still reduce the load factor because it removes all deleted sentinels.

* runtime/HashMapImpl.h:
(JSC::HashMapBuffer::create):
(JSC::HashMapBuffer::reset):
(JSC::HashMapImpl::HashMapImpl):
(JSC::HashMapImpl::add):
(JSC::HashMapImpl::remove):
(JSC::HashMapImpl::size):
(JSC::HashMapImpl::clear):
(JSC::HashMapImpl::approximateSize):
(JSC::HashMapImpl::shouldRehashAfterAdd):
(JSC::HashMapImpl::shouldShrink):
(JSC::HashMapImpl::rehash):
(JSC::HashMapImpl::checkConsistency):
(JSC::HashMapImpl::makeAndSetNewBuffer):
(JSC::HashMapImpl::assertBufferIsEmpty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205842 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMove the pixel data of ImageFrame to a separate class named ImageBackingStore
commit-queue@webkit.org [Mon, 12 Sep 2016 23:51:57 +0000 (23:51 +0000)]
Move the pixel data of ImageFrame to a separate class named ImageBackingStore
https://bugs.webkit.org/show_bug.cgi?id=159679

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-09-12
Reviewed by Simon Fraser.

Move the pixel data manipulation part in ImageFrame into a separate class
and allocate it on demand.

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformWinCairo.cmake:
* WebCore.xcodeproj/project.pbxproj:
Add ImageBackingStoreCairo.cpp and remove ImageDecoderCairo.cpp from the
WebKit projects.

* platform/graphics/Color.cpp:
(WebCore::premultipliedChannel): channel = channel * alpha / 255.
(WebCore::unpremultipliedChannel): channel = channel * 255 / alpha.
(WebCore::makePremultipliedRGBA): Un-premultiplied channels to premultiplied RGBA32.
(WebCore::makeUnPremultipliedRGBA): Premultiplied channels to un-premultiplied RGBA32.
(WebCore::colorFromPremultipliedARGB): Use makeUnPremultipliedRGBA.
(WebCore::premultipliedARGBFromColor): Use makePremultipliedRGBA.
* platform/graphics/Color.h:
(WebCore::fastMultiplyBy255): x * 255 = x * 256 - x = x << 8 - x.

* platform/graphics/ImageBackingStore.h: Added.
(WebCore::ImageBackingStore::create): Creates a new ImageBackingStore.
(WebCore::ImageBackingStore::setSize): Changes the pixels size.
(WebCore::ImageBackingStore::setFrameRect): This will always just be the entire buffer except for GIF and PNG frames.
(WebCore::ImageBackingStore::size): Returns the pixels size.
(WebCore::ImageBackingStore::frameRect): Returns the pixels frame rectangle.
(WebCore::ImageBackingStore::clear): Clears the entire image.
(WebCore::ImageBackingStore::clearRect): Clears a rectangle in the image.
(WebCore::ImageBackingStore::repeatFirstRow): Repeats the first row in a rectangle in the image.
(WebCore::ImageBackingStore::pixelAt): Returns a pointer to a pixel data.
(WebCore::ImageBackingStore::setPixel): Sets the color of a pixel in the image.
(WebCore::ImageBackingStore::blendPixel): Blend a color with a pixel in the image.
(WebCore::ImageBackingStore::inBounds): Checks if a rectangle is in the bounds of the image.
(WebCore::ImageBackingStore::isOverSize): Checks whether a size could not be allocated for an image.
(WebCore::ImageBackingStore::ImageBackingStore):

* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::nativeImageHasAlpha): Implement this function. See comments in https://bugs.webkit.org/show_bug.cgi?id=158684.

* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageFrame::operator=): copyBitmapData() now copies the frameRect of the ImageBackingStore.
(WebCore::ImageFrame::clearPixelData): The pixels data and the pointer to these pixels are now included in the ImageBackingStore.
(WebCore::ImageFrame::zeroFillPixelData): Clearing the image pixels are now in ImageBackingStore::clear().
(WebCore::ImageFrame::zeroFillFrameRect): Clearing the image pixels are now in ImageBackingStore::clearRect().
(WebCore::ImageFrame::copyBitmapData): We either need to create a new ImageBackingStore or nullify the current one.
(WebCore::ImageFrame::setSize): ImageFrame::setSize() is supposed to be called once and to create the ImageBackingStore.
(WebCore::ImageFrame::setOriginalFrameRect): Delegate this call to ImageBackingStore::setFrameRect().
(WebCore::ImageDecoder::frameBytesAtIndex): ImageFrame::PixelData can be replaced by RGBA32.

* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageFrame::copyRowNTimes): The implementation was moved to ImageBackingStore::repeatFirstRow().
(WebCore::ImageFrame::size): Gets the size of an image from its ImageBackingStore.
(WebCore::ImageFrame::asNewNativeImage): Gets a NtaiveImagePtr from the ImageBackingStore.
(WebCore::ImageFrame::backingStore): Returns a raw pointer to the ImageBackingStore.
(WebCore::ImageFrame::hasBackingStore): Returns whether the ImageFrame has an ImageBackingStore.
(WebCore::ImageFrame::originalFrameRect): Returns the frameRect of the image from its ImageBackingStore.
(WebCore::ImageFrame::pixelAt): Delegates the call to the ImageBackingStore.
(WebCore::ImageFrame::setPixel): Delegates the call to the ImageBackingStore.
(WebCore::ImageFrame::blendPixel): Delegates the call to the ImageBackingStore.

(WebCore::ImageDecoder::setSize): setSize() now takes an IntSize.
(WebCore::ImageFrame::setOriginalFrameRect): Deleted. Moved to ImageDecoder.cpp.
(WebCore::ImageFrame::setRGBA): Deleted. Renamed to ImageFrame::setPixel().
(WebCore::ImageFrame::getAddr): Deleted. Renamed to ImageFrame::pixelAt().
(WebCore::ImageFrame::hasPixelData): Deleted. Renamed to ImageFrame::hasBackingStore().
(WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
(WebCore::ImageFrame::divide255): Deleted. Replaced by fastDivideBy255() from Color.h.
(WebCore::ImageFrame::overRGBA): Deleted. Renamed to ImageFrame::blendPixel().
(WebCore::ImageFrame::width): Deleted.
(WebCore::ImageFrame::height): Deleted.
(WebCore::ImageDecoder::isOverSize): Deleted. Moved to ImageBackingStore::isOverSize().

* platform/image-decoders/bmp/BMPImageReader.cpp:
(WebCore::BMPImageReader::decodeBMP):
(WebCore::BMPImageReader::processInfoHeader):
(WebCore::BMPImageReader::processNonRLEData):
* platform/image-decoders/bmp/BMPImageReader.h:
(WebCore::BMPImageReader::setI):
(WebCore::BMPImageReader::setPixel):
(WebCore::BMPImageReader::fillRGBA):
(WebCore::BMPImageReader::setRGBA): Deleted.
* platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: Added.
(WebCore::ImageBackingStore::image):
* platform/image-decoders/cairo/ImageDecoderCairo.cpp: Removed.
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::setSize):
(WebCore::GIFImageDecoder::haveDecodedRow):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/gif/GIFImageDecoder.h:
* platform/image-decoders/gif/GIFImageReader.cpp:
(GIFImageReader::parse):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::setSize):
(WebCore::ICOImageDecoder::processDirectoryEntries):
* platform/image-decoders/ico/ICOImageDecoder.h:
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageReader::decode):
(WebCore::JPEGImageDecoder::setSize):
(WebCore::setPixel):
(WebCore::JPEGImageDecoder::outputScanlines):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::setSize):
(WebCore::PNGImageDecoder::headerAvailable):
(WebCore::setPixelRGB):
(WebCore::setPixelRGBA):
(WebCore::setPixelPremultipliedRGBA):
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::initFrameBuffer):
(WebCore::PNGImageDecoder::frameComplete):
* platform/image-decoders/png/PNGImageDecoder.h:
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):
- Send an IntSize to ImageFrame::setSize() and ImageDecoder::setSize().
- Replace ImageFrame::PixelData by RGBA32.
- No need to call ImageFrame::setOriginalFrameRect() if this sets the
  frameRect to the entire image rectangle since this is done by default
  in ImageBackingStore::setSize().
- ImageBackingStore::image() now replaces ImageFrame::asNewNativeImage().
- ImageFrame::setPixel() now replaces ImageFrame::setRGBA().
- ImageFrame::blendPixel() now replaces ImageFrame::overRGBA().
- ImageFrame::pixelAt() now replaces ImageFrame::getAddr().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoHTMLButtonElement.prototype.click should be HTMLElement.prototype.click
commit-queue@webkit.org [Mon, 12 Sep 2016 23:33:58 +0000 (23:33 +0000)]
HTMLButtonElement.prototype.click should be HTMLElement.prototype.click
https://bugs.webkit.org/show_bug.cgi?id=161874

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-09-12
Reviewed by Chris Dumez.

Source/WebCore:

Test: fast/dom/HTMLButtonElement/click.html

* html/HTMLButtonElement.idl:
Remove the unnecessary 'click' definition. It already exists in HTMLElement.
If this was needed for ObjC code generation on DOMHTMLButtonElement, then
the extra definition is no longer needed now that ObjC bindings have moved.

LayoutTests:

* fast/dom/HTMLButtonElement/click-expected.txt: Added.
* fast/dom/HTMLButtonElement/click.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205839 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMarking imported/w3c/web-platform-tests/dom/nodes/ProcessingInstruction-escapes-1...
ryanhaddad@apple.com [Mon, 12 Sep 2016 23:14:25 +0000 (23:14 +0000)]
Marking imported/w3c/web-platform-tests/dom/nodes/ProcessingInstruction-escapes-1.xhtml as flaky on mac.
https://bugs.webkit.org/show_bug.cgi?id=161883

Unreviewed test gardening.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205838 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoUnreviewed, fix tests for different libm environments
utatane.tea@gmail.com [Mon, 12 Sep 2016 23:11:55 +0000 (23:11 +0000)]
Unreviewed, fix tests for different libm environments
https://bugs.webkit.org/show_bug.cgi?id=161857

* stress/ftl-arithtan.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205837 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[WTF] HashTable's rehash is not compatible to Ref<T> and ASan
utatane.tea@gmail.com [Mon, 12 Sep 2016 23:08:49 +0000 (23:08 +0000)]
[WTF] HashTable's rehash is not compatible to Ref<T> and ASan
https://bugs.webkit.org/show_bug.cgi?id=161763

Reviewed by Darin Adler.

Destructors of HashTable's empty values need to be called while ones of deleted values don't.

* wtf/HashTable.h:
(WTF::KeyTraits>::deallocateTable):
* wtf/Ref.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205836 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser: Fix relative URLs containing only fragments
achristensen@apple.com [Mon, 12 Sep 2016 23:03:09 +0000 (23:03 +0000)]
URLParser: Fix relative URLs containing only fragments
https://bugs.webkit.org/show_bug.cgi?id=161882

Reviewed by Brady Eidson.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205835 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSource/WebInspectorUI:
mattbaker@apple.com [Mon, 12 Sep 2016 22:36:57 +0000 (22:36 +0000)]
Source/WebInspectorUI:
Web Inspector: Improve clarity of inspector tests by adding TestHarness.expect* functions similar to XCTest
https://bugs.webkit.org/show_bug.cgi?id=161278
<rdar://problem/28039741>

Reviewed by Joseph Pecoraro.

Under the hood they all call TestHarness.expectThat.

* UserInterface/Test/TestHarness.js:
(TestHarness.prototype.expectFalse):
(TestHarness.prototype.expectNull):
(TestHarness.prototype.expectNotNull):
(TestHarness.prototype.expectEqual):
(TestHarness.prototype.expectNotEqual):
(TestHarness.prototype.expectShallowEqual):
(TestHarness.prototype.expectNotShallowEqual):
(TestHarness.prototype.expectEqualWithAccuracy):
(TestHarness.prototype.expectLessThan):
(TestHarness.prototype.expectLessThanOrEqual):
(TestHarness.prototype.expectGreaterThan):
(TestHarness.prototype.expectGreaterThanOrEqual):

LayoutTests:
Web Inspector: Add TestHarness assertions/expectations to provide additional semantics similar to XCTest
https://bugs.webkit.org/show_bug.cgi?id=161278
<rdar://problem/28039741>

Reviewed by Joseph Pecoraro.

Add test to verify that the TestHarness.expect* family of functions
trivially work. Since it isn't possible to verify the TestPage results
directly without introducing additional complexity, simply log baseline
"PASS" and "FAIL" results for each function.

* inspector/unit-tests/test-harness-expect-functions-expected.txt: Added.
* inspector/unit-tests/test-harness-expect-functions.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoURLParser: Correctly handle relative URLs that are just a scheme and a colon
achristensen@apple.com [Mon, 12 Sep 2016 22:36:14 +0000 (22:36 +0000)]
URLParser: Correctly handle relative URLs that are just a scheme and a colon
https://bugs.webkit.org/show_bug.cgi?id=161876

Reviewed by Brady Eidson.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205833 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoREGRESSION (r205223): Web Inspector: Debugger popover title and code aren't horizonta...
nvasilyev@apple.com [Mon, 12 Sep 2016 22:35:20 +0000 (22:35 +0000)]
REGRESSION (r205223): Web Inspector: Debugger popover title and code aren't horizontally aligned
https://bugs.webkit.org/show_bug.cgi?id=161848
<rdar://problem/28250703>

Reviewed by Matt Baker.

* UserInterface/Views/SourceCodeTextEditor.css:
(.popover .debugger-popover-content > .title):
(.popover .debugger-popover-content.function > .body):
Make left and right padding the same.

(.popover .debugger-popover-content.function > .body .CodeMirror pre):
Override left padding defined in CodeMirrorOverrides.css by `.CodeMirror pre` rule.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205832 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove OptionalColor
dino@apple.com [Mon, 12 Sep 2016 22:16:24 +0000 (22:16 +0000)]
Remove OptionalColor
https://bugs.webkit.org/show_bug.cgi?id=161853
<rdar://problem/28252385>

Reviewed by Alex Christensen.

OptionalColor isn't used. The concept will be implemented
in a different manner.

* platform/graphics/Color.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205831 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[JSC] Use GetArrayLength for JSArray.length even when the array type is undecided
commit-queue@webkit.org [Mon, 12 Sep 2016 22:13:37 +0000 (22:13 +0000)]
[JSC] Use GetArrayLength for JSArray.length even when the array type is undecided
https://bugs.webkit.org/show_bug.cgi?id=161671

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-09-12
Reviewed by Geoffrey Garen.

JSTests:

* stress/get-array-length-on-undecided.js: Added.

Source/JavaScriptCore:

UndecidedShape is a type with storage. When we allocate an uninitialized JSArray,
it gets a butterfly with its length.
When we were querying that length, we were generating a generic GetById with inline cache.

This patch adds the missing bits to treat Undecided like the other types with storage.

* dfg/DFGArrayMode.cpp:
(JSC::DFG::canBecomeGetArrayLength):
(JSC::DFG::ArrayMode::refine):
* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::usesButterfly):
(JSC::DFG::ArrayMode::lengthNeedsStorage):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::checkArray):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileGetArrayLength):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205830 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd Intersection Observer to the features.json file.
simon.fraser@apple.com [Mon, 12 Sep 2016 22:05:54 +0000 (22:05 +0000)]
Add Intersection Observer to the features.json file.

* features.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205829 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[DFG][FTL] Add ArithTan
utatane.tea@gmail.com [Mon, 12 Sep 2016 22:01:13 +0000 (22:01 +0000)]
[DFG][FTL] Add ArithTan
https://bugs.webkit.org/show_bug.cgi?id=161857

Reviewed by Filip Pizlo.

JSTests:

* microbenchmarks/tan.js: Added.
* stress/arith-tan-on-various-types.js: Added.
(let.validInputTypedTestCases.validInputTestCases.map):
(isIdentical):
(opaqueTanNoArgument):
(testNoArgument):
(opaqueAllTypesTan):
(testAllTypesCall):
(testTangleTypeCall):
(testConstant):
(opaqueTanForSideEffects):
(testSideEffect.let.testObject.valueOf):
(testSideEffect):
(opaqueTanForCSE):
(testCSE.let.testObject.valueOf):
(testCSE):
(opaqueTanForDCE):
(testDCE.let.testObject.valueOf):
(testDCE):
(testException.opaqueTanWithException):
(testException):
* stress/ftl-arithtan.js: Added.
(foo):

Source/JavaScriptCore:

While ArithSin and ArithCos are supported, ArithTan is not supported yet.
And we also find that Math.tan is included in MotionMark's Multiply benchmark.

This patch adds ArithTan support in DFG and FTL. And it also cleans up the
existing ArithSin, ArithCos, and ArithLog compilations by unifying them.
The microbenchmark shows the 9% perf improvement.

    tan    322.4819+-0.3766     ^    295.8700+-0.3094        ^ definitely 1.0899x faster

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithDoubleUnaryOp):
(JSC::DFG::SpeculativeJIT::compileArithCos):
(JSC::DFG::SpeculativeJIT::compileArithTan):
(JSC::DFG::SpeculativeJIT::compileArithSin):
(JSC::DFG::SpeculativeJIT::compileArithLog):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileArithTan):
* ftl/FTLOutput.cpp:
(JSC::FTL::Output::doubleTan):
* ftl/FTLOutput.h:
* runtime/Intrinsic.h:
* runtime/MathObject.cpp:
(JSC::MathObject::finishCreation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205828 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Hide ["PrivateSymbol.concatSlowPath"] and other PrivateSymbols from...
commit-queue@webkit.org [Mon, 12 Sep 2016 21:46:49 +0000 (21:46 +0000)]
Web Inspector: Hide ["PrivateSymbol.concatSlowPath"] and other PrivateSymbols from memory edges
https://bugs.webkit.org/show_bug.cgi?id=156763

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-09-12
Reviewed by Joseph Pecoraro.

* UserInterface/Proxies/HeapSnapshotEdgeProxy.js:
(WebInspector.HeapSnapshotEdgeProxy.prototype.isPrivateSymbol):
Checks that the edge data does not begin with "PrivateSymbol".

* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populate):
Only add child nodes if they are not PrivateSymbol nodes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205827 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[Cocoa] Reduce uses of CGFonts in favor of CTFonts
mmaxfield@apple.com [Mon, 12 Sep 2016 21:44:29 +0000 (21:44 +0000)]
[Cocoa] Reduce uses of CGFonts in favor of CTFonts
https://bugs.webkit.org/show_bug.cgi?id=161809

Reviewed by Daniel Bates.

Source/WebCore:

Eventually, we want to remove the cgFont() member of PlatformFontData for both memory
savings and conceptual clarity. Because there is no performance loss from moving from
CGFontGetGlyphsForUnichars() to CTFontGetGlyphsForCharacters(), making this switch
gets us closer to reducing the uses of cgFont().

No new tests because there is no behavior change.

* platform/graphics/Font.cpp:
(WebCore::createAndFillGlyphPage):
* platform/graphics/GlyphPage.h:
(WebCore::GlyphData::GlyphData):
* platform/graphics/mac/GlyphPageMac.cpp:
(WebCore::shouldFillWithVerticalGlyphs):
(WebCore::GlyphPage::fill):
(WebCore::shouldUseCoreText): Deleted.

Source/WTF:

* wtf/unicode/CharacterNames.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205826 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAX: WKWebView for macOS does not allow configuration of tabsToLinks
commit-queue@webkit.org [Mon, 12 Sep 2016 21:42:31 +0000 (21:42 +0000)]
AX: WKWebView for macOS does not allow configuration of tabsToLinks
https://bugs.webkit.org/show_bug.cgi?id=161394

Patch by DAN SAUNDERS <dasau@microsoft.com> on 2016-09-12
Reviewed by Anders Carlsson.

Source/WebKit2:

* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences encodeWithCoder:]):
(-[WKPreferences initWithCoder:]):
(-[WKPreferences tabFocusesLinks]):
(-[WKPreferences setTabFocusesLinks:]):

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205825 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoRemove trailing control characters and spaces before parsing a URL
achristensen@apple.com [Mon, 12 Sep 2016 21:30:30 +0000 (21:30 +0000)]
Remove trailing control characters and spaces before parsing a URL
https://bugs.webkit.org/show_bug.cgi?id=161870

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::bufferView):
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205824 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agowindow.performance object resets script-applied properties
cdumez@apple.com [Mon, 12 Sep 2016 21:23:12 +0000 (21:23 +0000)]
window.performance object resets script-applied properties
https://bugs.webkit.org/show_bug.cgi?id=137407

Reviewed by Darin Adler.

Source/WebCore:

Make sure the window.performance wrapper stays alive for as long as the
associated frame, similarly to what we do for window.screen.

Test: fast/performance/performance-object-gc.html

* page/Performance.idl:

LayoutTests:

Add layout test coverage.

* fast/performance/performance-object-gc-expected.txt: Added.
* fast/performance/performance-object-gc.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205823 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoAdd WebKit support for an option in Safari's debug menu similar to "Get Bytecode...
sbarati@apple.com [Mon, 12 Sep 2016 21:13:09 +0000 (21:13 +0000)]
Add WebKit support for an option in Safari's debug menu similar to "Get Bytecode Profile" but for the Sampling Profiler's data
https://bugs.webkit.org/show_bug.cgi?id=161785

Reviewed by Tim Horton.

Source/WebCore:

* ForwardingHeaders/runtime/SamplingProfiler.h: Added.

Source/WebKit2:

This patch follows in the steps of how we dump output for the
internal JSC bytecode profiler tool, but now also for the internal
JSC sampling profiler tool. This can be used when doing performance
analysis work analyzing the JS execution of a page.

* UIProcess/API/C/WKPage.cpp:
(WKPageGetSamplingProfilerOutput):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::getSamplingProfilerOutput):
(WebKit::WebPageProxy::invalidateStringCallback):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getSamplingProfilerOutput):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205822 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years ago[CSS Parser] Add support for the parsing of the HTML sizes attribute
hyatt@apple.com [Mon, 12 Sep 2016 21:12:41 +0000 (21:12 +0000)]
[CSS Parser] Add support for the parsing of the HTML sizes attribute
https://bugs.webkit.org/show_bug.cgi?id=161868

Reviewed by Dean Jackson.

This patch adds the parsers for the sizes attribute. This code is heavily modified
from Blink, and it really only makes use of the tokenization/parsing code. What is done
with the results involves the same original code that we used over in SourceSizeList.cpp.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/parser/SizesAttributeParser.cpp: Added.
(WebCore::SizesAttributeParser::computeLength):
(WebCore::SizesAttributeParser::SizesAttributeParser):
(WebCore::SizesAttributeParser::length):
(WebCore::SizesAttributeParser::calculateLengthInPixels):
(WebCore::SizesAttributeParser::mediaConditionMatches):
(WebCore::SizesAttributeParser::parse):
(WebCore::SizesAttributeParser::effectiveSize):
(WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
* css/parser/SizesAttributeParser.h: Added.
* css/parser/SizesCalcParser.cpp: Added.
(WebCore::SizesCalcParser::SizesCalcParser):
(WebCore::SizesCalcParser::result):
(WebCore::operatorPriority):
(WebCore::SizesCalcParser::handleOperator):
(WebCore::SizesCalcParser::appendNumber):
(WebCore::SizesCalcParser::appendLength):
(WebCore::SizesCalcParser::appendOperator):
(WebCore::SizesCalcParser::calcToReversePolishNotation):
(WebCore::operateOnStack):
(WebCore::SizesCalcParser::calculate):
* css/parser/SizesCalcParser.h: Added.
(WebCore::SizesCalcValue::SizesCalcValue):
(WebCore::SizesCalcParser::isValid):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205821 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoFix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html...
jer.noble@apple.com [Mon, 12 Sep 2016 21:09:15 +0000 (21:09 +0000)]
Fix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html tests
https://bugs.webkit.org/show_bug.cgi?id=161819

Reviewed by Eric Carlson.

Source/WebCore:

Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-play.html
             imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html

The newest revision of the web-platform-test suite for Media Source tests new behavior
added to the MSE specification. Specifically, setting a MediaSource's duration will no
longer implicitly truncate the source's active SourceBuffer objects.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setDuration): Return exception if issued by setDurationInternal.
(WebCore::MediaSource::setDurationInternal): Bring "duration change" algorithm up to spec.
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SampleMap.h:
(WebCore::PresentationOrderSampleMap::begin): Add const accessor.
(WebCore::PresentationOrderSampleMap::end): Ditto.
(WebCore::PresentationOrderSampleMap::rbegin): Ditto.
(WebCore::PresentationOrderSampleMap::rend): DItto.
(WebCore::DecodeOrderSampleMap::begin): Ditto.
(WebCore::DecodeOrderSampleMap::end): Ditto.
(WebCore::DecodeOrderSampleMap::rbegin): Ditto.
(WebCore::DecodeOrderSampleMap::rend): Ditto.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::highestPresentationTimestamp): Added convenience method.
(WebCore::SourceBuffer::removeCodedFrames): Drive-by fix; use .values() rather than
    pulling the value out of each HashMap iterator.
* Modules/mediasource/SourceBuffer.h:

LayoutTests:

* media/media-source/media-source-end-of-stream-readyState.html:
* media/media-source/media-source-end-of-stream-readyState-expected.txt:
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205820 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoMapHash should do constant folding when it has a constant argument and its legal...
sbarati@apple.com [Mon, 12 Sep 2016 21:04:25 +0000 (21:04 +0000)]
MapHash should do constant folding when it has a constant argument and its legal to hash that value
https://bugs.webkit.org/show_bug.cgi?id=161639

Reviewed by Filip Pizlo.

JSTests:

* microbenchmarks/map-constant-key.js: Added.
(assert):
(test):
(foo):

Source/JavaScriptCore:

We now constant fold the MapHash node. We're careful to not resolve
ropes from the compiler thread, and to only hash strings if they're
not too large. The microbenchmark I added runs about 12% faster with
this patch.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* runtime/HashMapImpl.h:
(JSC::wangsInt64Hash):
(JSC::jsMapHash):
(JSC::concurrentJSMapHash):

Source/WTF:

This patch adds a concurrentHash method to StringImpl. It's
probably safe to get the actual hash while being racy, however,
it's simpler and more future proof to not have to worry about
that and to just compute it on demand. Users of this API should
be aware that it's doing non-trivial work. Currently, the only
user is JSC's JIT compilers, and they only ask for hashes for small-ish
strings.

* wtf/text/StringImpl.h:
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::concurrentHash):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoSwitch remaining users of Document::inPageCache() to pageCacheState()
cdumez@apple.com [Mon, 12 Sep 2016 19:50:50 +0000 (19:50 +0000)]
Switch remaining users of Document::inPageCache() to pageCacheState()
https://bugs.webkit.org/show_bug.cgi?id=161865

Reviewed by Darin Adler.

Switch remaining users of Document::inPageCache() to pageCacheState() as
the former one is confusing (given that it returns true while the
pagehide event is being fired).

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::scheduleStyleRecalc):
(WebCore::Document::fontsNeedUpdate):
(WebCore::Document::removeFocusedNodeOfSubtree):
(WebCore::Document::setFocusedElement):
(WebCore::Document::takeDOMWindowFrom):
(WebCore::Document::topDocument):
(WebCore::Document::webkitWillEnterFullScreenForElement):
(WebCore::Document::webkitDidEnterFullScreenForElement):
(WebCore::Document::webkitWillExitFullScreenForElement):
(WebCore::Document::webkitDidExitFullScreenForElement):
* dom/Document.h:
(WebCore::Document::needsStyleRecalc):
(WebCore::Document::inPageCache): Deleted.
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):
(WebCore::CachedFrame::clear):
(WebCore::CachedFrame::destroy):
* html/HTMLMediaElement.cpp:
(WebCore::mediaElementIsAllowedToAutoplay):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::createElementRenderer):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::addSubresourceLoader):
* loader/HistoryController.cpp:
(WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::decrementScrollEventListenersCount):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::setNeedsStyleRecalc):
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::updateAnimations):
(WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
(WebCore::AnimationController::cancelAnimations):
(WebCore::AnimationController::updateAnimations):
* page/animation/ImplicitAnimation.cpp:
(WebCore::ImplicitAnimation::sendTransitionEvent):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::sendAnimationEvent):
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
* rendering/RenderElement.cpp:
(WebCore::shouldRepaintForImageAnimation):
(WebCore::RenderElement::newImageAnimationFrameAvailable):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
(WebCore::RenderLayerCompositor::didAddScrollingLayer):
* rendering/RenderObject.cpp:
(WebCore::printRenderTreeForLiveDocuments):
(WebCore::printLayerTreeForLiveDocuments):
* rendering/RenderView.cpp:
(WebCore::RenderView::lazyRepaintTimerFired):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(-[WebHTMLView layoutToMinimumPageWidth:height:originalPageWidth:originalPageHeight:maximumShrinkRatio:adjustingViewSize:]):
(-[WebHTMLView setNeedsLayout:]):
(-[WebHTMLView setNeedsToApplyStyles:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205818 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoEnhance Network logging
krollin@apple.com [Mon, 12 Sep 2016 18:59:32 +0000 (18:59 +0000)]
Enhance Network logging
https://bugs.webkit.org/show_bug.cgi?id=161771

Reviewed by Antti Koivisto.

Modify current logging statements to follow a consistent pattern in
order to enhance readability and parsing.

Source/WebCore:

No new tests -- there are no tests for logging.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::prepareForLoadStart):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):

Source/WebKit2:

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::didReceiveResponse):
(WebKit::Download::didReceiveData):
(WebKit::Download::didFinish):
(WebKit::Download::didFail):
(WebKit::Download::didCancel):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::continueWillSendRequest):
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::willSendRequest):
(WebKit::WebResourceLoader::didReceiveResponse):
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didFinishResourceLoad):
(WebKit::WebResourceLoader::didFailResourceLoad):
(WebKit::WebResourceLoader::didReceiveResource):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoJSC test timeout: ChakraCore.yaml/ChakraCore/test/Bugs/bug56026_trycatch.js.default
msaboff@apple.com [Mon, 12 Sep 2016 18:45:43 +0000 (18:45 +0000)]
JSC test timeout: ChakraCore.yaml/ChakraCore/test/Bugs/bug56026_trycatch.js.default
https://bugs.webkit.org/show_bug.cgi?id=161863

Reviewed by Saam Barati.

* ChakraCore.yaml:
Disabled Bugs/bug56026_trycatch.js.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205816 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoWeb Inspector: Object.shallowEqual() should return false if object prototype chains...
mattbaker@apple.com [Mon, 12 Sep 2016 18:35:40 +0000 (18:35 +0000)]
Web Inspector: Object.shallowEqual() should return false if object prototype chains differ
https://bugs.webkit.org/show_bug.cgi?id=161852

Reviewed by Joseph Pecoraro.

Source/WebInspectorUI:

Improve Object.shallowEqual so it won't produce false positives.

* UserInterface/Base/Utilities.js:
(value):
Object.shallowEqual should return false for non-array arguments.
Since typeof null === "object", use `instanceof` instead to avoid separate
null checks. Also use Array.shallowEqual fast path when both arguments are arrays.

LayoutTests:

* inspector/unit-tests/object-utilities-expected.txt: Added.
* inspector/unit-tests/object-utilities.html: Added.
Add test coverage for Object.shallowEqual.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205815 268f45cc-cd09-0410-ab3c-d52691b4dbfc

4 years agoCrash in com.apple.WebCore: WebCore::NavigatorGamepad::gamepadFromPlatformGamepad.
beidson@apple.com [Mon, 12 Sep 2016 18:18:05 +0000 (18:18 +0000)]
Crash in com.apple.WebCore: WebCore::NavigatorGamepad::gamepadFromPlatformGamepad.
<rdar://problem/28018073> and https://bugs.webkit.org/show_bug.cgi?id=161694

Reviewed by Alex Christensen.

No new tests (Caught by existing tests in some configurations).

* Modules/gamepad/GamepadManager.cpp:
(WebCore::GamepadManager::platformGamepadInputActivity): Null check.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205814 268f45cc-cd09-0410-ab3c-d52691b4dbfc