Bug 138856 - Add an optional entry transition (from selection highlight) to TextIndicator
Summary: Add an optional entry transition (from selection highlight) to TextIndicator
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 17:40 PST by Tim Horton
Modified: 2014-11-20 00:31 PST (History)
8 users (show)

See Also:


Attachments
Patch (44.14 KB, patch)
2014-11-18 17:41 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (42.38 KB, patch)
2014-11-19 02:27 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (61.80 KB, patch)
2014-11-19 15:30 PST, Tim Horton
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2014-11-18 17:40:18 PST
Add an optional entry transition (from selection highlight) to TextIndicator
Comment 1 Tim Horton 2014-11-18 17:41:07 PST
Created attachment 241840 [details]
Patch
Comment 2 WebKit Commit Bot 2014-11-18 17:42:48 PST
Attachment 241840 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:300:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 1 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Tim Horton 2014-11-18 17:43:54 PST
<rdar://problem/18840128>
Comment 4 Tim Horton 2014-11-18 19:36:39 PST
Need to turn on the transition for the DDChangedUI case, too.
Comment 5 Tim Horton 2014-11-19 02:27:33 PST
Created attachment 241852 [details]
Patch
Comment 6 mitz 2014-11-19 09:53:56 PST
Comment on attachment 241852 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241852&action=review

> Source/WebKit2/Shared/TextIndicator.cpp:120
> +// FIXME: Ideally the FrameSnapshotting functions would be more flexible and we
> +// wouldn't have to implement this here.

Can you please file a bug about doing this?

> Source/WebKit2/Shared/TextIndicator.h:71
> +    static PassRefPtr<TextIndicator> createWithSelectionInFrame(const WebFrame&, bool transitionFromSelectionColor = false);
> +    static PassRefPtr<TextIndicator> createWithRange(const WebCore::Range&, bool transitionFromSelectionColor = false);

I don’t think transitionFromSelectionColor best captures what this does. The transition is not from a color but rather from a snapshot of the selection (which typically includes the selection highlight, the foreground color of the selection, and any replaced elements). Declaring this as a boolean is also bad, which is evident from call sites below that pass "true". A TextIndicator::Transition parameter with values like FadeIn and Dissolve or whatever.
Comment 7 mitz 2014-11-19 09:54:49 PST
Comment on attachment 241852 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241852&action=review

>> Source/WebKit2/Shared/TextIndicator.h:71
>> +    static PassRefPtr<TextIndicator> createWithRange(const WebCore::Range&, bool transitionFromSelectionColor = false);
> 
> I don’t think transitionFromSelectionColor best captures what this does. The transition is not from a color but rather from a snapshot of the selection (which typically includes the selection highlight, the foreground color of the selection, and any replaced elements). Declaring this as a boolean is also bad, which is evident from call sites below that pass "true". A TextIndicator::Transition parameter with values like FadeIn and Dissolve or whatever.

…might be better.
Comment 8 mitz 2014-11-19 10:16:23 PST
Comment on attachment 241852 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241852&action=review

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:40
> +const double bounceAnimationDuration = 0.12;
> +const double bounceWithTransitionAnimationDuration = 0.25;
> +const double timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
> +const double fadeOutAnimationDuration = 0.3;

Why aren’t these CFTimeInterval?

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:69
> +    bool _transitionFromSelectionColor;

Not BOOL? The name seems wrong for the reasons I stated above.

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:72
> +- (id)_initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator margin:(CGSize)margin;

Why the underscore?

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:75
> +- (void)bounceWithCompletionHandler:(void(^)(void))completionHandler;
> +- (void)fadeOutWithCompletionHandler:(void(^)(void))completionHandler;

Now that multiple appearance transitions are supported, perhaps these names should be more generic (-appearWithCompletionHandler:, -disappearWithCompletionHandler: or similar).
Comment 9 mitz 2014-11-19 10:28:55 PST
Comment on attachment 241852 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241852&action=review

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:83
> -    if ((self = [super initWithFrame:NSZeroRect]))
> +    if ((self = [super initWithFrame:frame])) {

Please make this an early return on the reverse condition.

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:86
> +        _transitionFromSelectionColor = _textIndicator->data().contentImageWithHighlight;

When this is a BOOL, remember to !!

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:122
> +            // FIXME: Ideally we wouldn't remove the margin in this case, but we need to to ensure
> +            // that the yellow highlight and contentImageWithHighlight overlap precisely.

Can you file a bug about fixing this?

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:138
> +            [bounceLayer setValue:dropShadowLayer.get() forKey:@"dropShadowLayer"];

Better to define an NSString * const for this

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:152
> +            [bounceLayer setValue:rimShadowLayer.get() forKey:@"rimShadowLayer"];

…and this

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:174
> +            [bounceLayer setValue:textLayer.get() forKey:@"textLayer"];

…and this!

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:190
> +        [NSValue valueWithCATransform3D:CATransform3DMakeScale(1, 1, 1)],

CATransform3DIdentity

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:192
> +        [NSValue valueWithCATransform3D:CATransform3DMakeScale(1, 1, 1)]

CATransform3DIdentity

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:201
> +        [transitionAnimation setToValue:(id)contentsImage.get()];

.toVaue =

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:204
> +        [transitionAnimation setFillMode:kCAFillModeForwards];
> +        [transitionAnimation setRemovedOnCompletion:NO];
> +        [transitionAnimation setDuration:animationDuration];

. . .

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:211
> +        [fadeShadowInAnimation setFromValue:@0];
> +        [fadeShadowInAnimation setToValue:@1];
> +        [fadeShadowInAnimation setFillMode:kCAFillModeForwards];
> +        [fadeShadowInAnimation setRemovedOnCompletion:NO];
> +        [fadeShadowInAnimation setDuration:animationDuration];

. . . . .
Comment 10 mitz 2014-11-19 11:46:13 PST
Comment on attachment 241852 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=241852&action=review

> Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:81
> +- (id)_initWithFrame:(NSRect)frame textIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator margin:(CGSize)margin

Weird mix of NS and CG geometry types here.
Comment 11 Tim Horton 2014-11-19 15:30:29 PST
Created attachment 241896 [details]
Patch
Comment 12 WebKit Commit Bot 2014-11-19 15:31:59 PST
Attachment 241896 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h:51:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/UIProcess/API/mac/WKViewInternal.h:84:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/UIProcess/API/mac/WKView.mm:3072:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm:270:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 4 in 22 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Tim Horton 2014-11-19 16:11:08 PST
http://trac.webkit.org/changeset/176363
Comment 14 Tim Horton 2014-11-19 17:16:45 PST
Build fix http://trac.webkit.org/changeset/176370
Comment 15 Tim Horton 2014-11-19 17:56:32 PST
Build fix http://trac.webkit.org/changeset/176374
Comment 16 Csaba Osztrogonác 2014-11-20 00:30:13 PST
EFL buildfix - https://trac.webkit.org/changeset/176375
Comment 17 Csaba Osztrogonác 2014-11-20 00:31:04 PST
GTK buildfix - https://trac.webkit.org/changeset/176385