Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193441 => 193442)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-04 20:52:04 UTC (rev 193442)
@@ -1,5 +1,22 @@
2015-12-04 Timothy Hatcher <[email protected]>
+ Merge r188631. rdar://problem/23581597
+
+ 2015-08-18 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Links for rules in <style> are incorrect, do not account for <style> offset in the document
+ https://bugs.webkit.org/show_bug.cgi?id=148141
+
+ Reviewed by Brian Burg.
+
+ * inspector/css/getAllStyleSheets-expected.txt: Added.
+ * inspector/css/getAllStyleSheets.html: Added.
+ * inspector/css/resources/external.css: Added.
+ (body):
+ Test for style sheet header information for external and inline stylesheets.
+
+2015-12-04 Timothy Hatcher <[email protected]>
+
Merge r187496. rdar://problem/23581597
2015-07-28 Joseph Pecoraro <[email protected]>
Added: branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets-expected.txt (0 => 193442)
--- branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets-expected.txt (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets-expected.txt 2015-12-04 20:52:04 UTC (rev 193442)
@@ -0,0 +1,16 @@
+Test CSS.getAllStyleSheets returns expected information for different style sheet sources.
+
+PASS: There should be three stylesheets.
+
+URL: inspector/css/resources/external.css
+OFFSET: (0, 0)
+PASS: Stylesheet should have a frame.
+
+URL: <style> on inspector/css/getAllStyleSheets.html
+OFFSET: (5, 7)
+PASS: Stylesheet should have a frame.
+
+URL: inspector/css/getAllStyleSheets.html
+OFFSET: (0, 0)
+PASS: Stylesheet should have a frame.
+
Added: branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets.html (0 => 193442)
--- branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets.html (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/css/getAllStyleSheets.html 2015-12-04 20:52:04 UTC (rev 193442)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<link rel="stylesheet" href=""
+<style>body { color: blue; }</style>
+<script>
+var style = document.createElement("style");
+style.textContent = "body { color: gray; }";
+document.head.appendChild(style);
+</script>
+</script>
+<script>
+function test()
+{
+ function sanitizeURL(url) {
+ return url.replace(/^.*?LayoutTests\//, "");
+ }
+
+ WebInspector.cssStyleManager.fetchStyleSheetsIfNeeded();
+ InspectorBackend.runAfterPendingDispatches(function() {
+ let styleSheets = WebInspector.cssStyleManager.styleSheets;
+ InspectorTest.expectThat(styleSheets.length === 3, "There should be three stylesheets.");
+
+ for (let styleSheet of styleSheets) {
+ InspectorTest.log("");
+ InspectorTest.log(`URL: ${styleSheet.isInlineStyleTag() ? "<style> on " : ""}${sanitizeURL(styleSheet.url)}`);
+ InspectorTest.log(`OFFSET: (${styleSheet.startLineNumber}, ${styleSheet.startColumnNumber})`);
+ InspectorTest.expectThat(styleSheet.parentFrame, "Stylesheet should have a frame.");
+ }
+
+ InspectorTest.completeTest();
+ });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test CSS.getAllStyleSheets returns expected information for different style sheet sources.</p>
+</body>
+</html>
Added: branches/safari-601.1.46-branch/LayoutTests/inspector/css/resources/external.css (0 => 193442)
--- branches/safari-601.1.46-branch/LayoutTests/inspector/css/resources/external.css (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/css/resources/external.css 2015-12-04 20:52:04 UTC (rev 193442)
@@ -0,0 +1 @@
+body { color: red; }
Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog 2015-12-04 20:52:04 UTC (rev 193442)
@@ -1,5 +1,21 @@
2015-12-04 Timothy Hatcher <[email protected]>
+ Merge r188631. rdar://problem/23581597
+
+ 2015-08-18 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Links for rules in <style> are incorrect, do not account for <style> offset in the document
+ https://bugs.webkit.org/show_bug.cgi?id=148141
+
+ Reviewed by Brian Burg.
+
+ * inspector/protocol/CSS.json:
+ Extend StyleSheetHeader to include start offset information and a bit
+ for whether or not this was an inline style tag created by the parser.
+ These match additions to Blink's protocol.
+
+2015-12-04 Timothy Hatcher <[email protected]>
+
Merge r187496. rdar://problem/23581597
2015-07-28 Joseph Pecoraro <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json 2015-12-04 20:52:04 UTC (rev 193442)
@@ -96,7 +96,10 @@
{ "name": "sourceURL", "type": "string", "description": "Stylesheet resource URL."},
{ "name": "origin", "$ref": "StyleSheetOrigin", "description": "Stylesheet origin."},
{ "name": "title", "type": "string", "description": "Stylesheet title."},
- { "name": "disabled", "type": "boolean", "description": "Denotes whether the stylesheet is disabled."}
+ { "name": "disabled", "type": "boolean", "description": "Denotes whether the stylesheet is disabled."},
+ { "name": "isInline", "type": "boolean", "description": "Whether this stylesheet is a <style> tag created by the parser. This is not set for document.written <style> tags." },
+ { "name": "startLine", "type": "number", "description": "Line offset of the stylesheet within the resource (zero based)." },
+ { "name": "startColumn", "type": "number", "description": "Column offset of the stylesheet within the resource (zero based)." }
],
"description": "CSS stylesheet metainformation."
},
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-04 20:52:04 UTC (rev 193442)
@@ -1,5 +1,36 @@
2015-12-04 Timothy Hatcher <[email protected]>
+ Merge r188631. rdar://problem/23581597
+
+ 2015-08-18 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Links for rules in <style> are incorrect, do not account for <style> offset in the document
+ https://bugs.webkit.org/show_bug.cgi?id=148141
+
+ Reviewed by Brian Burg.
+
+ Test: inspector/css/getAllStyleSheets.html
+
+ * css/CSSStyleSheet.h:
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::create):
+ (WebCore::CSSStyleSheet::createInline):
+ (WebCore::CSSStyleSheet::CSSStyleSheet):
+ Include the starting position when created by the Parser.
+ Default to the minimum position, which should never be
+ possible for an inline <style> because the "<style>" characters
+ themselves require at least some offset.
+
+ * dom/InlineStyleSheetOwner.cpp:
+ (WebCore::InlineStyleSheetOwner::createSheet):
+ Provide the start position offset for this stylesheet if it was inline.
+
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo):
+ Include new protocol values for the style sheet.
+
+2015-12-04 Timothy Hatcher <[email protected]>
+
Merge r187496. rdar://problem/23581597
2015-07-28 Joseph Pecoraro <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.cpp (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.cpp 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.cpp 2015-12-04 20:52:04 UTC (rev 193442)
@@ -82,13 +82,13 @@
Ref<CSSStyleSheet> CSSStyleSheet::create(Ref<StyleSheetContents>&& sheet, Node* ownerNode)
{
- return adoptRef(*new CSSStyleSheet(WTF::move(sheet), ownerNode, false));
+ return adoptRef(*new CSSStyleSheet(WTF::move(sheet), ownerNode, TextPosition::minimumPosition(), false));
}
-Ref<CSSStyleSheet> CSSStyleSheet::createInline(Node& ownerNode, const URL& baseURL, const String& encoding)
+Ref<CSSStyleSheet> CSSStyleSheet::createInline(Node& ownerNode, const URL& baseURL, const TextPosition& startPosition, const String& encoding)
{
CSSParserContext parserContext(ownerNode.document(), baseURL, encoding);
- return adoptRef(*new CSSStyleSheet(StyleSheetContents::create(baseURL.string(), parserContext), &ownerNode, true));
+ return adoptRef(*new CSSStyleSheet(StyleSheetContents::create(baseURL.string(), parserContext), &ownerNode, startPosition, true));
}
CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, CSSImportRule* ownerRule)
@@ -98,17 +98,19 @@
, m_mutatedRules(false)
, m_ownerNode(0)
, m_ownerRule(ownerRule)
+ , m_startPosition()
{
m_contents->registerClient(this);
}
-CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, Node* ownerNode, bool isInlineStylesheet)
+CSSStyleSheet::CSSStyleSheet(Ref<StyleSheetContents>&& contents, Node* ownerNode, const TextPosition& startPosition, bool isInlineStylesheet)
: m_contents(WTF::move(contents))
, m_isInlineStylesheet(isInlineStylesheet)
, m_isDisabled(false)
, m_mutatedRules(false)
, m_ownerNode(ownerNode)
, m_ownerRule(0)
+ , m_startPosition(startPosition)
{
ASSERT(isAcceptableCSSStyleSheetParent(ownerNode));
m_contents->registerClient(this);
Modified: branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.h (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.h 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebCore/css/CSSStyleSheet.h 2015-12-04 20:52:04 UTC (rev 193442)
@@ -29,6 +29,7 @@
#include <wtf/Noncopyable.h>
#include <wtf/TypeCasts.h>
#include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/TextPosition.h>
namespace WebCore {
@@ -51,7 +52,7 @@
public:
static Ref<CSSStyleSheet> create(Ref<StyleSheetContents>&&, CSSImportRule* ownerRule = 0);
static Ref<CSSStyleSheet> create(Ref<StyleSheetContents>&&, Node* ownerNode);
- static Ref<CSSStyleSheet> createInline(Node&, const URL&, const String& encoding = String());
+ static Ref<CSSStyleSheet> createInline(Node&, const URL&, const TextPosition& startPosition = TextPosition::minimumPosition(), const String& encoding = String());
virtual ~CSSStyleSheet();
@@ -118,11 +119,14 @@
StyleSheetContents& contents() { return m_contents; }
+ bool isInline() const { return m_isInlineStylesheet; }
+ TextPosition startPosition() const { return m_startPosition; }
+
void detachFromDocument() { m_ownerNode = nullptr; }
private:
CSSStyleSheet(Ref<StyleSheetContents>&&, CSSImportRule* ownerRule);
- CSSStyleSheet(Ref<StyleSheetContents>&&, Node* ownerNode, bool isInlineStylesheet);
+ CSSStyleSheet(Ref<StyleSheetContents>&&, Node* ownerNode, const TextPosition& startPosition, bool isInlineStylesheet);
virtual bool isCSSStyleSheet() const override { return true; }
virtual String type() const override { return ASCIILiteral("text/css"); }
@@ -139,6 +143,8 @@
Node* m_ownerNode;
CSSImportRule* m_ownerRule;
+ TextPosition m_startPosition;
+
mutable RefPtr<MediaList> m_mediaCSSOMWrapper;
mutable Vector<RefPtr<CSSRule>> m_childRuleCSSOMWrappers;
mutable std::unique_ptr<CSSRuleList> m_ruleListCSSOMWrapper;
Modified: branches/safari-601.1.46-branch/Source/WebCore/dom/InlineStyleSheetOwner.cpp (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2015-12-04 20:52:04 UTC (rev 193442)
@@ -141,7 +141,7 @@
m_loading = true;
- m_sheet = CSSStyleSheet::createInline(element, URL(), document.inputEncoding());
+ m_sheet = CSSStyleSheet::createInline(element, URL(), m_startTextPosition, document.inputEncoding());
m_sheet->setMediaQueries(mediaQueries.release());
m_sheet->setTitle(element.title());
m_sheet->contents().parseStringAtPosition(text, m_startTextPosition, m_isParsingChildren);
Modified: branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorStyleSheet.cpp (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorStyleSheet.cpp 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorStyleSheet.cpp 2015-12-04 20:52:04 UTC (rev 193442)
@@ -806,6 +806,9 @@
.setSourceURL(finalURL())
.setTitle(styleSheet->title())
.setFrameId(m_pageAgent->frameId(frame))
+ .setIsInline(styleSheet->isInline() && styleSheet->startPosition() != TextPosition::minimumPosition())
+ .setStartLine(styleSheet->startPosition().m_line.zeroBasedInt())
+ .setStartColumn(styleSheet->startPosition().m_column.zeroBasedInt())
.release();
}
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog 2015-12-04 20:52:04 UTC (rev 193442)
@@ -1,5 +1,59 @@
2015-12-04 Timothy Hatcher <[email protected]>
+ Merge r188631. rdar://problem/23581597
+
+ 2015-08-18 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Links for rules in <style> are incorrect, do not account for <style> offset in the document
+ https://bugs.webkit.org/show_bug.cgi?id=148141
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Controllers/CSSStyleManager.js:
+ (WebInspector.CSSStyleManager):
+ (WebInspector.CSSStyleManager.prototype.get styleSheets):
+ (WebInspector.CSSStyleManager.prototype.fetchStyleSheetsIfNeeded):
+ (WebInspector.CSSStyleManager.prototype.styleSheetForIdentifier):
+ (WebInspector.CSSStyleManager.prototype._mainResourceDidChange):
+ Update more information about a StyleSheet when fetched.
+
+ * UserInterface/Models/CSSRule.js:
+ (WebInspector.CSSRule.prototype.update):
+ Eliminate usage of `delete`.
+
+ * UserInterface/Models/CSSStyleSheet.js:
+ (WebInspector.CSSStyleSheet):
+ (WebInspector.CSSStyleSheet.prototype.get startLineNumber):
+ (WebInspector.CSSStyleSheet.prototype.get startColumnNumber):
+ (WebInspector.CSSStyleSheet.prototype.hasInfo):
+ (WebInspector.CSSStyleSheet.prototype.isInlineStyleTag):
+ (WebInspector.CSSStyleSheet.prototype.updateInfo):
+ Include more information about this stylesheet.
+
+ (WebInspector.CSSStyleSheet.prototype.offsetSourceCodeLocation):
+ Include helper API to offset a source code location by the startLine/Column
+ of this stylesheet itself, if it was an inline style.
+
+ (WebInspector.CSSStyleSheet.prototype.isInlineStyleAttributeStyleSheet):
+ (WebInspector.CSSStyleSheet.prototype.markAsInlineStyleAttributeStyleSheet):
+ (WebInspector.CSSStyleSheet.isInlineStyle): Deleted.
+ (WebInspector.CSSStyleSheet.prototype.markAsInlineStyle): Deleted.
+ Rename for clarity.
+
+ * UserInterface/Models/DOMNodeStyles.js:
+ (WebInspector.DOMNodeStyles.prototype.refresh):
+ Fetch stylesheet header information eagerly, so we have them early on.
+
+ (WebInspector.DOMNodeStyles.prototype._parseStyleDeclarationPayload):
+ (WebInspector.DOMNodeStyles.prototype._parseRulePayload):
+ Offset sourceCodeLocations for CSSRules based on the StyleSheet offset.
+
+ * UserInterface/Models/SourceCodeLocation.js:
+ (WebInspector.SourceCodeLocation.prototype.update):
+ Improve coding style.
+
+2015-12-04 Timothy Hatcher <[email protected]>
+
Merge r187496. rdar://problem/23581597
2015-07-28 Joseph Pecoraro <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -43,8 +43,9 @@
this._colorFormatSetting = new WebInspector.Setting("default-color-format", WebInspector.Color.Format.Original);
- this._styleSheetIdentifierMap = {};
- this._styleSheetFrameURLMap = {};
+ this._fetchedInitialStyleSheets = false;
+ this._styleSheetIdentifierMap = new Map;
+ this._styleSheetFrameURLMap = new Map;
this._nodeStylesMap = {};
}
@@ -55,6 +56,11 @@
return this._colorFormatSetting.value;
}
+ get styleSheets()
+ {
+ return [...this._styleSheetIdentifierMap.values()];
+ }
+
canForcePseudoClasses()
{
return window.CSSAgent && !!CSSAgent.forcePseudoState;
@@ -93,6 +99,14 @@
return match[1];
}
+ fetchStyleSheetsIfNeeded()
+ {
+ if (this._fetchedInitialStyleSheets)
+ return;
+
+ this._fetchInfoForAllStyleSheets(function() {});
+ }
+
styleSheetForIdentifier(id)
{
if (id in this._styleSheetIdentifierMap)
@@ -130,7 +144,7 @@
console.assert(styleSheet);
// Do not observe inline styles
- if (styleSheet.isInlineStyle())
+ if (styleSheet.isInlineStyleAttributeStyleSheet())
return;
styleSheet.noteContentDidChange();
@@ -172,8 +186,9 @@
// Clear our maps when the main frame navigates.
- this._styleSheetIdentifierMap = {};
- this._styleSheetFrameURLMap = {};
+ this._fetchedInitialStyleSheets = false;
+ this._styleSheetIdentifierMap.clear();
+ this._styleSheetFrameURLMap.clear();
this._nodeStylesMap = {};
}
@@ -255,11 +270,16 @@
// COMPATIBILITY (iOS 6): The info did not have 'frameId', so make parentFrame null in that case.
var parentFrame = "frameId" in styleSheetInfo ? WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId) : null;
+ // COMPATIBILITY (iOS 9): The info did not have 'isInline', 'startLine', and 'startColumn', so make false and 0 in these cases.
+ var isInline = styleSheetInfo.isInline || false;
+ var startLine = styleSheetInfo.startLine || 0;
+ var startColumn = styleSheetInfo.startColumn || 0;
+
var styleSheet = this.styleSheetForIdentifier(styleSheetInfo.styleSheetId);
- styleSheet.updateInfo(styleSheetInfo.sourceURL, parentFrame);
+ styleSheet.updateInfo(styleSheetInfo.sourceURL, parentFrame, isInline, startLine, startColumn);
var key = this._frameURLMapKey(parentFrame, styleSheetInfo.sourceURL);
- this._styleSheetFrameURLMap[key] = styleSheet;
+ this._styleSheetFrameURLMap.set(key, styleSheet);
}
callback();
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -18220,4 +18220,4 @@
};
},{}]},{},[9])(9)
-});
\ No newline at end of file
+});
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSRule.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSRule.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSRule.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -83,8 +83,8 @@
this._style = style;
this._mediaList = mediaList;
- delete this._matchedSelectors;
- delete this._matchedSelectorText;
+ this._matchedSelectors = null;
+ this._matchedSelectorText = null;
if (this._style)
this._style.ownerRule = this;
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSStyleSheet.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -34,6 +34,13 @@
this._id = id || null;
this._url = null;
this._parentFrame = null;
+ this._startLineNumber = 0;
+ this._startColumnNumber = 0;
+
+ this._inlineStyleAttribute = false;
+ this._inlineStyleTag = false;
+
+ this._hasInfo = false;
}
// Static
@@ -84,24 +91,64 @@
return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);
}
- isInlineStyle()
+ get startLineNumber()
{
- return !!this._inlineStyle;
+ return this._startLineNumber;
}
- markAsInlineStyle()
+ get startColumnNumber()
{
- this._inlineStyle = true;
+ return this._startColumnNumber;
}
+ hasInfo()
+ {
+ return this._hasInfo;
+ }
+
+ isInlineStyleTag()
+ {
+ return this._inlineStyleTag;
+ }
+
+ isInlineStyleAttributeStyleSheet()
+ {
+ return this._inlineStyleAttribute;
+ }
+
+ markAsInlineStyleAttributeStyleSheet()
+ {
+ this._inlineStyleAttribute = true;
+ }
+
+ offsetSourceCodeLocation(sourceCodeLocation)
+ {
+ if (!sourceCodeLocation)
+ return null;
+
+ if (!this._hasInfo)
+ return sourceCodeLocation;
+
+ var sourceCode = sourceCodeLocation.sourceCode;
+ var lineNumber = this._startLineNumber + sourceCodeLocation.lineNumber;
+ var columnNumber = this._startColumnNumber + sourceCodeLocation.columnNumber;
+ return sourceCode.createSourceCodeLocation(lineNumber, columnNumber);
+ }
+
// Protected
- updateInfo(url, parentFrame)
+ updateInfo(url, parentFrame, inlineStyle, startLineNumber, startColumnNumber)
{
+ this._hasInfo = true;
+
this._url = url || null;
- delete this._urlComponents;
+ this._urlComponents = undefined;
this._parentFrame = parentFrame || null;
+
+ this._inlineStyleTag = inlineStyle;
+ this._startLineNumber = startLineNumber;
+ this._startColumnNumber = startColumnNumber;
}
get revisionForRequestedContent()
@@ -143,7 +190,7 @@
noteContentDidChange()
{
if (this._ignoreNextContentDidChangeNotification) {
- delete this._ignoreNextContentDidChangeNotification;
+ this._ignoreNextContentDidChangeNotification = false;
return false;
}
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -235,6 +235,9 @@
this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.Refreshed, {significantChange});
}
+ // FIXME: Convert to pushing StyleSheet information to the frontend. <rdar://problem/13213680>
+ WebInspector.cssStyleManager.fetchStyleSheetsIfNeeded();
+
CSSAgent.getMatchedStylesForNode.invoke({nodeId: this._node.id, includePseudo: true, includeInherited: true}, fetchedMatchedStyles.bind(this));
CSSAgent.getInlineStylesForNode.invoke({nodeId: this._node.id}, fetchedInlineStyles.bind(this));
CSSAgent.getComputedStyleForNode.invoke({nodeId: this._node.id}, fetchedComputedStyle.bind(this));
@@ -654,7 +657,7 @@
var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
if (styleSheet) {
if (type === WebInspector.CSSStyleDeclaration.Type.Inline)
- styleSheet.markAsInlineStyle();
+ styleSheet.markAsInlineStyleAttributeStyleSheet();
styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
}
@@ -737,6 +740,8 @@
if (!style)
return null;
+ var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
+
// COMPATIBILITY (iOS 6): The payload had 'selectorText' as a property,
// now it has 'selectorList' with a 'text' property. Support both here.
var selectorText = payload.selectorList ? payload.selectorList.text : payload.selectorText;
@@ -749,6 +754,8 @@
var sourceCodeLocation = this._createSourceCodeLocation(payload.sourceURL, sourceRange.startLine, sourceRange.startColumn);
} else
var sourceCodeLocation = this._createSourceCodeLocation(payload.sourceURL, payload.sourceLine);
+ if (styleSheet)
+ sourceCodeLocation = styleSheet.offsetSourceCodeLocation(sourceCodeLocation);
var type;
switch (payload.origin) {
@@ -788,6 +795,8 @@
var mediaText = mediaItem.text;
var mediaSourceCodeLocation = this._createSourceCodeLocation(mediaItem.sourceURL, mediaItem.sourceLine);
+ if (styleSheet)
+ mediaSourceCodeLocation = styleSheet.offsetSourceCodeLocation(mediaSourceCodeLocation);
mediaList.push(new WebInspector.CSSMedia(mediaType, mediaText, mediaSourceCodeLocation));
}
@@ -797,7 +806,6 @@
return rule;
}
- var styleSheet = id ? WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId) : null;
if (styleSheet)
styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange, this._styleSheetContentDidChange, this);
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -179,7 +179,7 @@
if (sourceCode === this._sourceCode && lineNumber === this._lineNumber && columnNumber === this._columnNumber)
return;
- else if (this._mappedResource && sourceCode === this._mappedResource && lineNumber === this._mappedLineNumber && columnNumber === this._mappedColumnNumber)
+ if (this._mappedResource && sourceCode === this._mappedResource && lineNumber === this._mappedLineNumber && columnNumber === this._mappedColumnNumber)
return;
var newSourceCodeLocation = sourceCode.createSourceCodeLocation(lineNumber, columnNumber);
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -52,4 +52,4 @@
{
this._reject(value);
}
-}
\ No newline at end of file
+}
Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js (193441 => 193442)
--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-04 20:51:49 UTC (rev 193441)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-04 20:52:04 UTC (rev 193442)
@@ -166,4 +166,4 @@
WebInspector.StyleDetailsPanel.Event = {
Refreshed: "style-details-panel-refreshed"
-};
\ No newline at end of file
+};