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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp

Issue 2108803006: Fix inspector overlay when use-zoom-for-dsf is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plumb through frameview instead Created 4 years, 5 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
Index: third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp b/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
index 09c2e5836bcb30d8d2d2abba45db0a6eeb168518..f3521f5734ec18f71688d45c8cf74803a92d0377 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
@@ -27,9 +27,11 @@ public:
std::unique_ptr<protocol::ListValue> release() { return std::move(m_path); }
- void appendPath(const Path& path)
+ void appendPath(const Path& path, float pathScale)
{
- path.apply(this, &PathBuilder::appendPathElement);
+ Path transformPath(path);
+ transformPath.transform(AffineTransform().scale(pathScale));
+ transformPath.apply(this, &PathBuilder::appendPathElement);
}
protected:
@@ -90,10 +92,10 @@ public:
, m_layoutObject(layoutObject)
, m_shapeOutsideInfo(shapeOutsideInfo) { }
- static std::unique_ptr<protocol::ListValue> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path)
+ static std::unique_ptr<protocol::ListValue> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path, float pathScale)
{
ShapePathBuilder builder(view, layoutObject, shapeOutsideInfo);
- builder.appendPath(path);
+ builder.appendPath(path, pathScale);
return builder.release();
}
@@ -213,11 +215,12 @@ std::unique_ptr<protocol::DictionaryValue> buildElementInfo(Element* element)
} // namespace
-InspectorHighlight::InspectorHighlight()
+InspectorHighlight::InspectorHighlight(float highlightScale)
: m_highlightPaths(protocol::ListValue::create())
, m_showRulers(false)
, m_showExtensionLines(false)
, m_displayAsMaterial(false)
+ , m_highlightScale(highlightScale)
{
}
@@ -234,6 +237,7 @@ InspectorHighlight::InspectorHighlight(Node* node, const InspectorHighlightConfi
, m_showRulers(highlightConfig.showRulers)
, m_showExtensionLines(highlightConfig.showExtensionLines)
, m_displayAsMaterial(highlightConfig.displayAsMaterial)
+ , m_highlightScale(node->document().view()->viewportToWindowScale())
{
appendPathsForShapeOutside(node, highlightConfig);
appendNodeHighlight(node, highlightConfig);
@@ -249,7 +253,7 @@ void InspectorHighlight::appendQuad(const FloatQuad& quad, const Color& fillColo
{
Path path = quadToPath(quad);
PathBuilder builder;
- builder.appendPath(path);
+ builder.appendPath(path, m_highlightScale);
appendPath(builder.release(), fillColor, outlineColor, name);
}
@@ -288,9 +292,9 @@ void InspectorHighlight::appendPathsForShapeOutside(Node* node, const InspectorH
return;
}
- appendPath(ShapePathBuilder::buildPath(*node->document().view(), *node->layoutObject(), *shapeOutsideInfo, paths.shape), config.shape, Color::transparent);
+ appendPath(ShapePathBuilder::buildPath(*node->document().view(), *node->layoutObject(), *shapeOutsideInfo, paths.shape, m_highlightScale), config.shape, Color::transparent);
if (paths.marginShape.length())
- appendPath(ShapePathBuilder::buildPath(*node->document().view(), *node->layoutObject(), *shapeOutsideInfo, paths.marginShape), config.shapeMargin, Color::transparent);
+ appendPath(ShapePathBuilder::buildPath(*node->document().view(), *node->layoutObject(), *shapeOutsideInfo, paths.marginShape, m_highlightScale), config.shapeMargin, Color::transparent);
}
void InspectorHighlight::appendNodeHighlight(Node* node, const InspectorHighlightConfig& highlightConfig)
@@ -362,8 +366,8 @@ bool InspectorHighlight::getBoxModel(Node* node, std::unique_ptr<protocol::DOM::
if (const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &paths, &boundsQuad)) {
(*model)->setShapeOutside(protocol::DOM::ShapeOutsideInfo::create()
.setBounds(buildArrayForQuad(boundsQuad))
- .setShape(protocol::Array<protocol::Value>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape).get(), &errors))
- .setMarginShape(protocol::Array<protocol::Value>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape).get(), &errors))
+ .setShape(protocol::Array<protocol::Value>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape, 1.f).get(), &errors))
+ .setMarginShape(protocol::Array<protocol::Value>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape, 1.f).get(), &errors))
.build());
}

Powered by Google App Engine
This is Rietveld 408576698