Make code generation of the unoptimized pseudo classes separate
https://bugs.webkit.org/show_bug.cgi?id=128704

Reviewed by Andreas Kling.

Mapping the unoptimized selectors when generating the code was useful for debugging
but those cases are so common that looping over unoptimizedPseudoCheckers was more
costly than anticipated.

This patch moves the unoptimized pseudo selector in their own array to simplify code generation.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::SelectorCodeGenerator):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't optimize variadic closure calls
https://bugs.webkit.org/show_bug.cgi?id=128835

Source/JavaScriptCore: 

Reviewed by Gavin Barraclough.
        
Read the check that had been in JITStubs.cpp, back in the day. This code came
from the DFG and the DFG didn't need these checks.

* jit/JITOperations.cpp:

LayoutTests: 

Reviewed by Gavin Barraclough.
        
Add a test that covers both the performance and correctness of this case.

* js/regress/script-tests/variadic-closure-call.js: Added.
(foo.bar):
(foo):
* js/regress/variadic-closure-call-expected.txt: Added.
* js/regress/variadic-closure-call.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/15994340> WK2: Cannot scroll to the bottom of the page when the keyboard is on the screen
https://bugs.webkit.org/show_bug.cgi?id=128710

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-14
Reviewed by Enrica Casucci.

WKView/WKWebView needs to adapt the UIScrollView insets to leave some space for the keyboard.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView dealloc]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
(-[WKWebView _keyboardWillChangeFrame:]):
(-[WKWebView _keyboardDidChangeFrame:]):
(-[WKWebView _keyboardWillShow:]):
(-[WKWebView _keyboardWillHide:]):
* UIProcess/API/ios/WKContentView.h:
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView isAssistingNode]):
* UIProcess/API/ios/WKInteractionView.h:
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView dealloc]):
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):
(-[WKView _keyboardChangedWithInfo:adjustScrollView:]):
(-[WKView _keyboardWillChangeFrame:]):
(-[WKView _keyboardDidChangeFrame:]):
(-[WKView _keyboardWillShow:]):
(-[WKView _keyboardWillHide:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][iOS] Add WKContentObservation support when dispatching synthetic mouse events
https://bugs.webkit.org/show_bug.cgi?id=128715

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-14
Reviewed by Darin Adler.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleTap):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Do not attempt to synchronize attributes when no Simple Selector could match an animatable attribute
https://bugs.webkit.org/show_bug.cgi?id=128728

Reviewed by Andreas Kling.

In most cases, we don't even need to test for the flag animatedSVGAttributesNotDirty.
If the selector filter could never match an animatable attribute, there is no point in testing for one.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::canMatchStyleAttribute):
Skip the second test when the local name is equal to canonicalLocalName. That is the common case.

(WebCore::SelectorCompiler::canMatchAnimatableSVGAttribute):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributesMatching):

* svg/SVGElement.cpp:
(WebCore::addQualifiedName):
(WebCore::SVGElement::animatableAttributeForName):
(WebCore::SVGElement::isAnimatableAttribute):
(WebCore::SVGElement::filterOutAnimatableAttribute):
* svg/SVGElement.h:
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::filterOutAnimatableAttribute):
* svg/SVGScriptElement.h:
Move the list of animatable attribute to a static function available in Release.
Selector matching is a lot more flexible than normal name matching. Since the local name must
always match, it is used as a key to get the full QualifiedName to compare to the selector.

Separating the list of animatable attributes between Selectors and SVGElement::isAnimatableAttribute
would be error prone. Instead, SVGElement::isAnimatableAttribute() is modified to use
SVGElement::animatableAttributeForName so that the two never get out of sync.

Since SVGScriptElement has one additional restriction to isAnimatableAttribute(), the function
filterOutAnimatableAttribute() is added to remove a qualified name from the complete list of animatable attributes.
This ensure SVGElement::animatableAttributeForName() always has the complete list, and subclasses of SVGElement
can only remove QualifiedNames, not add them.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164123 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improve the performance on mobile of FTPDirectoryDocument
https://bugs.webkit.org/show_bug.cgi?id=128778

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-14
Reviewed by Antti Koivisto.

Source/WebCore: 

Little cleanup.

* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::createTDForFilename):
(WebCore::processFilesizeString):
(WebCore::wasLastDayOfMonth):
(WebCore::processFileDateString):
(WebCore::FTPDirectoryDocumentParser::parseAndAppendOneLine):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
(WebCore::FTPDirectoryDocumentParser::createBasicDocument):

Source/WTF: 

* wtf/text/WTFString.h:
(WTF::String::endsWith): add a missing overload.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up JSDOMStringMap::deleteProperty
https://bugs.webkit.org/show_bug.cgi?id=128801

Reviewed by Geoffrey Garen.

Follow up on my cleaning of JSDOMStringMapCustom, this time for deletion.

Previously, we would query for the name, then call deleteItem() if the name was
found. Instead, everything is moved to deleteItem which then return if the deletion
is successful or not.

By using convertPropertyNameToAttributeName, we can use Element::hasAttribute() directly
to find if the attribute exists or not. If it exists, we remove it.

Theoretically we could have a single pass over the attributes to find->delete but this
code is not hot enough to justify anything fancy at this point.

Finally, we no longer check for isValidPropertyName() on deletion. JSDOMStringMapCustom
was the last client of DatasetDOMStringMap::deleteItem() and it could not call deleteItem()
with invalid name since the name would have failed DatasetDOMStringMap::contains().
The spec does not specify any name checking either for deletion so we are safe just ignoring
invalid input.

* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::deleteProperty):
* dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::deleteItem):
* dom/DatasetDOMStringMap.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164125 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS][WK2] Always enable AVKit in WK2
https://bugs.webkit.org/show_bug.cgi?id=128686

Reviewed by Simon Fraser.

Enable AVKit in iOS WK2 by default. This enables <video> element full screen in WK2.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MediaControls] Add support for a loading progress meter
https://bugs.webkit.org/show_bug.cgi?id=128651

Reviewed by Eric Carlson.

Draw the loaded ranges underneath the timeline slider. Use a -webkit-canvas()
CSS function to allow the track of the slider to reflect the current state of
the video's loadedTimeRanges property.

Since -webkit-canvas() will share a backing store with all other CSS images using
the same identifier, use a monotonically increasing identifier to uniquely identify the timeline on a per-document basis.

* Modules/mediacontrols/mediaControlsApple.css:
(audio::-webkit-media-controls-timeline):
* Modules/mediacontrols/mediaControlsApple.js:
(Controller): Call updateProgress().
(Controller.prototype.createControls): Set up the canvas style and identifier.
(Controller.prototype.handleLoadStart): Call updateProgress().
(Controller.prototype.handleStalled): Ditto.
(Controller.prototype.handleReadyStateChange): Ditto.
(Controller.prototype.handleDurationChange): Ditto.
(Controller.prototype.handleProgress): Ditto.
(Controller.prototype.progressFillStyle): Added an easily overridable method
    to determine the fill color of the progress bar.
(Controller.prototype.updateProgress): Draw the loadedTimeRanges into the timeline slider.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.progressFillStyle): Override.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Baseline JIT should have a fast path to bypass the write barrier on op_enter
https://bugs.webkit.org/show_bug.cgi?id=128832

Reviewed by Filip Pizlo.

* jit/JIT.h: Removed some random commented out functions.h
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_enter):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitWriteBarrier):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MediaControls][iOS] Start playback button is visible when playing embedded YouTube
https://bugs.webkit.org/show_bug.cgi?id=128754

Reviewed by Eric Carlson.

Update shouldHaveStartPlaybackButton to match the behavior of the plugin proxy.

Add a accessor to determine whether playback has been requested:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::userGestureRequired):
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

Update the logic of shouldHaveStartPlaybackButton.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.shouldHaveStartPlaybackButton):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MediaControls][iOS] Embedded YouTube does not show a 'paused' button state after starting
https://bugs.webkit.org/show_bug.cgi?id=128755

Reviewed by Eric Carlson.

Don't rely on "canPlay()", instead, take the information directly from the event itself. I.e., when
handling the 'play' event, switch mode to playing, and vice versa for the 'pause' event.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.handlePlay):
(Controller.prototype.handlePause):
(Controller.prototype.updatePlaying):
(Controller.prototype.setPlaying):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Purge remaining ENABLE(SHADOW_DOM) cruft.
<https://webkit.org/b/128827>

Source/WebCore:

Remove the remaining 8.8 million lines of Shadow DOM code to align
with goals for intent to ship 60fps on mobile in 2014.

Reviewed by Antti Koivisto.

Tools:

Reviewed by Antti Koivisto.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(resetDefaultsToConsistentValues):
* Scripts/webkitperl/FeatureList.pm:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add WKBackForwardListDidChangeNotification
https://bugs.webkit.org/show_bug.cgi?id=128839

Reviewed by Dan Bernstein.

Also, make LoaderClient::didChangeBackForwardList take a Vector of WebBackForwardListItems
instead of a pointer to a Vector of API::Objects.

* Shared/API/Cocoa/WKFoundation.h:
* UIProcess/API/APILoaderClient.h:
(API::LoaderClient::didChangeBackForwardList):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageLoaderClient):
* UIProcess/API/Cocoa/WKBackForwardList.h:
* UIProcess/API/Cocoa/WKBackForwardList.mm:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::LoaderClient::didChangeBackForwardList):
* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::addItem):
(WebKit::WebBackForwardList::goToItem):
(WebKit::WebBackForwardList::clear):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeBackForwardList):
* UIProcess/WebPageProxy.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
setSelection should not synchronously trigger layout
https://bugs.webkit.org/show_bug.cgi?id=128797

Reviewed by Antti Koivisto.

Only update the appearance and reveal selection when the style and the layout is already up to date.
Otherwise, do so in performPostLayoutTasks.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::FrameSelection):
(WebCore::FrameSelection::setSelection): Set m_pendingSelectionUpdate and synchronously update caret rect
if we don't need to update style or layout.
(WebCore::updateSelectionByUpdatingLayoutOrStyle): Added. Used by FrameSelection member functions to
trigger layout or style recalc whichever is needed.
(WebCore::FrameSelection::updateAndRevealSelection): Extracted from setSelection.
(WebCore::FrameSelection::absoluteCaretBounds): Call updateSelectionByUpdatingLayoutOrStyle since caret rect
is no longer updated synchronously in setSelection.
(WebCore::FrameSelection::recomputeCaretRect): Don't assert that visibleStart().absoluteCaretBounds() is
equal to m_absCaretBounds since selection may no longer be caret at this point.
(WebCore::FrameSelection::setCaretVisibility): Call updateSelectionByUpdatingLayoutOrStyle since we're
synchronously calling into updateAppearance here. In the future, we should make this asynchronous as well.
(WebCore::FrameSelection::selectionBounds): Call updateSelectionByUpdatingLayoutOrStyle since selection bounds
could be outdated. This code only triggering style recalc was presumably a bug.
* editing/FrameSelection.h:

* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks): Update selection's appearance and scroll to reveal selection
as needed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
jsc-cli should allow scripts to access argv
https://bugs.webkit.org/show_bug.cgi?id=127486

Reviewed by Oliver Hunt.

* jsc-cli/jsc-cli.xcodeproj/project.pbxproj:
* jsc-cli/jsc-cli/CLIInstance.h:
* jsc-cli/jsc-cli/CLIInstance.m:
(-[CLIInstance init]):
(-[CLIInstance loadFile:]):
(-[CLIInstance didReceiveArguments:atOffset:withLength:]):
* jsc-cli/jsc-cli/JSRunLoopThread.h:
* jsc-cli/jsc-cli/JSRunLoopThread.m:
(-[JSRunLoopThread initWithContext:]):
(-[JSRunLoopThread loadFile:]):
(-[JSRunLoopThread start]):
* jsc-cli/jsc-cli/main.m:
(printUsage):
(main):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Margin tiles are not created for the top and left sides when there is a < 1.0 
scale factor
https://bugs.webkit.org/show_bug.cgi?id=128842

Reviewed by Simon Fraser.

floor the result of the computation whenever we have a negative origin, to ensure 
that we are rounding 'up' to a larger number of tiles. 
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::getTileIndexRangeForRect):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ASSERT(isValidAllocation(bytes)) when ObjC API creates custom errors
https://bugs.webkit.org/show_bug.cgi?id=128840

Reviewed by Joseph Pecoraro.

We need to add APIEntryShims around places where we allocate errors in JSC.
Also converted some of the createTypeError call sites to use ASCIILiteral.

* API/JSValue.mm:
(valueToArray):
(valueToDictionary):
* API/ObjCCallbackFunction.mm:
(JSC::objCCallbackFunctionCallAsConstructor):
(JSC::ObjCCallbackFunctionImpl::call):
* API/tests/testapi.mm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Save ARGV in a local to avoid repeated lookups

Rubber stamped by Joseph Pecoraro.

* jsc-cli/jsc-cli/CLIInstance.m:
(-[CLIInstance didReceiveArguments:atOffset:withLength:]):


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