Skip to content

Commit

Permalink
checks to make sure style of child and parent haven't been modified b…
Browse files Browse the repository at this point in the history
…efore modifying them back; fixes Google Maps

Signed-off-by: Jonathan 'Wolf' Rentzsch <[email protected]>
  • Loading branch information
Simone Manganelli authored and rentzsch committed May 6, 2009
1 parent c0e67b2 commit b2c2c60
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ - (id) initWithArguments:(NSDictionary *)arguments

if (originalStyle != nil && [originalStyle length] > 0u && ![originalStyle hasSuffix:opacityResetString]) {
[originalOpacityDict setObject:originalStyle forKey:@"self-style"];
[originalOpacityDict setObject:[originalStyle stringByAppendingString:opacityResetString] forKey:@"modified-self-style"];
[self.container setAttribute:@"style" value:[originalStyle stringByAppendingString:opacityResetString]];
}

Expand All @@ -305,6 +306,7 @@ - (id) initWithArguments:(NSDictionary *)arguments

if (originalParentStyle != nil && [originalParentStyle length] > 0u && ![originalParentStyle hasSuffix:opacityResetString]) {
[originalOpacityDict setObject:originalParentStyle forKey:@"parent-style"];
[originalOpacityDict setObject:[originalParentStyle stringByAppendingString:opacityResetString] forKey:@"modified-parent-style"];
[(DOMElement *)[self.container parentNode] setAttribute:@"style" value:[originalParentStyle stringByAppendingString:opacityResetString]];
}

Expand Down Expand Up @@ -963,19 +965,25 @@ - (void) _revertToOriginalOpacityAttributes
[self.container setAttribute:@"wmode" value:selfWmode];
}

NSString *selfStyle = [self.originalOpacityAttributes objectForKey:@"self-style"];
if (selfStyle != nil ) {
[self.container setAttribute:@"style" value:selfStyle];
NSString *currentStyle = [self.container getAttribute:@"style"];
NSString *originalSelfStyle = [self.originalOpacityAttributes objectForKey:@"self-style"];
if (originalSelfStyle != nil ) {
if ([currentStyle isEqualToString:[self.originalOpacityAttributes objectForKey:@"modified-self-style"]]) {
[self.container setAttribute:@"style" value:originalSelfStyle];
}
}

NSString *parentWmode = [self.originalOpacityAttributes objectForKey:@"parent-wmode"];
if (parentWmode != nil ) {
[(DOMElement *)[self.container parentNode] setAttribute:@"wmode" value:parentWmode];
}

NSString *parentStyle = [self.originalOpacityAttributes objectForKey:@"parent-style"];
if (parentStyle != nil ) {
[(DOMElement *)[self.container parentNode] setAttribute:@"style" value:parentStyle];
NSString *currentParentStyle = [(DOMElement *)[self.container parentNode] getAttribute:@"style"];
NSString *originalParentStyle = [self.originalOpacityAttributes objectForKey:@"parent-style"];
if (originalParentStyle != nil ) {
if ([currentParentStyle isEqualToString:[self.originalOpacityAttributes objectForKey:@"modified-parent-style"]]) {
[(DOMElement *)[self.container parentNode] setAttribute:@"style" value:originalParentStyle];
}
}
}

Expand Down

0 comments on commit b2c2c60

Please sign in to comment.