WebKit-https.git
2 years agoAttempted build fix.
bdakin@apple.com [Wed, 9 Nov 2016 22:27:16 +0000 (22:27 +0000)]
Attempted build fix.

* WebView/WebView.mm:

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

2 years agoNo need to set setFlowThreadState on RenderText in createTextRenderer.
zalan@apple.com [Wed, 9 Nov 2016 22:25:07 +0000 (22:25 +0000)]
No need to set setFlowThreadState on RenderText in createTextRenderer.
https://bugs.webkit.org/show_bug.cgi?id=164559

Reviewed by Antti Koivisto.

       setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
       styleWillChange/styleDidChange through initializeStyle, the state is already set.
       However since RenderText does not have its own style, it's sufficient to have the flow state set
       through the normal RenderElement::insertChildInternal code path.

No change in functionality.

* style/RenderTreeUpdater.cpp:
(WebCore::createTextRenderer):

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

2 years agoIndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
beidson@apple.com [Wed, 9 Nov 2016 22:24:49 +0000 (22:24 +0000)]
IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
https://bugs.webkit.org/show_bug.cgi?id=164504

Reviewed by Darin Adler.

Source/WebCore:

No new tests (Refactor, no behavior change).

This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
That struct will then be easily expandable in the future (e.g. bug 164404).

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::uncheckedIterateCursor):

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::iterateCursor):
(WebCore::IDBTransaction::iterateCursorOnServer):
* Modules/indexeddb/IDBTransaction.h:

* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
* Modules/indexeddb/client/IDBConnectionProxy.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/server/IDBBackingStore.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::iterateCursor):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
(WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
(WebCore::IDBIterateCursorData::isolatedCopy):
* Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
(WebCore::IDBIterateCursorData::encode):
(WebCore::IDBIterateCursorData::decode):

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::iterateCursor):
* Modules/indexeddb/shared/InProcessIDBServer.h:

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::iterateCursor):
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:

* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::iterateCursor):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:

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

2 years agoStyledElement::attributeChanged shouldn't do any work when the attribute value didn...
rniwa@webkit.org [Wed, 9 Nov 2016 22:15:05 +0000 (22:15 +0000)]
StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
https://bugs.webkit.org/show_bug.cgi?id=129476

Reviewed by Andreas Kling.

Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
when the attribute value didn't change as in r164856.

* dom/StyledElement.cpp:
(WebCore::StyledElement::attributeChanged):

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

2 years agoTypeProfiler and running GC collection on another thread don't play nicely with each...
sbarati@apple.com [Wed, 9 Nov 2016 22:02:20 +0000 (22:02 +0000)]
TypeProfiler and running GC collection on another thread don't play nicely with each other
https://bugs.webkit.org/show_bug.cgi?id=164441
<rdar://problem/29132174>

Reviewed by Geoffrey Garen.

JSTests:

* typeProfiler/type-profiler-gc.js: Added.
(bar):
(foo):

Source/JavaScriptCore:

This fix here is simple: we now treat the type profiler log as a GC root.
GC will make sure that we mark any values/structures that are in the log.
It's easy to reason about the correctness of this, and it also solves
the problem that we were clearing the log on the GC thread. Clearing the
log on the GC thread was a problem because when we clear the log, we may
allocate, which we're not allowed to do from the GC thread.

* heap/Heap.cpp:
(JSC::Heap::markRoots):
(JSC::Heap::visitTypeProfiler):
(JSC::Heap::collectInThread):
* heap/Heap.h:
* runtime/TypeProfilerLog.cpp:
(JSC::TypeProfilerLog::processLogEntries):
(JSC::TypeProfilerLog::visit):
* runtime/TypeProfilerLog.h:

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

2 years agoAllow RefPtrs of const ThreadSafeRefCounted types
commit-queue@webkit.org [Wed, 9 Nov 2016 21:42:33 +0000 (21:42 +0000)]
Allow RefPtrs of const ThreadSafeRefCounted types
https://bugs.webkit.org/show_bug.cgi?id=164548

Patch by Alex Christensen <achristensen@webkit.org> on 2016-11-09
Reviewed by Tim Horton.

* wtf/ThreadSafeRefCounted.h:
Make m_refCount mutable like we did with RefCounted in r203257.

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

2 years ago[DOMJIT] Implement Node::ownerDocument
utatane.tea@gmail.com [Wed, 9 Nov 2016 21:33:23 +0000 (21:33 +0000)]
[DOMJIT] Implement Node::ownerDocument
https://bugs.webkit.org/show_bug.cgi?id=164004

Reviewed by Darin Adler.

Source/WebCore:

Test: js/dom/domjit-accessor-owner-document.html

Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
document() won't return nullptr and access the member of it.

This patch aligns the DOMJIT implementation strictly to the C++ one.

* dom/Node.idl:
* domjit/JSNodeDOMJIT.cpp:
(WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
(WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):

LayoutTests:

* js/dom/domjit-accessor-owner-document-expected.txt: Added.
* js/dom/domjit-accessor-owner-document.html: Added.

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

2 years ago[SVG] Start moving special casing of SVG out of the bindings - SVGAngle
commit-queue@webkit.org [Wed, 9 Nov 2016 21:30:41 +0000 (21:30 +0000)]
[SVG] Start moving special casing of SVG out of the bindings - SVGAngle
https://bugs.webkit.org/show_bug.cgi?id=164496

Patch by Sam Weinig <sam@webkit.org> on 2016-11-09
Reviewed by Darin Adler.

There is quite a bit of special casing of SVG types in the bindings that adds
a lot of complexity and is relatively fragile, as it is based on type naming.

Instead of keeping the complexity in the bindings, I am going to move it into
the implementation, where it has also longed to be.

Starting small, with just SVGAngle. It has been split in two, with the existing
SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from
SVGPropertyTearOff<SVGAngleValue>).

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Add SVGAngleValue.cpp

* bindings/scripts/CodeGenerator.pm:
Remove SVGAngle as a special case.

* svg/SVGAngle.cpp: Removed.
* svg/SVGAngle.h:
Added. Implements the SVGAngle interface explicitly, getting to
the SVGAngleValue through propertyReference().

* svg/SVGAngle.idl:
* svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
* svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
Move old SVGAngle implementation to SVGAngleValue.

* svg/SVGAnimatedAngle.cpp:
Replace SVGAngle usage with SVGAngleValue.

* svg/SVGAnimatedAngle.h:
Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.

* svg/SVGAnimatedLength.h:
* svg/SVGAnimatedPreserveAspectRatio.h:
* svg/SVGAnimatedRect.h:
Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.

* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::createAngleAndEnumeration):
* svg/SVGAnimatedType.h:
(WebCore::SVGAnimatedType::angleAndEnumeration):
Use SVGAngleValue.

* svg/SVGComponentTransferFunctionElement.h:
Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).

* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::parseAttribute):
(WebCore::SVGMarkerElement::setOrient):
Switch to take an SVGAngleValue.

(WebCore::SVGMarkerElement::setOrientToAngle):
Update to pull the value out via propertyReference().

* svg/SVGMarkerElement.h:
Switch to take an SVGAngleValue.

* svg/SVGLengthList.h:
* svg/SVGNumberList.h:
* svg/SVGPathSegList.h:
* svg/SVGPointList.h:
* svg/SVGStringList.h:
* svg/SVGTransformList.h:
Switch to using type aliases in SVGPropertyTraits and add an alias for
ListItemTearOff.

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::createSVGAngle):
* svg/SVGSVGElement.h:
Change createSVGAngle to return a Ref<SVGAngle> and create one.

* svg/SVGSVGElement.idl:
Annotate IDL to indicate that a new value is being returned.

* svg/SVGTransform.cpp:
Remove unnecessary include of SVGAngle.h.

* svg/SVGViewSpec.cpp:
Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).

* svg/properties/SVGAnimatedPropertyTearOff.h:
Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
Property type from the TearOffType.

* svg/properties/SVGListProperty.h:
* svg/properties/SVGListPropertyTearOff.h:
Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.

* svg/properties/SVGPropertyTearOff.h:
Make the PropertyType available by exposing it as a type alias.

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

2 years agoMove Range from ExceptionCode to ExceptionOr
darin@apple.com [Wed, 9 Nov 2016 21:27:56 +0000 (21:27 +0000)]
Move Range from ExceptionCode to ExceptionOr
https://bugs.webkit.org/show_bug.cgi?id=164457

Reviewed by Alex Christensen.

Source/WebCore:

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
keeping behavior the same.
(WebCore::characterOffsetsInOrder): Ditto.
(WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
reference instead of a pointer. Use a boolean return value to indicate
success rather than an exception, since the callers don't need to know
which exception it is.
(WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
the above.
(WebCore::AXObjectCache::nextBoundary): Ditto.
(WebCore::AXObjectCache::previousBoundary): Ditto.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
Update to use ExceptionOr, keeping behavior the same.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
* accessibility/atk/WebKitAccessibleUtil.cpp:
(selectionBelongsToObject): Ditto.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
* dom/Node.cpp:
(WebCore::Node::textRects): Ditto.

* dom/Range.cpp:
(WebCore::Range::~Range): Remove old comment that no longer makes sense now
that the detach function no longer does anything.
(WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
keeping behavior the same.
(WebCore::Range::setStart): Ditto.
(WebCore::Range::setEnd): Ditto.
(WebCore::Range::isPointInRange): Ditto.
(WebCore::Range::comparePoint): Ditto.
(WebCore::Range::compareNode): Ditto.
(WebCore::top): Added helper function so that compareBoundaryPoints doesn't
need to have two identical loops in it.
(WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
keeping behavior the same.
(WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
instead of relying on the order of the values to check for unsupported values.
(WebCore::Range::boundaryPointsValid): Ditto.
(WebCore::Range::deleteContents): Ditto.
(WebCore::Range::intersectsNode): Ditto.
(WebCore::Range::processContents): Ditto.
(WebCore::deleteCharacterData): Ditto.
(WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
non-member function and private to this file instead of in the class.
(WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
since the code relies on using it after mutating the DOM.
(WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
to use ExceptionOr so the caller doesn't have to check the exception first.
(WebCore::Range::extractContents): Ditto.
(WebCore::Range::cloneContents): Ditto.
(WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
instead of three times.
(WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
per node instead of twice, to use downcast instead of static_cast, and to
use the word "node" instead of "n" for the local variable name.
(WebCore::Range::createContextualFragment): Ditto.
(WebCore::Range::checkNodeWOffset): Ditto.
(WebCore::Range::setStartAfter): Ditto.
(WebCore::Range::setEndBefore): Ditto.
(WebCore::Range::setEndAfter): Ditto.
(WebCore::Range::selectNode): Ditto.
(WebCore::Range::selectNodeContents): Ditto.
(WebCore::Range::surroundContents): Ditto.
(WebCore::Range::setStartBefore): Ditto.
(WebCore::Range::contains): Ditto. Except added code to handle exception
case to return false without asserting because I saw at least one crash
that seemed to imply this behavior was needed.
(WebCore::rangesOverlap): Ditto.
(WebCore::rangeOfContents): Ditto.
(WebCore::Range::expand): Ditto.
(WebCore::Range::getClientRects): Ditto.
(WebCore::Range::getBoundingClientRect): Ditto.
(WebCore::Range::borderAndTextQuads): Changed to use return value
instead of out argument, since it's a private function used only
within this class so it was easy to update all call sites.
(WebCore::Range::boundingRect): Updated for above. Also renamed since
there was no need for the name "internal" in this.
(WebCore::Range::absoluteBoundingRect): Ditto.
* dom/Range.h: Updated for above.
* dom/Range.idl: Use non-legacy exceptions. Also changed the default value
of the string argument to the expand function to the empty string rather
than "undefined", because the function silently does nothing when passed
any unrecognized string, and so this leaves behavior unchanged. I removed
the comment saying that the "undefined" default is wrong.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
to use ExceptionOr but behave the same.
* editing/Editor.cpp:
(WebCore::Editor::advanceToNextMisspelling): Ditto.
(WebCore::Editor::markAndReplaceFor): Ditto.
(WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
(WebCore::Editor::countMatchesForText): Ditto.
* editing/EditorCommand.cpp:
(WebCore::unionDOMRanges): Ditto.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::respondToNodeModification): Ditto.
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingParagraph::offsetTo): Ditto.
* editing/TextCheckingHelper.h: Updated for above and also deleted
unneeded private function checkingRange, which just churned the
reference count unnecessarily; instead use m_checkingRange directly.
* editing/TextIterator.cpp:
(WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
* editing/VisiblePosition.cpp:
(WebCore::setStart): Ditto.
(WebCore::setEnd): Ditto.
* editing/VisibleSelection.cpp:
(WebCore::makeSearchRange): Ditto.

* editing/VisibleUnits.cpp:
(WebCore::suffixLengthForRange): Changed argument from RefPtr to
a reference.
(WebCore::prefixLengthForRange): Ditto.
(WebCore::previousBoundary): Updated for ExceptionOr and the change
above.
(WebCore::nextBoundary): Ditto.
* editing/VisibleUnits.h: Updated for above.

* editing/htmlediting.cpp:
(WebCore::comparePositions): Updated to use ExceptionOr but behave
the same.
(WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
(WebCore::isNodeVisiblyContainedWithin): Ditto.
* editing/ios/EditorIOS.mm:
(WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
(WebCore::Editor::setTextAsChildOfElement): Ditto.
* editing/mac/EditorMac.mm:
(WebCore::Editor::adjustedSelectionRange): Ditto.
* editing/markup.cpp:
(WebCore::createMarkupInternal): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
* page/DOMSelection.cpp:
(WebCore::DOMSelection::addRange): Ditto.
(WebCore::DOMSelection::deleteFromDocument): Ditto.
(WebCore::DOMSelection::containsNode): Ditto.

* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent): Updated for change to
use ExceptionOr in Ragne::compareNode. Also refactored the function
to make the logic a little mroe straightforward and nest less of it
inside a loop.

* page/Page.cpp:
(WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
without changing behavior.
* page/TextIndicator.cpp:
(WebCore::hasNonInlineOrReplacedElements): Ditto.
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::getRanges): Ditto.

Source/WebKit/mac:

* DOM/DOMRange.mm:
(-[DOMRange setStart:offset:]): Updated exception handling.
(-[DOMRange setEnd:offset:]): Ditto.
(-[DOMRange setStartBefore:]): Ditto.
(-[DOMRange setStartAfter:]): Ditto.
(-[DOMRange setEndBefore:]): Ditto.
(-[DOMRange setEndAfter:]): Ditto.
(-[DOMRange selectNode:]): Ditto.
(-[DOMRange selectNodeContents:]): Ditto.
(-[DOMRange compareBoundaryPoints:sourceRange:]): Ditto.
(-[DOMRange deleteContents]): Ditto.
(-[DOMRange extractContents]): Ditto.
(-[DOMRange cloneContents]): Ditto.
(-[DOMRange insertNode:]): Ditto.
(-[DOMRange surroundContents:]): Ditto.
(-[DOMRange createContextualFragment:]): Ditto.
(-[DOMRange compareNode:]): Ditto.
(-[DOMRange intersectsNode:]): Ditto.
(-[DOMRange comparePoint:offset:]): Ditto.
(-[DOMRange isPointInRange:offset:]): Ditto.
(-[DOMRange expand:]): Ditto.
* WebView/WebFrame.mm:
(-[WebFrame _documentFragmentWithMarkupString:baseURLString:]): Ditto.
(-[WebFrame _smartDeleteRangeForProposedRange:]): Deleted.
This function was incorrectly implemented (set both start and end of
the range to the computed start), not declared in any header file,
not used anywhere inside WebKit, and I also could not find a use of it
in outside-WebKit Apple code.
* mac/DOM/DOMUIKitExtensions.mm:
(-[DOMRange move:inDirection:]): Ditto.
(-[DOMRange extend:inDirection:]): Ditto.

Source/WebKit/win:

* WebView.cpp:
(WebView::onIMERequestCharPosition): Updated for new exception handling.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMRange.cpp:
(webkit_dom_range_set_start): Updated exception handling.
(webkit_dom_range_set_end): Ditto.
(webkit_dom_range_set_start_before): Ditto.
(webkit_dom_range_set_start_after): Ditto.
(webkit_dom_range_set_end_before): Ditto.
(webkit_dom_range_set_end_after): Ditto.
(webkit_dom_range_select_node): Ditto.
(webkit_dom_range_select_node_contents): Ditto.
(webkit_dom_range_compare_boundary_points): Ditto.
(webkit_dom_range_delete_contents): Ditto.
(webkit_dom_range_extract_contents): Ditto.
(webkit_dom_range_clone_contents): Ditto.
(webkit_dom_range_insert_node): Ditto.
(webkit_dom_range_surround_contents): Ditto.
(webkit_dom_range_create_contextual_fragment): Ditto.
(webkit_dom_range_compare_node): Ditto.
(webkit_dom_range_intersects_node): Ditto.
(webkit_dom_range_compare_point): Ditto.
(webkit_dom_range_is_point_in_range): Ditto.
(webkit_dom_range_expand): Ditto.
* WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
(-[WKDOMRange setStart:offset:]): Ditto.
(-[WKDOMRange setEnd:offset:]): Ditto.
(-[WKDOMRange selectNode:]): Ditto.
(-[WKDOMRange selectNodeContents:]): Ditto.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::contentsAsString): Ditto.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rangeForWebSelectionAtPosition): Ditto.
(WebKit::WebPage::rangeForBlockAtPoint): Ditto.
(WebKit::WebPage::selectWithGesture): Ditto.
(WebKit::containsRange): Ditto.
(WebKit::unionDOMRanges): Ditto.
(WebKit::WebPage::switchToBlockSelectionAtPoint): Ditto.
(WebKit::WebPage::getPositionInformation): Ditto.

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

2 years ago[CSS Parser] Fix grid layout parsing
hyatt@apple.com [Wed, 9 Nov 2016 21:27:29 +0000 (21:27 +0000)]
[CSS Parser] Fix grid layout parsing
https://bugs.webkit.org/show_bug.cgi?id=164489

Reviewed by Dean Jackson.

Source/WebCore:

* css/CSSValueKeywords.in:
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFitContent):
(WebCore::isGridTrackFixedSized):
(WebCore::consumeGridTrackSize):
(WebCore::consumeGridTrackRepeatFunction):
(WebCore::consumeGridTrackList):
(WebCore::isCustomIdentValue):
(WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
(WebCore::CSSPropertyParser::consumeGridAreaShorthand):
(WebCore::consumeImplicitGridAutoFlow):
(WebCore::CSSPropertyParser::consumeGridShorthand):

LayoutTests:

* fast/css-grid-layout/grid-auto-columns-rows-auto-flow-resolution.html:

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

2 years agoCorrect a typo in the name of a flaky test.
ryanhaddad@apple.com [Wed, 9 Nov 2016 21:21:40 +0000 (21:21 +0000)]
Correct a typo in the name of a flaky test.
https://bugs.webkit.org/show_bug.cgi?id=164388

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoMove EventTarget from ExceptionCode to ExceptionOr
darin@apple.com [Wed, 9 Nov 2016 21:21:02 +0000 (21:21 +0000)]
Move EventTarget from ExceptionCode to ExceptionOr
https://bugs.webkit.org/show_bug.cgi?id=164465

Reviewed by Youenn Fablet.

Source/WebCore:

* Modules/indexeddb/IDBRequest.h: Added now-needed forward
class declarations.
* Modules/webaudio/AudioContext.h: Ditto.

* bindings/js/JSEventListener.cpp:
(WebCore::eventHandlerAttribute): Updated for name change of the
attributeEventListener function.
(WebCore::documentEventHandlerAttribute): Ditto.
* dom/Document.cpp:
(WebCore::Document::getWindowAttributeEventListener): Ditto.

* dom/EventTarget.cpp:
(WebCore::EventTarget::setAttributeEventListener): Updated for
name change.
(WebCore::EventTarget::attributeEventListener): Ditto.
(WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
(WebCore::legacyType): Use null instead of empty for no type, since
it's more efficient to check for null.
(WebCore::EventTarget::fireEventListeners): Check for null.
Also streamlined logic a little bit and removed a very old comment.
(WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
* dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
some functions to remove get prefix. Updated for above changes.
Moved one inline function out of the class header. Made the destructor
for EventTarget be inline to make the destructors for derived classes
slightly more efficient.
* dom/EventTarget.idl: Use non-legacy exception.

* dom/Node.cpp:
(WebCore::Node::didMoveToNewDocument): Updated for name change.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::ReplacementFragment): Ditto.

* inspector/InspectorCSSAgent.h: Added now-needed forward declaration.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.

* inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
* page/DOMWindow.h: Ditto.
* xml/XMLHttpRequest.h: Ditto.

Source/WebKit/mac:

* DOM/DOMNode.mm:
(-[DOMNode dispatchEvent:]): Updated exception handling.

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMNode::dispatchEvent): Updated exception handling.
(DOMWindow::dispatchEvent): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
(webkit_dom_attr_dispatch_event): Updated exception handling.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
(webkit_dom_cdata_section_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
(webkit_dom_character_data_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
(webkit_dom_comment_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
(webkit_dom_dom_window_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
(webkit_dom_document_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
(webkit_dom_document_fragment_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
(webkit_dom_document_type_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
(webkit_dom_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
(webkit_dom_html_anchor_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
(webkit_dom_html_applet_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
(webkit_dom_html_area_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
(webkit_dom_html_br_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
(webkit_dom_html_base_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
(webkit_dom_html_body_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
(webkit_dom_html_button_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLCanvasElement.cpp:
(webkit_dom_html_canvas_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDListElement.cpp:
(webkit_dom_html_d_list_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDirectoryElement.cpp:
(webkit_dom_html_directory_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
(webkit_dom_html_div_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDocument.cpp:
(webkit_dom_html_document_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
(webkit_dom_html_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
(webkit_dom_html_embed_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFieldSetElement.cpp:
(webkit_dom_html_field_set_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
(webkit_dom_html_font_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
(webkit_dom_html_form_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
(webkit_dom_html_frame_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
(webkit_dom_html_frame_set_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
(webkit_dom_html_hr_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
(webkit_dom_html_heading_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
(webkit_dom_html_head_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
(webkit_dom_html_html_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
(webkit_dom_html_iframe_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
(webkit_dom_html_image_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
(webkit_dom_html_input_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
(webkit_dom_html_li_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
(webkit_dom_html_label_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
(webkit_dom_html_legend_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
(webkit_dom_html_link_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMapElement.cpp:
(webkit_dom_html_map_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMarqueeElement.cpp:
(webkit_dom_html_marquee_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMenuElement.cpp:
(webkit_dom_html_menu_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
(webkit_dom_html_meta_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
(webkit_dom_html_mod_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
(webkit_dom_html_o_list_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
(webkit_dom_html_object_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
(webkit_dom_html_opt_group_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptionElement.cpp:
(webkit_dom_html_option_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
(webkit_dom_html_paragraph_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
(webkit_dom_html_param_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLPreElement.cpp:
(webkit_dom_html_pre_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLQuoteElement.cpp:
(webkit_dom_html_quote_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
(webkit_dom_html_script_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLSelectElement.cpp:
(webkit_dom_html_select_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
(webkit_dom_html_style_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
(webkit_dom_html_table_caption_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
(webkit_dom_html_table_cell_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
(webkit_dom_html_table_col_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
(webkit_dom_html_table_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
(webkit_dom_html_table_row_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
(webkit_dom_html_table_section_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTextAreaElement.cpp:
(webkit_dom_html_text_area_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTitleElement.cpp:
(webkit_dom_html_title_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
(webkit_dom_html_u_list_element_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNode.cpp:
(webkit_dom_node_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMProcessingInstruction.cpp:
(webkit_dom_processing_instruction_dispatch_event): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMText.cpp:
(webkit_dom_text_dispatch_event): Ditto.

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

2 years agoAdd test infrastructure and tests for existing HTTP 0.9 sandbox machinery
dbates@webkit.org [Wed, 9 Nov 2016 21:17:45 +0000 (21:17 +0000)]
Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
https://bugs.webkit.org/show_bug.cgi?id=164389
<rdar://problem/29101072>

Reviewed by Alex Christensen.

Source/WebCore:

Add test infrastructure to support registering an arbitrary port as the default port
for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
can be effected by whether the resource request was made using the default port for
the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
a test to override the default port associated with a protocol so as to support
testing these code paths using the existing port 8000 server started by run-webkit-httpd.
Without window.internals.registerDefaultPortForProtocol() we would need to teach
run-webkit-httpd to run a web server on port 80, which requires superuser privileges
(since it is a privileged port number) and is more likely to interfere with an
existing web server setup.

Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
       http/tests/security/http-0.9/default-port-script-blocked.html
       http/tests/security/http-0.9/iframe-blocked.html
       http/tests/security/http-0.9/image-blocked.html
       http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
       http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
       http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
       http/tests/security/http-0.9/worker-connect-src-blocked.html
       http/tests/security/http-0.9/worker-importScripts-blocked.html
       http/tests/security/http-0.9/xhr-asynchronous-blocked.html

* platform/URL.cpp:
(WebCore::defaultPortForProtocolMapForTesting): Added.
(WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
mapping used for testing.
(WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
test runs.
(WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
before consulting URLParser::defaultPortForProtocol().
* platform/URL.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
(WebCore::Internals::registerDefaultPortForProtocol): Added.
* testing/Internals.h:
* testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().

LayoutTests:

Add tests for the existing HTTP 0.9 sandbox machinery. Until we fix <https://bugs.webkit.org/show_bug.cgi?id=164387>,
these tests can only be run singly (i.e. pass --run-singly to run-webkit-tests). So, we skip
these tests to avoid test failures when run-webkit-tests runs in parallel mode (the default
mode and the mode used on the buildbots).

* TestExpectations:
* http/tests/security/http-0.9/default-port-plugin-blocked-expected.txt: Added.
* http/tests/security/http-0.9/default-port-plugin-blocked.html: Added.
* http/tests/security/http-0.9/default-port-script-blocked-expected.txt: Added.
* http/tests/security/http-0.9/default-port-script-blocked.html: Added.
* http/tests/security/http-0.9/iframe-blocked-expected.txt: Added.
* http/tests/security/http-0.9/iframe-blocked.html: Added.
* http/tests/security/http-0.9/image-blocked-expected.txt: Added.
* http/tests/security/http-0.9/image-blocked.html: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-expected.txt: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test-expected.html: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked-expected.txt: Added.
* http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html: Added.
* http/tests/security/http-0.9/resources/blue-square.png: Added.
* http/tests/security/http-0.9/resources/nph-alert-fail.pl: Added.
* http/tests/security/http-0.9/resources/nph-fail.pl: Added.
* http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-default-port-page-allowed.pl: Added.
* http/tests/security/http-0.9/resources/nph-image-on-HTTP-0.9-page-blocked.pl: Added.
* http/tests/security/http-0.9/resources/nph-image.pl: Added.
* http/tests/security/http-0.9/resources/nph-load-plugin-fail.pl: Added.
* http/tests/security/http-0.9/resources/nph-worker-fail.pl: Added.
* http/tests/security/http-0.9/worker-connect-src-blocked-expected.txt: Added.
* http/tests/security/http-0.9/worker-connect-src-blocked.html: Added.
* http/tests/security/http-0.9/worker-importScripts-blocked-expected.txt: Added.
* http/tests/security/http-0.9/worker-importScripts-blocked.html: Added.
* http/tests/security/http-0.9/xhr-asynchronous-blocked-expected.txt: Added.
* http/tests/security/http-0.9/xhr-asynchronous-blocked.html: Added.

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

2 years ago[WebIDL] Add proper parsing for Promises
commit-queue@webkit.org [Wed, 9 Nov 2016 21:16:44 +0000 (21:16 +0000)]
[WebIDL] Add proper parsing for Promises
https://bugs.webkit.org/show_bug.cgi?id=164497

Patch by Sam Weinig <sam@webkit.org> on 2016-11-09
Reviewed by Tim Horton.

* bindings/scripts/IDLParser.pm:
(parseNonAnyType):
(parseStringType):
Require Promise types to declare the type they resolve to.

* bindings/js/JSDOMPromise.h:
Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
overload of resolve that takes no arguments when in a DOMPromise<void>.

* Modules/applepay/ApplePaySession.idl:
* Modules/fetch/DOMWindowFetch.idl:
* Modules/fetch/FetchBody.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/fetch/WorkerGlobalScopeFetch.idl:
* Modules/mediastream/MediaDevices.idl:
* Modules/mediastream/MediaStreamTrack.idl:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCStatsReport.idl:
* Modules/streams/ReadableStream.idl:
* Modules/streams/ReadableStreamDefaultReader.idl:
* Modules/streams/ReadableStreamSource.idl:
* Modules/streams/WritableStream.idl:
* Modules/webaudio/AudioContext.idl:
* bindings/scripts/test/TestNode.idl:
* bindings/scripts/test/TestObj.idl:
* crypto/SubtleCrypto.idl:
* crypto/WebKitSubtleCrypto.idl:
* css/FontFace.idl:
* css/FontFaceSet.idl:
* dom/CustomElementRegistry.idl:
* html/HTMLMediaElement.idl:
Update IDLs to specify the resolve type of promise types.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::replaceTrack):
(WebCore::MediaEndpointPeerConnection::replaceTrackTask):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::applyConstraints):
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
(WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/streams/ReadableStreamSource.h:
(WebCore::ReadableStreamSource::start):
(WebCore::ReadableStreamSource::pull):
(WebCore::ReadableStreamSource::startFinished):
(WebCore::ReadableStreamSource::pullFinished):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::addReaction):
(WebCore::AudioContext::setState):
(WebCore::AudioContext::suspend):
(WebCore::AudioContext::resume):
(WebCore::AudioContext::close):
* Modules/webaudio/AudioContext.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::rejectPendingPlayPromises):
(WebCore::HTMLMediaElement::resolvePendingPlayPromises):
(WebCore::HTMLMediaElement::play):
* html/HTMLMediaElement.h:
Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
and use the new resolve() overload.

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

2 years agoFollowup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction...
beidson@apple.com [Wed, 9 Nov 2016 20:58:07 +0000 (20:58 +0000)]
Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&

Rubberstamped by Alex Christensen.

No new tests (No behavior change).

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::IDBObjectStore):
(WebCore::IDBObjectStore::~IDBObjectStore):
(WebCore::IDBObjectStore::hasPendingActivity):
(WebCore::IDBObjectStore::name):
(WebCore::IDBObjectStore::setName):
(WebCore::IDBObjectStore::keyPath):
(WebCore::IDBObjectStore::indexNames):
(WebCore::IDBObjectStore::transaction):
(WebCore::IDBObjectStore::autoIncrement):
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::putOrAdd):
(WebCore::IDBObjectStore::doDelete):
(WebCore::IDBObjectStore::clear):
(WebCore::IDBObjectStore::createIndex):
(WebCore::IDBObjectStore::index):
(WebCore::IDBObjectStore::deleteIndex):
(WebCore::IDBObjectStore::doCount):
(WebCore::IDBObjectStore::getAll):
(WebCore::IDBObjectStore::getAllKeys):
(WebCore::IDBObjectStore::markAsDeleted):
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
(WebCore::IDBObjectStore::ref):
(WebCore::IDBObjectStore::deref):
* Modules/indexeddb/IDBObjectStore.h:

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

2 years agoMove RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
zalan@apple.com [Wed, 9 Nov 2016 20:38:28 +0000 (20:38 +0000)]
Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
https://bugs.webkit.org/show_bug.cgi?id=164503

Reviewed by Antti Koivisto.

When we insert a renderer into the render tree, we need to know both its parent
and its next sibling. Normally the parent and the sibling are based on the DOM, but
when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling.
To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement().
RenderNamedFlowThread keeps track of its children so that it can compute the next sibling
for the insertion point.

This patch eliminates the need for keeping track of the child renderers of each
flow by moving the 'next sibling' logic to RenderTreePosition.

No change in functionality.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertedIntoTree):
(WebCore::RenderElement::willBeDestroyed):
(WebCore::RenderElement::removeFromRenderFlowThread):
(WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted.
* rendering/RenderElement.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted.
(WebCore::RenderNamedFlowThread::addFlowChild): Deleted.
(WebCore::RenderNamedFlowThread::removeFlowChild): Deleted.
* rendering/RenderNamedFlowThread.h:
* style/RenderTreePosition.cpp:
(WebCore::RenderTreePosition::previousSiblingRenderer):
(WebCore::RenderTreePosition::flowThreadInsertionContext):
* style/RenderTreePosition.h:
(WebCore::RenderTreePosition::RenderTreePosition):
(WebCore::RenderTreePosition::parent):
* style/RenderTreeUpdater.cpp:
(WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none).
(WebCore::RenderTreeUpdater::createRenderer):
(WebCore::moveToFlowThreadIfNeeded): Deleted.

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

2 years ago[Win][Direct2D] Incomplete image decoding.
pvollan@apple.com [Wed, 9 Nov 2016 20:29:23 +0000 (20:29 +0000)]
[Win][Direct2D] Incomplete image decoding.
https://bugs.webkit.org/show_bug.cgi?id=164511

Reviewed by Darin Adler.

Create native decoder when all image data has been received.

* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoder::setData):

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

2 years agoAttempted build fix.
bdakin@apple.com [Wed, 9 Nov 2016 20:25:54 +0000 (20:25 +0000)]
Attempted build fix.

* platform/spi/cocoa/AVKitSPI.h:

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

2 years agoIndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index...
beidson@apple.com [Wed, 9 Nov 2016 20:23:11 +0000 (20:23 +0000)]
IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime.
https://bugs.webkit.org/show_bug.cgi?id=164466

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/transaction-abort-index-metadata-revert-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests that now pass).

Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive.
Now, IDBObjectStore ref/deref do the same thing for the owning transaction.

Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted"
set and get promoted back up into the "referenced" set.

Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back
to the owning objects.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::IDBObjectStore):
(WebCore::IDBObjectStore::indexNames):
(WebCore::IDBObjectStore::transaction):
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
(WebCore::IDBObjectStore::deleteIndex):
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
(WebCore::IDBObjectStore::visitReferencedIndexes):
(WebCore::IDBObjectStore::ref):
(WebCore::IDBObjectStore::deref):
(WebCore::IDBObjectStore::create): Deleted.
* Modules/indexeddb/IDBObjectStore.h:

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::objectStore):
(WebCore::IDBTransaction::transitionedToFinishing):
(WebCore::IDBTransaction::internalAbort):
(WebCore::IDBTransaction::createObjectStore):
(WebCore::IDBTransaction::deleteObjectStore):
(WebCore::IDBTransaction::visitReferencedObjectStores):
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/IDBTransaction.idl:

* bindings/js/JSIDBTransactionCustom.cpp: Added.
(WebCore::JSIDBTransaction::visitAdditionalChildren):

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

2 years agoAllow customization of TextStream-based logging for geometry types
simon.fraser@apple.com [Wed, 9 Nov 2016 20:22:37 +0000 (20:22 +0000)]
Allow customization of TextStream-based logging for geometry types
https://bugs.webkit.org/show_bug.cgi?id=164460

Reviewed by Zalan Bujtas.

TextStream-based logging was constrained by the requirement to maintain compatibility
with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40")
and dumping LayoutRects as IntRects.

Add some formatting flags so that other TextStream clients (e.g. logging) can have
more readable output, and opt into automatic FormatNumberRespectingIntegers behavior.

TextStreams whose output appears in test results are given flags to avoid behavior
changes, but in the longer term test results should be updated.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::replayDisplayListAsText):
* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::scrollingStateTreeAsText):
* platform/graphics/FloatPoint.cpp:
(WebCore::operator<<):
* platform/graphics/FloatRect.cpp:
(WebCore::operator<<):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::layerTreeAsText):
* platform/graphics/IntRect.cpp:
(WebCore::operator<<):
* platform/graphics/LayoutPoint.cpp:
(WebCore::operator<<):
* platform/graphics/LayoutRect.cpp:
(WebCore::operator<<):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::replayDisplayListAsText):
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::asText):
* platform/text/TextStream.cpp:
(WebCore::TextStream::operator<<):
* platform/text/TextStream.h:
(WebCore::TextStream::TextStream):
(WebCore::TextStream::formattingFlags):
(WebCore::TextStream::setFormattingFlags):
(WebCore::TextStream::hasFormattingFlag):
(WebCore::TextStream::increaseIndent):
(WebCore::TextStream::decreaseIndent):
* rendering/RenderTreeAsText.cpp:
(WebCore::externalRepresentation):
(WebCore::counterValueForElement):

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

2 years agoRenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead...
zalan@apple.com [Wed, 9 Nov 2016 20:21:49 +0000 (20:21 +0000)]
RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject*
https://bugs.webkit.org/show_bug.cgi?id=164543

Reviewed by Simon Fraser.

No change in functionality.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::removeChild):
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
(WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved):
* rendering/RenderMultiColumnFlowThread.h:

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

2 years agoREGRESSION (r208149): Media scrubber is not displayed in media controls
jer.noble@apple.com [Wed, 9 Nov 2016 20:18:46 +0000 (20:18 +0000)]
REGRESSION (r208149): Media scrubber is not displayed in media controls
https://bugs.webkit.org/show_bug.cgi?id=164514

Reviewed by Darin Adler.

Fixes broken Media Controls API tests.

Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of
MediaElementSession.h so that is<> and downcast<> work correctly.

* html/MediaElementSession.h:
(isType):

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

2 years agoWebAssembly: Silence noisy warning
jfbastien@apple.com [Wed, 9 Nov 2016 20:13:11 +0000 (20:13 +0000)]
WebAssembly: Silence noisy warning
https://bugs.webkit.org/show_bug.cgi?id=164459

Reviewed by Yusuke Suzuki.

* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::Plan):

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

2 years agoWhen editing IME, `compositionend` events should fire after input events
wenson_hsieh@apple.com [Wed, 9 Nov 2016 20:06:00 +0000 (20:06 +0000)]
When editing IME, `compositionend` events should fire after input events
https://bugs.webkit.org/show_bug.cgi?id=164324
<rdar://problem/29050438>

Reviewed by Darin Adler.

Source/WebCore:

Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or
`input` events. Also augments existing layout tests to verify the change.

* editing/Editor.cpp:
(WebCore::Editor::setComposition):

LayoutTests:

Augments fast/events/input-events-ime-recomposition.html and fast/events/input-events-ime-composition.html to
verify that compositionend events are fired after input events. Also rebaselines
fast/events/ime-composition-events-001.html.

* fast/events/ime-composition-events-001-expected.txt:
* fast/events/input-events-ime-composition-expected.txt:
* fast/events/input-events-ime-composition.html:
* fast/events/input-events-ime-recomposition-expected.txt:
* fast/events/input-events-ime-recomposition.html:

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

2 years agoSetting foreground color when text is selected should fire an input event with color...
wenson_hsieh@apple.com [Wed, 9 Nov 2016 20:04:51 +0000 (20:04 +0000)]
Setting foreground color when text is selected should fire an input event with color data
https://bugs.webkit.org/show_bug.cgi?id=164241
<rdar://problem/29032759>

Reviewed by Darin Adler.

Source/WebCore:

Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch.
Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to
return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle,
in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command.

Test: fast/events/input-events-selection-forecolor-data.html

* editing/ApplyStyleCommand.h:
* editing/Editor.cpp:
(WebCore::inputEventDataForEditingStyleAndAction):
(WebCore::Editor::applyStyle):
(WebCore::Editor::applyParagraphStyle):
(WebCore::Editor::computeAndSetTypingStyle):

LayoutTests:

Adds a new layout test verifying that selecting text and setting its foreground color will fire input events
with the correct RGB values in the data attribute.

* fast/events/input-events-selection-forecolor-data-expected.txt: Added.
* fast/events/input-events-selection-forecolor-data.html: Added.
* platform/ios-simulator/TestExpectations:

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

2 years agoRendering support for ExtendedColors
dino@apple.com [Wed, 9 Nov 2016 19:56:17 +0000 (19:56 +0000)]
Rendering support for ExtendedColors
https://bugs.webkit.org/show_bug.cgi?id=164443
<rdar://problems/29123243>

Reviewed by Simon Fraser and Darin Adler.

Source/WebCore:

Add support for rendering the new color() syntax, which
ends up as an ExtendedColor.

In order to make rendering code a little more readable, I
changed Color::hasAlpha to Color::isOpaque (since an alpha
of 100% is still an alpha), and added a Color::isVisible
helper (the color isn't completely transparent). These new
helpers support ExtendedColor forms.

Support for painting gradients and blending between colors
is still to come. I also added some FIXME comments
to show other places that don't handle ExtendedColors yet.

Tests: css3/color/backgrounds-and-borders.html
       css3/color/box-shadows.html
       css3/color/canvas.html
       css3/color/composited-solid-backgrounds.html
       css3/color/text.html

* css/CSSGradientValue.cpp: Add some notes that this is broken.
(WebCore::interpolate):
(WebCore::CSSGradientValue::knownToBeOpaque):

* editing/EditingStyle.cpp: Use new Color helpers.
(WebCore::isTransparentColorValue):

* editing/mac/EditorMac.mm: Use new Color helpers.
(WebCore::Editor::fontAttributesForSelectionStart):

* html/ColorInputType.cpp: No need to use the Color class at all here.
(WebCore::isValidSimpleColorString): Renamed from isValidColorString.
(WebCore::ColorInputType::sanitizeValue):
(WebCore::ColorInputType::typeMismatchFor):
(WebCore::isValidColorString): Deleted.

* html/canvas/CanvasRenderingContext2D.cpp: New helpers.
(WebCore::CanvasRenderingContext2D::shouldDrawShadows):
(WebCore::CanvasRenderingContext2D::didDraw):

* page/FrameView.cpp: Ditto.
(WebCore::FrameView::recalculateScrollbarOverlayStyle):
(WebCore::FrameView::hasOpaqueBackground):
(WebCore::FrameView::setBaseBackgroundColor):

* platform/graphics/Color.cpp:
(WebCore::differenceSquared): Support ExtendedColor, but also
add a note to indicate that this method and its call sites
should use floats.
(WebCore::Color::serialized): New helper.
(WebCore::Color::cssText): Ditto.
(WebCore::Color::blend): Ditto.
(WebCore::Color::blendWithWhite):
(WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function.
(WebCore::Color::colorWithAlpha): Ditto.
(WebCore::Color::opaqueColor): New method to return an opaque version of the given color.
(WebCore::blend):
* platform/graphics/Color.h:
(WebCore::Color::isOpaque): New helper that is !hasAlpha().
(WebCore::Color::isVisible): New helper.
(WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces
a bunch of places that were calculating it manually each time. Meanwhile, we
might consider always exposing the primaries as floats... or at least
have that option.
(WebCore::isBlackColor): New helper - it was used in a couple of places.
(WebCore::isWhiteColor): Ditto.
(WebCore::Color::hasAlpha): Deleted.

* platform/graphics/Gradient.cpp: Add FIXME.
(WebCore::Gradient::addColorStop):
* platform/graphics/Gradient.h:

* platform/graphics/GraphicsContext.cpp: Use new helpers.
(WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::hasVisibleShadow):

* platform/graphics/Image.cpp: Ditto.
(WebCore::Image::fillWithSolidColor):

* platform/graphics/ShadowBlur.cpp: Ditto.
(WebCore::ShadowBlur::updateShadowBlurValues):

* platform/graphics/ca/GraphicsLayerCA.cpp: Ditto.
(WebCore::GraphicsLayerCA::setContentsToSolidColor):

* platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::platformGradient): Add a FIXME to note that we can
add ExtendedColor support simply by using CGColors, rather than fetching
the components ourselves.

* platform/graphics/cg/GraphicsContextCG.cpp: New helpers.
(WebCore::calculateDrawingMode):

* platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers.
(WebCore::FontCascade::drawGlyphs):

* platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash().
(WebCore::nsColor):

* platform/graphics/texmap/TextureMapperGL.cpp: New helpers.
(WebCore::TextureMapperGL::drawBorder):

* rendering/BorderEdge.cpp: Ditto.
(WebCore::BorderEdge::obscuresBackgroundEdge):
(WebCore::BorderEdge::obscuresBackground):

* rendering/RenderBox.cpp: Ditto.
(WebCore::RenderBox::getBackgroundPaintedExtent):
(WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
(WebCore::RenderBox::backgroundHasOpaqueTopLayer):

* rendering/RenderBoxModelObject.cpp: Ditto.
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::colorNeedsAntiAliasAtCorner):
(WebCore::willBeOverdrawn):
(WebCore::RenderBoxModelObject::paintTranslucentBorderSides):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
(WebCore::RenderBoxModelObject::paintBoxShadow):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintOutline):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutline):
* rendering/RenderLayerBacking.cpp:
(WebCore::canCreateTiledImage):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::viewHasTransparentBackground):
* rendering/RenderMenuList.cpp:
(RenderMenuList::getItemBackgroundColor):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::disabledTextColor):
* rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):
* rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintTextDecoration):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextWithShadows):
* rendering/style/BorderValue.h:
(WebCore::BorderValue::isTransparent):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::visitedDependentColor):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::hasBackground):
* rendering/svg/RenderSVGResource.cpp:
(WebCore::requestPaintingResource):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintSelectionBackground):

* svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken.
(WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):

Source/WebKit2:

Implement argument coders for Color.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Color>::encode):
(IPC::ArgumentCoder<Color>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateScrollViewBackground]):

LayoutTests:

Tests that use the new color() syntax.

* css3/color/backgrounds-and-borders-expected.html: Added.
* css3/color/backgrounds-and-borders.html: Added.
* css3/color/box-shadows-expected.html: Added.
* css3/color/box-shadows.html: Added.
* css3/color/canvas-expected.html: Added.
* css3/color/canvas.html: Added.
* css3/color/composited-solid-backgrounds-expected.html: Added.
* css3/color/composited-solid-backgrounds.html: Added.
* css3/color/text-expected.html: Added.
* css3/color/text.html: Added.
* editing/mac/attributed-string/anchor-element-expected.txt: Updated.
* editing/mac/attributed-string/basic-expected.txt:

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

2 years agoBuild fix.
bdakin@apple.com [Wed, 9 Nov 2016 19:54:25 +0000 (19:54 +0000)]
Build fix.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::~WebViewImpl):

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

2 years agoIgnore URL.origin in URL web-platform-tests
achristensen@apple.com [Wed, 9 Nov 2016 19:40:37 +0000 (19:40 +0000)]
Ignore URL.origin in URL web-platform-tests
https://bugs.webkit.org/show_bug.cgi?id=164553

Reviewed by Tim Horton.

Spec-noncompliance in our SecurityOrigin class is covering up URLParser bugs.
Let's ignore those bugs for now in our copy of the web-platform-tests so we can see URLParser conformance improvement in our results.
I've proposed moving these URL.origin checks to different tests in https://github.com/w3c/web-platform-tests/pull/4182

* web-platform-tests/url/a-element-expected.txt:
* web-platform-tests/url/a-element-xhtml-expected.txt:
* web-platform-tests/url/a-element.js:
(runURLTests):
* web-platform-tests/url/url-constructor-expected.txt:
* web-platform-tests/url/url-constructor.html:

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

2 years ago[Modern Media Controls] UI Library: StatusLabel
graouts@webkit.org [Wed, 9 Nov 2016 19:37:22 +0000 (19:37 +0000)]
[Modern Media Controls] UI Library: StatusLabel
https://bugs.webkit.org/show_bug.cgi?id=164544
<rdar://problem/29179541>

Reviewed by Dean Jackson.

We add a new StatusLabel class to display a string of text in place of the TimeControl.
A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast"
test under the right media state.

Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html
       media/modern-media-controls/status-label/status-label.html

* Modules/modern-media-controls/controls/macos-inline-media-controls.css:
(.media-controls.mac.inline .time-label,):
(.media-controls.mac.inline .time-label): Deleted.
* Modules/modern-media-controls/controls/macos-inline-media-controls.js:
(MacOSInlineMediaControls.prototype.layout):
* Modules/modern-media-controls/controls/media-controls.js:
(MediaControls.):
* Modules/modern-media-controls/controls/status-label.css: Added.
(.status-label):
* Modules/modern-media-controls/controls/status-label.js: Added.
(StatusLabel.prototype.get text):
(StatusLabel.prototype.set text):
(StatusLabel.prototype.commitProperty):
* Modules/modern-media-controls/js-files:
* WebCore.xcodeproj/project.pbxproj:

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

2 years ago[Mac] Stop using deprecated AppKit enumeration values
cdumez@apple.com [Wed, 9 Nov 2016 19:31:56 +0000 (19:31 +0000)]
[Mac] Stop using deprecated AppKit enumeration values
https://bugs.webkit.org/show_bug.cgi?id=164494

Reviewed by Darin Adler.

Stop using deprecated AppKit enumeration values.

Source/WebCore:

* editing/cocoa/HTMLConverter.mm:
(HTMLConverter::computedAttributesForElement):
(HTMLConverter::_processElement):
(HTMLConverter::_addMarkersToList):
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::keyEvent):
(WebCore::lastEventIsMouseUp):
(WebCore::EventHandler::passSubframeEventToSubframe):
(WebCore::EventHandler::widgetDidHandleWheelEvent):
(WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
* page/mac/TextIndicatorWindow.mm:
(WebCore::TextIndicatorWindow::setTextIndicator):
* platform/graphics/mac/IconMac.mm:
(WebCore::Icon::paint):
* platform/mac/CursorMac.mm:
(WebCore::createCustomCursor):
* platform/mac/DragImageMac.mm:
(WebCore::dissolveDragImageToFraction):
(WebCore::createDragImageFromImage):
* platform/mac/EventLoopMac.mm:
(WebCore::EventLoop::cycle):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::setDragImage):
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::globalPointForEvent):
(WebCore::pointForEvent):
(WebCore::mouseButtonForEvent):
(WebCore::mouseEventTypeForEvent):
(WebCore::clickCountForEvent):
(WebCore::isKeypadEvent):
(WebCore::windowsKeyCodeForKeyEvent):
(WebCore::isKeyUpEvent):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::scrollbarControlSizeToNSControlSize):
* platform/mac/ThemeMac.mm:
(-[WebCoreThemeView window]):
(WebCore::controlSizeForFont):
(WebCore::controlSizeFromPixelSize):
(WebCore::setUpButtonCell):
(WebCore::stepperControlSizeForFont):
(WebCore::paintStepper):
(WebCore::ThemeMac::minimumControlSize):
* platform/mac/WebVideoFullscreenHUDWindowController.mm:
(-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
(-[WebVideoFullscreenHUDWindow performKeyEquivalent:]):
(-[WebVideoFullscreenHUDWindowController init]):
(-[WebVideoFullscreenHUDWindowController keyDown:]):
(-[WebVideoFullscreenHUDWindowController windowDidLoad]):
* platform/mac/WebWindowAnimation.mm:
(WebWindowAnimationDurationFromDuration):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::updateCachedSystemFontDescription):
(WebCore::RenderThemeMac::controlSizeForFont):
(WebCore::RenderThemeMac::controlSizeForCell):
(WebCore::RenderThemeMac::controlSizeForSystemFont):
(WebCore::RenderThemeMac::paintProgressBar):
(WebCore::RenderThemeMac::popupMenuSize):
(WebCore::RenderThemeMac::sliderThumbHorizontal):
(WebCore::RenderThemeMac::sliderThumbVertical):

Source/WebKit/mac:

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
(-[CarbonWindowAdapter sendSuperEvent:]):
* Plugins/Hosted/NetscapePluginHostProxy.mm:
(WebKit::NetscapePluginHostProxy::beginModal):
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::syntheticKeyDownWithCommandModifier):
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView drawRect:]):
* Plugins/WebNetscapePluginEventHandlerCocoa.mm:
(WebNetscapePluginEventHandlerCocoa::syntheticKeyDownWithCommandModifier):
* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::populate):
(PopupMenuMac::show):
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::showContextMenu):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::actionDictionary):
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::canAttach):
(-[WebInspectorWindowController window]):
* WebInspector/WebNodeHighlight.mm:
(-[WebNodeHighlight initWithTargetView:inspectorController:]):
* WebView/WebFrameView.mm:
(-[WebFrameView keyDown:keyDown:]):
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController init]):
(createBackgroundFullscreenWindow):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _postFakeMouseMovedEventForFlagsChangedEvent:]):
(-[WebHTMLView _setMouseDownEvent:_setMouseDownEvent:]):
(-[WebHTMLView _updateMouseoverWithFakeEvent]):
(isQuickLookEvent):
(-[WebHTMLView hitTest:]):
(-[WebHTMLView _sendToolTipMouseExited]):
(-[WebHTMLView _sendToolTipMouseEntered]):
(mouseEventIsPartOfClickOrDrag):
(-[WebHTMLView _updateMouseoverWithEvent:]):
(-[WebHTMLView _autoscroll]):
(-[WebHTMLView acceptsFirstResponder]):
(-[WebHTMLView viewDidMoveToWindow]):
(-[WebHTMLView mouseDown:mouseDown:]):
(currentKeyboardEvent):
(-[WebHTMLView _handleStyleKeyEquivalent:]):
(-[WebHTMLView _interpretKeyEvent:savingCommands:]):
* WebView/WebPDFView.mm:
(-[WebPDFView hitTest:]):
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):
(-[WebPDFView _fakeKeyEventWithFunctionKey:]):
* WebView/WebTextCompletionController.mm:
(-[WebTextCompletionController _buildUI]):
(-[WebTextCompletionController _placePopupWindow:]):
* WebView/WebView.mm:
(-[WebView applicationFlags:]):

Source/WebKit2:

* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::stopNSAppRunLoop):
* Shared/mac/WebEventFactory.mm:
(WebKit::mouseButtonForEvent):
(WebKit::mouseEventTypeForEvent):
(WebKit::clickCountForEvent):
(WebKit::globalPointForEvent):
(WebKit::pointForEvent):
(WebKit::textFromEvent):
(WebKit::unmodifiedTextFromEvent):
(WebKit::isKeypadEvent):
(WebKit::isKeyUpEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::becomeFirstResponder):
(WebKit::WebViewImpl::updateContentInsetsIfAutomatic):
(WebKit::WebViewImpl::viewDidMoveToWindow):
(WebKit::WebViewImpl::postFakeMouseMovedEventForFlagsChangedEvent):
(WebKit::WebViewImpl::createFullScreenWindow):
(WebKit::WebViewImpl::sendToolTipMouseExited):
(WebKit::WebViewImpl::sendToolTipMouseEntered):
(WebKit::applicationFlagsForDrag):
(WebKit::WebViewImpl::setLastMouseDownEvent):
(WebKit::WebViewImpl::doneWithKeyEvent):
(WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):
(WebKit::WebViewImpl::performKeyEquivalent):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::beginModal):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::showContextMenuWithItems):
* UIProcess/mac/WebInspectorProxyMac.mm:
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::populate):
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::modifierFlagsFromWebEvent):
(WebKit::getEventTypeFromWebEvent):
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::cssAlignmentValueForNSTextAlignment):
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::convertImageToBitmap):

Source/WTF:

* wtf/mac/AppKitCompatibilityDeclarations.h:

Tools:

* DumpRenderTree/mac/EventSendingController.mm:
(eventTypeForMouseButtonAndAction):
(modifierFlags):
(-[EventSendingController mouseMoveToX:Y:]):
(-[EventSendingController contextClick]):
(-[EventSendingController keyDown:withModifiers:withLocation:]):
* DumpRenderTree/mac/TextInputController.m:
(-[TextInputController interpretKeyEvents:withSender:]):
* TestWebKitAPI/Tests/WebKit2Cocoa/CommandBackForward.mm:
(simulateCommandArrow):
* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenLayoutConstraints.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/ShouldOpenExternalURLsInNewWindowActions.mm:
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/UserInitiatedActionInNavigationAction.mm:
(UserInitiatedActionTest::SetUp):
(UserInitiatedActionTest::click):
* TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm:
(TestWebKitAPI::AcceptsFirstMouse::runTest):
* TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm:
(TestWebKitAPI::contextMenuCopyLink):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/ContextMenuDefaultItemsHaveTags.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/FullscreenZoomInitialFrame.mm:
(TestWebKitAPI::FullscreenZoomInitialFrame::runTest):
* TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/mac/PlatformUtilitiesMac.mm:
(TestWebKitAPI::Util::isKeyDown):
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::initialize):
(TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
(TestWebKitAPI::PlatformWebView::simulateRightClick):
(TestWebKitAPI::PlatformWebView::simulateMouseMove):
(TestWebKitAPI::eventTypeForButton):
(TestWebKitAPI::modifierFlagsForWKModifiers):
* TestWebKitAPI/mac/TestWKWebViewMac.mm:
(__simulated_forceClickAssociatedEventsMask):
(-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]):
(-[TestWKWebView _setUpTestWindow:]):
(-[TestWKWebView typeCharacter:]):
* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::eventTypeForMouseButtonAndAction):
(WTR::buildModifierFlags):
(WTR::EventSenderProxy::sendMouseDownToStartPressureEvents):
(WTR::EventSenderProxy::mouseForceClick):
(WTR::EventSenderProxy::startAndCancelMouseForceClick):
(WTR::EventSenderProxy::mouseMoveTo):
(WTR::EventSenderProxy::keyDown):
(WTR::EventSenderProxy::swipeGestureWithWheelAndMomentumPhases):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformResetStateToConsistentValues):

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

2 years ago[Modern Media Controls] UI Library: iOS inline controls
graouts@webkit.org [Wed, 9 Nov 2016 19:31:25 +0000 (19:31 +0000)]
[Modern Media Controls] UI Library: iOS inline controls
https://bugs.webkit.org/show_bug.cgi?id=164513
<rdar://problem/27989475>

Reviewed by Dean Jackson.

We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls
for inline playback on iOS.

Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html
       media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html
       media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
       media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html
       media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html
       media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html

* Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added.
(.media-controls.ios.inline > .controls-bar):
(.media-controls.ios.inline .time-control):
(.media-controls.ios.inline button):
(.media-controls.ios.inline button:active):
(.media-controls.ios.inline > .controls-bar button):
(.media-controls.ios.inline .buttons-container.right):
(.media-controls.ios.inline button.play-pause):
(.media-controls.ios.inline button.skip-back):
(.media-controls.ios.inline .scrubber.slider):
(.media-controls.ios.inline button.airplay):
(.media-controls.ios.inline button.pip):
(.media-controls.ios.inline button.fullscreen):
(.media-controls.ios.inline .time-label):
(.media-controls.ios.inline .scrubber.slider > .fill):
(.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
* Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added.
(IOSInlineMediaControls.prototype.layout):
(IOSInlineMediaControls):
* Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added.
* Modules/modern-media-controls/js-files:
* WebCore.xcodeproj/project.pbxproj:

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

2 years agoLayoutTest fast/visual-viewport/rtl-zoomed-rects.html failing
simon.fraser@apple.com [Wed, 9 Nov 2016 19:20:54 +0000 (19:20 +0000)]
LayoutTest fast/visual-viewport/rtl-zoomed-rects.html failing
https://bugs.webkit.org/show_bug.cgi?id=164491

Mark fast/visual-viewport/rtl-zoomed-rects.html as failing on Yosemite and El Capitan
in WK1.

* platform/mac-wk1/TestExpectations:

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

2 years agoSupport TouchBar in WebKit
bdakin@apple.com [Wed, 9 Nov 2016 19:16:09 +0000 (19:16 +0000)]
Support TouchBar in WebKit
https://bugs.webkit.org/show_bug.cgi?id=164437
-and corresponding-
rdar://problem/28876524

Reviewed by Darin Adler.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* platform/spi/cocoa/AVKitSPI.h:
* platform/spi/cocoa/NSTouchBarSPI.h: Added.
* platform/spi/mac/NSSpellCheckerSPI.h:

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::respondToChangedSelection):
(WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged):
* WebView/WebHTMLView.mm:
(-[WebHTMLView candidateListTouchBarItem]):
* WebView/WebView.mm:
(-[_WebTextListTouchBarViewController initWithWebView:]):
(-[_WebTextListTouchBarViewController _selectList:]):
(-[_WebTextListTouchBarViewController setCurrentListType:]):
(-[WebTextTouchBarItemController initWithWebView:]):
(-[WebTextTouchBarItemController itemForIdentifier:]):
(-[WebTextTouchBarItemController webTextListTouchBarViewController]):
(-[WebTextTouchBarItemController setTextIsBold:]):
(-[WebTextTouchBarItemController setTextIsItalic:]):
(-[WebTextTouchBarItemController setTextIsUnderlined:]):
(-[WebTextTouchBarItemController _webChangeTextStyle:]):
(-[WebTextTouchBarItemController setCurrentTextAlignment:]):
(-[WebTextTouchBarItemController _webChangeTextAlignment:]):
(-[WebTextTouchBarItemController textColor]):
(-[WebTextTouchBarItemController setTextColor:]):
(-[WebTextTouchBarItemController _webChangeColor:]):
(-[WebTextTouchBarItemController textListViewController]):
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):
(-[WebView shouldRequestCandidates]):
(-[WebView forceRequestCandidatesForTesting]):
(-[WebView makeTouchBar]):
(-[WebView touchBar:makeItemForIdentifier:]):
(textCheckingResultFromNSTextCheckingResult):
(-[WebView candidateListTouchBarItem:endSelectingCandidateAtIndex:]):
(-[WebView candidateListTouchBarItem:changedCandidateListVisibility:]):
(-[WebView _setUpPlaybackControlsManagerForMediaElement:]):
(-[WebView _clearPlaybackControlsManager]):
(-[WebView _dismissTextTouchBarPopoverItemWithIdentifier:]):
(-[WebView _textTouchBarCustomizationAllowedIdentifiers]):
(-[WebView _plainTextTouchBarCustomizationDefaultItemIdentifiers]):
(-[WebView _richTextTouchBarCustomizationDefaultItemIdentifiers]):
(-[WebView touchBarDidExitCustomization:]):
(-[WebView touchBarWillEnterCustomization:]):
(-[WebView didChangeAutomaticTextCompletion:]):
(-[WebView setUpTextTouchBar:]):
(-[WebView _isRichlyEditable]):
(-[WebView textTouchBar]):
(-[WebView updateTextTouchBar]):
(-[WebView updateMediaTouchBar]):
(-[WebView updateTouchBar]):
(-[WebView prepareForMouseDown]):
(-[WebView prepareForMouseUp]):
(-[WebView webViewAdditionsWillDestroyView]):
(-[WebView candidateList]):
(-[WebView updateWebViewAdditions]): Deleted.
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

Source/WebKit2:

* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView makeTouchBar]):
(-[WKWebView candidateListTouchBarItem]):
(-[WKWebView _web_didAddMediaControlsManager:]):
(-[WKWebView _web_didRemoveMediaControlsManager]):
(-[WKWebView _interactWithMediaControlsForTesting]):
(-[WKWebView _wantsMediaPlaybackControlsView]):
(-[WKWebView _setWantsMediaPlaybackControlsView:]):
(-[WKWebView _mediaPlaybackControlsView]):
(-[WKWebView _addMediaPlaybackControlsView:]):
(-[WKWebView _removeMediaPlaybackControlsView]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView makeTouchBar]):
(-[WKView candidateListTouchBarItem]):
(-[WKView _web_didAddMediaControlsManager:]):
(-[WKView _web_didRemoveMediaControlsManager]):
(-[WKView _wantsMediaPlaybackControlsView]):
(-[WKView _setWantsMediaPlaybackControlsView:]):
(-[WKView _mediaPlaybackControlsView]):
(-[WKView _addMediaPlaybackControlsView:]):
(-[WKView _removeMediaPlaybackControlsView]):
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::currentTouchBar):
(WebKit::WebViewImpl::clientWantsMediaPlaybackControlsView):
(WebKit::WebViewImpl::setClientWantsMediaPlaybackControlsView):
(WebKit::WebViewImpl::setIsCustomizingTouchBar):
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKTextListTouchBarViewController initWithWebViewImpl:]):
(-[WKTextListTouchBarViewController didDestroyView]):
(-[WKTextListTouchBarViewController _selectList:]):
(-[WKTextListTouchBarViewController setCurrentListType:]):
(-[WKTextTouchBarItemController initWithWebViewImpl:]):
(-[WKTextTouchBarItemController didDestroyView]):
(-[WKTextTouchBarItemController touchBar:makeItemForIdentifier:]):
(-[WKTextTouchBarItemController itemForIdentifier:]):
(-[WKTextTouchBarItemController candidateListTouchBarItem:endSelectingCandidateAtIndex:]):
(-[WKTextTouchBarItemController candidateListTouchBarItem:changedCandidateListVisibility:]):
(-[WKTextTouchBarItemController textListTouchBarViewController]):
(-[WKTextTouchBarItemController setTextIsBold:]):
(-[WKTextTouchBarItemController setTextIsItalic:]):
(-[WKTextTouchBarItemController setTextIsUnderlined:]):
(-[WKTextTouchBarItemController _wkChangeTextStyle:]):
(-[WKTextTouchBarItemController setCurrentTextAlignment:]):
(-[WKTextTouchBarItemController _wkChangeTextAlignment:]):
(-[WKTextTouchBarItemController textColor]):
(-[WKTextTouchBarItemController setTextColor:]):
(-[WKTextTouchBarItemController _wkChangeColor:]):
(-[WKTextTouchBarItemController textListViewController]):
(WebKit::WebViewImpl::makeTouchBar):
(WebKit::WebViewImpl::candidateListTouchBarItem):
(WebKit::WebViewImpl::mediaPlaybackControlsView):
(WebKit::WebViewImpl::useMediaPlaybackControlsView):
(WebKit::WebViewImpl::dismissTextTouchBarPopoverItemWithIdentifier):
(WebKit::textTouchBarCustomizationAllowedIdentifiers):
(WebKit::plainTextTouchBarCustomizationDefaultItemIdentifiers):
(WebKit::richTextTouchBarCustomizationDefaultItemIdentifiers):
(WebKit::touchBarDidExitCustomization):
(WebKit::touchBarWillEnterCustomization):
(WebKit::didChangeAutomaticTextCompletion):
(WebKit::WebViewImpl::updateTouchBarAndRefreshTextBarIdentifiers):
(WebKit::WebViewImpl::setUpTextTouchBar):
(WebKit::WebViewImpl::isRichlyEditable):
(WebKit::WebViewImpl::textTouchBar):
(WebKit::WebViewImpl::updateTextTouchBar):
(WebKit::WebViewImpl::updateMediaTouchBar):
(WebKit::WebViewImpl::forceRequestCandidatesForTesting):
(WebKit::WebViewImpl::updateTouchBar):
(WebKit::WebViewImpl::shouldRequestCandidates):
(WebKit::WebViewImpl::showCandidates):
(WebKit::WebViewImpl::webViewImplAdditionsWillDestroyView):
(WebKit::WebViewImpl::setEditableElementIsFocused):
(WebKit::WebViewImpl::becomeFirstResponder):
(WebKit::WebViewImpl::selectionDidChange):
(WebKit::WebViewImpl::videoControlsManagerDidChange):
(WebKit::WebViewImpl::updateWebViewImplAdditions): Deleted.

Tools:

This makes MiniBrowser support TouchBar customization.

* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate awakeFromNib]):

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

2 years agoUse Blob URL instead of webkit-fake-url when pasting an image
cdumez@apple.com [Wed, 9 Nov 2016 19:14:17 +0000 (19:14 +0000)]
Use Blob URL instead of webkit-fake-url when pasting an image
https://bugs.webkit.org/show_bug.cgi?id=49141

Reviewed by Darin Adler.

Source/WebCore:

Use Blob URL instead of webkit-fake-url when pasting an image.

Tests: editing/pasteboard/paste-image-as-blob-url.html
       editing/pasteboard/paste-image-using-image-data.html

* editing/Editor.h:
* editing/mac/EditorMac.mm:
(WebCore::Editor::WebContentReader::readImage):
(WebCore::Editor::createFragmentForImageAndURL):

LayoutTests:

Add layout test coverage checking that the image shows as expected and that the
resulting URL is indeed a Blob URL.

* editing/pasteboard/paste-image-as-blob-url-expected.txt: Added.
* editing/pasteboard/paste-image-as-blob-url.html: Added.
* editing/pasteboard/paste-image-using-image-data-expected.html: Added.
* editing/pasteboard/paste-image-using-image-data.html: Added.

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

2 years ago[JSC] The implementation of 8 bit operation in MacroAssembler should care about uint8...
utatane.tea@gmail.com [Wed, 9 Nov 2016 19:10:42 +0000 (19:10 +0000)]
[JSC] The implementation of 8 bit operation in MacroAssembler should care about uint8_t / int8_t
https://bugs.webkit.org/show_bug.cgi?id=164432

Reviewed by Michael Saboff.

Source/JavaScriptCore:

Except for X86, our supported MacroAssemblers do not have native 8bit instructions.
It means that all the 8bit instructions are converted to 32bit operations by using
scratch registers. For example, ARM64 branch8 implementation is the following.

    Jump branch8(RelationCondition cord, Address left, TrustedImm32 right)
    {
        TrustedImm32 right8(static_cast<int8_t>(right.m_value));
        load8(left, getCachedMemoryTempRegisterIDAndInvalidate());
        return branch32(cone, memoryTempRegister, right8);
    }

The problem is that we exclusively use zero-extended load instruction (load8). Even
for signed RelationConditions, we do not perform sign extension. It makes signed
operations with negative numbers incorrect! Consider the |left| address holds `-1`
in int8_t form. However load8 will load it as 255 into 32bit register. On the other hand,
|right| will be sign extended. If you pass 0 as |right| and LessThan condition, this
branch8 should jump based on the answer of `-1 < 0`. But the current MacroAssembler
performs `255 < 0` in int32_t context and returns the incorrect result.

We should follow the x86 model. So we should select the appropriate load operation and masking
operation based on the RelationCondition. This patch introduces mask8OnCondition and load8OnCondition.
And we use them in 8bit operations including branch8, branchTest8, compare8, and test8.

We intentionally do not change anything on x86 assembler since it has the native signed 8bit operations.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssembler.h:
(JSC::MacroAssembler::isSigned):
(JSC::MacroAssembler::isUnsigned):
(JSC::MacroAssembler::branchTest8):
* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::branch8):
(JSC::MacroAssemblerARM::branchTest8):
(JSC::MacroAssemblerARM::compare8):
(JSC::MacroAssemblerARM::test8):
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::load8SignedExtendTo32):
(JSC::MacroAssemblerARM64::branch8):
(JSC::MacroAssemblerARM64::branchTest8):
(JSC::MacroAssemblerARM64::compare8):
(JSC::MacroAssemblerARM64::test8):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::branch8):
(JSC::MacroAssemblerARMv7::branchTest8):
(JSC::MacroAssemblerARMv7::compare8):
(JSC::MacroAssemblerARMv7::test8):
* assembler/MacroAssemblerHelpers.h: Added.
(JSC::MacroAssemblerHelpers::isSigned):
(JSC::MacroAssemblerHelpers::isUnsigned):
(JSC::MacroAssemblerHelpers::mask8OnCondition):
(JSC::MacroAssemblerHelpers::load8OnCondition):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::branch8):
(JSC::MacroAssemblerMIPS::compare8):
(JSC::MacroAssemblerMIPS::branchTest8):
(JSC::MacroAssemblerMIPS::test8):
* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::branchTest8):
(JSC::MacroAssemblerSH4::branch8):
(JSC::MacroAssemblerSH4::compare8):
(JSC::MacroAssemblerSH4::test8):
* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::branch8):

LayoutTests:

Use ownerDocument. Once DOMJIT for ownerDocument is landed, this will use branch8.

* js/dom/domjit-accessor-owner-document-type-check-expected.txt: Added.
* js/dom/domjit-accessor-owner-document-type-check.html: Added.

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

2 years agoFix error message when SQLite initialization fails
mcatanzaro@igalia.com [Wed, 9 Nov 2016 19:10:15 +0000 (19:10 +0000)]
Fix error message when SQLite initialization fails
https://bugs.webkit.org/show_bug.cgi?id=164462

Reviewed by Darin Adler.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::initializeSQLiteIfNecessary):

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

2 years ago[Modern Media Controls] UI Library: macOS fullscreen controls
graouts@webkit.org [Wed, 9 Nov 2016 19:01:07 +0000 (19:01 +0000)]
[Modern Media Controls] UI Library: macOS fullscreen controls
https://bugs.webkit.org/show_bug.cgi?id=164414
<rdar://problem/27989474>

Reviewed by Dean Jackson.

We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls
for fullscreen playback on macOS. These controls can be dragged by the user.

Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
       media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html

* Modules/modern-media-controls/controls/button.js:
(Button.prototype.set enabled):

    Correctly notify the layoutDelegate when the enabled property changes, regardless of whether
    the flag is on.

* Modules/modern-media-controls/controls/icon-button.js:
(IconButton.prototype._updateImage):
(IconButton):

    Correctly notify the layout delegate when the image metrics have changed so that it may perform
    a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness.

* Modules/modern-media-controls/controls/icon-service.js:
(const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
(const.iconService.new.IconService):

    Fix a typo.

* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added.
(.media-controls.mac.fullscreen > .controls-bar):
(.media-controls.mac.fullscreen .volume.slider):
(.media-controls.mac.fullscreen .buttons-container):
(.media-controls.mac.fullscreen .buttons-container.center):
(.media-controls.mac.fullscreen > .controls-bar button):
(.media-controls.mac.fullscreen button.rewind):
(.media-controls.mac.fullscreen button.play-pause):
(.media-controls.mac.fullscreen button.forward):
(.media-controls.mac.fullscreen .buttons-container.right):
(.media-controls.mac.fullscreen button.airplay):
(.media-controls.mac.fullscreen button.aspect-ratio):
(.media-controls.mac.fullscreen button.pip):
(.media-controls.mac.fullscreen button.tracks):
(.media-controls.mac.fullscreen button.fullscreen):
(.media-controls.mac.fullscreen .time-control):
(.media-controls.mac.fullscreen .time-label):
(.media-controls.mac.fullscreen .scrubber):
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added.
(MacOSFullscreenMediaControls.prototype.layout):
(MacOSFullscreenMediaControls):
* Modules/modern-media-controls/controls/macos-media-controls.js:
(MacOSMediaControls):

    Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS
    so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit.

* Modules/modern-media-controls/js-files:

    Add a reference to the new macos-fullscreen-media-controls.js file.

* WebCore.xcodeproj/project.pbxproj:

    Add references to the new macos-fullscreen-media-controls.js and
    macos-fullscreen-media-controls.css files.

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

2 years agoAdd test coverage for radiusX / radiusY in WebPlatformTouchPoint.
cdumez@apple.com [Wed, 9 Nov 2016 18:35:51 +0000 (18:35 +0000)]
Add test coverage for radiusX / radiusY in WebPlatformTouchPoint.
https://bugs.webkit.org/show_bug.cgi?id=162801
<rdar://problem/28807455>

Reviewed by Darin Adler.

Add test coverage for radiusX / radiusY in WebPlatformTouchPoint.

* fast/events/touch/ios/touch-event-radius-expected.txt: Added.
* fast/events/touch/ios/touch-event-radius.html: Added.

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

2 years agoShave 16 bytes off HTMLInputElement
cdumez@apple.com [Wed, 9 Nov 2016 18:32:02 +0000 (18:32 +0000)]
Shave 16 bytes off HTMLInputElement
https://bugs.webkit.org/show_bug.cgi?id=164488

Reviewed by Sam Weinig.

Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members
better.

* html/HTMLFormControlElement.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
* html/HTMLTextFormControlElement.h:

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

2 years ago[WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
commit-queue@webkit.org [Wed, 9 Nov 2016 18:28:08 +0000 (18:28 +0000)]
[WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
https://bugs.webkit.org/show_bug.cgi?id=164409

Patch by Youenn Fablet <youenn@apple.com> on 2016-11-09
Reviewed by Eric Carlson.

Source/WebCore:

Covered by existing tests.

Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate.
Also refactored ICE candidate event generation (done at PeerConnectionBackend).
Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend.

The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/.
Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend.
This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::createOfferTask):
(WebCore::MediaEndpointPeerConnection::doCreateAnswer):
(WebCore::MediaEndpointPeerConnection::createAnswerTask):
(WebCore::MediaEndpointPeerConnection::doSetLocalDescription):
(WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
(WebCore::MediaEndpointPeerConnection::doSetRemoteDescription):
(WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
(WebCore::MediaEndpointPeerConnection::doAddIceCandidate):
(WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
(WebCore::MediaEndpointPeerConnection::doStop):
(WebCore::MediaEndpointPeerConnection::gotIceCandidate):
(WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
(WebCore::MediaEndpointPeerConnection::createAnswer): Deleted.
(WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted.
(WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted.
(WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted.
(WebCore::MediaEndpointPeerConnection::stop): Deleted.
(WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted.
(WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted.
* Modules/mediastream/MediaEndpointPeerConnection.h:
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::createOffer):
(WebCore::PeerConnectionBackend::createOfferFailed):
(WebCore::PeerConnectionBackend::createAnswer):
(WebCore::PeerConnectionBackend::createAnswerSucceeded):
(WebCore::PeerConnectionBackend::createAnswerFailed):
(WebCore::isLocalDescriptionTypeValidForState):
(WebCore::PeerConnectionBackend::setLocalDescription):
(WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
(WebCore::isRemoteDescriptionTypeValidForState):
(WebCore::PeerConnectionBackend::setRemoteDescription):
(WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
(WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
(WebCore::PeerConnectionBackend::addIceCandidate):
(WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
(WebCore::PeerConnectionBackend::addIceCandidateFailed):
(WebCore::PeerConnectionBackend::fireICECandidateEvent):
(WebCore::PeerConnectionBackend::doneGatheringCandidates):
(WebCore::PeerConnectionBackend::stop):
* Modules/mediastream/PeerConnectionBackend.h:

LayoutTests:

Rebasing test as patch changes the order in which error cases are checked in case of setRemoteDescription/setLocalDescription.
New order tries to follow more closely https://www.w3.org/TR/webrtc/#set-description.

* fast/mediastream/RTCPeerConnection-stable-expected.txt:

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

2 years ago[MediaStream][Mac] Mark captured video frames as ready for display immediately
eric.carlson@apple.com [Wed, 9 Nov 2016 18:27:37 +0000 (18:27 +0000)]
[MediaStream][Mac] Mark captured video frames as ready for display immediately
https://bugs.webkit.org/show_bug.cgi?id=164482
<rdar://problem/29139073>

Reviewed by Jer Noble.

* platform/cf/CoreMediaSoftLink.cpp: Add new constant.
* platform/cf/CoreMediaSoftLink.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData):
  New, ask register for a callback when the sample buffer display layer is ready
  for more media data.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change
  the sample timestamps, assume the caller has configured the sample correctly.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't
  drop frames when the display layer isn't ready.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData.
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard
  late video frames, we don't need them.
(WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately
  attachment.

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

2 years agoWeb Inspector: Settings tab: Checkbox labels should be clickable
nvasilyev@apple.com [Wed, 9 Nov 2016 18:26:04 +0000 (18:26 +0000)]
Web Inspector: Settings tab: Checkbox labels should be clickable
https://bugs.webkit.org/show_bug.cgi?id=164470
<rdar://problem/29133787>

Reviewed by Matt Baker.

* UserInterface/Views/SettingsTabContentView.js:
(WebInspector.SettingsTabContentView.prototype.initialLayout):
Add a label element to make checkboxes clickable.

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

2 years agoAX: [ATK] Wrong selected element at a given index in a list box (redux)
jdiggs@igalia.com [Wed, 9 Nov 2016 18:25:42 +0000 (18:25 +0000)]
AX: [ATK] Wrong selected element at a given index in a list box (redux)
https://bugs.webkit.org/show_bug.cgi?id=164430

Reviewed by Darin Adler.

Source/WebCore:

This essentially undoes the implementation change resulting from r164577.
As stated in the ATK documentation, atk_selection_ref_selection() takes
"a gint specifying the index in the selection set. (e.g. the ith selection
as opposed to the ith child)." r164577 deliberately modified that, causing
atk_selection_ref_selection() to treat the index as if it were the position
with respect to all of the children. There is different API in ATK, namely
atk_object_ref_accessible_child(), when the ith child from the set of all
children is sought.

Tests: accessibility/aria-listbox-no-selection.html
       accessibility/native-listbox-no-selection.html

* accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
(optionFromSelection):

LayoutTests:

Add tests to ensure listboxes with no selected children do not report
a selected child. Modify select-element-at-index.html to reflect the
corrected behavior for ATK. Move the Mac port's expectations to the
shared expectations.

* accessibility/aria-listbox-no-selection-expected.txt: Added.
* accessibility/aria-listbox-no-selection.html: Added.
* accessibility/native-listbox-no-selection-expected.txt: Added.
* accessibility/native-listbox-no-selection.html: Added.
* accessibility/select-element-at-index-expected.txt: Modified.
* accessibility/select-element-at-index.html: Modified.
* platform/mac/accessibility/select-element-at-index-expected.txt: Removed.

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

2 years agoWeb Inspector: Allow FolderTreeElement to display content when selected
commit-queue@webkit.org [Wed, 9 Nov 2016 18:25:30 +0000 (18:25 +0000)]
Web Inspector: Allow FolderTreeElement to display content when selected
https://bugs.webkit.org/show_bug.cgi?id=164407

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-11-09
Reviewed by Timothy Hatcher.

* UserInterface/Main.html:
Add CollectionContentView and TitleView.

* UserInterface/Base/Main.js:
* UserInterface/Views/ContentView.js:
(WebInspector.ContentView.createFromRepresentedObject):
(WebInspector.ContentView.isViewable):
Add support for Collection as the representedObject of a content view.

* UserInterface/Views/CollectionContentView.css: Added.
(.content-view.collection):
(.content-view.collection > .content-view):
* UserInterface/Views/CollectionContentView.js: Added.
(WebInspector.CollectionContentView):
(WebInspector.CollectionContentView.prototype.initialLayout):
(WebInspector.CollectionContentView.prototype._addContentViewForItem):
(WebInspector.CollectionContentView.prototype._removeContentViewForItem):
(WebInspector.CollectionContentView.prototype._handleItemAdded):
(WebInspector.CollectionContentView.prototype._handleItemRemoved):
(WebInspector.CollectionContentView.prototype._handleContentError):
Takes in a Collection when constructed, and attempts to display a sub-ContentView for each
item in the collection if the type of the collection is viewable en masse.  Currently, this
is only supported for WebInspector.Resource.Type.Image collections.

* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView.prototype._contentError):
Dispatch an event whenever the content fails to load.

* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):
* UserInterface/Views/ResourcesTabContentView.js:
(WebInspector.ResourcesTabContentView.prototype.canShowRepresentedObject):
Allow FolderTreeElements to be selected.

* UserInterface/Views/TitleView.css: Added.
(.title-view):
* UserInterface/Views/TitleView.js: Added.
(WebInspector.TitleView):
Basic view that displays the given text in the center of the viewable area.

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

2 years ago[EFL] Use libgcrypt instead of GnuTLS for CryptoDigest
gyuyoung.kim@webkit.org [Wed, 9 Nov 2016 18:24:09 +0000 (18:24 +0000)]
[EFL] Use libgcrypt instead of GnuTLS for CryptoDigest
https://bugs.webkit.org/show_bug.cgi?id=164461

Reviewed by Michael Catanzaro.

.:

* Source/cmake/OptionsEfl.cmake: Find LibGcrypt package instead of GnuTLS.

Source/WebCore:

As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well.

No new tests, no behavior change.

* PlatformEfl.cmake:

Tools:

As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well.

* efl/install-dependencies: Add libgcript package dependecy.

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

2 years ago[EFL] Remove unused function in MiniBrowser
gyuyoung.kim@webkit.org [Wed, 9 Nov 2016 18:23:27 +0000 (18:23 +0000)]
[EFL] Remove unused function in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=164398

Reviewed by Darin Adler.

* MiniBrowser/efl/main.c:
(window_find_with_elm_window): Deleted because it is not used anywhere.

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

2 years ago[WK2][NETWORK_SESSION] Add support for downloading file backed blobs
cdumez@apple.com [Wed, 9 Nov 2016 18:07:07 +0000 (18:07 +0000)]
[WK2][NETWORK_SESSION] Add support for downloading file backed blobs
https://bugs.webkit.org/show_bug.cgi?id=164458
<rdar://problem/28905514>

Reviewed by Darin Adler.

Source/WebKit2:

Add support for downloading file backed blobs on WebKit2.
It previously wasn't working because we weren't calling
BlobDataFileReference::prepareForFileAccess() for each blob file before
starting the download, similarly to what is done in NetworkResourceLoader's
consumeSandboxExtensions().

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload):
* NetworkProcess/Downloads/DownloadManager.h:
(WebKit::DownloadManager::startDownload):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::startDownload):
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload):
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkDataTaskBlob.cpp:
(WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::download):
* NetworkProcess/NetworkDataTaskBlob.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad):
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::downloadRequest):
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
(WebKit::NetworkResourceLoader::startNetworkLoad):
* NetworkProcess/PingLoad.h:

Tools:

Add testRunner.setShouldDownloadUndisplayableMIMETypes(bool) API so that layout
tests can request that such resources are downloaded instead of being ignored.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShouldDownloadUndisplayableMIMETypes):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::decidePolicyForNavigationResponse):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setShouldDownloadUndisplayableMIMETypes):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

Add layout test coverage for downloading blobs, both via <a download> or
because a load is later converted into a download.

* fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-convert-to-download.html: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-download-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-file-blob-download.html: Added.
* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

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

2 years ago[WK2] Network cache speculative revalidation can cause loads to hang
cdumez@apple.com [Wed, 9 Nov 2016 18:06:27 +0000 (18:06 +0000)]
[WK2] Network cache speculative revalidation can cause loads to hang
https://bugs.webkit.org/show_bug.cgi?id=164532
<rdar://problem/28519331>

Reviewed by Alex Christensen.

Source/WebKit2:

Network cache speculative revalidation could cause loads to hang when HTTP
authentication was involved because NetworkCacheSpeculativeLoad failed to
call NetworkLoad::continueCanAuthenticateAgainstProtectionSpace() in its
canAuthenticateAgainstProtectionSpaceAsync() callback.

* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:

LayoutTests:

Add layout test coverage. The test hangs without the fix.

* http/tests/cache/disk-cache/speculative-validation/http-auth-expected.txt: Added.
* http/tests/cache/disk-cache/speculative-validation/http-auth.html: Added.
* http/tests/cache/disk-cache/speculative-validation/resources/frame-with-authenticated-resource.php: Added.
* http/tests/cache/disk-cache/speculative-validation/resources/resource-with-auth.php: Added.

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

2 years agoVersioning.
matthew_hanson@apple.com [Wed, 9 Nov 2016 17:53:01 +0000 (17:53 +0000)]
Versioning.

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

2 years agoUnreviewed, rolling out r208422.
ryanhaddad@apple.com [Wed, 9 Nov 2016 17:49:55 +0000 (17:49 +0000)]
Unreviewed, rolling out r208422.

Roll r208382 back in since it was not responsible for the API
test failures seen on macOS.

Reverted changeset:

"Unreviewed, rolling out r208382."
https://bugs.webkit.org/show_bug.cgi?id=164319
http://trac.webkit.org/changeset/208422

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

2 years agoOne more URTBF after r208361.
ossy@webkit.org [Wed, 9 Nov 2016 17:36:21 +0000 (17:36 +0000)]
One more URTBF after r208361.

* PlatformMac.cmake:

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

2 years agoURTBF after r208361.
ossy@webkit.org [Wed, 9 Nov 2016 17:28:57 +0000 (17:28 +0000)]
URTBF after r208361.

* PlatformMac.cmake:

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

2 years agoUnreviewed typo fix after r160616 to fix the build on case sensitive file systems.
ossy@webkit.org [Wed, 9 Nov 2016 17:18:21 +0000 (17:18 +0000)]
Unreviewed typo fix after r160616 to fix the build on case sensitive file systems.

* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:

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

2 years agoMake rpaths more robust for iOS Simulators
jbedard@apple.com [Wed, 9 Nov 2016 17:17:11 +0000 (17:17 +0000)]
Make rpaths more robust for iOS Simulators
https://bugs.webkit.org/show_bug.cgi?id=164521

Reviewed by Simon Fraser.

* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort._createSimulatorApp): Added more robust path.

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

2 years agoFix Tools build on case sensitive file systems
ossy@webkit.org [Wed, 9 Nov 2016 16:52:09 +0000 (16:52 +0000)]
Fix Tools build on case sensitive file systems
https://bugs.webkit.org/show_bug.cgi?id=164474

Unreviewed buildfix.

* DumpRenderTree/CMakeLists.txt:
* DumpRenderTree/PlatformMac.cmake:
* DumpRenderTree/PlatformWin.cmake:
* DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
* MiniBrowser/mac/CMakeLists.txt:

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

2 years agoTypo fix after r162782
ossy@webkit.org [Wed, 9 Nov 2016 16:49:19 +0000 (16:49 +0000)]
Typo fix after r162782
https://bugs.webkit.org/show_bug.cgi?id=164473

Unreviewed trivial fix.

* platform/ThreadGlobalData.cpp:

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

2 years agoREGRESSION: date-format-tofte.js is super slow
rniwa@webkit.org [Wed, 9 Nov 2016 02:51:19 +0000 (02:51 +0000)]
REGRESSION: date-format-tofte.js is super slow
https://bugs.webkit.org/show_bug.cgi?id=164499

Patch by Geoffrey Garen <ggaren@apple.com> on 2016-11-08
Reviewed by Sam Weinig.

* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::CacheKey::operator==): Use character comparison,
not pointer comparison. (This function was always wrong, but I started
calling it in more places.)

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

2 years agoREGRESSION: Crashes in StringImpl destructor during GC when clearing the HasOwnProper...
rniwa@webkit.org [Wed, 9 Nov 2016 02:50:05 +0000 (02:50 +0000)]
REGRESSION: Crashes in StringImpl destructor during GC when clearing the HasOwnPropertyCache
https://bugs.webkit.org/show_bug.cgi?id=164433

Patch by Saam Barati <sbarati@apple.com> on 2016-11-08
Reviewed by Mark Lam.

Clearing the HasOwnPropertyCache will call deref() on the StringImpls
in the cache. We were doing this from the collector thread, which is
not allowed. It must be done from the mutator thread. We now clear the
cache in Heap::finalize() which happens before the mutator begins
executing JS after a collection happens.

* heap/Heap.cpp:
(JSC::Heap::collectInThread):
(JSC::Heap::finalize):

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

2 years agoUnreviewed, rolling out r208382.
ryanhaddad@apple.com [Mon, 7 Nov 2016 14:46:04 +0000 (14:46 +0000)]
Unreviewed, rolling out r208382.

This change appears to have caused 3
SerializedCryptoKeyWrapTest API tests to fail on macOS.

Reverted changeset:

"[Readable Streams API] Implement ByteStreamController
error()"
https://bugs.webkit.org/show_bug.cgi?id=164319
http://trac.webkit.org/changeset/208382

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

2 years agoFixed compilation of LLInt with MinGW
annulen@yandex.ru [Sat, 5 Nov 2016 18:00:29 +0000 (18:00 +0000)]
Fixed compilation of LLInt with MinGW
https://bugs.webkit.org/show_bug.cgi?id=164449

Reviewed by Michael Catanzaro.

MinGW uses LLIntAssembly.h with GNU assembler syntax, just like GCC on
other platforms.

Source/JavaScriptCore:

* llint/LowLevelInterpreter.cpp: Include LLIntAssembly.h with
appropriate preamble.

Source/WTF:

* wtf/InlineASM.h: Define LOCAL_LABEL_STRING as .L#name for MinGW.

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

2 years agoRemoving flaky expectations for tests that were fixed with r208327.
ryanhaddad@apple.com [Sat, 5 Nov 2016 17:59:33 +0000 (17:59 +0000)]
Removing flaky expectations for tests that were fixed with r208327.
https://bugs.webkit.org/show_bug.cgi?id=164034

Unreviewed test gardening.

* TestExpectations:
* platform/mac/TestExpectations:

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

2 years ago[MinGW] Fixed C99/C++11 format attributes in printf-like functions
annulen@yandex.ru [Sat, 5 Nov 2016 17:58:31 +0000 (17:58 +0000)]
[MinGW] Fixed C99/C++11 format attributes in printf-like functions
https://bugs.webkit.org/show_bug.cgi?id=164448

Reviewed by Michael Catanzaro.

By default MinGW uses printf-like function provided in msvcrt.dll,
however they miss support for C99/C++11 format attributes. Use MinGW
implementations instead.

.:

* Source/cmake/OptionsCommon.cmake: Define __USE_MINGW_ANSI_STDIO

Source/WTF:

* wtf/Assertions.h: Use gnu_printf format in WTF_ATTRIBUTE_PRINTF

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

2 years ago[JSCOnly] RunLoopGeneric should adopt MonotonicTime / WallTime change
utatane.tea@gmail.com [Sat, 5 Nov 2016 08:24:19 +0000 (08:24 +0000)]
[JSCOnly] RunLoopGeneric should adopt MonotonicTime / WallTime change
https://bugs.webkit.org/show_bug.cgi?id=164447

Reviewed by Csaba Osztrogon√°c.

Build fix for JSCOnly.

* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::create):
(WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
(WTF::RunLoop::TimerBase::ScheduledTask::scheduledTimePoint):
(WTF::RunLoop::TimerBase::ScheduledTask::updateReadyTime):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::start):

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

2 years ago[SOUP] Layout test http/tests/misc/authentication-redirect-3/authentication-sent...
carlosgc@webkit.org [Sat, 5 Nov 2016 07:56:49 +0000 (07:56 +0000)]
[SOUP] Layout test http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html fails
https://bugs.webkit.org/show_bug.cgi?id=139358

Reviewed by Michael Catanzaro.

Source/WebKit2:

Stop putting the credentials in the URL unconditionally and ensure we only do that when provided by the URL
itself. Libsoup has its own cache of SoupAuth, so we don't need to pass user/pass in the URL for every single
request, libsoup will authenticate those automatically.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::applyAuthenticationToRequest):

LayoutTests:

* platform/gtk/TestExpectations: Unskip http/tests/misc/authentication-redirect-3/authentication-sent-to-redirect-same-origin-with-location-credentials.html.

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

2 years agoWTF::ParkingLot should stop using std::chrono because std::chrono::duration casts...
fpizlo@apple.com [Sat, 5 Nov 2016 03:02:39 +0000 (03:02 +0000)]
WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
https://bugs.webkit.org/show_bug.cgi?id=152045

Reviewed by Andy Estes.
Source/JavaScriptCore:

Probably the nicest example of why this patch is a good idea is the change in
AtomicsObject.cpp.

* jit/ICStats.cpp:
(JSC::ICStats::ICStats):
* runtime/AtomicsObject.cpp:
(JSC::atomicsFuncWait):

Source/WebCore:

No new layout tests because no new behavior. The new WTF time classes have some unit tests
in TestWebKitAPI.

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::blobSize):
* platform/MainThreadSharedTimer.h:
* platform/SharedTimer.h:
* platform/ThreadTimers.cpp:
(WebCore::ThreadTimers::updateSharedTimer):
* platform/cf/MainThreadSharedTimerCF.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/efl/MainThreadSharedTimerEfl.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/glib/MainThreadSharedTimerGLib.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* platform/win/MainThreadSharedTimerWin.cpp:
(WebCore::MainThreadSharedTimer::setFireInterval):
* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::runInMode):

Source/WebKit2:

* Platform/IPC/Connection.cpp:
(IPC::Connection::SyncMessageState::wait):
(IPC::Connection::sendMessage):
(IPC::Connection::timeoutRespectingIgnoreTimeoutsForTesting):
(IPC::Connection::waitForMessage):
(IPC::Connection::sendSyncMessage):
(IPC::Connection::waitForSyncReply):
* Platform/IPC/Connection.h:
(IPC::Connection::sendSync):
(IPC::Connection::waitForAndDispatchImmediately):
* Platform/IPC/MessageSender.h:
(IPC::MessageSender::sendSync):
* UIProcess/ChildProcessProxy.h:
(WebKit::ChildProcessProxy::sendSync):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/Storage/StorageManager.cpp:
(WebKit::StorageManager::applicationWillTerminate):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(-[WKOneShotDisplayLinkHandler displayLinkFired:]):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
(WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::stringSelectionForPasteboard):
(WebKit::WebPageProxy::dataSelectionForPasteboard):
(WebKit::WebPageProxy::readSelectionFromPasteboard):
(WebKit::WebPageProxy::shouldDelayWindowOrderingForEvent):
(WebKit::WebPageProxy::acceptsFirstMouse):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::runBeforeUnloadConfirmPanel):
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
(WebKit::WebChromeClient::print):
(WebKit::WebChromeClient::exceededDatabaseQuota):
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::postSynchronousMessageForTesting):

Source/WTF:

We used to use 'double' for all time measurements. Sometimes it was milliseconds,
sometimes it was seconds. Sometimes we measured a span of time, sometimes we spoke of time
since some epoch. When we spoke of time since epoch, we either used a monotonic clock or
a wall clock. The type - always 'double' - never told us what kind of time we had, even
though there were roughly six of them (sec interval, ms interval, sec since epoch on wall,
ms since epoch on wall, sec since epoch monotonic, ms since epoch monotonic).

At some point, we thought that it would be a good idea to replace these doubles with
std::chrono. But since replacing some things with std::chrono, we found it to be terribly
inconvenient:

- Outrageous API. I never want to say std::chrono::milliseconds(blah). I never want to say
  std::chrono::steady_clock::timepoint. The syntax for duration_cast is ugly, and ideally
  duration_cast would not even be a thing.

- No overflow protection. std::chrono uses integers by default and using anything else is
  clumsy. But the integer math is done without regard for the rough edges of integer math,
  so any cast between std::chrono types risks overflow. Any comparison risks overflow
  because it may do conversions silently. We have even found bugs where some C++
  implementations had more overflows than others, which ends up being a special kind of
  hell. In many cases, the overflow also has nasal demons.

It's an error to represent time using integers. It would have been excusable back when
floating point math was not guaranteed to be supported on all platforms, but that would
have been a long time ago. Time is a continuous, infinite concept and it's a perfect fit
for floating point:

- Floating point preserves precision under multiplication in all but extreme cases, so
  using floating point for time means that unit conversions are almost completely
  lossless. This means that we don't have to think very hard about what units to use. In
  this patch, we use seconds almost everywhere. We only convert at boundaries, like an API
  boundary that wants something other than seconds.

- Floating point makes it easy to reason about infinity, which is something that time code
  wants to do a lot. Example: when would you like to timeout? Infinity please! This is the
  most elegant way of having an API support both a timeout variant and a no-timeout
  variant.

- Floating point does well-understood things when math goes wrong, and these things are
  pretty well optimized to match what a mathematician would do when computing with real
  numbers represented using scientific notation with a finite number of significant
  digits. This means that time math under floating point looks like normal math. On the
  other hand, std::chrono time math looks like garbage because you have to always check
  for multiple possible UB corners whenever you touch large integers. Integers that
  represent time are very likely to be large and you don't have to do much to overflow
  them. At this time, based on the number of bugs we have already seen due to chrono
  overflows, I am not certain that we even understand what are all of the corner cases
  that we should even check for.

This patch introduces a new set of timekeeping classes that are all based on double, and
all internally use seconds. These classes support algebraic typing. The classes are:

- Seconds: this is for measuring a duration.
- WallTime: time since epoch according to a wall clock (aka real time clock).
- MonotonicTime: time since epoch according to a monotonic clock.
- ClockType: enum that says either Wall or Monotonic.
- TimeWithDynamicClockType: a tuple of double and ClockType, which represents either a
  wall time or a monotonic time.

All of these classes behave like C++ values and are cheap to copy around since they are
very nearly POD. This supports comprehensive conversions between the various time types.
Most of this is by way of algebra. Here are just some of the rules we recognize:

WallTime = WallTime + Seconds
Seconds = WallTime - WallTime
MonotonicTime = MonotonicTime + Seconds
etc...

We support negative, infinite, and NaN times because math.

We support conversions between MonotonicTime and WallTime, like:

WallTime wt = mt.approximateWallTime()

This is called this "approximate" because the only way to do it is to get the current time
on both clocks and convert relative to that.

Many of our APIs would be happy using whatever notion of time the user wanted to use. For
those APIs, which includes Condition and ParkingLot, we have TimeWithDynamicClockType. You
can automatically convert WallTime or MonotonicTime to TimeWithDynamicClockType. This
means that if you use a WallTime with Condition::waitUntil, then Condition's internal
logic for when it should wake up makes its decision based on the current WallTime - but if
you use MonotonicTime then waitUntil will make its decision based on current
MonotonicTime. This is a greater level of flexibility than chrono allowed, since chrono
did not have the concept of a dynamic clock type.

This patch does not include conversions between std::chrono and these new time classes,
because past experience shows that we're quite bad at getting conversions between
std::chrono and anything else right. Also, I didn't need such conversion code because this
patch only converts code that transitively touches ParkingLot and Condition. It was easy
to get all of that code onto the new time classes.

* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/CMakeLists.txt:
* wtf/ClockType.cpp: Added.
(WTF::printInternal):
* wtf/ClockType.h: Added.
* wtf/Condition.h:
(WTF::ConditionBase::waitUntil):
(WTF::ConditionBase::waitFor):
(WTF::ConditionBase::wait):
(WTF::ConditionBase::waitUntilWallClockSeconds): Deleted.
(WTF::ConditionBase::waitUntilMonotonicClockSeconds): Deleted.
(WTF::ConditionBase::waitForSeconds): Deleted.
(WTF::ConditionBase::waitForSecondsImpl): Deleted.
(WTF::ConditionBase::waitForImpl): Deleted.
(WTF::ConditionBase::absoluteFromRelative): Deleted.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::waitForMessage):
* wtf/CurrentTime.cpp:
(WTF::sleep):
* wtf/MessageQueue.h:
(WTF::MessageQueue::infiniteTime): Deleted.
* wtf/MonotonicTime.cpp: Added.
(WTF::MonotonicTime::now):
(WTF::MonotonicTime::approximateWallTime):
(WTF::MonotonicTime::dump):
(WTF::MonotonicTime::sleep):
* wtf/MonotonicTime.h: Added.
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawDouble):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::approximateMonotonicTime):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(WTF::MonotonicTime::operator+=):
(WTF::MonotonicTime::operator-=):
(WTF::MonotonicTime::operator==):
(WTF::MonotonicTime::operator!=):
(WTF::MonotonicTime::operator<):
(WTF::MonotonicTime::operator>):
(WTF::MonotonicTime::operator<=):
(WTF::MonotonicTime::operator>=):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/ParkingLot.h:
(WTF::ParkingLot::parkConditionally):
(WTF::ParkingLot::compareAndPark):
* wtf/Seconds.cpp: Added.
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::dump):
(WTF::Seconds::sleep):
* wtf/Seconds.h: Added.
(WTF::Seconds::Seconds):
(WTF::Seconds::value):
(WTF::Seconds::seconds):
(WTF::Seconds::milliseconds):
(WTF::Seconds::microseconds):
(WTF::Seconds::nanoseconds):
(WTF::Seconds::fromMilliseconds):
(WTF::Seconds::fromMicroseconds):
(WTF::Seconds::fromNanoseconds):
(WTF::Seconds::infinity):
(WTF::Seconds::operator bool):
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::operator*):
(WTF::Seconds::operator/):
(WTF::Seconds::operator+=):
(WTF::Seconds::operator-=):
(WTF::Seconds::operator*=):
(WTF::Seconds::operator/=):
(WTF::Seconds::operator==):
(WTF::Seconds::operator!=):
(WTF::Seconds::operator<):
(WTF::Seconds::operator>):
(WTF::Seconds::operator<=):
(WTF::Seconds::operator>=):
* wtf/TimeWithDynamicClockType.cpp: Added.
(WTF::TimeWithDynamicClockType::now):
(WTF::TimeWithDynamicClockType::nowWithSameClock):
(WTF::TimeWithDynamicClockType::wallTime):
(WTF::TimeWithDynamicClockType::monotonicTime):
(WTF::TimeWithDynamicClockType::approximateWallTime):
(WTF::TimeWithDynamicClockType::approximateMonotonicTime):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator<):
(WTF::TimeWithDynamicClockType::operator>):
(WTF::TimeWithDynamicClockType::operator<=):
(WTF::TimeWithDynamicClockType::operator>=):
(WTF::TimeWithDynamicClockType::dump):
(WTF::TimeWithDynamicClockType::sleep):
* wtf/TimeWithDynamicClockType.h: Added.
(WTF::TimeWithDynamicClockType::TimeWithDynamicClockType):
(WTF::TimeWithDynamicClockType::fromRawDouble):
(WTF::TimeWithDynamicClockType::secondsSinceEpoch):
(WTF::TimeWithDynamicClockType::clockType):
(WTF::TimeWithDynamicClockType::withSameClockAndRawDouble):
(WTF::TimeWithDynamicClockType::operator bool):
(WTF::TimeWithDynamicClockType::operator+):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator+=):
(WTF::TimeWithDynamicClockType::operator-=):
(WTF::TimeWithDynamicClockType::operator==):
(WTF::TimeWithDynamicClockType::operator!=):
* wtf/WallTime.cpp: Added.
(WTF::WallTime::now):
(WTF::WallTime::approximateMonotonicTime):
(WTF::WallTime::dump):
(WTF::WallTime::sleep):
* wtf/WallTime.h: Added.
(WTF::WallTime::WallTime):
(WTF::WallTime::fromRawDouble):
(WTF::WallTime::infinity):
(WTF::WallTime::secondsSinceEpoch):
(WTF::WallTime::approximateWallTime):
(WTF::WallTime::operator bool):
(WTF::WallTime::operator+):
(WTF::WallTime::operator-):
(WTF::WallTime::operator+=):
(WTF::WallTime::operator-=):
(WTF::WallTime::operator==):
(WTF::WallTime::operator!=):
(WTF::WallTime::operator<):
(WTF::WallTime::operator>):
(WTF::WallTime::operator<=):
(WTF::WallTime::operator>=):
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::wait):
* wtf/threads/BinarySemaphore.h:

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Condition.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp:
(TestWebKitAPI::ToUpperConverter::stopProducing):
(TestWebKitAPI::ToUpperConverter::stopConsuming):
* TestWebKitAPI/Tests/WTF/Time.cpp: Added.
(WTF::operator<<):
(TestWebKitAPI::TEST):

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

2 years agoRenderFlowThread state reset cleanup.
zalan@apple.com [Sat, 5 Nov 2016 02:57:38 +0000 (02:57 +0000)]
RenderFlowThread state reset cleanup.
https://bugs.webkit.org/show_bug.cgi?id=164426

Reviewed by Simon Fraser.

RenderFlowThread state reset is spread across several functions. This patch groups them
together in RenderObject::resetFlowThreadState().

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeLeftoverAnonymousBlock):
(WebCore::RenderBlock::dropAnonymousBoxChild): This is now part of resetFlowThreadState() since resetFlowThreadState
gets called even when NotifyChildren is false.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::insertChildInternal): Initialize the thread state before we notify the child.
(WebCore::RenderElement::removeChildInternal): Reset the state even when NotifyChildren is false.
(WebCore::RenderElement::willBeRemovedFromTree): This code is moved to removeFromRenderFlowThread().
(WebCore::RenderElement::removeFromRenderFlowThread):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::initializeFlowThreadState): This is in transition for webkit.org/b/164428 (RenderFlowThread state initialization cleanup.)
(WebCore::RenderObject::resetFlowThreadState):
(WebCore::RenderObject::setParent): This was seemingly a random place to put flow state initialization.
(WebCore::RenderObject::willBeRemovedFromTree): resetFlowThreadState() takes care of it now.
* rendering/RenderObject.h:

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

2 years agotestWASM should be very sad if no options are provided
jfbastien@apple.com [Sat, 5 Nov 2016 02:48:16 +0000 (02:48 +0000)]
testWASM should be very sad if no options are provided
https://bugs.webkit.org/show_bug.cgi?id=164444

Reviewed by Saam Barati.

Detect missing or invalid options on the command line.

* testWasm.cpp:
(CommandLine::parseArguments):

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

2 years ago[DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById
utatane.tea@gmail.com [Sat, 5 Nov 2016 01:15:17 +0000 (01:15 +0000)]
[DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById
https://bugs.webkit.org/show_bug.cgi?id=164356

Reviewed by Filip Pizlo.

Source/WebCore:

This patch implements DOMJIT::Signature annotation for getElementById.
Since getElementById is also implemented in DocumentFragment, we implement
the branchIfDocumentFragment/branchIfNotDocumentFragment for that.

In dromaeo, we have a test like this.

test( "getElementById", function(){
    for ( var i = 0; i < num * 30; i++ ) {
        ret = document.getElementById("testA" + num).nodeType;
        ret = document.getElementById("testB" + num).nodeType;
        ret = document.getElementById("testC" + num).nodeType;
        ret = document.getElementById("testD" + num).nodeType;
        ret = document.getElementById("testE" + num).nodeType;
        ret = document.getElementById("testF" + num).nodeType;
    }
});

In the above test, JSC already knows the following things.

1. Since nodeType is now handled as CallDOMGetter, we know that it is pure.
2. getElementById look up becomes PureGetById since document is impure object. But it is kept as PureGetById. So it does not write DOMState.
3. `"testA" + num` will be converted to constant string.
4. CallDOM for getElementById said it just reads(DOMState:DOM). And it saids that it returns the same value as long as DOMState is not clobbered.
5. CheckCell leading CallDOM ensures the inlined getElementById node. (CallDOM node).

The key thing is that no node clobbers DOMState during the loop. So CallDOM & CallDOMGetter can be hoisted.
This improves dom-query significantly. Dromaeo dom-query getElementById becomes 40x faster (247796 v.s. 6197).
Dromaeo dom-query getElementById (not in document) becomes 89x faster (630317.8 v.s. 7066.).

Tests: js/dom/domjit-function-get-element-by-id-changed.html
       js/dom/domjit-function-get-element-by-id-licm.html
       js/dom/domjit-function-get-element-by-id.html

* dom/NonElementParentNode.idl:
* domjit/DOMJITCheckDOM.h:
(WebCore::DOMJIT::TypeChecker<DocumentFragment>::branchIfFail):
* domjit/DOMJITHelpers.h:
(WebCore::DOMJIT::branchIfDocumentFragment):
(WebCore::DOMJIT::branchIfNotDocumentFragment):

LayoutTests:

* js/dom/domjit-function-get-element-by-id-changed-expected.txt: Added.
* js/dom/domjit-function-get-element-by-id-changed.html: Added.
* js/dom/domjit-function-get-element-by-id-expected.txt: Added.
* js/dom/domjit-function-get-element-by-id-licm-expected.txt: Added.
* js/dom/domjit-function-get-element-by-id-licm.html: Added.
* js/dom/domjit-function-get-element-by-id.html: Added.

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

2 years agoRename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingOb...
simon.fraser@apple.com [Sat, 5 Nov 2016 00:55:43 +0000 (00:55 +0000)]
Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
https://bugs.webkit.org/show_bug.cgi?id=164438

Reviewed by Tim Horton.

unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
of confusion.

Functions with "VisibleContent" in the name are usually expected to return document coordinates (affected by zooming),
so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of "unscaled" vs "visibleContent", and
"unobscured" vs "visible".

So rename:
    unscaledUnobscuredVisibleContentSize -> sizeForUnobscuredContent
    unscaledVisibleContentSizeIncludingObscuredArea -> sizeForVisibleContent

sizeForUnobscuredContent() can also be private to ScrollView.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::update):
* platform/ScrollView.cpp:
(WebCore::ScrollView::unobscuredContentRectInternal):
(WebCore::ScrollView::sizeForVisibleContent):
(WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
before testing whether we have a platform widget.
(WebCore::ScrollView::layoutSize):
(WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
(WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
* platform/ScrollView.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):
(WebCore::RenderLayerCompositor::updateRootLayerPosition):
(WebCore::RenderLayerCompositor::ensureRootLayer):

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

2 years agoError description code should be able to handle Symbol values.
mark.lam@apple.com [Sat, 5 Nov 2016 00:48:01 +0000 (00:48 +0000)]
Error description code should be able to handle Symbol values.
https://bugs.webkit.org/show_bug.cgi?id=164436
<rdar://problem/29115583>

Reviewed by Filip Pizlo and Saam Barati.

JSTests:

* stress/error-description-on-symbols-should-not-crash.js: Added.

Source/JavaScriptCore:

Previously, we try to toString() the Symbol value, resulting in it throwing an
exception in errorDescriptionForValue() which breaks the invariant that
errorDescriptionForValue() should not throw.

We fixed this by making errorDescriptionForValue() aware of the Symbol type, and
not so a toString() on Symbol values.  Also fixed notAFunctionSourceAppender()
to build a nicer message for Symbol values.

* runtime/ExceptionHelpers.cpp:
(JSC::errorDescriptionForValue):
(JSC::notAFunctionSourceAppender):

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

2 years agoLayout viewport wrong with RTL documents
simon.fraser@apple.com [Sat, 5 Nov 2016 00:41:50 +0000 (00:41 +0000)]
Layout viewport wrong with RTL documents
https://bugs.webkit.org/show_bug.cgi?id=164434

Reviewed by Tim Horton.

Source/WebCore:

The layoutViewportRect was computed incorrectly in RTL documents, because
FrameView::unscaledMaximumScrollPosition() was wrong; it erroneously mapped
what it thought was a scrollOffset to a scrollPosition.

Unscaled scroll positions are in the same coordinate space as unscaledDocumentRect,
so we should not call scrollPositionFromOffset() in FrameView::unscaledMaximumScrollPosition().

Changed FrameView::unscaledMinimumScrollPosition() to also just grab the location of
unscaledDocumentRect, for symmetry.

Finally fixed the tiled scrolling indicator's viewport rect for zoomed RTL documents
by using the unscaled scroll origin.

Tests: fast/visual-viewport/rtl-nonzoomed-rects.html
       fast/visual-viewport/rtl-zoomed-rects.html

* page/FrameView.cpp:
(WebCore::FrameView::setLayoutViewportOrigin):
(WebCore::FrameView::unscaledScrollOrigin):
(WebCore::FrameView::unscaledMinimumScrollPosition):
(WebCore::FrameView::unscaledMaximumScrollPosition):
* page/FrameView.h:

LayoutTests:

* fast/visual-viewport/rtl-nonzoomed-rects-expected.txt: Added.
* fast/visual-viewport/rtl-nonzoomed-rects.html: Added.
* fast/visual-viewport/rtl-zoomed-rects-expected.txt: Added.
* fast/visual-viewport/rtl-zoomed-rects.html: Added.
* platform/ios-simulator/fast/visual-viewport/rtl-nonzoomed-rects-expected.txt: Added.
* platform/ios-simulator/fast/visual-viewport/rtl-zoomed-rects-expected.txt: Added.
* platform/mac-wk1/fast/visual-viewport/rtl-zoomed-rects-expected.txt: Added. WK1 and RTL are weird.

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

2 years ago[WebIDL] Add support for modern callback syntax
commit-queue@webkit.org [Sat, 5 Nov 2016 00:03:32 +0000 (00:03 +0000)]
[WebIDL] Add support for modern callback syntax
https://bugs.webkit.org/show_bug.cgi?id=164435

Patch by Sam Weinig <sam@webkit.org> on 2016-11-04
Reviewed by Chris Dumez.

Support new callback syntax:
    callback Function = void (DOMString arg1, long arg2);

This replaces "callback interface" types with a Callback=FunctionOnly
extended attribute.

* Modules/geolocation/PositionCallback.idl:
* Modules/geolocation/PositionErrorCallback.idl:
* Modules/notifications/NotificationPermissionCallback.idl:
* Modules/quota/StorageErrorCallback.idl:
* Modules/quota/StorageQuotaCallback.idl:
* Modules/quota/StorageUsageCallback.idl:
* Modules/webaudio/AudioBufferCallback.idl:
* Modules/webdatabase/DatabaseCallback.idl:
* Modules/webdatabase/SQLStatementCallback.idl:
* Modules/webdatabase/SQLStatementErrorCallback.idl:
* Modules/webdatabase/SQLTransactionCallback.idl:
* Modules/webdatabase/SQLTransactionErrorCallback.idl:
* dom/RequestAnimationFrameCallback.idl:
* dom/StringCallback.idl:
* html/VoidCallback.idl:
* page/IntersectionObserverCallback.idl:
* css/MediaQueryListListener.idl:
Update to new syntax.

* css/MediaQueryListListener.h:
* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::styleResolverChanged):
Switch to using the now required 'handleEvent' name. This is an implementation detail
that we should change.

* bindings/scripts/CodeGenerator.pm:
Update document processing to allow a callback only file. Update callback
type checks to look for a regex that matches in the new format.

* bindings/scripts/CodeGeneratorJS.pm:
(AddToImplIncludesForIDLType):
(AddToIncludesForIDLType):
(AddToImplIncludes):
(AddToIncludes):
Abstract includes functions to allow passing in an include hash.

(GenerateCallbackFunctionHeader):
(GenerateCallbackFunctionImplementation):
(GenerateCallbackInterfaceHeader):
(GenerateCallbackInterfaceImplementation):
(GenerateCallbackHeaderContent):
(GenerateCallbackImplementationContent):
Refactor callback generation code into GenerateCallbackHeaderContent and GenerateCallbackImplementationContent
to allow using it for both the new callbacks as well as the old callback interfaces.

* bindings/scripts/IDLParser.pm:
(Parse):
(applyTypedefs):
(applyTypedefsToOperation):
(parseCallbackRest):
Parse callbacks into the new IDLCallbackFunction type. Ensure that typedefs are applied as well.

* bindings/scripts/IDLAttributes.txt:
Remove support for Callback=FunctionOnly.

* bindings/scripts/test/JS/JSTestCallback.cpp: Removed.
* bindings/scripts/test/JS/JSTestCallback.h: Removed.
* bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
* bindings/scripts/test/JS/JSTestCallbackFunction.h:
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: Added.
* bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: Added.
* bindings/scripts/test/JS/JSTestCallbackInterface.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp.
* bindings/scripts/test/JS/JSTestCallbackInterface.h: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h.
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/TestCallback.idl: Removed.
* bindings/scripts/test/TestCallbackFunction.idl:
* bindings/scripts/test/TestCallbackFunctionWithTypedefs.idl: Added.
* bindings/scripts/test/TestCallbackInterface.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallback.idl.
* bindings/scripts/test/TestObj.idl:
* bindings/scripts/test/TestTypedefs.idl:
Update existing tests and add new ones to test callback functions specifically.

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

2 years agoMove isDefaultPortForProtocol from URLParser.cpp back to URL.cpp
achristensen@apple.com [Fri, 4 Nov 2016 23:59:03 +0000 (23:59 +0000)]
Move isDefaultPortForProtocol from URLParser.cpp back to URL.cpp
https://bugs.webkit.org/show_bug.cgi?id=164439

Reviewed by Daniel Bates.

No change in behaviour.

* platform/URL.cpp:
(WebCore::defaultPortForProtocol):
(WebCore::isDefaultPortForProtocol):
* platform/URLParser.cpp:
(WebCore::URLParser::defaultPortForProtocol):
(WebCore::URLParser::parsePort):
(WebCore::defaultPortForProtocol): Deleted.
(WebCore::isDefaultPortForProtocol): Deleted.
* platform/URLParser.h:

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

2 years agoSafari does not emit composition end if blurred for dead key / Japanese IME
wenson_hsieh@apple.com [Fri, 4 Nov 2016 23:55:00 +0000 (23:55 +0000)]
Safari does not emit composition end if blurred for dead key / Japanese IME
https://bugs.webkit.org/show_bug.cgi?id=164369
<rdar://problem/29050439>

Reviewed by Ryosuke Niwa.

Source/WebCore:

On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
This is because the focused element may have changed after performing the selection change, so we would
otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
of the element with the composition.

Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
that discards the marked text, and then updates the editor state. This patch splits this into two separate
steps -- see the WebKit2 ChangeLog for more details.

Test: fast/events/ime-compositionend-on-selection-change.html

* editing/Editor.cpp:
(WebCore::Editor::selectionWillChange):
* editing/Editor.h:
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
* editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
* loader/EmptyClients.h:
* page/EditorClient.h:

Source/WebKit/mac:

When canceling a composition, make sure that we clear the system IME state.

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::canceledComposition):

Source/WebKit/win:

Add a stub implementation of canceledComposition.

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorClient::canceledComposition):
* WebCoreSupport/WebEditorClient.h:

Source/WebKit2:

Split WebPage::discardedComposition into two steps, where we first discard marked text and then update the
editor state. This allows the codepath where we cancel the composition early (before setting the selection) to
discard marked text without also forcing an editor state update at the same time. The editor state is later
updated in WebPage::didChangeSelection.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::compositionWasCanceled):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::canceledComposition):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):
(WebKit::WebPage::discardedComposition):
(WebKit::WebPage::canceledComposition):
* WebProcess/WebPage/WebPage.h:

LayoutTests:

Adds a new test verifying that we dispatch `compositionend` events in various circumstances:
    1. After composing in an editable area and then focusing another editable area.
    2. After composing in an editable area and then blur()-ing.
    3. After composing in an editable area and then changing the selection.

There should be no behavior change for other platforms, so no new tests are needed there with this change.

* fast/events/ime-compositionend-on-selection-change-expected.txt: Added.
* fast/events/ime-compositionend-on-selection-change.html: Added.
* platform/ios-simulator/TestExpectations:

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

2 years agoIndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from...
beidson@apple.com [Fri, 4 Nov 2016 23:27:19 +0000 (23:27 +0000)]
IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.
https://bugs.webkit.org/show_bug.cgi?id=164424

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the
spec in flux/under discussion.

We'll update either source or the tests as things are resolved.

* IndexedDB-private-browsing/idbcursor_advance_index7-expected.txt:
* IndexedDB-private-browsing/idbcursor_continue_index7-expected.txt:
* IndexedDB-private-browsing/idbindex_get7-expected.txt:
* IndexedDB-private-browsing/idbindex_getKey7-expected.txt:
* IndexedDB-private-browsing/idbindex_openCursor2-expected.txt:
* IndexedDB-private-browsing/idbindex_openKeyCursor3-expected.txt:
* web-platform-tests/IndexedDB/idbcursor_advance_index7-expected.txt:
* web-platform-tests/IndexedDB/idbcursor_continue_index7-expected.txt:
* web-platform-tests/IndexedDB/idbindex_get8-expected.txt:
* web-platform-tests/IndexedDB/idbindex_getKey8-expected.txt:
* web-platform-tests/IndexedDB/idbindex_openCursor3-expected.txt:
* web-platform-tests/IndexedDB/idbindex_openKeyCursor4-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-index-metadata-revert-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-multiple-metadata-revert-expected.txt:
* web-platform-tests/IndexedDB/transaction-abort-object-store-metadata-revert-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the
spec in flux/under discussion.

We'll update either source or the tests as things are resolved.

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::putOrAdd):
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):

LayoutTests:

* storage/indexeddb/resources/transaction-basics.js:
* storage/indexeddb/transaction-basics-expected.txt:
* storage/indexeddb/transaction-basics-private-expected.txt:

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

2 years agoEvalCodeCache should not give up in strict mode and other cases
ggaren@apple.com [Fri, 4 Nov 2016 23:02:19 +0000 (23:02 +0000)]
EvalCodeCache should not give up in strict mode and other cases
https://bugs.webkit.org/show_bug.cgi?id=164357

Reviewed by Michael Saboff.

JSTests:

* microbenchmarks/eval-cached.js: Added. 45x faster now.
* stress/eval-cached.js: Added. Try running the same eval text in a bunch
of different scopes and verify that we access the right scope.

Source/JavaScriptCore:

EvalCodeCache gives up in non-trivial cases because generated eval code
can't soundly migrate from, for example, a let scope to a non-let scope.
The number of cases has grown over time.

Instead, let's cache eval code based on the location of the call to
eval(). That way, we never relocate the code, and it's sound to make
normal assumptions about our surrounding scope.

* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::CacheKey::CacheKey): Use CallSiteIndex to uniquely
identify the location of our call to eval().

(JSC::EvalCodeCache::CacheKey::hash):
(JSC::EvalCodeCache::CacheKey::operator==):
(JSC::EvalCodeCache::CacheKey::Hash::equal): Use CallSiteIndex instead
of lots of other flags.

(JSC::EvalCodeCache::tryGet): No need to include details that are implied
by our CallSiteIndex.

(JSC::EvalCodeCache::getSlow): No need to skip caching in complex
situations. We promise we'll never relocate the cached code.

(JSC::EvalCodeCache::isCacheableScope): Deleted.
(JSC::EvalCodeCache::isCacheable): Deleted.

* interpreter/Interpreter.cpp:
(JSC::eval): Pass through a CallSiteIndex to uniquely identify this call
to eval().

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

2 years agoLoad stylesheets in link elements inside a connected shadow tree
rniwa@webkit.org [Fri, 4 Nov 2016 22:53:33 +0000 (22:53 +0000)]
Load stylesheets in link elements inside a connected shadow tree
https://bugs.webkit.org/show_bug.cgi?id=160683
<rdar://problem/29040652>

Reviewed by Antti Koivisto.

Source/WebCore:

Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement
when it's connected to a document instead of always talking to document's style scope.

Tests: fast/shadow-dom/link-element-in-shadow-tree.html
       fast/shadow-dom/selected-stylesheet-in-shadow-tree.html

       * html/HTMLLinkElement.cpp:
       (WebCore::HTMLLinkElement::HTMLLinkElement):
       (WebCore::HTMLLinkElement::~HTMLLinkElement):
       (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking
       didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits
       early when inDocument() is false.
       (WebCore::HTMLLinkElement::parseAttribute):
       (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree.
       (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to
       a document instead of whenever its self-inclusive ancestor is inserted into a container.
       (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after
       calling removePendingSheet since the latter depends on m_styleScope being not null.
       (WebCore::HTMLLinkElement::addPendingSheet):
       (WebCore::HTMLLinkElement::removePendingSheet):
       * html/HTMLLinkElement.h:
       * html/HTMLStyleElement.cpp:
       (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this
       element has just become connected to a document.
       (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal.
       * style/StyleScope.h:
       * svg/SVGStyleElement.cpp:
       (WebCore::SVGStyleElement::insertedInto): Ditto.
       (WebCore::SVGStyleElement::removedFrom): Ditto for the removal.

LayoutTests:

Added W3C style testharness.js tests for loading stylesheets via a link element inside a ahadow tree.

* fast/shadow-dom/link-element-in-shadow-tree-expected.txt: Added.
* fast/shadow-dom/link-element-in-shadow-tree.html: Added.
* fast/shadow-dom/resources/green-host.css: Added.
* fast/shadow-dom/selected-stylesheet-in-shadow-tree-expected.txt: Added.
* fast/shadow-dom/selected-stylesheet-in-shadow-tree.html: Added.

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

2 years agoAdd support for Wasm br_table
keith_miller@apple.com [Fri, 4 Nov 2016 22:53:21 +0000 (22:53 +0000)]
Add support for Wasm br_table
https://bugs.webkit.org/show_bug.cgi?id=164429

Reviewed by Michael Saboff.

This patch adds support for Wasm br_table. The Wasm br_table
opcode essentially directly maps to B3's switch opcode.

There are also three other minor changes:
1) all non-argument locals should be initialized to zero at function entry.
2) add new setErrorMessage member to WasmFunctionParser.h
3) return does not decode an extra immediate anymore.

* testWasm.cpp:
(runWasmTests):
* wasm/WasmB3IRGenerator.cpp:
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser::setErrorMessage):
(JSC::Wasm::FunctionParser<Context>::parseExpression):
(JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):
(JSC::Wasm::FunctionParser<Context>::popExpressionStack):
* wasm/WasmValidate.cpp:
(JSC::Wasm::Validate::checkBranchTarget):
(JSC::Wasm::Validate::addBranch):
(JSC::Wasm::Validate::addSwitch):

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

2 years agoWebAssembly JS API: implement more sections
jfbastien@apple.com [Fri, 4 Nov 2016 22:12:12 +0000 (22:12 +0000)]
WebAssembly JS API: implement more sections
https://bugs.webkit.org/show_bug.cgi?id=164023

Reviewed by Keith Miller.

On the JSC side:

 - Put in parser stubs for all WebAssembly sections.
 - Parse Import, Export sections.
 - Use tryReserveCapacity instead of reserve, and bail out of the parser if it fails. This prevents the parser from bringing everything down when faced with a malicious input.
 - Encapsulate all parsed module information into its own structure, making it easier to pass around (from parser to Plan to Module to Instance).
 - Create WasmFormat.cpp to hold parsed module information's dtor to avoid including WasmMemory.h needlessly.
JSTests:

 - parseCode: avoid overflow through function size.
 - Remove all remainders of polyfill-prototype-1, and update license.
 - Add missing WasmOps.h and WasmValidateInlines.h auto-generation for cmake build.

On the Builder.js testing side:

 - Implement Type, Import (function only), Export (function only) sections.
 - Check section order and uniqueness.
 - Optionally auto-generate the Type section from subsequent Export / Import / Code entries.
 - Allow re-exporting an import.

* wasm/Builder.js: build type, import, and export sections
(const._normalizeFunctionSignature):
* wasm/Builder_WebAssemblyBinary.js: Added. Forked from Builder.js
(const.emitters.Type):
(const.emitters.Import):
(const.emitters.Function):
(const.emitters.Table):
(const.emitters.Memory):
(const.emitters.Global):
(const.emitters.Export):
(const.emitters.Start):
(const.emitters.Element):
(const.emitters.Code):
(const.emitters.Data):
(export.const.Binary):
* wasm/LowLevelBinary.js: Add a few useful outputs
(export.default.LowLevelBinary.prototype.varuint1):
(export.default.LowLevelBinary.prototype.varint7):
* wasm/WASM.js: value type and external kind helpers
* wasm/assert.js: array element-wise equality comparison
(const._eq):
* wasm/js-api/test_Module.js:
(ModuleWithImports):
* wasm/self-test/test_BuilderJSON.js: many more tests for all the new Builder APIs, and update to some older tests which now require a Type section or rejiggered Function signature
(const.assertOpThrows):
(SectionsWithSameCustomName):
(TwoTypeSections):
(EmptyImportSection):
(ImportBeforeTypeSections):
* wasm/self-test/test_BuilderWebAssembly.js: remove a test which wasn't helpful and is now obsolete
(CustomSection):

Source/JavaScriptCore:

 - Remove all remainders of polyfill-prototype-1, and update license.
 - Add missing WasmOps.h and WasmValidateInlines.h auto-generation for cmake build.

On the Builder.js testing side:

 - Implement Type, Import (function only), Export (function only) sections.
 - Check section order and uniqueness.
 - Optionally auto-generate the Type section from subsequent Export / Import / Code entries.
 - Allow re-exporting an import.

* CMakeLists.txt: missing auto-genration
* JavaScriptCore.xcodeproj/project.pbxproj: merge conflict
* testWasm.cpp: update for API changes, no functional change
(checkPlan):
(runWasmTests):
* wasm/WasmFormat.cpp: add a dtor which requires extra headers which I'd rather not include in WasmFormat.h
(JSC::Wasm::ModuleInformation::~ModuleInformation):
* wasm/WasmFormat.h: Add External, Import, Functioninformation, Export, ModuleInformation, CompiledFunction, and remove obsolete stuff which was a holdover from the first implementation (all that code is now gone, so remove its license)
(JSC::Wasm::External::isValid):
* wasm/WasmModuleParser.cpp: simplify some, make names consistent with the WebAssembly section names, check memory allocations so they can fail early
(JSC::Wasm::ModuleParser::parse):
(JSC::Wasm::ModuleParser::parseType):
(JSC::Wasm::ModuleParser::parseImport):
(JSC::Wasm::ModuleParser::parseFunction):
(JSC::Wasm::ModuleParser::parseTable):
(JSC::Wasm::ModuleParser::parseMemory):
(JSC::Wasm::ModuleParser::parseGlobal):
(JSC::Wasm::ModuleParser::parseExport):
(JSC::Wasm::ModuleParser::parseStart):
(JSC::Wasm::ModuleParser::parseElement):
(JSC::Wasm::ModuleParser::parseCode): avoid overflow through function size.
(JSC::Wasm::ModuleParser::parseData):
* wasm/WasmModuleParser.h:
(JSC::Wasm::ModuleParser::moduleInformation):
* wasm/WasmParser.h:
(JSC::Wasm::Parser::consumeUTF8String): add as required by spec
(JSC::Wasm::Parser::parseExternalKind): add as per spec
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::Plan): fix some ownership, improve some error messages
* wasm/WasmPlan.h: fix some ownership
(JSC::Wasm::Plan::getModuleInformation):
(JSC::Wasm::Plan::getMemory):
(JSC::Wasm::Plan::compiledFunctionCount):
(JSC::Wasm::Plan::compiledFunction):
(JSC::Wasm::Plan::getCompiledFunctions):
* wasm/WasmSections.h: macroize with description, so that error messages are super pretty. This could be auto-generated.
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::create): take module information
(JSC::JSWebAssemblyModule::JSWebAssemblyModule): ditto
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::moduleInformation):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance): check that modules with imports are instantiated with an import object, as per spec. This needs to be tested.
* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::constructJSWebAssemblyMemory):
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::constructJSWebAssemblyModule):
* wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::constructJSWebAssemblyTable):

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

2 years agoUnreviewed, rolling out r208293.
achristensen@apple.com [Fri, 4 Nov 2016 22:02:19 +0000 (22:02 +0000)]
Unreviewed, rolling out r208293.

asserts in API tests.

Reverted changeset:

"NetworkSession: Network process crash when converting main
resource to download"
https://bugs.webkit.org/show_bug.cgi?id=164220
http://trac.webkit.org/changeset/208293

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

2 years agoAdd a setting and preferences to enable/disable async image decoding
commit-queue@webkit.org [Fri, 4 Nov 2016 21:54:44 +0000 (21:54 +0000)]
Add a setting and preferences to enable/disable async image decoding
https://bugs.webkit.org/show_bug.cgi?id=164417

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

Source/WebCore:

Add an asyncImageDecodingEnabled setting. This setting controls whether an
image "can" be asynchronously decoded on a separate thread or not. The
function ImageSource::isAsyncDecodingRequired() will be used in conjunction
with this setting to decide whether an image "should" be asynchronously
decoded or not.

* page/Settings.in:

Source/WebKit/mac:

Hook up the asyncImageDecodingEnabled setting for WebKit1.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences asyncImageDecodingEnabled]):
(-[WebPreferences setAsyncImageDecodingEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Hook up the asyncImageDecodingEnabled setting for WebKit2.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _asyncImageDecodingEnabled]):
(-[WKPreferences _setAsyncImageDecodingEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Pref and a menu item to toggle asyncImageDecodingEnabled for WebKits 1 and 2.

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController toggleAsyncImageDecodingEnabled:]):
(-[SettingsController asyncImageDecodingEnabled]):
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]):

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

2 years agoApply post-landing review comments for r208347
timothy_horton@apple.com [Fri, 4 Nov 2016 21:04:28 +0000 (21:04 +0000)]
Apply post-landing review comments for r208347

* dom/Element.cpp:
(WebCore::Element::findAnchorElementForLink):
Use attributeWithoutSynchronization.

* page/PrintContext.cpp:
(WebCore::PrintContext::spoolPage):
(WebCore::PrintContext::spoolRect):
(WebCore::PrintContext::collectLinkedDestinations):
(WebCore::PrintContext::outputLinkedDestinations):
* page/PrintContext.h:
Pass Document by reference instead of Node by pointer,
use ElementTraversal instead of NodeTraversal to avoid
having to locally check the type, and null-check renderers.

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

2 years agoAdd layout test for input.setCustomValidity()
cdumez@apple.com [Fri, 4 Nov 2016 20:48:18 +0000 (20:48 +0000)]
Add layout test for input.setCustomValidity()
https://bugs.webkit.org/show_bug.cgi?id=164419

Reviewed by Simon Fraser.

Add layout test for input.setCustomValidity().

* fast/forms/validation-custom-message-expected.txt: Added.
* fast/forms/validation-custom-message.html: Added.

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

2 years agoImplement WebGL2RenderingContext::copyBufferSubData()
mmaxfield@apple.com [Fri, 4 Nov 2016 20:09:39 +0000 (20:09 +0000)]
Implement WebGL2RenderingContext::copyBufferSubData()
https://bugs.webkit.org/show_bug.cgi?id=164008

Reviewed by Dean Jackson.

Source/WebCore:

Similar to previous work regarding WebGL 2 buffers, this method implements
the ability to copy from one buffer to another without the data leaving
the GPU.

Test: fast/canvas/webgl/copyBufferSubData.html

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::copyBufferSubData):
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::associateCopyBufferSubData):
* html/canvas/WebGLBuffer.h:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::copyBufferSubData):

LayoutTests:

* fast/canvas/webgl/copyBufferSubData-expected.txt: Added.
* fast/canvas/webgl/copyBufferSubData.html: Added.

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

2 years agoRename some ScrollingTree/Node-related functions to reduce the number of uses of...
simon.fraser@apple.com [Fri, 4 Nov 2016 19:42:26 +0000 (19:42 +0000)]
Rename some ScrollingTree/Node-related functions to reduce the number of uses of "update"
https://bugs.webkit.org/show_bug.cgi?id=164420

Reviewed by Tim Horton.

Rename:
    commitNewTreeState -> commitTreeState ("new" was redundant)
    updateBeforeChildren -> commitStateBeforeChildren
    updateAfterChildren -> commitStateAfterChildren

Source/WebCore:

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitTreeState):
(WebCore::ScrollingTree::updateTreeFromStateNode):
(WebCore::ScrollingTree::commitNewTreeState): Deleted.
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeFrameScrollingNode::updateBeforeChildren): Deleted.
* page/scrolling/ScrollingTreeFrameScrollingNode.h:
* page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::commitStateAfterChildren):
(WebCore::ScrollingTreeNode::updateAfterChildren): Deleted.
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Deleted.
(WebCore::ScrollingTreeScrollingNode::updateAfterChildren): Deleted.
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::commitTreeState):
(WebCore::ThreadedScrollingTree::commitNewTreeState): Deleted.
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
(WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
(WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateAfterChildren):
(WebCore::ScrollingTreeFrameScrollingNodeIOS::updateBeforeChildren): Deleted.
(WebCore::ScrollingTreeFrameScrollingNodeIOS::updateAfterChildren): Deleted.
* page/scrolling/ios/ScrollingTreeIOS.cpp:
(WebCore::ScrollingTreeIOS::commitNewTreeState): Deleted.
* page/scrolling/ios/ScrollingTreeIOS.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::commitTreeState):
* page/scrolling/mac/ScrollingTreeFixedNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeFixedNode::updateBeforeChildren): Deleted.
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
(WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Deleted.
(WebCore::ScrollingTreeFrameScrollingNodeMac::updateAfterChildren): Deleted.
* page/scrolling/mac/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeStickyNode::updateBeforeChildren): Deleted.

Source/WebKit2:

* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
(WebKit::RemoteScrollingCoordinatorProxy::updateScrollingTree): Deleted.
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateBeforeChildren):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateBeforeChildren): Deleted.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren): Deleted.
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

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

2 years agoAdd new 'other' Apple Pay button style
andersca@apple.com [Fri, 4 Nov 2016 19:16:31 +0000 (19:16 +0000)]
Add new 'other' Apple Pay button style
https://bugs.webkit.org/show_bug.cgi?id=164384
rdar://problem/28302528

Reviewed by Dean Jackson.

* DerivedSources.make:
* WebCorePrefix.h:
Add extension points.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
Add ApplePayButtonType::Other.

(WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
Add CSSValueOther.

* css/CSSValueKeywords.in:
Add other.

* css/parser/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
Add CSSValueOther.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
Add CSSValueOther.

* rendering/RenderThemeCocoa.mm:
(WebCore::toPKPaymentButtonType):
Handle ApplePayButtonType::Other.

* rendering/style/RenderStyleConstants.h:
Add ApplePayButtonType::Other.

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

2 years agoslotted() pseudo does not work with ID selector
antti@apple.com [Fri, 4 Nov 2016 18:32:45 +0000 (18:32 +0000)]
slotted() pseudo does not work with ID selector
https://bugs.webkit.org/show_bug.cgi?id=160538
<rdar://problem/28534529>

Reviewed by Andreas Kling.

Source/WebCore:

When we saw an id selector while addin rules we immediately threw it into the m_idRules
optimization bucket and bailed out. However selectors containing ::slotted must always end
up in m_slottedPseudoElementRules list no matter what else is there.

Fix by treating id like other selectors and only choosing the bucket after analysing all
the selector components.

Test: fast/shadow-dom/css-scoping-slot-with-id.html

* css/RuleSet.cpp:
(WebCore::RuleSet::addRule): Also made this use switch instead of a series of ifs.

LayoutTests:

* fast/shadow-dom/css-scoping-slot-with-id-expected.html: Added.
* fast/shadow-dom/css-scoping-slot-with-id.html: Added.

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

2 years agoIndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change...
beidson@apple.com [Fri, 4 Nov 2016 18:10:24 +0000 (18:10 +0000)]
IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
https://bugs.webkit.org/show_bug.cgi?id=164416

Reviewed by Beth Dakin.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbobjectstore-rename-abort-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):

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

2 years agoNetworkSession: Add NetworkDataTask implementation for blobs
achristensen@apple.com [Fri, 4 Nov 2016 18:08:05 +0000 (18:08 +0000)]
NetworkSession: Add NetworkDataTask implementation for blobs
https://bugs.webkit.org/show_bug.cgi?id=163939

Source/WebCore:

Patch by Keith Rollin <krollin@apple.com> on 2016-11-04
Reviewed by Alex Christensen.

* WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
* fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
* platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
* platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
* platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().

Source/WebCore/platform/gtk/po:

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-11-04
Reviewed by Alex Christensen.

* POTFILES.in: Remove DownloadSoup.cpp

Source/WebKit2:

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-11-04
Reviewed by Alex Christensen.

Add NetworkDataTaskBlob to handle blobs when using NetworkSession instead of using ResourceHandle. This patch
adds more USE(NETWORK_SESSION) ifdefs to not use ResourceHandle in Downloads and NetworkLoad when NetworkSession
is enabled.

* CMakeLists.txt: Add new files to compilation.
* NetworkProcess/Downloads/BlobDownloadClient.cpp:
* NetworkProcess/Downloads/BlobDownloadClient.h:
* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::Download): Split the constructor again and remove the PlatformDownloadTaskRef
definitions. Now Cocoa specific constructor receives a NSURLSessionDownloadTask and the general constructor
reveices a NetworkDataTask and is used by Soup backend and blobs.
(WebKit::Download::~Download):
(WebKit::Download::start):
(WebKit::Download::startWithHandle):
(WebKit::Download::cancel):
(WebKit::Download::didReceiveAuthenticationChallenge):
(WebKit::Download::didReceiveData):
(WebKit::Download::didFinish):
(WebKit::Download::platformCancelNetworkLoad): Rename cancelNetworkLoad() as platformCancelNetworkLoad() since
this is now used only by Cocoa platform to cancel the NSURLSessionDownloadTask.
* NetworkProcess/Downloads/Download.h:
(WebKit::Download::Download):
(WebKit::Download::suggestedName):
(WebKit::Download::request):
* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::startDownload): Remove blobs specific code when using NetworkSession.
(WebKit::DownloadManager::continueDecidePendingDownloadDestination):
* NetworkProcess/Downloads/DownloadManager.h:
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::platformCancelNetworkLoad):
* NetworkProcess/Downloads/soup/DownloadSoup.cpp: Removed.
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::convertMainResourceLoadToDownload): Remove blobs specific code when
using NetworkSession.
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create): If request is a blob, create a NetworkDataTaskBlob.
* NetworkProcess/NetworkDataTask.h: Add invalidateAndCancel pure virtual method.
* NetworkProcess/NetworkDataTaskBlob.cpp: Added.
(WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::~NetworkDataTaskBlob):
(WebKit::NetworkDataTaskBlob::clearStream):
(WebKit::NetworkDataTaskBlob::resume):
(WebKit::NetworkDataTaskBlob::suspend):
(WebKit::NetworkDataTaskBlob::cancel):
(WebKit::NetworkDataTaskBlob::invalidateAndCancel):
(WebKit::NetworkDataTaskBlob::getSizeForNext):
(WebKit::NetworkDataTaskBlob::didGetSize):
(WebKit::NetworkDataTaskBlob::seek):
(WebKit::NetworkDataTaskBlob::didReceiveResponse):
(WebKit::NetworkDataTaskBlob::read):
(WebKit::NetworkDataTaskBlob::readData):
(WebKit::NetworkDataTaskBlob::readFile):
(WebKit::NetworkDataTaskBlob::didOpen):
(WebKit::NetworkDataTaskBlob::didRead):
(WebKit::NetworkDataTaskBlob::consumeData):
(WebKit::NetworkDataTaskBlob::setPendingDownloadLocation):
(WebKit::NetworkDataTaskBlob::suggestedFilename):
(WebKit::NetworkDataTaskBlob::download):
(WebKit::NetworkDataTaskBlob::writeDownload):
(WebKit::NetworkDataTaskBlob::cleanDownloadFiles):
(WebKit::NetworkDataTaskBlob::didFailDownload):
(WebKit::NetworkDataTaskBlob::didFinishDownload):
(WebKit::NetworkDataTaskBlob::didFail):
(WebKit::NetworkDataTaskBlob::didFinish):
* NetworkProcess/NetworkDataTaskBlob.h: Added.
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::NetworkLoad): Remove blobs specific code when using NetworkSession.
(WebKit::NetworkLoad::~NetworkLoad):
(WebKit::NetworkLoad::setDefersLoading):
(WebKit::NetworkLoad::cancel):
(WebKit::NetworkLoad::continueWillSendRequest):
(WebKit::NetworkLoad::continueDidReceiveResponse):
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
(WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::invalidateAndCancel): Moved from NetworkSessionSoup, since this is now used also by blobs.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::registerNetworkDataTask): Ditto.
(WebKit::NetworkSession::unregisterNetworkDataTask): Ditto.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h: Add invalidateAndCancel() implementation that does nothing
because in Cocoa all tasks are invalidated and canceled by the network session.
* NetworkProcess/mac/NetworkLoadMac.mm:
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::~NetworkDataTaskSoup):
(WebKit::NetworkDataTaskSoup::download):
* NetworkProcess/soup/NetworkDataTaskSoup.h:
* NetworkProcess/soup/NetworkSessionSoup.cpp:
* NetworkProcess/soup/NetworkSessionSoup.h:
* PlatformEfl.cmake: Remove DownloadSoup.cpp from compilation.
* PlatformGTK.cmake: Ditto.
* WebKit2.xcodeproj/project.pbxproj: Add new files to compilation.

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

2 years agoREGRESSION (r208349) StringHasher::hashMemory behavior changed, causing API tests...
beidson@apple.com [Fri, 4 Nov 2016 18:02:32 +0000 (18:02 +0000)]
REGRESSION (r208349) StringHasher::hashMemory behavior changed, causing API tests to fail
https://bugs.webkit.org/show_bug.cgi?id=164390

Reviewed by Geoffrey Garen.

Operating under the assumption that the behavior change is okay/desirable, this updates the test.

* TestWebKitAPI/Tests/WTF/StringHasher.cpp:
(TestWebKitAPI::TEST):

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

2 years agoIndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions...
beidson@apple.com [Fri, 4 Nov 2016 18:02:02 +0000 (18:02 +0000)]
IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
https://bugs.webkit.org/show_bug.cgi?id=164406

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbindex-rename-errors-expected.txt:
* web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::setName):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::setName):

LayoutTests:

* storage/indexeddb/modern/index-rename-1-expected.txt:
* storage/indexeddb/modern/index-rename-1-private-expected.txt:
* storage/indexeddb/modern/objectstore-rename-1-expected.txt:
* storage/indexeddb/modern/objectstore-rename-1-private-expected.txt:

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

2 years agoAX: [ATK] Attempting to clear selection on ARIA listboxes results in crash
jdiggs@igalia.com [Fri, 4 Nov 2016 16:48:12 +0000 (16:48 +0000)]
AX: [ATK] Attempting to clear selection on ARIA listboxes results in crash
https://bugs.webkit.org/show_bug.cgi?id=164331

Reviewed by Chris Fleizach.

Source/WebCore:

The ATK code is using is<AccessibilityListBox>() to identify native listboxes.
But is<AccessibilityListBox>() returns the value of isListBox() which returns
true both for AccessibilityListBox instances as well as for AccessibilityObject
instances which have an AccessibilityRole value of ListBoxRole. Because only
native listboxes should be AccessibilityListBoxes, add isNativeListBox() so
that we can distinguish native and ARIA listboxes.

Tests: accessibility/aria-listbox-clear-selection-crash.html
       accessibility/listbox-clear-selection.html

* accessibility/AccessibilityListBox.h:
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isNativeListBox):
(WebCore::AccessibilityObject::isListBox):

Tools:

Add AccessibilityUIElement::clearSelectedChildren() to DRT and WKTR.
Implement it for ATK.

* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::clearSelectedChildren):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::clearSelectedChildren):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::clearSelectedChildren):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::clearSelectedChildren):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::clearSelectedChildren):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::clearSelectedChildren):

LayoutTests:

Add tests to verify clearing selection works for native listboxes, and does not
crash for ARIA listboxes. These tests are being skipped for the Mac and Win ports
which do not yet implement AccessibilityUIElement::clearSelectedChildren().

* accessibility/aria-listbox-clear-selection-crash-expected.txt: Added.
* accessibility/aria-listbox-clear-selection-crash.html: Added.
* accessibility/listbox-clear-selection-expected.txt: Added.
* accessibility/listbox-clear-selection.html: Added.
* platform/mac/TestExpectations:
* platform/win/TestExpectations:

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

2 years agoIndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming.
beidson@apple.com [Fri, 4 Nov 2016 15:49:33 +0000 (15:49 +0000)]
IndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming.
https://bugs.webkit.org/show_bug.cgi?id=164405

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbindex-rename-errors-expected.txt:
* web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::setName):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::setName):

LayoutTests:

* storage/indexeddb/modern/index-rename-1-expected.txt:
* storage/indexeddb/modern/index-rename-1-private-expected.txt:
* storage/indexeddb/modern/objectstore-rename-1-expected.txt:
* storage/indexeddb/modern/objectstore-rename-1-private-expected.txt:

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

2 years ago[Readable Streams API] Implement ByteStreamController error()
commit-queue@webkit.org [Fri, 4 Nov 2016 10:39:09 +0000 (10:39 +0000)]
[Readable Streams API] Implement ByteStreamController error()
https://bugs.webkit.org/show_bug.cgi?id=164319

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2016-11-04
Reviewed by Youenn Fablet.

Source/WebCore:

Implemented error() method of ReadableByteStreamController.

Updated test expectations for error() and added IDL-related tests.

* Modules/streams/ReadableByteStreamController.js:
(error): Implemented.
* Modules/streams/ReadableByteStreamInternals.js:
(privateInitializeReadableByteStreamController):
(isReadableByteStreamController): Added.
(readableByteStreamControllerError): Added.
(readableByteStreamControllerClearPendingPullIntos): Added.
* Modules/streams/ReadableStream.js:
(initializeReadableStream): More detailed error message.
* Modules/streams/ReadableStreamDefaultController.js:
(error): Removed unnecessary variable declaration.
* bindings/js/WebCoreBuiltinNames.h: Added totalQueuedBytes.

LayoutTests:

Updated test expectation for error() test (previously FAIL, now PASS).
Added IDL-related tests for ReadableByteStreamController.

* streams/readable-byte-stream-controller-expected.txt:

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

2 years ago[Win] Page visibility tests are timing out.
pvollan@apple.com [Fri, 4 Nov 2016 09:35:36 +0000 (09:35 +0000)]
[Win] Page visibility tests are timing out.
https://bugs.webkit.org/show_bug.cgi?id=164363

Reviewed by Brent Fulgham.

Source/WebKit/win:

Add method to set page visibility.

* Interfaces/IWebViewPrivate.idl:
* WebView.cpp:
(WebView::QueryInterface):
(WebView::findString):
(WebView::setVisibilityState):
* WebView.h:

Tools:

Implement methods to set page visibility.

* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::resetPageVisibility):
(TestRunner::setPageVisibility):

LayoutTests:

Unskip page visibility tests.

* platform/win/TestExpectations:

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

2 years agoIndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transacti...
beidson@apple.com [Fri, 4 Nov 2016 06:37:09 +0000 (06:37 +0000)]
IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
https://bugs.webkit.org/show_bug.cgi?id=164403

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbindex-rename-abort-expected.txt: Updated to passing expectations.

Source/WebCore:

No new tests (Covered by existing test).

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
  already existed before this version change transaction.

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

2 years ago[WebRTC] Introduce asynchronous backend createOffer API
commit-queue@webkit.org [Fri, 4 Nov 2016 06:34:46 +0000 (06:34 +0000)]
[WebRTC] Introduce asynchronous backend createOffer API
https://bugs.webkit.org/show_bug.cgi?id=164365

Patch by Youenn Fablet <youenn@apple.com> on 2016-11-03
Reviewed by Sam Weinig.

Covered by existing tests.

Removing PeerEndpointBackendClient as it is only RTCPeerConnection.
This allows removing virtual for some functions.

Moving MediaEndpointPeerClient::m_client to PeerEndpointBackendClient::m_peerConnection and making it a reference.

Implementing createOffer at PeerConnectionBackend by splitting it in four sub-functions:
- main createOffer, implemented at PeerConnectionBackend.
- doCreateOffer implemented by subclasses (MediaEndpointPeerConnection).
- createOfferSucceeded/createOfferFailed implemented by PeerConnectionBackend.

* CMakeLists.txt:
* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::createMediaEndpointPeerConnection):
(WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
(WebCore::MediaEndpointPeerConnection::doCreateOffer):
(WebCore::MediaEndpointPeerConnection::createOfferTask):
(WebCore::MediaEndpointPeerConnection::createAnswerTask):
(WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
(WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
(WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
(WebCore::MediaEndpointPeerConnection::createReceiver):
(WebCore::MediaEndpointPeerConnection::replaceTrack):
(WebCore::MediaEndpointPeerConnection::replaceTrackTask):
(WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
(WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState):
(WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState):
(WebCore::MediaEndpointPeerConnection::gotIceCandidate):
(WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
(WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
(WebCore::MediaEndpointPeerConnection::createOffer): Deleted.
* Modules/mediastream/MediaEndpointPeerConnection.h:
* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::createOffer):
(WebCore::PeerConnectionBackend::createOfferSucceeded):
(WebCore::PeerConnectionBackend::createOfferFailed):
(WebCore::createPeerConnectionBackend): Deleted.
* Modules/mediastream/PeerConnectionBackend.h:
(WebCore::PeerConnectionBackend::PeerConnectionBackend):
(WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient): Deleted.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.h:
* WebCore.xcodeproj/project.pbxproj:

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

2 years agoREGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style...
antti@apple.com [Fri, 4 Nov 2016 06:21:06 +0000 (06:21 +0000)]
REGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style::Scope::flushPendingUpdate + 16
https://bugs.webkit.org/show_bug.cgi?id=164397
<rdar://problem/29100135>

Reviewed by Ryosuke Niwa.

The problem here was that we were leaving stale pointers to Document::m_inDocumentShadowRoots set when
using fast-path document teardown.

(Patch and stories mostly by rniwa).

* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::didInsertInDocumentShadowRoot):
(WebCore::Document::didRemoveInDocumentShadowRoot):

    Improve asserts.

* dom/Element.cpp:
(WebCore::Element::removeShadowRoot):

    Remove the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to
    avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that
    ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer()
    since the latter function tears down nodes via the deletion queue during a document destruction and use
    notifyChildNodeRemoved() on nodes that outlive the shadow root.

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::~ShadowRoot):

    Take care to clean up inDocumentShadowRoots for fast-pathed destruction too.

(WebCore::ShadowRoot::insertedInto):
(WebCore::ShadowRoot::removedFrom):

    Improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from
    m_inDocumentShadowRoots when the connected-ness changes.

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

2 years agoClonedArguments need to also support haveABadTime mode.
mark.lam@apple.com [Fri, 4 Nov 2016 06:18:01 +0000 (06:18 +0000)]
ClonedArguments need to also support haveABadTime mode.
https://bugs.webkit.org/show_bug.cgi?id=164200
<rdar://problem/27211336>

Reviewed by Geoffrey Garen.

JSTests:

* stress/have-a-bad-time-with-arguments.js: Added.

Source/JavaScriptCore:

For those who are not familiar with the parlance, "have a bad time" in the VM
means that Object.prototype has been modified in such a way that we can no longer
trivially do indexed property accesses without consulting the Object.prototype.
This defeats JIT indexed put optimizations, and hence, makes the VM "have a
bad time".

Once the VM enters haveABadTime mode, all existing objects are converted to use
slow put storage.  Thereafter, JSArrays are always created with slow put storage.
JSObjects are always created with a blank indexing type.  When a new indexed
property is put into the new object, its indexing type will be converted to the
slow put array indexing type just before we perform the put operation.  This is
how we ensure that the objects will also use slow put storage.

However, ClonedArguments is an object which was previously created unconditionally
to use contiguous storage.  Subsequently, if we try to call Object.preventExtensions()
on that ClonedArguments object, Object.preventExtensions() will:
1. make the ClonedArguments enter dictionary indexing mode, which means it will
2. first ensure that the ClonedArguments is using slow put array storage via
   JSObject::ensureArrayStorageSlow().

However, JSObject::ensureArrayStorageSlow() expects that we never see an object
with contiguous storage once we're in haveABadTime mode.  Our ClonedArguments
object did not obey this invariant.

The fix is to make the ClonedArguments factories create objects that use slow put
array storage when in haveABadTime mode.  This means:

1. JSGlobalObject::haveABadTime() now changes m_clonedArgumentsStructure to use
   its slow put version.

   Also the caching of the slow put version of m_regExpMatchesArrayStructure,
   because we only need to create it when we are having a bad time.

2. The ClonedArguments factories now allocates a butterfly with slow put array
   storage if we're in haveABadTime mode.

   Also added some assertions in ClonedArguments' factory methods to ensure that
   the created object has the slow put indexing type when it needsSlowPutIndexing().

3. DFGFixupPhase now watches the havingABadTimeWatchpoint because ClonedArguments'
   structure will change when having a bad time.

4. DFGArgumentEliminationPhase and DFGVarargsForwardingPhase need not be changed
   because it is still valid to eliminate the creation of the arguments object
   even having a bad time, as long as the arguments object does not escape.

5. The DFGAbstractInterpreterInlines now checks for haveABadTime, and sets the
   predicted type to be SpecObject.

Note: this issue does not apply to DirectArguments and ScopedArguments because
they use a blank indexing type (just like JSObject).

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGArrayMode.cpp:
(JSC::DFG::ArrayMode::dump):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::createEmpty):
(JSC::ClonedArguments::createWithInlineFrame):
(JSC::ClonedArguments::createWithMachineFrame):
(JSC::ClonedArguments::createByCopyingFrom):
(JSC::ClonedArguments::createStructure):
(JSC::ClonedArguments::createSlowPutStructure):
* runtime/ClonedArguments.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::haveABadTime):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:

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

2 years agoDFG plays fast and loose with the shadow values of a Phi
fpizlo@apple.com [Fri, 4 Nov 2016 05:28:35 +0000 (05:28 +0000)]
DFG plays fast and loose with the shadow values of a Phi
https://bugs.webkit.org/show_bug.cgi?id=164309

Reviewed by Saam Barati.

JSTests:

This test demonstrates why the DFG needs to recognize the shadow value of a Phi.

* stress/dfg-ssa-swap.js: Added.
(foo):

Source/JavaScriptCore:

Oh boy, what an embarrassing mistake! The style of SSA I like to use avoids block/value
tuples as parameters of a Phi, thereby simplifying CFG transformations and making Phi largely
not a special case for most compiler transforms. It does this by introducing another value
called Upsilon, which stores a value into some Phi.

B3 uses this also. The easiest way to understand what Upsilon/Phi behave like is to look at
the B3->Air lowering. Air is not SSA - it has Tmps that you can assign to and use as many
times as you like. B3 allocates one Tmp per Value, and an extra "phiTmp" for Phis, so that
Phis get two Tmps total. Upsilon stores the value into the phiTmp of the Phi, while Phi moves
the value from its phiTmp to its tmp.

This is necessary to support scenarios like this:

    a: Phi()
    b: Upsilon(@x, ^a)
    c: Use(@a)

Here, we want @c to see @a's value before @b. That's a very basic requirement of SSA: that
the a value (like @a) doesn't change during its lifetime.

Unfortunately, DFG's liveness analysis, abstract interpreter, and integer range optimization
all failed to correctly model Upsilon/Phi this way. They would assume that it's accurate to
model the Upsilon as storing into the Phi directly.

Because DFG does flow analysis over SSA, making it correct means enabling it to speak of the
shadow value. This change addresses this problem by introducing the concept of a
NodeFlowProjection. This is a key that lets us speak of both a Node's primary value and its
optional "shadow" value. Liveness, AI, and integer range are now keyed by NodeFlowProjection
rather than Node*. Conceptually this turns out to be a very simple change, but it does touch
a good amount of code.

This looks to be perf-neutral.

Rolled back in after fixing the debug build.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/air/AirLiveness.h:
(JSC::B3::Air::TmpLivenessAdapter::numIndices):
(JSC::B3::Air::StackSlotLivenessAdapter::numIndices):
(JSC::B3::Air::RegLivenessAdapter::numIndices):
(JSC::B3::Air::AbstractLiveness::AbstractLiveness):
(JSC::B3::Air::TmpLivenessAdapter::maxIndex): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::maxIndex): Deleted.
(JSC::B3::Air::RegLivenessAdapter::maxIndex): Deleted.
* dfg/DFGAbstractInterpreter.h:
(JSC::DFG::AbstractInterpreter::forNode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::forAllValues):
(JSC::DFG::AbstractInterpreter<AbstractStateType>::dump):
* dfg/DFGAtTailAbstractState.cpp:
(JSC::DFG::AtTailAbstractState::createValueForNode):
(JSC::DFG::AtTailAbstractState::forNode):
* dfg/DFGAtTailAbstractState.h:
* dfg/DFGBasicBlock.h:
* dfg/DFGCombinedLiveness.cpp:
(JSC::DFG::liveNodesAtHead):
* dfg/DFGCombinedLiveness.h:
* dfg/DFGFlowIndexing.cpp: Added.
(JSC::DFG::FlowIndexing::FlowIndexing):
(JSC::DFG::FlowIndexing::~FlowIndexing):
(JSC::DFG::FlowIndexing::recompute):
* dfg/DFGFlowIndexing.h: Added.
(JSC::DFG::FlowIndexing::graph):
(JSC::DFG::FlowIndexing::numIndices):
(JSC::DFG::FlowIndexing::index):
(JSC::DFG::FlowIndexing::shadowIndex):
(JSC::DFG::FlowIndexing::nodeProjection):
* dfg/DFGFlowMap.h: Added.
(JSC::DFG::FlowMap::FlowMap):
(JSC::DFG::FlowMap::resize):
(JSC::DFG::FlowMap::graph):
(JSC::DFG::FlowMap::at):
(JSC::DFG::FlowMap::atShadow):
(WTF::printInternal):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::Graph):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::abstractValuesCache): Deleted.
* dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::InPlaceAbstractState::InPlaceAbstractState):
(JSC::DFG::InPlaceAbstractState::beginBasicBlock):
(JSC::DFG::setLiveValues):
(JSC::DFG::InPlaceAbstractState::endBasicBlock):
(JSC::DFG::InPlaceAbstractState::merge):
* dfg/DFGInPlaceAbstractState.h:
(JSC::DFG::InPlaceAbstractState::createValueForNode):
(JSC::DFG::InPlaceAbstractState::forNode):
* dfg/DFGIntegerRangeOptimizationPhase.cpp:
* dfg/DFGLivenessAnalysisPhase.cpp:
(JSC::DFG::LivenessAnalysisPhase::LivenessAnalysisPhase):
(JSC::DFG::LivenessAnalysisPhase::run):
(JSC::DFG::LivenessAnalysisPhase::processBlock):
(JSC::DFG::LivenessAnalysisPhase::addChildUse): Deleted.
* dfg/DFGNode.h:
(JSC::DFG::NodeComparator::operator()):
(JSC::DFG::nodeListDump):
(JSC::DFG::nodeMapDump):
(JSC::DFG::nodeValuePairListDump):
(JSC::DFG::nodeComparator): Deleted.
* dfg/DFGNodeAbstractValuePair.cpp: Added.
(JSC::DFG::NodeAbstractValuePair::dump):
* dfg/DFGNodeAbstractValuePair.h: Added.
(JSC::DFG::NodeAbstractValuePair::NodeAbstractValuePair):
* dfg/DFGNodeFlowProjection.cpp: Added.
(JSC::DFG::NodeFlowProjection::dump):
* dfg/DFGNodeFlowProjection.h: Added.
(JSC::DFG::NodeFlowProjection::NodeFlowProjection):
(JSC::DFG::NodeFlowProjection::operator bool):
(JSC::DFG::NodeFlowProjection::kind):
(JSC::DFG::NodeFlowProjection::node):
(JSC::DFG::NodeFlowProjection::operator*):
(JSC::DFG::NodeFlowProjection::operator->):
(JSC::DFG::NodeFlowProjection::hash):
(JSC::DFG::NodeFlowProjection::operator==):
(JSC::DFG::NodeFlowProjection::operator!=):
(JSC::DFG::NodeFlowProjection::operator<):
(JSC::DFG::NodeFlowProjection::operator>):
(JSC::DFG::NodeFlowProjection::operator<=):
(JSC::DFG::NodeFlowProjection::operator>=):
(JSC::DFG::NodeFlowProjection::isHashTableDeletedValue):
(JSC::DFG::NodeFlowProjection::isStillValid):
(JSC::DFG::NodeFlowProjection::forEach):
(JSC::DFG::NodeFlowProjectionHash::hash):
(JSC::DFG::NodeFlowProjectionHash::equal):
* dfg/DFGStoreBarrierInsertionPhase.cpp:

Source/WTF:

Made this API use size rather than maxIndex as its initialization parameter, because that's
less confusing.

* wtf/IndexSparseSet.h:
(WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet):

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