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

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

Issue 607593002: Remove -webkit-border-fit (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 2 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/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.cpp » ('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) 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 // Multiple passes might be required for column and pagination based layout 355 // Multiple passes might be required for column and pagination based layout
356 // In the case of the old column code the number of passes will only be two 356 // In the case of the old column code the number of passes will only be two
357 // however, in the newer column code the number of passes could equal the 357 // however, in the newer column code the number of passes could equal the
358 // number of columns. 358 // number of columns.
359 bool done = false; 359 bool done = false;
360 LayoutUnit pageLogicalHeight = 0; 360 LayoutUnit pageLogicalHeight = 0;
361 while (!done) 361 while (!done)
362 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope) ; 362 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope) ;
363 363
364 fitBorderToLinesIfNeeded();
365
366 RenderView* renderView = view(); 364 RenderView* renderView = view();
367 if (renderView->layoutState()->pageLogicalHeight()) 365 if (renderView->layoutState()->pageLogicalHeight())
368 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this, logicalTop())); 366 setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(*this, logicalTop()));
369 367
370 updateLayerTransformAfterLayout(); 368 updateLayerTransformAfterLayout();
371 369
372 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if 370 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if
373 // we overflow or not. 371 // we overflow or not.
374 updateScrollInfoAfterLayout(); 372 updateScrollInfoAfterLayout();
375 373
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 if (floatingObject->renderer()->hitTest(request, result, locationInC ontainer, childPoint)) { 2637 if (floatingObject->renderer()->hitTest(request, result, locationInC ontainer, childPoint)) {
2640 updateHitTestResult(result, locationInContainer.point() - toLayo utSize(childPoint)); 2638 updateHitTestResult(result, locationInContainer.point() - toLayo utSize(childPoint));
2641 return true; 2639 return true;
2642 } 2640 }
2643 } 2641 }
2644 } 2642 }
2645 2643
2646 return false; 2644 return false;
2647 } 2645 }
2648 2646
2649 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU nit& right) const
2650 {
2651 if (style()->visibility() != VISIBLE)
2652 return;
2653
2654 // We don't deal with relative positioning. Our assumption is that you shrin k to fit the lines without accounting
2655 // for either overflow or translations via relative positioning.
2656 if (childrenInline()) {
2657 for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) {
2658 if (box->firstChild())
2659 left = std::min(left, x + static_cast<LayoutUnit>(box->firstChil d()->x()));
2660 if (box->lastChild())
2661 right = std::max(right, x + static_cast<LayoutUnit>(ceilf(box->l astChild()->logicalRight())));
2662 }
2663 } else {
2664 for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox()) {
2665 if (!obj->isFloatingOrOutOfFlowPositioned()) {
2666 if (obj->isRenderBlockFlow() && !obj->hasOverflowClip()) {
2667 toRenderBlockFlow(obj)->adjustForBorderFit(x + obj->x(), lef t, right);
2668 } else if (obj->style()->visibility() == VISIBLE) {
2669 // We are a replaced element or some kind of non-block-flow object.
2670 left = std::min(left, x + obj->x());
2671 right = std::max(right, x + obj->x() + obj->width());
2672 }
2673 }
2674 }
2675 }
2676
2677 if (m_floatingObjects) {
2678 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2679 FloatingObjectSetIterator end = floatingObjectSet.end();
2680 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
2681 FloatingObject* floatingObject = it->get();
2682 // Only examine the object if our m_shouldPaint flag is set.
2683 if (floatingObject->shouldPaint()) {
2684 LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floating Object) - floatingObject->renderer()->x();
2685 LayoutUnit floatRight = floatLeft + floatingObject->renderer()-> width();
2686 left = std::min(left, floatLeft);
2687 right = std::max(right, floatRight);
2688 }
2689 }
2690 }
2691 }
2692
2693 void RenderBlockFlow::fitBorderToLinesIfNeeded()
2694 {
2695 if (style()->borderFit() == BorderFitBorder || hasOverrideWidth())
2696 return;
2697
2698 // Walk any normal flow lines to snugly fit.
2699 LayoutUnit left = LayoutUnit::max();
2700 LayoutUnit right = LayoutUnit::min();
2701 LayoutUnit oldWidth = contentWidth();
2702 adjustForBorderFit(0, left, right);
2703
2704 // Clamp to our existing edges. We can never grow. We only shrink.
2705 LayoutUnit leftEdge = borderLeft() + paddingLeft();
2706 LayoutUnit rightEdge = leftEdge + oldWidth;
2707 left = std::min(rightEdge, std::max(leftEdge, left));
2708 right = std::max(left, std::min(rightEdge, right));
2709
2710 LayoutUnit newContentWidth = right - left;
2711 if (newContentWidth == oldWidth)
2712 return;
2713
2714 setOverrideLogicalContentWidth(newContentWidth);
2715 layoutBlock(false);
2716 clearOverrideLogicalContentWidth();
2717 }
2718
2719 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 2647 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
2720 { 2648 {
2721 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) 2649 if (m_floatingObjects && m_floatingObjects->hasLeftObjects())
2722 return m_floatingObjects->logicalLeftOffset(fixedOffset, logicalTop, log icalHeight); 2650 return m_floatingObjects->logicalLeftOffset(fixedOffset, logicalTop, log icalHeight);
2723 2651
2724 return fixedOffset; 2652 return fixedOffset;
2725 } 2653 }
2726 2654
2727 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 2655 LayoutUnit RenderBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
2728 { 2656 {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 FrameView* frameView = document().view(); 2860 FrameView* frameView = document().view();
2933 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); 2861 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height();
2934 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 2862 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
2935 if (height() < visibleHeight) 2863 if (height() < visibleHeight)
2936 top += (visibleHeight - height()) / 2; 2864 top += (visibleHeight - height()) / 2;
2937 setY(top); 2865 setY(top);
2938 dialog->setCentered(top); 2866 dialog->setCentered(top);
2939 } 2867 }
2940 2868
2941 } // namespace blink 2869 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698