source: webkit/trunk/Source/WebCore/css/DeprecatedCSSOMCounter.h

Last change on this file was 219744, checked in by [email protected], 8 years ago

[WebIDL] Remove the need for the side map of DeprecatedCSSOMValue roots
https://bugs.webkit.org/show_bug.cgi?id=174713

Patch by Sam Weinig <[email protected]> on 2017-07-21
Reviewed by Andreas Kling.

We used to not want to bloat the size of CSSValues with a pointer to the
owner CSSStyleDeclaration, so, for GC purposes we need kept a mapping of
them on DOMWrapperWorld that only got set if a wrapper was made. Now that
we have DeprecatedCSSOMValue, a wrapper for CSSValue that only gets created
for the bindings, we no longer need the side table, and simply have the
DeprecatedCSSOMValue maintain a reference to the CSSStyleDeclaration.

  • bindings/js/DOMWrapperWorld.h:

(WebCore::DOMWrapperWorld::wrappers):
Remove m_deprecatedCSSOMValueRoots and make m_wrappers private with a getter.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): Deleted.
Remove custom implementation of getPropertyCSSValue, now that it no longer
needs to update m_deprecatedCSSOMValueRoots.

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):

  • bindings/js/JSDOMWrapperCache.h:

(WebCore::getCachedWrapper):
(WebCore::cacheWrapper):
(WebCore::uncacheWrapper):

  • bindings/js/JSNodeCustom.cpp:

(WebCore::getOutOfLineCachedWrapper):
Use wrappers getter rather than direct member variable.

  • bindings/js/JSDeprecatedCSSOMValueCustom.cpp:

(WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
Rather than checking the side table for roots, now get the root
via the reference CSSStyleDeclaration.

(WebCore::JSDeprecatedCSSOMValueOwner::finalize): Deleted.
Remove custom finalize now that we don't have to remove ourself
from m_deprecatedCSSOMValueRoots.

  • css/CSSStyleDeclaration.idl:

Remove [Custom] from getPropertyCSSValue.

  • css/DeprecatedCSSOMValue.idl:

Remove [JSCustomFinalize].

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/CSSImageValue.cpp:

(WebCore::CSSImageValue::createDeprecatedCSSOMWrapper):

  • css/CSSImageValue.h:
  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::createDeprecatedCSSOMPrimitiveWrapper):

  • css/CSSPrimitiveValue.h:
  • css/CSSStyleDeclaration.h:
  • css/CSSValue.cpp:

(WebCore::CSSValue::createDeprecatedCSSOMWrapper):

  • css/CSSValue.h:
  • css/DeprecatedCSSOMCounter.h:
  • css/DeprecatedCSSOMPrimitiveValue.cpp:

(WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue):
(WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue):
(WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue):

  • css/DeprecatedCSSOMPrimitiveValue.h:

(WebCore::DeprecatedCSSOMPrimitiveValue::create):
(WebCore::DeprecatedCSSOMPrimitiveValue::DeprecatedCSSOMPrimitiveValue):

  • css/DeprecatedCSSOMRGBColor.h:
  • css/DeprecatedCSSOMRect.h:
  • css/DeprecatedCSSOMValue.h:

(WebCore::DeprecatedCSSOMValue::owner):
(WebCore::DeprecatedCSSOMValue::DeprecatedCSSOMValue):
(WebCore::DeprecatedCSSOMComplexValue::create):
(WebCore::DeprecatedCSSOMComplexValue::DeprecatedCSSOMComplexValue):

  • css/DeprecatedCSSOMValueList.h:

(WebCore::DeprecatedCSSOMValueList::create):
(WebCore::DeprecatedCSSOMValueList::DeprecatedCSSOMValueList):

  • css/PropertySetCSSStyleDeclaration.cpp:

(WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):

  • css/PropertySetCSSStyleDeclaration.h:
  • svg/SVGElement.cpp:

(WebCore::SVGElement::getPresentationAttribute):
Pass owning CSSStyleDeclaration to DeprecatedCSSOMValue and derived classes.

File size: 2.4 KB
Line 
1/*
2 * Copyright (C) 2016 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "Counter.h"
29#include "DeprecatedCSSOMPrimitiveValue.h"
30#include <wtf/Ref.h>
31
32namespace WebCore {
33
34class DeprecatedCSSOMCounter final : public RefCounted<DeprecatedCSSOMCounter> {
35public:
36 static Ref<DeprecatedCSSOMCounter> create(const Counter& counter, CSSStyleDeclaration& owner)
37 {
38 return adoptRef(*new DeprecatedCSSOMCounter(counter, owner));
39 }
40
41 String identifier() const { return m_identifier->stringValue(); }
42 String listStyle() const { return m_listStyle->stringValue(); }
43 String separator() const { return m_separator->stringValue(); }
44
45private:
46 DeprecatedCSSOMCounter(const Counter& counter, CSSStyleDeclaration& owner)
47 : m_identifier(counter.identifierValue().createDeprecatedCSSOMPrimitiveWrapper(owner))
48 , m_listStyle(counter.listStyleValue().createDeprecatedCSSOMPrimitiveWrapper(owner))
49 , m_separator(counter.separatorValue().createDeprecatedCSSOMPrimitiveWrapper(owner))
50 {
51 }
52
53 Ref<DeprecatedCSSOMPrimitiveValue> m_identifier;
54 Ref<DeprecatedCSSOMPrimitiveValue> m_listStyle;
55 Ref<DeprecatedCSSOMPrimitiveValue> m_separator;
56};
57
58} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.