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

Side by Side Diff: Source/core/layout/LayoutBoxModelObject.cpp

Issue 1212893005: Add position: sticky as supported position value when CSSStickyPosition is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 { 417 {
418 const ComputedStyle& styleToUse = styleRef(); 418 const ComputedStyle& styleToUse = styleRef();
419 setHasBoxDecorationBackground(calculateHasBoxDecorations()); 419 setHasBoxDecorationBackground(calculateHasBoxDecorations());
420 setInline(styleToUse.isDisplayInlineType()); 420 setInline(styleToUse.isDisplayInlineType());
421 setPositionState(styleToUse.position()); 421 setPositionState(styleToUse.position());
422 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); 422 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
423 } 423 }
424 424
425 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child) 425 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child)
426 { 426 {
427 if (!child->isAnonymousBlock() || !child->isRelPositioned()) 427 if (!child->isAnonymousBlock() || !child->isInFlowPositioned())
428 return LayoutSize(); 428 return LayoutSize();
429 LayoutSize offset; 429 LayoutSize offset;
430 LayoutObject* p = toLayoutBlock(child)->inlineElementContinuation(); 430 LayoutObject* p = toLayoutBlock(child)->inlineElementContinuation();
431 while (p && p->isLayoutInline()) { 431 while (p && p->isLayoutInline()) {
432 if (p->isRelPositioned()) { 432 if (p->isInFlowPositioned()) {
433 LayoutInline* layoutInline = toLayoutInline(p); 433 LayoutInline* layoutInline = toLayoutInline(p);
434 offset += layoutInline->offsetForInFlowPosition(); 434 offset += layoutInline->offsetForInFlowPosition();
435 } 435 }
436 p = p->parent(); 436 p = p->parent();
437 } 437 }
438 return offset; 438 return offset;
439 } 439 }
440 440
441 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const 441 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const
442 { 442 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // return the distance between the canvas origin and the left border edge 539 // return the distance between the canvas origin and the left border edge
540 // of the element and stop this algorithm. 540 // of the element and stop this algorithm.
541 Element* element = offsetParent(); 541 Element* element = offsetParent();
542 if (!element) 542 if (!element)
543 return referencePoint; 543 return referencePoint;
544 544
545 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { 545 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) {
546 if (offsetParent->isBox() && !offsetParent->isBody()) 546 if (offsetParent->isBox() && !offsetParent->isBody())
547 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); 547 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop());
548 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 548 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
549 if (isRelPositioned()) 549 if (isInFlowPositioned())
550 referencePoint.move(relativePositionOffset()); 550 referencePoint.move(relativePositionOffset());
551 551
552 LayoutObject* current; 552 LayoutObject* current;
553 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) { 553 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) {
554 // FIXME: What are we supposed to do inside SVG content? 554 // FIXME: What are we supposed to do inside SVG content?
555 if (!isOutOfFlowPositioned()) { 555 if (!isOutOfFlowPositioned()) {
556 if (current->isBox() && !current->isTableRow()) 556 if (current->isBox() && !current->isTableRow())
557 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion()); 557 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion());
558 referencePoint.move(current->parent()->columnOffset(referenc ePoint)); 558 referencePoint.move(current->parent()->columnOffset(referenc ePoint));
559 } 559 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 if (rootElementStyle->hasBackground()) 973 if (rootElementStyle->hasBackground())
974 return false; 974 return false;
975 975
976 if (node() != document().firstBodyElement()) 976 if (node() != document().firstBodyElement())
977 return false; 977 return false;
978 978
979 return true; 979 return true;
980 } 980 }
981 981
982 } // namespace blink 982 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698