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

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

Issue 960123006: Merge 190872 "Traverse subframes during PrintContext::outputLink..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2311/
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
===================================================================
--- Source/core/page/PrintContext.cpp (revision 191009)
+++ Source/core/page/PrintContext.cpp (working copy)
@@ -236,12 +236,17 @@
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)
@@ -248,10 +253,13 @@
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