[CSSRegions] Crash when cloning a region child with a content node child
https://bugs.webkit.org/show_bug.cgi?id=129811

Reviewed by David Hyatt.

Source/WebCore:

Collecting the children of a region in another named flow will be supported
again in the future and it will be revisited when we will implement the content
keyword: http://dev.w3.org/csswg/css-regions-1/#the-flow-into-property.
Remove the support for now as it introduces unnecessary complexity in the code
and potential wrong behavior.

Test: fast/regions/region-content-node-child-clone-crash.html

* dom/Element.cpp:
(WebCore::Element::shouldMoveToFlowThread):
(WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):
* dom/Element.h:
* dom/ElementRareData.h:
(WebCore::ElementRareData::ElementRareData):
* rendering/FlowThreadController.cpp:
* rendering/FlowThreadController.h:
* style/StyleResolveTree.cpp:
(WebCore::Style::moveToFlowThreadIfNeeded):
(WebCore::Style::createRendererIfNeeded):

LayoutTests:

Collecting the children of a region in another named flow will be supported
again in the future and it will be revisited when we will implement the content
keyword: http://dev.w3.org/csswg/css-regions-1/#the-flow-into-property.
For now, skip the tests for that use case.

* TestExpectations:
* fast/regions/overflow-region-inline-expected.html: Expected file should not be region based.
* fast/regions/region-content-node-child-clone-crash-expected.txt: Added.
* fast/regions/region-content-node-child-clone-crash.html: Added.
* fast/regions/unsplittable-nested-region-expected.html: Expected file should not be region based.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSRegions] Rename inNamedFlow flag to isNamedFlowContentNode flag
https://bugs.webkit.org/show_bug.cgi?id=130731

Reviewed by Andrei Bucur.

Currently, the inNamedFlow flag in Node class tells if a node is a content node, one that has a style with flow-into.
Since it is used only for those nodes and not propagated through hierarchy, i want to renamed it to a more meaningful name.
No new functionality, no new tests.

* dom/ContainerNode.cpp:
(WebCore::destroyRenderTreeIfNeeded):
* dom/Element.cpp:
(WebCore::Element::~Element):
(WebCore::Element::unregisterNamedFlowContentElement):
* dom/Node.h:
(WebCore::Node::isNamedFlowContentNode):
(WebCore::Node::setIsNamedFlowContentNode):
(WebCore::Node::clearIsNamedFlowContentNode):
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearContentElements):
(WebCore::RenderNamedFlowThread::registerNamedFlowContentElement):
(WebCore::RenderNamedFlowThread::unregisterNamedFlowContentElement):
(WebCore::nextNodeInsideContentElement):
* style/StyleResolveTree.cpp:
(WebCore::Style::attachChildren):
(WebCore::Style::resolveLocal):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL][WK2] Add tests of the set process model API
https://bugs.webkit.org/show_bug.cgi?id=130830

Patch by Maciej Florek <m.florek@samsung.com> on 2014-03-27
Reviewed by Gyuyoung Kim.

Implement unit tests to check, if process model API works
properly. When process model is set to EWK_PROCESS_MODEL_SHARED_SECONDARY,
there should be only one WebProcess. In case of EWK_PROCESS_MODEL_MULTIPLE_SECONDARY
setting, each WebView should have own process, as well as the network process
should exist.

* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
(EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase):
(EWK2UnitTest::EWK2UnitTestBase::SetUp):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h:
* UIProcess/API/efl/tests/test_ewk2_context.cpp:
(EWK2ContextTestMultipleProcesses::EWK2ContextTestMultipleProcesses):
(TEST_F):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Remove unused variable in fast/css-grid-layout/implicit-position-dynamic-change.html
https://bugs.webkit.org/show_bug.cgi?id=130833

Reviewed by Sergio Villar Senin.

* fast/css-grid-layout/implicit-position-dynamic-change.html: Inside
method updateImplicitGridColumn() we define a variable gridItem that
is not used. This patch removes it.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove LayerTreeContextCairo.cpp
https://bugs.webkit.org/show_bug.cgi?id=130807

Reviewed by Martin Robinson.

* Shared/cairo/LayerTreeContextCairo.cpp: Removed.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Returns const reference to static string.
https://bugs.webkit.org/show_bug.cgi?id=130835

Reviewed by Mario Sanchez Prada.

Avoiding some unnecessary copies by returning const reference to static string.

No new tests. No behaviour change.

* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaControl::controlTypeName):
(WebCore::AccessibilityMediaControlsContainer::elementTypeName):
* accessibility/AccessibilityMediaControls.h:

Change-Id: I05357d107c0df944a65c7fb97c8bbdec549202c4

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enable LLVM stackmap liveOuts computation
https://bugs.webkit.org/show_bug.cgi?id=130821

Reviewed by Andy Estes and Sam Weinig.

* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::Record::dump):
* llvm/library/LLVMExports.cpp:
(initializeAndGetJSCLLVMAPI):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Connection::dispatchOneMessage() can be re-entered while handling Cmd-key menu
equivalents, ASSERT(!_data->_keyDownEventBeingResent)
https://bugs.webkit.org/show_bug.cgi?id=130767
<rdar://problem/16307487>

Source/WebCore: 

Added a wrapper for RunLoop::initializeMainThread that also adds modal run loop
mode to it on Mac.

* CMakeLists.txt:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* platform/MainRunLoop.cpp: Added.
(WebCore::initializeMainRunLoop):
* platform/MainRunLoop.h: Added.
* platform/mac/MainRunLoop.mm: Added.
(WebCore::initializeMainRunLoop):

Source/WebKit/mac: 

Reviewed by Darin Adler.

Switched to a WebCore wrapper for RunLoop::initializeMainRunLoop that adds
NSModalPanelRunLoopMode to RunLoop event source and timer modes.

* Carbon/CarbonWindowAdapter.mm: (+[CarbonWindowAdapter initialize]):
* History/WebBackForwardList.mm: (+[WebBackForwardList initialize]):
* History/WebHistoryItem.mm: (+[WebHistoryItem initialize]):
* Misc/WebCache.mm: (+[WebCache initialize]):
* Misc/WebElementDictionary.mm: (+[WebElementDictionary initialize]):
* Misc/WebIconDatabase.mm: (+[WebIconDatabase initialize]):
* Plugins/Hosted/WebHostedNetscapePluginView.mm: (+[WebHostedNetscapePluginView initialize]):
* Plugins/WebBaseNetscapePluginView.mm:
* Plugins/WebBasePluginPackage.mm:
* Plugins/WebNetscapePluginView.mm: (+[WebNetscapePluginView initialize]):
* WebCoreSupport/WebEditorClient.mm: (+[WebUndoStep initialize]):
* WebCoreSupport/WebFrameLoaderClient.mm:
* WebView/WebArchive.mm: (+[WebArchivePrivate initialize]):
* WebView/WebDataSource.mm: (+[WebDataSource initialize]):
* WebView/WebHTMLView.mm:
(+[WebHTMLViewPrivate initialize]):
(+[WebHTMLView initialize]):
* WebView/WebPreferences.mm: (+[WebPreferences initialize]):
* WebView/WebResource.mm: (+[WebResourcePrivate initialize]):
* WebView/WebTextIterator.mm: (+[WebTextIteratorPrivate initialize]):
* WebView/WebView.mm: (+[WebView initialize]):
* WebView/WebViewData.mm: (+[WebViewPrivate initialize]):

Source/WebKit2: 

Reviewed by Darin Adler.

* Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): Added NSModalPanelRunLoopMode
to RunLoop event source and timer modes.

Source/WTF: 

Reviewed by Darin Adler.

Changed RunLoop to wake up and fire timers only in default run loop mode by default,
and added an ability to add more modes (can't use AppKit symbols in WTF).

In addition to this bug, the change also blocks modal alerts from appearing under
menus during menu tracking.

* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::RunLoop):
(WTF::RunLoop::addModeForWakeUpAndTimers):
(WTF::RunLoop::TimerBase::start):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename WKFrameHandle to _WKFrameHandle
https://bugs.webkit.org/show_bug.cgi?id=130847

Reviewed by Tim Horton.

* Shared/API/Cocoa/_WKFrameHandle.h: Renamed from Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.h.
* Shared/API/Cocoa/_WKFrameHandle.mm: Renamed from Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.mm.
(-[_WKFrameHandle dealloc]):
(-[_WKFrameHandle isEqual:]):
(-[_WKFrameHandle hash]):
(-[_WKFrameHandle _frameID]):
(-[_WKFrameHandle copyWithZone:]):
(+[_WKFrameHandle supportsSecureCoding]):
(-[_WKFrameHandle initWithCoder:]):
(-[_WKFrameHandle encodeWithCoder:]):
(-[_WKFrameHandle API::]):
* Shared/API/Cocoa/_WKFrameHandleInternal.h: Renamed from Source/WebKit2/Shared/API/Cocoa/WKFrameHandleInternal.h.
(WebKit::wrapper):
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]):
(-[WKWebProcessPlugInFrame handle]):
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix a crash caused by track insertion after load()
https://bugs.webkit.org/show_bug.cgi?id=130777

Reviewed by Eric Carlson.

Test: media/track/track-insert-after-load-crash.html

Based on the Blink change (patch by acolwell@chromium.org):
https://codereview.chromium.org/211373009/

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute): Remove stale LoadMediaResource flag after explicit load.

LayoutTests:

* media/track/track-insert-after-load-crash-expected.txt: Added.
* media/track/track-insert-after-load-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Correct handling of autogenerated WebInspectorUI files
https://bugs.webkit.org/show_bug.cgi?id=130846

Reviewed by Joseph Pecoraro.

* WebInspectorUI.vcxproj/WebInspectorUIPostBuild.cmd: Files need to be placed in the
'Protocol' subdirectory of the WebInspectorUI directory.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166363 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Operator stretching: expose a math data API
https://bugs.webkit.org/show_bug.cgi?id=130572

Reviewed by Chris Fleizach.

We expose a new SimpleFontData API to give access to the data from the
OpenType MATH table using a font cache. The class OpenTypeMathData will
be implemented in bug 130324. On Darwin platform, we also implement the
missing FontPlatformData::openTypeTable function which will be necessary
to load the OpenType MATH table. The changes are intended to be used
for MathML operator stretching (bug 130322) so tests are not added yet.

* CMakeLists.txt: add new OpenTypeMathData files.
* WebCore.vcxproj/WebCore.vcxproj: ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: ditto.
* WebCore.xcodeproj/project.pbxproj: ditto.
* platform/graphics/FontCache.cpp: We add a FontCache::getMathData function to implement a cache for the math data.
We make the math and vertical data share the same key for the cache.
(WebCore::fontMathDataCacheInstance):
(WebCore::FontCache::getMathData):
(WebCore::fontVerticalDataCacheInstance):
* platform/graphics/FontCache.h: We declare FontCache::getMathData and FontFileKey on all platforms.
* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::openTypeTable): We implement openTypeTable() on Darwin platform.
* platform/graphics/FontPlatformData.h: We expose openTypeTable() on Darwin platform.
* platform/graphics/SimpleFontData.cpp: We initialize m_mathData from the font cache.
(WebCore::SimpleFontData::SimpleFontData):
* platform/graphics/SimpleFontData.h: We expose a mathData() function to access the MATH data.
* platform/graphics/opentype/OpenTypeMathData.cpp: Added. This is a new class that will be used to parse the data from the OpenType MATH table.
(WebCore::OpenTypeMathData::OpenTypeMathData):
* platform/graphics/opentype/OpenTypeMathData.h: Added.
(WebCore::OpenTypeMathData::create):
(WebCore::OpenTypeMathData::hasMathData):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: clearing the console log doesn't update the activity viewer
https://bugs.webkit.org/show_bug.cgi?id=130774

Reviewed by Joseph Pecoraro.

Ensure we take the changes made to the ivars into account on the view.

* UserInterface/Models/DefaultDashboard.js:
(WebInspector.DefaultDashboard.prototype._consoleWasCleared):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up questionable style in ScriptExecutable::prepareForExecutionImpl
https://bugs.webkit.org/show_bug.cgi?id=130845

Reviewed by Filip Pizlo.

There was a hack added to make sure C Loop LLInt worked which included overriding the
global Options::useLLInt setting, which makes no sense to do here. We should put the
update of the global setting in Options::recomputeDependentOptions along with the other
execution engine flags.

* runtime/Executable.cpp:
(JSC::ScriptExecutable::prepareForExecutionImpl):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Provide SPI to disallow remote inspection of a JSContext
https://bugs.webkit.org/show_bug.cgi?id=130853

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-03-27
Reviewed by Timothy Hatcher.

* API/JSContextPrivate.h: Added.
* API/JSContext.mm:
(-[JSContext _remoteInspectionEnabled]):
(-[JSContext _setRemoteInspectionEnabled:]):
ObjC SPI to enable/disable remote inspection.

* API/JSContextRefPrivate.h:
* API/JSContextRef.cpp:
(JSGlobalContextGetRemoteInspectionEnabled):
(JSGlobalContextSetRemoteInspectionEnabled):
C SPI to enable/disable remote inspection.

* JavaScriptCore.xcodeproj/project.pbxproj:
Add new private header, and export as a private header.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove comment from Filter.h
https://bugs.webkit.org/show_bug.cgi?id=130848

Reviewed by Simon Fraser.

Exploring the use of consts on applyScale() methods didn't yield
good results.

No new tests, no change on behavior.

* platform/graphics/filters/Filter.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove some unnecessary branches from LiveNodeList traversal
https://bugs.webkit.org/show_bug.cgi?id=130854

Reviewed by Andreas Kling.

Compile different traversal code paths for all NodeList subclasses.

* dom/ClassNodeList.cpp:
(WebCore::ClassNodeList::ClassNodeList):
(WebCore::ClassNodeList::~ClassNodeList):
(WebCore::ClassNodeList::nodeMatches): Deleted.
* dom/ClassNodeList.h:
(WebCore::ClassNodeList::nodeMatches):
(WebCore::ClassNodeList::nodeMatchesInlined): Deleted.
        
    Remove separate nodeMatchesInlined functions. 
    We now rely on exact types and marking classes final.

* dom/LiveNodeList.cpp:
(WebCore::LiveNodeList::LiveNodeList):
(WebCore::LiveNodeList::~LiveNodeList):
(WebCore::LiveNodeList::namedItem):
(WebCore::LiveNodeList::rootNode): Deleted.
(WebCore::isMatchingElement): Deleted.
(WebCore::firstMatchingElement): Deleted.
(WebCore::lastMatchingElement): Deleted.
(WebCore::nextMatchingElement): Deleted.
(WebCore::previousMatchingElement): Deleted.
(WebCore::traverseMatchingElementsForward): Deleted.
(WebCore::traverseMatchingElementsBackward): Deleted.
(WebCore::LiveNodeList::collectionFirst): Deleted.
(WebCore::LiveNodeList::collectionLast): Deleted.
(WebCore::LiveNodeList::collectionTraverseForward): Deleted.
(WebCore::LiveNodeList::collectionTraverseBackward): Deleted.
(WebCore::LiveNodeList::length): Deleted.
(WebCore::LiveNodeList::item): Deleted.
(WebCore::LiveNodeList::memoryCost): Deleted.
(WebCore::LiveNodeList::invalidateCache): Deleted.
* dom/LiveNodeList.h:
(WebCore::LiveNodeList::invalidateCacheForAttribute):
(WebCore::CachedLiveNodeList::collectionCanTraverseBackward):
(WebCore::LiveNodeList::rootNode):
(WebCore::CachedLiveNodeList<NodeListType>::CachedLiveNodeList):
        
    Add CachedLiveNodeList<NodeListType> utility type that interfaces with CollectionIndexCache.
    It is the base class for all concrete LiveNodeLists.

(WebCore::CachedLiveNodeList<NodeListType>::~CachedLiveNodeList):
(WebCore::CachedLiveNodeList<NodeListType>::collectionFirst):
(WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
(WebCore::nextMatchingElement):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
(WebCore::previousMatchingElement):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
(WebCore::CachedLiveNodeList<NodeListType>::willValidateIndexCache):
(WebCore::CachedLiveNodeList<NodeListType>::invalidateCache):
(WebCore::CachedLiveNodeList<NodeListType>::length):
(WebCore::CachedLiveNodeList<NodeListType>::item):
(WebCore::CachedLiveNodeList<NodeListType>::memoryCost):
        
    Templated code moves to header.

(WebCore::LiveNodeList::LiveNodeList): Deleted.
(WebCore::LiveNodeList::~LiveNodeList): Deleted.
(WebCore::LiveNodeList::invalidateCache): Deleted.
(WebCore::LiveNodeList::collectionCanTraverseBackward): Deleted.
(WebCore::LiveNodeList::willValidateIndexCache): Deleted.
* dom/NameNodeList.cpp:
(WebCore::NameNodeList::NameNodeList):
* dom/NameNodeList.h:
* dom/Node.cpp:
(WebCore::Document::invalidateNodeListAndCollectionCaches):
(WebCore::NodeListsNodeData::invalidateCaches):
* dom/TagNodeList.cpp:
(WebCore::TagNodeList::TagNodeList):
(WebCore::HTMLTagNodeList::HTMLTagNodeList):
(WebCore::HTMLTagNodeList::~HTMLTagNodeList):
(WebCore::TagNodeList::nodeMatches): Deleted.
(WebCore::HTMLTagNodeList::nodeMatches): Deleted.
* dom/TagNodeList.h:
(WebCore::TagNodeList::nodeMatches):
(WebCore::HTMLTagNodeList::nodeMatches):
(WebCore::TagNodeList::create): Deleted.
(WebCore::HTMLTagNodeList::nodeMatchesInlined): Deleted.
* html/LabelsNodeList.cpp:
(WebCore::LabelsNodeList::LabelsNodeList):
* html/LabelsNodeList.h:
* html/RadioNodeList.cpp:
(WebCore::RadioNodeList::RadioNodeList):
* html/RadioNodeList.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166369 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add reload and reloadFromOrigin as API
https://bugs.webkit.org/show_bug.cgi?id=130858

Reviewed by Simon Fraser.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView reload]):
(-[WKWebView reloadFromOrigin]):
(-[WKWebView validateUserInterfaceItem:]):
(-[WKWebView reload:]):
(-[WKWebView reloadFromOrigin:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Give WebProcess a proxy application entitlement
https://bugs.webkit.org/show_bug.cgi?id=130806

Reviewed by Timothy Hatcher.

* Configurations/WebContent-iOS.entitlements:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix crash when RenderView is cleared inside of frame flattening layout
https://bugs.webkit.org/show_bug.cgi?id=130864

Reviewed by Dan Bernstein.

Navigating on http://wallstcheatsheet.com pages on iOS in WebKit1 would
sometimes crash when, inside the inChildFrameLayoutWithFrameFlattening clause,
our frame's RenderView would be null after doing a layout from the root frame,
possibly also when WebCore was being re-entered from another thread.

Add a null check to fix this.

Crash was timing-dependent and hard to test.

* page/FrameView.cpp:
(WebCore::FrameView::layout):

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