1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/text-overflow/selection-ref.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,114 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<!-- 1.6 + Any copyright is dedicated to the Public Domain. 1.7 + http://creativecommons.org/licenses/publicdomain/ 1.8 +--> 1.9 +<html class="reftest-wait"><head> 1.10 +<title>text-overflow: Selected text, background, decorations</title> 1.11 +<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 1.12 +<style type="text/css"> 1.13 +@font-face { 1.14 + font-family: DejaVuSansMono; 1.15 + src: url(../fonts/DejaVuSansMono.woff); 1.16 +} 1.17 +@font-face { 1.18 + font-family: TestEllipsisFallback; 1.19 + src: url(TestEllipsisFallback.woff); 1.20 +} 1.21 +html,body { 1.22 + color:black; background-color:white; font-size:16px; padding:0; margin:0; font-family:DejaVuSansMono; 1.23 +} 1.24 + 1.25 +.test { 1.26 + overflow:auto; 1.27 + white-space:nowrap; 1.28 + width: 5em; 1.29 + position:relative; 1.30 + margin-top:1em; 1.31 + padding-left: 0.9em; 1.32 + padding-right: 1.3em; 1.33 +} 1.34 + 1.35 +.hidden { 1.36 + overflow:hidden; 1.37 + width: 4.4em; 1.38 +} 1.39 + 1.40 +.rlo { 1.41 + unicode-bidi: bidi-override; direction: rtl; 1.42 +} 1.43 +.lro { 1.44 + unicode-bidi: bidi-override; direction: ltr; 1.45 +} 1.46 +.rtl { 1.47 + direction:rtl; 1.48 +} 1.49 +i { display:none; } 1.50 +x {font-family:DejaVuSansMono;} 1.51 +</style> 1.52 +<script> 1.53 +function getTextNode(elm) { 1.54 + if (elm.nodeType != 3) 1.55 + return getTextNode(elm.firstChild); 1.56 + return elm; 1.57 +} 1.58 +function addRange(elm) { 1.59 +try { 1.60 + var sel = window.getSelection(); 1.61 + var range = document.createRange(); 1.62 + var startNode = elm.getAttribute('startNode'); 1.63 + if (startNode == null) 1.64 + startNode = getTextNode(elm); 1.65 + else 1.66 + startNode = getTextNode(elm.childNodes[startNode]) 1.67 + var start = elm.getAttribute('start'); 1.68 + if (start == null) start = 2; 1.69 + var endNode = elm.getAttribute('endNode'); 1.70 + if (endNode == null) 1.71 + endNode = startNode; 1.72 + else 1.73 + endNode = getTextNode(elm.childNodes[endNode]) 1.74 + var end = elm.getAttribute('end'); 1.75 + if (end == null) end = endNode.textContent.length; 1.76 + if (startNode==endNode && start > end) return; 1.77 + if (startNode==null) return; 1.78 + range.setStart(startNode, start); 1.79 + range.setEnd(endNode, end); 1.80 + sel.addRange(range); 1.81 +} catch (e) { 1.82 +alert(e+'\n'+elm.id+'\n'+t) 1.83 +} 1.84 +} 1.85 +function selectText() { 1.86 + var divs = document.getElementsByTagName('div'); 1.87 + for (i = 0; i < divs.length; ++i) { 1.88 + addRange(divs[i]); 1.89 + } 1.90 + var t1 = document.getElementById('t1'); 1.91 + addRange(t1.firstChild); 1.92 + var t2 = document.getElementById('t2'); 1.93 + addRange(t2.firstChild); 1.94 + document.body.offsetHeight; 1.95 + setTimeout(function(){document.documentElement.removeAttribute('class')},2000); 1.96 +} 1.97 +</script> 1.98 +</head><body onload="selectText();"> 1.99 + 1.100 +<!-- LTR overflow:hidden --> 1.101 +<div contenteditable="true" spellcheck="true" class="test ltr hidden" end=6>Mispe|…</div> 1.102 +<span style="display:block;width:15em"><div contenteditable="true" spellcheck="true" class="test ltr hidden" style="width:auto; float:right; font-family:TestEllipsisFallback; text-align:right; width:9em;" start=0 end=0>...<x><i>z</i>d word</x></div></span><br clear="all"> 1.103 + 1.104 +<div id="t1" contenteditable="true" spellcheck="true" class="test ltr hidden"><span class="rlo" endNode="1" start="0" end="6"><i>z</i>d word</span>… </div> 1.105 +<div id="t2" contenteditable="true" spellcheck="true" class="test ltr hidden" ><span class="rlo" endNode="2" start="1" end="1">…<i>z</i>d word</span></div> 1.106 +<div contenteditable="true" spellcheck="true" class="test ltr hidden"><span class="rlo">…<i>z</i>d word</div> 1.107 +<div contenteditable="true" spellcheck="true" class="test ltr hidden" endNode="1" start="2" end="3" style="text-indent:-0.2em"><span> …s</span><span>pe|</span>…<span></span></div> 1.108 + 1.109 +<!-- RTL overflow:hidden --> 1.110 +<div contenteditable="true" spellcheck="true" class="test rtl hidden" endNode="2" start="8" end="6">Misp …<i>z</i>d word</div> 1.111 +<div contenteditable="true" spellcheck="true" class="test rtl hidden" end="2"><span class="lro"> …<i>z</i>d word</span></div> 1.112 +<div contenteditable="true" spellcheck="true" class="test rtl hidden" endNode="1" end=0 start=1><span class="lro">…<i>z</i>d</span><span class="rlo"> word</span></div> 1.113 +<div contenteditable="true" spellcheck="true" class="test rtl hidden"><span class="rlo">Mis</span><span class="rlo">pel… word</div> 1.114 +<div contenteditable="true" spellcheck="true" class="test rtl hidden"><span class="rlo">Mis</span><span class="rlo">pel… word</div> 1.115 +<div contenteditable="true" spellcheck="true" class="test rtl hidden"><span class="rlo" style="margin-right:-0.2em"> …s</span><span class="rlo">pel… </span><span class="rlo"> word</span></div> 1.116 + 1.117 +</body></html>