⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 187299 in webkit


Ignore:
Timestamp:
Jul 23, 2015, 11:29:28 PM (11 years ago)
Author:
Lucas Forschler
Message:

Merged r187117. rdar://problem/21921061

Location:
branches/safari-601.1-branch/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-601.1-branch/Source/WebKit2/ChangeLog

    r187297 r187299  
     12015-07-23  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r187117
     4
     5    2015-07-21  Tim Horton  <timothy_horton@apple.com>
     6
     7            [iOS] Avoid using a TextIndicator if there are non-text things to indicate
     8            https://bugs.webkit.org/show_bug.cgi?id=147152
     9            <rdar://problem/21921061>
     10
     11            Reviewed by Beth Dakin.
     12
     13            * UIProcess/ios/WKContentViewInteraction.mm:
     14            (-[WKContentView willPresentPreviewViewController:forPosition:inSourceView:]):
     15            * WebProcess/WebPage/ios/WebPageIOS.mm:
     16            (WebKit::shouldUseTextIndicatorForLink):
     17            (WebKit::WebPage::getPositionInformation):
     18            Fall back to a rectangular area instead of a TextIndicator if there are any
     19            non-inline elements inside the link.
     20
    1212015-07-23  Lucas Forschler  <lforschler@apple.com>
    222
  • branches/safari-601.1-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r187291 r187299  
    33223322    [_previewIndicatorView removeFromSuperview];
    33233323
     3324    float deviceScaleFactor = _page->deviceScaleFactor();
     3325
    33243326    RefPtr<Image> image = _positionInformation.linkIndicator.contentImage;
    33253327    if (!image) {
    3326         [[viewController presentationController] setSourceRect:_positionInformation.bounds];
     3328        IntRect sourceRect = _positionInformation.bounds;
     3329        const float marginInPoints = 4;
     3330        sourceRect.inflate(marginInPoints * deviceScaleFactor);
     3331        [[viewController presentationController] setSourceRect:sourceRect];
    33273332        [[viewController presentationController] setSourceView:self];
    33283333        return;
     
    33323337    _previewIndicatorView = adoptNS([[UIImageView alloc] initWithImage:indicatorImage.get()]);
    33333338
    3334     float deviceScaleFactor = _page->deviceScaleFactor();
    33353339    const float cornerRadiusInPoints = 5;
    33363340    Path path = PathUtilities::pathWithShrinkWrappedRects(_positionInformation.linkIndicator.textRectsInBoundingRectCoordinates, cornerRadiusInPoints * deviceScaleFactor);
  • branches/safari-601.1-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r187070 r187299  
    6464#import <WebCore/HTMLElementTypeHelpers.h>
    6565#import <WebCore/HTMLFormElement.h>
     66#import <WebCore/HTMLImageElement.h>
    6667#import <WebCore/HTMLInputElement.h>
    6768#import <WebCore/HTMLOptGroupElement.h>
     
    21072108}
    21082109
     2110static bool shouldUseTextIndicatorForLink(Element& element)
     2111{
     2112    if (element.renderer() && !element.renderer()->isInline())
     2113        return false;
     2114
     2115    for (auto& child : descendantsOfType<Element>(element)) {
     2116        if (child.renderer() && !child.renderer()->isInline())
     2117            return false;
     2118    }
     2119
     2120    return true;
     2121}
     2122
    21092123void WebPage::getPositionInformation(const IntPoint& point, InteractionInformationAtPosition& info)
    21102124{
     
    21582172                        info.image = snapshot->bitmap();
    21592173
    2160                     RefPtr<Range> linkRange = rangeOfContents(*linkElement);
    2161                     if (linkRange) {
    2162                         float deviceScaleFactor = corePage()->deviceScaleFactor();
    2163                         const float marginInPoints = 4;
    2164                         RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::None, marginInPoints * deviceScaleFactor);
    2165                         if (textIndicator)
    2166                             info.linkIndicator = textIndicator->data();
     2174                    if (shouldUseTextIndicatorForLink(*linkElement)) {
     2175                        RefPtr<Range> linkRange = rangeOfContents(*linkElement);
     2176                        if (linkRange) {
     2177                            float deviceScaleFactor = corePage()->deviceScaleFactor();
     2178                            const float marginInPoints = 4;
     2179                            RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::None, marginInPoints * deviceScaleFactor);
     2180                            if (textIndicator)
     2181                                info.linkIndicator = textIndicator->data();
     2182                        }
    21672183                    }
    21682184                } else if (element->renderer() && element->renderer()->isRenderImage()) {
Note: See TracChangeset for help on using the changeset viewer.