Closed Bug 1070851 Opened 10 years ago Closed 10 years ago

[Touch Caret] Make touch caret respect argument 'withCaret' of snapshotWindow()

Categories

(Core :: Layout, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(1 file, 1 obsolete file)

When calling snapshotWindow(win, withCaret) [1] in javascript, we can pass 'false' in the 2nd argument to avoid snapshot caret. However, touch caret will always be captured in the snapshot. It will be better to make touch caret respect this argument as caret did.

[1] http://hg.mozilla.org/mozilla-central/file/5bd6e09f074e/testing/mochitest/tests/SimpleTest/WindowSnapshot.js#l11
Hi Robert,

It seems that nsCaret avoid adding itself in the snapshot by early return in [1]. But touch caret is an anonymous frame under canvas frame. Any similar trick we could do to avoid displaying touch caret? Would you please give me some hints? Thanks.

[1] http://hg.mozilla.org/mozilla-central/file/5bd6e09f074e/layout/base/nsDisplayList.cpp#l957
Flags: needinfo?(roc)
You can probably just exclude the kid frame(s) for the touch caret for that case,
something like this:
 if (aBuilder->mBuildCaret || kid->GetContent() != mTouchCaretElement) {
   BuildDisplayListForChild(...);
 }
here:
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsCanvasFrame.cpp#418
Assignee: nobody → tlin
Mats, thank you for providing the solution!
Status: NEW → ASSIGNED
Flags: needinfo?(roc)
Avoid capture touch caret when the argument 'withCaret' is false in
snapshotWindow().
Attachment #8493613 - Flags: review?(roc)
With the following CSS, I still got blue glow shown when focusing the input on B2G desktop and emulator. That's why the try failed.

input, textarea, div {
  background: none;
  outline: none;
}

Try result:
https://tbpl.mozilla.org/?tree=Try&rev=a6763c38622a
Does adding -moz-appearance:none; to the above style rule help?
Adding "-moz-appearance:none;" does not make any difference. I'll add "border: none;" to the style rule.

Try result:
https://tbpl.mozilla.org/?tree=Try&rev=7ee274c48684
Attachment #8493613 - Attachment is obsolete: true
Attachment #8494366 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f2441dd1b0a9
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: