@@ -271,14 +271,21 @@ - (id) initWithArguments:(NSDictionary *)arguments
271
271
// Should we apply this to the parent?
272
272
// That seems to be problematic.
273
273
274
+ // well, in my experience w/CSS, to get a layout to work a lot of the
275
+ // time, you need to create parent objects and apply styles to parents,
276
+ // so it seemed reasonable to check both self and parent for potential
277
+ // problems with opacity
278
+
274
279
NSMutableDictionary *originalOpacityDict = [NSMutableDictionary dictionary ];
275
280
NSString *opacityResetString = @" ; opacity: 1.000 !important; -moz-opacity: 1 !important; filter: alpha(opacity=1) !important;" ;
276
281
277
282
NSString *originalWmode = [self .container getAttribute: @" wmode" ];
278
283
NSString *originalStyle = [self .container getAttribute: @" style" ];
284
+ NSString *originalParentWmode = [(DOMElement *)[self .container parentNode ] getAttribute: @" wmode" ];
285
+ NSString *originalParentStyle = [(DOMElement *)[self .container parentNode ] getAttribute: @" style" ];
279
286
280
287
if (originalWmode != nil && [originalWmode length ] > 0u && ![originalWmode isEqualToString: @" opaque" ]) {
281
- [originalOpacityDict setObject: originalWmode forKey: @" wmode" ];
288
+ [originalOpacityDict setObject: originalWmode forKey: @" self- wmode" ];
282
289
[self .container setAttribute: @" wmode" value: @" opaque" ];
283
290
}
284
291
@@ -287,6 +294,16 @@ - (id) initWithArguments:(NSDictionary *)arguments
287
294
[self .container setAttribute: @" style" value: [originalStyle stringByAppendingString: opacityResetString]];
288
295
}
289
296
297
+ if (originalParentWmode != nil && [originalParentWmode length ] > 0u && ![originalParentWmode isEqualToString: @" opaque" ]) {
298
+ [originalOpacityDict setObject: originalParentWmode forKey: @" parent-wmode" ];
299
+ [(DOMElement *)[self .container parentNode ] setAttribute: @" wmode" value: @" opaque" ];
300
+ }
301
+
302
+ if (originalParentStyle != nil && [originalParentStyle length ] > 0u && ![originalParentStyle hasSuffix: opacityResetString]) {
303
+ [originalOpacityDict setObject: originalParentStyle forKey: @" parent-style" ];
304
+ [(DOMElement *)[self .container parentNode ] setAttribute: @" style" value: [originalParentStyle stringByAppendingString: opacityResetString]];
305
+ }
306
+
290
307
self.originalOpacityAttributes = originalOpacityDict;
291
308
}
292
309
@@ -937,15 +954,25 @@ - (void) _prepareForConversion
937
954
938
955
- (void ) _revertToOriginalOpacityAttributes
939
956
{
940
- NSString *wmode = [self .originalOpacityAttributes objectForKey: @" wmode" ];
941
- if (wmode != nil ) {
942
- [self .container setAttribute: @" wmode" value: wmode ];
957
+ NSString *selfWmode = [self .originalOpacityAttributes objectForKey: @" self- wmode" ];
958
+ if (selfWmode != nil ) {
959
+ [self .container setAttribute: @" wmode" value: selfWmode ];
943
960
}
944
961
945
962
NSString *selfStyle = [self .originalOpacityAttributes objectForKey: @" self-style" ];
946
963
if (selfStyle != nil ) {
947
964
[self .container setAttribute: @" style" value: selfStyle];
948
965
}
966
+
967
+ NSString *parentWmode = [self .originalOpacityAttributes objectForKey: @" parent-wmode" ];
968
+ if (parentWmode != nil ) {
969
+ [(DOMElement *)[self .container parentNode ] setAttribute: @" wmode" value: parentWmode];
970
+ }
971
+
972
+ NSString *parentStyle = [self .originalOpacityAttributes objectForKey: @" parent-style" ];
973
+ if (parentStyle != nil ) {
974
+ [(DOMElement *)[self .container parentNode ] setAttribute: @" style" value: parentStyle];
975
+ }
949
976
}
950
977
951
978
@synthesize webView = _webView;
0 commit comments