Closed Bug 689877 Opened 13 years ago Closed 13 years ago

Fennec does not scroll view into plugin editable field

Categories

(Firefox for Android Graveyard :: Panning/Zooming, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 10

People

(Reporter: romaxa, Assigned: romaxa)

Details

Attachments

(1 file, 4 obsolete files)

When plugin input field is focused, we do not do anything in order to scroll plugin field into view.
Here is some wip approach how to fix that problem
Attachment #563002 - Flags: feedback?(mark.finkle)
Comment on attachment 563002 [details] [diff] [review]
Scroll plugin input filed into view

This approach is just quick way to scroll plugin input field (using last click point) without hacking formhelper functionality.
couple of questions here:
1) I've found that we do subtract toolbar height from ViewableArea for table but not for default UI.... and that seems breaking proper positioning of input field... so that is why I added height -= BrowserUI.toolbarH;
2) Should I integrate HTMLEmbed tag handling into form helper, or should I keep I as separate thing?
Attachment #563002 - Flags: feedback?(mbrubeck)
Comment on attachment 563002 [details] [diff] [review]
Scroll plugin input filed into view

Looks okay to me overall.  Some feedback below:

>   observe: function va_observe(aSubject, aTopic, aData) {
> #if MOZ_PLATFORM_MAEMO == 6
>     let rect = Rect.fromRect(JSON.parse(aData));
>     let height = rect.bottom - rect.top;
>     let width = rect.right - rect.left;
>+    height -= BrowserUI.toolbarH;
>     if (height == window.innerHeight && width == window.innerWidth) {
>       this._height = null;
>       this._width = null;
>     }

Why is this change needed?  Won't this guarantee that the (height == window.innerHeight) check on the next line always fails?  In tablet mode (on a hypothetical Maemo 6 tablet) it will also do weird things because the "ViewableAreaObserver.height" getter subtracts toolbarH again.

>+    window.addEventListener("KeyboardChanged", function(aEvent) {
>+      window.removeEventListener("KeyboardChanged", arguments.callee, false);

Please avoid using arguments.callee - among other reasons, it won't be allowed in JS strict mode.  This can be changed to:

    window.addEventListener("KeyboardChanged", function listener(aEvent) {
      window.removeEventListener("KeyboardChanged", listener, false);

>+            let timer = new Util.Timeout(function() {
>+              // ...
>+            });
>+            timer.once(0);

You should store a non-local reference to the timer, or just use setTimeout, because of http://www.joshmatthews.net/blog/2011/03/nsitimer-anti-pattern/
Attachment #563002 - Flags: feedback?(mbrubeck) → feedback+
Comment on attachment 563002 [details] [diff] [review]
Scroll plugin input filed into view

>diff --git a/mobile/chrome/content/common-ui.js b/mobile/chrome/content/common-ui.js

>+  _waitAndZoom: function formHelperWaitAndZoom(elementRect, elSubRect) {
>+    if (ViewableAreaObserver.isKeyboardOpened) {
>+      this._zoom(elementRect, elSubRect);
>+      return;
>+    }
>+
>+    let self = this;
>+    window.addEventListener("KeyboardChanged", function(aEvent) {
>+      window.removeEventListener("KeyboardChanged", arguments.callee, false);
>+      if (ViewableAreaObserver.isKeyboardOpened) {
>+        self._zoom(elementRect, elSubRect);
>+      }
>+    }, false);
>+  },

Why do we need this when we already have a _waitForKeyboard mechanism used when calling show() ?


>     switch (aMessage.name) {
>+      case "FormAssist:ShowPlugins":
>+        this._currentElementRect = Rect.fromRect(json.rect);
>+        this._currentBrowser = getBrowser();
>+        let caretRect = new Rect(json.pressPoint.x, json.pressPoint.y, 1, 50);
>+        this._waitAndZoom(Rect.fromRect(json.rect), caretRect);

Why not use show?
I wish we were using aMessage.target and not getBrowser() - I see it's used in ForAssist:Show too

>diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js

>+              if (utils.IMEStatus == 3) {

Do we have a real constant name and not just '3' ?

(and Matt's feedback)

f+ (overall, it looks OK)
Attachment #563002 - Flags: feedback?(mark.finkle) → feedback+
Assignee: nobody → romaxa
Attachment #563002 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #563559 - Flags: review?(mbrubeck)
Comment on attachment 563559 [details] [diff] [review]
Scroll plugin input filed into view

Hop it is ok to :Show, and hardcode some params for plugin case
Attachment #563559 - Flags: review?(mark.finkle)
Comment on attachment 563559 [details] [diff] [review]
Scroll plugin input filed into view

The code here looks good, but I have just one change I'd like to see.  I think this code belongs in FormAssistant (chrome/content/forms.js).  Can you make it so this check is called inside of FormAssistant.prototype.open?  I think you could put it in a new function that you call if the _isValidElement check fails.

Sorry for not thinking of this in my previous feedback.
Attachment #563559 - Flags: review?(mbrubeck) → review-
Attachment #563559 - Attachment is obsolete: true
Attachment #563559 - Flags: review?(mark.finkle)
Attachment #563799 - Flags: review?(mbrubeck)
Attachment #563799 - Flags: review?(mbrubeck) → review+
Keywords: checkin-needed
ok, make sense
Keywords: checkin-needed
Added default param
Attachment #563799 - Attachment is obsolete: true
Attachment #563823 - Flags: review?(mark.finkle)
Comment on attachment 563823 [details] [diff] [review]
Scroll plugin input filed into view

Should work OK
Attachment #563823 - Flags: review?(mark.finkle) → review+
Keywords: checkin-needed
Pushed to Try (with some other stuff I'm hoping to check in):
https://tbpl.mozilla.org/?tree=Try&rev=654c636e0207
Try caught a syntax error caused by an extra curly brace after an "if" statement in content.js.
Keywords: checkin-needed
Fixed syntax error... wrongly synced patch between mozilla-7.0 release branch
Attachment #563823 - Attachment is obsolete: true
Attachment #563876 - Flags: review?(mbrubeck)
Attachment #563876 - Flags: review?(mbrubeck) → review+
New Try run is green: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=cdb8f52e8801

Pushed to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/49ae33f133dd
OS: Linux → All
Hardware: x86 → All
Target Milestone: --- → Firefox 10
https://hg.mozilla.org/mozilla-central/rev/49ae33f133dd
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: