Closed Bug 15901 Opened 25 years ago Closed 25 years ago

[DOGFOOD] Selected text does not clear when you type

Categories

(Core :: DOM: Editor, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: alecf, Assigned: kinmoz)

References

Details

(Whiteboard: [PDT+])

If I type something in an HTML text field, then select any part of the text
(most commonly, I select the whole thing) and start typing, the selected text
does not go away. The actual selection seems to go away but visually it looks
like it's still there...
I can type and the visually-selected text gets overwritten with nonselected
text, and when I submit forms the correct text is submitted, so I think this is
entirely a visual thing, but damn it's ugly.
Assignee: buster → pavlov
Summary: Selected text does not clear when you type → [DOGFOOD] Selected text does not clear when you type
normally I would assign this to akkana, but she's on vacation so I'm hoping you
can take a look at this, Pav.  If this isn't your area, please reassign it to
me.  cc Kin because he's dabbled in the view space as well.
Whiteboard: [PDT+]
Putting on [PDT+] radar
*** Bug 15926 has been marked as a duplicate of this bug. ***
*** Bug 16389 has been marked as a duplicate of this bug. ***
I have a fix for this.

The editor batches UpdateView calls. When batching is on, the ViewManager saves
all update rects in a damage region. UpdateView is called when layout frames are
invalidated, and the rect passed in is usually the frame's bounds. There are
some frames in layout that have zero width or height which gdk_regions_union()
does not seem to like.

Calling gdk_regions_union() with a zero width or height rect causes the region's
rect to be reset to all zeros.

This means that the damage region will not contain the correct update rect when
it comes time to paint.

The following patch fixes the problem. I will check this in after
beard@netscape.com reviews it.





Index: nsViewManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/view/src/nsViewManager.cpp,v
retrieving revision 3.128
diff -c -r3.128 nsViewManager.cpp
*** nsViewManager.cpp   1999/10/12 00:16:03     3.128
--- nsViewManager.cpp   1999/10/14 22:04:32
***************
*** 1373,1379 ****
  NS_IMETHODIMP nsViewManager :: UpdateView(nsIView *aView, const nsRect &aRect,
 PRUint32 aUpdateFlags)
  {
    NS_PRECONDITION(nsnull != aView, "null view");
!   if (!mRefreshEnabled) {
      // accumulate this rectangle in the view's dirty region, so we can process
 it later.
      AddRectToDirtyRegion(aView, aRect);
      ++mUpdateCnt;
--- 1373,1379 ----
  NS_IMETHODIMP nsViewManager :: UpdateView(nsIView *aView, const nsRect &aRect,
 PRUint32 aUpdateFlags)
  {
    NS_PRECONDITION(nsnull != aView, "null view");
!   if (!mRefreshEnabled && aRect.width != 0 && aRect.height != 0) {
      // accumulate this rectangle in the view's dirty region, so we can process
 it later.
      AddRectToDirtyRegion(aView, aRect);
      ++mUpdateCnt;
shouldn't we fix all the calls to gdk_regions_union()? There are a number of
other places where painting is confused...or do all calls go through UpdateView
anyway?
I believe pavlov will be adding a check for zero width or height at the gdk
level as well.

Here's a new version of the patch ... the original one had bad logic. Oops. :)


Index: nsViewManager.cpp
===================================================================
RCS file: /cvsroot/mozilla/view/src/nsViewManager.cpp,v
retrieving revision 3.128
diff -c -r3.128 nsViewManager.cpp
*** nsViewManager.cpp   1999/10/12 00:16:03     3.128
--- nsViewManager.cpp   1999/10/14 22:29:16
***************
*** 1375,1382 ****
    NS_PRECONDITION(nsnull != aView, "null view");
    if (!mRefreshEnabled) {
      // accumulate this rectangle in the view's dirty region, so we can process
 it later.
!     AddRectToDirtyRegion(aView, aRect);
!     ++mUpdateCnt;
      return NS_OK;
    }

--- 1375,1384 ----
    NS_PRECONDITION(nsnull != aView, "null view");
    if (!mRefreshEnabled) {
      // accumulate this rectangle in the view's dirty region, so we can process
 it later.
!     if (aRect.width != 0 && aRect.height != 0) {
!       AddRectToDirtyRegion(aView, aRect);
!       ++mUpdateCnt;
!     }
      return NS_OK;
    }
Assignee: pavlov → kin
Reassigning to kin@netscape.com.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix checked into mozilla/view/src/nsViewManager.cpp  revision 3.129.
*** Bug 14808 has been marked as a duplicate of this bug. ***
Status: RESOLVED → VERIFIED
looks fine to me...verified in 10/19 build.
Blocks: 12658
linking to PDT+ tracking bug 12658
You need to log in before you can comment on or make changes to this bug.