New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 624139 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

A new inspector stylesheet is added for every enable/disable

Reported by r...@opera.com, Jun 28 2016

Issue description

On the second enable, the first inspector stylesheet still applies, but is inaccessible as an inspector stylesheet from the UI.

1. Open some page
2. Open the inspector and add a style rule to set the body background to red.
3. Close the inspector. Notice the body background is still red.
4. Open the inspector again. The stylesheet applies, but the rules are not in the inspector stylesheet.

Both inspector stylesheets can be found as normal sheets in <head> as described in  issue 623550 .

We should have a single inspector stylesheet for a document which is created and added to the style engine in a non-dom-observable fashion like we do for stylesheets injected from extensions (StyleEngine::m_injectedAuthorStyleSheets).

I am not sure if the sheet should be enabled/disabled when the inspector is enabled/disabled, but my proposal is that:

1. The inspector stylesheet only applies while the inspector is enabled.
2. The inspector stylesheet is not cleared when disabling such that the user can get the contents of the inspector stylesheet back when enabling the inspector again.

 
Owner: lushnikov@chromium.org
Status: Assigned (was: Available)
Cc: lushnikov@chromium.org
 Issue 623550  has been merged into this issue.

Comment 3 by r...@opera.com, Sep 5 2016

Owner: r...@opera.com
Status: Started (was: Assigned)
I've started looking at this as it's a prerequisite for getting async stylesheet updates to work.

Project Member

Comment 5 by bugdroid1@chromium.org, Sep 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/af38b2ad3019b41ee420097c6d81a5cebda7dadc

commit af38b2ad3019b41ee420097c6d81a5cebda7dadc
Author: rune <rune@opera.com>
Date: Wed Sep 07 19:13:55 2016

Store a single inspector stylesheet hidden from CSSOM.

Custom style rules can be added via the inspector. These were stored in
a stylesheet appended to <head>. That meant it was visible to the
document via CSSOM. Also, enabling/disabling the inspector would not
remember that a stylesheet was added, so the inspector started out with
a new blank stylesheet for editing, yet the existing rules still
applied.

This CL introduces a single inspector stylesheet in the StyleEngine
which takes part in the document collection to apply the rules, but it
is not appended to the document.styleSheets list. Neither is it
accessible through a <style> element in the DOM.

The stylesheet ends up after the author stylesheets in the order of
appearance. That is similar to how it was, but previously, sheets in
<body> would appear after the inspector sheet while sheets in <head>
would appear before.

The inspector sheet source is stored in a resource container like
changes for author stylesheets. This means the inspector sheet source
will persist across inspector enable/disable.

R=pfeldman@chromium.org,lushnikov@chromium.org
BUG= 624139 
TEST=http/tests/inspector-enabled/reattach-after-editing-styles.html

Review-Url: https://codereview.chromium.org/2312953002
Cr-Commit-Position: refs/heads/master@{#417021}

[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/LayoutTests/http/tests/inspector-enabled/reattach-after-editing-styles-expected.txt
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/dom/StyleEngine.cpp
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/dom/StyleEngine.h
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
[modify] https://crrev.com/af38b2ad3019b41ee420097c6d81a5cebda7dadc/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.h

Comment 6 by r...@opera.com, Sep 7 2016

Status: Fixed (was: Started)

Sign in to add a comment