WebKit及其遗留的前缀 [英] WebKit and its legacy prefixes

查看:77
本文介绍了WebKit及其遗留的前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译以 -apple - -khtml - 属性 c> ,因为它们最终被删除或引入了。

对它们有什么限制?例如,你可以在 document.body.style

中找到它们。

我想只有知道的人喜欢此错误的记者可以为我们提供准确的列表。
但是我喜欢这里首先询问,这样每个人都可以从中受益。



开始调查的好地方是此修订

解决方案

/ h2>

问题并不像你想象的那么简单。很容易比较支持的CSS属性的官方列表的修订版本,并确定它们被引入或退出的修订版本;然而,对传统前缀的使用的支持也由它们如何由CSS解析器实现来处理来确定。因此,您应该咨询时间线和下面的旧的前缀属性的完整列表,以确定如何在给定的WebKit修订版本中处理支持。



解析器更改的时间线旧资源支持





引入/退出的旧属性和修订列表



下面的列表是从提交历史记录以查看支持的属性列表。第一个数字是将此属性的支持添加到列表中的修订版本;第二个是它被删除的修订版本。



r13874 -webkit 前缀下存在一段时间,因此传统前缀可能继续工作,具体取决于解析器如何处理它们。




  • -apple-dashboard-region: r7588至r9101

  • -apple-line-clamp: r6391至r9101

  • r6805到r9101

  • -khtml-appearance :r9828至r13874

  • 绑定:r5967至r13874

  • -khtml-border-horizo​​ntal-spacing: r5212至r13874

  • -khtml-border-vertical-spacing: r5212至r13874

  • -khtml-box-align: r4704至r13874

  • -khtml-box-direction: r4704至r13874

  • r4704至r13874

  • -khtml-box-flex-group: r4704至r13874

  • box-flex-group-transition: r6758至r6802

  • -khtml-box-lines: r4704至r13874

  • -khtml-box-ordinal-group: r4704至r13874

  • -khtml-box-orient: r4704 r13874

  • -khtml-box-pack: r4704至r13874

  • r9101至r13874

  • -khtml-flow-mode: r4704至r8041

  • khtml-font-size-delta: r8382至r13874

  • -khtml-horizo​​ntal-border-spacing: r5200至r5212

  • -khtml-line-break: r7763至r13874

  • -khtml-line-clamp: r13874

  • -khtml-margin-bottom-collapse: r7362至r13874

  • 崩溃: r7362至r13874

  • -khtml-margin-start: r7708至r13874

  • -khtml-margin-top-collapse: r7362至r13874

  • -khtml-marquee: r5301至r13874

  • -khtml-marquee-direction: r5301至r13874

  • / li>
  • -khtml-marquee-repeat: r5301至r13874

  • strong> r5301至r13874

  • -khtml-marquee-style: r5301至r13874

  • match-nearest-mail-blockquote-color: r8642到r13874

  • -khtml-nbsp-mode: r7763到r13874

  • -khtml-opacity: r4704至r5340 *

  • -khtml-padding-start: r7708至r13874

  • -khtml-rtl-ordering: r12027至r13874

  • khtml-text-decorations-in-effect: r8466至r13874

  • -khtml-text-size-adjust: r9101至r13874

  • -khtml-user-drag: r6728至r13874

  • r5970至r13874

  • -khtml-user-select: r6728至r13874

  • border-spacing: r5200至r5212



* 虽然已弃用, -khtml-opacity - 以后 -webkit-opacity - 被解析器尊重,直到CSSProperties.in引入支持< a href =http://trac.webkit.org/changeset/85212 =nofollow> r85212 ,仍然可用为 -webkit-opacity 到最新版本。



在早期版本中支持两个 -konq p>


  • -konq-flow-mode: r4至r4704

  • -konq-js-clip: r798到r3695



今天的故事



由于r13874,WebKit CSS解析器简单地将任何遗留前缀归一化为 -webkit 。基本上,所有 -webkit 前缀属性与 -apple -khtml 前缀:

  //如果前缀是-apple-或-khtml- ,将其更改为-webkit-。 
//这使得字符串长一个字符。
if(hasPrefix(buffer,length,-apple-)|| hasPrefix(buffer,length,-khtml-)){
memmove(buffer + 7,buffer + 6,length + 1 - 6);
memcpy(buffer,-webkit,7);
++ length;
}

(这也解释了为什么你不能遍历这些属性 document.body.style -those属性已被解析器替换为相应的 -webkit 属性。)



Peter Beverloo建议对这些属性的支持应删除或已淘汰 所有旧属性的短暂时间已禁用,除了 -apple-dashboard-region -apple-line-clamp ,但这是几天后还原,因为的各种兼容性问题。在较新的版本中,旧版 -apple -khtml 前缀是禁用,除非使用 ENABLE(LEGACY_CSS_VENDOR_PREFIXES) 构建。当启用此功能标志时,解析器允许上述的旧行为。


I am trying to compile the properties prefixed by -apple- and -khtml- which are/were supported by WebKit and since which version they were eventually dropped or introduced.
What are the limitations imposed on them? For example can you find them in document.body.style?

I guess only someone in the know like the reporter of this bug could provide us an accurate list. But I prefer asking here first this way everyone will benefit from it…

A good place to start your investigation is this revision.

解决方案

Introduction

The problem is not quite as simple as you might think. It is easy enough to compare revisions of the "official" list of supported CSS properties and determine the revisions at which they were introduced or retired; however, support for the use of legacy prefixes is also determined by how they are handled by the CSS parser implementation. Thus, you should consult both the timeline and the full list of legacy prefixed properties below to determine how support is handled in a given WebKit revision.

Timeline of parser changes relating to legacy property support

  • 5 May 2003 (r9101): -apple (and briefly -moz!) will be normalized to -khtml behind the scenes.
  • 30 Aug 2005 (r10397): -webkit added as an alternative to -khtml.
  • 14 Jun 2006 (r13874): all -webkit properties will work with legacy prefixes (i.e. -apple and -khtml are normalized to -webkit). All remaining legacy prefixes were updated to -webkit in this revision.
  • 19 Feb 2008 (r30393): legacy prefix handling moved from CSSGrammar.y to CSSParser.cpp.
  • 21 Jul 2010 (r63854): no legacy prefixes are supported except for -apple-dashboard-region and -apple-line-clamp.
  • 26 Jul 2010 (r64071): all -webkit properties work with legacy prefixes again. (Previous change reverted.)
  • 10 Apr 2012 (r113795): no legacy prefixes are supported unless specifically enabled.

List of legacy properties and revisions introduced/retired

The list below has been gathered from the commit history for the list of supported properties. The first number is the revision in which support for this property was added to the list; the second is the revision in which it was removed. No distinction is made between a property being renamed as opposed to being dropped outright.

The properties removed in r13874 lived on for some time under the -webkit prefix, so the legacy prefixes might continue to work depending upon how they are handled by the parser. (See the timeline above for more details.)

  • -apple-dashboard-region: r7588 to r9101
  • -apple-line-clamp: r6391 to r9101
  • -apple-text-size-adjust: r6805 to r9101
  • -khtml-appearance: r9828 to r13874
  • -khtml-binding: r5967 to r13874
  • -khtml-border-horizontal-spacing: r5212 to r13874
  • -khtml-border-vertical-spacing: r5212 to r13874
  • -khtml-box-align: r4704 to r13874
  • -khtml-box-direction: r4704 to r13874
  • -khtml-box-flex: r4704 to r13874
  • -khtml-box-flex-group: r4704 to r13874
  • -khtml-box-flex-group-transition: r6758 to r6802
  • -khtml-box-lines: r4704 to r13874
  • -khtml-box-ordinal-group: r4704 to r13874
  • -khtml-box-orient: r4704 to r13874
  • -khtml-box-pack: r4704 to r13874
  • -khtml-dashboard-region: r9101 to r13874
  • -khtml-flow-mode: r4704 to r8041
  • -khtml-font-size-delta: r8382 to r13874
  • -khtml-horizontal-border-spacing: r5200 to r5212
  • -khtml-line-break: r7763 to r13874
  • -khtml-line-clamp: r9101 to r13874
  • -khtml-margin-bottom-collapse: r7362 to r13874
  • -khtml-margin-collapse: r7362 to r13874
  • -khtml-margin-start: r7708 to r13874
  • -khtml-margin-top-collapse: r7362 to r13874
  • -khtml-marquee: r5301 to r13874
  • -khtml-marquee-direction: r5301 to r13874
  • -khtml-marquee-increment: r5301 to r13874
  • -khtml-marquee-repetition: r5301 to r13874
  • -khtml-marquee-speed: r5301 to r13874
  • -khtml-marquee-style: r5301 to r13874
  • -khtml-match-nearest-mail-blockquote-color: r8642 to r13874
  • -khtml-nbsp-mode: r7763 to r13874
  • -khtml-opacity: r4704 to r5340 *
  • -khtml-padding-start: r7708 to r13874
  • -khtml-rtl-ordering: r12027 to r13874
  • -khtml-text-decorations-in-effect: r8466 to r13874
  • -khtml-text-size-adjust: r9101 to r13874
  • -khtml-user-drag: r6728 to r13874
  • -khtml-user-modify: r5970 to r13874
  • -khtml-user-select: r6728 to r13874
  • -khtml-vertical-border-spacing: r5200 to r5212

* Although deprecated, -khtml-opacity—and later -webkit-opacity—was honoured by the parser right up until CSSProperties.in introduced support for aliases in r85212, and remains available as -webkit-opacity to the latest revision.

A couple of -konq prefixed properties were supported in very early revisions:

  • -konq-flow-mode: r4 to r4704
  • -konq-js-clip: r798 to r3695

The story today

Since r13874, the WebKit CSS parser simply normalized any legacy prefixes to -webkit. Essentially, all -webkit prefixed properties worked with the -apple or -khtml prefixes:

// If the prefix is -apple- or -khtml-, change it to -webkit-.
// This makes the string one character longer.
if (hasPrefix(buffer, length, "-apple-") || hasPrefix(buffer, length, "-khtml-")) {
    memmove(buffer + 7, buffer + 6, length + 1 - 6);
    memcpy(buffer, "-webkit", 7);
    ++length;
}

(This also explains why you cannot iterate through these properties in document.body.style—those properties have been replaced by the parser with the corresponding -webkit property.)

Peter Beverloo suggested that support for these properties should be removed or phased out For a brief time all legacy properties were disabled, with the exception of -apple-dashboard-region and -apple-line-clamp, but this was reverted mere days later because of myriad compatibility issues. In newer revisions, the legacy -apple and -khtml prefixes are disabled unless built with ENABLE(LEGACY_CSS_VENDOR_PREFIXES). When this feature flag is enabled, the parser permits the older behaviour outlined above.

这篇关于WebKit及其遗留的前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆