Change page preview loading order, and add a TextIndicator
https://bugs.webkit.org/show_bug.cgi?id=139793
<rdar://problem/19288547>

Reviewed by Beth Dakin.

* Shared/mac/ActionMenuHitTestResult.h:
* Shared/mac/ActionMenuHitTestResult.mm:
(WebKit::ActionMenuHitTestResult::encode):
(WebKit::ActionMenuHitTestResult::decode):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performActionMenuHitTestAtLocation):
Build a TextIndicator for links.

* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _dismissContentRelativeChildWindows]):
(-[WKView _setPreviewTitle:]):
(-[WKView _setPreviewLoading:]):
Remove unneeded WK_API_ENABLED #ifs.

(-[WKView _setPreviewOverrideImage:]):
Add; forward to WKImmediateActionController.

* UIProcess/mac/WKImmediateActionController.h:
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController willDestroyView:]):
Shut down the WKPreviewPopoverAnimationController.

(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
Don't build an immediate action item here; we'll always build it in
willBeginAnimation, and the one we build here is likely to be wrong.

(-[WKImmediateActionController _defaultAnimationController]):
(-[WKImmediateActionController hidePreview]):
(-[WKImmediateActionController setPreviewTitle:]):
(-[WKImmediateActionController setPreviewLoading:]):
(-[WKImmediateActionController setPreviewOverrideImage:]):
(-[WKImmediateActionController _animationControllerForCustomPreview]):
(-[WKImmediateActionController _createPreviewPopoverIfNeededForURL:]): Deleted.
(-[WKImmediateActionController popoverWillClose:]): Deleted.
(targetSizeFitsInAvailableSpace): Deleted.
(-[WKImmediateActionController largestPopoverSize]): Deleted.
(-[WKImmediateActionController _preferredPopoverSizeWithPreviewPadding:]): Deleted.
(-[WKImmediateActionController pagePreviewViewController:viewForPreviewingURL:initialFrameSize:]): Deleted.
(-[WKImmediateActionController pagePreviewViewController:titleForPreviewOfURL:]): Deleted.
(-[WKImmediateActionController pagePreviewViewControllerWasClicked:]): Deleted.
Move preview popover code to WKPreviewPopoverAnimationController.
Install and uninstall the link text indicator when necessary.

* UIProcess/mac/WKPagePreviewViewController.h:
* UIProcess/mac/WKPagePreviewViewController.mm:
(-[WKPagePreviewViewController setLoading:]):
(-[WKPagePreviewViewController loadView]):
(-[WKPagePreviewViewController replacePreviewWithImage:atSize:]):
Allow overriding the preview with a full-view NSImage.
Hide the preview view until the loading spinner goes away.

* UIProcess/mac/WKPreviewPopoverAnimationController.h: Copied from Source/WebKit2/UIProcess/mac/WKImmediateActionController.h.
* UIProcess/mac/WKPreviewPopoverAnimationController.mm: Added.
(+[WKPreviewPopoverAnimationController _shouldImmediatelyShowPreview]):
(-[WKPreviewPopoverAnimationController initWithURL:view:page:originRect:eventLocationInView:]):
(-[WKPreviewPopoverAnimationController close]):
(-[WKPreviewPopoverAnimationController setPreviewLoading:]):
(-[WKPreviewPopoverAnimationController setPreviewOverrideImage:]):
If we have shown the popover, choose a size strictly smaller than
its current size.

(-[WKPreviewPopoverAnimationController _hidePreview]):
(-[WKPreviewPopoverAnimationController setPreviewTitle:]):
(-[WKPreviewPopoverAnimationController _createPreviewPopover]):
(-[WKPreviewPopoverAnimationController _showPreview]):
(targetSizeFitsInAvailableSpace):
(-[WKPreviewPopoverAnimationController largestPopoverSize]):
(-[WKPreviewPopoverAnimationController _targetSizeForPagePreview]):
(-[WKPreviewPopoverAnimationController _preferredPopoverSizeWithPreviewPadding:forTargetSize:]):
(-[WKPreviewPopoverAnimationController _previewWatchdogTimerFired:]):
(-[WKPreviewPopoverAnimationController recognizerWillBeginAnimation:]):
(-[WKPreviewPopoverAnimationController recognizerDidUpdateAnimation:]):
(-[WKPreviewPopoverAnimationController recognizerDidCancelAnimation:]):
(-[WKPreviewPopoverAnimationController recognizerDidCompleteAnimation:]):
(-[WKPreviewPopoverAnimationController recognizerDidDismissAnimation:]):
(-[WKPreviewPopoverAnimationController pagePreviewViewController:viewForPreviewingURL:initialFrameSize:]):
(-[WKPreviewPopoverAnimationController pagePreviewViewController:titleForPreviewOfURL:]):
(-[WKPreviewPopoverAnimationController pagePreviewViewControllerWasClicked:]):
(-[WKPreviewPopoverAnimationController popoverWillClose:]):
Move code in from WKImmediateActionController.
Forward NSImmediateActionAnimationControllerDelegate methods
to the popover's animation controller if we've popped it.
Pop the popover if we've loaded or 1 second has passed, whichever
comes first.

* WebKit2.xcodeproj/project.pbxproj:

* WebCore.exp.in:
* platform/spi/mac/NSPopoverSPI.h:
Add an export and some SPI.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify smart pointer classes by using std::exchange
https://bugs.webkit.org/show_bug.cgi?id=139790

Reviewed by Andreas Kling.

* wtf/MallocPtr.h:
* wtf/OSObjectPtr.h:
* wtf/OwnPtr.h:
(WTF::OwnPtr<T>::clear):
(WTF::OwnPtr<T>::release):
(WTF::OwnPtr<T>::leakPtr):
(WTF::=):
* wtf/PassOwnPtr.h:
(WTF::PassOwnPtr<T>::leakPtr):
* wtf/PassRefPtr.h:
(WTF::PassRefPtr<T>::leakRef):
* wtf/Ref.h:
* wtf/RefPtr.h:
(WTF::RefPtr<T>::clear):
(WTF::RefPtr<T>::leakRef):
* wtf/RetainPtr.h:
(WTF::RetainPtr<T>::leakRef):

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

* platform/cocoa/MachSendRight.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the build.

* UIProcess/API/mac/WKView.mm:
(-[WKView _setPreviewOverrideImage:]):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Stop using WKPreferencesPrivate API to toggle FeatureCounter support
https://bugs.webkit.org/show_bug.cgi?id=139794
<rdar://problem/19266254>

Reviewed by Anders Carlsson.

Stop using WKPreferencesPrivate API to toggle FeatureCounter support
and use WKWebViewConfigurationPrivate API instead. FeatureCounter is
not meant to change state after the view has been created.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetFeatureCounterEnabled): Deleted.
(WKPreferencesGetFeatureCounterEnabled): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _featureCounterEnabled]): Deleted.
(-[WKPreferences _setFeatureCounterEnabled:]): Deleted.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _featureCounterEnabled]):
(-[WKWebViewConfiguration _setFeatureCounterEnabled:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unify the Mac and iOS implementations of FontPlatformData a bit
https://bugs.webkit.org/show_bug.cgi?id=139721

Reviewed by Anders Carlsson.

Source/WebCore:

This is a first pass of unifying the Mac and iOS implementations of FontPlatformData.
Notable changes:
- Change the storage of the platform font to be CTFontRef across the board. Adds NSFont
  setter/getter/constructor as a temporary measures during the transition away from NSFont.
- Removes duplicate code that only differed by whether the type was NSFont or CTFontRef.
- Reduces the number of #ifdefs.

* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::operator=):
(WebCore::FontPlatformData::openTypeTable): Deleted.
* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::nsFont):
(WebCore::FontPlatformData::setNSFont):
(WebCore::FontPlatformData::hash):
(WebCore::FontPlatformData::operator==):
(WebCore::FontPlatformData::isHashTableDeletedValue):
(WebCore::toCTFontRef): Deleted.
(WebCore::FontPlatformData::font): Deleted.
(WebCore::FontPlatformData::roundsGlyphAdvances): Deleted.
(WebCore::FontPlatformData::cgFont): Deleted.
(WebCore::FontPlatformData::hashTableDeletedFontValue): Deleted.
* platform/graphics/SimpleFontData.h:
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::~FontPlatformData):
(WebCore::FontPlatformData::platformDataInit):
(WebCore::FontPlatformData::platformDataAssign):
(WebCore::FontPlatformData::setFont):
(WebCore::FontPlatformData::roundsGlyphAdvances):
(WebCore::FontPlatformData::allowsLigatures):
(WebCore::FontPlatformData::ctFont):
(WebCore::FontPlatformData::openTypeTable):
(WebCore::FontPlatformData::loadFont): Deleted.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::systemFallbackForCharacters):
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::drawGlyphs):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::getCompositeFontReferenceFontData):
(WebCore::SimpleFontData::platformInit):
(WebCore::SimpleFontData::platformCreateScaledFontData):
(WebCore::SimpleFontData::containsCharacters):
(WebCore::SimpleFontData::determinePitch):
(WebCore::SimpleFontData::renderingStyle):
(WebCore::SimpleFontData::advanceForColorBitmapFont):

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(fontNameForDescription):
Update for new function name.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Need to re-enable action menus
https://bugs.webkit.org/show_bug.cgi?id=139795
-and corresponding-
rdar://problem/19299367

Reviewed by Tim Horton.

Re-enable the menus by un-commenting the code to create the menu and controller.
Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit2:

* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:context:configuration:webView:]):

performActionMenuHitTest already takes a parameter indicating whether the hit test 
is for an immediate action or not. The callback didPerformActionMenuHitTest needs 
that information too so that it knows whether to call into the 
ActionMenuController or the ImmediateActionController.
(-[WKView _didPerformActionMenuHitTest:forImmediateAction:userData:]):
(-[WKView _didPerformActionMenuHitTest:userData:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didPerformActionMenuHitTest):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didPerformActionMenuHitTest):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performActionMenuHitTestAtLocation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Perf tests frequently fail saying "build not up to date"
https://bugs.webkit.org/show_bug.cgi?id=139786

Reviewed by Ryosuke Niwa.

Perf tests only build DumpRenderTree, not WebKit itself. Just clean the build
directory to get rid of stale precompiled headers, and let it rebuild
DumpRenderTree each time, that's fast.

Also, removed unused "build and perf test" code.

* BuildSlaveSupport/build.webkit.org-config/config.json:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
New perf dashboard should not duplicate author information in each commit
https://bugs.webkit.org/show_bug.cgi?id=139756

Reviewed by Darin Adler.

Instead of each commit having author name and email, make it reference a newly added committers table.
Also replace "email" by "account" since some repositories don't use emails as account names.

This improves the keyword search performance in commits.php since LIKE now runs on committers table,
which only contains as many rows as there are accounts in each repository, instead of commits table
which contains every commit ever happened in each repository.

To migrate an existing database into match the new schema, run:

BEGIN;

INSERT INTO committers (committer_repository, committer_name, committer_email)
    (SELECT DISTINCT commit_repository, commit_author_name, commit_author_email
        FROM commits WHERE commit_author_email IS NOT NULL);

ALTER TABLE commits ADD COLUMN commit_committer integer REFERENCES committers ON DELETE CASCADE;

UPDATE commits SET commit_committer = committer_id FROM committers
    WHERE commit_repository = committer_repository AND commit_author_email = committer_email;

ALTER TABLE commits DROP COLUMN commit_author_name CASCADE;
ALTER TABLE commits DROP COLUMN commit_author_email CASCADE;

COMMIT;

* init-database.sql: Added committers table, and replaced author columns in commits table by a foreign
reference to committers. Also added the missing drop table statements.

* public/api/commits.php:
(main): Fetch the corresponding committers row for a single commit. Also wrap a single commit by
an array here instead of doing it in format_commit.
(fetch_commits_between): Updated queries to JOIN commits with committers.
(format_commit): Takes both commit and committers rows. Also don't wrap the result in an array as that
is now done in main.

* public/api/report-commits.php:
(main): Store the reported committer information or update the existing entry if there is one.

* tests/admin-regenerate-manifest.js: Fixed tests.

* tests/api-report-commits.js: Ditto. Also added a test for updating an existing committer entry.

* tools/pull-svn.py: Renamed email to account.
(main):
(fetch_commit_and_resolve_author):
(fetch_commit):
(resolve_author_name_from_account):
(resolve_author_name_from_email): Deleted.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add missing availability annotation on @property _featureCounterEnabled
https://bugs.webkit.org/show_bug.cgi?id=139794
<rdar://problem/19266254>

Rubber-stamped by Dan Bernstein.

Follow-up to r177526 adding availability annotation on @property
_featureCounterEnabled.

* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: event.target should sometimes be a descendant element on AXPress-triggered mouse clicks
https://bugs.webkit.org/show_bug.cgi?id=135689

Reviewed by Mario Sanchez Prada.

Source/WebCore:

When trying to find the right sub-node to target, we need to go back up the parent chain to find 
an Element, in case we land on a Text node for example.

Test: accessibility/press-target-uses-text-descendant-node.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::press):

LayoutTests:

* accessibility/press-target-uses-text-descendant-node-expected.txt: Added.
* accessibility/press-target-uses-text-descendant-node.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Roll out part of the previous patch - BuildAndPerfTestWebKit2 is used by Efl.
I thought that it was unused because grepping for BuildAndPerfTestWebKit2Factory
found nothing.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(BuildAndPerfTestFactory):
(BuildAndPerfTestWebKit2Factory):



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

* UIProcess/API/mac/WKViewInternal.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Perf tests frequently fail saying "build not up to date"
https://bugs.webkit.org/show_bug.cgi?id=139786

Illegitimately yet authoritatively reviewed by Lucas Forschler.

Undo the rest of the first fix, and implement the behavior differently.

is_clean isn't automatically forwarded from config.json to properties.

* BuildSlaveSupport/build.webkit.org-config/config.json:
* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(CleanBuildUnconditionally):
(CleanBuildUnconditionally.start):
(DownloadAndPerfTestFactory.__init__):
(DownloadAndPerfTestWebKit2Factory.__init__):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Heuristic: Avoid exposing an element as clickable if mouse event delegation is handled on an element with any explicit ARIA role, including presentation.
https://bugs.webkit.org/show_bug.cgi?id=133613

Reviewed by Mario Sanchez Prada.

Source/WebCore:

This adds a heuristic to avoid a problem we have where too many objects that say they respond to press actions for accessibility.
It results from people installing click handlers on container nodes and then lots of static text objects are "clickable" in the eyes of VoiceOver.

What we can do is avoid this determination if the element is presentational.

Test: platform/mac/accessibility/press-action-for-presentational-descendants.html

* accessibility/AccessibilityObject.cpp:
(WebCore::nodeHasPresentationRole):
(WebCore::AccessibilityObject::supportsPressAction):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityActionNames]):

LayoutTests:

* platform/mac/accessibility/press-action-for-presentational-descendants-expected.txt: Added.
* platform/mac/accessibility/press-action-for-presentational-descendants.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@177536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Recursive crash at WebCore::accessibleNameForNode
https://bugs.webkit.org/show_bug.cgi?id=139616

Reviewed by Mario Sanchez Prada.

Source/WebCore:

An image that uses aria-labelledby to reference its own parent can lead to a recursion crash.
There needs to be some information we can pass through these methods to ensure we don't hit this case.

Test: accessibility/accessibility-description-crash.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::alternativeText):
(WebCore::AccessibilityNodeObject::textUnderElement):
(WebCore::accessibleNameForNode):
(WebCore::AccessibilityNodeObject::accessibilityDescriptionForElements):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityTextUnderElementMode::AccessibilityTextUnderElementMode):

LayoutTests:

* accessibility/accessibility-description-crash-expected.txt: Added.
* accessibility/accessibility-description-crash.html: Added.



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