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

Unified Diff: Source/web/LinkHighlight.cpp

Issue 622253004: Use a composed tree based traversal in computing quads in LinkHighlight::computeQuads(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: no pixel test Created 6 years, 2 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/web/LinkHighlight.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/LinkHighlight.cpp
diff --git a/Source/web/LinkHighlight.cpp b/Source/web/LinkHighlight.cpp
index afaed964dea86d828d588867dab34a3ac36f2986..34006a1ae200c8126c4b71b09904ee1895428436 100644
--- a/Source/web/LinkHighlight.cpp
+++ b/Source/web/LinkHighlight.cpp
@@ -29,6 +29,7 @@
#include "SkMatrix44.h"
#include "core/dom/Node.h"
+#include "core/dom/NodeRenderingTraversal.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/rendering/RenderLayer.h"
@@ -180,18 +181,23 @@ static void addQuadToPath(const FloatQuad& quad, Path& path)
path.closeSubpath();
}
-void LinkHighlight::computeQuads(RenderObject& renderer, Vector<FloatQuad>& outQuads) const
+void LinkHighlight::computeQuads(const Node& node, Vector<FloatQuad>& outQuads) const
{
+ if (!node.renderer())
+ return;
+
+ RenderObject* renderer = node.renderer();
+
// For inline elements, absoluteQuads will return a line box based on the line-height
// and font metrics, which is technically incorrect as replaced elements like images
// should use their intristic height and expand the linebox as needed. To get an
// appropriately sized highlight we descend into the children and have them add their
// boxes.
- if (renderer.isRenderInline()) {
- for (RenderObject* child = renderer.slowFirstChild(); child; child = child->nextSibling())
+ if (renderer->isRenderInline()) {
+ for (Node* child = NodeRenderingTraversal::firstChild(&node); child; child = NodeRenderingTraversal::nextSibling(child))
computeQuads(*child, outQuads);
} else {
- renderer.absoluteQuads(outQuads);
+ renderer->absoluteQuads(outQuads);
}
}
@@ -204,7 +210,7 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin
// Get quads for node in absolute coordinates.
Vector<FloatQuad> quads;
- computeQuads(*m_node->renderer(), quads);
+ computeQuads(*m_node, quads);
ASSERT(quads.size());
// Adjust for offset between target graphics layer and the node's renderer.
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698