source: webkit/trunk/Source/WebCore/css/CSSCursorImageValue.cpp

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

[Build-time perf] Forward-declare more things in Element.h
https://bugs.webkit.org/show_bug.cgi?id=231283

Reviewed by Myles C. Maxfield.

Source/JavaScriptCore:

Add two new forwarding headers: one for Strong, and as a dependency, one for Handle.

  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • heap/Handle.h:
  • heap/HandleForward.h: Copied from Source/JavaScriptCore/runtime/Forward.h.
  • heap/Strong.h:
  • heap/StrongForward.h: Copied from Source/JavaScriptCore/runtime/Forward.h.
  • runtime/Forward.h:

Source/WebCore:

Replace as many #includes as possible with forward type declarations. To do so, split out the inline function
definitions into their own ElementInlines.h header.

Move MediaKeyMessageEventInit into its own .idl to allow the bindings generator code to include
the two files separately, and to allow MediaKeyMessageEventInit to be forward-declared in MediaKeyMessageEvent.h.

Move Event's enums into their own EventOptions.h header that allows those enums to be forward declared.

Move ScrollExtents into its own ScrollExtents.h header, so that ScrollTypes.h can be freely #included without
pulling in geometry and math headers.

Modify some of the parameters to methods in HTMLMediaElement.h to be passed by reference or r-value reference,
allowing those types to be forward-declared.

Because the SVG and RenderSVG classes rely on ElementInlines.h, their inline methods must be inlined
as well, to ensure ElementInlines.h doesn't leak out into header includes generally.

With these changes in place, the net cost of Element.h during a typical build has gone from ~750s to ~57s.

  • CMakeLists.txt:
  • DerivedSources-input.xcfilelist:
  • DerivedSources-output.xcfilelist:
  • DerivedSources.make:
  • Headers.cmake:
  • Modules/encryptedmedia/MediaKeyMessageEvent.cpp:

(WebCore::MediaKeyMessageEvent::message const):

  • Modules/encryptedmedia/MediaKeyMessageEvent.h:
  • Modules/encryptedmedia/MediaKeyMessageEvent.idl:
  • Modules/encryptedmedia/MediaKeyMessageEventInit.idl: Added.
  • Modules/encryptedmedia/MediaKeyMessageType.idl: Added.
  • Modules/encryptedmedia/MediaKeySession.cpp:
  • Modules/entriesapi/HTMLInputElementEntriesAPI.cpp:
  • Modules/highlight/AppHighlightStorage.cpp:
  • Modules/model-element/HTMLModelElement.cpp:
  • Modules/remoteplayback/RemotePlayback.cpp:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • accessibility/AccessibilityListBoxOption.cpp:
  • accessibility/AccessibilityRenderObject.cpp:
  • accessibility/AccessibilitySVGElement.cpp:
  • accessibility/AccessibilitySVGRoot.cpp:
  • accessibility/atk/WebKitAccessible.cpp:
  • bindings/js/JSNodeCustom.h:
  • bindings/scripts/CodeGenerator.pm:

(GetterExpression):

  • bindings/scripts/test/JS/JSTestCEReactions.cpp:
  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • css/CSSCursorImageValue.cpp:
  • css/CSSFontFaceSource.cpp:
  • css/CSSStyleSheet.cpp:
  • css/SelectorChecker.cpp:
  • dom/ContainerNode.cpp:
  • dom/DataTransferMac.mm:
  • dom/DatasetDOMStringMap.cpp:
  • dom/Document.cpp:
  • dom/DocumentInlines.h: Added.

(WebCore::Document::textEncoding const):
(WebCore::Document::templateDocument const):
(WebCore::Document::existingAXObjectCache const):
(WebCore::Document::create):
(WebCore::Document::invalidateAccessKeyCache):
(WebCore::Node::scriptExecutionContext const):

  • dom/Element.cpp:
  • dom/Element.h:

(WebCore::Element::attributesIterator const): Deleted.
(WebCore::Element::findAttributeIndexByName const): Deleted.
(WebCore::Node::hasAttributes const): Deleted.
(WebCore::Node::attributes const): Deleted.
(WebCore::Node::parentElement const): Deleted.
(WebCore::Element::rootElement const): Deleted.
(WebCore::Element::hasAttributeWithoutSynchronization const): Deleted.
(WebCore::Element::attributeWithoutSynchronization const): Deleted.
(WebCore::Element::hasAttributesWithoutUpdate const): Deleted.
(WebCore::Element::idForStyleResolution const): Deleted.
(WebCore::Element::getIdAttribute const): Deleted.
(WebCore::Element::getNameAttribute const): Deleted.
(WebCore::Element::setIdAttribute): Deleted.
(WebCore::Element::classNames const): Deleted.
(WebCore::Element::attributeCount const): Deleted.
(WebCore::Element::attributeAt const): Deleted.
(WebCore::Element::findAttributeByName const): Deleted.
(WebCore::Element::hasID const): Deleted.
(WebCore::Element::hasClass const): Deleted.
(WebCore::Element::hasName const): Deleted.
(WebCore::Element::ensureUniqueElementData): Deleted.
(WebCore::shouldIgnoreAttributeCase): Deleted.
(WebCore::Element::getAttribute const): Deleted.
(WebCore::isInTopLayerOrBackdrop): Deleted.

  • dom/ElementInlines.h: Added.

(WebCore::Element::attributesIterator const):
(WebCore::Element::findAttributeIndexByName const):
(WebCore::Node::hasAttributes const):
(WebCore::Node::attributes const):
(WebCore::Node::parentElement const):
(WebCore::Element::rootElement const):
(WebCore::Element::hasAttributeWithoutSynchronization const):
(WebCore::Element::attributeWithoutSynchronization const):
(WebCore::Element::hasAttributesWithoutUpdate const):
(WebCore::Element::idForStyleResolution const):
(WebCore::Element::getIdAttribute const):
(WebCore::Element::getNameAttribute const):
(WebCore::Element::setIdAttribute):
(WebCore::Element::classNames const):
(WebCore::Element::attributeCount const):
(WebCore::Element::attributeAt const):
(WebCore::Element::findAttributeByName const):
(WebCore::Element::hasID const):
(WebCore::Element::hasClass const):
(WebCore::Element::hasName const):
(WebCore::Element::ensureUniqueElementData):
(WebCore::shouldIgnoreAttributeCase):
(WebCore::Element::getAttribute const):
(WebCore::isInTopLayerOrBackdrop):

  • dom/ElementIterator.h:
  • dom/ElementIteratorAssertions.h:
  • dom/Event.h:
  • dom/EventOptions.h: Added.
  • dom/FullscreenManager.cpp:
  • dom/InlineClassicScript.cpp:
  • dom/InlineStyleSheetOwner.cpp:
  • dom/NamedNodeMap.cpp:
  • dom/Node.h:
  • dom/Position.cpp:
  • dom/Range.cpp:
  • dom/ScriptElement.cpp:
  • dom/ShadowRoot.cpp:
  • dom/SlotAssignment.cpp:
  • dom/StyledElement.cpp:
  • dom/StyledElement.h:
  • dom/Text.cpp:
  • dom/VisitedLinkState.cpp:
  • editing/Editing.cpp:
  • editing/EditingStyle.cpp:
  • editing/EditorCommand.cpp:
  • editing/FrameSelection.h:
  • editing/MarkupAccumulator.cpp:
  • editing/ModifySelectionListLevel.cpp:
  • editing/TextIterator.cpp:
  • editing/cocoa/HTMLConverter.mm:
  • editing/cocoa/WebContentReaderCocoa.mm:
  • editing/gtk/EditorGtk.cpp:
  • html/Autofill.cpp:
  • html/BaseTextInputType.cpp:
  • html/DateInputType.cpp:
  • html/DateTimeLocalInputType.cpp:
  • html/FeaturePolicy.cpp:
  • html/FormAssociatedElement.cpp:
  • html/HTMLAnchorElement.h:

(WebCore::HTMLAnchorElement::visitedLinkHash const): Deleted.

  • html/HTMLAnchorElementInlines.h: Added.

(WebCore::HTMLAnchorElement::visitedLinkHash const):

  • html/HTMLAreaElement.cpp:
  • html/HTMLAttachmentElement.cpp:
  • html/HTMLBaseElement.cpp:
  • html/HTMLBodyElement.cpp:
  • html/HTMLButtonElement.cpp:
  • html/HTMLCanvasElement.cpp:
  • html/HTMLCanvasElement.h:
  • html/HTMLElement.h:
  • html/HTMLFormControlElement.cpp:

(WebCore::HTMLFormControlElement::resultForDialogSubmit const):

  • html/HTMLFormControlElement.h:

(WebCore::HTMLFormControlElement::resultForDialogSubmit const): Deleted.

  • html/HTMLFrameElementBase.cpp:
  • html/HTMLFrameOwnerElement.cpp:
  • html/HTMLHtmlElement.cpp:
  • html/HTMLIFrameElement.cpp:
  • html/HTMLImageElement.h:
  • html/HTMLLinkElement.cpp:
  • html/HTMLMarqueeElement.cpp:
  • html/HTMLMediaElement.h:
  • html/HTMLMetaElement.cpp:
  • html/HTMLParamElement.cpp:
  • html/HTMLPlugInImageElement.cpp:
  • html/HTMLScriptElement.cpp:
  • html/HTMLSlotElement.cpp:
  • html/HTMLSourceElement.cpp:
  • html/HTMLTableCellElement.cpp:
  • html/HTMLTableColElement.cpp:
  • html/HTMLTrackElement.cpp:
  • html/HTMLVideoElement.cpp:
  • html/ImageInputType.cpp:
  • html/InputType.cpp:
  • html/MediaElementSession.cpp:
  • html/MonthInputType.cpp:
  • html/NumberInputType.cpp:
  • html/TextFieldInputType.cpp:
  • html/TimeInputType.cpp:
  • html/ValidationMessage.cpp:
  • html/WeekInputType.cpp:
  • html/parser/HTMLConstructionSite.cpp:
  • html/parser/HTMLConstructionSite.h:
  • html/parser/HTMLTreeBuilder.cpp:
  • html/track/DataCue.cpp:
  • html/track/InbandGenericTextTrack.cpp:
  • html/track/InbandTextTrack.cpp:
  • html/track/LoadableTextTrack.cpp:
  • html/track/TextTrackCue.cpp:
  • html/track/TextTrackCue.h:
  • html/track/VTTRegion.h:
  • html/track/WebVTTElement.cpp:
  • html/track/WebVTTParser.cpp:
  • inspector/InspectorOverlay.cpp:
  • inspector/InspectorStyleSheet.cpp:
  • inspector/agents/InspectorPageAgent.cpp:
  • loader/FormSubmission.cpp:
  • loader/FrameLoader.cpp:
  • loader/ImageLoader.cpp:
  • loader/cache/CachedImage.cpp:
  • loader/cache/CachedResourceLoader.cpp:
  • loader/cache/CachedResourceLoader.h:
  • loader/cache/CachedResourceRequest.h:
  • mathml/MathMLAnnotationElement.cpp:
  • mathml/MathMLElement.cpp:
  • mathml/MathMLFractionElement.cpp:
  • mathml/MathMLMencloseElement.cpp:
  • mathml/MathMLOperatorElement.cpp:
  • mathml/MathMLPresentationElement.cpp:
  • mathml/MathMLSelectElement.cpp:
  • page/CaptionUserPreferences.h:
  • page/DragController.cpp:
  • page/EventHandler.cpp:
  • page/Frame.cpp:
  • page/FrameView.cpp:
  • page/IntersectionObserver.h:
  • page/KeyboardScroll.h:
  • page/PageSerializer.cpp:
  • page/Quirks.cpp:
  • page/mac/ImageOverlayControllerMac.mm:
  • page/mac/PageMac.mm:
  • page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
  • page/scrolling/nicosia/ScrollingTreeScrollingNodeDelegateNicosia.cpp:
  • platform/ScrollAnimation.h:
  • platform/ScrollAnimationKinetic.cpp:
  • platform/ScrollAnimationSmooth.cpp:
  • platform/ScrollAnimator.cpp:
  • platform/ScrollAnimator.h:
  • platform/ScrollExtents.h: Added.

(WebCore::ScrollExtents::minimumScrollOffset const):
(WebCore::ScrollExtents::maximumScrollOffset const):

  • platform/ScrollSnapAnimatorState.cpp:
  • platform/ScrollSnapAnimatorState.h:
  • platform/ScrollTypes.h:

(WebCore::logicalToPhysical):
(WebCore::ScrollExtents::minimumScrollOffset const): Deleted.
(WebCore::ScrollExtents::maximumScrollOffset const): Deleted.

  • platform/ScrollingEffectsController.cpp:
  • platform/ScrollingEffectsController.h:
  • platform/ScrollingMomentumCalculator.h:
  • platform/SharedBuffer.cpp:
  • platform/SharedBuffer.h:
  • platform/audio/cocoa/MediaSessionManagerCocoa.mm:
  • platform/encryptedmedia/CDMLogging.cpp:
  • platform/mac/ScrollingEffectsController.mm:
  • platform/win/PasteboardWin.cpp:
  • rendering/CSSFilter.cpp:
  • rendering/HitTestResult.cpp:
  • rendering/LegacyLineLayout.cpp:
  • rendering/ReferencedSVGResources.cpp:
  • rendering/RenderBlockFlow.cpp:
  • rendering/RenderBox.cpp:
  • rendering/RenderDetailsMarker.cpp:
  • rendering/RenderElement.cpp:
  • rendering/RenderImage.cpp:
  • rendering/RenderLayer.cpp:
  • rendering/RenderLineBreak.cpp:
  • rendering/RenderListItem.cpp:
  • rendering/RenderMenuList.cpp:
  • rendering/RenderObject.h:
  • rendering/RenderSearchField.cpp:
  • rendering/RenderTableCell.cpp:
  • rendering/RenderText.cpp:
  • rendering/RenderThemeMac.mm:
  • rendering/RenderTreeAsText.cpp:
  • rendering/mathml/RenderMathMLFenced.cpp:
  • rendering/svg/RenderSVGBlock.cpp:
  • rendering/svg/RenderSVGBlock.h:

(WebCore::RenderSVGBlock::graphicsElement const): Deleted.

  • rendering/svg/RenderSVGBlockInlines.h: Added.

(WebCore::RenderSVGBlock::graphicsElement const):

  • rendering/svg/RenderSVGEllipse.cpp:
  • rendering/svg/RenderSVGForeignObject.cpp:
  • rendering/svg/RenderSVGGradientStop.cpp:
  • rendering/svg/RenderSVGGradientStop.h:
  • rendering/svg/RenderSVGGradientStopInlines.h: Added.

(WebCore::RenderSVGGradientStop::element const):

  • rendering/svg/RenderSVGImage.cpp:
  • rendering/svg/RenderSVGInline.h:

(WebCore::RenderSVGInline::graphicsElement const): Deleted.

  • rendering/svg/RenderSVGInlineInlines.h: Added.

(WebCore::RenderSVGInline::graphicsElement const):

  • rendering/svg/RenderSVGInlineText.cpp:
  • rendering/svg/RenderSVGRect.cpp:
  • rendering/svg/RenderSVGResourceClipper.cpp:
  • rendering/svg/RenderSVGResourceClipper.h:
  • rendering/svg/RenderSVGResourceClipperInlines.h: Added.

(WebCore::RenderSVGResourceClipper::clipPathElement const):
(WebCore::RenderSVGResourceClipper::clipPathUnits const):

  • rendering/svg/RenderSVGResourceContainer.cpp:
  • rendering/svg/RenderSVGResourceFilter.cpp:
  • rendering/svg/RenderSVGResourceFilter.h:
  • rendering/svg/RenderSVGResourceFilterInlines.h: Added.

(WebCore::RenderSVGResourceFilter::filterElement const):
(WebCore::RenderSVGResourceFilter::filterUnits const):
(WebCore::RenderSVGResourceFilter::primitiveUnits const):

  • rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
  • rendering/svg/RenderSVGResourceLinearGradient.cpp:
  • rendering/svg/RenderSVGResourceLinearGradient.h:
  • rendering/svg/RenderSVGResourceLinearGradientInlines.h: Added.

(WebCore::RenderSVGResourceLinearGradient::linearGradientElement const):

  • rendering/svg/RenderSVGResourceMarker.cpp:
  • rendering/svg/RenderSVGResourceMarker.h:
  • rendering/svg/RenderSVGResourceMarkerInlines.h: Added.

(WebCore::RenderSVGResourceMarker::markerElement const):
(WebCore::RenderSVGResourceMarker::markerUnits const):

  • rendering/svg/RenderSVGResourceMasker.cpp:
  • rendering/svg/RenderSVGResourceMasker.h:
  • rendering/svg/RenderSVGResourceMaskerInlines.h: Added.

(WebCore::RenderSVGResourceMasker::maskElement const):
(WebCore::RenderSVGResourceMasker::maskUnits const):
(WebCore::RenderSVGResourceMasker::maskContentUnits const):

  • rendering/svg/RenderSVGResourcePattern.cpp:
  • rendering/svg/RenderSVGResourceRadialGradient.cpp:
  • rendering/svg/RenderSVGResourceRadialGradient.h:
  • rendering/svg/RenderSVGResourceRadialGradientInlines.h: Added.

(WebCore::RenderSVGResourceRadialGradient::radialGradientElement const):

  • rendering/svg/RenderSVGRoot.cpp:
  • rendering/svg/RenderSVGShape.cpp:
  • rendering/svg/RenderSVGShape.h:

(WebCore::RenderSVGShape::graphicsElement const): Deleted.

  • rendering/svg/RenderSVGShapeInlines.h: Added.

(WebCore::RenderSVGShape::graphicsElement const):

  • rendering/svg/RenderSVGTSpan.h:
  • rendering/svg/RenderSVGText.cpp:
  • rendering/svg/RenderSVGTextPath.cpp:
  • rendering/svg/RenderSVGTextPath.h:
  • rendering/svg/RenderSVGTransformableContainer.cpp:

(WebCore::RenderSVGTransformableContainer::graphicsElement):

  • rendering/svg/RenderSVGTransformableContainer.h:
  • rendering/svg/RenderSVGViewportContainer.cpp:
  • rendering/svg/SVGInlineFlowBox.cpp:
  • rendering/svg/SVGInlineTextBox.cpp:
  • rendering/svg/SVGInlineTextBox.h:
  • rendering/svg/SVGInlineTextBoxInlines.h: Added.

(WebCore::SVGInlineTextBox::renderer const):
(WebCore::SVGInlineTextBox::nextTextBox const):

  • rendering/svg/SVGPathData.cpp:
  • rendering/svg/SVGRenderSupport.cpp:
  • rendering/svg/SVGRenderTreeAsText.cpp:
  • rendering/svg/SVGRenderingContext.cpp:
  • rendering/svg/SVGResources.cpp:
  • rendering/svg/SVGRootInlineBox.cpp:
  • rendering/svg/SVGTextLayoutEngine.cpp:
  • rendering/svg/SVGTextQuery.cpp:
  • style/StyleAdjuster.cpp:
  • style/StyleBuilderState.cpp:
  • style/StyleChange.h:
  • style/StyleResolver.h:
  • style/StyleScope.cpp:
  • style/StyleSharingResolver.cpp:
  • svg/DocumentSVG.cpp:
  • svg/SVGAElement.cpp:
  • svg/SVGAltGlyphDefElement.cpp:
  • svg/SVGAltGlyphElement.cpp:
  • svg/SVGAnimateMotionElement.cpp:
  • svg/SVGAnimationElement.cpp:
  • svg/SVGCircleElement.cpp:
  • svg/SVGElement.cpp:
  • svg/SVGElement.h:

(WebCore::SVGElement::invalidateSVGAttributes): Deleted.
(WebCore::SVGElement::invalidateSVGPresentationalHintStyle): Deleted.
(WebCore::SVGAttributeHashTranslator::hash): Deleted.
(WebCore::SVGAttributeHashTranslator::equal): Deleted.
(WebCore::Node::hasTagName const): Deleted.

  • svg/SVGElementInlines.h: Added.

(WebCore::SVGElement::invalidateSVGAttributes):
(WebCore::SVGElement::invalidateSVGPresentationalHintStyle):
(WebCore::SVGAttributeHashTranslator::hash):
(WebCore::SVGAttributeHashTranslator::equal):
(WebCore::Element::hasTagName const):
(WebCore::Node::hasTagName const):

  • svg/SVGEllipseElement.cpp:
  • svg/SVGFEComponentTransferElement.cpp:
  • svg/SVGFELightElement.cpp:
  • svg/SVGFilterElement.cpp:
  • svg/SVGFontFaceElement.cpp:
  • svg/SVGFontFaceFormatElement.cpp:
  • svg/SVGFontFaceNameElement.cpp:
  • svg/SVGFontFaceSrcElement.cpp:
  • svg/SVGFontFaceUriElement.cpp:
  • svg/SVGForeignObjectElement.cpp:
  • svg/SVGGlyphRefElement.cpp:
  • svg/SVGHKernElement.cpp:
  • svg/SVGImageElement.cpp:
  • svg/SVGImageLoader.cpp:
  • svg/SVGLengthContext.cpp:
  • svg/SVGLinearGradientElement.cpp:
  • svg/SVGLocatable.cpp:
  • svg/SVGMPathElement.cpp:
  • svg/SVGMaskElement.cpp:
  • svg/SVGPathElement.cpp:
  • svg/SVGPatternElement.cpp:
  • svg/SVGRadialGradientElement.cpp:
  • svg/SVGRectElement.cpp:
  • svg/SVGSVGElement.cpp:
  • svg/SVGStyleElement.cpp:
  • svg/SVGStyleElement.h:
  • svg/SVGTextContentElement.cpp:
  • svg/SVGTextPositioningElement.cpp:
  • svg/SVGUseElement.cpp:
  • svg/SVGVKernElement.cpp:
  • svg/animation/SVGSMILElement.cpp:
  • svg/graphics/SVGImage.cpp:
  • svg/properties/SVGAttributeAnimator.cpp:
  • xml/XPathFunctions.cpp:
  • xml/XPathNodeSet.cpp:
  • xml/XPathStep.cpp:
  • xml/parser/XMLDocumentParser.cpp:

Source/WebKit:

Include ElementInlines.h in various necessary places.

  • Shared/TouchBarMenuData.cpp:
  • Shared/TouchBarMenuItemData.cpp:
  • Shared/glib/InputMethodState.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBaseElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBodyElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLButtonElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLDivElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLEmbedElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFontElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFormElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLFrameSetElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHRElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHeadingElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLHtmlElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLIFrameElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLImageElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLIElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLabelElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLegendElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLLinkElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLMetaElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLModElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOListElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLObjectElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLOptGroupElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParagraphElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLParamElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLScriptElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLStyleElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCaptionElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableCellElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableColElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableRowElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLTableSectionElement.cpp:
  • WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLUListElement.cpp:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:
  • WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
  • WebProcess/cocoa/PlaybackSessionManager.mm:

Source/WebKitLegacy/mac:

Include ElementInlines.h in various necessary places.

  • WebView/WebHTMLRepresentation.mm:

Tools:

Include ArrayBuffer.h in various necessary places.

  • TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
  • Property svn:eol-style set to native
File size: 5.1 KB
Line 
1/*
2 * Copyright (C) 2006 Rob Buis <[email protected]>
3 * (C) 2008 Nikolas Zimmermann <[email protected]>
4 * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#include "config.h"
23#include "CSSCursorImageValue.h"
24
25#include "CSSImageSetValue.h"
26#include "CSSImageValue.h"
27#include "SVGCursorElement.h"
28#include "SVGElementTypeHelpers.h"
29#include "SVGLengthContext.h"
30#include "SVGURIReference.h"
31#include "StyleBuilderState.h"
32#include <wtf/MathExtras.h>
33#include <wtf/text/WTFString.h>
34
35namespace WebCore {
36
37CSSCursorImageValue::CSSCursorImageValue(Ref<CSSValue>&& imageValue, const std::optional<IntPoint>& hotSpot, LoadedFromOpaqueSource loadedFromOpaqueSource)
38 : CSSValue(CursorImageClass)
39 , m_imageValue(WTFMove(imageValue))
40 , m_hotSpot(hotSpot)
41 , m_loadedFromOpaqueSource(loadedFromOpaqueSource)
42{
43 if (is<CSSImageValue>(m_imageValue))
44 m_originalURL = downcast<CSSImageValue>(m_imageValue.get()).imageURL();
45}
46
47Ref<CSSCursorImageValue> CSSCursorImageValue::create(Ref<CSSValue>&& imageValue, const std::optional<IntPoint>& hotSpot, LoadedFromOpaqueSource loadedFromOpaqueSource)
48{
49 return adoptRef(*new CSSCursorImageValue(WTFMove(imageValue), hotSpot, loadedFromOpaqueSource));
50}
51
52CSSCursorImageValue::~CSSCursorImageValue()
53{
54 for (auto* element : m_cursorElements)
55 element->removeClient(*this);
56}
57
58String CSSCursorImageValue::customCSSText() const
59{
60 String text = m_imageValue.get().cssText();
61 if (!m_hotSpot)
62 return text;
63 return makeString(text, ' ', m_hotSpot->x(), ' ', m_hotSpot->y());
64}
65
66// FIXME: Should this function take a TreeScope instead?
67SVGCursorElement* CSSCursorImageValue::updateCursorElement(const Document& document)
68{
69 auto element = SVGURIReference::targetElementFromIRIString(m_originalURL.string(), document).element;
70 if (!is<SVGCursorElement>(element))
71 return nullptr;
72
73 // FIXME: Not right to keep old cursor elements as clients. The new one should replace the old, not join it in a set.
74 auto& cursorElement = downcast<SVGCursorElement>(*element);
75 if (m_cursorElements.add(&cursorElement).isNewEntry) {
76 cursorElementChanged(cursorElement);
77 cursorElement.addClient(*this);
78 }
79 return &cursorElement;
80}
81
82void CSSCursorImageValue::cursorElementRemoved(SVGCursorElement& cursorElement)
83{
84 // FIXME: Not right to stay a client of a cursor element until the element is destroyed. We'd want to stop being a client once it's no longer a valid target, like when it's disconnected.
85 m_cursorElements.remove(&cursorElement);
86}
87
88void CSSCursorImageValue::cursorElementChanged(SVGCursorElement& cursorElement)
89{
90 // FIXME: Seems wrong that changing an old cursor element, one that that is no longer the target, changes the hot spot.
91 // FIXME: This will override a hot spot that was specified in CSS, which is probably incorrect.
92 // FIXME: Should we clamp from float to int instead of just casting here?
93 SVGLengthContext lengthContext(nullptr);
94 m_hotSpot = IntPoint {
95 static_cast<int>(std::round(cursorElement.x().value(lengthContext))),
96 static_cast<int>(std::round(cursorElement.y().value(lengthContext)))
97 };
98
99 // FIXME: Why doesn't this funtion check for a change to the href of the cursor element? Why would we dynamically track changes to x/y but not href?
100}
101
102ImageWithScale CSSCursorImageValue::selectBestFitImage(const Document& document)
103{
104 if (is<CSSImageSetValue>(m_imageValue))
105 return downcast<CSSImageSetValue>(m_imageValue.get()).selectBestFitImage(document);
106
107 if (auto* cursorElement = updateCursorElement(document)) {
108 auto location = document.completeURL(cursorElement->href());
109 if (location != downcast<CSSImageValue>(m_imageValue.get()).imageURL())
110 m_imageValue = CSSImageValue::create(WTFMove(location), m_loadedFromOpaqueSource);
111 }
112
113 return { m_imageValue.ptr() , 1 };
114}
115
116bool CSSCursorImageValue::equals(const CSSCursorImageValue& other) const
117{
118 return m_hotSpot == other.m_hotSpot && compareCSSValue(m_imageValue, other.m_imageValue);
119}
120
121Ref<CSSCursorImageValue> CSSCursorImageValue::valueWithStylesResolved(Style::BuilderState& state)
122{
123 auto imageValue = state.resolveImageStyles(m_imageValue.get());
124 if (imageValue.ptr() == m_imageValue.ptr())
125 return *this;
126 return create(WTFMove(imageValue), m_hotSpot, m_loadedFromOpaqueSource);
127}
128
129} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.