WTF fails to compile with gcc 4.8.2 and -Werror=array-bounds
https://bugs.webkit.org/show_bug.cgi?id=125936

Reviewed by Anders Carlsson.

* wtf/dtoa/double-conversion.cc: Use a unsigned instead of int on buffer_pos type.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/15696824> [CFNetwork] Loading stops at server redirects
https://bugs.webkit.org/show_bug.cgi?id=125984

Reviewed by Anders Carlsson.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::willSendRequest): If the client uses async callbacks, call its
willSendRequestAsync callback instead if willSendRequest.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improve "bad parent" and "bad child list" assertions in line boxes
https://bugs.webkit.org/show_bug.cgi?id=125656

Reviewed by Sam Weinig.

* rendering/InlineBox.cpp:
(WebCore::InlineBox::root): Use parent() function with assertions rather than
using m_parent function, which skips the assertions.
* rendering/RenderText.cpp:
(WebCore::RenderText::removeAndDestroyTextBoxes): Call invalidateParentChildLists
if we are in the optimized document-destruction code path and destroying children
without removing them from their parents.
* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::invalidateParentChildLists): Added.
* rendering/RenderTextLineBoxes.h: Added invalidateParentChildLists.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WTF, JavaScriptCore fails to build with trunk clang: operators new, new[],
delete, delete[] cannot be declared inline
https://bugs.webkit.org/show_bug.cgi?id=124186
<rdar://problem/15644039>

Reviewed by Geoffrey Garen and Anders Carlsson.

Following <http://llvm.org/viewvc/llvm-project?view=revision&revision=193044>
(http://llvm.org/bugs/show_bug.cgi?id=17591>), Clang emits warnings when
operator new, delete are inlined. Such definitions cannot be inline per
replacement.functions (17.6.4.6/3) of the C++ standard. For now,
disable these warnings instead of exporting these functions.

* wtf/FastMalloc.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for platforms which do not define -[AVSampleBufferAudioRenderer muted].
Rubber-stamped by Eric Carlson.

To work around platforms with broken AVSampleBufferAudioRenderer headers, just
declare only those functions we need, and update isAvalable to bail out early if
those methods are not present.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
platform/mac/editing/attributed-string tests all flakily assert
https://bugs.webkit.org/show_bug.cgi?id=123029

* platform/mac/TestExpectations: Marked as flakily asserting.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Upstream WebCore/loader changes
https://bugs.webkit.org/show_bug.cgi?id=125879

Reviewed by Darin Adler.

* WebCore.exp.in: Added symbols for MemoryCache::{addImageToCache, removeImageFromCache}().
* loader/DocumentLoader.cpp:
(WebCore::areAllLoadersPageCacheAcceptable): Added.
(WebCore::DocumentLoader::DocumentLoader): Initialize m_subresourceLoadersArePageCacheAcceptable.
(WebCore::DocumentLoader::stopLoading): Modified to conditionally call areAllLoadersPageCacheAcceptable().
(WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Modified to query FrameLoader::loadsSynchronously()
whether to load substitute data immediately or to schedule a load.
(WebCore::DocumentLoader::responseReceived): Modified to create a content filer when the response protocol
is either HTTP or HTTPS, assuming content filtering is enabled.
(WebCore::DocumentLoader::dataReceived): Modified to call DocumentLoader::setContentFilterForBlockedLoad()
as appropriate.
(WebCore::DocumentLoader::clearMainResourceLoader): Added PLATFORM(IOS)-guarded code. Also added a
FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
(WebCore::DocumentLoader::setResponseMIMEType): Added; guard by PLATFORM(IOS). Also added FIXME comment.
(WebCore::DocumentLoader::startLoadingMainResource): Added PLATFORM(IOS)-guarded code. Also added a
FIXME comment to remove the PLATFORM(IOS)-guard once we upstream the iOS changes to ResourceRequest.h.
I also substituted static NeverDestroyed<> for DEFINE_STATIC_LOCAL.
(WebCore::DocumentLoader::setContentFilterForBlockedLoad): Added; guarded by USE(CONTENT_FILTERING).
(WebCore::DocumentLoader::handleContentFilterRequest): Added; guarded by USE(CONTENT_FILTERING) and PLATFORM(IOS).
Also added a FIXME comment to remove the PLATFORM(IOS) guard inside its function body once we upstream
file ContentFilterIOS.mm and implement ContentFilter::requestUnblockAndDispatchIfSuccessful() for Mac.
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setResponse): Added; guard by PLATFORM(IOS). Also added a FIXME comment as
this method seems to violate the encapsulation of DocumentLoader.
(WebCore::DocumentLoader::subresourceLoadersArePageCacheAcceptable): Added.
(WebCore::DocumentLoader::documentURL): Added; returns the URL of the document resulting from the DocumentLoader.
* loader/DocumentWriter.cpp:
(WebCore::DocumentWriter::createDocument): Added iOS-specific code to create a PDF document.
* loader/EmptyClients.cpp:
(WebCore::EmptyChromeClient::openDateTimeChooser): Opt out of compiling this code for iOS. Also substituted
nullptr for 0.
* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameProgressTracker::~FrameProgressTracker):
(WebCore::FrameLoader::FrameLoader): Initialize m_loadsSynchronously.
(WebCore::FrameLoader::initForSynthesizedDocument): Added; guarded by PLATFORM(IOS). Also added FIXME comment.
(WebCore::FrameLoader::checkCompleted): Added iOS-specific code with FIXME comment.
(WebCore::FrameLoader::willLoadMediaElementURL): Added iOS-specific code.
(WebCore::FrameLoader::stopForUserCancel): Added iOS-specific code and FIXME comment.
(WebCore::FrameLoader::commitProvisionalLoad): Added iOS-specific code and FIXME comment.
(WebCore::FrameLoader::transitionToCommitted): Opt out of ENABLE(TOUCH_EVENTS) logic when building for iOS.
(WebCore::FrameLoader::didFirstLayout): Added iOS-specific code.
(WebCore::FrameLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
(WebCore::createWindow): Added iOS-specific code and FIXME comment.
* loader/FrameLoader.h:
(WebCore::FrameLoader::setLoadsSynchronously): Added.
(WebCore::FrameLoader::loadsSynchronously): Added.
* loader/FrameLoaderClient.h:
* loader/HistoryController.cpp:
(WebCore::HistoryController::restoreScrollPositionAndViewState): Opt out of scroll position logic when building for iOS.
(WebCore::HistoryController::replaceCurrentItem): Added.
* loader/HistoryController.h:
* loader/PlaceholderDocument.h: Changed access control of constructor from private to protected and removed the FINAL
keyword from the class so that we can subclass PlaceholderDocument on iOS.
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy): Added USE(QUICK_LOOK)- and USE(CONTENT_FILTERING)-guarded code.
* loader/ResourceBuffer.cpp:
(WebCore::ResourceBuffer::shouldUsePurgeableMemory): Added; guarded by PLATFORM(IOS).
* loader/ResourceBuffer.h:
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest): Added USE(QUICK_LOOK)-guarded code.
* loader/ResourceLoadScheduler.cpp:
(WebCore::ResourceLoadScheduler::scheduleSubresourceLoad): Added iOS-specific code.
(WebCore::ResourceLoadScheduler::scheduleLoad): Ditto.
(WebCore::ResourceLoadScheduler::remove): Added iOS-specific code with FIXME comment.
(WebCore::ResourceLoadScheduler::crossOriginRedirectReceived): Added null-check for variable oldHost. Also added
iOS-specific code.
(WebCore::ResourceLoadScheduler::servePendingRequests): Added iOS-specific code.
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::init): Ditto.
(WebCore::ResourceLoader::willSendRequest): Ditto.
(WebCore::ResourceLoader::connectionProperties): Added; guarded by PLATFORM(IOS).
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
(WebCore::ResourceLoader::iOSOriginalRequest): Added; iOS-specific.
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadPlugin): Added iOS-specific code.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::create): Ditto.
(WebCore::SubresourceLoader::startLoading): Added; guarded by PLATFORM(IOS).
(WebCore::SubresourceLoader::didFinishLoading): Added iOS-specific code.
(WebCore::SubresourceLoader::willCancel): Ditto.
(WebCore::SubresourceLoader::notifyDone): Ditto.
(WebCore::SubresourceLoader::releaseResources): Ditto.
* loader/SubresourceLoader.h:
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::loadCacheGroup): Added iOS-specific code.
(WebCore::ApplicationCacheStorage::loadManifestHostHashes): Ditto.
(WebCore::ApplicationCacheStorage::cacheGroupForURL): Ditto.
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL): Ditto.
(WebCore::ApplicationCacheStorage::calculateQuotaForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::calculateUsageForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache): Ditto.
(WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): Ditto.
(WebCore::ApplicationCacheStorage::executeSQLCommand): Ditto.
(WebCore::ApplicationCacheStorage::verifySchemaVersion): Ditto.
(WebCore::ApplicationCacheStorage::openDatabase): Ditto.
(WebCore::ApplicationCacheStorage::executeStatement): Ditto.
(WebCore::ApplicationCacheStorage::store): Ditto.
(WebCore::ApplicationCacheStorage::storeUpdatedType): Ditto.
(WebCore::ApplicationCacheStorage::ensureOriginRecord): Ditto.
(WebCore::ApplicationCacheStorage::loadCache): Ditto.
(WebCore::ApplicationCacheStorage::remove): Ditto.
(WebCore::ApplicationCacheStorage::empty): Ditto.
(WebCore::ApplicationCacheStorage::storeCopyOfCache): Ditto.
(WebCore::ApplicationCacheStorage::manifestURLs): Ditto.
(WebCore::ApplicationCacheStorage::cacheGroupSize): Ditto.
(WebCore::ApplicationCacheStorage::deleteCacheGroup): Ditto.
(WebCore::ApplicationCacheStorage::vacuumDatabaseFile): Ditto.
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::CachedImage): Added.
(WebCore::CachedImage::imageSizeForRenderer): Added iOS-specific code.
(WebCore::CachedImageManual::CachedImageManual): Added; guarded by USE(CF). Also added FIXME comment to incorporate
the functionality of this class into CachedImage and to remove the USE(CF)-guard once we make MemoryCache::addImageToCache()
platform-independent.
(WebCore::CachedImageManual::mustRevalidateDueToCacheHeaders): Added; guarded by USE(CF).
* loader/cache/CachedImage.h: Removed FINAL keyword from class so that we can define derived class CachedImageManual.
(WebCore::CachedImage::isManual): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::CachedImageManual::addFakeClient): Added; guarded by USE(CF).
(WebCore::CachedImageManual::removeFakeClient): Added; guarded by USE(CF).
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load): Added iOS-specific code.
* loader/cache/CachedResource.h:
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::loadDone): Added argument shouldPerformPostLoadActions, defaults to true. Modified
to conditionally call performPostLoadActions() with respect to the argument shouldPerformPostLoadActions.
(WebCore::CachedResourceLoader::preload): Added iOS-specific code.
(WebCore::CachedResourceLoader::checkForPendingPreloads): Ditto.
* loader/cache/CachedResourceLoader.h:
* loader/cache/MemoryCache.cpp:
(WebCore::memoryCache):
(WebCore::MemoryCache::add): Added iOS-specific code.
(WebCore::MemoryCache::revalidationFailed): Ditto.
(WebCore::MemoryCache::resourceForRequest): Ditto.
(WebCore::MemoryCache::addImageToCache): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::MemoryCache::removeImageFromCache): Added; guarded by USE(CF). Also added FIXME comment.
(WebCore::MemoryCache::pruneLiveResources): Modified to take argument shouldDestroyDecodedDataForAllLiveResources.
(WebCore::MemoryCache::pruneLiveResourcesToSize): Modified to take argument shouldDestroyDecodedDataForAllLiveResources,
defaults to false. When this argument is true we destroy the decoded data for all live resources from the memory cache.
Such functionality is useful when the system is running low on memory.
(WebCore::MemoryCache::evict): Added iOS-specific code.
* loader/cache/MemoryCache.h:
* loader/cf/SubresourceLoaderCF.cpp:
(WebCore::SubresourceLoader::didReceiveDataArray): Actually make this code compile. In particular, there is no
method called sendDataToResource on SubresourceLoader or in its class hierarchy.
* loader/mac/DocumentLoaderMac.cpp:
(WebCore::DocumentLoader::schedule): This method has an empty implementation when building for iOS.
(WebCore::DocumentLoader::unschedule): Ditto.
* platform/graphics/BitmapImage.h: Exposed decodedSize() to access the decoded size of the bitmap image.
This functionality is used in MemoryCache::addImageToCache().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160841 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[ATK] [WK2] platform/gtk/accessibility/roles-exposed.html is failing
https://bugs.webkit.org/show_bug.cgi?id=125854

Reviewed by Chris Fleizach.

Tools:

Ensure we don't ever create instances of AccessibilityUIElement
wrapping invalid platform-specific accessibility objects in DRT,
both for consistency with what WKTR does (so we avoid situations
where some tests fail in WK2 and not in WK1) and also to avoid
overlooking tests that might not be checking the right thing.

* DumpRenderTree/AccessibilityUIElement.cpp:
(AccessibilityUIElement::makeJSAccessibilityUIElement): Return a
nullPtr if the platformUIElement() is not a valid one.
* DumpRenderTree/AccessibilityUIElement.h:
(AccessibilityUIElement::platformUIElement): Added const modifier.

LayoutTests:

Updated tests and expectations to keep them passing after the
change done in DRT, without changing their actual purpose.

* platform/gtk/accessibility/roles-exposed.html: Make sure we
print "AXRole: (no element)" when accessibilityElementByID() does
not return a valid object, not to confuse it with cases where the
returned string for the role is an empty string.
* platform/gtk/accessibility/roles-exposed-expected.txt: Update
test expectations to reflect the "AXRole: (no element)" string
that is now being exposed. Also, replace the (wrongly added) PASS
expectations with FAIL for rowgroups, which are currently not
being exposed for ATK either.

* accessibility/deleting-iframe-destroys-axcache.html: Just
consider the first and third sons of the accessibility object for
the body (instead of the grandsons), so the test can run both in
Mac, where sons and grandsons are exposed, and ATK, where only
sons are exposed (no StaticText objects exposed there).

* accessibility/non-data-table-cell-title-ui-element.html: Use
accessibilityElementById() to get the accessibility object for the
"skip" table header instead of navigating with childAtIndex(),
since the hierarchy is not the same for Mac and ATK based ports.

* accessibility/loading-iframe-updates-axtree.html: Use the new
web area inside the iframe to compare against the old one, instead
of doing it the other way around, to avoid calling isEqual for an
undefined value (the old web area).
* accessibility/loading-iframe-updates-axtree-expected.txt:
Removed line comparing the old and new web areas inside the iframe.

* platform/mac/accessibility/search-predicate.html: Do not rely on
shouldBe() together with the string "AXRole: " when asking for the
role of objects that should no longer be in the accessibility
tree, and use shouldBeUndefined() instead.
* platform/mac/accessibility/search-when-element-starts-in-table.html: Ditto.

* platform/mac/accessibility/search-predicate-expected.txt: Update
expectations according to the usage of shouldBeUndefined().
* platform/mac/accessibility/search-when-element-starts-in-table-expected.txt: Ditto.

* platform/mac-wk2/TestExpectations: Add search-when-element-starts-in-table.html
here, since it does not return an undefined object in WebKit2 when
the search query should return no results (see bug 125996).

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Compile fix for VS2013 when using ACCELERATED_COMPOSITING.
https://bugs.webkit.org/show_bug.cgi?id=124866

Patch by Alex Christensen <achristensen@webkit.org> on 2013-12-19
Reviewed by Darin Adler.

* platform/graphics/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::TiledBackingStore):
* platform/graphics/TiledBackingStore.h:
Added constructor overload to avoid compile errors
from using MSVC's make_unique as a default parameter.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Upstream WebCore/accessibility changes
https://bugs.webkit.org/show_bug.cgi?id=125925

Reviewed by Chris Fleizach.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::visiblePositionForPoint): Opt out of code when building for iOS.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the Windows build after <http://trac.webkit.org/changeset/160841>
(https://bugs.webkit.org/show_bug.cgi?id=125879)

Add ENABLE(CACHE_PARTITIONING)-guard around call to ResourceRequest::setCachePartition()
as this function is only compiled when building with cache partitioning enabled.

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::addImageToCache):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't check VSINSTALLDIR when looking for Visual Studio install directory.
https://bugs.webkit.org/show_bug.cgi?id=125998.

Reviewed by Alexey Proskuryakov.

* Scripts/webkitdirs.pm:
(visualStudioInstallDir):
Get rid of the VSINSTALLDIR check. We can't build on anything besides VS2013 now anyways.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160846 268f45cc-cd09-0410-ab3c-d52691b4dbfc
overflowchanged event could cause a crash
https://bugs.webkit.org/show_bug.cgi?id=125978

Reviewed by Tim Horton.

Source/WebCore: 

Made the event asynchrnous by re-using Document's event queuing ability. Also removed
the infrastructure to queue up events in FrameView.

Test: fast/events/overflowchanged-inside-selection-collapse-crash.html

* dom/Document.cpp:
(WebCore::Document::recalcStyle):
(WebCore::Document::enqueueOverflowEvent):
* dom/Document.h:
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::~FrameView):
(WebCore::FrameView::layout):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::updateOverflowStatus):
* page/FrameView.h:
* rendering/RenderBlock.cpp:
(WebCore::OverflowEventDispatcher::~OverflowEventDispatcher):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::start):

LayoutTests: 

Add a regression test.

* fast/events/overflowchanged-inside-selection-collapse-crash-expected.txt: Added.
* fast/events/overflowchanged-inside-selection-collapse-crash.html: Added.


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