[iOS] Remove duplicate call to RunLoop::initializeMainRunLoop
https://bugs.webkit.org/show_bug.cgi?id=128328

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-02-06
Reviewed by Dan Bernstein.

* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView initWithFrame:configuration:]):
(-[WKContentView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163572 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, fix build error on 64bit debug build

Apply static_cast<long long> to int64_t variable when '%lli' is used.

* Modules/indexeddb/IDBDatabaseBackend.cpp:
(WebCore::IDBDatabaseBackend::clearObjectStore):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::setActive):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163573 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSManagedValue should automatically call removeManagedReference:withOwner: upon dealloc
https://bugs.webkit.org/show_bug.cgi?id=124053

Reviewed by Geoffrey Garen.

* API/JSManagedValue.h:
* API/JSManagedValue.mm:
(+[JSManagedValue managedValueWithValue:andOwner:]):
(-[JSManagedValue initWithValue:]):
(-[JSManagedValue dealloc]):
(-[JSManagedValue didAddOwner:]):
(-[JSManagedValue didRemoveOwner:]):
* API/JSManagedValueInternal.h: Added.
* API/JSVirtualMachine.mm:
(-[JSVirtualMachine addManagedReference:withOwner:]):
(-[JSVirtualMachine removeManagedReference:withOwner:]):
* API/WebKitAvailability.h:
* API/tests/testapi.mm:
(-[TextXYZ click]):
* JavaScriptCore.xcodeproj/project.pbxproj:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed Windows Build Fix after r163568.

Remove old symbol export. It is now const. Waiting for bot to produce new symbol.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Heap::writeBarrier shouldn't be static
https://bugs.webkit.org/show_bug.cgi?id=127807

Reviewed by Geoffrey Garen.

Currently it looks up the Heap in which to fire the write barrier by using
the cell passed to it. Almost every call site already has a reference to the
VM or the Heap itself. It seems wasteful to look it up all over again.

Source/JavaScriptCore:

* GNUmakefile.list.am:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/CopyWriteBarrier.h:
(JSC::CopyWriteBarrier::set):
* heap/Heap.cpp:
(JSC::Heap::writeBarrier):
* heap/Heap.h:
(JSC::Heap::writeBarrier):
* jit/JITOperations.cpp:
* jit/JITWriteBarrier.h:
(JSC::JITWriteBarrierBase::set):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::llint_write_barrier_slow):
* runtime/Arguments.h:
* runtime/JSWeakMap.cpp:
* runtime/MapData.cpp:
(JSC::MapData::ensureSpaceForAppend):
* runtime/PropertyTable.cpp:
(JSC::PropertyTable::PropertyTable):
* runtime/Structure.h:
* runtime/WriteBarrier.h:
* runtime/WriteBarrierInlines.h: Added.

Source/WebCore:

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::JSEventListener):
* bindings/js/JSEventListener.h:
(WebCore::JSEventListener::jsFunction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the setter definition from r163514.

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-06

* UIProcess/API/Cocoa/WKWebViewPrivate.h:


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

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _remoteObjectRegistry]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make adoption agency use the task queue
https://bugs.webkit.org/show_bug.cgi?id=109445

Reviewed by Ryosuke Niwa.

Source/WebCore:

Tests: fast/parser/adoption-agency-crash-01.html
       fast/parser/adoption-agency-crash-02.html
       fast/parser/adoption-agency-crash-03.html

* html/parser/HTMLConstructionSite.cpp:
(WebCore::insert):
(WebCore::executeInsertTask):
(WebCore::executeReparentTask):
(WebCore::executeInsertAlreadyParsedChildTask):
(WebCore::executeTakeAllChildrenTask):
(WebCore::executeTask):
(WebCore::HTMLConstructionSite::attachLater):
(WebCore::HTMLConstructionSite::executeQueuedTasks):
(WebCore::HTMLConstructionSite::insertTextNode):
(WebCore::HTMLConstructionSite::reparent):
(WebCore::HTMLConstructionSite::insertAlreadyParsedChild):
(WebCore::HTMLConstructionSite::takeAllChildren):
(WebCore::HTMLConstructionSite::fosterParent):
* html/parser/HTMLConstructionSite.h:
(WebCore::HTMLConstructionSiteTask::HTMLConstructionSiteTask):
(WebCore::HTMLConstructionSiteTask::oldParent):
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::callTheAdoptionAgency):

LayoutTests:

* TestExpectations:
* fast/parser/adoption-agency-crash-01-expected.txt: Added.
* fast/parser/adoption-agency-crash-01.html: Added.
* fast/parser/adoption-agency-crash-02-expected.txt: Added.
* fast/parser/adoption-agency-crash-02.html: Added.
* fast/parser/adoption-agency-crash-03-expected.txt: Added.
* fast/parser/adoption-agency-crash-03.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Regenerate JSTestObj now that ScriptArguments moved. Generator knows what to do.

Rubber-stamped by Zalan Bujtas.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix iOS builds after r163574

* API/JSManagedValue.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes] Rounded Insets Let Content Overlap Shape
https://bugs.webkit.org/show_bug.cgi?id=127852

Reviewed by Bem Jones-Bey.

Source/WebCore:

Using LengthSize to FloatSize conversion from LengthSize.h lead to miscalculated
inset border radius, when the border radius was defined by percentages. This patch
fixes the behavior and removes the incorrect conversion.

Test: fast/shapes/shape-outside-floats/shape-outside-rounded-inset.html

* css/LengthFunctions.cpp:
(WebCore::floatSizeForLengthSize): Add new helper function for LengthSize to FloatSize conversion.
* css/LengthFunctions.h:
* platform/LengthSize.h: Remove floatSize conversion.
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape): Use new helper function to calculate the right with for the inset border radius.

LayoutTests:

* fast/shapes/shape-outside-floats/shape-outside-rounded-inset-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-rounded-inset.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Crash in WebCore::AXObjectCache::computedObjectAttributeCache
https://bugs.webkit.org/show_bug.cgi?id=128310

Reviewed by Alexey Proskuryakov.

Be more careful about using axObjectCache() directly since it can return null.
I audited the usage cases of this method and ensured the ptr was not null in cases
where I thought we might get hit by this.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::parentObject):
(WebCore::AccessibilityNodeObject::menuForMenuButton):
(WebCore::AccessibilityNodeObject::menuButtonForMenu):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::firstAccessibleObjectFromNode):
(WebCore::AccessibilityObject::findMatchingObjects):
(WebCore::AccessibilityObject::elementAccessibilityHitTest):
(WebCore::AccessibilityObject::axObjectCache):
(WebCore::AccessibilityObject::notifyIfIgnoredValueChanged):
(WebCore::AccessibilityObject::accessibilityIsIgnored):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::parentObjectIfExists):
(WebCore::AccessibilityRenderObject::parentObject):
(WebCore::AccessibilityRenderObject::anchorElement):
(WebCore::AccessibilityRenderObject::isTabItemSelected):
(WebCore::AccessibilityRenderObject::accessibilityParentForImageMap):
(WebCore::AccessibilityRenderObject::nodeIsTextControl):
(WebCore::AccessibilityRenderObject::activeDescendant):
(WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
(WebCore::AccessibilityRenderObject::observableObject):
(WebCore::AccessibilityRenderObject::textChanged):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::addChildScrollbar):
(WebCore::AccessibilityScrollView::webAreaObject):
(WebCore::AccessibilityScrollView::parentObject):
(WebCore::AccessibilityScrollView::parentObjectIfExists):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS][WebKit2] Remove JoinExistingSession from plist
https://bugs.webkit.org/show_bug.cgi?id=128318
<rdar://problem/15971612>

Reviewed by Tim Horton.

Remove JoinExistingSession key that is not available on iOS.

* NetworkProcess/EntryPoint/mac/XPCService/NetworkService.Development/Info-iOS.plist:
* NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService.Development/Info-iOS.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] WebKit2 can't access the GPU
https://bugs.webkit.org/show_bug.cgi?id=128345
<rdar://problem/15976084>

Reviewed by Tim Horton.

Add an entitlement to allow web process to access GPU.

* Configurations/WebContent-iOS.entitlements: Added.
* Configurations/WebContentService.Development.xcconfig:
* Configurations/WebContentService.xcconfig:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r163558.
http://trac.webkit.org/changeset/163558
https://bugs.webkit.org/show_bug.cgi?id=128350

Breaks scrolling on certain websites (Requested by bfulgham on
#webkit).

* page/EventHandler.cpp:
(WebCore::EventHandler::handleWheelEvent):
* page/WheelEventDeltaTracker.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+[JSContext currentCallee] should return the currently executing JS function
https://bugs.webkit.org/show_bug.cgi?id=122621

Reviewed by Geoffrey Garen.

It would be useful if there was a +[JSContext currentObject] API which was 
callable from ObjC API callbacks. Its purpose would be to allow convenient 
access to the JSValue wrapper for the currently-executing block callback.

* API/JSContext.h:
* API/JSContext.mm:
(+[JSContext currentCallee]):
(-[JSContext beginCallbackWithData:calleeValue:thisValue:argumentCount:arguments:]):
* API/JSContextInternal.h:
* API/ObjCCallbackFunction.mm:
(JSC::objCCallbackFunctionCallAsFunction):
(JSC::objCCallbackFunctionCallAsConstructor):
* API/tests/testapi.mm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove ChildProcess::m_activeTasks
https://bugs.webkit.org/show_bug.cgi?id=128342

Reviewed by Anders Carlson.

Currently we funnel a number of different user activities
to a single UserActivity object, which requires a call down
from WebCore to WebKit2. Split these out so we can track
them separately.

Source/WebCore: 

* page/ChromeClient.h:
    - removed [inc|dec]rementActivePageCount
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
    - incrementActivePageCount -> beginActivity
(WebCore::PageThrottler::~PageThrottler):
    - decrementActivePageCount -> endActivity
(WebCore::PageThrottler::throttlePage):
    - decrementActivePageCount -> endActivity
(WebCore::PageThrottler::unthrottlePage):
    - incrementActivePageCount -> beginActivity
* page/PageThrottler.h:
    - Added m_pageActivity.

Source/WebKit2: 

* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::PluginProcess):
    - added m_connectionActivity.
* PluginProcess/PluginProcess.h:
(WebKit::PluginProcess::connectionActivity):
    - added m_connectionActivity.
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::didReceiveSyncMessage):
(WebKit::WebProcessConnection::destroyPlugin):
(WebKit::WebProcessConnection::createPlugin):
    - use connectionActivity
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializeProcess):
    - use a separate UserActivity for Java.
* Shared/ActivityAssertion.cpp:
(WebKit::ActivityAssertion::ActivityAssertion):
(WebKit::ActivityAssertion::~ActivityAssertion):
* Shared/ActivityAssertion.h:
    - ChildProcess -> UserActivity
* Shared/ChildProcess.cpp:
(WebKit::ChildProcess::ChildProcess):
* Shared/ChildProcess.h:
    - remove m_activeTasks.
(WebKit::ChildProcess::processSuppressionEnabled):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
* WebProcess/WebCoreSupport/WebChromeClient.h:
    - removed [inc|dec]rementActivePageCount



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Check selectors exactly when invalidating style
https://bugs.webkit.org/show_bug.cgi?id=128321

Reviewed by Andreas Kling.
        
Selectors are now really fast to match with the JIT. Take advantage of this by invalidating
the document style exactly when a new stylesheet arrives (instead of using heuristics).
        
This reduces need for large style recalculations in some common cases.

* css/ElementRuleCollector.cpp:
(WebCore::ElementRuleCollector::clearMatchedRules):
(WebCore::ElementRuleCollector::collectMatchingRulesForList):
* css/ElementRuleCollector.h:
(WebCore::ElementRuleCollector::hasMatchedRules):
* css/RuleSet.h:
(WebCore::RuleSet::hasShadowPseudoElementRules):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
* css/SelectorChecker.h:
        
    Add new mode where all pseudo elements match so we can invalidate their element.

* css/StyleInvalidationAnalysis.cpp:
(WebCore::shouldDirtyAllStyle):
(WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis):
(WebCore::invalidateStyleRecursively):
(WebCore::StyleInvalidationAnalysis::invalidateStyle):
        
    Switch to real selector checker.

* css/StyleInvalidationAnalysis.h:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchedProperties::~MatchedProperties):
* css/StyleResolver.h:
(WebCore::StyleResolver::mediaQueryEvaluator):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add missing &.

* css/StyleInvalidationAnalysis.cpp:
(WebCore::shouldDirtyAllStyle):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Workaround REGRESSION(r163195-r163227): Crash beneath NSErrorUserInfoFromJSException when installing AppleInternal.mpkg
https://bugs.webkit.org/show_bug.cgi?id=128347

Reviewed by Geoffrey Garen.

Added a flag to VM class called m_ignoreStackLimit that disables stack limit checks.
We set this flag in JSContextGroupCreate() and JSGlobalContextCreateInGroup().

Disabled stack overflow tests in testapi.js since it uses these paths.

THis patch will be reverted as part of a comprehensive solution to the problem.

* API/JSContextRef.cpp:
(JSContextGroupCreate):
(JSGlobalContextCreateInGroup):
* API/tests/testapi.js:
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::updateStackLimitWithReservedZoneSize):
* runtime/VM.h:
(JSC::VM::ignoreStackLimit):


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