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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 24278008: [oilpan] Handlify Nodes in htmlediting (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 3 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, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
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 3969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 3980
3981 if (extraWidthToEndOfLine) 3981 if (extraWidthToEndOfLine)
3982 *extraWidthToEndOfLine = x() + width() - rect.maxX(); 3982 *extraWidthToEndOfLine = x() + width() - rect.maxX();
3983 3983
3984 // Move to local coords 3984 // Move to local coords
3985 rect.moveBy(-location()); 3985 rect.moveBy(-location());
3986 3986
3987 // FIXME: Border/padding should be added for all elements but this workaroun d 3987 // FIXME: Border/padding should be added for all elements but this workaroun d
3988 // is needed because we use offsets inside an "atomic" element to represent 3988 // is needed because we use offsets inside an "atomic" element to represent
3989 // positions before and after the element in deprecated editing offsets. 3989 // positions before and after the element in deprecated editing offsets.
3990 if (node() && !(editingIgnoresContent(node().handle().raw()) || isTableEleme nt(node().handle().raw()))) { 3990 if (node() && !(editingIgnoresContent(node()) || isTableElement(node()))) {
3991 rect.setX(rect.x() + borderLeft() + paddingLeft()); 3991 rect.setX(rect.x() + borderLeft() + paddingLeft());
3992 rect.setY(rect.y() + paddingTop() + borderTop()); 3992 rect.setY(rect.y() + paddingTop() + borderTop());
3993 } 3993 }
3994 3994
3995 if (!isHorizontalWritingMode()) 3995 if (!isHorizontalWritingMode())
3996 return rect.transposedRect(); 3996 return rect.transposedRect();
3997 3997
3998 return rect; 3998 return rect;
3999 } 3999 }
4000 4000
4001 VisiblePosition RenderBox::positionForPoint(const LayoutPoint& point) 4001 VisiblePosition RenderBox::positionForPoint(const LayoutPoint& point)
4002 { 4002 {
4003 // no children...return this render object's element, if there is one, and o ffset 0 4003 // no children...return this render object's element, if there is one, and o ffset 0
4004 if (!firstChild()) 4004 if (!firstChild())
4005 return createVisiblePosition(nonPseudoNode() ? firstPositionInOrBeforeNo de(nonPseudoNode().handle().raw()) : Position()); 4005 return createVisiblePosition(nonPseudoNode() ? firstPositionInOrBeforeNo de(nonPseudoNode()) : Position());
4006 4006
4007 if (isTable() && nonPseudoNode()) { 4007 if (isTable() && nonPseudoNode()) {
4008 LayoutUnit right = contentWidth() + borderAndPaddingWidth(); 4008 LayoutUnit right = contentWidth() + borderAndPaddingWidth();
4009 LayoutUnit bottom = contentHeight() + borderAndPaddingHeight(); 4009 LayoutUnit bottom = contentHeight() + borderAndPaddingHeight();
4010 4010
4011 if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > b ottom) { 4011 if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > b ottom) {
4012 if (point.x() <= right / 2) 4012 if (point.x() <= right / 2)
4013 return createVisiblePosition(firstPositionInOrBeforeNode(nonPseu doNode().handle().raw())); 4013 return createVisiblePosition(firstPositionInOrBeforeNode(nonPseu doNode()));
4014 return createVisiblePosition(lastPositionInOrAfterNode(nonPseudoNode ().handle().raw())); 4014 return createVisiblePosition(lastPositionInOrAfterNode(nonPseudoNode ()));
4015 } 4015 }
4016 } 4016 }
4017 4017
4018 // Pass off to the closest child. 4018 // Pass off to the closest child.
4019 LayoutUnit minDist = LayoutUnit::max(); 4019 LayoutUnit minDist = LayoutUnit::max();
4020 RenderBox* closestRenderer = 0; 4020 RenderBox* closestRenderer = 0;
4021 LayoutPoint adjustedPoint = point; 4021 LayoutPoint adjustedPoint = point;
4022 if (isTableRow()) 4022 if (isTableRow())
4023 adjustedPoint.moveBy(location()); 4023 adjustedPoint.moveBy(location());
4024 4024
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4072 LayoutUnit dist = difference.width() * difference.width() + difference.h eight() * difference.height(); 4072 LayoutUnit dist = difference.width() * difference.width() + difference.h eight() * difference.height();
4073 if (dist < minDist) { 4073 if (dist < minDist) {
4074 closestRenderer = renderer; 4074 closestRenderer = renderer;
4075 minDist = dist; 4075 minDist = dist;
4076 } 4076 }
4077 } 4077 }
4078 4078
4079 if (closestRenderer) 4079 if (closestRenderer)
4080 return closestRenderer->positionForPoint(adjustedPoint - closestRenderer ->locationOffset()); 4080 return closestRenderer->positionForPoint(adjustedPoint - closestRenderer ->locationOffset());
4081 4081
4082 return createVisiblePosition(firstPositionInOrBeforeNode(nonPseudoNode().han dle().raw())); 4082 return createVisiblePosition(firstPositionInOrBeforeNode(nonPseudoNode()));
4083 } 4083 }
4084 4084
4085 bool RenderBox::shrinkToAvoidFloats() const 4085 bool RenderBox::shrinkToAvoidFloats() const
4086 { 4086 {
4087 // Floating objects don't shrink. Objects that don't avoid floats don't shr ink. Marquees don't shrink. 4087 // Floating objects don't shrink. Objects that don't avoid floats don't shr ink. Marquees don't shrink.
4088 if ((isInline() && !isHTMLMarquee()) || !avoidsFloats() || isFloating()) 4088 if ((isInline() && !isHTMLMarquee()) || !avoidsFloats() || isFloating())
4089 return false; 4089 return false;
4090 4090
4091 // Only auto width objects can possibly shrink to avoid floats. 4091 // Only auto width objects can possibly shrink to avoid floats.
4092 return style()->width().isAuto(); 4092 return style()->width().isAuto();
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
4605 4605
4606 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) 4606 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation)
4607 { 4607 {
4608 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); 4608 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures);
4609 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); 4609 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures);
4610 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); 4610 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures);
4611 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); 4611 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures);
4612 } 4612 }
4613 4613
4614 } // namespace WebCore 4614 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698