Diff
Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (190501 => 190502)
--- branches/safari-601-branch/Source/WebCore/ChangeLog 2015-10-02 13:58:00 UTC (rev 190501)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog 2015-10-02 13:58:08 UTC (rev 190502)
@@ -1,5 +1,30 @@
2015-10-02 Matthew Hanson <[email protected]>
+ Merge r190252. rdar://problem/22867962
+
+ 2015-09-25 Beth Dakin <[email protected]>
+
+ Clicking on a data detected item inside a form control always pops up a map
+ on force touch trackpad
+ https://bugs.webkit.org/show_bug.cgi?id=149559
+ -and corresponding-
+ rdar://problem/22826796
+
+ Reviewed by Tim Horton.
+
+ The real bug here appears to be a bug in Lookup, but we can work around it.
+ For normal text, we call directly into Data Detectors for map results, and
+ that works fine. For text within form controls, we did not properly extract
+ the text for DD, so we sent it to Lookup instead, and Lookup has this bug
+ where they will pop open the map right away. If we properly extract the text
+ for form controls, then we can work around this bug.
+
+ * editing/mac/DataDetection.mm:
+ (WebCore::detectItemAtPositionWithRange):
+ (WebCore::DataDetection::detectItemAroundHitTestResult):
+
+2015-10-02 Matthew Hanson <[email protected]>
+
Merge r189560. rdar://problem/22824659
2015-09-09 Benjamin Poulain <[email protected]>
Modified: branches/safari-601-branch/Source/WebCore/editing/mac/DataDetection.mm (190501 => 190502)
--- branches/safari-601-branch/Source/WebCore/editing/mac/DataDetection.mm 2015-10-02 13:58:00 UTC (rev 190501)
+++ branches/safari-601-branch/Source/WebCore/editing/mac/DataDetection.mm 2015-10-02 13:58:08 UTC (rev 190502)
@@ -30,6 +30,7 @@
#import "DataDetectorsSPI.h"
#import "FrameView.h"
+#import "HTMLTextFormControlElement.h"
#import "HitTestResult.h"
#import "Node.h"
#import "Range.h"
@@ -41,25 +42,8 @@
namespace WebCore {
-RetainPtr<DDActionContext> DataDetection::detectItemAroundHitTestResult(const HitTestResult& hitTestResult, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
+static RetainPtr<DDActionContext> detectItemAtPositionWithRange(VisiblePosition position, RefPtr<Range> contextRange, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
{
- if (!DataDetectorsLibrary())
- return nullptr;
-
- Node* node = hitTestResult.innerNonSharedNode();
- if (!node)
- return nullptr;
- auto renderer = node->renderer();
- if (!renderer)
- return nullptr;
- VisiblePosition position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
- if (position.isNull())
- position = firstPositionInOrBeforeNode(node);
-
- RefPtr<Range> contextRange = rangeExpandedAroundPositionByCharacters(position, 250);
- if (!contextRange)
- return nullptr;
-
String fullPlainTextString = plainText(contextRange.get());
int hitLocation = TextIterator::rangeLength(makeRange(contextRange->startPosition(), position).get());
@@ -104,6 +88,50 @@
return actionContext;
}
+RetainPtr<DDActionContext> DataDetection::detectItemAroundHitTestResult(const HitTestResult& hitTestResult, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
+{
+ if (!DataDetectorsLibrary())
+ return nullptr;
+
+ Node* node = hitTestResult.innerNonSharedNode();
+ if (!node)
+ return nullptr;
+ auto renderer = node->renderer();
+ if (!renderer)
+ return nullptr;
+
+ VisiblePosition position;
+ RefPtr<Range> contextRange;
+
+ if (!is<HTMLTextFormControlElement>(*node)) {
+ position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
+ if (position.isNull())
+ position = firstPositionInOrBeforeNode(node);
+
+ contextRange = rangeExpandedAroundPositionByCharacters(position, 250);
+ if (!contextRange)
+ return nullptr;
+ } else {
+ Frame* frame = node->document().frame();
+ if (!frame)
+ return nullptr;
+
+ IntPoint framePoint = hitTestResult.roundedPointInInnerNodeFrame();
+ if (!frame->rangeForPoint(framePoint))
+ return nullptr;
+
+ VisiblePosition position = frame->visiblePositionForPoint(framePoint);
+ if (position.isNull())
+ return nullptr;
+
+ contextRange = enclosingTextUnitOfGranularity(position, LineGranularity, DirectionForward);
+ if (!contextRange)
+ return nullptr;
+ }
+
+ return detectItemAtPositionWithRange(position, contextRange, detectedDataBoundingBox, detectedDataRange);
+}
+
} // namespace WebCore
#endif // PLATFORM(MAC)
Modified: branches/safari-601-branch/Source/WebKit2/ChangeLog (190501 => 190502)
--- branches/safari-601-branch/Source/WebKit2/ChangeLog 2015-10-02 13:58:00 UTC (rev 190501)
+++ branches/safari-601-branch/Source/WebKit2/ChangeLog 2015-10-02 13:58:08 UTC (rev 190502)
@@ -1,5 +1,25 @@
2015-10-02 Matthew Hanson <[email protected]>
+ Merge r190252. rdar://problem/22867962
+
+ 2015-09-25 Beth Dakin <[email protected]>
+
+ Clicking on a data detected item inside a form control always pops up a map
+ on force touch trackpad
+ https://bugs.webkit.org/show_bug.cgi?id=149559
+ -and corresponding-
+ rdar://problem/22826796
+
+ Reviewed by Tim Horton.
+
+ Look for Data Detected text for text nodes and HitTestResults that are over
+ text inside form controls.
+
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performImmediateActionHitTestAtLocation):
+
+2015-10-02 Matthew Hanson <[email protected]>
+
Merge r188990. rdar://problem/22802029
2015-08-26 Beth Dakin <[email protected]>
Modified: branches/safari-601-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (190501 => 190502)
--- branches/safari-601-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-10-02 13:58:00 UTC (rev 190501)
+++ branches/safari-601-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-10-02 13:58:08 UTC (rev 190502)
@@ -1140,7 +1140,7 @@
}
// FIXME: Avoid scanning if we will just throw away the result (e.g. we're over a link).
- if (!pageOverlayDidOverrideDataDetectors && hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode()) {
+ if (!pageOverlayDidOverrideDataDetectors && hitTestResult.innerNode() && (hitTestResult.innerNode()->isTextNode() || hitTestResult.isOverTextInsideFormControlElement())) {
FloatRect detectedDataBoundingBox;
RefPtr<Range> detectedDataRange;
immediateActionResult.detectedDataActionContext = DataDetection::detectItemAroundHitTestResult(hitTestResult, detectedDataBoundingBox, detectedDataRange);