[Mac] Unable to select 'Off' or 'Auto' from track menu when tracks consist of unsupported track types
https://bugs.webkit.org/show_bug.cgi?id=131908
<rdar://problem/15999882>

Reviewed by Eric Carlson.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setSelectedTextTrack): When the user selects 'Off', make sure the currently 'showing'
track is switched to 'disabled'.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ScriptExecutionContext::stopActiveDOMObjects iterates a hash map that can change during iteration (for multiple reasons, including GC)
https://bugs.webkit.org/show_bug.cgi?id=52719

Reviewed by Alexey Proskuryakov.

At least two specific ways this can happen:

1) XMLHttpRequest::stop can trigger a JavaScript garbage collection.
2) NotificationCenter::stop can delete the last references to notifications;
   those notifications are also active DOM objects.

Besides fixing the iteration in that function, did some other fixes for the
ScriptExecutionContext class, including some coding style changes. Many uses
of nullptr instead of 0, without listing each function separately below.

* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::contextDestroyed): Call through to the base class
version of contextDestroyed rather than repeating what it does (with a large
comment that doesn't acknowledge the base class alread does it).
* Modules/webdatabase/DatabaseContext.h: Removed some unneeded includes.
Wrote out "private" explicitly for deriving from ActiveDOMObject. Made the
ActiveDOMObject function overrides private, and marked them override and final.

* dom/ActiveDOMObject.h: Updated comments. Replaced suspendIfNeededCalled with
assertSuspendIfNeededWasCalled, which has an empty inline version in the header.
Renamed m_suspendIfNeededCalled to m_suspendIfNeededWasCalled.

* dom/ActiveDOMObject.cpp:
(WebCore::ActiveDOMObject::ActiveDOMObject): Pass a reference instead of a pointer.
(WebCore::ActiveDOMObject::~ActiveDOMObject): Ditto.
(WebCore::ActiveDOMObject::suspendIfNeeded): Ditto.

* dom/ContextDestructionObserver.cpp:
(WebCore::ContextDestructionObserver::observeContext): Pass a reference instead of a pointer.

* dom/MessagePort.cpp:
(WebCore::MessagePort::MessagePort): Pass a reference instead of a pointer.
(WebCore::MessagePort::~MessagePort): Ditto.
(WebCore::MessagePort::disentangle): Ditto.

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::ScriptExecutionContext): Updated flags used
for assertions so they are conditional and updated their names.
(WebCore::takeAny): Added. Helper function that we can consider for HashSet in
the future; makes loop below easier to read.
(WebCore::checkConsistency): Added. Assertions that were done multiple places below,
and should not be written over and over again.
(WebCore::ScriptExecutionContext::~ScriptExecutionContext): Changed to use C++11
for loops and the takeAny function above.
(WebCore::ScriptExecutionContext::dispatchMessagePortEvents): Ditto.
(WebCore::ScriptExecutionContext::createdMessagePort): Changed to take a reference
for clarity and so it doesn't have to do an assert the pointer is non-null.
(WebCore::ScriptExecutionContext::destroyedMessagePort): Ditto.
(WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects): Changed to use
C++11 for loop and reworded comment and redid assertions.
(WebCore::ScriptExecutionContext::suspendActiveDOMObjects): Ditto.
(WebCore::ScriptExecutionContext::resumeActiveDOMObjects): Ditto.
(WebCore::ScriptExecutionContext::stopActiveDOMObjects): Changed to support
removal of an active DOM object during the stop function. Included new comments
to clarify what the rules are.
(WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded): Changed to take
a reference for clarity and so it doesn't have to assert a pointer is non-null.
(WebCore::ScriptExecutionContext::didCreateActiveDOMObject): Ditto. Also changed to
use RELEASE_ASSERT instead of CRASH.
(WebCore::ScriptExecutionContext::willDestroyActiveDOMObject): Ditto.
(WebCore::ScriptExecutionContext::didCreateDestructionObserver): Ditto.
(WebCore::ScriptExecutionContext::willDestroyDestructionObserver): Ditto.
(WebCore::ScriptExecutionContext::closeMessagePorts): Moved the body of this
function into its one call site, ScriptExecutionContext::stopActiveDOMObjects,
since it's simple enough when written as a C++11 for loop.
(WebCore::ScriptExecutionContext::hasPendingActivity): Added. This function was
already exported for workers, and implementing it outside this class required
exposing the private HashSet members; more sensible to implement it here and
simply make it public in WorkerGlobalScope.

* dom/ScriptExecutionContext.h: Removed unnecessary includes and forward declarations.
Removed a long-ago-fixed FIXME. Changed various functions to take references instead of
pointers. Added a protected hasPendingActivity function, deleted the closeMessagePorts
function, deleted the ActiveDOMObjectsSet typedef, made the assertion flags be
!ASSERT_DISABLED only, and deleted the messagePorts and activeDOMObjects functions.

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::hasPendingActivity): Deleted. This is now implemented
in the base class.

* workers/WorkerGlobalScope.h: Make hasPendingActivity function from the base class
public instead of declaring it in this class.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simple layout can get confused by coordinate overflow
https://bugs.webkit.org/show_bug.cgi?id=131890
rdar://problem/15558510

Reviewed by Andreas Kling.

Source/WebCore:
Test: fast/css/simple-layout-overflow.html

* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::rangeForRect):
If lastLine is smaller than firstList, just ignore it.

LayoutTests:
* fast/css/simple-layout-overflow-expected.txt: Added.
* fast/css/simple-layout-overflow.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix typo in change log

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Subpixel rendering: RenderLayer's size is set using enclosingRect() which can result in cruft.
https://bugs.webkit.org/show_bug.cgi?id=131468

Reviewed by Darin Adler.

Layers marked opaque may not paint edge pixels, when RenderLayer bounds are non-integral and
get device pixel snapped.
For details see this: https://trac.webkit.org/r159463

Source/WebCore:
Test: compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

LayoutTests:
* compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background-expected.html: Added.
* compositing/hidpi-non-simple-compositing-layer-with-fractional-size-and-background.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Expando properties on attribute nodes disappear
https://bugs.webkit.org/show_bug.cgi?id=88045

* TestExpectations:
* platform/efl/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
Consolidated test expectations, because all ports are equally affected. Some
platforms accidentally start to pass this test sometimes, but there is no real fix yet.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add Element.matches, the standard name for webkitMatchesSelector
https://bugs.webkit.org/show_bug.cgi?id=131922

Reviewed by Andreas Kling.


Source/WebCore: 
This patch just renames webkitMatchesSelector() to matches().

* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateImplementation):
The Objective-C binding generator only supported ImplementedAs for getters and setters.
This adds support for the option so that Element.matches can be generated for Obj-C.

* dom/Element.cpp:
(WebCore::Element::matches):
(WebCore::Element::webkitMatchesSelector): Deleted.
* dom/Element.h:
* dom/Element.idl:
* inspector/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):

LayoutTests: 
Update the tests to verify both Element.matches and Element.webkitMatchesSelector

* fast/dom/SelectorAPI/attrname-case-insensitive-expected.txt:
* fast/dom/SelectorAPI/attrname-case-insensitive.html:
* fast/dom/SelectorAPI/attrname-case-sensitive-expected.txt:
* fast/dom/SelectorAPI/attrname-case-sensitive.xhtml:
* fast/dom/SelectorAPI/caseID-almost-strict-expected.txt:
* fast/dom/SelectorAPI/caseID-almost-strict.html:
* fast/dom/SelectorAPI/caseID-expected.txt:
* fast/dom/SelectorAPI/caseID-strict-expected.txt:
* fast/dom/SelectorAPI/caseID-strict.html:
* fast/dom/SelectorAPI/caseID.html:
* fast/dom/SelectorAPI/caseTag-expected.txt:
* fast/dom/SelectorAPI/caseTag.html:
* fast/dom/SelectorAPI/caseTagX-expected.txt:
* fast/dom/SelectorAPI/caseTagX.xhtml:
* fast/dom/SelectorAPI/detached-element-expected.txt:
* fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt:
* fast/dom/SelectorAPI/not-supported-namespace-in-selector.html:
* fast/dom/SelectorAPI/script-tests/detached-element.js:
* fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js:
* fast/dom/SelectorAPI/script-tests/viewless-document.js:
* fast/dom/SelectorAPI/undefined-null-stringify-expected.txt:
* fast/dom/SelectorAPI/viewless-document-expected.txt:
* fast/forms/radio/radio-live-validation-style-expected.txt:
* fast/forms/radio/radio-live-validation-style.html:
* fast/harness/results.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Compile the :root pseudo class and fix a related issue with :nth-child()
https://bugs.webkit.org/show_bug.cgi?id=131926

Reviewed by Andreas Kling.


Source/WebCore: 
Add the :root pseudo class. This is another trivial selector, we just need to compare
the element pointer with the documentElement.

I discovered some issues with :nth-child(n) through the layout tests for ":root".
When the pseudo class nth-child could match anything, no code was generated. That decision
was taken when generating the fragments.

The specification of :nth-child() has two tests: the parent test and the counter test.
Since some fragments would not generate any code for :nth-child(n), they would succeed on the root,
which is incorrect since the root should fail the parent test.

This was fixed by moving the filtering of non-counting :nth-child() after we generate the parent
check.
We still don't generate any counter test unless required.

Test: fast/selectors/nth-child-on-root.html

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsRoot):
* dom/Document.h:
(WebCore::Document::documentElementMemoryOffset):

LayoutTests: 
Add more test coverage that would have caught the bug with :nth-child(n).

* fast/selectors/nth-child-on-root-expected.txt: Added.
* fast/selectors/nth-child-on-root.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] Remove interfaces in the To Be Removed groups
https://bugs.webkit.org/show_bug.cgi?id=131925

Reviewed by Darin Adler.

* Shared/API/Cocoa/WKRemoteObjectInterface.h: Removed.
* Shared/API/Cocoa/WKRemoteObjectInterface.mm: Removed.
* Shared/API/Cocoa/WKRemoteObjectRegistry.h: Removed.
* Shared/API/Cocoa/WKRemoteObjectRegistry.mm: Removed.
* UIProcess/API/Cocoa/WKProcessPool.mm:
* UIProcess/API/Cocoa/WKProcessPoolConfiguration.h: Removed.
* UIProcess/API/Cocoa/WKProcessPoolConfiguration.mm: Removed.
* UIProcess/API/Cocoa/WKProcessPoolConfigurationPrivate.h: Removed.
* UIProcess/API/Cocoa/WKProcessPoolToBeRemoved.mm: Removed.
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInBrowserContextControllerToBeRemoved.mm: Removed.
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextControllerPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Blind Windows build fix. Hope I guessed the 64-bit mangled form right.

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

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