Skip to content

Instantly share code, notes, and snippets.

// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generated from template:
// core/css/templates/CSSOMTypes.cpp.tmpl
// and input files:
// ../../third_party/WebKit/Source/core/css/ComputedStyleFieldAliases.json5
// ../../third_party/WebKit/Source/core/css/CSSProperties.json5
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generated from template:
// core/css/templates/CSSOMTypes.cpp.tmpl
// and input files:
// ../../third_party/WebKit/Source/core/css/ComputedStyleFieldAliases.json5
// ../../third_party/WebKit/Source/core/css/CSSProperties.json5
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generated from template:
// templates/ComputedStyleBase.cpp.tmpl
// and input files:
// ../../third_party/WebKit/Source/core/css/CSSProperties.json5
@darrnshn
darrnshn / mozGetMatchedCSSRules.js
Last active June 22, 2022 16:43 — forked from ydaniv/mozGetMatchedCSSRules.js
A Blink only polyfill for Webkit's window.getMatchedCSSRules
// polyfill window.getMatchedCSSRules() in Chrome
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "core/style/ComputedStyle.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "core/style/ComputedStyle.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "core/style/ComputedStyle.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "core/style/ComputedStyle.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/ComputedStyleBase.h"
#include "core/style/ComputedStyle.h"
#include "platform/wtf/SizeAssertions.h"
namespace blink {
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/css/cssom/CSSOMKeywords.h"
#include "core/css/CSSPropertyIDTemplates.h"
#include "core/css/cssom/CSSKeywordValue.h"
#include "platform/wtf/HashMap.h"