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

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

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (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/layout/LayoutBox.cpp ('k') | Source/core/layout/LayoutEmbeddedObject.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) 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 { 280 {
281 for (LayoutObject* current = slowFirstChild(); current; current = current->n extSibling()) { 281 for (LayoutObject* current = slowFirstChild(); current; current = current->n extSibling()) {
282 if (current->isText() || current->isListMarker()) 282 if (current->isText() || current->isListMarker())
283 continue; 283 continue;
284 284
285 if (!current->isBox()) { 285 if (!current->isBox()) {
286 current->addFocusRingRects(rects, additionalOffset); 286 current->addFocusRingRects(rects, additionalOffset);
287 continue; 287 continue;
288 } 288 }
289 289
290 RenderBox* box = toRenderBox(current); 290 LayoutBox* box = toLayoutBox(current);
291 if (!box->hasLayer()) { 291 if (!box->hasLayer()) {
292 box->addFocusRingRects(rects, additionalOffset + box->locationOffset ()); 292 box->addFocusRingRects(rects, additionalOffset + box->locationOffset ());
293 continue; 293 continue;
294 } 294 }
295 295
296 Vector<LayoutRect> layerFocusRingRects; 296 Vector<LayoutRect> layerFocusRingRects;
297 box->addFocusRingRects(layerFocusRingRects, LayoutPoint()); 297 box->addFocusRingRects(layerFocusRingRects, LayoutPoint());
298 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { 298 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) {
299 FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(layerFocus RingRects[i]), this); 299 FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(layerFocus RingRects[i]), this);
300 LayoutRect rect = LayoutRect(quadInBox.boundingBox()); 300 LayoutRect rect = LayoutRect(quadInBox.boundingBox());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'. 345 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'.
346 if (!logicalHeight.isPercent() || isOutOfFlowPositioned()) 346 if (!logicalHeight.isPercent() || isOutOfFlowPositioned())
347 return 0; 347 return 0;
348 348
349 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: 349 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it:
350 // the closest non-anonymous ancestor box is used instead. 350 // the closest non-anonymous ancestor box is used instead.
351 RenderBlock* cb = containingBlock(); 351 RenderBlock* cb = containingBlock();
352 while (cb->isAnonymous()) 352 while (cb->isAnonymous())
353 cb = cb->containingBlock(); 353 cb = cb->containingBlock();
354 354
355 // Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by 355 // Matching LayoutBox::percentageLogicalHeightIsResolvableFromBlock() by
356 // ignoring table cell's attribute value, where it says that table cells vio late 356 // ignoring table cell's attribute value, where it says that table cells vio late
357 // what the CSS spec says to do with heights. Basically we 357 // what the CSS spec says to do with heights. Basically we
358 // don't care if the cell specified a height or not. 358 // don't care if the cell specified a height or not.
359 if (cb->isTableCell()) 359 if (cb->isTableCell())
360 return 0; 360 return 0;
361 361
362 // Match RenderBox::availableLogicalHeightUsing by special casing 362 // Match LayoutBox::availableLogicalHeightUsing by special casing
363 // the render view. The available height is taken from the frame. 363 // the render view. The available height is taken from the frame.
364 if (cb->isRenderView()) 364 if (cb->isRenderView())
365 return 0; 365 return 0;
366 366
367 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c b->style()->logicalBottom().isAuto()) 367 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c b->style()->logicalBottom().isAuto())
368 return 0; 368 return 0;
369 369
370 return cb; 370 return cb;
371 } 371 }
372 372
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 // If the offsetParent of the element is null, or is the HTML body element, 438 // If the offsetParent of the element is null, or is the HTML body element,
439 // return the distance between the canvas origin and the left border edge 439 // return the distance between the canvas origin and the left border edge
440 // of the element and stop this algorithm. 440 // of the element and stop this algorithm.
441 Element* element = offsetParent(); 441 Element* element = offsetParent();
442 if (!element) 442 if (!element)
443 return referencePoint; 443 return referencePoint;
444 444
445 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { 445 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) {
446 if (offsetParent->isBox() && !offsetParent->isBody()) 446 if (offsetParent->isBox() && !offsetParent->isBody())
447 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen derBox(offsetParent)->borderTop()); 447 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop());
448 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 448 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
449 if (isRelPositioned()) 449 if (isRelPositioned())
450 referencePoint.move(relativePositionOffset()); 450 referencePoint.move(relativePositionOffset());
451 451
452 LayoutObject* current; 452 LayoutObject* current;
453 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) { 453 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) {
454 // FIXME: What are we supposed to do inside SVG content? 454 // FIXME: What are we supposed to do inside SVG content?
455 if (!isOutOfFlowPositioned()) { 455 if (!isOutOfFlowPositioned()) {
456 if (current->isBox() && !current->isTableRow()) 456 if (current->isBox() && !current->isTableRow())
457 referencePoint.moveBy(toRenderBox(current)->topLeftLocat ion()); 457 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion());
458 referencePoint.move(current->parent()->columnOffset(referenc ePoint)); 458 referencePoint.move(current->parent()->columnOffset(referenc ePoint));
459 } 459 }
460 } 460 }
461 461
462 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned()) 462 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned())
463 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation ()); 463 referencePoint.moveBy(toLayoutBox(offsetParent)->topLeftLocation ());
464 } 464 }
465 } 465 }
466 466
467 return referencePoint; 467 return referencePoint;
468 } 468 }
469 469
470 LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const 470 LayoutSize LayoutBoxModelObject::offsetForInFlowPosition() const
471 { 471 {
472 return isRelPositioned() ? relativePositionOffset() : LayoutSize(); 472 return isRelPositioned() ? relativePositionOffset() : LayoutSize();
473 } 473 }
474 474
475 LayoutUnit LayoutBoxModelObject::offsetLeft() const 475 LayoutUnit LayoutBoxModelObject::offsetLeft() const
476 { 476 {
477 // Note that RenderInline and RenderBox override this to pass a different 477 // Note that RenderInline and LayoutBox override this to pass a different
478 // startPoint to adjustedPositionRelativeToOffsetParent. 478 // startPoint to adjustedPositionRelativeToOffsetParent.
479 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x(); 479 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).x();
480 } 480 }
481 481
482 LayoutUnit LayoutBoxModelObject::offsetTop() const 482 LayoutUnit LayoutBoxModelObject::offsetTop() const
483 { 483 {
484 // Note that RenderInline and RenderBox override this to pass a different 484 // Note that RenderInline and LayoutBox override this to pass a different
485 // startPoint to adjustedPositionRelativeToOffsetParent. 485 // startPoint to adjustedPositionRelativeToOffsetParent.
486 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y(); 486 return adjustedPositionRelativeToOffsetParent(LayoutPoint()).y();
487 } 487 }
488 488
489 int LayoutBoxModelObject::pixelSnappedOffsetWidth() const 489 int LayoutBoxModelObject::pixelSnappedOffsetWidth() const
490 { 490 {
491 return snapSizeToPixel(offsetWidth(), offsetLeft()); 491 return snapSizeToPixel(offsetWidth(), offsetLeft());
492 } 492 }
493 493
494 int LayoutBoxModelObject::pixelSnappedOffsetHeight() const 494 int LayoutBoxModelObject::pixelSnappedOffsetHeight() const
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 850 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
851 for (LayoutObject* child = startChild; child && child != endChild; ) { 851 for (LayoutObject* child = startChild; child && child != endChild; ) {
852 // Save our next sibling as moveChildTo will clear it. 852 // Save our next sibling as moveChildTo will clear it.
853 LayoutObject* nextSibling = child->nextSibling(); 853 LayoutObject* nextSibling = child->nextSibling();
854 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 854 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
855 child = nextSibling; 855 child = nextSibling;
856 } 856 }
857 } 857 }
858 858
859 } // namespace blink 859 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | Source/core/layout/LayoutEmbeddedObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698