Change public text iterator API implementations to not depend on 16-bit character pointers
https://bugs.webkit.org/show_bug.cgi?id=129566

Reviewed by Anders Carlsson.

Source/WebKit/mac:

* WebView/WebTextIterator.mm:
(-[WebTextIterator initWithRange:]): Use make_unique instead of adoptPtr.
(-[WebTextIterator advance]): Clear out the upconverted text since we are moving on to the
next text.
(-[WebTextIterator currentTextPointer]): Upconvert if we have 8-bit text.
(-[WebTextIterator currentTextLength]): Call TextIterator::text().length() since we will
probably be removing TextIterator::length eventually.

Source/WebKit2:

* WebView/WebTextIterator.mm:
(-[WKDOMTextIterator initWithRange:]): Use make_unique instead of adoptPtr.
(-[WKDOMTextIterator advance]): Clear out the upconverted text since we are moving on to the
next text.
(-[WKDOMTextIterator currentTextPointer]): Upconvert if we have 8-bit text.
(-[WKDOMTextIterator currentTextLength]): Call TextIterator::text().length() since we will
probably be removing TextIterator::length eventually.

* WebProcess/WebCoreSupport/WebEditorClient.cpp: Removed unneded include of TextIterator.h.
* WebProcess/WebPage/WebPage.cpp: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reactivate SVG mask-type tests for Mac
https://bugs.webkit.org/show_bug.cgi?id=129577

Reviewed by Darin Adler.

Reduce mask-type tests to the minimum to test the feature.

* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:
* svg/masking/mask-type-alpha-expected.svg:
* svg/masking/mask-type-alpha.svg:
* svg/masking/mask-type-luminance-expected.svg:
* svg/masking/mask-type-luminance.svg:
* svg/masking/mask-type-not-set-expected.svg:
* svg/masking/mask-type-not-set.svg:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DocumentLoader should keep maps of ResourceLoaders instead of sets
https://bugs.webkit.org/show_bug.cgi?id=129388

Reviewed by Darin Adler.

For web replay, we need to be able to pull a ResourceLoader instance by
identifier from the DocumentLoader. This is easy to do if we convert
ResourceLoaderSet to ResourceLoaderMap, keyed by the loader's identifier.

Added assertions whenever adding or removing from the map to ensure
that we don't try to add duplicates or resources with zero identifiers.

No new tests required. No functionality was added.

* loader/DocumentLoader.cpp:
(WebCore::cancelAll):
(WebCore::setAllDefersLoading):
(WebCore::areAllLoadersPageCacheAcceptable):
(WebCore::DocumentLoader::addSubresourceLoader):
(WebCore::DocumentLoader::removeSubresourceLoader):
(WebCore::DocumentLoader::addPlugInStreamLoader):
(WebCore::DocumentLoader::removePlugInStreamLoader):
(WebCore::DocumentLoader::subresourceLoaderFinishedLoadingOnePart):
* loader/DocumentLoader.h:
* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::create): Only add the loader
to the document loader's map if it initialized successfully.
The old code was probably leaking resource loaders that failed to
initialize.

* loader/mac/DocumentLoaderMac.cpp:
(WebCore::scheduleAll):
(WebCore::unscheduleAll):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Split UserActivity, simplify PageThrottler
https://bugs.webkit.org/show_bug.cgi?id=129551

Reviewed by Darin Adler.

The class UserActivity currently implements two things – a hysteresis mechanism, and
an abstraction of NSActivity controlled by that mechanism. PageThrottler implements
its own hysteresis mechanism, which directly controls DOM timer throttling and also
controls a couple of UserActivities, giving a total of 3 separate hysteresis mechanisms,
layered two deep.

Split UserActivity into three, with HysteresisActivity implementing an abstract hysteresis
mechanism, UserActivity::Impl controlling the NSActivity, and then UserActivity combining
these two back together. The interface to UserActivity is unchanged.

Remove PageThrottler's bespoke hysteresis, replacing it with a use of HysteresisActivity.
Replace the two UserActivities with a single UserActivity::Impl, so there are no longer
layered hysteresis mechanisms.

* WebCore.exp.in:
    - exports changed.
* WebCore.xcodeproj/project.pbxproj:
    - added HysteresisActivity.h.
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
    - if the page starts visible, begin activity. If it starts hidden throttle DOM timers.
(WebCore::PageThrottler::hiddenPageDOMTimerThrottlingStateChanged):
    - when the DOM timer throttling setting changes, make sure we update.
(WebCore::PageThrottler::incrementActivityCount):
(WebCore::PageThrottler::decrementActivityCount):
    - when m_activityCount changes update the hysteresis state.
(WebCore::PageThrottler::updateHysteresis):
(WebCore::PageThrottler::setViewState):
    - when IsVisuallyIdle changes update the hysteresis state.
(WebCore::PageThrottler::started):
(WebCore::PageThrottler::stopped):
    - callbacks from HysteresisActivity, these control m_activity and DOM timer throttling.
* page/PageThrottler.h:
(WebCore::PageThrottler::didReceiveUserInput):
(WebCore::PageThrottler::pluginDidEvaluate):
    - call impulse to temporarily enable the activity.
* platform/HysteresisActivity.h: Copied from Source/WebCore/platform/UserActivity.h.
(WebCore::HysteresisActivity::HysteresisActivity):
    - constructor takes a delegate optionally a timeout.
(WebCore::HysteresisActivity::start):
    - start activity immediately. If stopped, call started method on delegate. If in timeout period, cancel the timer.
(WebCore::HysteresisActivity::stop):
    - stop activity after hysteresis. If started, initiate timeout period.
(WebCore::HysteresisActivity::impulse):
    - ensure activity for at least the timeout period.
(WebCore::HysteresisActivity::hysteresisTimerFired):
    - delayed stop - when the timer fires call stopped on the delegate.
* platform/UserActivity.cpp:
(WebCore::UserActivity::Impl::Impl):
(WebCore::UserActivity::Impl::beginActivity):
(WebCore::UserActivity::Impl::endActivity):
    - nop implementation.
(WebCore::UserActivity::UserActivity):
    - UserActivity maintains existing interface with hysteresis.
(WebCore::UserActivity::started):
(WebCore::UserActivity::stopped):
    - callbacks from HysteresisTimer; forward to Impl.
* platform/UserActivity.h:
* platform/mac/UserActivityMac.mm:
(WebCore::UserActivity::Impl::Impl):
    - UserActivity::Impl, abstraction for NSActivity without added hysteresis.
(WebCore::UserActivity::Impl::beginActivity):
    - allocate NSActivity.
(WebCore::UserActivity::Impl::endActivity):
    - release NSActivity.



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