Adopt shrink-wrapping for TextIndicators on Mac
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 17:50:09 +0000 (17:50 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 17:50:09 +0000 (17:50 +0000)
commitff581a7a5ddb000b3fe776c2d1f0b8f0cd163c1d
treeab6cc42247550f081ac3de3d38f15a94c05808a2
parent16c3c6fe1925d652363301b86751d0027b6612bb
Adopt shrink-wrapping for TextIndicators on Mac
https://bugs.webkit.org/show_bug.cgi?id=148064

Reviewed by Beth Dakin.

Instead of indicating the bounding rect when there are multiple text rects,
use shrink-wrapping for TextIndicatorWindow (on Mac), like we do on iOS.

* bindings/objc/DOM.mm:
(-[DOMNode getPreviewSnapshotImage:andRects:]):
Make getPreviewSnapshotImage use the same options that iOS WebKit2 uses.
This fixes a regression from r188420 where iOS WebKit1 TextIndicators lost
all of the relevant (previously hardcoded inside TextIndicator) options.

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
(WebCore::TextIndicator::createWithSelectionInFrame):
(WebCore::initializeIndicator):
Don't keep indicatesCurrentSelection in TextIndicatorData. Instead,
just pass it through to initializeIndicator. Add a flag which stops us
from zeroing out the margin if indicatesCurrentSelection is true.
Move default margins into TextIndicator so they can be applied to the stored rects
just like on iOS, instead of trying to apply them later like we used to on Mac.

* page/TextIndicator.h:
(WebCore::TextIndicator::indicatesCurrentSelection): Deleted.
* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
(WebCore::TextIndicatorWindow::setTextIndicator):
(outsetIndicatorRectIncludingShadow): Deleted.
(textIndicatorsForTextRectsOverlap): Deleted.
Make use of pathsWithShrinkWrappedRects for TextIndicatorWindow, instead
of just smushing all intersecting rects together. Use the computed path
for the shadows and to mask the yellow highlight and snapshot layer.

* platform/graphics/PathUtilities.cpp:
(WebCore::PathUtilities::pathsWithShrinkWrappedRects):
(WebCore::PathUtilities::pathWithShrinkWrappedRects):
* platform/graphics/PathUtilities.h:
Make it possible to retrieve each non-intersecting path individually, instead
of just a single giant Path, so that TextIndicatorWindow can make separate
layers for each one (so they can bounce separately).

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<TextIndicatorData>::encode): Deleted.
(IPC::ArgumentCoder<TextIndicatorData>::decode): Deleted.
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::updateFindIndicator):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):
Use the new option, TextIndicatorOptionIncludeMarginIfRangeMatchesSelection,
for iOS and FindController, because we can keep the margins in these cases
because we don't have to animate to/from the blue highlight.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/page/TextIndicator.cpp
Source/WebCore/page/TextIndicator.h
Source/WebCore/page/mac/TextIndicatorWindow.h
Source/WebCore/page/mac/TextIndicatorWindow.mm
Source/WebCore/platform/graphics/PathUtilities.cpp
Source/WebCore/platform/graphics/PathUtilities.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/WebProcess/WebPage/FindController.cpp
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm