Bug 1301673, use css pixels for the drag region, add each rectangle to the clip region so that tree drag feedback in drawn properly, r=tn

This commit is contained in:
Neil Deakin 2016-10-19 15:01:39 -04:00
Родитель 68ac95182c
Коммит 918a9cbcbe
1 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -5056,14 +5056,24 @@ PresShell::PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems
MOZ_ASSERT(ctx); // already checked the draw target above MOZ_ASSERT(ctx); // already checked the draw target above
if (aRegion) { if (aRegion) {
RefPtr<PathBuilder> builder = dt->CreatePathBuilder(FillRule::FILL_WINDING);
// Convert aRegion from CSS pixels to dev pixels // Convert aRegion from CSS pixels to dev pixels
nsIntRegion region = nsIntRegion region =
aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()) aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel())
.ToOutsidePixels(pc->AppUnitsPerDevPixel()); .ToOutsidePixels(pc->AppUnitsPerDevPixel());
for (auto iter = region.RectIter(); !iter.Done(); iter.Next()) { for (auto iter = region.RectIter(); !iter.Done(); iter.Next()) {
const nsIntRect& rect = iter.Get(); const nsIntRect& rect = iter.Get();
ctx->Clip(gfxRect(rect.x, rect.y, rect.width, rect.height));
builder->MoveTo(rect.TopLeft());
builder->LineTo(rect.TopRight());
builder->LineTo(rect.BottomRight());
builder->LineTo(rect.BottomLeft());
builder->LineTo(rect.TopLeft());
} }
RefPtr<Path> path = builder->Finish();
ctx->Clip(path);
} }
nsRenderingContext rc(ctx); nsRenderingContext rc(ctx);
@ -5151,8 +5161,8 @@ PresShell::RenderNode(nsIDOMNode* aNode,
return nullptr; return nullptr;
// move the region so that it is offset from the topleft corner of the surface // move the region so that it is offset from the topleft corner of the surface
aRegion->MoveBy(-pc->AppUnitsToDevPixels(area.x), aRegion->MoveBy(-nsPresContext::AppUnitsToIntCSSPixels(area.x),
-pc->AppUnitsToDevPixels(area.y)); -nsPresContext::AppUnitsToIntCSSPixels(area.y));
} }
return PaintRangePaintInfo(rangeItems, nullptr, aRegion, area, aPoint, return PaintRangePaintInfo(rangeItems, nullptr, aRegion, area, aPoint,