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

Issue 22482004: Add support for the object-fit CSS property. (Closed)

Created:
7 years, 4 months ago by mstensho (USE GERRIT)
Modified:
7 years, 4 months ago
Reviewers:
pdr., ojan
CC:
blink-reviews, jamesr, eae+blinkwatch, leviw+renderwatch, danakj, dglazkov+blink, Rik, apavlov+blink_chromium.org, gavinp+loader_chromium.org, jchaffraix+rendering, darktears, Stephen Chennney, Nate Chapin, jeez
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Add support for the object-fit CSS property. This is hidden behind an "experimental" runtime flag named "ObjectFitPosition". Once object-fit's "sister" property, object-position, is implemented, the plan is to also put that behind this flag, too. This is an implementation of object-fit as described in http://www.w3.org/TR/2012/CR-css3-images-20120417/#object-fit Object-fit is used to maintain the aspect ratio of replaced content within its content box. All object-fit values except the initial one ('fill') will always ensure that the aspect ratio is retained, in different ways (fit inside the content box, cover the content box, or use intrinsic size). Painting is always clipped against the content box, regardless of the 'overflow' property. Video elements used to behave like 'object-fit:contain', while the initial value is, as mentioned above, 'fill'. Therefore we need a section for video in the UA style sheet. Introducing RenderImageResource::intrinsicSize(). We cannot use imageSize(), since it may return the extrinsic size for SVG images. Parts of this patch (both code and layout tests) are based on work originally done by Simon Fraser <simon.fraser@apple.com>;. See https://bugs.webkit.org/show_bug.cgi?id=52040 BUG=236331 R=pdr@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156535

Patch Set 1 #

Patch Set 2 : Oops, sorry! Forgot to update UseCounter.cpp #

Total comments: 8

Patch Set 3 : Code review #

Total comments: 9

Patch Set 4 : Code review #

Total comments: 4

Patch Set 5 : Code review - new test: slow SVG loading, and revert a change (some clipping is fine, after all) #

Patch Set 6 : Rebase master (CachedImage has packed up and moved (and changed its name to ImageResource)) #

Patch Set 7 : Add FIXME #

Patch Set 8 : Rebase master (no conflicts) #

Patch Set 9 : Patch for landing #

Patch Set 10 : Rebase for landing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+685 lines, -37 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/svg/css/script-tests/svg-paint-order.js View 1 2 3 4 5 6 7 8 9 1 chunk +106 lines, -0 lines 0 comments Download
A + LayoutTests/svg/css/svg-paint-order.html View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
A LayoutTests/svg/css/svg-paint-order-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +69 lines, -0 lines 0 comments Download
A LayoutTests/svg/paintorder/paintorder.svg View 1 2 3 4 5 6 7 8 9 1 chunk +37 lines, -0 lines 0 comments Download
A LayoutTests/svg/paintorder/paintorder-expected.svg View 1 2 3 4 5 6 7 8 9 1 chunk +61 lines, -0 lines 0 comments Download
A LayoutTests/svg/paintorder/paintorder-text.svg View 1 2 3 4 5 6 7 8 9 1 chunk +37 lines, -0 lines 0 comments Download
A LayoutTests/svg/paintorder/paintorder-text-expected.svg View 1 2 3 4 5 6 7 8 9 1 chunk +61 lines, -0 lines 0 comments Download
A LayoutTests/svg/repaint/repaint-paintorder.svg View 1 2 3 4 5 6 7 8 9 1 chunk +39 lines, -0 lines 0 comments Download
M Source/core/css/CSSComputedStyleDeclaration.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/css/CSSParser.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/css/CSSPrimitiveValueMappings.h View 1 2 3 4 5 6 7 8 9 1 chunk +39 lines, -0 lines 0 comments Download
M Source/core/css/CSSProperty.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/CSSValueKeywords.in View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
M Source/core/css/SVGCSSComputedStyleDeclaration.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +23 lines, -0 lines 0 comments Download
M Source/core/css/SVGCSSParser.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +69 lines, -0 lines 0 comments Download
M Source/core/css/SVGCSSPropertyNames.in View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/SVGCSSValueKeywords.in View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -0 lines 0 comments Download
M Source/core/css/resolver/StyleBuilderCustom.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +38 lines, -0 lines 0 comments Download
M Source/core/page/RuntimeCSSEnabled.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/page/RuntimeEnabledFeatures.in View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/page/UseCounter.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/style/SVGRenderStyle.h View 1 2 3 4 5 6 7 8 9 6 chunks +8 lines, -1 line 0 comments Download
M Source/core/rendering/style/SVGRenderStyle.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M Source/core/rendering/style/SVGRenderStyleDefs.h View 1 2 3 4 5 6 7 8 9 1 chunk +11 lines, -0 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGShape.h View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -1 line 0 comments Download
M Source/core/rendering/svg/RenderSVGShape.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +28 lines, -23 lines 0 comments Download
M Source/core/rendering/svg/SVGInlineTextBox.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +23 lines, -10 lines 0 comments Download
M Source/core/scripts/make_runtime_features.py View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/svg/SVGElement.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -0 lines 0 comments Download
M Source/core/svg/svgattrs.in View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
mstensho (USE GERRIT)
Ojan, could this be something for you? If not, feel free to suggest another reviewer. ...
7 years, 4 months ago (2013-08-07 14:16:27 UTC) #1
ojan
I've done a first pass through the review. It mostly looks good. I need to ...
7 years, 4 months ago (2013-08-08 02:36:54 UTC) #2
mstensho (USE GERRIT)
https://codereview.chromium.org/22482004/diff/5002/LayoutTests/fast/css/parsing-object-fit.html File LayoutTests/fast/css/parsing-object-fit.html (right): https://codereview.chromium.org/22482004/diff/5002/LayoutTests/fast/css/parsing-object-fit.html#newcode10 LayoutTests/fast/css/parsing-object-fit.html:10: <script src="script-tests/parsing-object-fit.js"></script> On 2013/08/08 02:36:55, ojan wrote: > We're ...
7 years, 4 months ago (2013-08-08 07:26:42 UTC) #3
ojan
I couple more minor things. I've enlisted pdr to make sure the paint side of ...
7 years, 4 months ago (2013-08-09 23:27:26 UTC) #4
pdr.
Just two light comments. Overall this is quite nice. I like the implementation of intrinsicSize ...
7 years, 4 months ago (2013-08-09 23:39:21 UTC) #5
mstensho (USE GERRIT)
On 2013/08/09 23:39:21, pdr wrote: > I like the implementation of intrinsicSize but I wonder ...
7 years, 4 months ago (2013-08-12 13:37:36 UTC) #6
mstensho (USE GERRIT)
https://codereview.chromium.org/22482004/diff/13001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp (right): https://codereview.chromium.org/22482004/diff/13001/Source/core/rendering/RenderImage.cpp#newcode393 Source/core/rendering/RenderImage.cpp:393: paintIntoRect(context, paintRect); On 2013/08/09 23:39:22, pdr wrote: > In ...
7 years, 4 months ago (2013-08-12 13:39:10 UTC) #7
ojan
https://codereview.chromium.org/22482004/diff/13001/Source/core/rendering/RenderReplaced.cpp File Source/core/rendering/RenderReplaced.cpp (right): https://codereview.chromium.org/22482004/diff/13001/Source/core/rendering/RenderReplaced.cpp#newcode314 Source/core/rendering/RenderReplaced.cpp:314: LayoutRect RenderReplaced::replacedContentRect(const LayoutSize* overriddenIntrinsicSize) const On 2013/08/12 13:39:11, Morten ...
7 years, 4 months ago (2013-08-12 17:25:56 UTC) #8
pdr.
Looking great. Lets do one more round on the RenderImage.cpp part. https://codereview.chromium.org/22482004/diff/27001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp (right): ...
7 years, 4 months ago (2013-08-14 22:00:53 UTC) #9
mstensho (USE GERRIT)
https://codereview.chromium.org/22482004/diff/27001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp (right): https://codereview.chromium.org/22482004/diff/27001/Source/core/rendering/RenderImage.cpp#newcode254 Source/core/rendering/RenderImage.cpp:254: updateInnerContentRect(); On 2013/08/14 22:00:54, pdr wrote: > I don't ...
7 years, 4 months ago (2013-08-15 15:14:01 UTC) #10
pdr.
On 2013/08/15 15:14:01, Morten Stenshorne wrote: > https://codereview.chromium.org/22482004/diff/27001/Source/core/rendering/RenderImage.cpp > File Source/core/rendering/RenderImage.cpp (right): > > https://codereview.chromium.org/22482004/diff/27001/Source/core/rendering/RenderImage.cpp#newcode254 ...
7 years, 4 months ago (2013-08-15 16:15:36 UTC) #11
mstensho (USE GERRIT)
On 2013/08/15 16:15:36, pdr wrote: > This should already be handled. Here's how it should ...
7 years, 4 months ago (2013-08-15 18:44:47 UTC) #12
pdr.
On 2013/08/15 18:44:47, Morten Stenshorne wrote: > On 2013/08/15 16:15:36, pdr wrote: > > This ...
7 years, 4 months ago (2013-08-17 02:06:17 UTC) #13
mstensho (USE GERRIT)
On 2013/08/17 02:06:17, pdr wrote: > On 2013/08/15 18:44:47, Morten Stenshorne wrote: > > On ...
7 years, 4 months ago (2013-08-19 14:46:38 UTC) #14
pdr.
On 2013/08/19 14:46:38, Morten Stenshorne wrote: > On 2013/08/17 02:06:17, pdr wrote: > > On ...
7 years, 4 months ago (2013-08-19 17:16:04 UTC) #15
pdr.
LGTM
7 years, 4 months ago (2013-08-21 05:43:11 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mstensho@opera.com/22482004/62001
7 years, 4 months ago (2013-08-21 05:43:35 UTC) #17
commit-bot: I haz the power
Can't process patch for file LayoutTests/fast/css/resources/circles-portrait-small.png. Binary file support is temporarilly disabled due to a ...
7 years, 4 months ago (2013-08-21 05:44:02 UTC) #18
pdr.
On 2013/08/21 05:44:02, I haz the power (commit-bot) wrote: > Can't process patch for file ...
7 years, 4 months ago (2013-08-21 05:48:46 UTC) #19
mstensho (USE GERRIT)
On 2013/08/21 05:48:46, pdr wrote: > On 2013/08/21 05:44:02, I haz the power (commit-bot) wrote: ...
7 years, 4 months ago (2013-08-21 06:09:42 UTC) #20
pdr.
On 2013/08/21 06:09:42, Morten Stenshorne wrote: > On 2013/08/21 05:48:46, pdr wrote: > > On ...
7 years, 4 months ago (2013-08-21 06:23:55 UTC) #21
pdr.
7 years, 4 months ago (2013-08-22 03:33:38 UTC) #22
Message was sent while issue was closed.
Committed patchset #9 manually as r156535 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698