Skip to content

Commit 3b213a8

Browse files
Refactor FXIOS-12279 [Toolbar] Address Bar Shadow (backport #26937) (#26945)
Refactor FXIOS-12279 [Toolbar] Address Bar Shadow (#26937) * Add shadow to address toolbar * Change order of views (cherry picked from commit 5e6c4ae) Co-authored-by: Winnie Teichmann <[email protected]>
1 parent b834dbc commit 3b213a8

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

BrowserKit/Sources/ToolbarKit/AddressToolbar/BrowserAddressToolbar.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public class BrowserAddressToolbar: UIView,
3131
static let toolbarAnimationTime: CGFloat = 0.15
3232
static let iconsAnimationTime: CGFloat = 0.1
3333
static let iconsAnimationDelay: CGFloat = 0.075
34+
35+
static let shadowRadius: CGFloat = 14
36+
static let shadowOpacity: Float = 1
37+
static let shadowOffset = CGSize(width: 0, height: 2)
3438
}
3539

3640
public var notificationCenter: any NotificationProtocol = NotificationCenter.default
@@ -269,6 +273,16 @@ public class BrowserAddressToolbar: UIView,
269273
setupAccessibility()
270274
}
271275

276+
private func setupShadow(theme: Theme) {
277+
locationContainer.layer.shadowPath = UIBezierPath(roundedRect: locationContainer.bounds,
278+
cornerRadius: locationContainer.layer.cornerRadius).cgPath
279+
locationContainer.layer.shadowRadius = UX.shadowRadius
280+
locationContainer.layer.shadowOffset = UX.shadowOffset
281+
locationContainer.layer.shadowColor = theme.colors.shadowStrong.cgColor
282+
locationContainer.layer.shadowOpacity = UX.shadowOpacity
283+
locationContainer.layer.masksToBounds = false
284+
}
285+
272286
private func setupDragInteraction() {
273287
// Setup UIDragInteraction to handle dragging the location
274288
// bar for dropping its URL into other apps.
@@ -487,6 +501,7 @@ public class BrowserAddressToolbar: UIView,
487501
toolbarTopBorderView.backgroundColor = colors.borderPrimary
488502
toolbarBottomBorderView.backgroundColor = colors.borderPrimary
489503
locationView.applyTheme(theme: theme)
504+
setupShadow(theme: theme)
490505
self.theme = theme
491506
}
492507

firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,12 +1180,15 @@ class BrowserViewController: UIViewController,
11801180

11811181
view.addSubview(header)
11821182
view.addSubview(bottomContentStackView)
1183-
view.addSubview(overKeyboardContainer)
11841183

11851184
let toolbarToShow = isToolbarRefactorEnabled ? navigationToolbarContainer : toolbar
11861185

11871186
bottomContainer.addArrangedSubview(toolbarToShow)
11881187
view.addSubview(bottomContainer)
1188+
1189+
// add overKeyboardContainer after bottomContainer so the address toolbar shadow
1190+
// for bottom toolbar doesn't get clipped
1191+
view.addSubview(overKeyboardContainer)
11891192
}
11901193

11911194
private func enqueueTabRestoration() {

0 commit comments

Comments
 (0)