[BlackBerry] Add additional datalist support.
https://bugs.webkit.org/show_bug.cgi?id=114883

Reviewed by Rob Buis.

PR 210083.

Source/WebCore:

Extend support for datalist to include all non-popup input types.

Re-enabling fast/forms/datalist/input-list

Internally Reviewed by Otto Cheung.

* platform/blackberry/RenderThemeBlackBerry.cpp:
(WebCore::RenderThemeBlackBerry::supportsDataListUI):

Source/WebKit/blackberry:

Properly set state when opening a Date/Time popup and simplify
the logic for showing datalist options.

Internally Reviewed by Otto Cheung.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::openDatePopup):
(BlackBerry::WebKit::InputHandler::showTextInputTypeSuggestionBox):

LayoutTests:

Fix results for fast/forms/datalist/input-list.

Internally Reviewed by Otto Cheung.

* platform/blackberry/fast/forms/datalist/input-list-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] ASSERT in FrameLoaderClient::convertMainResourceLoadToDownload
https://bugs.webkit.org/show_bug.cgi?id=114741

Patch by Xan Lopez <xlopez@igalia.com> on 2013-04-22
Reviewed by George Staikos.

Consider the case where a ResourceHandle won't have a FilterStream
object associated (for example, Blob objects) instead of ASSERTing
pointlessly when asking our network layer for such an object.

This partially fixes fast/dom/HTMLAnchorElement/anchor-nodownload-set.html

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::convertMainResourceLoadToDownload):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148880 268f45cc-cd09-0410-ab3c-d52691b4dbfc
fix build warning(unused parameter)
https://bugs.webkit.org/show_bug.cgi?id=114855

Patch by Xuefei Ren <xren@blackberry.com> on 2013-04-22
Reviewed by Rob Buis.

Source/WebCore:

remove warning(unused parameter) in
Source/WebCore/platform/graphics/blackberry

* platform/graphics/blackberry/CanvasLayerWebKitThread.cpp:
(WebCore::CanvasLayerCompositingThreadClient::drawTextures):
(WebCore::CanvasLayerCompositingThreadClient::deleteTextures):
(WebCore::CanvasLayerCompositingThreadClient::commitPendingTextureUploads):
* platform/graphics/blackberry/FontBlackBerry.cpp:
(WebCore::Font::offsetForPositionForComplexText):
* platform/graphics/blackberry/FontCacheBlackBerry.cpp:
(WebCore::FontCache::getSimilarFontPlatformData):
(WebCore::FontCache::getTraitsInFamily):
* platform/graphics/blackberry/GlyphPageTreeNodeBlackBerry.cpp:
(WebCore::GlyphPage::fill):
* platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/blackberry/GraphicsContextBlackBerry.cpp:
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::clipConvexPolygon):
(WebCore::GraphicsContext::setURLForRect):
(WebCore::GraphicsContext::setPlatformStrokeColor):
(WebCore::GraphicsContext::setPlatformFillColor):
(WebCore::GraphicsContext::setPlatformCompositeOperation):
* platform/graphics/blackberry/ImageBlackBerry.cpp:
(WebCore::BitmapImage::draw):
(WebCore::Image::drawPattern):
* platform/graphics/blackberry/ImageBufferBlackBerry.cpp:
(WebCore::flushAndDraw):
(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::platformTransformColorSpace):
* platform/graphics/blackberry/LayerTiler.cpp:
(WebCore::LayerTiler::drawTile):
* platform/graphics/blackberry/PathBlackBerry.cpp:
(WebCore::GraphicsContext::drawFocusRing):
(WebCore::GraphicsContext::clipPath):
* platform/graphics/blackberry/PatternBlackBerry.cpp:
(WebCore::Pattern::platformPattern):

Source/WebKit/blackberry:

remove warning(unused parameter) in
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::extractedTextRequest):

Tools:

remove warning(unused parameter) in
Tools/DumpRenderTree/blackberry/EventSender.cpp

* DumpRenderTree/blackberry/EventSender.cpp:
(getDragModeCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update layout test verifying Tab behaves correctly after linking to fragment ID
https://bugs.webkit.org/show_bug.cgi?id=114645

Patch by Mario Sanchez Prada <mario.prada@samsung.com> on 2013-04-22
Reviewed by Chris Fleizach.

* fast/dom/fragment-activation-focuses-target.html: Updated test.
* fast/dom/fragment-activation-focuses-target-expected.txt: Updated expectations.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Fix build warning when GESTURE_EVENTS is ON.
https://bugs.webkit.org/show_bug.cgi?id=114812

Patch by Krzysztof Wolanski <k.wolanski@samsung.com> on 2013-04-22
Reviewed by Andreas Kling.

Handle GestureSingleTap in the event type switch.

* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::NetscapePlugin::platformHandleMouseEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WTF::AtomicString::find() should take unsigned 'start' argument
<http://webkit.org/b/114958>

Reviewed by Darin Adler.

Fixes the following warnings with -Wshorten-64-to-32:

    AtomicString.h:113:76: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
        size_t find(UChar c, size_t start = 0) const { return m_string.find(c, start); }
                                                              ~~~~~~~~         ^~~~~
    AtomicString.h:115:35: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
            { return m_string.find(s, start, caseSentitive); }
                     ~~~~~~~~         ^~~~~
    AtomicString.h:117:35: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
            { return m_string.find(s, start, caseSentitive); }
                     ~~~~~~~~         ^~~~~

* wtf/text/AtomicString.h:
(WTF::AtomicString::find): Change type of 'start' argument from
size_t to unsigned.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Update BatteryClientBlackBerry to use our port's new listener interface
https://bugs.webkit.org/show_bug.cgi?id=114892

Patch by Otto Derek Cheung <otcheung@rim.com> on 2013-04-22
Reviewed by Rob Buis.
PR 328147

Modify the client so we only have one listener for battery change events.
The dispatch of different event listeners are handled by BatteryController.

* WebCoreSupport/BatteryClientBlackBerry.cpp:
(WebCore::BatteryClientBlackBerry::BatteryClientBlackBerry):
(WebCore::BatteryClientBlackBerry::startUpdating):
(WebCore::BatteryClientBlackBerry::stopUpdating):
(WebCore::BatteryClientBlackBerry::onStatusChange):
* WebCoreSupport/BatteryClientBlackBerry.h:
(BatteryClientBlackBerry):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[SOUP] Soup disk cache should respect the diskCacheDirectory from the process initial parameters
https://bugs.webkit.org/show_bug.cgi?id=111845

Reviewed by Anders Carlsson.

Move the cache initialization to platformInitializeWebProcess() to
create the cache using the directory received from the UI
process. This allows to add public API to set a different disk
cache directory from the UI process.

* UIProcess/efl/WebContextEfl.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Return
default disk cache directory.
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::platformDefaultDiskCacheDirectory): Ditto.
* WebProcess/efl/WebProcessMainEfl.cpp:
(WebKit::WebProcessMainEfl): Remove soup cache initialization.
* WebProcess/gtk/WebProcessMainGtk.cpp:
(WebKit::WebProcessMainGtk): Ditto.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Initialize
soup cache.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add webkit_web_context_set_disk_cache_directory to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=111848

Reviewed by Anders Carlsson.

This allow applications to set a custom directory for the disk
cache.

* UIProcess/API/gtk/WebKitWebContext.cpp:
(webkit_web_context_set_disk_cache_directory):
* UIProcess/API/gtk/WebKitWebContext.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbol.
* UIProcess/API/gtk/tests/TestMain.cpp:
(removeNonEmptyDirectory):
(main): Use a different temporary disk cache directory for every
test.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Memory barrier support should also ensure that we always do a compiler fence
https://bugs.webkit.org/show_bug.cgi?id=114934

Reviewed by Michael Saboff.
        
This is a cherry-pick merge of the WTF part of r148836 from the dfgFourthTier
branch. It fixes a memory ordering bug that is likely asymptomatic, but
nonetheless real: TCSpinLock expects that using a memoryBarrierBeforeUnlock()
prior to setting lockword_ to 0 will ensure that the assignment to lockword_
won't get floated above any of the stores in the critical section. While that
memory barrier does indeed do the right thing on ARM, it doesn't do the right
thing on other architectures: it turns into empty code that the compiler blows
away, which is fine for the hardware since X86 won't reorder that store - but
it's not fine for the compiler, which may still do its own reorderings.
        
The WTF part of r148836 fixes this by using a compiler fence: an empty asm
volatile block that is marked as clobbering memory.
        
Instead of doing a separate surgical fix in trunk, I decided to merge the
whole WTF change over, to make merging easier in the future.
        
Performance testing of this change in dfgFourthTier showed no regression.

* wtf/Atomics.h:
(WTF::compilerFence):
(WTF::armV7_dmb):
(WTF::armV7_dmb_st):
(WTF::loadLoadFence):
(WTF::loadStoreFence):
(WTF::storeLoadFence):
(WTF::storeStoreFence):
(WTF::memoryBarrierAfterLock):
(WTF::memoryBarrierBeforeUnlock):
(WTF::x86_mfence):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148888 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix an incorrect rebaseline done in r148830.

Instead of updating the cross platform wk2 results, r148830 should have added efl wk2
specific results. Move the previous mac wk2 specific results into the mac wk2 platform
directory.

* platform/efl-wk2/loader/go-back-cached-main-resource-expected.txt: Renamed from LayoutTests/platform/wk2/loader/go-back-cached-main-resource-expected.txt.
* platform/mac-wk2/loader/go-back-cached-main-resource-expected.txt: Downloaded from the mac-wk2 bots.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] URL decode data: URLs before passing to the platform media player.
https://bugs.webkit.org/show_bug.cgi?id=114887

Patch by John Griggs <jgriggs@blackberry.com> on 2013-04-22
Reviewed by Rob Buis.

Pass data URL through URL decoding before passing to platform media player.  PR 313635.

Reviewed internally by Liam Quinn

* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::load):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Shrink baseline size of WTF::Vector on 64-bit by switching to unsigned capacity and size.
<http://webkit.org/b/97268>
<rdar://problem/12376519>

Reviewed by Sam Weinig.

Source/JavaScriptCore:

Update LLInt WTF::Vector offset constants to match the new memory layout.

* llint/LowLevelInterpreter.asm:

Source/WebCore:

* CMakeLists.txt: Add a workaround for GCC 4.6.x in Release mode so it
does not crash.

Source/WTF:

Shrink Vector by 8 bytes on 64-bit by using 32-bit capacity and size.
Vector now inherits from VectorBuffer instead of having a VectorBuffer member;
this is necessary for m_size to fall into the padding after the base class members.

The WTF::Vector API still uses size_t.

Based on Blink r148313 by <cevans@chromium.org>.

* wtf/SizeLimits.cpp:
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(VectorBufferBase):
(WTF::VectorBuffer::shouldReallocateBuffer):
(Vector):
(WTF::Vector::Vector):
(WTF::Vector::capacity):
(WTF::Vector::at):
(WTF::Vector::data):
(WTF::Vector::swap):
(WTF::::Vector):
(WTF::::reserveCapacity):
(WTF::::tryReserveCapacity):
(WTF::::reserveInitialCapacity):
(WTF::::shrinkCapacity):
(WTF::::releaseBuffer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Scrollbar should not depend on EventHandler, Frame and FrameView
https://bugs.webkit.org/show_bug.cgi?id=114941

Reviewed by Darin Adler.

It's a layering violation that Scrollbar uses EventHandler, Frame
and FrameView. Frame is used to get the EventHandler that is used
to set mousePressed to false after a Scrollbar::mouseUp(). This is
not really needed, since EventHandler already sets m_mousePressed
to false when calling Scrollbar::mouseUp(). The PopupMenu windows
implementation also calls Scrollbar::mouseUp(), but that scrollbar
is not inside a FrameView.

* platform/Scrollbar.cpp:
(WebCore::Scrollbar::isScrollViewScrollbar):
isScrollViewScrollbar() is a method of ScrollView so we don't need
to cast to FrameView.
(WebCore::Scrollbar::mouseUp): Remove EventHandler ussage.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change baseline JIT watchdog timer check to use the proper fast slow path
infrastructure.
https://bugs.webkit.org/show_bug.cgi?id=114963.

Reviewed by Oliver Hunt.

SH4 parts contributed by Julien Brianceau.

* assembler/ARMAssembler.h:
* assembler/MacroAssemblerARM.h:
* assembler/MacroAssemblerARMv7.h:
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::branchAdd32):
* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::branchAdd32):
* assembler/MacroAssemblerX86Common.h:
* assembler/SH4Assembler.h:
* jit/JIT.cpp:
(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::privateCompileSlowCases):
* jit/JIT.h:
(JSC::JIT::emitEnterOptimizationCheck):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_enter):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_enter):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash on OS X when shift clicking outside of input
https://bugs.webkit.org/show_bug.cgi?id=104058

Patch by Yi Shen <max.hong.shen@gmail.com> on 2013-04-22
Reviewed by Chang Shu.

Source/WebCore:

Shift clicking outside of a focused div while removing the focused div from
the dom tree at the same time may hit a null visible position, which should
not be used to calculate the text distance with the new selection's start and
end position. Otherwise, the browser may crash.

Test: editing/selection/crash-on-shift-click.html

* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):

LayoutTests:

Add test for shift click crash issue.

* editing/selection/crash-on-shift-click-expected.txt: Added.
* editing/selection/crash-on-shift-click.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed Mac gardening. Update a test and results now that forced text 
tracks are supported.

* media/track/track-in-band-expected.txt:
* media/track/track-in-band.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148895 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-04-22  Oliver Hunt  <oliver@apple.com>

        Fix assertions to account for new Vector layout

        RS=Gavin

        * llint/LLIntData.cpp:
        (JSC::LLInt::Data::performAssertions):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-04-22  Oliver Hunt  <oliver@apple.com>

        Perform null check before trying to use the result of readline()

        RS=Gavin

        * jsc.cpp:
        (runInteractive):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Range.getClientRects() should not include rects for partially selected elements
https://bugs.webkit.org/show_bug.cgi?id=76839

Reviewed by Sam Weinig.

Source/WebCore:

CSSOM says that Range.getClientRects() should include the border boxes
of each element selected by the range. However, we were also
incorrectly including border boxes for partially selected elements.
For instance, consider the following selection:

    <div>line one<br>line two</div>
    -------------

The <div> is two lines tall, but only the first line is selected.
Despite this, we'd include the <div>'s border box since its start tag
was included in the selection.

Fix this by excluding partially selected elements. This is accomplished
by skipping over elements that come after the start boundary point of
the range but are ancestors of the end boundary point.

Added test cases to LayoutTests/fast/dom/Range/getClientRects.html.

* dom/Range.cpp:
(WebCore::Range::getBorderAndTextQuads):

LayoutTests:

* fast/dom/Range/getClientRects-expected.txt: Updated expected result.
* fast/dom/Range/getClientRects.html: Added new test cases.

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