Changeset 242561 in webkit
- Timestamp:
- Mar 6, 2019, 12:18:00 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242555 r242561 1 2019-03-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer 4 https://bugs.webkit.org/show_bug.cgi?id=195300 5 6 Reviewed by Simon Fraser. 7 8 Move isTransparentOrFullyClippedRespectingParentFrames() from RenderObject to RenderLayer, since this function 9 asks questions about RenderLayers rather than their renderers. No change in behavior. 10 11 * rendering/RenderLayer.cpp: 12 (WebCore::enclosingFrameRenderLayer): 13 (WebCore::parentLayerCrossFrame): 14 15 Some static helpers currently in RenderObject that walk up the layer hierarchy through subframes are redundant 16 with static helpers in RenderLayer. Now that isTransparentOrFullyClippedRespectingParentFrames exists in 17 RenderLayer, simply use this existing helper instead and split logic to grab the enclosing layer around the 18 owner element of a frame into a separate helper. 19 20 * rendering/RenderLayer.h: 21 * rendering/RenderObject.cpp: 22 (WebCore::enclosingFrameRenderLayer): Deleted. 23 (WebCore::parentLayerCrossingFrameBoundaries): Deleted. 24 (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): Deleted. 25 26 Moved from RenderObject. 27 28 * rendering/RenderObject.h: 29 1 30 2019-03-06 Sihui Liu <sihui_liu@apple.com> 2 31 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r242333 r242561 1653 1653 } 1654 1654 1655 static RenderLayer* parentLayerCrossFrame(const RenderLayer& layer) 1656 { 1657 if (layer.parent()) 1658 return layer.parent(); 1659 1660 HTMLFrameOwnerElement* ownerElement = layer.renderer().document().ownerElement(); 1655 static RenderLayer* enclosingFrameRenderLayer(const RenderLayer& layer) 1656 { 1657 auto* ownerElement = layer.renderer().document().ownerElement(); 1661 1658 if (!ownerElement) 1662 1659 return nullptr; 1663 1660 1664 RenderElement* ownerRenderer = ownerElement->renderer();1661 auto* ownerRenderer = ownerElement->renderer(); 1665 1662 if (!ownerRenderer) 1666 1663 return nullptr; 1667 1664 1668 1665 return ownerRenderer->enclosingLayer(); 1666 } 1667 1668 static RenderLayer* parentLayerCrossFrame(const RenderLayer& layer) 1669 { 1670 if (auto* parent = layer.parent()) 1671 return parent; 1672 1673 return enclosingFrameRenderLayer(layer); 1669 1674 } 1670 1675 … … 6595 6600 } 6596 6601 6602 bool RenderLayer::isTransparentOrFullyClippedRespectingParentFrames() const 6603 { 6604 static const double minimumVisibleOpacity = 0.01; 6605 6606 float currentOpacity = 1; 6607 for (auto* layer = this; layer; layer = parentLayerCrossFrame(*layer)) { 6608 currentOpacity *= layer->renderer().style().opacity(); 6609 if (currentOpacity < minimumVisibleOpacity) 6610 return true; 6611 } 6612 6613 for (auto* layer = this; layer; layer = enclosingFrameRenderLayer(*layer)) { 6614 if (layer->selfClipRect().isEmpty()) 6615 return true; 6616 } 6617 6618 return false; 6619 } 6620 6597 6621 TextStream& operator<<(TextStream& ts, const RenderLayer& layer) 6598 6622 { -
trunk/Source/WebCore/rendering/RenderLayer.h
r242333 r242561 858 858 bool paintingFrequently() const { return m_paintFrequencyTracker.paintingFrequently(); } 859 859 860 WEBCORE_EXPORT bool isTransparentOrFullyClippedRespectingParentFrames() const; 861 860 862 private: 861 863 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r242401 r242561 1528 1528 } 1529 1529 1530 static RenderLayer* enclosingFrameRenderLayer(RenderObject& renderObject)1531 {1532 auto* owner = renderObject.frame().ownerElement();1533 if (!owner)1534 return nullptr;1535 1536 auto* frameOwnerRenderer = owner->renderer();1537 return frameOwnerRenderer ? frameOwnerRenderer->enclosingLayer() : nullptr;1538 }1539 1540 static RenderLayer* parentLayerCrossingFrameBoundaries(RenderLayer& layer)1541 {1542 if (auto* parentLayer = layer.parent())1543 return parentLayer;1544 1545 return enclosingFrameRenderLayer(layer.renderer());1546 }1547 1548 bool RenderObject::isTransparentOrFullyClippedRespectingParentFrames() const1549 {1550 static const double minimumVisibleOpacity = 0.01;1551 1552 float currentOpacity = 1;1553 for (auto* layer = enclosingLayer(); layer; layer = parentLayerCrossingFrameBoundaries(*layer)) {1554 currentOpacity *= layer->renderer().style().opacity();1555 if (currentOpacity < minimumVisibleOpacity)1556 return true;1557 }1558 1559 for (auto* layer = enclosingLayer(); layer; layer = enclosingFrameRenderLayer(layer->renderer())) {1560 if (layer->selfClipRect().isEmpty())1561 return true;1562 }1563 1564 return false;1565 }1566 1567 1530 Position RenderObject::positionForPoint(const LayoutPoint& point) 1568 1531 { -
trunk/Source/WebCore/rendering/RenderObject.h
r241183 r242561 798 798 void initializeFragmentedFlowStateOnInsertion(); 799 799 virtual void insertedIntoTree(); 800 801 WEBCORE_EXPORT bool isTransparentOrFullyClippedRespectingParentFrames() const;802 800 803 801 protected: -
trunk/Source/WebKit/ChangeLog
r242554 r242561 1 2019-03-06 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer 4 https://bugs.webkit.org/show_bug.cgi?id=195300 5 6 Reviewed by Simon Fraser. 7 8 Refactor some logic to use isTransparentOrFullyClippedRespectingParentFrames on RenderLayer rather than 9 RenderObject; introduce a helper method to ask whether the enclosing layer of a renderer is transparent or 10 clipped. 11 12 * WebProcess/WebPage/ios/WebPageIOS.mm: 13 (WebKit::enclosingLayerIsTransparentOrFullyClipped): 14 (WebKit::WebPage::platformEditorState const): 15 (WebKit::WebPage::requestEvasionRectsAboveSelection): 16 (WebKit::WebPage::getFocusedElementInformation): 17 1 18 2019-03-06 Chris Dumez <cdumez@apple.com> 2 19 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r242554 r242561 180 180 } 181 181 182 static bool enclosingLayerIsTransparentOrFullyClipped(const RenderObject& renderer) 183 { 184 auto* enclosingLayer = renderer.enclosingLayer(); 185 return enclosingLayer && enclosingLayer->isTransparentOrFullyClippedRespectingParentFrames(); 186 } 187 182 188 void WebPage::platformEditorState(Frame& frame, EditorState& result, IncludePostLayoutDataHint shouldIncludePostLayoutData) const 183 189 { … … 247 253 if (!selection.isNone()) { 248 254 if (m_focusedElement && m_focusedElement->renderer()) { 249 postLayoutData.focusedElementRect = view->contentsToRootView(m_focusedElement->renderer()->absoluteBoundingBoxRect()); 250 postLayoutData.caretColor = m_focusedElement->renderer()->style().caretColor(); 251 postLayoutData.elementIsTransparentOrFullyClipped = m_focusedElement->renderer()->isTransparentOrFullyClippedRespectingParentFrames(); 255 auto& renderer = *m_focusedElement->renderer(); 256 postLayoutData.focusedElementRect = view->contentsToRootView(renderer.absoluteBoundingBoxRect()); 257 postLayoutData.caretColor = renderer.style().caretColor(); 258 postLayoutData.elementIsTransparentOrFullyClipped = enclosingLayerIsTransparentOrFullyClipped(renderer); 252 259 } 253 260 computeEditableRootHasContentAndPlainText(selection, postLayoutData); … … 1524 1531 } 1525 1532 1526 if (!m_focusedElement || !m_focusedElement->renderer() || m_focusedElement->renderer()->isTransparentOrFullyClippedRespectingParentFrames()) {1533 if (!m_focusedElement || !m_focusedElement->renderer() || enclosingLayerIsTransparentOrFullyClipped(*m_focusedElement->renderer())) { 1527 1534 reply({ }); 1528 1535 return; … … 2490 2497 information.elementRect = elementRectInRootViewCoordinates(*m_focusedElement, elementFrame); 2491 2498 information.nodeFontSize = renderer->style().fontDescription().computedSize(); 2492 information.elementIsTransparentOrFullyClipped = renderer->isTransparentOrFullyClippedRespectingParentFrames();2499 information.elementIsTransparentOrFullyClipped = enclosingLayerIsTransparentOrFullyClipped(*renderer); 2493 2500 2494 2501 bool inFixed = false;
Note:
See TracChangeset
for help on using the changeset viewer.