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

Side by Side Diff: sky/engine/core/rendering/RenderObject.cpp

Issue 686633002: First pass at removing position:fixed. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.cpp » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 615
616 o->m_bitfields.setPreferredLogicalWidthsDirty(true); 616 o->m_bitfields.setPreferredLogicalWidthsDirty(true);
617 if (o->style()->hasOutOfFlowPosition()) 617 if (o->style()->hasOutOfFlowPosition())
618 // A positioned object has no effect on the min/max width of its con taining block ever. 618 // A positioned object has no effect on the min/max width of its con taining block ever.
619 // We can optimize this case and not go up any further. 619 // We can optimize this case and not go up any further.
620 break; 620 break;
621 o = container; 621 o = container;
622 } 622 }
623 } 623 }
624 624
625 RenderBlock* RenderObject::containerForFixedPosition(const RenderLayerModelObjec t* paintInvalidationContainer, bool* paintInvalidationContainerSkipped) const
626 {
627 ASSERT(!paintInvalidationContainerSkipped || !*paintInvalidationContainerSki pped);
628 ASSERT(!isText());
629 ASSERT(style()->position() == FixedPosition);
630
631 RenderObject* ancestor = parent();
632 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) {
633 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer)
634 *paintInvalidationContainerSkipped = true;
635 }
636
637 ASSERT(!ancestor || !ancestor->isAnonymousBlock());
638 return toRenderBlock(ancestor);
639 }
640
641 RenderBlock* RenderObject::containingBlock() const 625 RenderBlock* RenderObject::containingBlock() const
642 { 626 {
643 RenderObject* o = parent(); 627 RenderObject* o = parent();
644 if (!isText() && m_style->position() == FixedPosition) { 628 if (!isText() && m_style->position() == AbsolutePosition) {
645 return containerForFixedPosition();
646 } else if (!isText() && m_style->position() == AbsolutePosition) {
647 while (o) { 629 while (o) {
648 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try 630 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try
649 // to return the inline itself. This allows us to avoid having a po sitioned objects 631 // to return the inline itself. This allows us to avoid having a po sitioned objects
650 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result 632 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result
651 // from this method. The container() method can actually be used to obtain the 633 // from this method. The container() method can actually be used to obtain the
652 // inline directly. 634 // inline directly.
653 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced())) 635 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced()))
654 break; 636 break;
655 637
656 if (o->canContainFixedPositionObjects()) 638 if (o->canContainFixedPositionObjects())
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 // (3) For absolute positioned elements, it will return a relative positione d inline. 2275 // (3) For absolute positioned elements, it will return a relative positione d inline.
2294 // containingBlock() simply skips relpositioned inlines and lets an enclosin g block handle 2276 // containingBlock() simply skips relpositioned inlines and lets an enclosin g block handle
2295 // the layout of the positioned object. This does mean that computePosition edLogicalWidth and 2277 // the layout of the positioned object. This does mean that computePosition edLogicalWidth and
2296 // computePositionedLogicalHeight have to use container(). 2278 // computePositionedLogicalHeight have to use container().
2297 RenderObject* o = parent(); 2279 RenderObject* o = parent();
2298 2280
2299 if (isText()) 2281 if (isText())
2300 return o; 2282 return o;
2301 2283
2302 EPosition pos = m_style->position(); 2284 EPosition pos = m_style->position();
2303 if (pos == FixedPosition) { 2285 if (pos == AbsolutePosition) {
2304 return containerForFixedPosition(paintInvalidationContainer, paintInvali dationContainerSkipped);
2305 } else if (pos == AbsolutePosition) {
2306 // We technically just want our containing block, but 2286 // We technically just want our containing block, but
2307 // we may not have one if we're part of an uninstalled 2287 // we may not have one if we're part of an uninstalled
2308 // subtree. We'll climb as high as we can though. 2288 // subtree. We'll climb as high as we can though.
2309 while (o) { 2289 while (o) {
2310 if (o->style()->position() != StaticPosition) 2290 if (o->style()->position() != StaticPosition)
2311 break; 2291 break;
2312 2292
2313 if (o->canContainFixedPositionObjects()) 2293 if (o->canContainFixedPositionObjects())
2314 break; 2294 break;
2315 2295
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect) 2657 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect)
2678 { 2658 {
2679 imageChanged(static_cast<WrappedImagePtr>(image), rect); 2659 imageChanged(static_cast<WrappedImagePtr>(image), rect);
2680 } 2660 }
2681 2661
2682 Element* RenderObject::offsetParent() const 2662 Element* RenderObject::offsetParent() const
2683 { 2663 {
2684 if (isDocumentElement()) 2664 if (isDocumentElement())
2685 return 0; 2665 return 0;
2686 2666
2687 if (isOutOfFlowPositioned() && style()->position() == FixedPosition)
2688 return 0;
2689
2690 // If A is an area HTML element which has a map HTML element somewhere in th e ancestor 2667 // If A is an area HTML element which has a map HTML element somewhere in th e ancestor
2691 // chain return the nearest ancestor map HTML element and stop this algorith m. 2668 // chain return the nearest ancestor map HTML element and stop this algorith m.
2692 // FIXME: Implement! 2669 // FIXME: Implement!
2693 2670
2694 float effectiveZoom = style()->effectiveZoom(); 2671 float effectiveZoom = style()->effectiveZoom();
2695 Node* node = 0; 2672 Node* node = 0;
2696 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { 2673 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) {
2697 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes 2674 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes
2698 2675
2699 node = ancestor->node(); 2676 node = ancestor->node();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 { 2888 {
2912 if (object1) { 2889 if (object1) {
2913 const blink::RenderObject* root = object1; 2890 const blink::RenderObject* root = object1;
2914 while (root->parent()) 2891 while (root->parent())
2915 root = root->parent(); 2892 root = root->parent();
2916 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2893 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2917 } 2894 }
2918 } 2895 }
2919 2896
2920 #endif 2897 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698