Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (272466 => 272467)
--- trunk/Source/WebCore/CMakeLists.txt 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-02-07 03:28:55 UTC (rev 272467)
@@ -1435,6 +1435,7 @@
${WEBCORE_DIR}/css/plugIns.css
${WEBCORE_DIR}/css/quirks.css
${WEBCORE_DIR}/css/svg.css
+ ${WEBCORE_DIR}/html/shadow/imageOverlay.css
${WEBCORE_DIR}/html/shadow/meterElementShadow.css
)
Modified: trunk/Source/WebCore/ChangeLog (272466 => 272467)
--- trunk/Source/WebCore/ChangeLog 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/ChangeLog 2021-02-07 03:28:55 UTC (rev 272467)
@@ -1,3 +1,67 @@
+2021-02-06 Wenson Hsieh <[email protected]>
+
+ Introduce image overlays and add UA shadow root support for image extraction
+ https://bugs.webkit.org/show_bug.cgi?id=221236
+
+ Reviewed by Ryosuke Niwa.
+
+ This patch restores some of the logic previously introduced in r164457 (and removed with r272117) to render
+ service button cells over images, and additionally renames and repurposes it for image extraction, a new
+ accessibility feature. See comments below for more details.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTMLElement.cpp:
+ (WebCore::imageOverlayElementIdentifier):
+ (WebCore::HTMLElement::hasImageOverlay const):
+
+ Add a helper to determine whether or not an element's UA shadow root has an image overlay element. This is
+ consulted in the constructor of `RenderImage`.
+
+ (WebCore::HTMLElement::updateWithImageExtractionResult):
+
+ Add a helper method to install image extraction content in the shadow root of an element, given an
+ `ImageExtractionResult`. This consists of an image overlay container (a relatively positioned `div`), which then
+ contains some number of absolutely positioned child `div` elements. Additionally load the image overlay
+ stylesheet as text within a style element when creating the UA shadow root.
+
+ * html/HTMLElement.h:
+ * html/shadow/imageOverlay.css: Added.
+ (div#image-overlay):
+ (div.image-overlay-text):
+
+ Add a new UA stylesheet for the image overlay shadow DOM subtree. The overlay contains a number of absolutely
+ positoned `div` elements, which are positioned inside the overlay element using using CSS transforms.
+
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::RenderImage):
+ (WebCore::RenderImage::canHaveChildren const):
+
+ Return `true` if we require children in the shadow root (for either media controls, or this new image overlay).
+
+ (WebCore::RenderImage::layout):
+ (WebCore::RenderImage::layoutShadowContent):
+ (WebCore::RenderImage::layoutShadowControls): Deleted.
+
+ Rename `layoutShadowControls` to `layoutShadowContent`, and allow it to support both the "shadow controls" case
+ (i.e. `RenderMedia`) and the "image extraction content" case. Additonally, remove the check for
+ `shadowControlsNeedCustomLayoutMetrics()` when setting child renderer width/height. This is currently only used
+ for laying out media controls in `RenderMedia`, but we'll need it now for all `RenderImage`s.
+
+ * rendering/RenderImage.h:
+ (WebCore::RenderImage::setHasImageOverlay):
+ (WebCore::RenderImage::hasShadowContent const):
+
+ Add a helper method to return whether or not the `RenderImage` should expect shadow root content. This is true
+ for both media controls (`m_hasShadowControls`) and for the new image overlay content (`m_hasImageOverlay`).
+
+ (WebCore::RenderImage::shadowControlsNeedCustomLayoutMetrics const): Deleted.
+ * rendering/RenderMedia.h:
+
+ See `RenderImage::layoutShadowControls` above.
+
2021-02-06 Zalan Bujtas <[email protected]>
[LFC][IFC] Continuation pre and post block inline boxes should not have both the start and end decorations of the original inline box
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (272466 => 272467)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-02-07 03:28:55 UTC (rev 272467)
@@ -1038,6 +1038,7 @@
$(PROJECT_DIR)/html/canvas/WebGLVertexArrayObjectOES.idl
$(PROJECT_DIR)/html/parser/HTMLEntityNames.in
$(PROJECT_DIR)/html/parser/create-html-entity-table
+$(PROJECT_DIR)/html/shadow/imageOverlay.css
$(PROJECT_DIR)/html/shadow/meterElementShadow.css
$(PROJECT_DIR)/html/track/AudioTrack.idl
$(PROJECT_DIR)/html/track/AudioTrackList.idl
Modified: trunk/Source/WebCore/DerivedSources.make (272466 => 272467)
--- trunk/Source/WebCore/DerivedSources.make 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/DerivedSources.make 2021-02-07 03:28:55 UTC (rev 272467)
@@ -1526,6 +1526,7 @@
$(WebCore)/css/plugIns.css \
$(WebCore)/css/quirks.css \
$(WebCore)/css/svg.css \
+ $(WebCore)/html/shadow/imageOverlay.css \
$(WebCore)/html/shadow/meterElementShadow.css \
$(WebCore)/Modules/plugins/QuickTimePluginReplacement.css \
#
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (272466 => 272467)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-02-07 03:28:55 UTC (rev 272467)
@@ -5289,6 +5289,7 @@
F4D07559234D823300881E73 /* ClipboardItemPasteboardDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = F46C44802346547A0039A79D /* ClipboardItemPasteboardDataSource.h */; };
F4D40BC9255463BF00721349 /* DisplayListItemBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = F422B8B5253F7065004E77E8 /* DisplayListItemBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
F4D43D662188038B00ECECAC /* SerializedAttachmentData.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D43D64218802E600ECECAC /* SerializedAttachmentData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F4DD866525CC60A30059BFDA /* imageOverlay.css in Resources */ = {isa = PBXBuildFile; fileRef = F4DD866225CC60840059BFDA /* imageOverlay.css */; };
F4E57EDC213F3F5F004EA98E /* FontAttributeChanges.h in Headers */ = {isa = PBXBuildFile; fileRef = F4E57EDA213F3F5F004EA98E /* FontAttributeChanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
F4E57EE1213F434A004EA98E /* WebCoreNSFontManagerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = F4E57EDF213F434A004EA98E /* WebCoreNSFontManagerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
F4FB34FC2350C85D00F0094A /* PasteboardCustomData.h in Headers */ = {isa = PBXBuildFile; fileRef = F4FB34FA2350C85D00F0094A /* PasteboardCustomData.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -16624,6 +16625,7 @@
F4D43D64218802E600ECECAC /* SerializedAttachmentData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SerializedAttachmentData.h; sourceTree = "<group>"; };
F4D9817D2195FBF6008230FC /* ChangeListTypeCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChangeListTypeCommand.h; sourceTree = "<group>"; };
F4D9817E2195FBF6008230FC /* ChangeListTypeCommand.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ChangeListTypeCommand.cpp; sourceTree = "<group>"; };
+ F4DD866225CC60840059BFDA /* imageOverlay.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = imageOverlay.css; sourceTree = "<group>"; };
F4E1965A21F2395000285078 /* JSUndoItemCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUndoItemCustom.cpp; sourceTree = "<group>"; };
F4E1965F21F26E4E00285078 /* UndoItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UndoItem.cpp; sourceTree = "<group>"; };
F4E1966121F27D3C00285078 /* CustomUndoStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomUndoStep.h; sourceTree = "<group>"; };
@@ -19342,6 +19344,7 @@
E5F06AED24D4A63700BBC4F8 /* DateTimeSymbolicFieldElement.h */,
A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */,
A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */,
+ F4DD866225CC60840059BFDA /* imageOverlay.css */,
417253A81354BBBC00360F2A /* MediaControlTextTrackContainerElement.cpp */,
417253A91354BBBC00360F2A /* MediaControlTextTrackContainerElement.h */,
E4E243821DAB953E00C26E4B /* meterElementShadow.css */,
@@ -35709,6 +35712,7 @@
2D50A4B81CE10E0000198049 /* [email protected] in Resources */,
A1AA9AB91D23911500FEADB3 /* ContentFilterBlockedPage.html in Resources */,
A11E8C051B1E28F40003A7C7 /* copyCursor.png in Resources */,
+ F4DD866525CC60A30059BFDA /* imageOverlay.css in Resources */,
2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */,
E59DD4B821098287003C8B47 /* ListButtonArrow.png in Resources */,
E516699120FF9918009D2C27 /* [email protected] in Resources */,
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (272466 => 272467)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2021-02-07 03:28:55 UTC (rev 272467)
@@ -45,6 +45,7 @@
#include "HTMLBDIElement.h"
#include "HTMLBRElement.h"
#include "HTMLButtonElement.h"
+#include "HTMLDivElement.h"
#include "HTMLDocument.h"
#include "HTMLElementFactory.h"
#include "HTMLFieldSetElement.h"
@@ -55,10 +56,12 @@
#include "HTMLOptionElement.h"
#include "HTMLParserIdioms.h"
#include "HTMLSelectElement.h"
+#include "HTMLStyleElement.h"
#include "HTMLTextAreaElement.h"
#include "HTMLTextFormControlElement.h"
#include "NodeTraversal.h"
#include "RenderElement.h"
+#include "RenderImage.h"
#include "ScriptController.h"
#include "ScriptDisallowedScope.h"
#include "ShadowRoot.h"
@@ -65,6 +68,7 @@
#include "SimulatedClick.h"
#include "StyleProperties.h"
#include "Text.h"
+#include "UserAgentStyleSheets.h"
#include "XMLNames.h"
#include "markup.h"
#include <wtf/IsoMallocInlines.h>
@@ -73,6 +77,10 @@
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
+#if ENABLE(IMAGE_EXTRACTION)
+#include "ImageExtractionResult.h"
+#endif
+
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(HTMLElement);
@@ -1186,6 +1194,81 @@
setAttributeWithoutSynchronization(enterkeyhintAttr, value);
}
+static const AtomString& imageOverlayElementIdentifier()
+{
+ static MainThreadNeverDestroyed<const AtomString> identifier("image-overlay", AtomString::ConstructFromLiteral);
+ return identifier;
+}
+
+bool HTMLElement::hasImageOverlay() const
+{
+ auto shadowRoot = userAgentShadowRoot();
+ if (LIKELY(!shadowRoot))
+ return false;
+
+ return shadowRoot->hasElementWithId(*imageOverlayElementIdentifier().impl());
+}
+
+#if ENABLE(IMAGE_EXTRACTION)
+
+void HTMLElement::updateWithImageExtractionResult(ImageExtractionResult&& result)
+{
+ if (result.isEmpty())
+ return;
+
+ if (auto* renderer = this->renderer()) {
+ if (!is<RenderImage>(renderer))
+ return;
+
+ downcast<RenderImage>(*renderer).setHasImageOverlay();
+ }
+
+ static NeverDestroyed<const String> shadowStyle(imageOverlayUserAgentStyleSheet, String::ConstructFromLiteral);
+ auto style = HTMLStyleElement::create(HTMLNames::styleTag, document(), false);
+ style->setTextContent(shadowStyle);
+
+ auto shadowRoot = makeRef(ensureUserAgentShadowRoot());
+ shadowRoot->appendChild(WTFMove(style));
+
+ auto container = HTMLDivElement::create(document());
+ container->setIdAttribute(imageOverlayElementIdentifier());
+ shadowRoot->appendChild(container);
+
+ static MainThreadNeverDestroyed<const AtomString> imageOverlayTextClass("image-overlay-text", AtomString::ConstructFromLiteral);
+
+ IntSize containerSize { offsetWidth(), offsetHeight() };
+ for (auto& data : result.textData) {
+ auto child = HTMLDivElement::create(document());
+ child->classList().add(imageOverlayTextClass);
+
+ container->appendChild(child);
+ child->appendChild(Text::create(document(), data.text));
+ child->appendChild(HTMLBRElement::create(document()));
+
+ IntSize originalSize { child->offsetWidth(), child->offsetHeight() };
+ if (originalSize.isEmpty())
+ continue;
+
+ auto targetRect = data.normalizedQuad.boundingBox();
+ targetRect.scale(containerSize);
+
+ IntPoint translationOffset {
+ static_cast<int>(targetRect.x() + (targetRect.width() - originalSize.width()) / 2),
+ static_cast<int>(targetRect.y() + (targetRect.height() - originalSize.height()) / 2)
+ };
+
+ child->setInlineStyleProperty(CSSPropertyTransform, makeString(
+ "translate("_s, translationOffset.x(), "px, "_s, translationOffset.y(), "px) "_s
+ "scale("_s, targetRect.width() / originalSize.width(), ", "_s, targetRect.height() / originalSize.height(), ")"_s
+ ));
+ }
+
+ if (auto frame = makeRefPtr(document().frame()))
+ frame->eventHandler().scheduleCursorUpdate();
+}
+
+#endif // ENABLE(IMAGE_EXTRACTION)
+
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/html/HTMLElement.h (272466 => 272467)
--- trunk/Source/WebCore/html/HTMLElement.h 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/html/HTMLElement.h 2021-02-07 03:28:55 UTC (rev 272467)
@@ -35,6 +35,10 @@
class FormNamedItem;
class HTMLFormElement;
+#if ENABLE(IMAGE_EXTRACTION)
+struct ImageExtractionResult;
+#endif
+
enum class EnterKeyHint : uint8_t;
class HTMLElement : public StyledElement {
@@ -122,6 +126,12 @@
String enterKeyHint() const;
void setEnterKeyHint(const String& value);
+ bool hasImageOverlay() const;
+
+#if ENABLE(IMAGE_EXTRACTION)
+ WEBCORE_EXPORT void updateWithImageExtractionResult(ImageExtractionResult&&);
+#endif
+
protected:
HTMLElement(const QualifiedName& tagName, Document&, ConstructionType);
Added: trunk/Source/WebCore/html/shadow/imageOverlay.css (0 => 272467)
--- trunk/Source/WebCore/html/shadow/imageOverlay.css (rev 0)
+++ trunk/Source/WebCore/html/shadow/imageOverlay.css 2021-02-07 03:28:55 UTC (rev 272467)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+div#image-overlay {
+ display: inline-block;
+ position: relative;
+ overflow: hidden;
+ color: transparent;
+ text-align: center;
+ white-space: nowrap;
+ line-height: 100%;
+}
+
+div.image-overlay-text {
+ position: absolute;
+ overflow: hidden;
+}
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (272466 => 272467)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2021-02-07 03:28:55 UTC (rev 272467)
@@ -138,6 +138,7 @@
RenderImage::RenderImage(Element& element, RenderStyle&& style, StyleImage* styleImage, const float imageDevicePixelRatio)
: RenderReplaced(element, WTFMove(style), IntSize())
, m_imageResource(styleImage ? makeUnique<RenderImageResourceStyleImage>(*styleImage) : makeUnique<RenderImageResource>())
+ , m_hasImageOverlay(is<HTMLElement>(element) && downcast<HTMLElement>(element).hasImageOverlay())
, m_imageDevicePixelRatio(imageDevicePixelRatio)
{
updateAltText();
@@ -788,17 +789,13 @@
bool RenderImage::canHaveChildren() const
{
-#if !ENABLE(SERVICE_CONTROLS)
- return false;
-#else
- return m_hasShadowControls;
-#endif
+ return hasShadowContent();
}
void RenderImage::layout()
{
- // Recomputing overflow is required only when child content is present.
- if (needsSimplifiedNormalFlowLayoutOnly() && !m_hasShadowControls) {
+ // Recomputing overflow is required only when child content is present.
+ if (needsSimplifiedNormalFlowLayoutOnly() && !hasShadowContent()) {
clearNeedsLayout();
return;
}
@@ -810,45 +807,37 @@
updateInnerContentRect();
- if (m_hasShadowControls)
- layoutShadowControls(oldSize);
+ if (hasShadowContent())
+ layoutShadowContent(oldSize);
}
-void RenderImage::layoutShadowControls(const LayoutSize& oldSize)
+void RenderImage::layoutShadowContent(const LayoutSize& oldSize)
{
- // We expect a single containing box under the UA shadow root.
- ASSERT(firstChild() == lastChild());
+ for (auto& renderBox : childrenOfType<RenderBox>(*this)) {
+ bool childNeedsLayout = renderBox.needsLayout();
+ // If the region chain has changed we also need to relayout the children to update the region box info.
+ // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
+ auto* fragmentedFlow = enclosingFragmentedFlow();
+ if (fragmentedFlow && !childNeedsLayout) {
+ if (fragmentedFlow->pageLogicalSizeChanged())
+ childNeedsLayout = true;
+ }
- auto* controlsRenderer = downcast<RenderBox>(firstChild());
- if (!controlsRenderer)
- return;
-
- bool controlsNeedLayout = controlsRenderer->needsLayout();
- // If the region chain has changed we also need to relayout the controls to update the region box info.
- // FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
- const RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlow();
- if (fragmentedFlow && !controlsNeedLayout) {
- if (fragmentedFlow->pageLogicalSizeChanged())
- controlsNeedLayout = true;
- }
+ auto newSize = contentBoxRect().size();
+ if (newSize == oldSize && !childNeedsLayout)
+ continue;
- LayoutSize newSize = contentBoxRect().size();
- if (newSize == oldSize && !controlsNeedLayout)
- return;
-
- // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or
- // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
- // and this method might be called many times per second during video playback, use a LayoutStateMaintainer:
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
-
- if (shadowControlsNeedCustomLayoutMetrics()) {
- controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
- controlsRenderer->mutableStyle().setHeight(Length(newSize.height(), Fixed));
- controlsRenderer->mutableStyle().setWidth(Length(newSize.width(), Fixed));
+ // When calling layout() on a child node, a parent must either push a LayoutStateMaintainer, or
+ // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is slightly more efficient,
+ // and this method might be called many times per second during video playback, use a LayoutStateMaintainer:
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+ renderBox.setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
+ renderBox.mutableStyle().setHeight(Length(newSize.height(), Fixed));
+ renderBox.mutableStyle().setWidth(Length(newSize.width(), Fixed));
+ renderBox.setNeedsLayout(MarkOnlyThis);
+ renderBox.layout();
}
- controlsRenderer->setNeedsLayout(MarkOnlyThis);
- controlsRenderer->layout();
clearChildNeedsLayout();
}
Modified: trunk/Source/WebCore/rendering/RenderImage.h (272466 => 272467)
--- trunk/Source/WebCore/rendering/RenderImage.h 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/rendering/RenderImage.h 2021-02-07 03:28:55 UTC (rev 272467)
@@ -70,6 +70,7 @@
float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
void setHasShadowControls(bool hasShadowControls) { m_hasShadowControls = hasShadowControls; }
+ void setHasImageOverlay() { m_hasImageOverlay = true; }
bool isShowingMissingOrImageError() const;
bool isShowingAltText() const;
@@ -120,8 +121,6 @@
bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& paintOffset, BackgroundBleedAvoidance, InlineFlowBox*) const final;
- virtual bool shadowControlsNeedCustomLayoutMetrics() const { return false; }
-
IntSize imageSizeForError(CachedImage*) const;
void repaintOrMarkForLayout(ImageSizeChangeType, const IntRect* = nullptr);
void updateIntrinsicSizeIfNeeded(const LayoutSize&);
@@ -130,8 +129,10 @@
void paintAreaElementFocusRing(PaintInfo&, const LayoutPoint& paintOffset);
- void layoutShadowControls(const LayoutSize& oldSize);
+ void layoutShadowContent(const LayoutSize& oldSize);
+ bool hasShadowContent() const { return m_hasShadowControls || m_hasImageOverlay; }
+
LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override;
LayoutUnit computeReplacedLogicalHeight(Optional<LayoutUnit> estimatedUsedWidth = WTF::nullopt) const override;
@@ -143,6 +144,7 @@
bool m_needsToSetSizeForAltText { false };
bool m_isGeneratedContent { false };
bool m_hasShadowControls { false };
+ bool m_hasImageOverlay { false };
float m_imageDevicePixelRatio { 1 };
friend class RenderImageScaleObserver;
Modified: trunk/Source/WebCore/rendering/RenderMedia.h (272466 => 272467)
--- trunk/Source/WebCore/rendering/RenderMedia.h 2021-02-07 03:13:53 UTC (rev 272466)
+++ trunk/Source/WebCore/rendering/RenderMedia.h 2021-02-07 03:28:55 UTC (rev 272467)
@@ -56,7 +56,6 @@
bool isImage() const final { return false; }
void paintReplaced(PaintInfo&, const LayoutPoint&) override;
- bool shadowControlsNeedCustomLayoutMetrics() const override { return true; }
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
};