Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Side by Side Diff: Source/core/rendering/svg/RenderSVGRoot.cpp

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/RenderSVGShape.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 setNeedsBoundariesUpdate(); 227 setNeedsBoundariesUpdate();
228 if (diff.needsPaintInvalidation()) { 228 if (diff.needsPaintInvalidation()) {
229 // Box decorations may have appeared/disappeared - recompute status. 229 // Box decorations may have appeared/disappeared - recompute status.
230 m_hasBoxDecorationBackground = calculateHasBoxDecorations(); 230 m_hasBoxDecorationBackground = calculateHasBoxDecorations();
231 } 231 }
232 232
233 RenderReplaced::styleDidChange(diff, oldStyle); 233 RenderReplaced::styleDidChange(diff, oldStyle);
234 SVGResourcesCache::clientStyleChanged(this, diff, style()); 234 SVGResourcesCache::clientStyleChanged(this, diff, style());
235 } 235 }
236 236
237 bool RenderSVGRoot::isChildAllowed(RenderObject* child, const RenderStyle&) cons t 237 bool RenderSVGRoot::isChildAllowed(LayoutObject* child, const RenderStyle&) cons t
238 { 238 {
239 return child->isSVG() && !(child->isSVGInline() || child->isSVGInlineText()) ; 239 return child->isSVG() && !(child->isSVGInline() || child->isSVGInlineText()) ;
240 } 240 }
241 241
242 void RenderSVGRoot::addChild(RenderObject* child, RenderObject* beforeChild) 242 void RenderSVGRoot::addChild(LayoutObject* child, LayoutObject* beforeChild)
243 { 243 {
244 RenderReplaced::addChild(child, beforeChild); 244 RenderReplaced::addChild(child, beforeChild);
245 SVGResourcesCache::clientWasAddedToTree(child, child->style()); 245 SVGResourcesCache::clientWasAddedToTree(child, child->style());
246 246
247 bool shouldIsolateDescendants = (child->isBlendingAllowed() && child->style( )->hasBlendMode()) || child->hasNonIsolatedBlendingDescendants(); 247 bool shouldIsolateDescendants = (child->isBlendingAllowed() && child->style( )->hasBlendMode()) || child->hasNonIsolatedBlendingDescendants();
248 if (shouldIsolateDescendants) 248 if (shouldIsolateDescendants)
249 descendantIsolationRequirementsChanged(DescendantIsolationRequired); 249 descendantIsolationRequirementsChanged(DescendantIsolationRequired);
250 } 250 }
251 251
252 void RenderSVGRoot::removeChild(RenderObject* child) 252 void RenderSVGRoot::removeChild(LayoutObject* child)
253 { 253 {
254 SVGResourcesCache::clientWillBeRemovedFromTree(child); 254 SVGResourcesCache::clientWillBeRemovedFromTree(child);
255 RenderReplaced::removeChild(child); 255 RenderReplaced::removeChild(child);
256 256
257 bool hadNonIsolatedDescendants = (child->isBlendingAllowed() && child->style ()->hasBlendMode()) || child->hasNonIsolatedBlendingDescendants(); 257 bool hadNonIsolatedDescendants = (child->isBlendingAllowed() && child->style ()->hasBlendMode()) || child->hasNonIsolatedBlendingDescendants();
258 if (hadNonIsolatedDescendants) 258 if (hadNonIsolatedDescendants)
259 descendantIsolationRequirementsChanged(DescendantIsolationNeedsUpdate); 259 descendantIsolationRequirementsChanged(DescendantIsolationNeedsUpdate);
260 } 260 }
261 261
262 bool RenderSVGRoot::hasNonIsolatedBlendingDescendants() const 262 bool RenderSVGRoot::hasNonIsolatedBlendingDescendants() const
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void RenderSVGRoot::mapLocalToContainer(const LayoutLayerModelObject* paintInval idationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool * wasFixed, const PaintInvalidationState* paintInvalidationState) const 372 void RenderSVGRoot::mapLocalToContainer(const LayoutLayerModelObject* paintInval idationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool * wasFixed, const PaintInvalidationState* paintInvalidationState) const
373 { 373 {
374 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree. 374 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree.
375 // We used to have this ASSERT here, but we removed it when enabling layer s quashing. 375 // We used to have this ASSERT here, but we removed it when enabling layer s quashing.
376 // See http://crbug.com/364901 376 // See http://crbug.com/364901
377 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless. 377 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless.
378 378
379 RenderReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); 379 RenderReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState);
380 } 380 }
381 381
382 const RenderObject* RenderSVGRoot::pushMappingToContainer(const LayoutLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const 382 const LayoutObject* RenderSVGRoot::pushMappingToContainer(const LayoutLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const
383 { 383 {
384 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ; 384 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ;
385 } 385 }
386 386
387 void RenderSVGRoot::updateCachedBoundaries() 387 void RenderSVGRoot::updateCachedBoundaries()
388 { 388 {
389 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox); 389 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox);
390 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox); 390 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
391 } 391 }
392 392
393 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, HitTestAction hitTestAction) 393 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, HitTestAction hitTestAction)
394 { 394 {
395 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum ulatedOffset); 395 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum ulatedOffset);
396 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); 396 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());
397 397
398 // Only test SVG content if the point is in our content box, or in case we 398 // Only test SVG content if the point is in our content box, or in case we
399 // don't clip to the viewport, the visual overflow rect. 399 // don't clip to the viewport, the visual overflow rect.
400 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint. 400 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint.
401 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) { 401 if (contentBoxRect().contains(pointInBorderBox) || (!shouldApplyViewportClip () && visualOverflowRect().contains(pointInBorderBox))) {
402 const AffineTransform& localToParentTransform = this->localToParentTrans form(); 402 const AffineTransform& localToParentTransform = this->localToParentTrans form();
403 if (localToParentTransform.isInvertible()) { 403 if (localToParentTransform.isInvertible()) {
404 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent)); 404 FloatPoint localPoint = localToParentTransform.inverse().mapPoint(Fl oatPoint(pointInParent));
405 405
406 for (RenderObject* child = lastChild(); child; child = child->previo usSibling()) { 406 for (LayoutObject* child = lastChild(); child; child = child->previo usSibling()) {
407 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. 407 // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet.
408 if (child->nodeAtFloatPoint(request, result, localPoint, hitTest Action)) { 408 if (child->nodeAtFloatPoint(request, result, localPoint, hitTest Action)) {
409 updateHitTestResult(result, pointInBorderBox); 409 updateHitTestResult(result, pointInBorderBox);
410 if (!result.addNodeToRectBasedTestResult(child->node(), requ est, locationInContainer)) 410 if (!result.addNodeToRectBasedTestResult(child->node(), requ est, locationInContainer))
411 return true; 411 return true;
412 } 412 }
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417 // If we didn't early exit above, we've just hit the container <svg> element . Unlike SVG 1.1, 2nd Edition allows container elements to be hit. 417 // If we didn't early exit above, we've just hit the container <svg> element . Unlike SVG 1.1, 2nd Edition allows container elements to be hit.
418 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(request)) { 418 if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChil dBlockBackground) && visibleToHitTestRequest(request)) {
419 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed. 419 // Only return true here, if the last hit testing phase 'BlockBackground ' (or 'ChildBlockBackground' - depending on context) is executed.
420 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter. 420 // If we'd return true in the 'Foreground' phase, hit testing would stop immediately. For SVG only trees this doesn't matter.
421 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element. 421 // Though when we have a <foreignObject> subtree we need to be able to d etect hits on the background of a <div> element.
422 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore. 422 // If we'd return true here in the 'Foreground' phase, we are not able t o detect these hits anymore.
423 LayoutRect boundsRect(accumulatedOffset + location(), size()); 423 LayoutRect boundsRect(accumulatedOffset + location(), size());
424 if (locationInContainer.intersects(boundsRect)) { 424 if (locationInContainer.intersects(boundsRect)) {
425 updateHitTestResult(result, pointInBorderBox); 425 updateHitTestResult(result, pointInBorderBox);
426 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 426 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect))
427 return true; 427 return true;
428 } 428 }
429 } 429 }
430 430
431 return false; 431 return false;
432 } 432 }
433 433
434 } 434 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/RenderSVGShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698