Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: Source/web/WebFrameImpl.cpp

Issue 215473002: Remove WebFrame::findChildByExpression. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 #include "core/frame/Settings.h" 155 #include "core/frame/Settings.h"
156 #include "core/rendering/HitTestResult.h" 156 #include "core/rendering/HitTestResult.h"
157 #include "core/rendering/RenderBox.h" 157 #include "core/rendering/RenderBox.h"
158 #include "core/rendering/RenderFrame.h" 158 #include "core/rendering/RenderFrame.h"
159 #include "core/rendering/RenderLayer.h" 159 #include "core/rendering/RenderLayer.h"
160 #include "core/rendering/RenderObject.h" 160 #include "core/rendering/RenderObject.h"
161 #include "core/rendering/RenderTreeAsText.h" 161 #include "core/rendering/RenderTreeAsText.h"
162 #include "core/rendering/RenderView.h" 162 #include "core/rendering/RenderView.h"
163 #include "core/rendering/style/StyleInheritedData.h" 163 #include "core/rendering/style/StyleInheritedData.h"
164 #include "core/timing/Performance.h" 164 #include "core/timing/Performance.h"
165 #include "core/xml/DocumentXPathEvaluator.h"
166 #include "core/xml/XPathResult.h"
167 #include "platform/TraceEvent.h" 165 #include "platform/TraceEvent.h"
168 #include "platform/UserGestureIndicator.h" 166 #include "platform/UserGestureIndicator.h"
169 #include "platform/clipboard/ClipboardUtilities.h" 167 #include "platform/clipboard/ClipboardUtilities.h"
170 #include "platform/fonts/FontCache.h" 168 #include "platform/fonts/FontCache.h"
171 #include "platform/graphics/GraphicsContext.h" 169 #include "platform/graphics/GraphicsContext.h"
172 #include "platform/graphics/GraphicsLayerClient.h" 170 #include "platform/graphics/GraphicsLayerClient.h"
173 #include "platform/graphics/skia/SkiaUtils.h" 171 #include "platform/graphics/skia/SkiaUtils.h"
174 #include "platform/network/ResourceRequest.h" 172 #include "platform/network/ResourceRequest.h"
175 #include "platform/scroll/ScrollbarTheme.h" 173 #include "platform/scroll/ScrollbarTheme.h"
176 #include "platform/scroll/ScrollTypes.h" 174 #include "platform/scroll/ScrollTypes.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 return fromFrame(frame()->tree().traverseNextWithWrap(wrap)); 704 return fromFrame(frame()->tree().traverseNextWithWrap(wrap));
707 } 705 }
708 706
709 WebFrame* WebFrameImpl::findChildByName(const WebString& name) const 707 WebFrame* WebFrameImpl::findChildByName(const WebString& name) const
710 { 708 {
711 if (!frame()) 709 if (!frame())
712 return 0; 710 return 0;
713 return fromFrame(frame()->tree().child(name)); 711 return fromFrame(frame()->tree().child(name));
714 } 712 }
715 713
716 WebFrame* WebFrameImpl::findChildByExpression(const WebString& xpath) const
717 {
718 if (xpath.isEmpty())
719 return 0;
720
721 Document* document = frame()->document();
722 ASSERT(document);
723
724 RefPtrWillBeRawPtr<XPathResult> xpathResult = DocumentXPathEvaluator::evalua te(*document, xpath, document, nullptr, XPathResult::ORDERED_NODE_ITERATOR_TYPE, 0, IGNORE_EXCEPTION);
725 if (!xpathResult)
726 return 0;
727
728 Node* node = xpathResult->iterateNext(IGNORE_EXCEPTION);
729 if (!node || !node->isFrameOwnerElement())
730 return 0;
731 return fromFrame(toLocalFrame(toHTMLFrameOwnerElement(node)->contentFrame()) );
732 }
733
734 WebDocument WebFrameImpl::document() const 714 WebDocument WebFrameImpl::document() const
735 { 715 {
736 if (!frame() || !frame()->document()) 716 if (!frame() || !frame()->document())
737 return WebDocument(); 717 return WebDocument();
738 return WebDocument(frame()->document()); 718 return WebDocument(frame()->document());
739 } 719 }
740 720
741 WebPerformance WebFrameImpl::performance() const 721 WebPerformance WebFrameImpl::performance() const
742 { 722 {
743 if (!frame()) 723 if (!frame())
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 1957
1978 void WebFrameImpl::invalidateAll() const 1958 void WebFrameImpl::invalidateAll() const
1979 { 1959 {
1980 ASSERT(frame() && frame()->view()); 1960 ASSERT(frame() && frame()->view());
1981 FrameView* view = frame()->view(); 1961 FrameView* view = frame()->view();
1982 view->invalidateRect(view->frameRect()); 1962 view->invalidateRect(view->frameRect());
1983 invalidateScrollbar(); 1963 invalidateScrollbar();
1984 } 1964 }
1985 1965
1986 } // namespace blink 1966 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebFrameImpl.h ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698