Adding username to RTCIceServer
https://bugs.webkit.org/show_bug.cgi?id=120861

Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-09-09
Reviewed by Eric Carlson.

No new tests needed. Existing media stream tests already cover it

* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::parseConfiguration):
* platform/mediastream/RTCConfiguration.h:
(WebCore::RTCIceServer::create):
(WebCore::RTCIceServer::username):
(WebCore::RTCIceServer::RTCIceServer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Cancel the current active WebKitAuthenticationRequest on load failed
https://bugs.webkit.org/show_bug.cgi?id=120350

Patch by Anton Obzhirov <a.obzhirov@samsung.com> on 2013-09-09
Reviewed by Carlos Garcia Campos.

The default dialog does not get closed and the authentication is not cancelled
if loading fails or is stopped on a page which requires HTTP authentication.

This patch cancels the authentication request on load failed
and adds new authentication cancelled signal in WebKitAuthenticationRequest
to allow the application handling of authentication UI.

* UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
(authenticationCancelled):
(webkitAuthenticationDialogInitialize):
(webkitAuthenticationDialogDispose):
(webkitAuthenticationDialogNew):
* UIProcess/API/gtk/WebKitAuthenticationDialog.h:
* UIProcess/API/gtk/WebKitAuthenticationRequest.cpp:
(webkit_authentication_request_class_init):
(webkit_authentication_request_cancel):
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkitWebViewAuthenticate):
(webkitWebViewLoadFailed):
(webkitWebViewHandleAuthenticationChallenge):
(webkitWebViewCancelAuthenticationRequest):
* UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
(testWebViewAuthenticationLoadCancelled):
(beforeAll):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MouseLeave not always emitted when cursor leaves subframe
https://bugs.webkit.org/show_bug.cgi?id=121026

Reviewed by Antonio Gomes.

Source/WebCore:

Forward the PlatformMouseEvent in the recursive calls so nested documents
also get a chance to emit mouseleave when the hover moves out.

Test: fast/events/mouseenterleave-on-subframe.html

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):

LayoutTests:

Test or mouseenter/mouseleave events in an inner document. Note this test also
tests bug 120862, but the initial expectations assume that part to fail.

* fast/events/mouseenterleave-on-subframe-expected.html: Added.
* fast/events/mouseenterleave-on-subframe.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155348 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed fixup of expectation name.

* fast/events/mouseenterleave-on-subframe-expected.txt: Renamed from LayoutTests/fast/events/mouseenterleave-on-subframe-expected.html.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] fast/regions/overflow* converted reftests failing after r155114
https://bugs.webkit.org/show_bug.cgi?id=120848

Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-09-09
Reviewed by Antti Koivisto.

The tests are now platform independent by specifing the font.

* fast/regions/overflow-in-uniform-regions-dynamic-expected.html:
* fast/regions/overflow-in-uniform-regions-dynamic.html:
* fast/regions/overflow-in-variable-width-regions-expected.html:
* fast/regions/overflow-in-variable-width-regions.html:
* fast/regions/overflow-moving-below-floats-in-variable-width-regions-expected.html:
* fast/regions/overflow-moving-below-floats-in-variable-width-regions.html:
* fast/regions/overflow-not-moving-below-floats-in-variable-width-regions-expected.html:
* fast/regions/overflow-not-moving-below-floats-in-variable-width-regions.html:
* fast/regions/overflow-rtl-in-variable-width-regions-expected.html:
* fast/regions/overflow-rtl-in-variable-width-regions.html:
* fast/regions/overflow-size-change-in-variable-width-regions-expected.html:
* fast/regions/overflow-size-change-in-variable-width-regions.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MouseEnter and MouseLeave may be emitted on Document nodes
https://bugs.webkit.org/show_bug.cgi?id=120862

Reviewed by Antonio Gomes.

Source/WebCore:

Replace the overgeneric use of Nodes with Elements in updateHoverActiveState.
This also fixes the bug of emitting mouseenter/mouseleave events on Document,
since Document is not an Element.

This is tested by fast/events/mouseenterleave-on-subframe.html

* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):

LayoutTests:

Update expectations now we correctly do not get mouseenter/mouseleave events
targeted for Document nodes.

* fast/events/mouseenterleave-on-subframe-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
matchingShorthandsForLonghand builds map using a giant function
https://bugs.webkit.org/show_bug.cgi?id=121029

Reviewed by Anders Carlsson.

There is no need to use a map for this; a switch statement is fine.
Also, these structures are simple enough that we can build them
every time; we don't need to keep them in globals.

* css/CSSParser.cpp:
(WebCore::CSSParser::addProperty): Got rid of non-helpful local in
CSS_VARIABLES code. Updated for change in return value of the
matchingShorthandsForLonghand.
(WebCore::CSSParser::parseShorthand): Updated for change in return
type of propertiesForInitialization.

* css/CSSProperty.cpp:
(WebCore::StylePropertyMetadata::shorthandID): Updated for change in
return value of matchingShorthandsForLonghand.

* css/StylePropertyShorthand.cpp:
(WebCore::backgroundShorthand): Got rid of local variable, constructing
the StylePropertyShorthand every time.
(WebCore::backgroundPositionShorthand): Ditto.
(WebCore::backgroundRepeatShorthand): Ditto.
(WebCore::borderShorthand): Ditto.
(WebCore::borderAbridgedShorthand): Ditto.
(WebCore::borderBottomShorthand): Ditto.
(WebCore::borderColorShorthand): Ditto.
(WebCore::borderImageShorthand): Ditto.
(WebCore::borderLeftShorthand): Ditto.
(WebCore::borderRadiusShorthand): Ditto.
(WebCore::webkitBorderRadiusShorthand): Ditto.
(WebCore::borderRightShorthand): Ditto.
(WebCore::borderSpacingShorthand): Ditto.
(WebCore::borderStyleShorthand): Ditto.
(WebCore::borderTopShorthand): Ditto.
(WebCore::borderWidthShorthand): Ditto.
(WebCore::listStyleShorthand): Ditto.
(WebCore::fontShorthand): Ditto.
(WebCore::marginShorthand): Ditto. Ditto.
(WebCore::markerShorthand): Ditto.
(WebCore::outlineShorthand): Ditto.
(WebCore::overflowShorthand): Ditto.
(WebCore::paddingShorthand): Ditto.
(WebCore::transitionShorthand): Ditto.
(WebCore::webkitAnimationShorthand): Ditto.
(WebCore::webkitAnimationShorthandForParsing): Ditto.
(WebCore::webkitBorderAfterShorthand): Ditto.
(WebCore::webkitBorderBeforeShorthand): Ditto.
(WebCore::webkitBorderEndShorthand): Ditto.
(WebCore::webkitBorderStartShorthand): Ditto.
(WebCore::webkitColumnsShorthand): Ditto.
(WebCore::webkitColumnRuleShorthand): Ditto.
(WebCore::webkitFlexFlowShorthand): Ditto.
(WebCore::webkitFlexShorthand): Ditto.
(WebCore::webkitMarginCollapseShorthand): Ditto.
(WebCore::webkitGridColumnShorthand): Ditto.
(WebCore::webkitGridRowShorthand): Ditto.
(WebCore::webkitMarqueeShorthand): Ditto.
(WebCore::webkitMaskShorthand): Ditto.
(WebCore::webkitMaskPositionShorthand): Ditto.
(WebCore::webkitMaskRepeatShorthand): Ditto.
(WebCore::webkitTextDecorationShorthand): Ditto.
(WebCore::webkitTextEmphasisShorthand): Ditto.
(WebCore::webkitTextStrokeShorthand): Ditto.
(WebCore::webkitTransitionShorthand): Ditto.
(WebCore::webkitTransformOriginShorthand): Ditto.
(WebCore::widthShorthand): Ditto.
(WebCore::heightShorthand): Ditto.
(WebCore::shorthandForProperty): Ditto.
(WebCore::makeVector): Added. Helper function for the cases in the
switch inside matchingShorthandsForLonghand.
(WebCore::matchingShorthandsForLonghand): Rewrote this to use a switch
instead of a map.
(WebCore::indexOfShorthandForLonghand): Tightened up the coding style a bit.

* css/StylePropertyShorthand.h: Changed type of StylePropertyShorthand's
propertiesForInitialization to be an array of shorthands rather than an
array of pointers to shorthands. Changed return types of the shorthand
functions to return a shorthand object rather than a reference. Did the same
for the other functions.


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

* GNUmakefile.list.am: Typo - left-over \ from a copy/paste, most likely.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes] Heap-buffer-overflow in WebCore::ShapeInterval<float>::subtractShapeIntervals
https://bugs.webkit.org/show_bug.cgi?id=120802

Reviewed by Darin Adler.

Source/WebCore:

Revised the implementation of subtractShapeIntervals() to isloate and check the
places where it dereferences ShapeInterval vector iterators.

Test: fast/shapes/shape-inside/shape-inside-subtract-intervals-crash.html

* rendering/shapes/ShapeInterval.h:
(WebCore::ShapeInterval::subtractShapeIntervals):

LayoutTests:

Added a test case that crashed a bounds-checking runtime prior to this fix.

* fast/shapes/shape-inside/shape-inside-subtract-intervals-crash-expected.html: Added.
* fast/shapes/shape-inside/shape-inside-subtract-intervals-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tighten up EventQueue classes a bit, less indirection and memory allocation
https://bugs.webkit.org/show_bug.cgi?id=121016

Reviewed by Andreas Kling.

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession): Updated since event queue is now
a member rather than an OwnPtr.
(WebCore::MediaKeySession::close): Ditto.
(WebCore::MediaKeySession::keyRequestTimerFired): Ditto.
(WebCore::MediaKeySession::addKeyTimerFired): Ditto.
* Modules/encryptedmedia/MediaKeySession.h: Ditto.

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::closeConnection): Updated since ScriptExecutionContext's
eventQueue function now returns a reference rather than a pointer. Also, the
cancelEvent function takes a reference instead of a pointer.
(WebCore::IDBDatabase::enqueueEvent): Ditto.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::abort): Ditto.
(WebCore::IDBRequest::enqueueEvent): Ditto.
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::enqueueEvent): Ditto.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource): Updated since event queue is now a
member rather than an OwnPtr. Also use initialization instead of assignment
to set up source buffers.
(WebCore::MediaSource::hasPendingActivity): Ditto.
(WebCore::MediaSource::stop): Ditto.
(WebCore::MediaSource::scheduleEvent): Ditto.
* Modules/mediasource/MediaSource.h: Ditto.

* Modules/mediasource/SourceBufferList.cpp:
(WebCore::SourceBufferList::SourceBufferList): Take references instead of
pointers.
(WebCore::SourceBufferList::length): Changed type to unsigned instead of
unsigned long. This is an IDL "unsigned long", which corresponds to "unsigned"
in our C++ DOM implementation.
(WebCore::SourceBufferList::createAndFireEvent): Updated since event queue is
now a reference.
(WebCore::SourceBufferList::scriptExecutionContext): Updated since script
execution context is now a reference.
* Modules/mediasource/SourceBufferList.h: Ditto.

* dom/Document.cpp:
(WebCore::Document::Document): Updated since event queue is now a member rather
than a RefPtr.
(WebCore::Document::detach): Ditto.
(WebCore::Document::enqueueWindowEvent): Ditto.
(WebCore::Document::enqueueDocumentEvent): Ditto.
* dom/Document.h: Ditto.

* dom/DocumentEventQueue.cpp: Renamed DocumentEventQueueTimer to just Timer and
made it a class member of DocumentEventQueue. Also changed it to use references
instead of pointers and removed unneeded ScriptExecutionContext argument.
(WebCore::DocumentEventQueue::DocumentEventQueue): Updated to take a document
reference instead of a script execution context pointer.
(WebCore::DocumentEventQueue::enqueueEvent): Wrote the assertions in a clearer
style and do the assertions even when the queue is closed.
(WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent): Removed the unneeded
ScrollEventTargetType argument, since the policy is specific to the document node.
Made the argument a reference instead of a PassRefPtr, and rewrote the function
to be more straightforward and readable.
(WebCore::DocumentEventQueue::cancelEvent): Use the return value recently added to
the remove function to avoid the need for use of iterators and a find/remove pair.
(WebCore::DocumentEventQueue::pendingEventTimerFired): Rewrote this to use the
recently added ListHashSet takeFirst function. Also protect the document instead
of protecting just this object during the dispatch. Can't really protect the
event queue since it's no longer separately reference counted.
(WebCore::DocumentEventQueue::dispatchEvent): Changed this to take a reference and
added a FIXME about some curious code in here that needs a "why" comment.
* dom/DocumentEventQueue.h: Removed many unneeded includes, some unneeded forward
declarations, marked the class final, made it no longer derive from RefCounted,
removed ScrollEventTargetType and create, and did the other changes mentioned above.

* dom/EventQueue.h: Got rid of many uneeded includes, changed the argument type
of cancelEvent to Event& and rewrote the comment for close.

* dom/GenericEventQueue.cpp:
(WebCore::GenericEventQueue::GenericEventQueue): Updated to take a reference.
(WebCore::GenericEventQueue::enqueueEvent): Ditto.
(WebCore::GenericEventQueue::timerFired): Ditto.
* dom/GenericEventQueue.h: Changed this class to no longer derive from EventQueue
since there was no value coming from that polymorphism. Removed all the virtual
keywords from the class. Switched from pointers to references. Removed the unused
cancelEvent function. Removed the create function since this is always used as a
data member, not a pointer on the heap.

* dom/ScriptExecutionContext.h: Changed the return type of eventQueue to a reference.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Updated since event queue is now a
member rather than an OwnPtr.
(WebCore::HTMLMediaElement::~HTMLMediaElement): Ditto.
(WebCore::HTMLMediaElement::scheduleEvent): Ditto.
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): Ditto.
(WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerKeyAdded): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerKeyError): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerKeyMessage): Ditto.
(WebCore::HTMLMediaElement::mediaPlayerKeyNeeded): Ditto.
(WebCore::HTMLMediaElement::stop): Ditto.
(WebCore::HTMLMediaElement::hasPendingActivity): Ditto.
* html/HTMLMediaElement.h: Ditto.

* page/EventHandler.cpp:
(WebCore::EventHandler::sendScrollEvent): Updated to remove the now-uneeded
ScrollEventTargetType argument, and also to use references instead of pointers.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo): Ditto.
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollTo): Ditto.

* workers/WorkerEventQueue.cpp:
(WebCore::WorkerEventQueue::WorkerEventQueue): Updated to work with references
instead of pointers.
(WebCore::WorkerEventQueue::enqueueEvent): Ditto.
(WebCore::WorkerEventQueue::cancelEvent): Use the take function instead of a
get/remove pair, to eliminate double hashing.
* workers/WorkerEventQueue.h: Removed unneeded includes, forward declarations,
the create function, and the private removeEvent function. Marked class final.

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope): Updated since eventQueue is
now a data member.
(WebCore::WorkerGlobalScope::eventQueue): Ditto.
* workers/WorkerGlobalScope.h: Made m_eventQueue a queue instead of a pointer
to a queue. Also made the eventQueue function private and final.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Begin moving off of TypeTraits.h
https://bugs.webkit.org/show_bug.cgi?id=121006

Reviewed by Darin Adler.

Source/JavaScriptCore:

Convert uses of WTF type traits to STL type traits.

* heap/PassWeak.h:
* runtime/JSCell.h:
(JSC::jsCast):
(JSC::jsDynamicCast):
* runtime/WriteBarrier.h:
(JSC::validateCell):

Source/WebKit2:

Convert uses of WTF type traits to STL type traits.

* Platform/CoreIPC/ArgumentCoder.h:
* Platform/CoreIPC/ArgumentCoders.h:
* Platform/CoreIPC/ArgumentDecoder.h:
* Platform/CoreIPC/ArgumentEncoder.h:
* Platform/CoreIPC/Arguments.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toImpl):

Source/WTF:

The C++11 has its own type traits implementation that is more complete and handles corner cases better
since it ties into the compiler. Begin switching uses of WTF type traits to STL type traits.

* wtf/CheckedArithmetic.h:
* wtf/HashTraits.h:
* wtf/NeverDestroyed.h:
* wtf/OwnPtr.h:
* wtf/PassOwnPtr.h:
(WTF::adoptPtr):
* wtf/RetainPtr.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Preparing WebCore to receive Nix Port
https://bugs.webkit.org/show_bug.cgi?id=118326

Reviewed by Eric Carlson.

Only adding the compilation directives that are Nix specific, in the
existent WebCore files

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::defaultObjectContentType):
* platform/Cursor.h:
* platform/DragData.h:
* platform/DragImage.h:
* platform/FileSystem.h:
* platform/RunLoop.h:
* platform/Widget.h:
* platform/audio/FFTFrame.h:
* platform/audio/HRTFElevation.cpp:
* platform/cairo/WidgetBackingStore.h:
* platform/graphics/ANGLEWebKitBridge.h:
* platform/graphics/FontPlatformData.h:
* platform/graphics/GraphicsContext3D.cpp:
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/OpenGLESShims.h:
* platform/graphics/OpenGLShims.cpp:
(WebCore::getProcAddress):
* platform/graphics/OpenGLShims.h:
* platform/graphics/PlatformLayer.h:
* platform/graphics/cairo/GLContext.cpp:
(WebCore::GLContext::createContextForWindow):
* platform/graphics/cairo/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
* platform/graphics/freetype/FontPlatformDataFreeType.cpp:
* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::createVertexArrayOES):
(WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
(WebCore::Extensions3DOpenGL::isVertexArrayOES):
(WebCore::Extensions3DOpenGL::bindVertexArrayOES):
(WebCore::Extensions3DOpenGL::supportsExtension):
* platform/graphics/opengl/Extensions3DOpenGL.h:
* platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
* platform/graphics/opengl/Extensions3DOpenGLES.h:
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::reshape):
* platform/graphics/texmap/TextureMapper.h:
* plugins/PluginPackage.cpp:
* plugins/PluginView.cpp:
(WebCore::PluginView::PluginView):
* plugins/PluginView.h:
* plugins/PluginViewNone.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Nix upstreaming - Adding stubs and Nix specific platform files
https://bugs.webkit.org/show_bug.cgi?id=118358

Reviewed by Benjamin Poulain.

Basically adding all files that have "Nix" in their names and
are related to WebCore module.

Source/WebCore:

No new tests. They will be uploaded on another patch during the
upstreaming process.

* css/mediaControlsNix.css: Added.
* css/mediaControlsNixFullscreen.css: Added.
* page/nix/EventHandlerNix.cpp: Added.
* platform/graphics/egl/GLContextFromCurrentEGL.cpp: Added.
* platform/graphics/egl/GLContextFromCurrentEGL.h: Added.
* platform/graphics/gstreamer/PlatformVideoWindowNix.cpp: Added.
* platform/graphics/nix/IconNix.cpp: Added.
* platform/graphics/nix/ImageNix.cpp: Added.
* platform/nix/CursorNix.cpp: Added.
* platform/nix/DragDataNix.cpp: Added.
* platform/nix/DragImageNix.cpp: Added.
* platform/nix/GamepadsNix.cpp: Added.
* platform/nix/LanguageNix.cpp: Added.
* platform/nix/LocalizedStringsNix.cpp: Added.
* platform/nix/NixKeyboardUtilities.cpp: Added.
* platform/nix/NixKeyboardUtilities.h: Added.
* platform/nix/PasteboardNix.cpp: Added.
* platform/nix/PlatformKeyboardEventNix.cpp: Added.
* platform/nix/PlatformScreenNix.cpp: Added.
* platform/nix/SoundNix.cpp: Added.
* platform/nix/WidgetNix.cpp: Added.
* platform/text/nix/TextBreakIteratorInternalICUNix.cpp: Added.

Source/WTF:

* wtf/nix/FeatureDefinesNix.h: Added.
* wtf/nix/PlatformNix.h: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Assertion failure in WebCore::Page::checkSubframeCountConsistency when going back
https://bugs.webkit.org/show_bug.cgi?id=119781

Reviewed by Alexey Proskuryakov.

Source/WebCore:

We should pair restoring a cached frame and adding it to FrameTree so that
actual added frame count in FrameTree keeps same with restored frame count.
Otherwise assert failure occurs in Page::CheckSubframeCountConsistency.
We have added cached frames to FrameTree ahead and then restored them by tree travelsal.
But this way doesn't guarantee subframecount of Page and the number of child of FrameTree are equal.
In addition, we still make sure that adding a cached frame to FrameTree should happen
before opening it. Because FrameTree might be used while restoring a cached page.

Test: fast/history/go-back-to-iframe-with-plugin.html

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore):
(WebCore::CachedFrame::open):

LayoutTests:

To verify this fix, we need to use the CachedPage in WK2 debug mode.
And the test page should have at least one iframe with plugin.

* fast/history/go-back-to-iframe-with-plugin-expected.txt: Added.
* fast/history/go-back-to-iframe-with-plugin.html: Added.
* fast/history/resources/subframe-with-plugin.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Moving Add/Remove track from WebMediaStreamCenterClient to WebMediaStream
https://bugs.webkit.org/show_bug.cgi?id=120872

Reviewed by Jer Noble.

Merge https://chromium.googlesource.com/chromium/blink/+/7d740fd27c1f345b59c846df01c3adce53c18e6e
Simple cleanup that makes the API cleaner.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::addRemoteTrack):
(WebCore::MediaStream::removeRemoteTrack):
* platform/mediastream/MediaStreamCenter.cpp:
* platform/mediastream/MediaStreamCenter.h:
* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::removeAudioComponent):
(WebCore::MediaStreamDescriptor::addRemoteTrack):
(WebCore::MediaStreamDescriptor::removeRemoteTrack):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, fix build.

* Modules/encryptedmedia/MediaKeySession.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155363 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Stop means stop
https://bugs.webkit.org/show_bug.cgi?id=120873

Reviewed by Jer Noble.

Merge blink https://chromium.googlesource.com/chromium/blink/+/9a97b0f3892320fa5741485e06a78183b77c3635
by Tommy Widenflycht.

Removing notification functionality from MediaStreamTrack::stop because the world is being torn down.

No new tests, the original author was unable to come up with a reliable test case.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::stop): Don't call didEndTrack, the world is going away.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of isBlockFlowFlexBoxOrGrid().
https://bugs.webkit.org/show_bug.cgi?id=120897

Convert all callers and get rid of this method.

Reviewed by Beth Dakin.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* dom/Position.cpp:
(WebCore::Position::isCandidate):
(WebCore::Position::getInlineBoxAndOffset):
(WebCore::Position::primaryDirection):
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::isCandidate):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
* editing/Editor.cpp:
(WebCore::Editor::baseWritingDirectionForSelectionStart):
* editing/FrameSelection.cpp:
(WebCore::caretRenderer):
* editing/TextIterator.cpp:
(WebCore::TextIterator::shouldRepresentNodeOffsetZero):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::makeEditableRootEmpty):
* editing/htmlediting.cpp:
(WebCore::isBlockFlowElement):
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::collapseMargins):
(WebCore::RenderBlock::selectionGaps):
(WebCore::RenderBlock::firstLineBoxBaseline):
(WebCore::RenderBlock::lastLineBoxBaseline):
(WebCore::RenderBlock::firstLineBlock):
(WebCore::findFirstLetterBlock):
(WebCore::shouldCheckLines):
(WebCore::RenderBlock::adjustForBorderFit):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint):
(WebCore::RenderBox::positionForPoint):
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::canHaveBoxInfoInRegion):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::computeRectForRepaint):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::computeRectForRepaint):
(WebCore::RenderObject::styleWillChange):
(WebCore::firstLineStyleForCachedUncachedType):
* rendering/RenderObject.h:
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::insertChildNode):
* rendering/RenderView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add support for BeforeUnloadEvent interface
https://bugs.webkit.org/show_bug.cgi?id=120849

Reviewed by Darin Adler.

Source/WebCore:

Add support for BeforeUnloadEvent as per the specification:
http://www.whatwg.org/specs/web-apps/current-work/#beforeunloadevent

BeforeUnloadEvent has a returnValue attribute. Setting returnValue to a non-empty
string in an event handler causes the user agent should ask the user to confirm
that they wish to unload the document. This is equivalent to returning a non-empty
string in the EventHandler:
http://www.whatwg.org/specs/web-apps/current-work/#onbeforeunloadeventhandler

BeforeUnloadEvent and returnValue are already supported by IE and Firefox. Previously,
WebKit was passing a base Event type to the beforeunload event handlers instead of
a BeforeUnloadEvent.

Note that this patch keeps support for the legacy Event.returnValue attribute. This used
to be an IE extension but this is no longer supported by IE (nor Firefox). The standard
preventDefault() should be used instead however (supported in IE >= 9).

Test: fast/events/before-unload-returnValue.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* WebCore.order:
* WebCore.vcxproj/WebCore.vcxproj:
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* dom/BeforeUnloadEvent.cpp:
(WebCore::BeforeUnloadEvent::isBeforeUnloadEvent):
(WebCore::BeforeUnloadEvent::~BeforeUnloadEvent):
* dom/BeforeUnloadEvent.h:
(WebCore::BeforeUnloadEvent::create):
(WebCore::BeforeUnloadEvent::returnValue):
(WebCore::BeforeUnloadEvent::setReturnValue):
(WebCore::toBeforeUnloadEvent):
* dom/BeforeUnloadEvent.idl: Added.
* dom/Event.cpp:
(WebCore::Event::isBeforeUnloadEvent):
* dom/Event.h:
(WebCore::Event::legacyReturnValue):
(WebCore::Event::setLegacyReturnValue):
* dom/Event.idl:
* dom/EventNames.in:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::handleBeforeUnloadEvent):

LayoutTests:

Add layout test for validate support for the BeforeUnloadEvent.
Also rebaseline fast/js/global-constructors-attributes.html as
BeforeUnloadEvent is now exposed on the global Window object.

* fast/events/before-unload-returnValue-expected.txt: Added.
* fast/events/before-unload-returnValue.html: Added.
* fast/js/global-constructors-attributes-expected.txt:
* platform/efl/fast/js/global-constructors-attributes-expected.txt:
* platform/gtk/fast/js/global-constructors-attributes-expected.txt:
* platform/mac-lion/fast/js/global-constructors-attributes-expected.txt:
* platform/qt/fast/js/global-constructors-attributes-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move logical(Left|Right)FloatOffsetForLine methods into FloatingObjects
https://bugs.webkit.org/show_bug.cgi?id=120705

Reviewed by Sam Weinig.

These are the only consumers of the CalculateFloatOffsetAdapter and
the placed floats tree, so it will allow us to reduce the public
interface of FloatingObjects and make the placed floats tree private.

No new tests, no behavior change.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::logicalLeftFloatOffsetForLine):
(WebCore::RenderBlock::logicalRightFloatOffsetForLine):
(WebCore::RenderBlock::FloatingObjects::logicalLeftOffset):
(WebCore::RenderBlock::FloatingObjects::logicalRightOffset):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatingObjects::placedFloatsTree):


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