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

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

Issue 1024023002: [New Multicolumn] mapAbsoluteToLocalPoint() needs to convert to flow thread coordinates. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); 781 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2);
782 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth, height) : LayoutRect(y, x, height, caretWidth); 782 return currentStyle.isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth, height) : LayoutRect(y, x, height, caretWidth);
783 } 783 }
784 784
785 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const 785 void LayoutBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, Tra nsformState& transformState) const
786 { 786 {
787 LayoutObject* o = container(); 787 LayoutObject* o = container();
788 if (!o) 788 if (!o)
789 return; 789 return;
790 790
791 if (o->isLayoutFlowThread())
792 transformState.move(o->columnOffset(LayoutPoint(transformState.mappedPoi nt())));
793
794 o->mapAbsoluteToLocalPoint(mode, transformState); 791 o->mapAbsoluteToLocalPoint(mode, transformState);
795 792
796 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint()); 793 LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
797 794
798 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { 795 if (o->isLayoutFlowThread()) {
796 // Descending into a flow thread. Convert to the local coordinate space, i.e. flow thread coordinates.
797 const LayoutFlowThread* flowThread = toLayoutFlowThread(o);
798 LayoutPoint visualPoint = LayoutPoint(transformState.mappedPoint());
799 transformState.move(visualPoint - flowThread->visualPointToFlowThreadPoi nt(visualPoint));
800 // |containerOffset| is also in visual coordinates. Convert to flow thre ad coordinates.
801 // TODO(mstensho): Wouldn't it be better add a parameter to instruct off setFromContainer()
Julien - ping for review 2015/03/25 21:41:32 What's preventing this change now? I was wondering
mstensho (USE GERRIT) 2015/03/25 22:35:05 offsetFromContainer() currently needs to perform t
Julien - ping for review 2015/03/26 15:38:56 It seems reasonable to let the callers do it. I se
802 // to return flowthread coordinates in the first place? We're effectivel y performing two
803 // conversions here, when in fact none is needed.
804 containerOffset = toLayoutSize(flowThread->visualPointToFlowThreadPoint( toLayoutPoint(containerOffset)));
805 } else if (!style()->hasOutOfFlowPosition() && o->hasColumns()) {
799 LayoutBlock* block = toLayoutBlock(o); 806 LayoutBlock* block = toLayoutBlock(o);
800 LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint())); 807 LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint()));
801 point -= containerOffset; 808 point -= containerOffset;
802 block->adjustForColumnRect(containerOffset, point); 809 block->adjustForColumnRect(containerOffset, point);
803 } 810 }
804 811
805 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D()); 812 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D());
806 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { 813 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) {
807 TransformationMatrix t; 814 TransformationMatrix t;
808 getTransformFromContainer(o, containerOffset, t); 815 getTransformFromContainer(o, containerOffset, t);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 888 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
882 for (LayoutObject* child = startChild; child && child != endChild; ) { 889 for (LayoutObject* child = startChild; child && child != endChild; ) {
883 // Save our next sibling as moveChildTo will clear it. 890 // Save our next sibling as moveChildTo will clear it.
884 LayoutObject* nextSibling = child->nextSibling(); 891 LayoutObject* nextSibling = child->nextSibling();
885 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 892 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
886 child = nextSibling; 893 child = nextSibling;
887 } 894 }
888 } 895 }
889 896
890 } // namespace blink 897 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698