Commit edd10b43 authored by Alex Rudenko's avatar Alex Rudenko Committed by Commit Bot

CDP: Expose CSSStyleSheetHeader.isConstructed

Issue 1125357 highlighted a case which was not accounted for previously:
<link> CSS files can be edited via DevTools making them look like
constructed stylesheets. This CL adds an explicit isConstructed attribute
to CSSStyleSheetHeader for the frontend to be able to distinguish
between constructed and linked stylesheets.

Frontend CL: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2403326

Bug: 1125357
Change-Id: I66f5d9c935a0992977737c323476494db5331959
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403560Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806103}
parent 0b894aaa
......@@ -1076,9 +1076,11 @@ experimental domain CSS
boolean isInline
# Whether this stylesheet is mutable. Inline stylesheets become mutable
# after they have been modified via CSSOM API.
# <link> element's stylesheets are never mutable. Constructed stylesheets
# (new CSSStyleSheet()) are mutable immediately after creation.
# <link> element's stylesheets become mutable only if DevTools modifies them.
# Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
boolean isMutable
# Whether this stylesheet is a constructed stylesheet (created using new CSSStyleSheet()).
boolean isConstructed
# Line offset of the stylesheet within the resource (zero based).
number startLine
# Column offset of the stylesheet within the resource (zero based).
......
......@@ -1539,6 +1539,7 @@ InspectorStyleSheet::BuildObjectForStyleSheetInfo() {
.setTitle(style_sheet->title())
.setFrameId(frame ? IdentifiersFactory::FrameId(frame) : "")
.setIsInline(style_sheet->IsInline() && !StartsAtZero())
.setIsConstructed(style_sheet->IsConstructed())
.setIsMutable(style_sheet->Contents()->IsMutable())
.setStartLine(start.line_.ZeroBasedInt())
.setStartColumn(start.column_.ZeroBasedInt())
......
......@@ -1800,6 +1800,7 @@ crbug.com/1075869 http/tests/devtools/elements/styles-1/color-swatch.js [ Pass F
crbug.com/1075869 http/tests/devtools/elements/styles-3/spectrum.js [ Pass Failure ]
crbug.com/1075869 http/tests/devtools/elements/styles-4/styles-invalid-color-values.js [ Pass Failure ]
crbug.com/1075869 http/tests/devtools/extensions/extensions-timeline-api.js [ Pass Failure Timeout ]
crbug.com/1125357 http/tests/devtools/elements/styles-3/styles-cssom-important-property.js [ Pass Failure ]
# On these platforms (all but Android) media tests don't currently use gpu-accelerated (proprietary) codecs, so no
# benefit to running them again with gpu acceleration enabled.
......
......@@ -3,7 +3,7 @@ Tests that !important modifier is shown for CSSOM-generated properties.
element.style { ()
[expanded]
div { (constructed stylesheet)
div { (<style>)
color: red !important;
[expanded]
......
......@@ -7,6 +7,7 @@ The test verifies events fire for adding, changing, and removing CSSStyleSheets.
endColumn : 6
endLine : 4
frameId : <string>
isConstructed : false
isInline : false
isMutable : false
length : <number>
......@@ -36,6 +37,7 @@ The test verifies events fire for adding, changing, and removing CSSStyleSheets.
endColumn : 6
endLine : 4
frameId : <string>
isConstructed : false
isInline : false
isMutable : true
length : <number>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment