Bug 128958 - Add support for the isolation property
Summary: Add support for the isolation property
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 129661
  Show dependency treegraph
 
Reported: 2014-02-17 23:41 PST by Mihai Tica
Modified: 2014-03-03 23:49 PST (History)
17 users (show)

See Also:


Attachments
Patch V1 (17.91 KB, patch)
2014-02-18 00:16 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch V2 (17.87 KB, patch)
2014-02-18 00:34 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch V3 (18.27 KB, patch)
2014-02-19 01:19 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch V4 (25.77 KB, patch)
2014-02-24 05:44 PST, Mihai Tica
no flags Details | Formatted Diff | Diff
Patch V4. Addressed Dirk's comments (25.80 KB, patch)
2014-02-24 08:24 PST, Mihai Tica
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Tica 2014-02-17 23:41:28 PST
The isolation property is part of the CSS Blending specification: http://dev.w3.org/fxtf/compositing-1/#isolation

Parse and implement a prefixed version of the property. The allowed values for -webkit-isolation are isolate and auto(default).
Comment 1 Mihai Tica 2014-02-18 00:16:33 PST
Created attachment 224476 [details]
Patch V1
Comment 2 Mihai Tica 2014-02-18 00:34:54 PST
Created attachment 224479 [details]
Patch V2
Comment 3 Andreas Kling 2014-02-18 10:25:44 PST
Comment on attachment 224479 [details]
Patch V2

View in context: https://bugs.webkit.org/attachment.cgi?id=224479&action=review

> Source/WebCore/css/CSSPrimitiveValueMappings.h:4158
> +template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Isolation i)

Short variable names like "i" are not consistent with WebKit style. We tend to prefer e.g like "isolation".

> Source/WebCore/css/CSSPrimitiveValueMappings.h:4169
> +    switch (i) {
> +    case IsolationAuto:
> +        m_value.valueID = CSSValueAuto;
> +        break;
> +    case IsolationIsolate:
> +        m_value.valueID = CSSValueIsolate;
> +        break;
> +    }

We should have a default case here with ASSERT_NOT_REACHED(), just like we do when converting in the other direction.

> Source/WebCore/rendering/style/RenderStyle.h:974
> +    void setIsolation(Isolation v) { rareNonInheritedData.access()->m_isolation = v; }

Using rareNonInheritedData.access() like this will force the RenderStyle to create its own unique copy of the StyleRareNonInheritedData. If you look at other setters in this file, they use a macro (SET_VAR) that first checks if the value being written is identical to the existing one, and avoids a copy in that case.
Comment 4 Mihai Tica 2014-02-19 01:19:01 PST
Created attachment 224608 [details]
Patch V3

Addressed issues highlighted by Andreas Kling.
Comment 5 Simon Fraser (smfr) 2014-02-19 10:44:28 PST
Comment on attachment 224608 [details]
Patch V3

View in context: https://bugs.webkit.org/attachment.cgi?id=224608&action=review

> Source/WebCore/rendering/style/RenderStyle.h:975
> +    bool hasIsolation() const { return rareNonInheritedData->m_isolation != IsolationAuto; }

Won't this crash if rareNonInheritedData hasn't been allocated?
Comment 6 Mihai Tica 2014-02-20 01:13:13 PST
(In reply to comment #5)
> (From update of attachment 224608 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=224608&action=review
> 
> > Source/WebCore/rendering/style/RenderStyle.h:975
> > +    bool hasIsolation() const { return rareNonInheritedData->m_isolation != IsolationAuto; }
> 
> Won't this crash if rareNonInheritedData hasn't been allocated?

All of RenderStyle's constructors initialise a valid rareNonInheritedData member, so I don't think this will crash.
Comment 7 Mihai Tica 2014-02-24 05:44:16 PST
Created attachment 225055 [details]
Patch V4

Add SVG implementation. Add additional tests for HTML and SVG. Please have another look.
Comment 8 Dirk Schulze 2014-02-24 07:22:05 PST
Comment on attachment 225055 [details]
Patch V4

View in context: https://bugs.webkit.org/attachment.cgi?id=225055&action=review

The patch looks good to me. Just two snippets. I give the other reviewers some time to review the patch as well before giving my r+. Maybe Simon has more comments.

> Source/WebCore/rendering/style/RenderStyle.h:974
> +    void setBlendMode(BlendMode v) { SET_VAR(rareNonInheritedData, m_effectiveBlendMode, v); }
>      bool hasBlendMode() const { return static_cast<BlendMode>(rareNonInheritedData->m_effectiveBlendMode) != BlendModeNormal; }
> +
> +    Isolation isolation() const { return static_cast<Isolation>(rareNonInheritedData->m_isolation); }
> +    void setIsolation(Isolation v) { SET_VAR(rareNonInheritedData, m_isolation, v); }

should still have longer names like blendMode and isolation instead of v. Regardless of the use elsewhere.
Comment 9 Mihai Tica 2014-02-24 08:24:43 PST
Created attachment 225068 [details]
Patch V4. Addressed Dirk's comments
Comment 10 Dirk Schulze 2014-02-27 04:37:24 PST
Comment on attachment 225068 [details]
Patch V4. Addressed Dirk's comments

LGTM. Since no further review comments came from Simon and kling: r=me
Comment 11 WebKit Commit Bot 2014-02-27 05:09:55 PST
Comment on attachment 225068 [details]
Patch V4. Addressed Dirk's comments

Clearing flags on attachment: 225068

Committed r164795: <http://trac.webkit.org/changeset/164795>
Comment 12 WebKit Commit Bot 2014-02-27 05:09:59 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Alexey Proskuryakov 2014-02-27 21:03:09 PST
css3/compositing/isolation-isolate-blended-child.html test added in this patch fails every time on one of the bots. Filed bug 129468.