Closed Bug 1605803 Opened 6 years ago Closed 6 years ago

content property of getComputedStyle is being returned as none

Categories

(Core :: CSS Parsing and Computation, defect)

71 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla73
Webcompat Priority ?
Tracking Status
firefox73 --- fixed

People

(Reporter: ksenia, Assigned: emilio)

References

()

Details

Attachments

(2 files)

Attached file 46914.html

As reported here https://github.com/webcompat/web-bugs/issues/46914

Steps to reproduce:

Visit https://webgis.ci.brookfield.wi.us/BrookfieldWebMap/ and observe the site

Actual:
Map doesn't load

Expected:
Map loads

The problem seems to be that getComputedStyle(element)).content is none, however the site is expecting it to be normal. I've attached a reduced test case.

Blink / WebKit returns none for pseudo-elements getComputedStyle(element, "::before").content, but normal for elements...

And Safari returns the empty string, yay interop :-(

Is this broken in Safari as well?

Flags: needinfo?(kberezina)

Pff, probably not, from the snippet: b && "normal" != b ? d([eval(b)], c) : c(), so the empty string means we'll never test for normal...

Ugh.

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)

Pff, probably not, from the snippet: b && "normal" != b ? d([eval(b)], c) : c(), so the empty string means we'll never test for normal...

Ugh.

Yeah, working in Safari because of this exact reason :(

Flags: needinfo?(kberezina)
Blocks: 1605473

This cleans up and also allows us to keep the distinction between content: none
and content: normal, which allows us to fix the computed style we return from
getComputedStyle().

Do this last bit from the resolved value instead of StyleAdjuster, because
otherwise we need to tweak every initial struct for ::before / ::after.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

BTW, this is the hack that Chromium uses: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/properties/computed_style_utils.cc?rcl=70c8dc746602493b5e49a50365ce3e636e15c205&l=1902-1907

  if (!list->length()) {
    PseudoId pseudoId = style.StyleType();
    if (pseudoId == kPseudoIdBefore || pseudoId == kPseudoIdAfter)
      return CSSIdentifierValue::Create(CSSValueID::kNone);
    return CSSIdentifierValue::Create(CSSValueID::kNormal);
  }

If you plan to store content: normal and content: none as different values because of bug 1605473, will you also support content: none in elements? Or will it just compute as a different value but will still behave like content: normal?

I plan to make it compute a different value but still behave like normal.

That's a bit unfortunate... Implementing none on elements should be simple, but probably worth a separate bug. Probably worth making content: none compute to normal on elements too for now.

I also filed https://github.com/w3c/csswg-drafts/issues/4632 on content: contents which would break this website as well.

Flags: needinfo?(emilio)
Blocks: 1606628
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fc3002cb85dc Use cbindgen for content property. r=xidorn
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/21042 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Upstream PR merged by moz-wptsync-bot
Regressions: 1618277
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: