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

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

Issue 1661523002: Update should paint flag when a float's composited scrolling status changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build Created 4 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
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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 if (!hasOverhangingFloats()) 2038 if (!hasOverhangingFloats())
2039 return; 2039 return;
2040 2040
2041 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2041 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2042 FloatingObjectSetIterator end = floatingObjectSet.end(); 2042 FloatingObjectSetIterator end = floatingObjectSet.end();
2043 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 2043 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
2044 const FloatingObject& floatingObject = *it->get(); 2044 const FloatingObject& floatingObject = *it->get();
2045 // Only issue paint invaldiations for the object if it is overhanging, i s not in its own layer, and 2045 // Only issue paint invaldiations for the object if it is overhanging, i s not in its own layer, and
2046 // is our responsibility to paint (m_shouldPaint is set). When paintAllD escendants is true, the latter 2046 // is our responsibility to paint (m_shouldPaint is set). When paintAllD escendants is true, the latter
2047 // condition is replaced with being a descendant of us. 2047 // condition is replaced with being a descendant of us.
2048 if (logicalBottomForFloat(floatingObject) > logicalHeight() 2048 if (isOverhangingFloat(floatingObject)
2049 && !floatingObject.layoutObject()->hasSelfPaintingLayer() 2049 && !floatingObject.layoutObject()->hasSelfPaintingLayer()
2050 && (floatingObject.shouldPaint() || (paintAllDescendants && floating Object.layoutObject()->isDescendantOf(this)))) { 2050 && (floatingObject.shouldPaint() || (paintAllDescendants && floating Object.layoutObject()->isDescendantOf(this)))) {
2051 2051
2052 LayoutBox* floatingLayoutBox = floatingObject.layoutObject(); 2052 LayoutBox* floatingLayoutBox = floatingObject.layoutObject();
2053 floatingLayoutBox->setShouldDoFullPaintInvalidation(); 2053 floatingLayoutBox->setShouldDoFullPaintInvalidation();
2054 floatingLayoutBox->invalidatePaintForOverhangingFloats(false); 2054 floatingLayoutBox->invalidatePaintForOverhangingFloats(false);
2055 } 2055 }
2056 } 2056 }
2057 } 2057 }
2058 2058
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) 2454 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox)
2455 { 2455 {
2456 if (!m_floatingObjects || !parent()) 2456 if (!m_floatingObjects || !parent())
2457 return false; 2457 return false;
2458 2458
2459 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2459 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2460 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran slator>(layoutBox); 2460 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran slator>(layoutBox);
2461 if (it == floatingObjectSet.end()) 2461 if (it == floatingObjectSet.end())
2462 return false; 2462 return false;
2463 2463
2464 return logicalBottomForFloat(*it->get()) > logicalHeight(); 2464 return isOverhangingFloat(**it);
2465 } 2465 }
2466 2466
2467 void LayoutBlockFlow::addIntrudingFloats(LayoutBlockFlow* prev, LayoutUnit logic alLeftOffset, LayoutUnit logicalTopOffset) 2467 void LayoutBlockFlow::addIntrudingFloats(LayoutBlockFlow* prev, LayoutUnit logic alLeftOffset, LayoutUnit logicalTopOffset)
2468 { 2468 {
2469 ASSERT(!avoidsFloats()); 2469 ASSERT(!avoidsFloats());
2470 2470
2471 // If we create our own block formatting context then our contents don't int eract with floats outside it, even those from our parent. 2471 // If we create our own block formatting context then our contents don't int eract with floats outside it, even those from our parent.
2472 if (createsNewFormattingContext()) 2472 if (createsNewFormattingContext())
2473 return; 2473 return;
2474 2474
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 } 2621 }
2622 2622
2623 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 2623 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop , LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
2624 { 2624 {
2625 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) 2625 if (m_floatingObjects && m_floatingObjects->hasRightObjects())
2626 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight); 2626 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo gicalHeight);
2627 2627
2628 return fixedOffset; 2628 return fixedOffset;
2629 } 2629 }
2630 2630
2631 void LayoutBlockFlow::setAncestorShouldPaintFloatingObject(const LayoutBox& floa tBox, bool shouldPaint)
2632 {
2633 ASSERT(floatBox.isFloating());
2634 ASSERT(!floatBox.hasSelfPaintingLayer());
2635 for (LayoutObject* ancestor = floatBox.parent(); ancestor && ancestor->isLay outBlockFlow(); ancestor = ancestor->parent()) {
2636 LayoutBlockFlow* ancestorBlock = toLayoutBlockFlow(ancestor);
2637 FloatingObjects* ancestorFloatingObjects = ancestorBlock->m_floatingObje cts.get();
2638 if (!ancestorFloatingObjects)
2639 break;
2640 FloatingObjectSet::iterator it = ancestorFloatingObjects->mutableSet().f ind<FloatingObjectHashTranslator>(const_cast<LayoutBox*>(&floatBox));
2641 if (it == ancestorFloatingObjects->mutableSet().end())
2642 break;
2643
2644 FloatingObject& floatingObject = **it;
2645 if (shouldPaint) {
2646 ASSERT(!floatingObject.shouldPaint());
2647 // This repeats the logic in addOverhangingFloats() about shouldPain t flag:
2648 // - The nearest enclosing block in which the float doesn't overhang paints the float;
2649 // - Or even if the float overhangs, if the ancestor block has self- painting layer, it
2650 // paints the float.
2651 if (ancestorBlock->hasSelfPaintingLayer() || !ancestorBlock->isOverh angingFloat(floatingObject)) {
2652 floatingObject.setShouldPaint(true);
2653 return;
2654 }
2655 } else if (floatingObject.shouldPaint()) {
2656 floatingObject.setShouldPaint(false);
2657 return;
2658 }
2659 }
2660 // We should have found the ancestor to update shouldPaint flag.
2661 ASSERT_NOT_REACHED();
2662 }
2663
2631 IntRect alignSelectionRectToDevicePixels(LayoutRect& rect) 2664 IntRect alignSelectionRectToDevicePixels(LayoutRect& rect)
2632 { 2665 {
2633 LayoutUnit roundedX = LayoutUnit(rect.x().round()); 2666 LayoutUnit roundedX = LayoutUnit(rect.x().round());
2634 return IntRect(roundedX, rect.y().round(), 2667 return IntRect(roundedX, rect.y().round(),
2635 (rect.maxX() - roundedX).round(), 2668 (rect.maxX() - roundedX).round(),
2636 snapSizeToPixel(rect.height(), rect.y())); 2669 snapSizeToPixel(rect.height(), rect.y()));
2637 } 2670 }
2638 2671
2639 bool LayoutBlockFlow::allowsPaginationStrut() const 2672 bool LayoutBlockFlow::allowsPaginationStrut() const
2640 { 2673 {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 FrameView* frameView = document().view(); 2868 FrameView* frameView = document().view();
2836 LayoutUnit top = LayoutUnit((style()->position() == FixedPosition) ? 0 : fra meView->scrollOffset().height()); 2869 LayoutUnit top = LayoutUnit((style()->position() == FixedPosition) ? 0 : fra meView->scrollOffset().height());
2837 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); 2870 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( );
2838 if (size().height() < visibleHeight) 2871 if (size().height() < visibleHeight)
2839 top += (visibleHeight - size().height()) / 2; 2872 top += (visibleHeight - size().height()) / 2;
2840 setY(top); 2873 setY(top);
2841 dialog->setCentered(top); 2874 dialog->setCentered(top);
2842 } 2875 }
2843 2876
2844 } // namespace blink 2877 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698