Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Issue 2568983003: Add ability to linkify substituted string

Created:
4 years ago by karabur
Modified:
3 years, 10 months ago
Reviewers:
chenwilliam, lushnikov, luoe
CC:
apavlov+blink_chromium.org, blink-reviews, caseq+blink_chromium.org, chromium-reviews, devtools-reviews_chromium.org, kozyatinskiy+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add ability to linkify substituted string Currently, if string contains substitutions, only separate parts of the string are replaced with links. This patch change logic to linkify whole string despite is it generated by substitutions or not BUG=668591

Patch Set 1 #

Total comments: 11

Patch Set 2 : More generic approach to linkify, covering most of cases #

Patch Set 3 : Comments addressed #

Total comments: 12

Messages

Total messages: 24 (9 generated)
karabur
PTAL. This is my first patch, please run try jobs for me.
4 years ago (2016-12-12 21:35:45 UTC) #3
pfeldman
https://codereview.chromium.org/2568983003/diff/1/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js File third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js (right): https://codereview.chromium.org/2568983003/diff/1/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js#newcode851 third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js:851: var plainString = String.format(format, parameters, plainFormatters, '', (a, b) ...
4 years ago (2016-12-12 22:05:45 UTC) #9
luoe
I think a version of Components.linkifyStringAsFragmentWithCustomLinkifier() that works on elements with TextNodes would be great. ...
4 years ago (2016-12-13 00:08:27 UTC) #10
karabur
On 2016/12/13 at 00:08:27, luoe wrote: > I think a version of Components.linkifyStringAsFragmentWithCustomLinkifier() that works ...
4 years ago (2016-12-14 17:17:59 UTC) #11
karabur
Comments added, answers wanted. https://codereview.chromium.org/2568983003/diff/1/third_party/WebKit/LayoutTests/inspector/console/console-format-linkify.html File third_party/WebKit/LayoutTests/inspector/console/console-format-linkify.html (right): https://codereview.chromium.org/2568983003/diff/1/third_party/WebKit/LayoutTests/inspector/console/console-format-linkify.html#newcode9 third_party/WebKit/LayoutTests/inspector/console/console-format-linkify.html:9: console.log("%cwww.%s", "color:lightgray", "google.com", 12) On ...
4 years ago (2016-12-14 17:32:50 UTC) #12
luoe
Sure, I would like to see the complex cases mentioned in the comments handled, if ...
4 years ago (2016-12-14 20:09:02 UTC) #13
karabur
Implemented different approach to linkify and coloring, it covers more complex cases and result is ...
4 years ago (2016-12-21 13:14:14 UTC) #14
pfeldman
Hi there, sorry, I was not looking at it for some and it seems to ...
4 years ago (2016-12-21 22:44:38 UTC) #15
karabur
Hi, I did look at the logic of UI.highlightRangesWithStyleClass, and not sure how it can ...
3 years, 11 months ago (2017-01-02 18:48:34 UTC) #16
karabur
3 years, 11 months ago (2017-01-02 18:52:25 UTC) #17
pfeldman
If UI.highlightRangesWithStyleClass results in what you are saying, we should fix it. It would be ...
3 years, 11 months ago (2017-01-03 18:45:51 UTC) #18
karabur
Not sure if submitting a patch is enough to get all notified, so, adding a ...
3 years, 11 months ago (2017-01-26 20:50:12 UTC) #19
pfeldman
https://codereview.chromium.org/2568983003/diff/40001/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js File third_party/WebKit/Source/devtools/front_end/components/Linkifier.js (right): https://codereview.chromium.org/2568983003/diff/40001/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js#newcode608 third_party/WebKit/Source/devtools/front_end/components/Linkifier.js:608: Components.Linkifier.createLinkNodeWithCustomLinkifier = function(url, text, linkifier) { It looks like ...
3 years, 10 months ago (2017-01-27 19:10:07 UTC) #20
karabur
https://codereview.chromium.org/2568983003/diff/40001/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js File third_party/WebKit/Source/devtools/front_end/components/Linkifier.js (right): https://codereview.chromium.org/2568983003/diff/40001/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js#newcode608 third_party/WebKit/Source/devtools/front_end/components/Linkifier.js:608: Components.Linkifier.createLinkNodeWithCustomLinkifier = function(url, text, linkifier) { On 2017/01/27 at ...
3 years, 10 months ago (2017-01-27 21:21:04 UTC) #21
pfeldman
3 years, 10 months ago (2017-01-27 22:05:41 UTC) #22
> It does not, this method called with three different linkifiers. From
Linkifier
> itself, from ConsoleViewMessage._buildMessage and from
> TerminalWidget._linkifyTerminalLine. If i should make all of them capable of
> splitting line and column, it will be copypasted logic.

Copy-pasting 3 lines (with the use of helper method) is better than an ambiguous
linkifier API - it is already too hairy.

> I think this logic is specific for ConsoleViewMessage, and in particular to
> _formatWithSubstitutionString, since it is only place in app where we want to
> transfer style attr from parent to highlighted prop.

I guess I'm missing the use-case because I don't get why we should clone the
style.

> Yes, something looks wrong for me here as well, but I think it is because here
> we have two opposite requirements - destroy dom and create one text node for
> search, and keep dom structure and create set of text nodes for link.
> Do you mean highlightRangesWithStyleClass should be aware of that difference
and
> produce single node or set of nodes depending on is it used for search or
link?

The problem you are solving is considered a polish but, P3. It is important to
fix and please our users, but if it comes at a cost of bloat in complexity, we
have to pass. In this case, complexity is going up the order of magnitude
(arrays of arrays), while the use case is only solved partially (search nodes
are slit), hence the hesitation. Investing into a separable machinery
(highlighter) that solves this kind of problems altogether on a generic level
would justify the change. Otherwise, adding a bit of complexity into the code
that is already not great, while fixing something of not the highest priority
and not all the way, wouldn't be a great deal.

Powered by Google App Engine
This is Rietveld 408576698