Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
get basic style stuff working
  • Loading branch information
pmuellr committed Feb 11, 2011
1 parent 4ffaa0f commit a5f8b062bbcc5b9cfbfbaaa2e35d47a72b746622
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 31 deletions.
@@ -189,18 +189,19 @@
</fileset>
</copy>

<echo message="building InjectedScript.js"/>
<echo
file = "${WEB}/weinre/target/InjectedScript.js"
message = "var injectedScriptConstructor = ${line.separator}"
/>

<concat
destfile = "${WEB}/weinre/target/InjectedScript.js"
append = "true"
>
<fileset file="${VENDOR}/webkit/WebCore/inspector/InjectedScriptSource.js"/>
</concat>

<echo message="building versions.js"/>
<copy todir="${WEB}">
<fileset dir="../${PROJECT_WEB}">
<include name="versions.js"/>
@@ -221,6 +222,13 @@
<filter token="JAVAX_SERVLET_VERSION_IMPL" value="${JAVAX_SERVLET_VERSION_IMPL}"/>
</filterset>
</copy>

<echo message="building add-css-properties.js"/>
<exec executable="python" failonerror="true" failifexecutionfails="true">
<arg file="scripts/build-css-properties.py"/>
<arg value="vendor/webkit/WebCore/CSSPropertyNames.in"/>
<arg value="${WEB}/add-css-properties.js"/>
</exec>

</target>

@@ -36,7 +36,7 @@ def main():
properties.sort()

jsonString = json.dumps(properties, indent=4)
jsString = "Weinre.addCSSProperties(%s)" % jsonString
jsString = 'require("weinre/common/Weinre").addCSSProperties(%s)' % jsonString

oFile = open(oFileName, "w")
oFile.write(jsString)
@@ -21,6 +21,8 @@
<script src="/weinre/common/Callback.transportd.js" ></script>
<script src="/weinre/common/EventListeners.transportd.js" ></script>
<script src="/weinre/target/Console.transportd.js" ></script>
<script src="/add-css-properties.js" ></script>


<!--
<script src="/weinre/target/WebInspectorApplicationCacheHandlerImpl.transportd.js" ></script>
@@ -14,14 +14,23 @@ require ./StackTrace
class Weinre
throw new Ex(arguments, "this class is not intended to be instantiated")

//-----------------------------------------------------------------------------
static
var _notImplemented = {}
var _showNotImplemented = false
var CSSProperties = []

//-----------------------------------------------------------------------------
static method addIDLs(idls)
IDLTools.addIDLs(idls)

//-----------------------------------------------------------------------------
static
var _notImplemented = {}
var _showNotImplemented = false
static method addCSSProperties(cssProperties)
CSSProperties = cssProperties

//-----------------------------------------------------------------------------
static method getCSSProperties
return CSSProperties

//-----------------------------------------------------------------------------
static method deprecated()
@@ -88,9 +88,10 @@ method getPseudoElements(node)
//-----------------------------------------------------------------------------
method buildObjectForStyle(style, bind)
var result = {
width: null,
height: null,
properties: []
width: null,
height: null,
properties: [],
cssProperties: []
}

if (!style) return result
@@ -147,7 +148,7 @@ method populateObjectWithStyleProperties(style, result)
}
}

result.properties = properties
result.cssProperties = properties
result.shorthandValues = shorthandValues

//-----------------------------------------------------------------------------
@@ -49,7 +49,7 @@ method nextNodeId()
//
//-----------------------------------------------------------------------------
method serializeNode(node, depth)
var nodeName = null
var nodeName = ""
var nodeValue = null
var localName = null
var id = this.getNodeId(node)
@@ -13,21 +13,67 @@ class WiCSSImpl

//-----------------------------------------------------------------------------
method getStylesForNode(/*int*/ nodeId, callback)
// callback: function(/*any*/ styles)
Weinre.notImplemented(arguments.callee.signature)

var result = {}

var node = Weinre.nodeStore.getNode(nodeId)
if (!node) {
console.log(arguments.callee.signature + " passed an invalid nodeId: " + nodeId)
return
}

var result = {
inlineStyle: Weinre.cssStore.getInlineStyle(node),
computedStyle: Weinre.cssStore.getComputedStyle(node),
matchedCSSRules: Weinre.cssStore.getMatchedCSSRules(node),
styleAttributes: Weinre.cssStore.getStyleAttributes(node),
pseudoElements: Weinre.cssStore.getPseudoElements(node),
inherited: []
}

var parentNode = node.parentNode

while (parentNode) {
var parentStyle = {
inlineStyle: Weinre.cssStore.getInlineStyle(parentNode),
matchedCSSRules: Weinre.cssStore.getMatchedCSSRules(parentNode),
}

result.inherited.push(parentStyle)
parentNode = parentNode.parentNode
}

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [result])
}

//-----------------------------------------------------------------------------
method getComputedStyleForNode(/*int*/ nodeId, callback)
// callback: function(/*any*/ style)
Weinre.notImplemented(arguments.callee.signature)
var node = Weinre.nodeStore.getNode(nodeId)
if (!node) {
console.log(arguments.callee.signature + " passed an invalid nodeId: " + nodeId)
return
}

var result = Weinre.cssStore.getComputedStyle(node)

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [result])
}


//-----------------------------------------------------------------------------
method getInlineStyleForNode(/*int*/ nodeId, callback)
// callback: function(/*any*/ style)
Weinre.notImplemented(arguments.callee.signature)
var node = Weinre.nodeStore.getNode(nodeId)
if (!node) {
console.log(arguments.callee.signature + " passed an invalid nodeId: " + nodeId)
return
}

var result = Weinre.cssStore.getInlineStyle(node)

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [result])
}

//-----------------------------------------------------------------------------
method getAllStyles(callback)
@@ -79,8 +125,7 @@ method addRule(/*int*/ contextNodeId, /*string*/ selector, callback)

//-----------------------------------------------------------------------------
method getSupportedCSSProperties(callback)
// callback: function(/*any[]*/ cssProperties)
Weinre.notImplemented(arguments.callee.signature)
return Weinre.getCSSProperties()


//-----------------------------------------------------------------------------
@@ -10,20 +10,26 @@ require ../common/Weinre

//-----------------------------------------------------------------------------
class WiConsoleImpl
this.messagesEnabled = true

//-----------------------------------------------------------------------------
method setConsoleMessagesEnabled(/*boolean*/ enabled, callback)
// callback: function(/*boolean*/ newState)
Weinre.notImplemented(arguments.callee.signature)

var oldValue = this.messagesEnabled
this.messagesEnabled = enabled

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [oldValue])
}

//-----------------------------------------------------------------------------
method clearConsoleMessages(callback)
// callback: function()
Weinre.notImplemented(arguments.callee.signature)
if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [])
}


//-----------------------------------------------------------------------------
method setMonitoringXHREnabled(/*boolean*/ enabled, callback)
// callback: function()
Weinre.notImplemented(arguments.callee.signature)
if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback, [])
}
@@ -55,15 +55,25 @@ method didEvaluateForTestInFrontend(/*int*/ testCallId, /*string*/ jsonResult, c

//-----------------------------------------------------------------------------
method highlightDOMNode(/*int*/ nodeId, callback)
// callback: function()
Weinre.notImplemented(arguments.callee.signature)
var node = Weinre.nodeStore.getNode(nodeId)
if (!node) {
console.log(arguments.callee.signature + " passed an invalid nodeId: " + nodeId)
return
}

Weinre.elementHighlighter.on(node)

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback)
}

//-----------------------------------------------------------------------------
method hideDOMNodeHighlight(callback)
// callback: function()
Weinre.notImplemented(arguments.callee.signature)

Weinre.elementHighlighter.off()

if (callback) {
Weinre.WeinreTargetCommands.sendClientCallback(callback)
}

//-----------------------------------------------------------------------------
method highlightFrame(/*int*/ frameId, callback)

0 comments on commit a5f8b06

Please sign in to comment.