Commit 4cd05baa authored by estade@chromium.org's avatar estade@chromium.org

make the settings search page bubbles look cool

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10408038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138211 0039d316-1c4b-4281-b951-d872f2087c98
parent 9597042c
......@@ -10,29 +10,57 @@
background-color: rgba(255, 240, 120, 0.9);
}
/* Container for the elements that make up the search bubble. */
.search-bubble {
-webkit-box-shadow: 0 2px 2px #888;
background-color: rgba(255, 240, 120, 0.8);
border-radius: 6px;
box-shadow: 0 2px 2px #888;
left: 0;
margin: 12px 0 0;
padding: 4px 10px;
margin-top: 5px;
pointer-events: none;
position: absolute;
top: -1000px; /* Minor hack: position off-screen by default. */
/* Create a z-context for search-bubble-innards, its after and before. */
z-index: 0;
}
/* Contains the text content of the bubble. */
.search-bubble-innards {
background: -webkit-linear-gradient(rgba(255, 248, 172, 0.9),
rgba(255, 243, 128, 0.9));
border-radius: 2px;
padding: 4px 10px;
text-align: center;
top: -1000px; /* minor hack: position off-screen by default */
width: 100px;
}
.search-bubble:after {
border-color: rgba(255, 240, 120, 0.9) transparent;
border-style: solid;
border-width: 0 10px 10px;
/* Provides the border around the bubble (has to be behind :after). */
.search-bubble-innards::before {
border: 1px solid rgb(220, 198, 72);
border-radius: 2px;
bottom: -1px;
content: '';
left: -1px;
position: absolute;
right: -1px;
top: -1px;
z-index: -2;
}
/* Provides the arrow which points at the anchor element. */
.search-bubble-innards::after {
-webkit-transform: rotate(45deg);
background:
-webkit-linear-gradient(-45deg, rgb(251, 255, 181),
rgb(255, 248, 172) 50%,
rgba(255, 248, 172, 0));
border: 1px solid rgb(220, 198, 72);
border-bottom-color: transparent;
border-right-color: transparent;
content: '';
left: 50px;
height: 12px;
left: 53px;
position: absolute;
top: -10px;
top: -7px;
width: 12px;
z-index: -1;
}
.search-bubble-wrapper {
......
......@@ -12,7 +12,7 @@ cr.define('options', function() {
function SearchBubble(text) {
var el = cr.doc.createElement('div');
SearchBubble.decorate(el);
el.textContent = text;
el.content = text;
return el;
}
......@@ -27,6 +27,10 @@ cr.define('options', function() {
decorate: function() {
this.className = 'search-bubble';
this.innards_ = cr.doc.createElement('div');
this.innards_.className = 'search-bubble-innards';
this.appendChild(this.innards_);
// We create a timer to periodically update the position of the bubbles.
// While this isn't all that desirable, it's the only sure-fire way of
// making sure the bubbles stay in the correct location as sections
......@@ -34,9 +38,17 @@ cr.define('options', function() {
this.intervalId = setInterval(this.updatePosition.bind(this), 250);
},
/**
* Attach the bubble to the element.
*/
/**
* Sets the text message in the bubble.
* @param {string} text The text the bubble will show.
*/
set content(text) {
this.innards_.textContent = text;
},
/**
* Attach the bubble to the element.
*/
attachTo: function(element) {
var parent = element.parentElement;
if (!parent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment