iframe and scrollbar with "overflow:auto" should support autoscroll with mousedrag
https://bugs.webkit.org/show_bug.cgi?id=40981

Patch by Antonio Gomes <a1.gomes@sisa.samsung.com> on 2013-09-23
Reviewed by Darin Adler.

Source/WebCore:

RenderBox::calculateAutoscrollDirection does not properly translate
inner frames' coordinates in order to determine its auto-scrollability.
By coincidence, if the inner frame box it placed near to page's 0, 0 position
(upper left corner), it might work.

Patch fixes it by changing ::calculateAutoscrollDirection algorithm to operate
with window coordinates, taking inner frames offset and scroll position into account.
The behavior of auto-scrollable non-frame overflow boxes, including divs, still works
as it is used to.

Test: fast/events/drag-and-drop-autoscroll-inner-frame.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::calculateAutoscrollDirection):

LayoutTests:

Test ensures that dragging an element close to the boundary of
scrollable Frames, scroll its content in that direction.

* fast/events/drag-and-drop-autoscroll-inner-frame-expected.txt: Added.
* fast/events/drag-and-drop-autoscroll-inner-frame.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove PassTraits.h
https://bugs.webkit.org/show_bug.cgi?id=121805

Reviewed by Andreas Kling.

We no longer need PassTraits.h, get rid of it.

* GNUmakefile.list.am:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PassTraits.h: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156298 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Delete TestWebKitAPI domain or some keys before running TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=121715 & <rdar://problem/14269434>

Patch by Benjamin Poulain <benjamin@webkit.org> on 2013-09-23
Reviewed by Alexey Proskuryakov.

Previously, initalizing a WebPreference would change the cache model
to WebCacheModelDocumentBrowser. That behavior was due to a stale
preference file on disk.

This patch fixes the tests by resetting the default, and using the proper
default values after initializing WebPreference.

* TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:
(TestWebKitAPI::TEST): Use the proper initial value, unrelated
to the previous runs.

* TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:
(TestWebKitAPI::TEST): This test needs b/f cache to be enabled, so change
cache model to the one required.

* TestWebKitAPI/ios/mainIOS.mm:
(main): Reset the preferences before testing.
* TestWebKitAPI/mac/mainMac.mm:
(main): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Never use ReturnPC for exception handling and quit using exception check indices as a lame replica of the CodeOrigin index
https://bugs.webkit.org/show_bug.cgi?id=121734

Reviewed by Mark Hahnenberg.
        
Exception handling can deduce where the exception was thrown from by looking at the
code origin that was stored into the call frame header. There is no need to pass any
additional meta-data into the exception throwing logic. But the DFG was still doing it
anyway.
        
This removes all of the logic to pass extra meta-data into lookupExceptionHandler()
and friends. It simplifies a lot of code.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::shrinkToFit):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::codeOrigins):
(JSC::CodeBlock::hasCodeOrigins):
(JSC::CodeBlock::canGetCodeOrigin):
(JSC::CodeBlock::codeOrigin):
* bytecode/CodeOrigin.h:
(JSC::InlineCallFrame::InlineCallFrame):
* bytecode/InlineCallFrameSet.cpp: Added.
(JSC::InlineCallFrameSet::InlineCallFrameSet):
(JSC::InlineCallFrameSet::~InlineCallFrameSet):
(JSC::InlineCallFrameSet::add):
(JSC::InlineCallFrameSet::shrinkToFit):
* bytecode/InlineCallFrameSet.h: Added.
(JSC::InlineCallFrameSet::isEmpty):
(JSC::InlineCallFrameSet::size):
(JSC::InlineCallFrameSet::at):
* dfg/DFGArgumentsSimplificationPhase.cpp:
(JSC::DFG::ArgumentsSimplificationPhase::run):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGCommonData.cpp:
(JSC::DFG::CommonData::addCodeOrigin):
(JSC::DFG::CommonData::shrinkToFit):
* dfg/DFGCommonData.h:
* dfg/DFGDesiredWriteBarriers.cpp:
(JSC::DFG::DesiredWriteBarrier::DesiredWriteBarrier):
(JSC::DFG::DesiredWriteBarrier::trigger):
* dfg/DFGDesiredWriteBarriers.h:
(JSC::DFG::DesiredWriteBarriers::add):
(JSC::DFG::initializeLazyWriteBarrierForInlineCallFrameExecutable):
(JSC::DFG::initializeLazyWriteBarrierForInlineCallFrameCallee):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::Graph):
* dfg/DFGGraph.h:
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::compileExceptionHandlers):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compileFunction):
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::emitStoreCodeOrigin):
(JSC::DFG::JITCompiler::exceptionCheck):
(JSC::DFG::JITCompiler::fastExceptionCheck):
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGRepatch.cpp:
(JSC::DFG::tryBuildGetByIDList):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheck):
(JSC::DFG::SpeculativeJIT::appendCallSetResult):
(JSC::DFG::SpeculativeJIT::appendCall):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
(JSC::DFG::VirtualRegisterAllocationPhase::run):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::callPreflight):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitExceptionCheck):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r155998): when zooming in, tiles are too small
https://bugs.webkit.org/show_bug.cgi?id=121765

Source/WebCore:

Reviewed by Dean Jackson.

In r155998 I made GraphicsLayerCA take root-relative transforms
into account when computing contentsScale, and landed a bunch of
new results which should actually have told me that I broke page
scaling.

We don't want to take page scale into account when computing contentsScale,
because we already do so, so ignore the transform on the layer that
applies page scale (the only transform it should ever has is the page scale).

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

LayoutTests:

Reviewed by Dean Jackson.

Fix results of tests that showed that we had incorrect tiling
behavior on zooming.

* platform/mac-wk2/tiled-drawing/fixed-background/fixed-body-background-zoomed-expected.txt:
* platform/mac-wk2/tiled-drawing/tile-size-slow-zoomed-expected.txt:
* platform/mac-wk2/tiled-drawing/tiled-drawing-zoom-expected.txt:
* platform/mac-wk2/tiled-drawing/tiled-drawing-zoom-scrolled-expected.txt:
* platform/mac/compositing/tiling/tile-cache-zoomed-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
use NOMINMAX instead of #define min min
https://bugs.webkit.org/show_bug.cgi?id=73563

Reviewed by Brent Fulgham.

Use NOMINMAX instead of #define min/max as a cleaner
way of ensuring that Windows system header files don't
define min/max as macro in the first place.

Source/JavaScriptCore:

* config.h:

Source/WebCore:

* WebCorePrefix.h:
* config.h:

Source/WebKit/win:

* WebKitPrefix.h:

Source/WebKit2:

* config.h:

Source/WTF:

* config.h:

Tools:

* DumpRenderTree/DumpRenderTreePrefix.h:
* DumpRenderTree/cg/ImageDiffCG.cpp:
* DumpRenderTree/config.h:
* DumpRenderTree/win/ImageDiffCairo.cpp:
* WebKitTestRunner/WebKitTestRunnerPrefix.h:
* WebKitTestRunner/config.h:

WebKitLibraries:

* win/tools/vsprops/common.props:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WIN] Implement WebMutableURLRequest::setHTTPBody()
https://bugs.webkit.org/show_bug.cgi?id=91920

Reviewed by Brent Fulgham.

Source/WebCore:

Add a method to FormData for growing the internal buffer with a given size.

* platform/network/FormData.cpp:
(WebCore::FormData::appendData):
(WebCore::FormData::expandDataStore):
* platform/network/FormData.h:

Source/WebKit/win:

* WebMutableURLRequest.cpp:
(WebMutableURLRequest::setHTTPBody):
(WebMutableURLRequest::setHTTPBodyStream):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add hash traits for std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=121807

Reviewed by Antti Koivisto.

Also, convert the thread map over to using std::unique_ptr instead of OwnPtr.

* wtf/HashMap.h:
Remove unnecessary typedefs and add missing calls to std::forward.

* wtf/HashTraits.h:
Add hash trait for std::unique_ptr.

* wtf/RefPtrHashMap.h:
Use std::add_lvalue_reference.

* wtf/ThreadingPthreads.cpp:
(WTF::establishIdentifierForPthreadHandle):
Change ThreadMap to be a hash map from ThreadIdentifier to std::unique_ptr<PthreadState>.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ListHashSet::removeLast should only remove one element.

* wtf/ListHashSet.h:
(WTF::ListHashSet::removeLast):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WIN] Add implementation for WebCore::readFromFile()
https://bugs.webkit.org/show_bug.cgi?id=119210

Reviewed by Brent Fulgham.

* platform/win/FileSystemWin.cpp:
(WebCore::readFromFile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Test the waters and begin using lambdas
https://bugs.webkit.org/show_bug.cgi?id=121809

Reviewed by Andreas Kling.

Source/WebCore:

Use lambdas instead of static functions and function objects.

* css/MediaQuery.cpp:
(WebCore::MediaQuery::MediaQuery):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::deliverAllMutations):
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::sortedTrackListForMenu):

Source/WTF:

* wtf/ListDump.h:
(WTF::sortedListDump):
Use std::less instead of a custom lessThan function.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CTTE: RenderObject::container() should return a RenderElement*.
<https://webkit.org/b/121811>

Reviewed by Antti Koivisto.

The containing renderer is always a RenderElement.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make the Mac build work with IndexedDB enabled.
https://bugs.webkit.org/show_bug.cgi?id=121814

Reviewed by Alexey Proskuryakov.

This patch makes the Mac build work if one were to enable the IndexedDB feature flag.
This patch does not actually enable the flag for everyone.

* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBBackingStore.cpp: Added.
(WebCore::IDBBackingStore::open):
(WebCore::IDBBackingStore::openInMemory):
(WebCore::IDBBackingStore::getObjectStores):
(WebCore::IDBBackingStore::Cursor::advance):
(WebCore::IDBBackingStore::Cursor::continueFunction):
(WebCore::IDBBackingStore::Transaction::Transaction):
(WebCore::IDBBackingStore::Transaction::begin):
(WebCore::IDBBackingStore::Transaction::commit):
(WebCore::IDBBackingStore::Transaction::rollback):
* Modules/indexeddb/IDBBackingStore.h:
(WebCore::LevelDBFactory::~LevelDBFactory):
(WebCore::IDBBackingStore::Transaction::reset):
(WebCore::IDBBackingStore::Transaction::levelDBTransactionFrom):

* Modules/indexeddb/IDBKeyPath.cpp:
(WebCore::IDBIsValidKeyPath):

* bindings/js/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):

* bindings/js/JSIDBAnyCustom.cpp:
(WebCore::toJS):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156309 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move rendererForRootBackground() to RenderElement.
<http://webkit.org/b/121813>

Reviewed by Antti Koivisto.

Move this to RenderElement (and make it return one, too) since the
document element renderer will always be a RenderElement.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r156307.
http://trac.webkit.org/changeset/156307
https://bugs.webkit.org/show_bug.cgi?id=121817

Broke the build, and crashes the compiler (Requested by ap on
#webkit).

Source/WebCore:

* css/MediaQuery.cpp:
(WebCore::expressionCompare):
(WebCore::MediaQuery::MediaQuery):
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::ObserverLessThan::operator()):
(WebCore::MutationObserver::deliverAllMutations):
* page/CaptionUserPreferences.cpp:
(WebCore::textTrackCompare):
(WebCore::CaptionUserPreferences::sortedTrackListForMenu):

Source/WTF:

* wtf/ListDump.h:
(WTF::lessThan):
(WTF::sortedListDump):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156311 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move style change analysis code to RenderElement
https://bugs.webkit.org/show_bug.cgi?id=121812

Reviewed by Andreas Kling.

Text renderers don't need this. There is no text renderer specific invalidation and text
style never changes independent from the containing RenderElement.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Introduce CSS_VALUE_TYPE_CASTS macro in order to cast CSSValue type
https://bugs.webkit.org/show_bug.cgi?id=121462

Reviewed by Darin Adler.

As r155429 introduced ELEMENT_TYPE_CASTS, CSS_VALUE_TYPE_CASTS can be used
by css value type casting as well. This type cast macros will help to detect
bad-cast bugs as well as improve a code readibility.

This patch adds the following methods,

- CSSFooValue* toCSSFooValue(CSSValue*)
- const CSSFooValue* toCSSFooValue(const CSSValue*)

This patch support CSSImageSetValue and CSSReflectValue first. Other CSS*Values
will use this macro step by step.

Besides this patch will remove unnecessary local variables.

No new tests, no behavior change.

* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::cachedImage):
(WebCore::CSSCursorImageValue::cachedOrPendingImage):
* css/CSSImageSetValue.h:
* css/CSSReflectValue.h:
* css/CSSValue.cpp:
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
* css/StyleResolver.cpp:
(WebCore::hasVariableReference):
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::styleImage):
* rendering/style/StylePendingImage.h:
(WebCore::StylePendingImage::cssImageSetValue):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderTextControlSingleLine::updateFromElement() override not needed.
<https://webkit.org/b/121815>

Reviewed by Anders Carlsson.

* rendering/RenderTextControlSingleLine.cpp:
* rendering/RenderTextControlSingleLine.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Moving back in history from a page with <video>, then moving forward causes crash.
https://bugs.webkit.org/show_bug.cgi?id=120475

Reviewed by Anders Carlsson.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::AVFWrapper::AVFWrapper): Add assertion that creation is on main thread.
(WebCore::AVFWrapper::~AVFWrapper): Add assertion that destruction is on main thread.
(WebCore::destroyAVFWrapper): Helper function to dispatch on main queue.
(WebCore::AVFWrapper::disconnectAndDeleteAVFWrapper): Spawn AVFoundationCF destruction to
main queue.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove WTF_USE_SCROLLBAR_PAINTER #define
https://bugs.webkit.org/show_bug.cgi?id=121819

Reviewed by Sam Weinig.

Source/WebCore:

Remove unnecessary if checks and dead code.

* platform/mac/NSScrollerImpDetails.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::~ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::contentAreaWillPaint):
(WebCore::ScrollAnimatorMac::mouseEnteredContentArea):
(WebCore::ScrollAnimatorMac::mouseExitedContentArea):
(WebCore::ScrollAnimatorMac::mouseMovedInContentArea):
(WebCore::ScrollAnimatorMac::mouseEnteredScrollbar):
(WebCore::ScrollAnimatorMac::mouseExitedScrollbar):
(WebCore::ScrollAnimatorMac::willStartLiveResize):
(WebCore::ScrollAnimatorMac::contentsResized):
(WebCore::ScrollAnimatorMac::willEndLiveResize):
(WebCore::ScrollAnimatorMac::contentAreaDidShow):
(WebCore::ScrollAnimatorMac::contentAreaDidHide):
(WebCore::ScrollAnimatorMac::didBeginScrollGesture):
(WebCore::ScrollAnimatorMac::didEndScrollGesture):
(WebCore::ScrollAnimatorMac::mayBeginScrollGesture):
(WebCore::ScrollAnimatorMac::finishCurrentScrollAnimations):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::willRemoveVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorMac::willRemoveHorizontalScrollbar):
(WebCore::ScrollAnimatorMac::shouldScrollbarParticipateInHitTesting):
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::cancelAnimations):
(WebCore::ScrollAnimatorMac::setIsActive):
(WebCore::ScrollAnimatorMac::updateScrollerStyle):
(WebCore::ScrollAnimatorMac::initialScrollbarPaintTimerFired):
* platform/mac/ScrollViewMac.mm:
(WebCore::toNSScrollerKnobStyle):
(WebCore::ScrollView::platformSetScrollbarOverlayStyle):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::updateArrowPlacement):
(WebCore::ScrollbarThemeMac::registerScrollbar):
(WebCore::ScrollbarThemeMac::ScrollbarThemeMac):
(WebCore::ScrollbarThemeMac::scrollbarThickness):
(WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged):
(WebCore::ScrollbarThemeMac::hasThumb):
(WebCore::ScrollbarThemeMac::minimumThumbLength):
(WebCore::ScrollbarThemeMac::updateEnabledState):
(WebCore::ScrollbarThemeMac::paint):

Source/WTF:

All our supported systems use the scrollbar painter now, so get rid of the #ifdef.

* wtf/Platform.h:


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