[webkit-changes] [WebKit/WebKit] 76eb7a: [Remote Inspection] Add a mechanism to adjust visi...

Wenson Hsieh noreply at github.com
Fri Mar 22 07:55:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 76eb7a2a68c693dda089e347b386d13d172b0fc4
      https://github.com/WebKit/WebKit/commit/76eb7a2a68c693dda089e347b386d13d172b0fc4
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-03-22 (Fri, 22 Mar 2024)

  Changed paths:
    M Source/WebCore/accessibility/AXObjectCache.cpp
    M Source/WebCore/accessibility/AccessibilityObject.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/ElementRareData.cpp
    M Source/WebCore/dom/ElementRareData.h
    M Source/WebCore/html/shadow/TextControlInnerElements.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentPainter.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/ios/ContentChangeObserver.cpp
    M Source/WebCore/page/text-extraction/TextExtraction.cpp
    M Source/WebCore/rendering/InlineBoxPainter.cpp
    M Source/WebCore/rendering/LegacyInlineTextBox.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderDetailsMarker.cpp
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElementInlines.h
    M Source/WebCore/rendering/RenderFileUploadControl.cpp
    M Source/WebCore/rendering/RenderInline.cpp
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerModelObject.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
    M Source/WebCore/rendering/RenderListBox.cpp
    M Source/WebCore/rendering/RenderListMarker.cpp
    M Source/WebCore/rendering/RenderMedia.cpp
    M Source/WebCore/rendering/RenderMenuList.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderSearchField.cpp
    M Source/WebCore/rendering/RenderTable.cpp
    M Source/WebCore/rendering/RenderTableCell.cpp
    M Source/WebCore/rendering/RenderTableRow.cpp
    M Source/WebCore/rendering/RenderTableSection.cpp
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebCore/rendering/RenderWidget.cpp
    M Source/WebCore/rendering/mathml/MathOperator.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/RenderStyleSetters.h
    M Source/WebCore/rendering/style/StyleRareInheritedData.cpp
    M Source/WebCore/rendering/style/StyleRareInheritedData.h
    M Source/WebCore/rendering/svg/RenderSVGImage.cpp
    M Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
    M Source/WebCore/rendering/svg/RenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/RenderSVGText.cpp
    M Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceMasker.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebCore/svg/SVGClipPathElement.cpp
    M Source/WebCore/svg/SVGMaskElement.cpp
    M Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm

  Log Message:
  -----------
  [Remote Inspection] Add a mechanism to adjust visibility for the purposes of painting underneath element subtrees
https://bugs.webkit.org/show_bug.cgi?id=271332

Reviewed by Antti Koivisto and Anne van Kesteren.

This patch consists of the following:

1.  An `ElementRareData` flag to mark elements as "visibility adjustment roots".

2.  A new `RenderStyle` flag that's set at style adjustment time, after consulting (1). This new
    flag is used to implement a notion of `usedVisibility()`, wherein the visibility used for
    painting, hit-testing, accessibility, and some other purposes that are opaque to script may
    differ from the specified visibility.

3.  Finally, deploy this new `usedVisibility()` method in all places where `visibility()` is
    currently used for non-web-exposed purposes.

In subsequent patches, this style infrastructure will make it possible for Web Inspector's Element
Selection targeting mode to inspect elements that would otherwise be obscured by other content,
without running into compat issues that may arise from affecting the computed visibility in a way
that the page's script may not expect or handle correctly.

See below for more details.

* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::isNodeVisible const):
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isDOMHidden const):
(WebCore::AccessibilityObject::defaultObjectInclusion const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::isPageBoxVisible):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isVisibilityAdjustmentRoot const):
(WebCore::Element::setIsVisibilityAdjustmentRoot):

Add `Element` getters and setters for the new rare data flag.

* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ElementRareData.cpp:
* Source/WebCore/dom/ElementRareData.h:
(WebCore::ElementRareData::isVisibilityAdjustmentRoot const):
(WebCore::ElementRareData::setIsVisibilityAdjustmentRoot):
* Source/WebCore/html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldCancelButtonElement::resolveCustomStyle):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h:
(WebCore::InlineDisplay::Box::isVisible const):
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentPainter.cpp:
(WebCore::LayoutIntegration::InlineContentPainter::paintEllipsis):
(WebCore::LayoutIntegration::InlineContentPainter::paintDisplayBox):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::searchForLabelsAboveCell):
(WebCore::LocalFrame::searchForLabelsBeforeElement):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::adjustVerticalPageScrollStepForFixedContent):
(WebCore::LocalFrameView::checkAndDispatchDidReachVisuallyNonEmptyState):
* Source/WebCore/page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::isVisuallyHidden):
* Source/WebCore/page/text-extraction/TextExtraction.cpp:
(WebCore::TextExtraction::extractItemData):
(WebCore::TextExtraction::extractRenderedText):
* Source/WebCore/rendering/InlineBoxPainter.cpp:
(WebCore::InlineBoxPainter::paint):
(WebCore::InlineBoxPainter::paintMask):
(WebCore::InlineBoxPainter::paintDecorations):
* Source/WebCore/rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::paint):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
(WebCore::RenderBlock::paintObject):
(WebCore::RenderBlock::shouldPaintSelectionGaps const):
(WebCore::isChildHitTestCandidate):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::inlineSelectionGaps):
(WebCore::RenderBlockFlow::findClosestTextAtAbsolutePoint):
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::isCandidateForOpaquenessTest):
(WebCore::RenderBox::paintMask):
(WebCore::RenderBox::paintClippingMask):
(WebCore::RenderBox::positionForPoint):
* Source/WebCore/rendering/RenderDetailsMarker.cpp:
(WebCore::RenderDetailsMarker::paint):
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::repaintBeforeStyleChange):
(WebCore::RenderElement::styleWillChange):
(WebCore::RenderElement::insertedIntoTree):
(WebCore::RenderElement::willBeRemovedFromTree):
(WebCore::RenderElement::isVisibleIgnoringGeometry const):
(WebCore::RenderElement::isInsideEntirelyHiddenLayer const):
* Source/WebCore/rendering/RenderElementInlines.h:
(WebCore::RenderElement::visibleToHitTesting const):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
* Source/WebCore/rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):

Drive-by fix a typo: `needsvisibleContentStatusUpdate` -> `needsVisibleContentStatusUpdate`.

(WebCore::RenderLayer::removeChild):
(WebCore::RenderLayer::computeHasVisibleContent const):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterDescendants):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
(WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
(WebCore::RenderLayerCompositor::requiresCompositingForFrame const):
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::shouldPaintSVGRenderer const):
(WebCore::RenderLayerModelObject::paintSVGClippingMask const):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::canUseCompositedScrolling const):
* Source/WebCore/rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintObject):
(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):
* Source/WebCore/rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* Source/WebCore/rendering/RenderMedia.cpp:
(WebCore::RenderMedia::styleDidChange):
* Source/WebCore/rendering/RenderMenuList.cpp:
(RenderMenuList::itemStyle const):
(RenderMenuList::menuStyle const):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/RenderSearchField.cpp:
(WebCore::RenderSearchField::updateCancelButtonVisibility const):
(WebCore::RenderSearchField::visibilityForCancelButton const):
(WebCore::RenderSearchField::menuStyle const):
* Source/WebCore/rendering/RenderTable.cpp:
(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::paintMask):
* Source/WebCore/rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorders):
(WebCore::RenderTableCell::paintBackgroundsBehindCell):
(WebCore::RenderTableCell::paintMask):
* Source/WebCore/rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::paintOutlineForRowIfNeeded):
* Source/WebCore/rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paint):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::rendererObscuresBackground):
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::setWidget):
(WebCore::RenderWidget::styleDidChange):
* Source/WebCore/rendering/mathml/MathOperator.cpp:
(WebCore::MathOperator::paint):
* Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::paint):
* Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp:
(WebCore::RenderMathMLMenclose::paint):
* Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::paint):
* Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::paint):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout const):
(WebCore::requiresPainting):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::isInVisibilityAdjustmentSubtree const):
(WebCore::RenderStyle::usedVisibility const):
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setIsInVisibilityAdjustmentSubtree):
* Source/WebCore/rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
* Source/WebCore/rendering/style/StyleRareInheritedData.h:
* Source/WebCore/rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::nodeAtPoint):
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::styleDidChange):
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::paint):
(WebCore::RenderSVGRoot::paintObject):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::nodeAtPoint):
* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::nodeAtFloatPoint):
(WebCore::RenderSVGText::nodeAtPoint):
* Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintSelectionBackground):
(WebCore::SVGInlineTextBox::paint):
(WebCore::SVGInlineTextBox::paintDecoration):
(WebCore::SVGInlineTextBox::nodeAtPoint):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp:
(WebCore::LegacyRenderSVGContainer::paint):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp:
(WebCore::LegacyRenderSVGImage::paint):
(WebCore::LegacyRenderSVGImage::nodeAtFloatPoint):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp:
(WebCore::LegacyRenderSVGResourceClipper::pathOnlyClipping):
(WebCore::LegacyRenderSVGResourceClipper::drawContentIntoMaskImage):
(WebCore::LegacyRenderSVGResourceClipper::calculateClipContentRepaintRect):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceMasker.cpp:
(WebCore::LegacyRenderSVGResourceMasker::drawContentIntoContext):
(WebCore::LegacyRenderSVGResourceMasker::calculateMaskContentRepaintRect):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::paint):
(WebCore::LegacyRenderSVGShape::nodeAtFloatPoint):
* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::reportVisuallyNonEmptyContent):
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):

Propagate the new "visibility adjustment root" flag to the `RenderStyle` at style adjustment time
(and also propagate parents' `isInVisibilityAdjustmentSubtree` state to their children in the
render tree).

* Source/WebCore/svg/SVGClipPathElement.cpp:
(WebCore::SVGClipPathElement::shouldApplyPathClipping const):
(WebCore::SVGClipPathElement::calculateClipContentRepaintRect):
* Source/WebCore/svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::calculateMaskContentRepaintRect):
* Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm:
(searchForLabelsBeforeElement):

Canonical link: https://commits.webkit.org/276543@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list