Bug 1546636 - Should consider geometry box type r=longsonr

Geometry box was implemented long ago in Bug 1289011. But during some
refactoring, the existence of geometry box was overlooked. We add back
its support.

Differential Revision: https://phabricator.services.mozilla.com/D28815

--HG--
extra : moz-landing-system : lando
This commit is contained in:
violet 2019-04-25 19:56:15 +00:00
Родитель 56585dc81e
Коммит cd03f30677
4 изменённых файлов: 11 добавлений и 3 удалений

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

@ -0,0 +1,3 @@
<svg style="width: 400px; height: 400px">
<rect width="200" height="200" fill="purple"></rect>
</svg>

После

Ширина:  |  Высота:  |  Размер: 104 B

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

@ -0,0 +1,3 @@
<svg style="width: 400px; height: 400px">
<rect width="200" height="200" fill="purple" style="clip-path: fill-box"></rect>
</svg>

После

Ширина:  |  Высота:  |  Размер: 132 B

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

@ -81,6 +81,7 @@ fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||/^Windows\x20NT\x206\.[12]/
== clipPath-basic-08.svg pass.svg
== clipPath-basic-shape-transform.html clipPath-basic-shape-transform-ref.html
== clipPath-css-transform.html clipPath-css-transform-ref.html
== clipPath-fill-box.html clipPath-fill-box-ref.html
== clipPath-on-outflowElement-01a.html clipPath-on-outflowElement-01-ref.html
== clipPath-on-outflowElement-01b.html clipPath-on-outflowElement-01-ref.html
fuzzy(0-1,0-32400) == clipPath-on-outflowElement-02a.html clipPath-on-outflowElement-02-ref.html

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

@ -105,13 +105,14 @@ already_AddRefed<Path> nsCSSClipPathInstance::CreateClipPath(
r = nsRect(int(rr.x), int(rr.y), int(rr.width), int(rr.height));
if (mClipPathStyle.GetType() != StyleShapeSourceType::Shape) {
// TODO Clip to border-radius/reference box if no shape
// was specified.
if (mClipPathStyle.GetType() == StyleShapeSourceType::Box) {
RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
AppendRectToPath(builder, NSRectToRect(r, appUnitsPerDevPixel), true);
return builder->Finish();
}
MOZ_ASSERT(mClipPathStyle.GetType() == StyleShapeSourceType::Shape);
r = ToAppUnits(r.ToNearestPixels(appUnitsPerDevPixel), appUnitsPerDevPixel);
const auto& basicShape = mClipPathStyle.BasicShape();