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

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

Issue 17176018: [CSS Regions] Add new regionOversetChange event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Integrated styling fixes Created 7 years, 6 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
« no previous file with comments | « Source/core/rendering/RenderFlowThread.h ('k') | Source/core/rendering/RenderNamedFlowThread.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) 2011 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 30 matching lines...) Expand all
41 #include "core/rendering/RenderBoxRegionInfo.h" 41 #include "core/rendering/RenderBoxRegionInfo.h"
42 #include "core/rendering/RenderInline.h" 42 #include "core/rendering/RenderInline.h"
43 #include "core/rendering/RenderLayer.h" 43 #include "core/rendering/RenderLayer.h"
44 #include "core/rendering/RenderRegion.h" 44 #include "core/rendering/RenderRegion.h"
45 #include "core/rendering/RenderView.h" 45 #include "core/rendering/RenderView.h"
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 RenderFlowThread::RenderFlowThread() 49 RenderFlowThread::RenderFlowThread()
50 : RenderBlock(0) 50 : RenderBlock(0)
51 , m_previousRegionCount(0)
51 , m_autoLogicalHeightRegionsCount(0) 52 , m_autoLogicalHeightRegionsCount(0)
52 , m_regionsInvalidated(false) 53 , m_regionsInvalidated(false)
53 , m_regionsHaveUniformLogicalWidth(true) 54 , m_regionsHaveUniformLogicalWidth(true)
54 , m_regionsHaveUniformLogicalHeight(true) 55 , m_regionsHaveUniformLogicalHeight(true)
55 , m_overset(true) 56 , m_overset(true)
56 , m_hasRegionsWithStyling(false) 57 , m_hasRegionsWithStyling(false)
57 , m_dispatchRegionLayoutUpdateEvent(false) 58 , m_dispatchRegionLayoutUpdateEvent(false)
59 , m_dispatchRegionOversetChangeEvent(false)
58 , m_pageLogicalSizeChanged(false) 60 , m_pageLogicalSizeChanged(false)
59 , m_inConstrainedLayoutPhase(false) 61 , m_inConstrainedLayoutPhase(false)
60 , m_needsTwoPhasesLayout(false) 62 , m_needsTwoPhasesLayout(false)
61 { 63 {
62 setFlowThreadState(InsideOutOfFlowThread); 64 setFlowThreadState(InsideOutOfFlowThread);
63 } 65 }
64 66
65 PassRefPtr<RenderStyle> RenderFlowThread::createFlowThreadStyle(RenderStyle* par entStyle) 67 PassRefPtr<RenderStyle> RenderFlowThread::createFlowThreadStyle(RenderStyle* par entStyle)
66 { 68 {
67 RefPtr<RenderStyle> newStyle(RenderStyle::create()); 69 RefPtr<RenderStyle> newStyle(RenderStyle::create());
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 CurrentRenderFlowThreadMaintainer currentFlowThreadSetter(this); 212 CurrentRenderFlowThreadMaintainer currentFlowThreadSetter(this);
211 RenderBlock::layout(); 213 RenderBlock::layout();
212 214
213 m_pageLogicalSizeChanged = false; 215 m_pageLogicalSizeChanged = false;
214 216
215 if (lastRegion()) 217 if (lastRegion())
216 lastRegion()->expandToEncompassFlowThreadContentsIfNeeded(); 218 lastRegion()->expandToEncompassFlowThreadContentsIfNeeded();
217 219
218 if (shouldDispatchRegionLayoutUpdateEvent()) 220 if (shouldDispatchRegionLayoutUpdateEvent())
219 dispatchRegionLayoutUpdateEvent(); 221 dispatchRegionLayoutUpdateEvent();
222
223 if (shouldDispatchRegionOversetChangeEvent())
224 dispatchRegionOversetChangeEvent();
220 } 225 }
221 226
222 void RenderFlowThread::updateLogicalWidth() 227 void RenderFlowThread::updateLogicalWidth()
223 { 228 {
224 LayoutUnit logicalWidth = initialLogicalWidth(); 229 LayoutUnit logicalWidth = initialLogicalWidth();
225 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio nList.end(); ++iter) { 230 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio nList.end(); ++iter) {
226 RenderRegion* region = *iter; 231 RenderRegion* region = *iter;
227 ASSERT(!region->needsLayout() || region->isRenderRegionSet()); 232 ASSERT(!region->needsLayout() || region->isRenderRegionSet());
228 logicalWidth = max(region->pageLogicalWidth(), logicalWidth); 233 logicalWidth = max(region->pageLogicalWidth(), logicalWidth);
229 } 234 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 ASSERT(m_regionList.contains(startRegion) && m_regionList.contains(endRegion )); 727 ASSERT(m_regionList.contains(startRegion) && m_regionList.contains(endRegion ));
723 } 728 }
724 729
725 void RenderFlowThread::applyBreakAfterContent(LayoutUnit clientHeight) 730 void RenderFlowThread::applyBreakAfterContent(LayoutUnit clientHeight)
726 { 731 {
727 // Simulate a region break at height. If it points inside an auto logical he ight region, 732 // Simulate a region break at height. If it points inside an auto logical he ight region,
728 // then it may determine the region override logical content height. 733 // then it may determine the region override logical content height.
729 addForcedRegionBreak(clientHeight, this, false); 734 addForcedRegionBreak(clientHeight, this, false);
730 } 735 }
731 736
732 void RenderFlowThread::computeOverflowStateForRegions(LayoutUnit oldClientAfterE dge) 737 void RenderFlowThread::computeOversetStateForRegions(LayoutUnit oldClientAfterEd ge)
733 { 738 {
734 LayoutUnit height = oldClientAfterEdge; 739 LayoutUnit height = oldClientAfterEdge;
735 740
736 // FIXME: the visual overflow of middle region (if it is the last one to con tain any content in a render flow thread) 741 // FIXME: the visual overflow of middle region (if it is the last one to con tain any content in a render flow thread)
737 // might not be taken into account because the render flow thread height is greater that that regions height + its visual overflow 742 // might not be taken into account because the render flow thread height is greater that that regions height + its visual overflow
738 // because of how computeLogicalHeight is implemented for RenderFlowThread ( as a sum of all regions height). 743 // because of how computeLogicalHeight is implemented for RenderFlowThread ( as a sum of all regions height).
739 // This means that the middle region will be marked as fit (even if it has v isual overflow flowing into the next region) 744 // This means that the middle region will be marked as fit (even if it has v isual overflow flowing into the next region)
740 if (hasRenderOverflow() 745 if (hasRenderOverflow()
741 && ( (isHorizontalWritingMode() && visualOverflowRect().maxY() > clientB oxRect().maxY()) 746 && ( (isHorizontalWritingMode() && visualOverflowRect().maxY() > clientB oxRect().maxY())
742 || (!isHorizontalWritingMode() && visualOverflowRect().maxX() > clie ntBoxRect().maxX()))) 747 || (!isHorizontalWritingMode() && visualOverflowRect().maxX() > clie ntBoxRect().maxX())))
743 height = isHorizontalWritingMode() ? visualOverflowRect().maxY() : visua lOverflowRect().maxX(); 748 height = isHorizontalWritingMode() ? visualOverflowRect().maxY() : visua lOverflowRect().maxX();
744 749
745 RenderRegion* lastReg = lastRegion(); 750 RenderRegion* lastReg = lastRegion();
746 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio nList.end(); ++iter) { 751 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regio nList.end(); ++iter) {
747 RenderRegion* region = *iter; 752 RenderRegion* region = *iter;
748 LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowT hreadPortionRect().y() : region->flowThreadPortionRect().x()); 753 LayoutUnit flowMin = height - (isHorizontalWritingMode() ? region->flowT hreadPortionRect().y() : region->flowThreadPortionRect().x());
749 LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowT hreadPortionRect().maxY() : region->flowThreadPortionRect().maxX()); 754 LayoutUnit flowMax = height - (isHorizontalWritingMode() ? region->flowT hreadPortionRect().maxY() : region->flowThreadPortionRect().maxX());
750 RenderRegion::RegionState previousState = region->regionState(); 755 RegionOversetState previousState = region->regionOversetState();
751 RenderRegion::RegionState state = RenderRegion::RegionFit; 756 RegionOversetState state = RegionFit;
752 if (flowMin <= 0) 757 if (flowMin <= 0)
753 state = RenderRegion::RegionEmpty; 758 state = RegionEmpty;
754 if (flowMax > 0 && region == lastReg) 759 if (flowMax > 0 && region == lastReg)
755 state = RenderRegion::RegionOverset; 760 state = RegionOverset;
756 region->setRegionState(state); 761 region->setRegionOversetState(state);
757 // determine whether the NamedFlow object should dispatch a regionLayout Update event 762 // determine whether the NamedFlow object should dispatch a regionLayout Update event
758 // FIXME: currently it cannot determine whether a region whose regionOve rset state remained either "fit" or "overset" has actually 763 // FIXME: currently it cannot determine whether a region whose regionOve rset state remained either "fit" or "overset" has actually
759 // changed, so it just assumes that the NamedFlow should dispatch the ev ent 764 // changed, so it just assumes that the NamedFlow should dispatch the ev ent
760 if (previousState != state 765 if (previousState != state
761 || state == RenderRegion::RegionFit 766 || state == RegionFit
762 || state == RenderRegion::RegionOverset) 767 || state == RegionOverset)
763 setDispatchRegionLayoutUpdateEvent(true); 768 setDispatchRegionLayoutUpdateEvent(true);
769
770 if (previousState != state)
771 setDispatchRegionOversetChangeEvent(true);
772 }
773
774 // If the number of regions has changed since we last computed the overset p roperty, schedule the regionOversetChange event.
775 if (previousRegionCountChanged()) {
776 setDispatchRegionOversetChangeEvent(true);
777 updatePreviousRegionCount();
764 } 778 }
765 779
766 // With the regions overflow state computed we can also set the overset flag for the named flow. 780 // With the regions overflow state computed we can also set the overset flag for the named flow.
767 // If there are no valid regions in the chain, overset is true. 781 // If there are no valid regions in the chain, overset is true.
768 m_overset = lastReg ? lastReg->regionState() == RenderRegion::RegionOverset : true; 782 m_overset = lastReg ? lastReg->regionOversetState() == RegionOverset : true;
769 } 783 }
770 784
771 bool RenderFlowThread::regionInRange(const RenderRegion* targetRegion, const Ren derRegion* startRegion, const RenderRegion* endRegion) const 785 bool RenderFlowThread::regionInRange(const RenderRegion* targetRegion, const Ren derRegion* startRegion, const RenderRegion* endRegion) const
772 { 786 {
773 ASSERT(targetRegion); 787 ASSERT(targetRegion);
774 788
775 for (RenderRegionList::const_iterator it = m_regionList.find(const_cast<Rend erRegion*>(startRegion)); it != m_regionList.end(); ++it) { 789 for (RenderRegionList::const_iterator it = m_regionList.find(const_cast<Rend erRegion*>(startRegion)); it != m_regionList.end(); ++it) {
776 const RenderRegion* currRegion = *it; 790 const RenderRegion* currRegion = *it;
777 if (targetRegion == currRegion) 791 if (targetRegion == currRegion)
778 return true; 792 return true;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 { 1092 {
1079 if (!m_renderFlowThread) 1093 if (!m_renderFlowThread)
1080 return; 1094 return;
1081 RenderView* view = m_renderFlowThread->view(); 1095 RenderView* view = m_renderFlowThread->view();
1082 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl owThread); 1096 ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFl owThread);
1083 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo wThread); 1097 view->flowThreadController()->setCurrentRenderFlowThread(m_previousRenderFlo wThread);
1084 } 1098 }
1085 1099
1086 1100
1087 } // namespace WebCore 1101 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderFlowThread.h ('k') | Source/core/rendering/RenderNamedFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698