mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 800188 - Add preliminary support RTL content in reader mode (r=lucasr)
This commit is contained in:
parent
d93f38166d
commit
53e782ed8e
@ -26,6 +26,7 @@ var Readability = function(uri, doc) {
|
||||
this._doc = doc;
|
||||
this._biggestFrame = false;
|
||||
this._articleByline = null;
|
||||
this._articleDir = null;
|
||||
|
||||
// Start with all flags set
|
||||
this._flags = this.FLAG_STRIP_UNLIKELYS |
|
||||
@ -406,6 +407,9 @@ Readability.prototype = {
|
||||
page = page ? page : this._doc.body;
|
||||
let pageCacheHtml = page.innerHTML;
|
||||
|
||||
// Check if any "dir" is set on the toplevel document element
|
||||
this._articleDir = doc.documentElement.getAttribute("dir");
|
||||
|
||||
while (true) {
|
||||
let stripUnlikelyCandidates = this._flagIsActive(this.FLAG_STRIP_UNLIKELYS);
|
||||
let allElements = page.getElementsByTagName('*');
|
||||
@ -1432,6 +1436,7 @@ Readability.prototype = {
|
||||
|
||||
return { title: articleTitle,
|
||||
byline: this._articleByline,
|
||||
dir: this._articleDir,
|
||||
content: articleContent.innerHTML };
|
||||
}
|
||||
};
|
||||
|
@ -427,6 +427,15 @@ AboutReader.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_maybeSetTextDirection: function Read_maybeSetTextDirection(article){
|
||||
if(!article.dir)
|
||||
return;
|
||||
|
||||
//Set "dir" attribute on content
|
||||
this._contentElement.setAttribute("dir", article.dir);
|
||||
this._headerElement.setAttribute("dir", article.dir);
|
||||
},
|
||||
|
||||
_showError: function Reader_showError(error) {
|
||||
this._headerElement.style.display = "none";
|
||||
this._contentElement.style.display = "none";
|
||||
@ -460,6 +469,7 @@ AboutReader.prototype = {
|
||||
this._contentElement.innerHTML = "";
|
||||
this._contentElement.appendChild(contentFragment);
|
||||
this._updateImageMargins();
|
||||
this._maybeSetTextDirection(article);
|
||||
|
||||
this._contentElement.style.display = "block";
|
||||
|
||||
|
@ -31,7 +31,7 @@ body {
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: left;
|
||||
text-align: start;
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ body {
|
||||
margin: 0px !important;
|
||||
margin-bottom: 20px !important;
|
||||
padding: 0px !important;
|
||||
padding-left: 16px !important;
|
||||
-moz-padding-start: 16px !important;
|
||||
border: 0px !important;
|
||||
border-left: 2px solid !important;
|
||||
}
|
||||
@ -283,12 +283,12 @@ body {
|
||||
}
|
||||
|
||||
.content ul {
|
||||
padding-left: 30px !important;
|
||||
-moz-padding-start: 30px !important;
|
||||
list-style: disk !important;
|
||||
}
|
||||
|
||||
.content ol {
|
||||
padding-left: 35px !important;
|
||||
-moz-padding-start: 35px !important;
|
||||
list-style: decimal !important;
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ body {
|
||||
}
|
||||
|
||||
.dropdown-popup {
|
||||
text-align: left;
|
||||
text-align: start;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
z-index: 1000;
|
||||
|
@ -18,7 +18,7 @@ body {
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: left;
|
||||
text-align: start;
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ body {
|
||||
margin: 0px !important;
|
||||
margin-bottom: 20px !important;
|
||||
padding: 0px !important;
|
||||
padding-left: 16px !important;
|
||||
-moz-padding-start: 16px !important;
|
||||
border: 0px !important;
|
||||
border-left: 2px solid !important;
|
||||
}
|
||||
@ -270,12 +270,12 @@ body {
|
||||
}
|
||||
|
||||
.content ul {
|
||||
padding-left: 30px !important;
|
||||
-moz-padding-start: 30px !important;
|
||||
list-style: disk !important;
|
||||
}
|
||||
|
||||
.content ol {
|
||||
padding-left: 35px !important;
|
||||
-moz-padding-start: 35px !important;
|
||||
list-style: decimal !important;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user