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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2610253004: Migrate WTF::Vector::append() to ::push_back() [part 9 of N] (Closed)
Patch Set: rebase Created 3 years, 11 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 2429
2430 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { 2430 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
2431 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->y()); 2431 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->y());
2432 LayoutUnit bottom = 2432 LayoutUnit bottom =
2433 std::min<LayoutUnit>(curr->lineBottom(), curr->y() + curr->height()); 2433 std::min<LayoutUnit>(curr->lineBottom(), curr->y() + curr->height());
2434 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top, 2434 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top,
2435 curr->width(), bottom - top); 2435 curr->width(), bottom - top);
2436 // It's common for this rect to be entirely contained in our box, so exclude 2436 // It's common for this rect to be entirely contained in our box, so exclude
2437 // that simple case. 2437 // that simple case.
2438 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))) 2438 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect)))
2439 rects.append(rect); 2439 rects.push_back(rect);
2440 } 2440 }
2441 } 2441 }
2442 2442
2443 void LayoutBlockFlow::absoluteRects( 2443 void LayoutBlockFlow::absoluteRects(
2444 Vector<IntRect>& rects, 2444 Vector<IntRect>& rects,
2445 const LayoutPoint& accumulatedOffset) const { 2445 const LayoutPoint& accumulatedOffset) const {
2446 if (!isAnonymousBlockContinuation()) { 2446 if (!isAnonymousBlockContinuation()) {
2447 LayoutBlock::absoluteRects(rects, accumulatedOffset); 2447 LayoutBlock::absoluteRects(rects, accumulatedOffset);
2448 return; 2448 return;
2449 } 2449 }
2450 // For blocks inside inlines, we go ahead and include margins so that we run 2450 // For blocks inside inlines, we go ahead and include margins so that we run
2451 // right up to the inline boxes above and below us (thus getting merged with 2451 // right up to the inline boxes above and below us (thus getting merged with
2452 // them to form a single irregular shape). 2452 // them to form a single irregular shape).
2453 // FIXME: This is wrong for vertical writing-modes. 2453 // FIXME: This is wrong for vertical writing-modes.
2454 // https://bugs.webkit.org/show_bug.cgi?id=46781 2454 // https://bugs.webkit.org/show_bug.cgi?id=46781
2455 LayoutRect rect(accumulatedOffset, size()); 2455 LayoutRect rect(accumulatedOffset, size());
2456 rect.expand(collapsedMarginBoxLogicalOutsets()); 2456 rect.expand(collapsedMarginBoxLogicalOutsets());
2457 rects.append(pixelSnappedIntRect(rect)); 2457 rects.push_back(pixelSnappedIntRect(rect));
2458 continuation()->absoluteRects( 2458 continuation()->absoluteRects(
2459 rects, 2459 rects,
2460 accumulatedOffset - 2460 accumulatedOffset -
2461 toLayoutSize( 2461 toLayoutSize(
2462 location() + 2462 location() +
2463 inlineElementContinuation()->containingBlock()->location())); 2463 inlineElementContinuation()->containingBlock()->location()));
2464 } 2464 }
2465 2465
2466 void LayoutBlockFlow::absoluteQuads(Vector<FloatQuad>& quads, 2466 void LayoutBlockFlow::absoluteQuads(Vector<FloatQuad>& quads,
2467 MapCoordinatesFlags mode) const { 2467 MapCoordinatesFlags mode) const {
2468 if (!isAnonymousBlockContinuation()) { 2468 if (!isAnonymousBlockContinuation()) {
2469 LayoutBlock::absoluteQuads(quads, mode); 2469 LayoutBlock::absoluteQuads(quads, mode);
2470 return; 2470 return;
2471 } 2471 }
2472 LayoutBoxModelObject::absoluteQuads(quads, mode); 2472 LayoutBoxModelObject::absoluteQuads(quads, mode);
2473 } 2473 }
2474 2474
2475 void LayoutBlockFlow::absoluteQuadsForSelf(Vector<FloatQuad>& quads, 2475 void LayoutBlockFlow::absoluteQuadsForSelf(Vector<FloatQuad>& quads,
2476 MapCoordinatesFlags mode) const { 2476 MapCoordinatesFlags mode) const {
2477 // For blocks inside inlines, we go ahead and include margins so that we run 2477 // For blocks inside inlines, we go ahead and include margins so that we run
2478 // right up to the inline boxes above and below us (thus getting merged with 2478 // right up to the inline boxes above and below us (thus getting merged with
2479 // them to form a single irregular shape). 2479 // them to form a single irregular shape).
2480 // FIXME: This is wrong for vertical writing-modes. 2480 // FIXME: This is wrong for vertical writing-modes.
2481 // https://bugs.webkit.org/show_bug.cgi?id=46781 2481 // https://bugs.webkit.org/show_bug.cgi?id=46781
2482 LayoutRect localRect(LayoutPoint(), size()); 2482 LayoutRect localRect(LayoutPoint(), size());
2483 localRect.expand(collapsedMarginBoxLogicalOutsets()); 2483 localRect.expand(collapsedMarginBoxLogicalOutsets());
2484 quads.append(localToAbsoluteQuad(FloatRect(localRect), mode)); 2484 quads.push_back(localToAbsoluteQuad(FloatRect(localRect), mode));
2485 } 2485 }
2486 2486
2487 LayoutObject* LayoutBlockFlow::hoverAncestor() const { 2487 LayoutObject* LayoutBlockFlow::hoverAncestor() const {
2488 return isAnonymousBlockContinuation() ? continuation() 2488 return isAnonymousBlockContinuation() ? continuation()
2489 : LayoutBlock::hoverAncestor(); 2489 : LayoutBlock::hoverAncestor();
2490 } 2490 }
2491 2491
2492 RootInlineBox* LayoutBlockFlow::createAndAppendRootInlineBox() { 2492 RootInlineBox* LayoutBlockFlow::createAndAppendRootInlineBox() {
2493 RootInlineBox* rootBox = createRootInlineBox(); 2493 RootInlineBox* rootBox = createRootInlineBox();
2494 m_lineBoxes.appendLineBox(rootBox); 2494 m_lineBoxes.appendLineBox(rootBox);
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 return; 3258 return;
3259 // We are only interested in removing anonymous wrappers if there are inline 3259 // We are only interested in removing anonymous wrappers if there are inline
3260 // siblings underneath them. 3260 // siblings underneath them.
3261 if (!child->childrenInline()) 3261 if (!child->childrenInline())
3262 return; 3262 return;
3263 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by 3263 // Ruby elements use anonymous wrappers for ruby runs and ruby bases by
3264 // design, so we don't remove them. 3264 // design, so we don't remove them.
3265 if (child->isRubyRun() || child->isRubyBase()) 3265 if (child->isRubyRun() || child->isRubyBase())
3266 return; 3266 return;
3267 3267
3268 blocksToRemove.append(toLayoutBlockFlow(child)); 3268 blocksToRemove.push_back(toLayoutBlockFlow(child));
3269 } 3269 }
3270 3270
3271 // If we make an object's children inline we are going to frustrate any future 3271 // If we make an object's children inline we are going to frustrate any future
3272 // attempts to remove floats from its children's float-lists before the next 3272 // attempts to remove floats from its children's float-lists before the next
3273 // layout happens so clear down all the floatlists now - they will be rebuilt 3273 // layout happens so clear down all the floatlists now - they will be rebuilt
3274 // at layout. 3274 // at layout.
3275 removeFloatingObjectsFromDescendants(); 3275 removeFloatingObjectsFromDescendants();
3276 3276
3277 for (size_t i = 0; i < blocksToRemove.size(); i++) 3277 for (size_t i = 0; i < blocksToRemove.size(); i++)
3278 collapseAnonymousBlockChild(blocksToRemove[i]); 3278 collapseAnonymousBlockChild(blocksToRemove[i]);
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4555 bool prevInlineHasLineBox = 4555 bool prevInlineHasLineBox =
4556 toLayoutInline(inlineElementContinuation->node()->layoutObject()) 4556 toLayoutInline(inlineElementContinuation->node()->layoutObject())
4557 ->firstLineBox(); 4557 ->firstLineBox();
4558 LayoutUnit topMargin = 4558 LayoutUnit topMargin =
4559 prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit(); 4559 prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
4560 LayoutUnit bottomMargin = 4560 LayoutUnit bottomMargin =
4561 nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit(); 4561 nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
4562 if (topMargin || bottomMargin) { 4562 if (topMargin || bottomMargin) {
4563 LayoutRect rect(additionalOffset, size()); 4563 LayoutRect rect(additionalOffset, size());
4564 rect.expandEdges(topMargin, LayoutUnit(), bottomMargin, LayoutUnit()); 4564 rect.expandEdges(topMargin, LayoutUnit(), bottomMargin, LayoutUnit());
4565 rects.append(rect); 4565 rects.push_back(rect);
4566 } 4566 }
4567 } 4567 }
4568 4568
4569 LayoutBlock::addOutlineRects(rects, additionalOffset, includeBlockOverflows); 4569 LayoutBlock::addOutlineRects(rects, additionalOffset, includeBlockOverflows);
4570 4570
4571 if (includeBlockOverflows == IncludeBlockVisualOverflow && 4571 if (includeBlockOverflows == IncludeBlockVisualOverflow &&
4572 !hasOverflowClip() && !hasControlClip()) { 4572 !hasOverflowClip() && !hasControlClip()) {
4573 for (RootInlineBox* curr = firstRootBox(); curr; 4573 for (RootInlineBox* curr = firstRootBox(); curr;
4574 curr = curr->nextRootBox()) { 4574 curr = curr->nextRootBox()) {
4575 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->y()); 4575 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->y());
4576 LayoutUnit bottom = 4576 LayoutUnit bottom =
4577 std::min<LayoutUnit>(curr->lineBottom(), curr->y() + curr->height()); 4577 std::min<LayoutUnit>(curr->lineBottom(), curr->y() + curr->height());
4578 LayoutRect rect(additionalOffset.x() + curr->x(), 4578 LayoutRect rect(additionalOffset.x() + curr->x(),
4579 additionalOffset.y() + top, curr->width(), bottom - top); 4579 additionalOffset.y() + top, curr->width(), bottom - top);
4580 if (!rect.isEmpty()) 4580 if (!rect.isEmpty())
4581 rects.append(rect); 4581 rects.push_back(rect);
4582 } 4582 }
4583 } 4583 }
4584 4584
4585 if (inlineElementContinuation) 4585 if (inlineElementContinuation)
4586 inlineElementContinuation->addOutlineRects( 4586 inlineElementContinuation->addOutlineRects(
4587 rects, additionalOffset + 4587 rects, additionalOffset +
4588 (inlineElementContinuation->containingBlock()->location() - 4588 (inlineElementContinuation->containingBlock()->location() -
4589 location()), 4589 location()),
4590 includeBlockOverflows); 4590 includeBlockOverflows);
4591 } 4591 }
4592 4592
4593 PaintInvalidationReason LayoutBlockFlow::invalidatePaintIfNeeded( 4593 PaintInvalidationReason LayoutBlockFlow::invalidatePaintIfNeeded(
4594 const PaintInvalidationState& paintInvalidationState) { 4594 const PaintInvalidationState& paintInvalidationState) {
4595 if (containsFloats()) 4595 if (containsFloats())
4596 paintInvalidationState.paintingLayer().setNeedsPaintPhaseFloat(); 4596 paintInvalidationState.paintingLayer().setNeedsPaintPhaseFloat();
4597 4597
4598 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 4598 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
4599 } 4599 }
4600 4600
4601 void LayoutBlockFlow::invalidateDisplayItemClients( 4601 void LayoutBlockFlow::invalidateDisplayItemClients(
4602 PaintInvalidationReason invalidationReason) const { 4602 PaintInvalidationReason invalidationReason) const {
4603 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients( 4603 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(
4604 invalidationReason); 4604 invalidationReason);
4605 } 4605 }
4606 4606
4607 } // namespace blink 4607 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698