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

Unified Diff: Source/core/page/PrintContext.cpp

Issue 944533003: Traverse subframes during PrintContext::outputLinkAndLinkedDestinations() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/PrintContext.h ('k') | Source/core/page/PrintContextTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/PrintContext.cpp
diff --git a/Source/core/page/PrintContext.cpp b/Source/core/page/PrintContext.cpp
index 32ef68ec5f8c979719137a46b42f9c7de4680171..83edd2db4b98e698e474adfc823cf289a7fd582b 100644
--- a/Source/core/page/PrintContext.cpp
+++ b/Source/core/page/PrintContext.cpp
@@ -236,22 +236,30 @@ void PrintContext::collectLinkAndLinkedDestinations(Node* node)
bool linkIsValid = true;
if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(url, node->document().baseURL())) {
- String name = url.fragmentIdentifier();
- Element* element = node->document().findAnchor(name);
- if (element)
- m_linkedDestinations.set(name, element);
- else
+ // Only output anchors and links to anchors in the top-level frame because our PrintContext
+ // supports only one namespace for the anchors.
+ if (node->document().frame() == m_frame.get()) {
+ String name = url.fragmentIdentifier();
+ if (Element* element = node->document().findAnchor(name))
+ m_linkedDestinations.set(name, element);
+ else
+ linkIsValid = false;
+ } else {
linkIsValid = false;
+ }
}
if (linkIsValid)
m_linkDestinations.set(toElement(node), url);
}
-void PrintContext::outputLinkAndLinkedDestinations(GraphicsContext& graphicsContext, Node* node, const IntRect& pageRect)
+void PrintContext::outputLinkAndLinkedDestinations(GraphicsContext& graphicsContext, const IntRect& pageRect)
{
if (!m_linkAndLinkedDestinationsValid) {
- collectLinkAndLinkedDestinations(node);
+ for (Frame* currentFrame = frame(); currentFrame; currentFrame = currentFrame->tree().traverseNext(frame())) {
+ if (currentFrame->isLocalFrame())
+ collectLinkAndLinkedDestinations(toLocalFrame(currentFrame)->document());
+ }
m_linkAndLinkedDestinationsValid = true;
}
« no previous file with comments | « Source/core/page/PrintContext.h ('k') | Source/core/page/PrintContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698