Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
index 074ddd83efbbd192e16f1e4075ad0b34eecd2604..65b23207223c5d5063c1a0055239a6afe1616c90 100644 |
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
@@ -1553,11 +1553,8 @@ LocalFrame* WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request, |
void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size) |
{ |
- // This is only possible on the main frame. |
- if (m_textFinder && m_textFinder->totalMatchCount() > 0) { |
- DCHECK(!parent()); |
+ if (m_textFinder && m_textFinder->totalMatchCount() > 0) |
m_textFinder->increaseMarkerVersion(); |
- } |
} |
void WebLocalFrameImpl::createFrameView() |
@@ -1625,12 +1622,7 @@ WebDataSourceImpl* WebLocalFrameImpl::provisionalDataSourceImpl() const |
void WebLocalFrameImpl::setFindEndstateFocusAndSelection() |
{ |
- WebLocalFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); |
- |
- // Main frame should already have a textFinder at this point of time. |
- DCHECK(mainFrameImpl->textFinder()); |
- |
- if (this != mainFrameImpl->textFinder()->activeMatchFrame()) |
+ if (!m_textFinder || !m_textFinder->activeMatchFrame()) |
return; |
if (Range* activeMatch = m_textFinder->activeMatch()) { |
@@ -1811,6 +1803,11 @@ void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f |
toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight); |
} |
+bool WebLocalFrameImpl::isFocused() const |
+{ |
+ return this == WebFrame::fromFrame(viewImpl()->page()->focusController().focusedFrame()); |
+} |
+ |
WebLocalFrameImpl* WebLocalFrameImpl::localRoot() |
{ |
// This can't use the LocalFrame::localFrameRoot, since it may be called |
@@ -2001,8 +1998,6 @@ void WebLocalFrameImpl::cancelPendingScopingEffort() |
void WebLocalFrameImpl::increaseMatchCount(int count, int identifier) |
{ |
- // This function should only be called on the mainframe. |
- DCHECK(!parent()); |
ensureTextFinder().increaseMatchCount(identifier, count); |
} |
@@ -2019,8 +2014,6 @@ void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOri |
int WebLocalFrameImpl::findMatchMarkersVersion() const |
{ |
- DCHECK(!parent()); |
- |
if (m_textFinder) |
return m_textFinder->findMatchMarkersVersion(); |
return 0; |
@@ -2028,14 +2021,18 @@ int WebLocalFrameImpl::findMatchMarkersVersion() const |
int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRect* selectionRect) |
{ |
- DCHECK(!parent()); |
return ensureTextFinder().selectNearestFindMatch(point, selectionRect); |
} |
-WebFloatRect WebLocalFrameImpl::activeFindMatchRect() |
+float WebLocalFrameImpl::nearestFindMatch(const WebFloatPoint& point) |
{ |
- DCHECK(!parent()); |
+ float nearestDistance; |
+ ensureTextFinder().nearestFindMatch(point, &nearestDistance); |
+ return nearestDistance; |
+} |
+WebFloatRect WebLocalFrameImpl::activeFindMatchRect() |
+{ |
if (m_textFinder) |
return m_textFinder->activeFindMatchRect(); |
return WebFloatRect(); |
@@ -2043,7 +2040,6 @@ WebFloatRect WebLocalFrameImpl::activeFindMatchRect() |
void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects) |
{ |
- DCHECK(!parent()); |
ensureTextFinder().findMatchRects(outputRects); |
} |
@@ -2112,4 +2108,9 @@ void WebLocalFrameImpl::forceSandboxFlags(WebSandboxFlags flags) |
frame()->loader().forceSandboxFlags(static_cast<SandboxFlags>(flags)); |
} |
+void WebLocalFrameImpl::clearActiveFindMatch() |
+{ |
+ ensureTextFinder().clearActiveFindMatch(); |
+} |
+ |
} // namespace blink |