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

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

Issue 153233002: *** DO NOT LAND *** Remove regions support, keeping a bare minimum to support "region-based"... (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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject ()) { 288 if (const RenderBoxModelObject* offsetParent = element->renderBoxModelObject ()) {
289 if (offsetParent->isBox() && !offsetParent->isBody()) 289 if (offsetParent->isBox() && !offsetParent->isBody())
290 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen derBox(offsetParent)->borderTop()); 290 referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRen derBox(offsetParent)->borderTop());
291 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 291 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
292 if (isRelPositioned()) 292 if (isRelPositioned())
293 referencePoint.move(relativePositionOffset()); 293 referencePoint.move(relativePositionOffset());
294 else if (isStickyPositioned()) 294 else if (isStickyPositioned())
295 referencePoint.move(stickyPositionOffset()); 295 referencePoint.move(stickyPositionOffset());
296 296
297 // CSS regions specification says that region flows should return th e body element as their offsetParent.
298 // Since we will bypass the body’s renderer anyway, just end the loo p if we encounter a region flow (named flow thread).
299 // See http://dev.w3.org/csswg/css-regions/#cssomview-offset-attribu tes
300 RenderObject* current; 297 RenderObject* current;
301 for (current = parent(); current != offsetParent && !current->isRend erNamedFlowThread() && current->parent(); current = current->parent()) { 298 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) {
302 // FIXME: What are we supposed to do inside SVG content? 299 // FIXME: What are we supposed to do inside SVG content?
303 if (!isOutOfFlowPositioned()) { 300 if (!isOutOfFlowPositioned()) {
304 if (current->isBox() && !current->isTableRow()) 301 if (current->isBox() && !current->isTableRow())
305 referencePoint.moveBy(toRenderBox(current)->topLeftLocat ion()); 302 referencePoint.moveBy(toRenderBox(current)->topLeftLocat ion());
306 referencePoint.move(current->parent()->offsetForColumns(refe rencePoint)); 303 referencePoint.move(current->parent()->offsetForColumns(refe rencePoint));
307 } 304 }
308 } 305 }
309 306
310 // Compute the offset position for elements inside named flow thread s for which the offsetParent was the body. 307 if (offsetParent->isBox() && offsetParent->isBody() && !offsetParent ->isPositioned())
311 // See https://code.google.com/p/chromium/issues/detail?id=242168
312 if (current->isRenderNamedFlowThread())
313 referencePoint = toRenderNamedFlowThread(current)->adjustedPosit ionRelativeToOffsetParent(*this, referencePoint);
314 else if (offsetParent->isBox() && offsetParent->isBody() && !offsetP arent->isPositioned())
315 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation ()); 308 referencePoint.moveBy(toRenderBox(offsetParent)->topLeftLocation ());
316 } 309 }
317 } 310 }
318 311
319 return referencePoint; 312 return referencePoint;
320 } 313 }
321 314
322 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo rtConstraints& constraints, const FloatRect& constrainingRect) const 315 void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo rtConstraints& constraints, const FloatRect& constrainingRect) const
323 { 316 {
324 RenderBlock* containingBlock = this->containingBlock(); 317 RenderBlock* containingBlock = this->containingBlock();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 371 }
379 372
380 LayoutSize RenderBoxModelObject::stickyPositionOffset() const 373 LayoutSize RenderBoxModelObject::stickyPositionOffset() const
381 { 374 {
382 FloatRect constrainingRect; 375 FloatRect constrainingRect;
383 376
384 ASSERT(hasLayer()); 377 ASSERT(hasLayer());
385 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf); 378 RenderLayer* enclosingClippingLayer = layer()->enclosingOverflowClipLayer(Ex cludeSelf);
386 if (enclosingClippingLayer) { 379 if (enclosingClippingLayer) {
387 RenderBox* enclosingClippingBox = toRenderBox(enclosingClippingLayer->re nderer()); 380 RenderBox* enclosingClippingBox = toRenderBox(enclosingClippingLayer->re nderer());
388 LayoutRect clipRect = enclosingClippingBox->overflowClipRect(LayoutPoint (), 0); // FIXME: make this work in regions. 381 LayoutRect clipRect = enclosingClippingBox->overflowClipRect(LayoutPoint ());
389 constrainingRect = enclosingClippingBox->localToContainerQuad(FloatRect( clipRect), view()).boundingBox(); 382 constrainingRect = enclosingClippingBox->localToContainerQuad(FloatRect( clipRect), view()).boundingBox();
390 } else { 383 } else {
391 LayoutRect viewportRect = view()->frameView()->viewportConstrainedVisibl eContentRect(); 384 LayoutRect viewportRect = view()->frameView()->viewportConstrainedVisibl eContentRect();
392 constrainingRect = viewportRect; 385 constrainingRect = viewportRect;
393 } 386 }
394 387
395 StickyPositionViewportConstraints constraints; 388 StickyPositionViewportConstraints constraints;
396 computeStickyPositionConstraints(constraints, constrainingRect); 389 computeStickyPositionConstraints(constraints, constrainingRect);
397 390
398 // The sticky offset is physical, so we can just return the delta computed i n absolute coords (though it may be wrong with transforms). 391 // 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
619 int bLeft = includeLeftEdge ? borderLeft() : 0; 612 int bLeft = includeLeftEdge ? borderLeft() : 0;
620 int bRight = includeRightEdge ? borderRight() : 0; 613 int bRight = includeRightEdge ? borderRight() : 0;
621 LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit(); 614 LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit();
622 LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit(); 615 LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit();
623 616
624 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling); 617 GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithL ocalScrolling);
625 LayoutRect scrolledPaintRect = rect; 618 LayoutRect scrolledPaintRect = rect;
626 if (clippedWithLocalScrolling) { 619 if (clippedWithLocalScrolling) {
627 // Clip to the overflow area. 620 // Clip to the overflow area.
628 RenderBox* thisBox = toRenderBox(this); 621 RenderBox* thisBox = toRenderBox(this);
629 context->clip(thisBox->overflowClipRect(rect.location(), paintInfo.rende rRegion)); 622 context->clip(thisBox->overflowClipRect(rect.location()));
630 623
631 // Adjust the paint rect to reflect a scrolled content box with borders at the ends. 624 // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
632 IntSize offset = thisBox->scrolledContentOffset(); 625 IntSize offset = thisBox->scrolledContentOffset();
633 scrolledPaintRect.move(-offset); 626 scrolledPaintRect.move(-offset);
634 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight); 627 scrolledPaintRect.setWidth(bLeft + thisBox->scrollWidth() + bRight);
635 scrolledPaintRect.setHeight(borderTop() + thisBox->scrollHeight() + bord erBottom()); 628 scrolledPaintRect.setHeight(borderTop() + thisBox->scrollHeight() + bord erBottom());
636 } 629 }
637 630
638 GraphicsContextStateSaver backgroundClipStateSaver(*context, false); 631 GraphicsContextStateSaver backgroundClipStateSaver(*context, false);
639 IntRect maskRect; 632 IntRect maskRect;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 if (bgLayer->clip() == TextFillBox) { 752 if (bgLayer->clip() == TextFillBox) {
760 // Create the text mask layer. 753 // Create the text mask layer.
761 context->setCompositeOperation(CompositeDestinationIn); 754 context->setCompositeOperation(CompositeDestinationIn);
762 context->beginTransparencyLayer(1); 755 context->beginTransparencyLayer(1);
763 756
764 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291. 757 // FIXME: Workaround for https://code.google.com/p/skia/issues/detail?id =1291.
765 context->clearRect(maskRect); 758 context->clearRect(maskRect);
766 759
767 // Now draw the text into the mask. We do this by painting using a speci al paint phase that signals to 760 // Now draw the text into the mask. We do this by painting using a speci al paint phase that signals to
768 // InlineTextBoxes that they should just add their contents to the clip. 761 // InlineTextBoxes that they should just add their contents to the clip.
769 PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForce BlackText, 0, paintInfo.renderRegion); 762 PaintInfo info(context, maskRect, PaintPhaseTextClip, PaintBehaviorForce BlackText, 0);
770 context->setCompositeOperation(CompositeSourceOver); 763 context->setCompositeOperation(CompositeSourceOver);
771 if (box) { 764 if (box) {
772 RootInlineBox* root = box->root(); 765 RootInlineBox* root = box->root();
773 box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrol ledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom()); 766 box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrol ledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
774 } else { 767 } else {
775 LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset () : LayoutSize(); 768 LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset () : LayoutSize();
776 paint(info, scrolledPaintRect.location() - localOffset); 769 paint(info, scrolledPaintRect.location() - localOffset);
777 } 770 }
778 771
779 context->endLayer(); 772 context->endLayer();
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2831 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2839 for (RenderObject* child = startChild; child && child != endChild; ) { 2832 for (RenderObject* child = startChild; child && child != endChild; ) {
2840 // Save our next sibling as moveChildTo will clear it. 2833 // Save our next sibling as moveChildTo will clear it.
2841 RenderObject* nextSibling = child->nextSibling(); 2834 RenderObject* nextSibling = child->nextSibling();
2842 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2835 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2843 child = nextSibling; 2836 child = nextSibling;
2844 } 2837 }
2845 } 2838 }
2846 2839
2847 } // namespace WebCore 2840 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderBoxRegionInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698