[Win][LLINT] Many JSC stress test failures.
https://bugs.webkit.org/show_bug.cgi?id=129155

Patch by peavo@outlook.com <peavo@outlook.com> on 2014-02-21
Reviewed by Michael Saboff.

Intel syntax has reversed operand order compared to AT&T syntax, so we need to swap the operand order, in this case on floating point operations.
Also avoid using the reverse opcode (e.g. fdivr), as this puts the result at the wrong position in the floating point stack.
E.g. "divd ft0, ft1" would translate to fdivr st, st(1) (Intel syntax) on Windows, but this puts the result in st, when it should be in st(1).

* offlineasm/x86.rb: Swap operand order on Windows.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
'mouseenter' mouse compat event not fired when listeners for touch events
https://bugs.webkit.org/show_bug.cgi?id=128534

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-21
Reviewed by Andreas Kling.

Source/WebCore: 

The code dispatching mouseenter and mouseleave events was making the assumption that
only mouse move would cause Document::updateHoverActiveState.

This is not true in some cases. In the case of this bug, the first touch handler sets
the hover state. From there, the code handling enter/leave is in an inconsistent state.

This patch changes the delivery of mouse enter/leave events to be done through the regular
processing of mouse events. The update is done with the mouseover and mouseout events.

* dom/Document.cpp:
(WebCore::Document::prepareMouseEvent):
(WebCore::Document::updateHoverActiveState):
* dom/Document.h:
* page/EventHandler.cpp:
(WebCore::nearestCommonHoverAncestor):
(WebCore::hierarchyHasCapturingEventListeners):
(WebCore::EventHandler::updateMouseEventTargetNode):

LayoutTests: 

The existing tests for mouseenter/mouseleave had very poor readability which made them
useless for debugging.
This updates them to log what cause the events, and log all the events everywhere on the page.

* fast/events/mouseenter-mouseleave-capture-expected.txt:
* fast/events/mouseenter-mouseleave-capture.html:
* fast/events/mouseenter-mouseleave-expected.txt:
* fast/events/mouseenter-mouseleave.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added a GetMyArgumentsLengthSafe and added a speculation check.
https://bugs.webkit.org/show_bug.cgi?id=129051

Patch by Matthew Mirman <mmirman@apple.com> on 2014-02-21
Reviewed by Filip Pizlo.

* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileGetMyArgumentsLength):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support WebSelections in WK2 on iOS.
https://bugs.webkit.org/show_bug.cgi?id=127015
<rdar://problem/15211964>

Reviewed by Benjamin Poulain.

../WebCore: 

Adding some exports.

* WebCore.exp.in:

../WebKit2: 

This is the remaining work on block selections for iOS in WK2.
Once a block selection has been created with a long press gesture
on a selectable area, we can interact with it by touching the four
handles at the top, right, bottom and left side of the selection box.
Expanding or shrinking a block selection requires finding the next/previous
block in the direction of the movement, depending on the handle we
are interacting with.
Every time a new block is selected, we compute the thresholds required
to trigger another block change. The thresholds are sent back to the
UIProcess that will use this information to decide when to activate
the new selection, either bigger or smaller.
This patch also fixes a bug in selectWithTwoTouches where the points
were not mapped to the active frame.

* Shared/ios/WKGestureTypes.h:
* UIProcess/API/ios/PageClientImplIOS.h:
* UIProcess/API/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didUpdateBlockSelectionWithTouches):
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView _didUpdateBlockSelectionWithTouches:withFlags:growThreshold:shrinkThreshold:]):
* UIProcess/API/ios/WKContentViewInternal.h:
* UIProcess/API/ios/WKInteractionView.h:
* UIProcess/API/ios/WKInteractionView.mm:
(-[WKInteractionView hasSelectablePositionAtPoint:]):
(-[WKInteractionView clearSelection]):
(toWKHandlePosition):
(-[WKInteractionView _didUpdateBlockSelectionWithTouches:WebKit::withFlags:WebKit::growThreshold:shrinkThreshold:]):
(-[WKInteractionView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::updateBlockSelectionWithTouches):
(WebKit::WebPageProxy::didUpdateBlockSelectionWithTouches):
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::rangeForWebSelectionAtPosition):
(WebKit::WebPage::rangeForBlockAtPoint):
(WebKit::WebPage::selectWithGesture):
(WebKit::distanceBetweenRectsForPosition):
(WebKit::rectsEssentiallyTheSame):
(WebKit::containsRange):
(WebKit::unionDOMRanges):
(WebKit::computeEdgeCenter):
(WebKit::WebPage::expandedRangeFromHandle):
(WebKit::WebPage::contractedRangeFromHandle):
(WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle):
(WebKit::shouldExpand):
(WebKit::WebPage::changeBlockSelection):
(WebKit::WebPage::updateBlockSelectionWithTouches):
(WebKit::WebPage::clearSelection):
(WebKit::WebPage::selectWithTwoTouches):
(WebKit::WebPage::getPositionInformation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix TimeRanges layering violations
https://bugs.webkit.org/show_bug.cgi?id=128717

Reviewed by NOBODY (OOPS!).

Source/WebCore: 

No new tests, no functionality changed.

* CMakeLists.txt:
* GNUmakefile.list.am: Add PlatformTimeRanges.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::buffered): TimeRanges -> PlatformTimeRanges.
* Modules/mediasource/MediaSource.h:

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): TimeRanges* -> TimeRanges&.

* WebCore.exp.in: Update for signature changes.

* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj: Add PlatformTimeRanges.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::percentLoaded): Create TimeRanges from PlatformTimeRanges.
(WebCore::HTMLMediaElement::buffered): Ditto.
(WebCore::HTMLMediaElement::seekable): Ditto.

* html/MediaController.cpp:
(MediaController::buffered): TimeRanges* -> TimeRanges&.
(MediaController::seekable): Ditto.
(MediaController::played): Ditto.

Move all of the logic into PlatformTimeRanges. Change API to take TimeRanges& instead of TimeRanges*.
* html/TimeRanges.cpp:
(WebCore::TimeRanges::create): Move to .cpp from .h.
(WebCore::TimeRanges::TimeRanges): Initialize the PlatformTimeRanges member variable.
(WebCore::TimeRanges::start): Passthrough to PlatformTimeRanges.
(WebCore::TimeRanges::end): Ditto.
(WebCore::TimeRanges::invert): Ditto.
(WebCore::TimeRanges::copy): Ditto.
(WebCore::TimeRanges::intersectWith): Ditto.
(WebCore::TimeRanges::unionWith): Ditto.
(WebCore::TimeRanges::length): Ditto.
(WebCore::TimeRanges::add): Ditto.
(WebCore::TimeRanges::contain): Ditto.
(WebCore::TimeRanges::find): Ditto.
(WebCore::TimeRanges::nearest): Ditto.
(WebCore::TimeRanges::totalDuration): Ditto.
* html/TimeRanges.h:

* platform/graphics/MediaPlayer.cpp:
(WebCore::NullMediaPlayerPrivate::buffered): TimeRanges -> PlatformTimeRanges.
(WebCore::MediaPlayer::buffered): Ditto.
(WebCore::MediaPlayer::seekable): Ditto.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:

* platform/graphics/MediaSourcePrivateClient.h:

* platform/graphics/PlatformTimeRanges.cpp: Added.
* platform/graphics/PlatformTimeRanges.h: Added.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::buffered): TimeRanges -> PlatformTimeRanges.
(WebCore::MediaPlayerPrivateAVFoundation::loadedTimeRangesChanged): Drive-by fix to log
    FunctionType notifications. ASSERT when passed an unknown notification.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges):  TimeRanges -> PlatformTimeRanges.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentTime): Ditto.
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges): Ditto.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekable): Ditto.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::buffered): Ditto.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::buffered): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

* platform/graphics/ios/MediaPlayerPrivateIOS.h:
* platform/graphics/ios/MediaPlayerPrivateIOS.mm:
(WebCore::MediaPlayerPrivateIOS::buffered): Ditto.

* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::buffered): Ditto.

* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::buffered): Ditto.
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:

* platform/graphics/wince/MediaPlayerPrivateWinCE.h:

* platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
(WebCore::MockMediaPlayerMediaSource::buffered): Ditto.
(WebCore::MockMediaPlayerMediaSource::advanceCurrentTime): Ditto.
* platform/mock/mediasource/MockMediaPlayerMediaSource.h:

Source/WebKit: 

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: TimeRanges::create(void) for Internals.

Tools: 

* TestWebKitAPI/Tests/WebCore/TimeRanges.cpp: TimeRanges* -> TimeRanges&.
(TestWebKitAPI::TEST):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
run-webkit-httpd fails to find httpd configuation file.

Reviewed by Ryosuke Niwa.

* Scripts/webkitperl/httpd.pm:
(getHTTPDConfigPathForTestDirectory):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
gatherFromOtherThread() needs to align the sp before gathering roots.
<https://webkit.org/b/129169>

Reviewed by Geoffrey Garen.

The GC scans the stacks of other threads using MachineThreads::gatherFromOtherThread().
gatherFromOtherThread() defines the range of the other thread's stack as
being bounded by the other thread's stack pointer and stack base. While
the stack base will always be aligned to sizeof(void*), the stack pointer
may not be. This is because the other thread may have just pushed a 32-bit
value on its stack before we suspended it for scanning.

The fix is to round the stack pointer up to the next aligned address of
sizeof(void*) and start scanning from there. On 64-bit systems, we will
effectively ignore the 32-bit word at the bottom of the stack (top of the
stack for stacks growing up) because it cannot be a 64-bit pointer anyway.
64-bit pointers should always be stored on 64-bit aligned boundaries (our
conservative scan algorithm already depends on this assumption).

On 32-bit systems, the rounding is effectively a no-op.

* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::genericAddSpan):
- Hardened somne assertions so that we can catch misalignment issues on
  release builds as well.
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::gatherFromOtherThread):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Disallow the use of -webkit-user-modify on shadow pseudo elements
https://bugs.webkit.org/show_bug.cgi?id=129144

Reviewed by Geoffrey Garen.

Completely disallow -webkit-user-modify on user agent (builtin) pseudo elements.

We've already had rules to do this in html.css but just hard code it into the engine
in order to eliminate the all uses of -webkit-user-modify in html.css.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* css/html.css:
(input::-webkit-textfield-decoration-container):
(input::-webkit-clear-button):
(input[type="search"]::-webkit-search-cancel-button):
(input[type="search"]::-webkit-search-decoration):
(input[type="search"]::-webkit-search-results-decoration):
(input[type="search"]::-webkit-search-results-button):
(input::-webkit-inner-spin-button):
(input::-webkit-input-speech-button):
(input::-webkit-input-placeholder, isindex::-webkit-input-placeholder):
(input[type="file"]::-webkit-file-upload-button):
(input[type="range"]::-webkit-slider-container, input[type="range"]::-webkit-media-slider-container):
(input[type="range"]::-webkit-slider-runnable-track):
(input[type="range"]::-webkit-slider-thumb, input[type="range"]::-webkit-media-slider-thumb):
(input[type="color"]::-webkit-color-swatch-wrapper):
(input[type="color"]::-webkit-color-swatch):
(::-webkit-validation-bubble):
(::-webkit-validation-bubble-message):
(::-webkit-validation-bubble-text-block):
(::-webkit-validation-bubble-heading):
(::-webkit-validation-bubble-arrow):
(::-webkit-validation-bubble-arrow-clipper):
(meter::-webkit-meter-inner-element):
(meter::-webkit-meter-bar):
(meter::-webkit-meter-optimum-value):
(meter::-webkit-meter-suboptimum-value):
(meter::-webkit-meter-even-less-good-value):
(progress::-webkit-progress-inner-element):
(progress::-webkit-progress-bar):
(progress::-webkit-progress-value):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for iOS after r164498.

Unreviewed.

* platform/graphics/ios/MediaPlayerPrivateIOS.mm:
(WebCore::MediaPlayerPrivateIOS::buffered):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add extra space to op_call and related opcodes
https://bugs.webkit.org/show_bug.cgi?id=129170

Reviewed by Mark Lam.

No change in behaviour, just some refactoring to add an extra
slot to the op_call instructions, and refactoring to make similar
changes easier in future.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::printCallOp):
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargs):
(JSC::BytecodeGenerator::emitConstruct):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsic):
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileOpCall):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
COL element in table has 0 for offsetWidth
https://bugs.webkit.org/show_bug.cgi?id=15277

Reviewed by David Hyatt.

Source/WebCore:

Implements offset{Left, Top, Width, Height} for table columns and column groups
per section Extensions to the HTMLElement Interface of the CSSOM View spec,
<http://www.w3.org/TR/cssom-view/#extensions-to-the-htmlelement-interface> (Draft 17 December 2013).

For now, we fail almost all of the offset{Height, Top} sub-tests in the included test
for the separate border model as we need to fix <https://bugs.webkit.org/show_bug.cgi?id=128988>.

Test: fast/table/col-and-colgroup-offsets.html

* rendering/RenderTable.cpp:
(WebCore::RenderTable::RenderTable): Initialize cached column offset top and offset height.
We cache these offsets since they are the same for all columns in the table.
(WebCore::RenderTable::invalidateCachedColumns): Clear cached effective column index map.
(WebCore::RenderTable::invalidateCachedColumnOffsets): Added.
(WebCore::RenderTable::layout): Invalidate cached column offsets as the location or height
of one or more sections may have changed.
(WebCore::RenderTable::updateColumnCache): Modified to build effective column index map.
(WebCore::RenderTable::effectiveIndexOfColumn): Added.
(WebCore::RenderTable::offsetTopForColumn): Added.
(WebCore::RenderTable::offsetLeftForColumn): Added.
(WebCore::RenderTable::offsetWidthForColumn): Added.
(WebCore::RenderTable::offsetHeightForColumn): Added.
* rendering/RenderTable.h: Make isTableColumnGroupWithColumnChildren() const.
* rendering/RenderTableCol.cpp:
(WebCore::RenderTableCol::offsetLeft): Added; turns around and calls RenderTable::offsetLeftForColumn().
(WebCore::RenderTableCol::offsetTop): Added; turns around and calls RenderTable::offsetTopForColumn().
(WebCore::RenderTableCol::offsetWidth): Added; turns around and calls RenderTable::offsetWidthForColumn().
(WebCore::RenderTableCol::offsetHeight): Added; turns around and calls RenderTable::offsetHeightForColumn().
* rendering/RenderTableCol.h:

LayoutTests:

Added test to ensure that offset{Left, Top, Width, Height} return correct results
for table columns and column groups.

For now, we fail almost all of the offset{Height, Top} sub-tests for the separate
border model as we need to fix <https://bugs.webkit.org/show_bug.cgi?id=128988>.

* fast/table/col-and-colgroup-offsets-expected.txt: Added.
* fast/table/col-and-colgroup-offsets.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
jsDocumentPrototypeFunctionGetElementById should not create an AtomicString for the function argument
https://bugs.webkit.org/show_bug.cgi?id=128893

Reviewed by Darin Adler.

Source/WebCore: 

The declaration of TreeScope::getElementById() was taking an AtomicString as the parameter.
Because of this, all the call sites manipulating String were creating and keeping alive an AtomicString
to make the call.

This had two negative consequences:
-The call sites were ref-ing the ID's atomic string for no reason.
-When there is no ID associated with the input string, an atomic string was created for the sole
 purpose of failing the query. Since IDs are stored as AtomicString, if there is not an existing
 AtomicString for the input, there is no reason to query anything.

* WebCore.exp.in:
* bindings/js/JSDOMBinding.cpp:
(WebCore::findAtomicString): Update this after the rename.

* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateImplementation):
* bindings/scripts/IDLAttributes.txt:
Now that there are two overloads for TreeScope::getElementById(), the conversion from NSString*
is ambiguous. I add the keyword ObjCExplicitAtomicString to force an explicit conversion to AtomicString.

* dom/Document.idl:
* dom/TreeScope.cpp:
(WebCore::TreeScope::getElementById):
When getting an AtomicString, the case of a empty string is not important, use isNull() instead.
When getting a String, get the corresponding AtomicString if any and use that for getting the element.

* dom/TreeScope.h:
* html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
Solve the ambiguous call.

* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
This is a wonderful candidate for substringSharingImpl. The substring does not survive the call since
the new getElementById never create any AtomicString.

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::getElementById):
It looks like there are opportunities to get faster here, Ryosuke should have a look.

* svg/SVGSVGElement.h:
* xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView):
Unrelated cleanup: noStyleMessage was useless.

Source/WebKit2: 

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::pageNumberForElementById): Remove the explicit conversion to use the right overload.

Source/WTF: 

AtomicString::find() is a special case optimized for the JavaScript bindings. The method can only
be called under specific conditions.
The method is renamed to findStringWithHash().

The new AtomicString::find is generic and does not require any propery on the input.

* wtf/text/AtomicString.cpp:
(WTF::AtomicString::findStringWithHash):
(WTF::AtomicString::findSlowCase):
* wtf/text/AtomicString.h:
(WTF::AtomicString::find):


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