Closed Bug 1087190 Opened 10 years ago Closed 10 years ago

[Text selection] Add debug logs to SelectionCarets

Categories

(Core :: Layout, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(1 file, 5 obsolete files)

It will be easier to debug SelectionCarets with some logs.
Morris,

If there're some critical points in SelectionCarets that should have a log print, feel free to let me know.
Attachment #8509307 - Flags: feedback?(mtseng)
Comment on attachment 8509307 [details] [diff] [review]
Add debug log to SelectionCarets.

Review of attachment 8509307 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/base/SelectionCarets.cpp
@@ +1032,5 @@
>    nsRefPtr<SelectionCarets> self = static_cast<SelectionCarets*>(aSelectionCarets);
>    NS_PRECONDITION(aTimer == self->mLongTapDetectorTimer,
>                    "Unexpected timer");
>  
> +  SELECTIONCARETS_LOG_STATIC("SelectWord");

This long tap event would be fired if apzc is not available. for apzc case, we'll receive event from apzc and handle it at SelectionCarets::HandleEvent(). So, please add a log for apzc long tap as well and both log message should able to distinguish where is long tap coming from.
Attachment #8509307 - Flags: feedback?(mtseng) → feedback+
Comment on attachment 8509307 [details] [diff] [review]
Add debug log to SelectionCarets.

Review of attachment 8509307 [details] [diff] [review]:
-----------------------------------------------------------------

I suggest to add the log for SelectWord, but the GetFrameName is required to define DEBUG_FRAME_DUMP.


111    SetSelectionDragState(true);
112    nsFrame* frame = static_cast<nsFrame*>(ptFrame);
113    nsresult rs = frame->SelectByTypeAtPoint(mPresShell->GetPresContext(), ptInFrame,
114                                             eSelectWord, eSelectWord, 0);
115 +  frame->GetFrameName(fName);
116 +  printf_stderr("peter SelectionCarets::SelectWord(%d) ptFrame %p  ptFrameyType %s ptInFrame %f %f flags 0x%08x\n",
117 +    __LINE__, frame, NS_ConvertUTF16toUTF8(fName).get(), (float)ptInFrame.x, (float)ptInFrame.y, flags);
Addressed comment 2 and comment 3.
Attachment #8510124 - Flags: review?(roc)
Comment on attachment 8510124 [details] [diff] [review]
Add debug log to SelectionCarets. f=mtseng, r=roc

Review of attachment 8510124 [details] [diff] [review]:
-----------------------------------------------------------------

Please use NSPR logging instead of rolling your own framework.
Attachment #8510124 - Flags: review?(roc) → review-
Use NSPR logging.
Attachment #8509307 - Attachment is obsolete: true
Attachment #8510124 - Attachment is obsolete: true
Attachment #8510963 - Flags: review?(roc)
To export NSPR_LOG_MODULES=SelectionCarets:5 and enable NSPR log on B2G, see this document.
https://developer.mozilla.org/en-US/Firefox_OS/Developing_Firefox_OS/Customizing_the_b2g.sh_script
Comment on attachment 8510963 [details] [diff] [review]
Add debug log to SelectionCarets. f=mtseng, r=roc (v2)

Review of attachment 8510963 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!!!
Attachment #8510963 - Flags: review?(roc) → review+
Comment on attachment 8510963 [details] [diff] [review]
Add debug log to SelectionCarets. f=mtseng, r=roc (v2)

Review of attachment 8510963 [details] [diff] [review]:
-----------------------------------------------------------------

With this patch, I could dump the selectioncaret log in B2G.

::: layout/base/SelectionCarets.cpp
@@ +941,5 @@
>                                         nsISelection* aSel,
>                                         int16_t aReason)
>  {
> +  SELECTIONCARETS_LOG("Reason=%d", aReason);
> +

Please also dump the collapse state here.
Peter, I'll fixup this patch to my main patch if it's look good to you.
Attachment #8512692 - Flags: feedback?(pchang)
Assignee: nobody → tlin
Status: NEW → ASSIGNED
Comment on attachment 8512692 [details] [diff] [review]
Use __FUNCTION__ and add log about collapsed. f=pchang

Review of attachment 8512692 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #8512692 - Flags: feedback?(pchang) → feedback+
Comment on attachment 8512692 [details] [diff] [review]
Use __FUNCTION__ and add log about collapsed. f=pchang

Review of attachment 8512692 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/base/SelectionCarets.cpp
@@ +950,4 @@
>    if (isCollapsed) {
>      SetVisibility(false);
>      return NS_OK;
>    }

This was removed in bug 1074736. I'll print the collapsed info in UpdateSelectionCarets()
Rebased.
Attachment #8510963 - Attachment is obsolete: true
Attachment #8512692 - Attachment is obsolete: true
Attachment #8513224 - Flags: review+
Keywords: checkin-needed
s/kLogModuleName/kSelectionCaretsLogModuleName so that it wont't clash with
names in other cpp in unified build in the future.
Attachment #8513224 - Attachment is obsolete: true
Attachment #8513302 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/468517afd116
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: