@@ -268,22 +268,26 @@ - (id) initWithArguments:(NSDictionary *)arguments
268
268
// visible, and then restore the original attributes so that we don't
269
269
// have any display issues once the Flash view is loaded
270
270
271
- // currently it only changes opacity for the CtF view and its immediate
272
- // parent, but opacity could still be applied further up the line
271
+ // Should we apply this to the parent?
272
+ // That seems to be problematic.
273
273
274
274
NSMutableDictionary *originalOpacityDict = [NSMutableDictionary dictionary ];
275
- [originalOpacityDict setObject: [self .container getAttribute: @" wmode" ] forKey: @" wmode" ];
276
- [originalOpacityDict setObject: [self .container getAttribute: @" style" ] forKey: @" self-style" ];
277
- [originalOpacityDict setObject: [(DOMElement *)[self .container parentNode ] getAttribute: @" style" ] forKey: @" parent-style" ];
278
- self.originalOpacityAttributes = originalOpacityDict;
279
-
280
275
NSString *opacityResetString = @" ; opacity: 1.000 !important; -moz-opacity: 1 !important; filter: alpha(opacity=1) !important;" ;
281
- NSString *newSelfStyleString = [[self .originalOpacityAttributes objectForKey: @" self-style" ] stringByAppendingString: opacityResetString];
282
- NSString *newParentStyleString = [[self .originalOpacityAttributes objectForKey: @" parent-style" ] stringByAppendingString: opacityResetString];
283
276
284
- [self .container setAttribute: @" wmode" value: @" opaque" ];
285
- [self .container setAttribute: @" style" value: newSelfStyleString];
286
- [(DOMElement *)[self .container parentNode ] setAttribute: @" style" value: newParentStyleString];
277
+ NSString *originalWmode = [self .container getAttribute: @" wmode" ];
278
+ NSString *originalStyle = [self .container getAttribute: @" style" ];
279
+
280
+ if (originalWmode != nil && [originalWmode length ] > 0u && ![originalWmode isEqualToString: @" opaque" ]) {
281
+ [originalOpacityDict setObject: originalWmode forKey: @" wmode" ];
282
+ [self .container setAttribute: @" wmode" value: @" opaque" ];
283
+ }
284
+
285
+ if (originalStyle != nil && [originalStyle length ] > 0u && ![originalStyle hasSuffix: opacityResetString]) {
286
+ [originalOpacityDict setObject: originalStyle forKey: @" self-style" ];
287
+ [self .container setAttribute: @" style" value: [originalStyle stringByAppendingString: opacityResetString]];
288
+ }
289
+
290
+ self.originalOpacityAttributes = originalOpacityDict;
287
291
}
288
292
289
293
return self;
@@ -933,9 +937,15 @@ - (void) _prepareForConversion
933
937
934
938
- (void ) _revertToOriginalOpacityAttributes
935
939
{
936
- [self .container setAttribute: @" wmode" value: [self .originalOpacityAttributes objectForKey: @" wmode" ]];
937
- [self .container setAttribute: @" style" value: [self .originalOpacityAttributes objectForKey: @" self-style" ]];
938
- [(DOMElement *)[self .container parentNode ] setAttribute: @" style" value: [self .originalOpacityAttributes objectForKey: @" parent-style" ]];
940
+ NSString *wmode = [self .originalOpacityAttributes objectForKey: @" wmode" ];
941
+ if (wmode != nil ) {
942
+ [self .container setAttribute: @" wmode" value: wmode];
943
+ }
944
+
945
+ NSString *selfStyle = [self .originalOpacityAttributes objectForKey: @" self-style" ];
946
+ if (selfStyle != nil ) {
947
+ [self .container setAttribute: @" style" value: selfStyle];
948
+ }
939
949
}
940
950
941
951
@synthesize webView = _webView;
0 commit comments