Closed Bug 353071 Opened 19 years ago Closed 19 years ago

Simplify visibility checks in OpenLocation and getSearchBar

Categories

(Firefox :: General, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Firefox 3 alpha1

People

(Reporter: asaf, Assigned: asaf)

Details

Attachments

(1 file, 2 obsolete files)

We can do simple checks on the boxObject of the location bar and search bar elements instead of checking their containers visibility etc.
Attached patch patch (obsolete) — Splinter Review
Attachment #238937 - Flags: review?(gavin.sharp)
Status: NEW → ASSIGNED
Comment on attachment 238937 [details] [diff] [review] patch >Index: browser/base/content/browser.js > var element; >- if (gIsLoadingBlank && gURLBar && !gURLBar.hidden && >- !gURLBarContainer.parentNode.collapsed) >+ if (gIsLoadingBlank && gURLBar && isElementVisible(gURLBar)) > element = gURLBar; > else > element = content; >- if (gURLBar) { >- var style = document.defaultView.getComputedStyle(gURLBarContainer, null); >- if (style.visibility == "visible" && style.display != "none") { >- gURLBar.focus(); >- gURLBar.select(); >- return; >- } >+ if (gURLBar && isElementVisible(gURLBar)) { >+ gURLBar.focus(); >+ gURLBar.select(); >+ return; gURLBarContainer is now unused, so you can remove it. >Index: browser/base/content/utilityOverlay.js >+function isElementVisible(aElement) >+{ >+ // * When an element is hidden (not collapsed), its boxObject.x property is >+ // set to 0. This is also true for elements on the leftmost edge of the screen, though... You should probably check at least one of width and height, too. I kinda of wish there was a better way to tell whether an element has a frame or not (or maybe there is and I don't know about it - maybe one of the Neils would?). Also, use document.defaultView.getComputedStyle instead of window.getComputedStyle.
Attachment #238937 - Flags: review?(gavin.sharp) → review-
Priority: -- → P3
Attached patch patch (obsolete) — Splinter Review
Attachment #238937 - Attachment is obsolete: true
Attachment #239426 - Flags: review?(gavin.sharp)
Comment on attachment 239426 [details] [diff] [review] patch r=me if you also remove other traces of gURLBarContainer.
Attachment #239426 - Flags: review?(gavin.sharp) → review+
Attached patch as checked inSplinter Review
mozilla/browser/base/content/browser.js 1.708 mozilla/browser/base/content/utilityOverlay.js 1.43
Attachment #239426 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
OS: Mac OS X 10.3 → All
Hardware: Macintosh → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: