Changeset 205927 in webkit
- Timestamp:
- Sep 14, 2016, 1:51:41 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205926 r205927 1 2016-09-14 Antti Koivisto <antti@apple.com> 2 3 Move more code out from RenderObject 4 https://bugs.webkit.org/show_bug.cgi?id=161980 5 6 Reviewed by Zalan Bujtas. 7 8 Move some functions that are only needed for RenderElement there. 9 Move collapsing anonymous table rows to RenderTableRow. 10 11 * rendering/RenderElement.cpp: 12 (WebCore::RenderElement::hasOutlineAnnotation): 13 (WebCore::RenderElement::hasSelfPaintingLayer): 14 (WebCore::RenderElement::checkForRepaintDuringLayout): 15 * rendering/RenderElement.h: 16 (WebCore::RenderElement::hasOutline): 17 (WebCore::RenderElement::hasHiddenBackface): Deleted. 18 * rendering/RenderLayerCompositor.cpp: 19 (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged): 20 * rendering/RenderObject.cpp: 21 (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect): 22 (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers): 23 (WebCore::RenderObject::hasSelfPaintingLayer): Deleted. 24 (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted. 25 (WebCore::RenderObject::hasOutlineAnnotation): Deleted. 26 (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted. 27 (WebCore::collapseAnonymousTableRowsIfNeeded): Deleted. 28 * rendering/RenderObject.h: 29 (WebCore::RenderObject::hasLayer): 30 (WebCore::RenderObject::canBeSelectionLeaf): 31 (WebCore::RenderObject::hasOutline): Deleted. 32 (WebCore::RenderObject::hasSelectedChildren): Deleted. 33 * rendering/RenderTableRow.cpp: 34 (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows): 35 * rendering/RenderTableRow.h: 36 * rendering/RenderView.cpp: 37 (WebCore::RenderView::rootBackgroundIsEntirelyFixed): 38 1 39 2016-09-14 Daniel Bates <dabates@apple.com> 2 40 -
trunk/Source/WebCore/rendering/RenderElement.cpp
r205818 r205927 2174 2174 } 2175 2175 2176 bool RenderElement::hasOutlineAnnotation() const 2177 { 2178 return element() && element()->isLink() && document().printing(); 2179 } 2180 2181 bool RenderElement::hasSelfPaintingLayer() const 2182 { 2183 if (!hasLayer()) 2184 return false; 2185 auto& layerModelObject = downcast<RenderLayerModelObject>(*this); 2186 return layerModelObject.hasSelfPaintingLayer(); 2187 } 2188 2189 bool RenderElement::checkForRepaintDuringLayout() const 2190 { 2191 return !document().view()->needsFullRepaint() && everHadLayout() && !hasSelfPaintingLayer(); 2192 } 2193 2176 2194 #if ENABLE(IOS_TEXT_AUTOSIZING) 2177 2195 static RenderObject::BlockContentHeightType includeNonFixedHeight(const RenderObject& renderer) -
trunk/Source/WebCore/rendering/RenderElement.h
r204667 r205927 162 162 bool hasClipPath() const { return style().clipPath(); } 163 163 bool hasHiddenBackface() const { return style().backfaceVisibility() == BackfaceVisibilityHidden; } 164 bool hasOutlineAnnotation() const; 165 bool hasOutline() const { return style().hasOutline() || hasOutlineAnnotation(); } 166 bool hasSelfPaintingLayer() const; 167 168 bool checkForRepaintDuringLayout() const; 164 169 165 170 // anchorRect() is conceptually similar to absoluteBoundingBoxRect(), but is intended for scrolling to an anchor. … … 177 182 #endif 178 183 } 184 179 185 180 186 #if ENABLE(CSS_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r205818 r205927 3234 3234 3235 3235 bool hadFixedBackground = oldStyle && oldStyle->hasEntirelyFixedBackground(); 3236 if (hadFixedBackground != renderer. hasEntirelyFixedBackground()) {3236 if (hadFixedBackground != renderer.style().hasEntirelyFixedBackground()) { 3237 3237 setCompositingLayersNeedRebuild(); 3238 3238 scheduleCompositingLayerUpdate(); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r205920 r205927 63 63 #include "RenderScrollbarPart.h" 64 64 #include "RenderTableRow.h" 65 #include "RenderTableSection.h"66 65 #include "RenderTheme.h" 67 66 #include "RenderView.h" … … 908 907 return snappedIntRect(absoluteClippedOverflowRect()); 909 908 } 910 911 bool RenderObject::hasSelfPaintingLayer() const912 {913 if (!hasLayer())914 return false;915 auto* layer = downcast<RenderLayerModelObject>(*this).layer();916 if (!layer)917 return false;918 return layer->isSelfPaintingLayer();919 }920 909 921 bool RenderObject::checkForRepaintDuringLayout() const922 {923 return !document().view()->needsFullRepaint() && everHadLayout() && !hasSelfPaintingLayer();924 }925 926 910 LayoutRect RenderObject::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const 927 911 { … … 1375 1359 } 1376 1360 1377 bool RenderObject::hasOutlineAnnotation() const1378 {1379 return node() && node()->isLink() && document().printing();1380 }1381 1382 bool RenderObject::hasEntirelyFixedBackground() const1383 {1384 return style().hasEntirelyFixedBackground();1385 }1386 1387 1361 static inline RenderElement* containerForElement(const RenderObject& renderer, const RenderLayerModelObject* repaintContainer, bool* repaintContainerSkipped) 1388 1362 { … … 1539 1513 } 1540 1514 1541 static void collapseAnonymousTableRowsIfNeeded(const RenderObject& rendererToBeDestroyed)1542 {1543 if (!is<RenderTableRow>(rendererToBeDestroyed))1544 return;1545 1546 auto& rowToBeDestroyed = downcast<RenderTableRow>(rendererToBeDestroyed);1547 auto* section = downcast<RenderTableSection>(rowToBeDestroyed.parent());1548 if (!section)1549 return;1550 1551 // All siblings generated?1552 for (auto* current = section->firstRow(); current; current = current->nextRow()) {1553 if (current == &rendererToBeDestroyed)1554 continue;1555 if (!current->isAnonymous())1556 return;1557 }1558 1559 RenderTableRow* rowToInsertInto = nullptr;1560 auto* currentRow = section->firstRow();1561 while (currentRow) {1562 if (currentRow == &rendererToBeDestroyed) {1563 currentRow = currentRow->nextRow();1564 continue;1565 }1566 if (!rowToInsertInto) {1567 rowToInsertInto = currentRow;1568 currentRow = currentRow->nextRow();1569 continue;1570 }1571 currentRow->moveAllChildrenTo(rowToInsertInto);1572 auto* destroyThis = currentRow;1573 currentRow = currentRow->nextRow();1574 destroyThis->destroy();1575 }1576 if (rowToInsertInto)1577 rowToInsertInto->setNeedsLayout();1578 }1579 1580 1515 void RenderObject::destroyAndCleanupAnonymousWrappers() 1581 1516 { … … 1598 1533 destroyRootParent = destroyRootParent->parent(); 1599 1534 } 1600 collapseAnonymousTableRowsIfNeeded(*destroyRoot); 1535 1536 if (is<RenderTableRow>(*destroyRoot)) { 1537 downcast<RenderTableRow>(*destroyRoot).destroyAndCollapseAnonymousSiblingRows(); 1538 return; 1539 } 1540 1601 1541 destroyRoot->destroy(); 1602 1542 // WARNING: |this| is deleted here. -
trunk/Source/WebCore/rendering/RenderObject.h
r205551 r205927 462 462 463 463 bool hasLayer() const { return m_bitfields.hasLayer(); } 464 bool hasSelfPaintingLayer() const;465 464 466 465 enum BoxDecorationState { … … 472 471 bool hasVisibleBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; } 473 472 bool backgroundIsKnownToBeObscured(const LayoutPoint& paintOffset); 474 bool hasEntirelyFixedBackground() const;475 473 476 474 bool needsLayout() const … … 520 518 Document& document() const { return m_node.document(); } 521 519 Frame& frame() const; 522 523 bool hasOutlineAnnotation() const;524 bool hasOutline() const { return style().hasOutline() || hasOutlineAnnotation(); }525 520 526 521 // Returns the object containing this one. Can be different from parent for positioned elements. … … 677 672 // Repaint a slow repaint object, which, at this time, means we are repainting an object with background-attachment:fixed. 678 673 void repaintSlowRepaintObject() const; 679 680 bool checkForRepaintDuringLayout() const;681 674 682 675 // Returns the rect that should be repainted whenever this object changes. The rect is in the view's … … 736 729 737 730 virtual bool canBeSelectionLeaf() const { return false; } 738 bool hasSelectedChildren() const { return selectionState() != SelectionNone; }739 731 740 732 // Whether or not a given block needs to paint selection gaps. -
trunk/Source/WebCore/rendering/RenderTableRow.cpp
r203708 r205927 273 273 } 274 274 275 void RenderTableRow::destroyAndCollapseAnonymousSiblingRows() 276 { 277 auto collapseAnonymousSiblingRows = [&] { 278 auto* section = this->section(); 279 if (!section) 280 return; 281 282 // All siblings generated? 283 for (auto* current = section->firstRow(); current; current = current->nextRow()) { 284 if (current == this) 285 continue; 286 if (!current->isAnonymous()) 287 return; 288 } 289 290 RenderTableRow* rowToInsertInto = nullptr; 291 auto* currentRow = section->firstRow(); 292 while (currentRow) { 293 if (currentRow == this) { 294 currentRow = currentRow->nextRow(); 295 continue; 296 } 297 if (!rowToInsertInto) { 298 rowToInsertInto = currentRow; 299 currentRow = currentRow->nextRow(); 300 continue; 301 } 302 currentRow->moveAllChildrenTo(rowToInsertInto); 303 auto* destroyThis = currentRow; 304 currentRow = currentRow->nextRow(); 305 destroyThis->destroy(); 306 } 307 if (rowToInsertInto) 308 rowToInsertInto->setNeedsLayout(); 309 }; 310 311 collapseAnonymousSiblingRows(); 312 destroy(); 313 } 314 275 315 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderTableRow.h
r203708 r205927 63 63 64 64 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; 65 66 void destroyAndCollapseAnonymousSiblingRows(); 65 67 66 68 private: -
trunk/Source/WebCore/rendering/RenderView.cpp
r205818 r205927 1138 1138 return false; 1139 1139 1140 return rootObject->rendererForRootBackground(). hasEntirelyFixedBackground();1140 return rootObject->rendererForRootBackground().style().hasEntirelyFixedBackground(); 1141 1141 } 1142 1142
Note:
See TracChangeset
for help on using the changeset viewer.