Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
wrapper for urlbar inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
psimyn committed Feb 26, 2016
1 parent 8a34b77 commit 0e57690
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 86 deletions.
2 changes: 1 addition & 1 deletion js/components/navigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class NavigationBar extends ImmutableComponent {
titleMode: this.titleMode
})}>

{ isSourceAboutUrl(frameProps.get('location')) ? null
{ isSourceAboutUrl(frameProps.get('location')) || this.titleMode ? null
: <div className='startButtons'>
{ this.loading
? <Button iconClass='fa-times'
Expand Down
111 changes: 58 additions & 53 deletions js/components/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class UrlBar extends ImmutableComponent {
const urlInput = this.urlInput
if (focused) {
urlInput.focus()
} else {
urlInput.blur()
}
}

Expand Down Expand Up @@ -232,57 +230,64 @@ class UrlBar extends ImmutableComponent {
action='#'
id='urlbar'
ref='urlbar'>
<span
onDragStart={this.onDragStart.bind(this)}
draggable
onClick={this.onSiteInfo}
className={cx({
urlbarIcon: true,
'fa': true,
'fa-lock': this.isHTTPPage && this.secure && !this.props.urlbar.get('active'),
'fa-unlock': this.isHTTPPage && !this.secure && !this.props.urlbar.get('active') && !this.props.titleMode,
'fa fa-search': this.props.searchSuggestions && this.props.urlbar.get('focused') && this.props.loading === false,
'fa fa-file-o': !this.props.searchSuggestions && this.props.urlbar.get('focused') && this.props.loading === false,
extendedValidation: this.extendedValidationSSL
})}/>
<div id='titleBar'>
<span><strong>{this.hostValue}</strong></span>
<span>{this.hostValue && this.titleValue ? ' | ' : ''}</span>
<span>{this.titleValue}</span>
</div>
<input type='text'
disabled={this.props.activeFrameProps.get('location') === undefined && this.loadTime === ''}
onFocus={this.onFocus.bind(this)}
onBlur={this.onBlur.bind(this)}
onKeyDown={this.onKeyDown.bind(this)}
onChange={this.onChange.bind(this)}
onClick={this.onClick.bind(this)}
onContextMenu={contextMenus.onUrlBarContextMenu.bind(this)}
value={this.locationValue}
data-l10n-id='urlbar'
className={cx({
insecure: !this.secure && this.props.loading === false && !this.isHTTPPage,
private: this.private,
testHookLoadDone: !this.props.loading
})}
id='urlInput'
readOnly={this.props.titleMode}
ref={node => this.urlInput = node}/>
{ !this.props.titleMode
? <span className='loadTime'>{this.loadTime}</span> : null }
{ this.shouldRenderUrlBarSuggestions
? <UrlBarSuggestions
ref={node => this.urlBarSuggestions = node}
suggestions={this.props.urlbar.get('suggestions')}
settings={this.props.settings}
sites={this.props.sites}
frames={this.props.frames}
searchDetail={this.searchDetail}
searchSuggestions={this.props.searchSuggestions}
activeFrameProps={this.props.activeFrameProps}
urlLocation={this.props.urlbar.get('location')}
urlPreview={this.props.urlbar.get('urlPreview')}
previewActiveIndex={this.props.previewActiveIndex || 0} /> : null }
<span
onDragStart={this.onDragStart.bind(this)}
draggable
onClick={this.onSiteInfo}
className={cx({
urlbarIcon: true,
'fa': true,
'fa-lock': this.isHTTPPage && this.secure && !this.props.urlbar.get('active'),
'fa-unlock': this.isHTTPPage && !this.secure && !this.props.urlbar.get('active') && !this.props.titleMode,
'fa fa-search': this.props.searchSuggestions && this.props.urlbar.get('focused') && this.props.loading === false,
'fa fa-file-o': !this.props.searchSuggestions && this.props.urlbar.get('focused') && this.props.loading === false,
extendedValidation: this.extendedValidationSSL
})} />
{ this.props.titleMode
? <div id='titleBar'>
<span><strong>{this.hostValue}</strong></span>
<span>{this.hostValue && this.titleValue ? ' | ' : ''}</span>
<span>{this.titleValue}</span>
</div>

: <input type='text'
disabled={this.props.activeFrameProps.get('location') === undefined && this.loadTime === ''}
onFocus={this.onFocus.bind(this)}
onBlur={this.onBlur.bind(this)}
onKeyDown={this.onKeyDown.bind(this)}
onChange={this.onChange.bind(this)}
onClick={this.onClick.bind(this)}
onContextMenu={contextMenus.onUrlBarContextMenu.bind(this)}
value={this.locationValue}
data-l10n-id='urlbar'
className={cx({
insecure: !this.secure && this.props.loading === false && !this.isHTTPPage,
private: this.private,
testHookLoadDone: !this.props.loading
})}
id='urlInput'
readOnly={this.props.titleMode}
ref={node => this.urlInput = node}/>
}
<legend/>

{ this.props.titleMode ? null
: <span className='loadTime'>{this.loadTime}</span>
}

{ this.shouldRenderUrlBarSuggestions
? <UrlBarSuggestions
ref={node => this.urlBarSuggestions = node}
suggestions={this.props.urlbar.get('suggestions')}
settings={this.props.settings}
sites={this.props.sites}
frames={this.props.frames}
searchDetail={this.searchDetail}
searchSuggestions={this.props.searchSuggestions}
activeFrameProps={this.props.activeFrameProps}
urlLocation={this.props.urlbar.get('location')}
urlPreview={this.props.urlbar.get('urlPreview')}
previewActiveIndex={this.props.previewActiveIndex || 0} /> : null }
</form>
}
}
Expand Down
14 changes: 4 additions & 10 deletions less/button.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
span.browserButton {
cursor: default;
display: inline-block;
line-height: 28px;
line-height: 30px;
width: 30px;
height: 30px;
font-size: 17px;
Expand Down Expand Up @@ -38,19 +38,13 @@ span.browserButton {

span.browserButton.newFrameButton {
font-family: helvetica;
font-weight: 100;
font-size: 26px;
line-height: 22px;
font-weight: 100;
font-size: 26px;
line-height: 22px;
width: 20px;
vertical-align: middle;
}

span.browserButton.reload-button,
span.browserButton.stop-button {
font-size: 16px;
line-height: 30px;
}

.buttonCommon {
color: #fff;
font-size: inherit;
Expand Down
70 changes: 48 additions & 22 deletions less/navigationBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,57 @@
justify-content: space-between;
padding-left: 70px;
border-bottom: 1px solid #bbb;
height: 40px;
}

.urlbarForm {
max-width: calc(~'100% - 72px');
max-width: calc(~'100% - 80px'); // space for reload and bookmark buttons
position: relative;
white-space: nowrap;
display: flex;
align-items: center;
justify-content: center;
height: 24px;

*:not(legend) {
z-index: 1;
}

input:focus + legend:before {
content: ' ';
position: absolute;
background: #fff;
border: 1px solid @focusUrlbarOutline;
border-radius: 4px;
box-shadow: 0 0 1px @focusUrlbarOutline, inset 0 0 2px @focusUrlbarOutline;
color: #333;
outline: none;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 0;
}

#navigator:not(.titleMode) & {
flex: 1;
background: white;
border-radius: @borderRadiusURL;
box-sizing: border-box;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
color: @chromeText;
padding: 0 8px;
}
}

#navigator {
font-size: 20px;
height: 34px;
align-items: center;
justify-content: center;
max-width: 900px;
box-sizing: border-box;
margin: 6px 0 0 -114px;
padding: 0 0 4px 0;
margin: 0 0 0 -114px;
padding: 0;
position: relative;
display: flex;
flex-direction: row;
Expand All @@ -55,22 +86,18 @@
max-width: 100%;
overflow-x: hidden;
text-overflow: ellipsis;
margin-top: 5px;
}
.startButtons {
display: none;
}

.endButtons {
position: absolute;
top: -2px;
}

.urlbarIcon {
display: inline-block;
opacity: 0.4;
position: relative;
left: 2px;
top: -2px;
min-width: 0;

&[class*=" fa-"] {
Expand All @@ -82,6 +109,7 @@
.bookmark-button {
transform: scale(0.6);
opacity: 0.6;
text-align: left;

&:not(.remove-bookmark-button) {
display: none;
Expand All @@ -96,7 +124,6 @@
.loadTime {
color: @loadTimeColor;
font-size: 12px;
position: absolute;
right: 10px;
text-align: right;
top: 8px;
Expand All @@ -111,34 +138,34 @@
-moz-window-dragging: no-drag;
}

.inputbar-wrapper {
background: white;
display: flex;
flex: 1 1 0;
border-radius: 4px;
align-items: center;
justify-content: center;
}

input {
-webkit-app-region: no-drag;
background: @navigationBarBackground;
border: none;
border-radius: @borderRadiusURL;
box-sizing: border-box;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
color: @chromeText;
cursor: text;
font-size: @defaultFontSize;
font-weight: normal;
height: 24px;
margin: 0 0 0 1px;
padding: 0 70px 0 33px;
outline: none;
text-overflow: ellipsis;
width: 100%;

&:hover {
background: @chromeControlsBackground2;
}

&:focus {
background: #fff;
border: 1px solid @focusUrlbarOutline;
box-shadow: 0 0 1px @focusUrlbarOutline, inset 0 0 2px @focusUrlbarOutline;
color: #333;
outline: none;
}

&.private {
background: @privateTabBackground;
Expand All @@ -153,8 +180,6 @@

.urlbarIcon {
color: @buttonColor;
position: absolute;
top: 6px;
left: 14px;
font-size: 15px;
min-height: 16px;
Expand All @@ -169,6 +194,7 @@
.flyoutDialog;
box-sizing: border-box;
width: 100%;
left: 0;
z-index: 311;

.suggestionIcon {
Expand Down

0 comments on commit 0e57690

Please sign in to comment.