Closed
Bug 773819
Opened 13 years ago
Closed 13 years ago
Avoid calls to getBoundingClientRect in text selection code
Categories
(Firefox for Android Graveyard :: Text Selection, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 16
People
(Reporter: Margaret, Assigned: Margaret)
References
Details
Attachments
(1 file, 1 obsolete file)
7.46 KB,
patch
|
mfinkle
:
review+
|
Details | Diff | Splinter Review |
Instead of calling getBoundingClientRect() on the handles before sending every mouse event, this patch caches the left/top values, and uses the aX/aY we get from the touch events to update the cache as we drag the handles.
Unfortunately, we do still need *some* calls to getBoundingClientRect(), such as after the page pans, or after we reverse the handle positions, but this patch significantly reduces the number of calls we're making.
I noticed a little bit of weirdness with the positioning of the handles when they reverse or when the selection completely collapses when they get right next to each other sometimes, but I verified those issues also exist on Nightly, so I can file other bugs about that.
Next, I'm going to work on a patch about the scrollX/scrollY problems.
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #642082 -
Flags: review?(mark.finkle)
Assignee | ||
Comment 2•13 years ago
|
||
Comment on attachment 642082 [details] [diff] [review]
patch
Ugh, I'm testing this again after fixing some other patches in my queue, and it's being really laggy. I'll investigate more.
Attachment #642082 -
Flags: review?(mark.finkle)
Assignee | ||
Comment 3•13 years ago
|
||
I found the problem was some bad interaction with my patch for bug 773813. Testing that patch on its own, things were working fine, but now with this patch applied, I'm often getting the html element in _sendMouseEvents, so we're bailing before sending our mouse events.
Flipping the flushLayout param to true in that call is fixing the problem, so maybe we do need at least one layout flush for this to work right? :/
This at least minimizes the number of layout flushes while maintaining the the right behavior. We could investigate this more in a separate bug.
Attachment #642082 -
Attachment is obsolete: true
Attachment #642132 -
Flags: review?(mark.finkle)
Comment 4•13 years ago
|
||
Comment on attachment 642132 [details] [diff] [review]
patch w/ flushLayout
>diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
> // Initialize the cache
>- this.cache = {};
>+ this.cache = { start: {}, end: {}};
Add a space-> end: {} };
> moveSelection: function sh_moveSelection(aIsStartHandle, aX, aY) {
> // Update the handle position as it's dragged
> let leftTop = "left:" + (aX + this._view.scrollX - this._viewOffset.left) + "px;" +
> "top:" + (aY + this._view.scrollY - this._viewOffset.top) + "px;";
Still can remove the view.scrollX / Y
Attachment #642132 -
Flags: review?(mark.finkle) → review+
Assignee | ||
Comment 5•13 years ago
|
||
(In reply to Mark Finkle (:mfinkle) from comment #4)
> Still can remove the view.scrollX / Y
See bug 773864.
Assignee | ||
Comment 6•13 years ago
|
||
Target Milestone: --- → Firefox 16
Comment 7•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•