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

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

Issue 134473008: Remove CSS regions support, keeping a bare minimum to support "region-based" multicol. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "core/rendering/RenderBoxModelObject.h" 27 #include "core/rendering/RenderBoxModelObject.h"
28 28
29 #include "HTMLNames.h" 29 #include "HTMLNames.h"
30 #include "core/frame/Settings.h" 30 #include "core/frame/Settings.h"
31 #include "core/html/HTMLFrameOwnerElement.h" 31 #include "core/html/HTMLFrameOwnerElement.h"
32 #include "core/page/scrolling/ScrollingConstraints.h" 32 #include "core/page/scrolling/ScrollingConstraints.h"
33 #include "core/rendering/CompositedLayerMapping.h" 33 #include "core/rendering/CompositedLayerMapping.h"
34 #include "core/rendering/ImageQualityController.h" 34 #include "core/rendering/ImageQualityController.h"
35 #include "core/rendering/RenderBlock.h" 35 #include "core/rendering/RenderBlock.h"
36 #include "core/rendering/RenderFlowThread.h"
36 #include "core/rendering/RenderGeometryMap.h" 37 #include "core/rendering/RenderGeometryMap.h"
37 #include "core/rendering/RenderInline.h" 38 #include "core/rendering/RenderInline.h"
38 #include "core/rendering/RenderLayer.h" 39 #include "core/rendering/RenderLayer.h"
39 #include "core/rendering/RenderLayerCompositor.h" 40 #include "core/rendering/RenderLayerCompositor.h"
40 #include "core/rendering/RenderNamedFlowThread.h"
41 #include "core/rendering/RenderRegion.h" 41 #include "core/rendering/RenderRegion.h"
42 #include "core/rendering/RenderView.h" 42 #include "core/rendering/RenderView.h"
43 #include "core/rendering/style/ShadowList.h" 43 #include "core/rendering/style/ShadowList.h"
44 #include "platform/geometry/TransformState.h" 44 #include "platform/geometry/TransformState.h"
45 #include "platform/graphics/DrawLooper.h" 45 #include "platform/graphics/DrawLooper.h"
46 #include "platform/graphics/GraphicsContextStateSaver.h" 46 #include "platform/graphics/GraphicsContextStateSaver.h"
47 #include "platform/graphics/Path.h" 47 #include "platform/graphics/Path.h"
48 #include "wtf/CurrentTime.h" 48 #include "wtf/CurrentTime.h"
49 49
50 using namespace std; 50 using namespace std;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject ()) { 246 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject ()) {
247 if (offsetParent->isBox() && !offsetParent->isBody()) 247 if (offsetParent->isBox() && !offsetParent->isBody())
248 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen derBox(offsetParent)->borderTop()); 248 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen derBox(offsetParent)->borderTop());
249 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 249 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
250 if (isRelPositioned()) 250 if (isRelPositioned())
251 referencePoint.move(relativePositionOffset()); 251 referencePoint.move(relativePositionOffset());
252 else if (isStickyPositioned()) 252 else if (isStickyPositioned())
253 referencePoint.move(stickyPositionOffset()); 253 referencePoint.move(stickyPositionOffset());
254 254
255 // CSS regions specification says that region flows should return th e body element as their offsetParent.
256 // Since we will bypass the body’s renderer anyway, just end the loo p if we encounter a region flow (named flow thread).
257 // See http://dev.w3.org/csswg/css-regions/#cssomview-offset-attribu tes
258 RenderObject* current; 255 RenderObject* current;
259 for (current = parent(); current != offsetParent && !current->isRend erNamedFlowThread() && current->parent(); current = current->parent()) { 256 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) {
260 // FIXME: What are we supposed to do inside SVG content? 257 // FIXME: What are we supposed to do inside SVG content?
261 if (!isOutOfFlowPositioned()) { 258 if (!isOutOfFlowPositioned()) {
262 if (current->isBox() && !current->isTableRow()) 259 if (current->isBox() && !current->isTableRow())
263 referencePoint.moveBy(toRenderBox(current)->topLeftLocat ion()); 260 referencePoint.moveBy(toRenderBox(current)->topLeftLocat ion());
264 referencePoint.move(current->parent()->offsetForColumns(refe rencePoint)); 261 referencePoint.move(current->parent()->offsetForColumns(refe rencePoint));
265 } 262 }
266 } 263 }
267 264
268 // Compute the offset position for elements inside named flow thread s for which the offsetParent was the body. 265 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned())
269 // See https://code.google.com/p/chromium/issues/detail?id=242168
270 if (current->isRenderNamedFlowThread())
271 referencePoint = toRenderNamedFlowThread(current)->adjustedPosit ionRelativeToOffsetParent(*this, referencePoint);
272 else if (offsetParent->isBox() && offsetParent->isBody() && !offsetP arent->isPositioned())
273 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation ()); 266 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation ());
274 } 267 }
275 } 268 }
276 269
277 return referencePoint; 270 return referencePoint;
278 } 271 }
279 272
280 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo rtConstraints& constraints, const FloatRect& constrainingRect) const 273 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo rtConstraints& constraints, const FloatRect& constrainingRect) const
281 { 274 {
282 RenderBlock* containingBlock = this->containingBlock(); 275 RenderBlock* containingBlock = this->containingBlock();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 329 }
337 330
338 LayoutSize RenderBoxModelObject::stickyPositionOffset() const 331 LayoutSize RenderBoxModelObject::stickyPositionOffset() const
339 { 332 {
340 FloatRect constrainingRect; 333 FloatRect constrainingRect;
341 334
342 ASSERT(hasLayer()); 335 ASSERT(hasLayer());
343 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf); 336 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf);
344 if (enclosingClippingLayer) { 337 if (enclosingClippingLayer) {
345 RenderBox* enclosingClippingBox = toRenderBox(enclosingClippingLayer->re nderer()); 338 RenderBox* enclosingClippingBox = toRenderBox(enclosingClippingLayer->re nderer());
346 LayoutRect clipRect = enclosingClippingBox->overflowClipRect(LayoutPoint (), 0); // FIXME: make this work in regions. 339 LayoutRect clipRect = enclosingClippingBox->overflowClipRect(LayoutPoint ());
347 constrainingRect = enclosingClippingBox->localToContainerQuad(FloatRect( clipRect), view()).boundingBox(); 340 constrainingRect = enclosingClippingBox->localToContainerQuad(FloatRect( clipRect), view()).boundingBox();
348 } else { 341 } else {
349 LayoutRect viewportRect = view()->frameView()->viewportConstrainedVisibl eContentRect(); 342 LayoutRect viewportRect = view()->frameView()->viewportConstrainedVisibl eContentRect();
350 constrainingRect = viewportRect; 343 constrainingRect = viewportRect;
351 } 344 }
352 345
353 StickyPositionViewportConstraints constraints; 346 StickyPositionViewportConstraints constraints;
354 computeStickyPositionConstraints(constraints, constrainingRect); 347 computeStickyPositionConstraints(constraints, constrainingRect);
355 348
356 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). 349 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms).
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 int bLeft = includeLeftEdge ? borderLeft() : 0; 570 int bLeft = includeLeftEdge ? borderLeft() : 0;
578 int bRight = includeRightEdge ? borderRight() : 0; 571 int bRight = includeRightEdge ? borderRight() : 0;
579 LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit(); 572 LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit();
580 LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit(); 573 LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit();
581 574
582 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling); 575 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling);
583 LayoutRect scrolledPaintRect = rect; 576 LayoutRect scrolledPaintRect = rect;
584 if (clippedWithLocalScrolling) { 577 if (clippedWithLocalScrolling) {
585 // Clip to the overflow area. 578 // Clip to the overflow area.
586 RenderBox* thisBox = toRenderBox(this); 579 RenderBox* thisBox = toRenderBox(this);
587 context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.rende rRegion)); 580 context->clip(thisBox->overflowClipRect(rect.location()));
588 581
589 // Adjust the paint rect to reflect a scrolled content box with borders at the ends. 582 // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
590 IntSize offset = thisBox->scrolledContentOffset(); 583 IntSize offset = thisBox->scrolledContentOffset();
591 scrolledPaintRect.move(-offset); 584 scrolledPaintRect.move(-offset);
592 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight); 585 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight);
593 scrolledPaintRect.setHeight(borderTop() + thisBox->scrollHeight() + bord erBottom()); 586 scrolledPaintRect.setHeight(borderTop() + thisBox->scrollHeight() + bord erBottom());
594 } 587 }
595 588
596 GraphicsContextStateSaver backgroundClipStateSaver(*context, false); 589 GraphicsContextStateSaver backgroundClipStateSaver(*context, false);
597 IntRect maskRect; 590 IntRect maskRect;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 if (bgLayer->clip() == TextFillBox) { 710 if (bgLayer->clip() == TextFillBox) {
718 // Create the text mask layer. 711 // Create the text mask layer.
719 context->setCompositeOperation(CompositeDestinationIn); 712 context->setCompositeOperation(CompositeDestinationIn);
720 context->beginTransparencyLayer(1); 713 context->beginTransparencyLayer(1);
721 714
722 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291. 715 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291.
723 context->clearRect(maskRect); 716 context->clearRect(maskRect);
724 717
725 // Now draw the text into the mask. We do this by painting using a speci al paint phase that signals to 718 // Now draw the text into the mask. We do this by painting using a speci al paint phase that signals to
726 // InlineTextBoxes that they should just add their contents to the clip. 719 // InlineTextBoxes that they should just add their contents to the clip.
727 PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForce BlackText, 0, paintInfo.renderRegion); 720 PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForce BlackText, 0);
728 context->setCompositeOperation(CompositeSourceOver); 721 context->setCompositeOperation(CompositeSourceOver);
729 if (box) { 722 if (box) {
730 RootInlineBox* root = box->root(); 723 RootInlineBox* root = box->root();
731 box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrol ledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom()); 724 box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrol ledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
732 } else { 725 } else {
733 LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset () : LayoutSize(); 726 LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset () : LayoutSize();
734 paint(info, scrolledPaintRect.location() - localOffset); 727 paint(info, scrolledPaintRect.location() - localOffset);
735 } 728 }
736 729
737 context->endLayer(); 730 context->endLayer();
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2789 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2797 for (RenderObject* child = startChild; child && child != endChild; ) { 2790 for (RenderObject* child = startChild; child && child != endChild; ) {
2798 // Save our next sibling as moveChildTo will clear it. 2791 // Save our next sibling as moveChildTo will clear it.
2799 RenderObject* nextSibling = child->nextSibling(); 2792 RenderObject* nextSibling = child->nextSibling();
2800 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2793 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2801 child = nextSibling; 2794 child = nextSibling;
2802 } 2795 }
2803 } 2796 }
2804 2797
2805 } // namespace WebCore 2798 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698