Diff
Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-12-04 17:11:04 UTC (rev 176799)
@@ -1,24 +1,3 @@
-2014-12-04 Dana Burkart <[email protected]>
-
- Merge r176766. <rdar://problem/19072083>
-
- 2014-12-03 Beth Dakin <[email protected]>
-
- <input> elements get whitespace action menu instead of editable text menu
- https://bugs.webkit.org/show_bug.cgi?id=139241
- -and corresponding-
- rdar://problem/19072083
-
- Reviewed by Sam Weinig.
-
- Since we will hit test form controls as form controls, we need a new function to
- determine if the hit point is over text inside that form control or not.
- * WebCore.exp.in:
- * rendering/HitTestResult.cpp:
- (WebCore::HitTestResult::isOverTextInsideFormControlElement):
- * rendering/HitTestResult.h:
-
-
2014-12-03 Dana Burkart <[email protected]>
Merge r176753. <rdar://problem/19052381>
Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in 2014-12-04 17:11:04 UTC (rev 176799)
@@ -1078,7 +1078,6 @@
__ZN7WebCore29cookieRequestHeaderFieldValueERKNS_21NetworkStorageSessionERKNS_3URLES5_
__ZN7WebCore29createDefaultParagraphElementERNS_8DocumentE
__ZN7WebCore29isCharacterSmartReplaceExemptEib
-__ZN7WebCore30enclosingTextUnitOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
__ZN7WebCore30hostNameNeedsDecodingWithRangeEP8NSString8_NSRange
__ZN7WebCore30hostNameNeedsEncodingWithRangeEP8NSString8_NSRange
__ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELm0ENS0_15CrashOnOverflowEEE
@@ -1685,7 +1684,6 @@
__ZNK7WebCore13HitTestResult19mediaIsInFullscreenEv
__ZNK7WebCore13HitTestResult19rectBasedTestResultEv
__ZNK7WebCore13HitTestResult21innerNonSharedElementEv
-__ZNK7WebCore13HitTestResult34isOverTextInsideFormControlElementEv
__ZNK7WebCore13HitTestResult5imageEv
__ZNK7WebCore13HitTestResult5titleERNS_13TextDirectionE
__ZNK7WebCore13HitTestResult9imageRectEv
@@ -2728,6 +2726,7 @@
__ZN7WebCore27tileControllerMemoryHandlerEv
__ZN7WebCore27withinTextUnitOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
__ZN7WebCore30closestWordBoundaryForPositionERKNS_15VisiblePositionE
+__ZN7WebCore30enclosingTextUnitOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
__ZN7WebCore30plainTextReplacingNoBreakSpaceEPKNS_5RangeEtb
__ZN7WebCore31NonSharedCharacterBreakIteratorC1EN3WTF10StringViewE
__ZN7WebCore31NonSharedCharacterBreakIteratorD1Ev
Modified: branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp 2014-12-04 17:11:04 UTC (rev 176799)
@@ -49,7 +49,6 @@
#include "SVGImageElement.h"
#include "SVGNames.h"
#include "UserGestureIndicator.h"
-#include "VisibleUnits.h"
#include "XLinkNames.h"
namespace WebCore {
@@ -516,34 +515,6 @@
return false;
}
-bool HitTestResult::isOverTextInsideFormControlElement() const
-{
- Node* node = innerNode();
- if (!node)
- return false;
-
- if (!is<HTMLTextFormControlElement>(*node))
- return false;
-
- Frame* frame = node->document().frame();
- if (!frame)
- return false;
-
- IntPoint framePoint = roundedPointInInnerNodeFrame();
- if (!frame->rangeForPoint(framePoint))
- return false;
-
- VisiblePosition position = frame->visiblePositionForPoint(framePoint);
- if (position.isNull())
- return false;
-
- RefPtr<Range> wordRange = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionForward);
- if (!wordRange)
- return false;
-
- return !wordRange->text().isEmpty();
-}
-
URL HitTestResult::absoluteLinkURL() const
{
if (m_innerURLElement)
Modified: branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h 2014-12-04 17:11:04 UTC (rev 176799)
@@ -125,7 +125,6 @@
bool mediaMuted() const;
void toggleMediaMuteState() const;
bool isDownloadableMedia() const;
- bool isOverTextInsideFormControlElement() const;
// Returns true if it is rect-based hit test and needs to continue until the rect is fully
// enclosed by the boundaries of a node.
Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog 2014-12-04 17:11:04 UTC (rev 176799)
@@ -34,33 +34,6 @@
2014-12-04 Dana Burkart <[email protected]>
- Merge r176766. <rdar://problem/19072083>
-
- 2014-12-03 Beth Dakin <[email protected]>
-
- <input> elements get whitespace action menu instead of editable text menu
- https://bugs.webkit.org/show_bug.cgi?id=139241
- -and corresponding-
- rdar://problem/19072083
-
- Reviewed by Sam Weinig.
-
- We should disallow shadow content in the hit test. This is the default and it is
- how context menus behave. We originally wanted to text inside shadow content so
- that we could find the text, but the new function I added to HitTestResult will
- allow that.
- * WebView/WebActionMenuController.mm:
- (-[WebActionMenuController performHitTestAtPoint:]):
-
- Adjust to the fact that we don’t hit test shadow content any more.
- (-[WebActionMenuController focusAndSelectHitTestResult]):
-
- Offer the text menus for text inside form controls.
- (-[WebActionMenuController _defaultMenuItems]):
-
-
-2014-12-04 Dana Burkart <[email protected]>
-
Merge r176763. <rdar://problem/19115662>
2014-12-03 Tim Horton <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-12-04 17:11:04 UTC (rev 176799)
@@ -109,8 +109,18 @@
Frame* coreFrame = core([documentView _frame]);
if (!coreFrame)
return nil;
- _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(point));
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
+ _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(point), hitType);
+ // We hit test including shadow content to get the desired result for editable text regions.
+ // But for media, we want to re-set to the shadow root.
+ if (Node* node = _hitTestResult.innerNode()) {
+ if (Element* shadowHost = node->shadowHost()) {
+ if (shadowHost->isMediaElement())
+ _hitTestResult.setToNonShadowAncestor();
+ }
+ }
+
return [[[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult] autorelease];
}
@@ -172,13 +182,15 @@
if (!element)
return;
- Frame* frame = element->document().frame();
- if (!frame)
+ auto renderer = element->renderer();
+ if (!renderer)
return;
- frame->page()->focusController().setFocusedElement(element, frame);
- VisiblePosition position = frame->visiblePositionForPoint(_hitTestResult.roundedPointInInnerNodeFrame());
- frame->selection().setSelection(position);
+ Frame& frame = renderer->frame();
+
+ frame.page()->focusController().setFocusedElement(element, element->document().frame());
+ VisiblePosition position = renderer->positionForPoint(_hitTestResult.localPoint(), nullptr);
+ frame.selection().setSelection(position);
}
- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
@@ -863,7 +875,7 @@
}
Node* node = _hitTestResult.innerNode();
- if ((node && node->isTextNode()) || _hitTestResult.isOverTextInsideFormControlElement()) {
+ if (node && node->isTextNode()) {
NSArray *dataDetectorMenuItems = [self _defaultMenuItemsForDataDetectedText];
if (_currentActionContext) {
// If this is a data detected item with no menu items, we should not fall back to regular text options.
Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-12-04 17:11:04 UTC (rev 176799)
@@ -1,42 +1,5 @@
2014-12-04 Dana Burkart <[email protected]>
- Merge r176766. <rdar://problem/19072083>
-
- 2014-12-03 Beth Dakin <[email protected]>
-
- <input> elements get whitespace action menu instead of editable text menu
- https://bugs.webkit.org/show_bug.cgi?id=139241
- -and corresponding-
- rdar://problem/19072083
-
- Reviewed by Sam Weinig.
-
- Add isOverTextInsideFormControlElement to WebHitTestResult.
- * Shared/WebHitTestResult.cpp:
- (WebKit::WebHitTestResult::Data::Data):
- (WebKit::WebHitTestResult::Data::encode):
- (WebKit::WebHitTestResult::Data::decode):
- * Shared/WebHitTestResult.h:
- (WebKit::WebHitTestResult::isOverTextInsideFormControlElement):
-
- Offer the text menus for text inside form controls.
- * UIProcess/mac/WKActionMenuController.mm:
- (-[WKActionMenuController _defaultMenuItems]):
-
- We should disallow shadow content in the hit test. This is the default and it is
- how context menus behave. We originally wanted to text inside shadow content so
- that we could find the text, but the new function I added to HitTestResult will
- allow that.
- * WebProcess/WebPage/mac/WebPageMac.mm:
-
- Adjust to the fact that we don’t hit test shadow content any more.
- (WebKit::WebPage::performActionMenuHitTestAtLocation):
- (WebKit::WebPage::lookupTextAtLocation):
- (WebKit::WebPage::focusAndSelectLastActionMenuHitTestResult):
-
-
-2014-12-04 Dana Burkart <[email protected]>
-
Merge r176763. <rdar://problem/19115662>
2014-12-03 Tim Horton <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp 2014-12-04 17:11:04 UTC (rev 176799)
@@ -54,7 +54,6 @@
, isScrollbar(hitTestResult.scrollbar())
, isSelected(hitTestResult.isSelected())
, isTextNode(hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode())
- , isOverTextInsideFormControlElement(hitTestResult.isOverTextInsideFormControlElement())
, isDownloadableMedia(hitTestResult.isDownloadableMedia())
{
}
@@ -76,7 +75,6 @@
encoder << isScrollbar;
encoder << isSelected;
encoder << isTextNode;
- encoder << isOverTextInsideFormControlElement;
encoder << isDownloadableMedia;
}
@@ -93,7 +91,6 @@
|| !decoder.decode(hitTestResultData.isScrollbar)
|| !decoder.decode(hitTestResultData.isSelected)
|| !decoder.decode(hitTestResultData.isTextNode)
- || !decoder.decode(hitTestResultData.isOverTextInsideFormControlElement)
|| !decoder.decode(hitTestResultData.isDownloadableMedia))
return false;
Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h 2014-12-04 17:11:04 UTC (rev 176799)
@@ -54,7 +54,6 @@
bool isScrollbar;
bool isSelected;
bool isTextNode;
- bool isOverTextInsideFormControlElement;
bool isDownloadableMedia;
Data();
@@ -87,8 +86,6 @@
bool isTextNode() const { return m_data.isTextNode; }
- bool isOverTextInsideFormControlElement() const { return m_data.isOverTextInsideFormControlElement; }
-
bool isDownloadableMedia() const { return m_data.isDownloadableMedia; }
private:
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm 2014-12-04 17:11:04 UTC (rev 176799)
@@ -1124,7 +1124,7 @@
return [self _defaultMenuItemsForImage];
}
- if (hitTestResult->isTextNode() || hitTestResult->isOverTextInsideFormControlElement()) {
+ if (hitTestResult->isTextNode()) {
NSArray *dataDetectorMenuItems = [self _defaultMenuItemsForDataDetectedText];
if (_currentActionContext) {
// If this is a data detected item with no menu items, we should not fall back to regular text options.
Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (176798 => 176799)
--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-12-04 17:05:12 UTC (rev 176798)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-12-04 17:11:04 UTC (rev 176799)
@@ -977,9 +977,23 @@
return;
}
+ RenderView& mainRenderView = *mainFrame.view()->renderView();
+
+ HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping);
+
IntPoint locationInContentCoordinates = mainFrame.view()->rootViewToContents(roundedIntPoint(locationInViewCooordinates));
- HitTestResult hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates);
+ HitTestResult hitTestResult(locationInContentCoordinates);
+ mainRenderView.hitTest(request, hitTestResult);
+ // We hit test including shadow content to get the desired result for editable text regions.
+ // But for media, we want to re-set to the shadow root.
+ if (Node* node = hitTestResult.innerNode()) {
+ if (Element* shadowHost = node->shadowHost()) {
+ if (shadowHost->isMediaElement())
+ hitTestResult.setToNonShadowAncestor();
+ }
+ }
+
ActionMenuHitTestResult actionMenuResult;
actionMenuResult.hitTestLocationInViewCooordinates = locationInViewCooordinates;
actionMenuResult.hitTestResult = WebHitTestResult::Data(hitTestResult);
@@ -1054,7 +1068,7 @@
return nullptr;
IntPoint point = roundedIntPoint(locationInViewCooordinates);
- HitTestResult result = mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point));
+ HitTestResult result = mainFrame.eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping);
NSDictionary *options = nil;
return rangeForDictionaryLookupAtHitTestResult(result, &options);
}
@@ -1074,13 +1088,13 @@
if (!element)
return;
- Frame* frame = element->document().frame();
- if (!frame)
+ auto renderer = element->renderer();
+ if (!renderer)
return;
- m_page->focusController().setFocusedElement(element, frame);
- VisiblePosition position = frame->visiblePositionForPoint(m_lastActionMenuHitTestResult.roundedPointInInnerNodeFrame());
- frame->selection().setSelection(position);
+ m_page->focusController().setFocusedElement(element, element->document().frame());
+ VisiblePosition position = renderer->positionForPoint(m_lastActionMenuHitTestResult.localPoint(), nullptr);
+ element->document().frame()->selection().setSelection(position);
}
void WebPage::dataDetectorsDidPresentUI(PageOverlay::PageOverlayID overlayID)