Setting an inline style property to "" shouldn't cause style recalc unless the property was present.
<http://webkit.org/b/115122>

Reviewed by Antti Koivisto.

StylePropertySet::setProperty() handles empty strings by removing the property entirely.
If there was no property to remove, it shouldn't claim that it changed something, as that
will cause the CSSOM wrapper to mark the element for style recalc.

A common idiom that triggers this is excessive use of { element.style.display = ''; }

* css/StylePropertySet.cpp:
(WebCore::MutableStylePropertySet::setProperty):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ElementData::attributeItem() should bounds-check the index.
<http://webkit.org/b/115076>

Reviewed by Antti Koivisto.

Switch the ASSERT_WITH_SECURITY_IMPLICATION to a RELEASE_ASSERT.

* dom/Element.h:
(WebCore::ElementData::attributeItem):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ElementData should use 'unsigned' attribute indices.
<http://webkit.org/b/115103>

Reviewed by Antti Koivisto.

Switch to using 'unsigned' for attribute indices. This gives consistent behavior
on 32/64-bit, and the underlying storage is already limited by Vector's 32-bit capacity.

Added an ElementData::attributeNotFound constant (-1) since we can't use WTF::notFound.

* dom/Element.cpp:
(WebCore::Element::detachAttribute):
(WebCore::Element::removeAttribute):
(WebCore::Element::setAttribute):
(WebCore::Element::setSynchronizedLazyAttribute):
(WebCore::Element::setAttributeInternal):
(WebCore::Element::setAttributeNode):
(WebCore::Element::removeAttributeNode):
(WebCore::Element::removeAttributeInternal):
(WebCore::UniqueElementData::removeAttribute):
(WebCore::ElementData::getAttributeItemIndexSlowCase):
* dom/Element.h:
(ElementData):
(UniqueElementData):
(Element):
(WebCore::Element::getAttributeItemIndex):
(WebCore::Element::attributeCount):
(WebCore::ElementData::length):
(WebCore::ElementData::getAttributeItem):
(WebCore::ElementData::getAttributeItemIndex):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::removeNamedItem):
(WebCore::NamedNodeMap::removeNamedItemNS):
(WebCore::NamedNodeMap::length):
* dom/NamedNodeMap.h:
(NamedNodeMap):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up unused code in ViewportArguments.h
https://bugs.webkit.org/show_bug.cgi?id=115121

Patch by Jacky Jiang <zhajiang@blackberry.com> on 2013-04-24.
Reviewed by Benjamin Poulain.

The target-densityDPI emulation implementation has been removed by
r147893, so clean up the remaining code as well.

* dom/ViewportArguments.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149062 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Battery API won't return updated battery status until client calls didChangeBatteryStatus
https://bugs.webkit.org/show_bug.cgi?id=114891

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

The BatteryStatus object in BatteryManager won't get updated until BatteryClient calls
didChangeBatteryStatus in BatteryController. Any attempts to call webkitBattery.charged()
or other get functions will always return the default values until the next battery status
change object gets passed to the controller.

We need to update the manager when we attach it to the controller, and update all
existing managers when the controller receives it's first battery status object.

* Modules/battery/BatteryController.cpp:
(WebCore::BatteryController::addListener):
(WebCore::BatteryController::updateBatteryStatus):
* Modules/battery/BatteryManager.cpp:
(WebCore::BatteryManager::didChangeBatteryStatus):
(WebCore::BatteryManager::updateBatteryStatus):
(WebCore):
* Modules/battery/BatteryManager.h:
(BatteryManager):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash when trying to determine the length of an invalid message
https://bugs.webkit.org/show_bug.cgi?id=115127
<rdar://problem/13700736>

Reviewed by Beth Dakin.

Use message instead of incomingMessage since incomingMessage will always be null.

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::processIncomingMessage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149064 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix a merge error in r149007 (was missing a null check added in r148777).

* rendering/LogicalSelectionOffsetCaches.h:
(WebCore::containingBlockForAbsolutePosition):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149065 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Vertical overlay scrollbar in iframes fades in and out rapidly when you scroll in 
a circle
https://bugs.webkit.org/show_bug.cgi?id=115124
-and corresponding-
<rdar://problem/13168957>

Reviewed by Anders Carlsson.

With http://trac.webkit.org/changeset/119834 we started calling 
ScrollbarPainterController's contentAreaScrolled/contentAreaScrolledInDirection 
API on a zero-delay timer instead of calling it right away. This prevented some 
crashes that we saw whenever this was called during a layout. However, that delay, 
combined with the particulars of contentAreaScrolledInDirection cause this bug 
where sometimes the scrollbars in an iframe will fade out very noticeably when 
scrolling in a circle.

This change makes it so we will only use the zero-delay timer if the 
ScrollableArea is not currently handling a wheel event. If it IS handling a wheel 
event, then we will send the notifications to AppKit right away. I confirmed that 
this change did not reintroduce the old crashes. 

Keep track of whether we are currently handling a wheel event with the new member 
variable m_isHandlingWheelEvent.
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::handleWheelEvent):
* page/EventHandler.h:
(WebCore::EventHandler::isHandlingWheelEvent):
(EventHandler):

To prevent layering violations, the ScrollableArea sub-classes will have to access 
this information from the EventHandler.
* page/FrameView.cpp:
(WebCore::FrameView::isHandlingWheelEvent):
* page/FrameView.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::isHandlingWheelEvent):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::isHandlingWheelEvent):
* rendering/RenderLayer.h:
(RenderLayer):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::isHandlingWheelEvent):
* rendering/RenderListBox.h:

sendContentAreaScrolledSoon() can be private. Also add new function 
sendContentAreaScrolled().
* platform/mac/ScrollAnimatorMac.h:
(ScrollAnimatorMac):

If the ScrollableArea is handling a wheel event, call 
sendContentAreaScrolled(), otherwise call sendContentAreaScrolledSoon()
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
(WebCore::ScrollAnimatorMac::sendContentAreaScrolled):

Re-factored to use sendContentAreaScrolled()
(WebCore::ScrollAnimatorMac::sendContentAreaScrolledTimerFired):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Have VS2010 WebKit solution look in WebKit_Libraries/lib32 for dependencies.

* JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExportGeneratorPostBuild.cmd:
* JavaScriptCore.vcxproj/JavaScriptCorePreLink.cmd:
* JavaScriptCore.vcxproj/jsc/jscPostBuild.cmd:
* JavaScriptCore.vcxproj/jsc/jscPreLink.cmd:
* JavaScriptCore.vcxproj/testRegExp/testRegExp.vcxproj.filters:
* JavaScriptCore.vcxproj/testRegExp/testRegExpPostBuild.cmd:
* JavaScriptCore.vcxproj/testRegExp/testRegExpPreLink.cmd:
* JavaScriptCore.vcxproj/testapi/testapiPreLink.cmd:
* WTF.vcxproj/build-generated-files.sh:
* win/tools/vsprops/common.props:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        fast/js/global-constructors.html was deleted in r149001, removing it from
        TextExpectations too.

        * platform/mac/TestExpectations:
        * platform/qt-arm/TestExpectations:
        * platform/win/TestExpectations:
        * platform/wincairo/TestExpectations:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Once a custom font is cached to disk, it starts failing to render until the page is refreshed.
<rdar://problem/13622998> and https://bugs.webkit.org/show_bug.cgi?id=115131

Reviewed by Alexey Proskuryakov.

No new tests (Not a tested config, nor are disk cache issues currently testable).

* loader/cache/CachedResource.h:
(WebCore::CachedResource:: mayTryReplaceEncodedData): Allow subclasses to refuse encoded data replacement.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::tryReplaceEncodedData): Only try if shouldTryReplaceEncodedData() is true.

* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::CachedFont):
(WebCore::CachedFont::ensureCustomFontData):
(WebCore::CachedFont::mayTryReplaceEncodedData): Return false if the custom font data has ever been created.
* loader/cache/CachedFont.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG should keep the operand to create_this alive if it's emitting code for create_this
https://bugs.webkit.org/show_bug.cgi?id=115133

Source/JavaScriptCore: 

Reviewed by Mark Hahnenberg.
        
The DFG must model bytecode liveness, or else OSR exit is going to have a really bad time.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):

LayoutTests: 

Reviewed by Mark Hahnenberg.
        
This test crashes prior to my change.

* fast/js/dfg-allocation-profile-watch-point-exit-expected.txt: Added.
* fast/js/dfg-allocation-profile-watch-point-exit.html: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/dfg-allocation-profile-watch-point-exit.js: Added.
(Foo):
(foo):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WIN] Remove pthread from Visual Studio files in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=114864

Reviewed by Brent Fulgham.

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
* JavaScriptCore.vcproj/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.vsprops:
* JavaScriptCore.vcproj/jsc/jscCommon.vsprops:
* JavaScriptCore.vcproj/testRegExp/testRegExpCommon.vsprops:
* JavaScriptCore.vcproj/testapi/testapiCommon.vsprops:
* JavaScriptCore.vcxproj/JavaScriptCoreCommon.props:
* JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExportGeneratorCommon.props:
* JavaScriptCore.vcxproj/LLInt/LLIntOffsetsExtractor/LLIntOffsetsExtractorCommon.props:
* JavaScriptCore.vcxproj/jsc/jscCommon.props:
* JavaScriptCore.vcxproj/testRegExp/testRegExpCommon.props:
* JavaScriptCore.vcxproj/testapi/testapiCommon.props:
* JavaScriptCore.vcxproj/testapi/testapiCommonCFLite.props:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149072 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Fix build error after r148963.
https://bugs.webkit.org/show_bug.cgi?id=115126

Reviewed by Laszlo Gombos.

Generate forwarding headers for 'CoordinatedGraphics' to generate WKView.h

Source/WebKit2:

* PlatformEfl.cmake:

Tools:

* TestWebKitAPI/PlatformEfl.cmake:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WWDC session videos don’t play at developer.apple.com
https://bugs.webkit.org/show_bug.cgi?id=114858

Reviewed by Eric Carlson. Rubber stamped by Brady Eidson.

AVFoundation uses CFNetwork to store and retrieve cookies from the global store.
However, in the case where network access happens in the NetworkProcess, session
cookies are stored in-memory, and are not accessable in the WebProcess. Until such
a time as AVFoundation can provide an API which would allow us to provide cookies
for a specific request, we will interpose the CFNetwork method which they use to
retrieve the cookie string from the cookie store for their pending request.

Duplicate the previous SecItemShim target to a new, WebProcessShim target. This
target includes the SecItemShim functionality, but will add a new shim for cookie
retrieval:
* Shared/mac/CookieStorageShimLibrary.h: Added
(CookieStorageShimCallbacks):
* Shared/mac/CookieStorageShimLibrary.cpp: Added.
(WebKit::ShimProtector::ShimProtector): A simple stack-based counter class.
(WebKit::ShimProtector::~ShimProtector):
(WebKit::ShimProtector::count):
(WebKit::shimCFHTTPCookieStorageCopyRequestHeaderFieldsForURL): Interpose
    the CFNetwork call, and pass to the registered callback.
(WebKit::WebKitCookieStorageShimInitialize): Register the callbacks.

Add a helper singleton class which will talk to the shim through the
registered callbacks:
* Shared/mac/CookieStorageShim.h: Added
(WebKit::CookieStorageShim::CookieStorageShim):
* Shared/mac/CookieStorageShim.cpp: Added.
(WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): Pass the request
    over to the NetworkProcess.
(WebKit::CookieStorageShim::shared): Simple singleton.
(WebKit::CookieStorageShim::initialize): Call the library initializer.

Initialize the shim only when the WebProcess is delegating network loading
to the NetworkProcess:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Rename the WebProcess's shim from SecItemShim -> WebProcessShim:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::addDYLDEnvironmentAdditions):
* WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:
(WebKit::WebContentProcessMainDelegate::doPreInitializationWork):
* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info.plist:
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):

As the DYLD_INTERPOSE macro is used in multiple files now, put it in its
own header:
* Shared/mac/DyldInterpose.h: Added.
* PluginProcess/mac/PluginProcessShim.mm:
* WebProcess/mac/SecItemShimLibrary.mm:

Add new files to the project:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix invalid test names in jsc-test-list
<http://webkit.org/b/115136>

Reviewed by Geoffrey Garen.

This shell script finds all the invalid tests listed in
LayoutTests/fast/js/jsc-test-list:

    $ for F in `cat LayoutTests/fast/js/jsc-test-list`; do if [ ! -f LayoutTests/$F.html ]; then echo $F; fi; done
    fast/js/dfg-double-addition-simplify-to-int.html
    fast/js/dfg-mul-big-integers-with-small-integer-and-bitor
    fast/js/dfg-mul-big-integers-with-small-integer-and-detect-overflow
    fast/js/dfg-mul-big-integers-with-small-integer
    fast/js/dfg-value-to-int32-with-side-effects

* fast/js/jsc-test-list: Fix invalid test names by removing
*.html suffix or stray "s" characters.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fix; link against CoreServices.framework instead of against
CoreFoundation.framework directly, to make the linker happy on Lion.

* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Further unreviewed build fix; CFNetwork.framework is the one which Lion
refuses to link against.

* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Misc bugfix and cleaning in sh4 base JIT.
https://bugs.webkit.org/show_bug.cgi?id=115022.

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-04-24
Reviewed by Oliver Hunt.

Remove unused add32() and sub32() with scratchreg parameter to avoid
confusion as this function prototype means another behaviour.
Remove unused "void push(Address)" function which seems quite buggy.

* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::and32): Cosmetic change.
(JSC::MacroAssemblerSH4::lshift32): Cosmetic change.
(JSC::MacroAssemblerSH4::or32): Cosmetic change.
(JSC::MacroAssemblerSH4::xor32): Cosmetic change.
(MacroAssemblerSH4):
(JSC::MacroAssemblerSH4::load32): Cosmetic change.
(JSC::MacroAssemblerSH4::load8Signed): Fix invalid offset upper limit
when using r0 register and cosmetic changes.
(JSC::MacroAssemblerSH4::load8): Reuse load8Signed to avoid duplication.
(JSC::MacroAssemblerSH4::load16): Fix invalid offset upper limit when
using r0 register, fix missing offset shift and cosmetic changes.
(JSC::MacroAssemblerSH4::store32): Cosmetic change.
(JSC::MacroAssemblerSH4::branchAdd32): Store result value before branch.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implementors of CachedResource subclasses should be forced to decide if encoded data can be replaced.
https://bugs.webkit.org/show_bug.cgi?id=115140

Reviewed by Beth Dakin.

No new tests (No behavior change).

This makes mayTryReplaceEncodedData() return false in CachedResource, but overrides to true
in all CachedResource subclasses besides CachedFont (which already has an implementation).

* loader/cache/CachedCSSStyleSheet.h:
* loader/cache/CachedImage.h:
* loader/cache/CachedRawResource.h:
* loader/cache/CachedResource.h:
* loader/cache/CachedSVGDocument.h:
* loader/cache/CachedScript.h:
* loader/cache/CachedShader.h:
* loader/cache/CachedTextTrack.h:
* loader/cache/CachedXSLStyleSheet.h:

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