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

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

Issue 669803002: Optimize for horizontal writing mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: w compile fix 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 int colCount = columnBlock->columnCount(colInfo); 2042 int colCount = columnBlock->columnCount(colInfo);
2043 2043
2044 // We have to go backwards from the last column to the first. 2044 // We have to go backwards from the last column to the first.
2045 bool isHorizontal = columnBlock->style()->isHorizontalWritingMode(); 2045 bool isHorizontal = columnBlock->style()->isHorizontalWritingMode();
2046 LayoutUnit logicalLeft = columnBlock->logicalLeftOffsetForContent(); 2046 LayoutUnit logicalLeft = columnBlock->logicalLeftOffsetForContent();
2047 LayoutUnit currLogicalTopOffset = 0; 2047 LayoutUnit currLogicalTopOffset = 0;
2048 int i; 2048 int i;
2049 for (i = 0; i < colCount; i++) { 2049 for (i = 0; i < colCount; i++) {
2050 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); 2050 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i);
2051 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.widt h()); 2051 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.widt h());
2052 if (columnBlock->style()->isFlippedBlocksWritingMode()) 2052 if (columnBlock->style()->slowIsFlippedBlocksWritingMode())
2053 currLogicalTopOffset += blockDelta; 2053 currLogicalTopOffset += blockDelta;
2054 else 2054 else
2055 currLogicalTopOffset -= blockDelta; 2055 currLogicalTopOffset -= blockDelta;
2056 } 2056 }
2057 for (i = colCount - 1; i >= 0; i--) { 2057 for (i = colCount - 1; i >= 0; i--) {
2058 // For each rect, we clip to the rect, and then we adjust our coords. 2058 // For each rect, we clip to the rect, and then we adjust our coords.
2059 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); 2059 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i);
2060 columnBlock->flipForWritingMode(colRect); 2060 columnBlock->flipForWritingMode(colRect);
2061 LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect .y()) - logicalLeft; 2061 LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect .y()) - logicalLeft;
2062 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.widt h()); 2062 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.widt h());
2063 if (columnBlock->style()->isFlippedBlocksWritingMode()) 2063 if (columnBlock->style()->slowIsFlippedBlocksWritingMode())
2064 currLogicalTopOffset -= blockDelta; 2064 currLogicalTopOffset -= blockDelta;
2065 else 2065 else
2066 currLogicalTopOffset += blockDelta; 2066 currLogicalTopOffset += blockDelta;
2067 2067
2068 LayoutSize offset; 2068 LayoutSize offset;
2069 if (isHorizontal) { 2069 if (isHorizontal) {
2070 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) 2070 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis)
2071 offset = LayoutSize(currLogicalLeftOffset, currLogicalTopOffset) ; 2071 offset = LayoutSize(currLogicalLeftOffset, currLogicalTopOffset) ;
2072 else 2072 else
2073 offset = LayoutSize(0, colRect.y() + currLogicalTopOffset - colu mnBlock->borderTop() - columnBlock->paddingTop()); 2073 offset = LayoutSize(0, colRect.y() + currLogicalTopOffset - colu mnBlock->borderTop() - columnBlock->paddingTop());
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 RenderBox* box = renderBox(); 2242 RenderBox* box = renderBox();
2243 ASSERT(box); 2243 ASSERT(box);
2244 result = box->borderBoxRect(); 2244 result = box->borderBoxRect();
2245 result.unite(box->visualOverflowRect()); 2245 result.unite(box->visualOverflowRect());
2246 } 2246 }
2247 2247
2248 ASSERT(renderer()->view()); 2248 ASSERT(renderer()->view());
2249 return result; 2249 return result;
2250 } 2250 }
2251 2251
2252 LayoutRect RenderLayer::flippedLogicalBoundingBox() const 2252 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Rende rObject* renderer)
2253 { 2253 {
2254 LayoutRect result = logicalBoundingBox(); 2254 if (!UNLIKELY(renderer->document().containsAnyRareWritingMode()))
2255 if (m_renderer->isBox()) 2255 return boundingBox;
2256 renderBox()->flipForWritingMode(result); 2256
2257 LayoutRect result = boundingBox;
2258 if (renderer->isBox())
2259 toRenderBox(renderer)->flipForWritingMode(result);
2257 else 2260 else
2258 m_renderer->containingBlock()->flipForWritingMode(result); 2261 renderer->containingBlock()->flipForWritingMode(result);
2259 return result; 2262 return result;
2260 } 2263 }
2261 2264
2262 LayoutRect RenderLayer::physicalBoundingBox(const RenderLayer* ancestorLayer, co nst LayoutPoint* offsetFromRoot) const 2265 LayoutRect RenderLayer::physicalBoundingBox(const RenderLayer* ancestorLayer, co nst LayoutPoint* offsetFromRoot) const
2263 { 2266 {
2264 LayoutRect result = flippedLogicalBoundingBox(); 2267 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer ());
2265 if (offsetFromRoot) 2268 if (offsetFromRoot)
2266 result.moveBy(*offsetFromRoot); 2269 result.moveBy(*offsetFromRoot);
2267 else 2270 else
2268 convertToLayerCoords(ancestorLayer, result); 2271 convertToLayerCoords(ancestorLayer, result);
2269 return result; 2272 return result;
2270 } 2273 }
2271 2274
2272 LayoutRect RenderLayer::fragmentsBoundingBox(const RenderLayer* ancestorLayer) c onst 2275 LayoutRect RenderLayer::fragmentsBoundingBox(const RenderLayer* ancestorLayer) c onst
2273 { 2276 {
2274 if (!enclosingPaginationLayer()) 2277 if (!enclosingPaginationLayer())
2275 return physicalBoundingBox(ancestorLayer); 2278 return physicalBoundingBox(ancestorLayer);
2276 2279
2277 LayoutRect result = flippedLogicalBoundingBox(); 2280 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer ());
2278 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu lt); 2281 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu lt);
2279 return result; 2282 return result;
2280 } 2283 }
2281 2284
2285 LayoutRect RenderLayer::boundingBoxForCompositingOverlapTest() const
2286 {
2287 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : flippe dLogicalBoundingBox(logicalBoundingBox(), renderer());
2288 }
2289
2282 static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest orLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result) 2290 static void expandRectForReflectionAndStackingChildren(const RenderLayer* ancest orLayer, RenderLayer::CalculateBoundsOptions options, LayoutRect& result)
2283 { 2291 {
2284 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref lectionLayer()->hasCompositedLayerMapping()) 2292 if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->ref lectionLayer()->hasCompositedLayerMapping())
2285 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin gBoxForCompositing(ancestorLayer)); 2293 result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundin gBoxForCompositing(ancestorLayer));
2286 2294
2287 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer- >stackingNode()->hasPositiveZOrderList()); 2295 ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer- >stackingNode()->hasPositiveZOrderList());
2288 2296
2289 #if ENABLE(ASSERT) 2297 #if ENABLE(ASSERT)
2290 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(ancestorL ayer)->stackingNode()); 2298 LayerListMutationDetector mutationChecker(const_cast<RenderLayer*>(ancestorL ayer)->stackingNode());
2291 #endif 2299 #endif
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 } 2871 }
2864 } 2872 }
2865 2873
2866 void showLayerTree(const blink::RenderObject* renderer) 2874 void showLayerTree(const blink::RenderObject* renderer)
2867 { 2875 {
2868 if (!renderer) 2876 if (!renderer)
2869 return; 2877 return;
2870 showLayerTree(renderer->enclosingLayer()); 2878 showLayerTree(renderer->enclosingLayer());
2871 } 2879 }
2872 #endif 2880 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698