  
  - (NSArray *)validAttributesForMarkedText {
    // This code is just copied from WebKit except renaming variables.
-@@ -3027,7 +3043,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
+@@ -3160,7 +3182,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
          NSUnderlineStyleAttributeName,
          NSUnderlineColorAttributeName,
          NSMarkedClauseSegmentAttributeName,

   return (renderWidgetHostView_->GetTextInputType() !=
               ui::TEXT_INPUT_TYPE_NONE &&
           [event type] == NSKeyDown &&
@@ -3016,9 +3030,11 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
 // Since this implementation doesn't have to wait any IPC calls, this doesn't
 // make any key-typing jank. --hbono 7/23/09
 //

 // These are not documented, so use only after checking -respondsToSelector:.
 @interface NSApplication (UndocumentedSpeechMethods)
 - (void)speakString:(NSString*)string;
@@ -1669,6 +1675,12 @@ void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) {
   DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
          SkColorGetA(color) == SK_AlphaTRANSPARENT);
   bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
+  if (opaque) {
+    bool wantsTransparent = ui::GpuSwitchingManager::UseTransparent() ||
+                            ([cocoa_view_ window] && ![[cocoa_view_ window] isOpaque]);
+    if (wantsTransparent)
+      opaque = NO;
+  }
   if (background_is_opaque_ != opaque) {
     background_is_opaque_ = opaque;
     if (render_widget_host_)
@@ -1893,6 +1905,9 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged(
 }
 
 - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
