New issue
Advanced search Search tips

Issue 641509 link

Starred by 18 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 27
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

"Couldn't set selectedTextBackgroundColor from default ()"

Reported by saurik@gmail.com, Aug 26 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce the problem:
1. Open Chrome at the command line (so you can watch standard output and standard error).
2. Click to highlight some text on a web page.
3. Watch as "Couldn't set selectedTextBackgroundColor from default ()" is logged.

What is the expected behavior?
I would expect nothing to log in this case: selecting text should probably just work silently ;P.

What went wrong?
When selecting text in Chrome, a message is printed to the console: "Couldn't set selectedTextBackgroundColor from default ()". This is not really noticeable when using Chrome or Chromium as a browser, but people who are using either NW.js or Electron (as they are likely to run their program using Chromium from a command line) often run into this extra output.

Here is a link to an issue reported in Electron where people have for some reason been complaining for a while and someone from that project has been taking the time to tell people to report the issue here, and yet annoying not a single person including the person telling people to report the issue here has seemingly ever bothered to actually have done so :/.

https://github.com/electron/electron/issues/4420

Did this work before? N/A 

Chrome version: 52.0.2743.116  Channel: stable
OS Version: OS X 10.9.5
Flash Version: Shockwave Flash 22.0 r0
 

Comment 1 by saurik@gmail.com, Aug 26 2016

Oh, you can even see this output showing up in the logs of someone running browser tests with AddressSanitizer in this other issue.

https://bugs.chromium.org/p/chromium/issues/detail?id=582510
Cc: joedow@chromium.org
Labels: Needs-Feedback
Able to reproduce the issue on Mac OS 10.11.6 using chrome latest stable M52-52.0.2743.116 by following steps mentioned in the original comment. Observed step-3 error while selecting text from chrome webpage.

joedow@ - As per comment #1 could you please confirm is this is the same issue you are working on it? If no, please let us know do we need to provide bisect information for this issue?

Thanks!

Comment 3 by joedow@chromium.org, Aug 30 2016

Cc: -joedow@chromium.org
I'm not working on anything like this, I think you have the wrong person :)

Comment 4 by saurik@gmail.com, Aug 30 2016

I only linked to that other issue to show that this output is quite common--anyone using Chrome from the command line (which includes Joe using AddressSanitizer) is seeing this output--not to imply that it was a related problem ;P.
Labels: -Needs-Feedback
Status: Untriaged (was: Unconfirmed)
Haven't found the culprit yet, grepping for "Couldn't set" or "selectedTextBackgroundColor".
I dug into this and it looks like the culprit is this:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm?rcl=0&l=148

If you change the so that it returns Color::black, the error message will not appear

Components: Blink>TextSelection Blink>Layout

Comment 8 by e...@chromium.org, Sep 8 2016

Labels: -Pri-2 Pri-3
Status: Available (was: Untriaged)
We should probably suppress that message.
That comes from here:

* thread #1: tid = 0xc7f5b, 0x00007fff9310cd67 Foundation`NSLog, name = 'CrRendererMain', queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
  * frame #0: 0x00007fff9310cd67 Foundation`NSLog
    frame #1: 0x00007fff9b5b9f49 AppKit`-[NSDynamicSystemColor recacheColor] + 162
    frame #2: 0x00007fff9b5b9d9d AppKit`-[NSDynamicSystemColor initWithSelector:] + 89
    frame #3: 0x00007fff9b619165 AppKit`+[NSColor selectedTextBackgroundColor] + 80
    frame #4: 0x000000010cd70e63 Chromium Framework`blink::LayoutThemeMac::platformActiveSelectionBackgroundColor(this=<unavailable>) const + 35 at LayoutThemeMac.mm:150
    frame #5: 0x000000010cd6cec1 Chromium Framework`blink::LayoutTheme::activeSelectionBackgroundColor(this=<unavailable>) const + 17 at LayoutTheme.cpp:297
    frame #6: 0x000000010cd23ff3 Chromium Framework`blink::LayoutObject::selectionBackgroundColor(this=<unavailable>) const + 307 at LayoutObject.cpp:1360
    frame #7: 0x000000010ced58ff Chromium Framework`void blink::InlineTextBoxPainter::paintSelection<(blink::InlineTextBoxPainter::PaintOptions)0>(blink::GraphicsContext&, blink::LayoutRect const&, blink::ComputedStyle const&, blink::Font const&, blink::Color, blink::LayoutTextCombine*) [inlined] blink::LineLayoutItem::selectionBackgroundColor() const + 95 at LineLayoutItem.h:376
    frame #8: 0x000000010ced58fa Chromium Framework`void blink::InlineTextBoxPainter::paintSelection<(blink::InlineTextBoxPainter::PaintOptions)0>(this=0x00007fff5863c228, context=0x00007fff58640f98, boxRect=0x00007fff5863c1a0, style=0x00000edca9c48990, font=0x00000edca9cfe4a8, textColor=<unavailable>, combinedText=0x0000000000000000) + 90 at InlineTextBoxPainter.cpp:443
    frame #9: 0x000000010ced485f Chromium Framework`blink::InlineTextBoxPainter::paint(this=<unavailable>, paintInfo=<unavailable>, paintOffset=<unavailable>) + 2431 at InlineTextBoxPainter.cpp:169
    frame #10: 0x000000010cdbd365 Chromium Framework`blink::InlineTextBox::paint(this=<unavailable>, paintInfo=<unavailable>, paintOffset=<unavailable>, (null)=<unavailable>, (null)=<unavailable>) const + 21 at InlineTextBox.cpp:425

AppKit`-[NSDynamicSystemColor recacheColor]:
[snip]
    0x7fff9b5b9f27 <+128>: call   0x7fff9baa3fce            ; _NSColorFromDefault
    0x7fff9b5b9f2c <+133>: mov    rbx, rax
    0x7fff9b5b9f2f <+136>: test   rbx, rbx
    0x7fff9b5b9f32 <+139>: jne    0x7fff9b5b9f6f            ; <+200>
    0x7fff9b5b9f34 <+141>: mov    rsi, qword ptr [r15 + r12]
    0x7fff9b5b9f38 <+145>: lea    rdi, [rip - 0x217eb94f]   ; @"Couldn't set %@ from default (%@)"
    0x7fff9b5b9f3f <+152>: xor    eax, eax
    0x7fff9b5b9f41 <+154>: mov    rdx, r14
    0x7fff9b5b9f44 <+157>: call   0x7fff9bfc1274            ; symbol stub for: NSLog

This is probably related to how we ferry NSUserDefaults via theme_helper_mac.mm, but I'm not sure why selectedTextBackgroundColor is the only one causing issues.

Cc: rsesek@chromium.org

Comment 11 by tkent@chromium.org, Oct 12 2016

Components: -Blink>TextSelection Blink>Editing>Selection
Seems like you almost have this one solved, I'll buy you lunch (via $10 over PayPal) if you can fix it. Getting these errors in my Electron terminal window is annoying :)

Comment 13 by kenorb@gmail.com, Oct 6 2017

Same here on macOS Sierra (using e7f0416cefe3af6fee4921a25611b0af4cedf868), but it happens at random:

2017-10-06 22:49:29.237 Chromium Helper[58854:5106427] Couldn't set selectedTextBackgroundColor from default ()
Please fix this issue, having this in current Electron:
https://github.com/electron/electron/issues/4420

Their solutions didn't work for me, still getting that error.
There is a workaround 
 ::selection { background: white; } 
the workaround does not work anymore
Project Member

Comment 17 by bugdroid1@chromium.org, Nov 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0694f7c1f92d46137fe536f1fde23963fccac0b5

commit 0694f7c1f92d46137fe536f1fde23963fccac0b5
Author: Robert Sesek <rsesek@chromium.org>
Date: Tue Nov 20 16:00:10 2018

[Mac] Stop performing direct NSColor lookups in the renderer process.

In blink::LayoutThemeMac, various system color properties are retrieved
from NSColor. These system colors are part of the "dynamic system color
store", and trying to access them may cause issues with the sandbox.

This augments the blink::WebSandboxSuport interface on Mac to look up
system colors via a shared memory segment that is populated by the
browser. In addition, this centralizes the various Mac implementations
of that interface into a single one.

      System Prefs>General and change the Highlight Color. Upon going
      back to Chrome, the new highlight color should be visible.

Bug:  641509 ,  36032 
Test: Highlight some text on a web page. Then go to
Change-Id: I3bc05c08ecab62b1fc68442d3edd93ec7edb8590
Reviewed-on: https://chromium-review.googlesource.com/c/1331133
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609719}
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/BUILD.gn
[add] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/sandbox_support_mac_impl.h
[add] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/sandbox_support_mac_impl.mm
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/service_manager/common_browser_interfaces.cc
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/theme_helper_mac.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/browser/theme_helper_mac.mm
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/child/child_process_sandbox_support_impl_mac.cc
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/child/child_process_sandbox_support_impl_mac.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/common/BUILD.gn
[add] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/common/sandbox_support_mac.mojom
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/ppapi_plugin/ppapi_blink_platform_impl.cc
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/ppapi_plugin/ppapi_blink_platform_impl.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/public/app/mojo/content_browser_manifest.json
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/public/app/mojo/content_plugin_manifest.json
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/public/app/mojo/content_renderer_manifest.json
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/public/app/mojo/content_utility_manifest.json
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/renderer/renderer_blink_platform_impl.cc
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/renderer/renderer_blink_platform_impl.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/utility/utility_blink_platform_with_sandbox_support_impl.cc
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/content/utility/utility_blink_platform_with_sandbox_support_impl.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/third_party/blink/public/common/BUILD.gn
[add] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/third_party/blink/public/common/sandbox_support/sandbox_support_mac.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/third_party/blink/public/platform/mac/web_sandbox_support.h
[modify] https://crrev.com/0694f7c1f92d46137fe536f1fde23963fccac0b5/third_party/blink/renderer/core/layout/layout_theme_mac.mm

Project Member

Comment 18 by bugdroid1@chromium.org, Nov 20

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c647137842a7ea4a4bb0f4e3e6da3afe5c78bd71

commit c647137842a7ea4a4bb0f4e3e6da3afe5c78bd71
Author: Robert Sesek <rsesek@chromium.org>
Date: Tue Nov 20 18:57:34 2018

[Mac] Use NSRectFill in content::NSColorToSkColor().

Previously it used -[NSColor drawSwatchInRect:] which "adorns" the color
with additional drawing.

Bug:  641509 ,  36032 
Change-Id: Ib3dd089980c4d942b0aac0435a94f5ad44fcd3e4
Reviewed-on: https://chromium-review.googlesource.com/c/1343045
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609759}
[modify] https://crrev.com/c647137842a7ea4a4bb0f4e3e6da3afe5c78bd71/content/browser/theme_helper_mac.mm

Labels: M-72
Owner: rsesek@chromium.org
Status: Fixed (was: Available)

Sign in to add a comment