[Title] Change the focused frame if flame has different value between focusedFrame and hitTestResultFrame
[Issue#] N/A
[Problem] Sometimes text selection handles and context menu are not appear via longpress
[Cause] Sometimes focusedFrame and hitTestResultFrame has different value
[Solution] Change the focused frame if flame has different value between focusedFrame and hitTestResultFrame
Change-Id: Id3cbaf1764ad4f1827abe2aad5ac0256556faced
HitTestResult hitTestResult = frame->eventHandler()->hitTestResultAtPoint(frameView->windowToContents(positionForSelection), false);
+ if (hitTestResult.innerNonSharedNode()) {
+ Frame* hitTestFrame = hitTestResult.innerNonSharedNode()->document()->frame();
+ if (frame != hitTestFrame) {
+ frame->page()->focusController()->setFocusedFrame(hitTestFrame);
+ frame = hitTestFrame;
+ }
+ }
+
RefPtr<Range> range;
Element* URLElement = hitTestResult.URLElement();
if (URLElement) {