Bug 42379 - Web Inspector: Rename method for CSS rule source range retrieval and fix return object format
Summary: Web Inspector: Rename method for CSS rule source range retrieval and fix retu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-15 08:47 PDT by Alexander Pavlov (apavlov)
Modified: 2010-07-22 06:27 PDT (History)
9 users (show)

See Also:


Attachments
[PATCH] Suggested solution (13.25 KB, patch)
2010-07-15 09:46 PDT, Alexander Pavlov (apavlov)
pfeldman: review-
Details | Formatted Diff | Diff
[PATCH] Comment addressed (13.73 KB, patch)
2010-07-20 02:14 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Revert a removed blank line (13.54 KB, patch)
2010-07-20 02:46 PDT, Alexander Pavlov (apavlov)
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2010-07-15 08:47:36 PDT
getRuleRangesForStyleSheetId looks too long compared to other InspectorBackend methods.
Also, it is more convenient to use styleId rather than ruleId as the key in the response object.
Comment 1 Alexander Pavlov (apavlov) 2010-07-15 09:46:22 PDT
Created attachment 61676 [details]
[PATCH] Suggested solution
Comment 2 Pavel Feldman 2010-07-18 12:25:46 PDT
Comment on attachment 61676 [details]
[PATCH] Suggested solution

WebCore/inspector/InspectorCSSStore.cpp:141
 +          return result;
Nit: I'd suggest not using result here and moving declaration to where it is used (bottom of this method).

WebCore/inspector/InspectorCSSStore.cpp:149
 +          result.set(bindStyle(rule->style()), offsetVector->at(ruleIndex));
I think binding rule makes more sense. Why did this change? r- here unless you explain please!
Comment 3 Alexander Pavlov (apavlov) 2010-07-18 14:22:50 PDT
(In reply to comment #2)
> (From update of attachment 61676 [details])
> WebCore/inspector/InspectorCSSStore.cpp:141
>  +          return result;
> Nit: I'd suggest not using result here and moving declaration to where it is used (bottom of this method).

Will do.

> WebCore/inspector/InspectorCSSStore.cpp:149
>  +          result.set(bindStyle(rule->style()), offsetVector->at(ruleIndex));
> I think binding rule makes more sense. Why did this change? r- here unless you explain please!

It is quite logical to bind rules instead of styles. However:

(a) Styles sidebar (and my new code) uses style bindings (rather than rule bindings) returned from InspectorDOMAgent::applyStyleText:
m_frontend->didApplyStyleText(callId, true, buildObjectForStyle(style, true), toArray(changedProperties));
I will need another internal map to handle rule bindings if they are used in place of style bindings.

(b) I can see this method (perhaps after getting a better name and a slight refactoring) return positions for rules in external CSS, inline CSS, and style descriptions as values of the "style" element attributes. In the latter case, there are no rules, only styles. It doesn't seem logical to return both bound rules and bound styles in similar cases.
Comment 4 Alexander Pavlov (apavlov) 2010-07-20 02:14:42 PDT
Created attachment 62045 [details]
[PATCH] Comment addressed
Comment 5 Alexander Pavlov (apavlov) 2010-07-20 02:46:18 PDT
Created attachment 62046 [details]
[PATCH] Revert a removed blank line
Comment 6 Alexander Pavlov (apavlov) 2010-07-22 06:27:16 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
        M       LayoutTests/ChangeLog
        M       LayoutTests/inspector/styles-source-offsets.html
        M       WebCore/ChangeLog
        M       WebCore/inspector/Inspector.idl
        M       WebCore/inspector/InspectorBackend.cpp
        M       WebCore/inspector/InspectorBackend.h
        M       WebCore/inspector/InspectorBackend.idl
        M       WebCore/inspector/InspectorCSSStore.cpp
        M       WebCore/inspector/InspectorCSSStore.h
        M       WebCore/inspector/InspectorDOMAgent.cpp
        M       WebCore/inspector/InspectorDOMAgent.h
        M       WebCore/inspector/front-end/DOMAgent.js
        M       WebKit/chromium/ChangeLog
        M       WebKit/chromium/src/js/InspectorControllerImpl.js
Committed r63886