Title: [190252] trunk/Source
- Revision
- 190252
- Author
- [email protected]
- Date
- 2015-09-25 14:35:11 -0700 (Fri, 25 Sep 2015)
Log Message
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.
Source/WebCore:
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):
Source/WebKit2:
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (190251 => 190252)
--- trunk/Source/WebCore/ChangeLog 2015-09-25 21:30:05 UTC (rev 190251)
+++ trunk/Source/WebCore/ChangeLog 2015-09-25 21:35:11 UTC (rev 190252)
@@ -1,3 +1,24 @@
+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-09-25 Brady Eidson <[email protected]>
PassRefPtr<> to RefPtr<> conversion in legacy IndexedDB code.
Modified: trunk/Source/WebCore/editing/mac/DataDetection.mm (190251 => 190252)
--- trunk/Source/WebCore/editing/mac/DataDetection.mm 2015-09-25 21:30:05 UTC (rev 190251)
+++ trunk/Source/WebCore/editing/mac/DataDetection.mm 2015-09-25 21:35:11 UTC (rev 190252)
@@ -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: trunk/Source/WebKit2/ChangeLog (190251 => 190252)
--- trunk/Source/WebKit2/ChangeLog 2015-09-25 21:30:05 UTC (rev 190251)
+++ trunk/Source/WebKit2/ChangeLog 2015-09-25 21:35:11 UTC (rev 190252)
@@ -1,3 +1,19 @@
+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-09-25 Carlos Garcia Campos <[email protected]>
[GTK] ASSERTION FAILED: !m_inUpdateBackingStoreState in DrawingAreaImpl::display() after DrawingAreaImpl::forceRepaint()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (190251 => 190252)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-09-25 21:30:05 UTC (rev 190251)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2015-09-25 21:35:11 UTC (rev 190252)
@@ -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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes