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

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

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 // When printing backgrounds is disabled or using economy mode, 550 // When printing backgrounds is disabled or using economy mode,
551 // change existing background colors and images to a solid white background. 551 // change existing background colors and images to a solid white background.
552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency. 552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency.
553 // We don't try to avoid loading the background images, because this style f lag is only set 553 // We don't try to avoid loading the background images, because this style f lag is only set
554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid 554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid
555 // loading the background images we'd have to do this check when applying st yles rather than 555 // loading the background images we'd have to do this check when applying st yles rather than
556 // while rendering.) 556 // while rendering.)
557 if (forceBackgroundToWhite) { 557 if (forceBackgroundToWhite) {
558 // Note that we can't reuse this variable below because the bgColor migh t be changed 558 // Note that we can't reuse this variable below because the bgColor migh t be changed
559 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.alpha(); 559 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha();
560 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { 560 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) {
561 bgColor = Color::white; 561 bgColor = Color::white;
562 shouldPaintBackgroundImage = false; 562 shouldPaintBackgroundImage = false;
563 } 563 }
564 } 564 }
565 565
566 bool colorVisible = bgColor.alpha(); 566 bool colorVisible = bgColor.isValid() && bgColor.alpha();
567 567
568 // Fast path for drawing simple color backgrounds. 568 // Fast path for drawing simple color backgrounds.
569 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) { 569 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) {
570 if (!colorVisible) 570 if (!colorVisible)
571 return; 571 return;
572 572
573 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli edToBackground(bleedAvoidance, box); 573 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli edToBackground(bleedAvoidance, box);
574 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp pliedToBackground); 574 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp pliedToBackground);
575 if (boxShadowShouldBeAppliedToBackground) 575 if (boxShadowShouldBeAppliedToBackground)
576 applyBoxShadowForBackground(context, this); 576 applyBoxShadowForBackground(context, this);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 default: 666 default:
667 ASSERT_NOT_REACHED(); 667 ASSERT_NOT_REACHED();
668 break; 668 break;
669 } 669 }
670 670
671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with 671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with
672 // no background in the child document should show the parent's background. 672 // no background in the child document should show the parent's background.
673 bool isOpaqueRoot = false; 673 bool isOpaqueRoot = false;
674 if (isRoot) { 674 if (isRoot) {
675 isOpaqueRoot = true; 675 isOpaqueRoot = true;
676 if (!bgLayer->next() && !(bgColor.alpha() == 255) && view()->frameView() ) { 676 if (!bgLayer->next() && !(bgColor.isValid() && bgColor.alpha() == 255) & & view()->frameView()) {
677 Element* ownerElement = document().ownerElement(); 677 Element* ownerElement = document().ownerElement();
678 if (ownerElement) { 678 if (ownerElement) {
679 if (!ownerElement->hasTagName(frameTag)) { 679 if (!ownerElement->hasTagName(frameTag)) {
680 // Locate the <body> element using the DOM. This is easier than trying 680 // Locate the <body> element using the DOM. This is easier than trying
681 // to crawl around a render tree with potential :before/:aft er content and 681 // to crawl around a render tree with potential :before/:aft er content and
682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body> 682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body>
683 // render object very easily via the DOM. 683 // render object very easily via the DOM.
684 HTMLElement* body = document().body(); 684 HTMLElement* body = document().body();
685 if (body) { 685 if (body) {
686 // Can't scroll a frameset document anyway. 686 // Can't scroll a frameset document anyway.
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 hasOneNormalBoxShadow = true; 2394 hasOneNormalBoxShadow = true;
2395 2395
2396 if (currentShadow->spread()) 2396 if (currentShadow->spread())
2397 return false; 2397 return false;
2398 } 2398 }
2399 2399
2400 if (!hasOneNormalBoxShadow) 2400 if (!hasOneNormalBoxShadow)
2401 return false; 2401 return false;
2402 2402
2403 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); 2403 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
2404 if (backgroundColor.hasAlpha()) 2404 if (!backgroundColor.isValid() || backgroundColor.hasAlpha())
2405 return false; 2405 return false;
2406 2406
2407 const FillLayer* lastBackgroundLayer = style()->backgroundLayers(); 2407 const FillLayer* lastBackgroundLayer = style()->backgroundLayers();
2408 for (const FillLayer* next = lastBackgroundLayer->next(); next; next = lastB ackgroundLayer->next()) 2408 for (const FillLayer* next = lastBackgroundLayer->next(); next; next = lastB ackgroundLayer->next())
2409 lastBackgroundLayer = next; 2409 lastBackgroundLayer = next;
2410 2410
2411 if (lastBackgroundLayer->clip() != BorderFillBox) 2411 if (lastBackgroundLayer->clip() != BorderFillBox)
2412 return false; 2412 return false;
2413 2413
2414 if (lastBackgroundLayer->image() && style()->hasBorderRadius()) 2414 if (lastBackgroundLayer->image() && style()->hasBorderRadius())
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 if (shadow->style() != shadowStyle) 2456 if (shadow->style() != shadowStyle)
2457 continue; 2457 continue;
2458 2458
2459 IntSize shadowOffset(shadow->x(), shadow->y()); 2459 IntSize shadowOffset(shadow->x(), shadow->y());
2460 int shadowBlur = shadow->blur(); 2460 int shadowBlur = shadow->blur();
2461 int shadowSpread = shadow->spread(); 2461 int shadowSpread = shadow->spread();
2462 2462
2463 if (shadowOffset.isZero() && !shadowBlur && !shadowSpread) 2463 if (shadowOffset.isZero() && !shadowBlur && !shadowSpread)
2464 continue; 2464 continue;
2465 2465
2466 const Color& shadowColor = resolveColor(shadow->color(), Color::stdShado wColor); 2466 const Color& shadowColor = resolveColor(shadow->color());
2467 2467
2468 if (shadow->style() == Normal) { 2468 if (shadow->style() == Normal) {
2469 RoundedRect fillRect = border; 2469 RoundedRect fillRect = border;
2470 fillRect.inflate(shadowSpread); 2470 fillRect.inflate(shadowSpread);
2471 if (fillRect.isEmpty()) 2471 if (fillRect.isEmpty())
2472 continue; 2472 continue;
2473 2473
2474 IntRect shadowRect(border.rect()); 2474 IntRect shadowRect(border.rect());
2475 shadowRect.inflate(shadowBlur + shadowSpread); 2475 shadowRect.inflate(shadowBlur + shadowSpread);
2476 shadowRect.move(shadowOffset); 2476 shadowRect.move(shadowOffset);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2787 for (RenderObject* child = startChild; child && child != endChild; ) { 2787 for (RenderObject* child = startChild; child && child != endChild; ) {
2788 // Save our next sibling as moveChildTo will clear it. 2788 // Save our next sibling as moveChildTo will clear it.
2789 RenderObject* nextSibling = child->nextSibling(); 2789 RenderObject* nextSibling = child->nextSibling();
2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2791 child = nextSibling; 2791 child = nextSibling;
2792 } 2792 }
2793 } 2793 }
2794 2794
2795 } // namespace WebCore 2795 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698