为什么OS X上的Chrome 37不能正确显示此HTML?

问题描述:

在OS X的Chrome 37中,此HTML页面的内容在滚动时没有正确刷新 - 它只是空白。如果您尝试选择文字,您也可能触发该问题 - 它将被清空。为什么OS X上的Chrome 37不能正确显示此HTML?

但是:

  • 如果从CSS中删除-webkit-font-feature-settings线, 它将正常工作。

  • 如果您从第一行删除­(软连字符),它将正常工作。

此显示错误不会影响Windows上的Chrome 37,OS X以及OS X之前的版本(AFAIK)。

因此我的问题:

  1. 这到底是怎么回事?

  2. 是否有解决方法,不涉及删除软连字符或OpenType功能?

谢谢。


这里是the fiddle

下面是HTML,具有相同的段落重复5次(和在每个段落以供参考的端部的标号):

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="UTF-8"> 
<title>here</title> 

<style type="text/css"> 

body { 
-webkit-font-feature-settings: 'kern' 1; 
} 

</style> 

</head> 
<body>hyphen&shy;ated 

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth. 

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth2. 

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth3. 

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth4. 

But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth5. 

</body> 
</html> 

PS。这里的a codepen以稍微不同的方式显示相同的问题。

+1

铬问题open reference这篇文章https://code.google.com/p/chromium/issues/detail?id=391515 – jedierikb 2014-09-02 13:23:02

+0

我知道,我把链接放在那里。请注意,Chromium开发人员并未将其视为错误,因为他们无法在OS X上使用Chrome 38进行复制(= true AFAICT:错误不在v38中,仅为v37) – 2014-09-03 02:03:26

我偶然发现了一个解决方案,因为它在chrome 38 mac中仍然有错误。

article h1, article h2, article p, article li, article blockquote { 
    white-space: pre-line; 
} 

其中p是容器&害羞;

这里发生了什么?

这是在Chrome 37

一个错误是有不涉及删除无论是软连字符或OpenType功能一个解决方法吗?

避免滚动内容。

这是一个错误。该错误还会影响OS X上的Opera 24(因为它基于有问题的Chrome 37代码)。

解决方法是删除文本中的软连字符或删除webkit的字体特征(即所有出现的CSS属性-webkit-font-feature-settings)。请注意,此属性必须是已删除 - 您无法链接第二个仅反转设置的CSS文件,例如* {-webkit-font-feature-settings: inherit}。无论出于何种原因,只要有故障的浏览器读取此属性,就会出现错误。

当然,这个解决方法的问题在于它是过度包含的:它会在所有版本的Chrome和Opera中禁用-webkit-font-feature-settings,而不仅仅是错误的。为了避免这个后果,我把styles.css分成了第二个版本,剥去了-webkit-font-feature-settings。然后我使用JavaScript来检测有问题的浏览器并加载剥离的CSS。我知道,一种令人皱眉的技术,但最简单的解决方法是最有效的方法(不要惩罚使用其他浏览器的人)。