Skip to content

Commit

Permalink
* [ios] fix element cssstyle selected bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yangshengtao committed Jun 27, 2016
1 parent e079e5c commit 41450a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ - (void)domain:(PDCSSDomain *)domain getMatchedStylesForNodeWithNodeId:(NSNumber
PDDOMNode *rootDomNode = [PDDOMDomainController defaultInstance].rootDomNode;
PDDOMNode *node = [self p_getNodeFromNodeId:nodeId rootNode:rootDomNode];
if (!node) {
NSLog(@"breakpoint error");
callback(nil,pseudoElements,inherited,nil);
return;
rootDomNode = [PDDOMDomainController defaultInstance].rootNode;
node = [self p_getNodeFromNodeId:nodeId rootNode:rootDomNode];
if (!node) {
callback(nil,pseudoElements,inherited,nil);
return;
}
}
PDCSSSelectorListData *selectorData = [[PDCSSSelectorListData alloc] init];
selectorData.text = node.nodeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
- (void)removeView:(UIView *)view;
- (void)addView:(UIView *)view;

- (PDDOMNode *)rootNode;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ - (void)domain:(PDDOMDomain *)domain getDocumentWithCallback:(void (^)(PDDOMNode
{
self.objectsForNodeIds = [[NSMutableDictionary alloc] init];
self.nodeIdsForObjects = [[NSMutableDictionary alloc] init];
self.nodeIdCounter = 0;
self.nodeIdCounter = 2;
callback([self rootNode], nil);
}

Expand Down Expand Up @@ -623,7 +623,7 @@ - (NSNumber *)getAndIncrementNodeIdCount;
- (PDDOMNode *)rootNode;
{
PDDOMNode *rootNode = [[PDDOMNode alloc] init];
rootNode.nodeId = [self getAndIncrementNodeIdCount];
rootNode.nodeId = [NSNumber numberWithInt:0];//[self getAndIncrementNodeIdCount];
rootNode.nodeType = @(kPDDOMNodeTypeDocument);
rootNode.nodeName = @"#document";
rootNode.children = @[ [self rootElement] ];
Expand All @@ -634,7 +634,7 @@ - (PDDOMNode *)rootNode;
- (PDDOMNode *)rootElement;
{
PDDOMNode *rootElement = [[PDDOMNode alloc] init];
rootElement.nodeId = [self getAndIncrementNodeIdCount];
rootElement.nodeId = [NSNumber numberWithInt:1];//[self getAndIncrementNodeIdCount];
rootElement.nodeType = @(kPDDOMNodeTypeElement);
rootElement.nodeName = @"iosml";
rootElement.children = [self windowNodes];
Expand Down Expand Up @@ -694,7 +694,12 @@ - (PDDOMNode *)elementNodeForObject:(id)object withChildNodes:(NSArray *)childre

elementNode.children = children;
elementNode.childNodeCount = @([elementNode.children count]);
elementNode.nodeId = [self getAndIncrementNodeIdCount];
NSNumber *nodeId = [self.nodeIdsForObjects objectForKey:[NSValue valueWithNonretainedObject:object]];
if (nodeId) {
elementNode.nodeId = nodeId;
}else {
elementNode.nodeId = [self getAndIncrementNodeIdCount];
}
elementNode.attributes = [self attributesArrayForObject:object];

return elementNode;
Expand Down Expand Up @@ -902,4 +907,5 @@ - (void)pd_swizzled_exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:
}
}


@end

0 comments on commit 41450a9

Please sign in to comment.