StylePropertySet: Use subclasses to manage varying object layouts.
<http://webkit.org/b/97470>

Reviewed by Antti Koivisto.

Add two StylePropertySet subclasses:

    - MutableStylePropertySet
    - ImmutableStylePropertySet

The StylePropertySet::m_isMutable bit determines which subclass to cast to when accessing
the property storage. Added mutablePropertyVector() and immutablePropertyArray() helpers
to StylePropertySet (with appropriate assertions.)

This patch removes one heap allocation (and one step of indirection) in the mutable case,
since the Vector<CSSProperty> is no longer heap-allocated, but part of MutableStylePropertySet.

Override RefCounted::deref() in StylePropertySet to make sure that the correct subclass
destructor gets called.

* WebCore.exp.in:
* css/StylePropertySet.cpp:
(WebCore::immutableStylePropertySetSize):
(WebCore::StylePropertySet::createImmutable):
(WebCore::StylePropertySet::immutableCopyIfNeeded):
(WebCore::MutableStylePropertySet::MutableStylePropertySet):
(WebCore::ImmutableStylePropertySet::ImmutableStylePropertySet):
(WebCore::ImmutableStylePropertySet::~ImmutableStylePropertySet):
(WebCore::StylePropertySet::~StylePropertySet):
(WebCore::StylePropertySet::removeProperty):
(WebCore::StylePropertySet::parseDeclaration):
(WebCore::StylePropertySet::addParsedProperties):
(WebCore::StylePropertySet::removePropertiesInSet):
(WebCore::StylePropertySet::removeEquivalentProperties):
(WebCore::StylePropertySet::copy):
(WebCore::StylePropertySet::reportMemoryUsage):
(WebCore::StylePropertySet::append):
(WebCore::StylePropertySet::create):
* css/StylePropertySet.h:
(StylePropertySet):
(WebCore::StylePropertySet::StylePropertySet):
(ImmutableStylePropertySet):
(MutableStylePropertySet):
(WebCore::MutableStylePropertySet::MutableStylePropertySet):
(WebCore::StylePropertySet::mutablePropertyVector):
(WebCore::StylePropertySet::immutablePropertyArray):
(WebCore::StylePropertySet::propertyAt):
(WebCore::StylePropertySet::propertyCount):
(WebCore::StylePropertySet::deref):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] When zooming into an input field take the current zoom level into account.
https://bugs.webkit.org/show_bug.cgi?id=97594

Reviewed by Antonio Gomes.

PR 188751.

Perform the zoom action prior to scroll to avoid breaking scrolling
rules.  Take the current scale into account when calculating the
zoom factor.

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


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129544 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=95397
Need to merge didFirstVisuallyNonEmptyLayout and 
didNewFirstVisuallyNonEmptyLayout
-and corresponding-
<rdar://problem/10791680>

Reviewed by Sam Weinig.

Source/WebCore: 

This patch merges didFirstLayout, didFirstVisuallyNonEmptyLayout, 
and didNewFirstVisuallyNonEmptyLayout. Page keeps track of which 
layout milestones we are interested in with a bit mask, so that 
different ports/clients can opt-into different milestones. This 
will allow us to safely add more layout milestones in the future 
if that seems worthwhile.

Include new file LayoutMilestoneOptions.h
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
by dispatchDidLayout(LayoutMilestoneOptions)
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::dispatchDidLayout):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didLayout):
* loader/FrameLoader.h:
(FrameLoader):
* loader/FrameLoaderClient.h:
(FrameLoaderClient):
(WebCore::FrameLoaderClient::dispatchDidLayout):
* page/LayoutMilestoneOptions.h: Added.
(WebCore):

Check with Page to find out which layout milestones the client is 
interested in, and then dispatch the notifications when 
appropriate.
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks):

Remove setRelevantRepaintedObjectsCounterThreshold(). Instead keep 
track of the layout milestones bit mask.
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::addLayoutMilestones):
(WebCore):
(WebCore::Page::isCountingRelevantRepaintedObjects):
(WebCore::Page::addRelevantRepaintedObject):
* page/Page.h:
(Page):
(WebCore::Page::layoutMilestones):

Source/WebKit/blackberry: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidLayout):
* WebCoreSupport/FrameLoaderClientBlackBerry.h:
(FrameLoaderClientBlackBerry):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::init):

Source/WebKit/chromium: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::dispatchDidLayout):
* src/FrameLoaderClientImpl.h:
(FrameLoaderClientImpl):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* src/WebHelperPluginImpl.cpp:
(WebKit::WebHelperPluginImpl::initPage):
* src/WebPagePopupImpl.cpp:
(WebKit::WebPagePopupImpl::initPage):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):

Source/WebKit/efl: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::dispatchDidLayout):
* WebCoreSupport/FrameLoaderClientEfl.h:
(FrameLoaderClientEfl):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* ewk/ewk_view.cpp:
(_ewk_view_priv_new):

Source/WebKit/gtk: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidLayout):
* WebCoreSupport/FrameLoaderClientGtk.h:
(FrameLoaderClient):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* webkit/webkitwebview.cpp:
(webkit_web_view_init):

Source/WebKit/mac: 

The new API has two parts. First, the client has to opt into which 
layout milestones they are interested in hearing about using 
[WebView _layoutMilestones]. Then, WebKit will call 
the WebFrameLoader delegate's didLayout(WebLayoutMilestones) 
callback when the specified layout milestones have fired. 
didLayout takes the WebLayoutMilestones bit mask, which will 
indicate which milestones have fired since it is possible for two 
to fire at the same time.

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
by dispatchDidLayout(LayoutMilestones)
* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidLayout):

Add new function to the delegate for didLayout.
* WebView/WebDelegateImplementationCaching.h:
(WebFrameLoadDelegateImplementationCache):

We need a delegate template that takes an NSUInteger.
* WebView/WebDelegateImplementationCaching.mm:
(CallDelegate):
(CallFrameLoadDelegate):

Convert between WebCore and WebKit versions of the bit mask.
* WebView/WebView.mm:
(coreLayoutMilestones):
(kitLayoutMilestones):

Add new delegate, and set the appropriate layout milestones in 
WebCore based on old delegates having implementations.
(-[WebView _cacheFrameLoadDelegateImplementations]):

Call into WebCore.
(-[WebView _listenForLayoutMilestones:]):
(-[WebView _layoutMilestones]):
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:

Source/WebKit/qt: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::dispatchDidLayout):
* WebCoreSupport/FrameLoaderClientQt.h:
(FrameLoaderClientQt):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):

Source/WebKit/win: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestoneOptions)
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidLayout):
* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient):

It is now necessary to opt into getting any of the 
"layout milestone" notifications.
* WebView.cpp:
(WebView::initWithFrame):

Source/WebKit/wince: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestones)
* WebCoreSupport/FrameLoaderClientWinCE.cpp:
(WebKit::FrameLoaderClientWinCE::dispatchDidLayout):
* WebCoreSupport/FrameLoaderClientWinCE.h:
(FrameLoaderClientWinCE):

Source/WebKit/wx: 

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality 
is now replaced by dispatchDidLayout(LayoutMilestones)
* WebKitSupport/FrameLoaderClientWx.cpp:
(WebCore::FrameLoaderClientWx::dispatchDidLayout):
* WebKitSupport/FrameLoaderClientWx.h:
(FrameLoaderClientWx):

Source/WebKit2: 

The new API has two parts. First, the client has to opt into which 
layout milestones they are interested in hearing about using 
WKPageListenForLayoutMilestones or 
WKBundlePageListenForLayoutMilestones(). Then, WebKit will call 
the didLayout(WKLayoutMilestones) callback on the appropriate 
clients when the specified layout milestones have fired. didLayout 
takes the WKLayoutMilestones bit mask, which will indicate which 
milestones have fired since it is possible for two to fire at the 
same time.

Define WKLayoutMilestoneOptions.
* Shared/API/c/WKPageLoadTypes.h:

Define conversions between WKLayoutMilestoneOptions and 
WebCore::LayoutMilestoneOptions
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toWKLayoutMilestoneOptions):
(WebKit):
(WebKit::toLayoutMilestoneOptions):

New API.
* UIProcess/API/C/WKPage.cpp:
(WKPageListenForLayoutMilestones):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::didLayout):
(WebKit):
* UIProcess/WebLoaderClient.h:
(WebLoaderClient):

didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, 
and didNewFirstVisuallyNonEmptyLayout are now implemented with 
didLayout under the hood. So if those old callbacks have been 
defined, be sure to add the appropriate layout milestones here for 
backwards-compatibility.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeLoaderClient):

New API.
(WebKit::WebPageProxy::listenForLayoutMilestones):
(WebKit):
(WebKit::WebPageProxy::didLayout):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:

New API. And remove the now-unnecessary 
WKBundlePageSetPaintedObjectsCounterThreshold. 
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageListenForLayoutMilestones):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:

New API.
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::didNewFirstVisuallyNonEmptyLayout):
(WebKit):
(WebKit::InjectedBundlePageLoaderClient::didLayout):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
(InjectedBundlePageLoaderClient):

Remove dispatchDidFirstLayout, 
dispatchDidFirstVisuallyNonEmptyLayout, and 
dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced 
by dispatchDidLayout(LayoutMilestoneOptions)
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidLayout):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient):

didFirstLayoutForFrame, didFirstVisuallyNonEmptyLayoutForFrame, 
and didNewFirstVisuallyNonEmptyLayout are now implemented with 
didLayout under the hood. So if those old callbacks have been 
defined, be sure to add the appropriate layout milestones here for 
backwards-compatibility.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::initializeInjectedBundleLoaderClient):
(WebKit):

Call into WebCore to set the layout milestones.
(WebKit::WebPage::listenForLayoutMilestones):
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebPage/WebPage.messages.in:

Account for the new member of PageLoadClient.
* WebProcess/qt/QtBuiltinBundlePage.cpp:
(WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage):

Tools: 

Account for the new member of the PageLoadClient.
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController awakeFromNib]):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):

The NewFirstVisuallyNonEmptyLayoutForImages has existed for a while, 
but it did not have the right target membership.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

Use new didLayout API instead of old 
didNewFirstVisuallyNonEmptyLayout API.
* TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp:
(TestWebKitAPI):
(TestWebKitAPI::didLayout):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp:
(TestWebKitAPI):
(TestWebKitAPI::didLayout):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages.cpp:
(TestWebKitAPI):
(TestWebKitAPI::didLayout):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames.cpp:
(TestWebKitAPI):
(TestWebKitAPI::didLayout):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::TEST):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use USE(3D_GRAPHICS) in CSS SHADERS code when ENABLE(WEBGL) is true.
https://bugs.webkit.org/show_bug.cgi?id=97543

Patch by Huang Dongsung <luxtella@company100.net> on 2012-09-25
Reviewed by Dean Jackson.

This patch cleans remaining ENABLE(WEBGL) guards in CSS SHADERS code after
r122175, which made USE(3D_GRAPHICS) default to true when ENABLE(WEBGL) is true.

No new tests because of no behavior changes.

* rendering/FilterEffectRenderer.cpp:
(WebCore):
(WebCore::FilterEffectRenderer::build):
* rendering/RenderView.cpp:
(WebCore):
* rendering/RenderView.h:
(WebCore):
(RenderView):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129546 268f45cc-cd09-0410-ab3c-d52691b4dbfc
GraphicsContext3D::compileShader is using incorrect string length in GraphicsContext3DOpenGLCommon.cpp
https://bugs.webkit.org/show_bug.cgi?id=97476

Reviewed by Dean Jackson.

No new tests because it's not testable in webkit test runner.

* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::compileShader):
Use translatedShaderCString.length() instead of translatedShaderSource.length()
for the shader source length because we are using translatedShaderCString.data()
for glShaderSource().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Regression: put beyond vector length prefers prototype setters to sparse properties
https://bugs.webkit.org/show_bug.cgi?id=97593

Reviewed by Geoff Garen & Filip Pizlo.

Source/JavaScriptCore: 

* runtime/JSObject.cpp:
(JSC::JSObject::putByIndexBeyondVectorLength):
    - Check for self properties in the sparse map - if present, don't examine the protochain.

LayoutTests: 

* fast/js/script-tests/array-defineOwnProperty.js:
(Object.defineProperty):
(set Object.defineProperty):
    - Added test case.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove HAVE_SBRK since we never set use_sbrk to true
https://bugs.webkit.org/show_bug.cgi?id=97525
<rdar://problem/12363601>

Reviewed by Geoffrey Garen.

Source/WebKit/blackberry:

* WebCoreSupport/AboutDataHaveFeatures.in: Remove SBRK from list.

Source/WTF:

The code under HAVE(SBRK) has not been used since 2005. We use mmap not sbrk for FastMalloc
not sbrk. We can just remove the define and move all of this code inside #ifndef
WTF_CHANGES.

* wtf/Platform.h:
* wtf/TCSystemAlloc.cpp:
(TCMalloc_SystemAlloc):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Suspend the backingstore while adjusting the view on input field focus.
https://bugs.webkit.org/show_bug.cgi?id=97595

Reviewed by Antonio Gomes.

PR 188751.

Avoid jumpiness when both a scroll and zoom are required to
move an input field into focus by suspending the backingstore.

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


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unused DOMAttrModified from EventsNames and Document::ListenerType
https://bugs.webkit.org/show_bug.cgi?id=97591

Reviewed by Ojan Vafai.

WebKit does not, and will never, fire DOMAttrModified events, so
there's no need to create the "DOMAttrModified" event name.

The only use of the name was to set the DOMATTRMODIFIED_LISTENER bit
on Document; with the name gone, the enum value can be removed as well.

* dom/Document.cpp:
(WebCore::Document::addListenerTypeIfNeeded):
* dom/Document.h: Remove DOMATTRMODIFIED_LISTENER, and switch this
enum to use shift-left instead of hex values, so as to be easier to
update in future.
* dom/EventNames.h:
(WebCore):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Make COMPUTED_GOTO part of the HAVE section
https://bugs.webkit.org/show_bug.cgi?id=97600

Reviewed by Yong Li.

Also get rid of COMPUTED_GOTO_INTERPRETER and add COMPUTED_GOTO_OPCODES.

* WebCoreSupport/AboutDataEnableFeatures.in:
* WebCoreSupport/AboutDataHaveFeatures.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Structure check hoisting phase doesn't know about the side-effecting nature of Arrayify
https://bugs.webkit.org/show_bug.cgi?id=97537

Reviewed by Mark Hahnenberg.

No tests because if we use Arrayify then we also use PutByVal(BlankToXYZ), and the latter is
already known to be side-effecting. So this bug shouldn't have had any symptoms, as far as I
can tell.

* dfg/DFGStructureCheckHoistingPhase.cpp:
(JSC::DFG::StructureCheckHoistingPhase::run):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening, skip failing tests.

* platform/qt-5.0-wk2/Skipped:

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