Changeset 138291 in webkit
- Timestamp:
- Dec 20, 2012, 1:22:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r138290 r138291 1 2012-12-20 Huang Dongsung <luxtella@company100.net> 2 3 [TexMap] Remove ParentChange in TextureMapperLayer. 4 https://bugs.webkit.org/show_bug.cgi?id=105494 5 6 Reviewed by Noam Rosenthal. 7 8 ParentChange is useless, because ChildrenChange is enough. In addition, 9 GraphicsLayer uses setParent() method internally. This patch copies 10 GraphicsLayer::setChildren() into TextureMapperLayer::setChildren(). 11 12 No new tests. Covered by existing tests. 13 14 * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: 15 (WebCore): 16 (WebCore::GraphicsLayerTextureMapper::setChildren): 17 Match the similar style of replaceChild(). 18 * platform/graphics/texmap/GraphicsLayerTextureMapper.h: 19 (GraphicsLayerTextureMapper): 20 * platform/graphics/texmap/TextureMapperLayer.cpp: 21 (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly): 22 (WebCore::TextureMapperLayer::setChildren): 23 Copied from GraphicsLayer::setChildren(). 24 (WebCore): 25 (WebCore::TextureMapperLayer::addChild): 26 Copied from GraphicsLayer::addChild(). 27 (WebCore::TextureMapperLayer::removeFromParent): 28 Copied from GraphicsLayer::removeFromParent(). 29 (WebCore::TextureMapperLayer::removeAllChildren): 30 Copied from GraphicsLayer::removeAllChildren(). 31 * platform/graphics/texmap/TextureMapperLayer.h: 32 (TextureMapperLayer): 33 1 34 2012-12-20 Alec Flett <alecflett@chromium.org> 2 35 -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
r138234 r138291 121 121 /* \reimp (GraphicsLayer.h) 122 122 */ 123 void GraphicsLayerTextureMapper::setParent(GraphicsLayer* layer)124 {125 notifyChange(TextureMapperLayer::ParentChange);126 GraphicsLayer::setParent(layer);127 }128 129 /* \reimp (GraphicsLayer.h)130 */131 123 bool GraphicsLayerTextureMapper::setChildren(const Vector<GraphicsLayer*>& children) 132 124 { 133 notifyChange(TextureMapperLayer::ChildrenChange); 134 return GraphicsLayer::setChildren(children); 125 if (GraphicsLayer::setChildren(children)) { 126 notifyChange(TextureMapperLayer::ChildrenChange); 127 return true; 128 } 129 return false; 135 130 } 136 131 … … 176 171 } 177 172 return false; 178 }179 180 /* \reimp (GraphicsLayer.h)181 */182 void GraphicsLayerTextureMapper::removeFromParent()183 {184 if (!parent())185 return;186 notifyChange(TextureMapperLayer::ParentChange);187 GraphicsLayer::removeFromParent();188 173 } 189 174 -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
r137867 r138291 41 41 virtual void setContentsNeedsDisplay(); 42 42 virtual void setNeedsDisplayInRect(const FloatRect&); 43 virtual void setParent(GraphicsLayer* layer);44 43 virtual bool setChildren(const Vector<GraphicsLayer*>&); 45 44 virtual void addChild(GraphicsLayer*); … … 48 47 virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling); 49 48 virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); 50 virtual void removeFromParent();51 49 virtual void setMaskLayer(GraphicsLayer* layer); 52 50 virtual void setPosition(const FloatPoint& p); -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
r137867 r138291 375 375 graphicsLayer->updateDebugIndicators(); 376 376 377 if (changeMask & ParentChange) { 378 TextureMapperLayer* newParent = toTextureMapperLayer(graphicsLayer->parent()); 379 if (newParent != m_parent) { 380 // Remove layer from current from child list first. 381 if (m_parent) { 382 size_t index = m_parent->m_children.find(this); 383 m_parent->m_children.remove(index); 384 m_parent = 0; 385 } 386 // Set new layer parent and add layer to the parents child list. 387 if (newParent) { 388 m_parent = newParent; 389 m_parent->m_children.append(this); 390 } 391 } 392 } 393 394 if (changeMask & ChildrenChange) { 395 // Clear children parent pointer to avoid unsync and crash on layer delete. 396 for (size_t i = 0; i < m_children.size(); i++) 397 m_children[i]->m_parent = 0; 398 399 m_children.clear(); 400 for (size_t i = 0; i < graphicsLayer->children().size(); ++i) { 401 TextureMapperLayer* child = toTextureMapperLayer(graphicsLayer->children()[i]); 402 if (!child) 403 continue; 404 m_children.append(child); 405 child->m_parent = this; 406 } 407 } 377 if (changeMask & ChildrenChange) 378 setChildren(graphicsLayer->children()); 408 379 409 380 m_size = graphicsLayer->size(); … … 455 426 } 456 427 428 void TextureMapperLayer::setChildren(const Vector<GraphicsLayer*>& newChildren) 429 { 430 removeAllChildren(); 431 for (size_t i = 0; i < newChildren.size(); ++i) { 432 TextureMapperLayer* child = toTextureMapperLayer(newChildren[i]); 433 ASSERT(child); 434 addChild(child); 435 } 436 } 437 438 void TextureMapperLayer::addChild(TextureMapperLayer* childLayer) 439 { 440 ASSERT(childLayer != this); 441 442 if (childLayer->m_parent) 443 childLayer->removeFromParent(); 444 445 childLayer->m_parent = this; 446 m_children.append(childLayer); 447 } 448 449 void TextureMapperLayer::removeFromParent() 450 { 451 if (m_parent) { 452 unsigned i; 453 for (i = 0; i < m_parent->m_children.size(); i++) { 454 if (this == m_parent->m_children[i]) { 455 m_parent->m_children.remove(i); 456 break; 457 } 458 } 459 460 m_parent = 0; 461 } 462 } 463 464 void TextureMapperLayer::removeAllChildren() 465 { 466 while (m_children.size()) { 467 TextureMapperLayer* curLayer = m_children[0]; 468 ASSERT(curLayer->m_parent); 469 curLayer->removeFromParent(); 470 } 471 } 472 473 457 474 bool TextureMapperLayer::descendantsOrSelfHaveRunningAnimations() const 458 475 { -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
r137867 r138291 58 58 NoChanges = 0, 59 59 60 ParentChange = (1L << 0),61 60 ChildrenChange = (1L << 1), 62 61 MaskLayerChange = (1L << 2), … … 138 137 FloatPoint adjustedPosition() const { return m_state.pos + m_scrollPositionDelta; } 139 138 bool isAncestorFixedToViewport() const; 139 140 void setChildren(const Vector<GraphicsLayer*>&); 141 void addChild(TextureMapperLayer*); 142 void removeFromParent(); 143 void removeAllChildren(); 140 144 141 145 void paintRecursive(const TextureMapperPaintOptions&);
Note:
See TracChangeset
for help on using the changeset viewer.