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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 950623002: Store resolved color in AppliedTextDecoration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated patch with underline optimization handling Created 5 years, 9 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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 if (diff.filterChanged() && hasLayer()) { 1592 if (diff.filterChanged() && hasLayer()) {
1593 Layer* layer = toLayoutBoxModelObject(this)->layer(); 1593 Layer* layer = toLayoutBoxModelObject(this)->layer();
1594 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters()) 1594 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters())
1595 diff.setNeedsPaintInvalidationLayer(); 1595 diff.setNeedsPaintInvalidationLayer();
1596 } 1596 }
1597 1597
1598 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) { 1598 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) {
1599 if (style()->hasBorder() || style()->hasOutline() 1599 if (style()->hasBorder() || style()->hasOutline()
1600 || (isText() && !toLayoutText(this)->isAllCollapsibleWhitespace())) 1600 || (isText() && !toLayoutText(this)->isAllCollapsibleWhitespace()))
1601 diff.setNeedsPaintInvalidationObject(); 1601 diff.setNeedsPaintInvalidationObject();
1602 if (style()->hasSimpleUnderlineTextDecoration())
1603 style()->adjustTextDecorationDifference();
Timothy Loh 2015/03/25 00:26:23 This seems a bit weird. I don't think we should be
1602 } 1604 }
1603 1605
1604 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual 1606 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch ange without the actual
1605 // style changing, since it depends on whether we decide to composite these elements. When the 1607 // style changing, since it depends on whether we decide to composite these elements. When the
1606 // layer status of one of these elements changes, we need to force a layout. 1608 // layer status of one of these elements changes, we need to force a layout.
1607 if (!diff.needsFullLayout() && style() && isLayoutBoxModelObject()) { 1609 if (!diff.needsFullLayout() && style() && isLayoutBoxModelObject()) {
1608 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() ! = NoLayer; 1610 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() ! = NoLayer;
1609 if (hasLayer() != requiresLayer) 1611 if (hasLayer() != requiresLayer)
1610 diff.setNeedsFullLayout(); 1612 diff.setNeedsFullLayout();
1611 } 1613 }
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 do { 2758 do {
2757 styleToUse = curr->style(firstlineStyle); 2759 styleToUse = curr->style(firstlineStyle);
2758 currDecs = styleToUse->textDecoration(); 2760 currDecs = styleToUse->textDecoration();
2759 currDecs &= decorations; 2761 currDecs &= decorations;
2760 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor); 2762 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2761 resultStyle = styleToUse->textDecorationStyle(); 2763 resultStyle = styleToUse->textDecorationStyle();
2762 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below. 2764 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2763 if (currDecs) { 2765 if (currDecs) {
2764 if (currDecs & TextDecorationUnderline) { 2766 if (currDecs & TextDecorationUnderline) {
2765 decorations &= ~TextDecorationUnderline; 2767 decorations &= ~TextDecorationUnderline;
2766 underline.color = resultColor; 2768 underline.setColor(resultColor);
2767 underline.style = resultStyle; 2769 underline.setStyle(resultStyle);
2768 } 2770 }
2769 if (currDecs & TextDecorationOverline) { 2771 if (currDecs & TextDecorationOverline) {
2770 decorations &= ~TextDecorationOverline; 2772 decorations &= ~TextDecorationOverline;
2771 overline.color = resultColor; 2773 overline.setColor(resultColor);
2772 overline.style = resultStyle; 2774 overline.setStyle(resultStyle);
2773 } 2775 }
2774 if (currDecs & TextDecorationLineThrough) { 2776 if (currDecs & TextDecorationLineThrough) {
2775 decorations &= ~TextDecorationLineThrough; 2777 decorations &= ~TextDecorationLineThrough;
2776 linethrough.color = resultColor; 2778 linethrough.setColor(resultColor);
2777 linethrough.style = resultStyle; 2779 linethrough.setStyle(resultStyle);
2778 } 2780 }
2779 } 2781 }
2780 if (curr->isRubyText()) 2782 if (curr->isRubyText())
2781 return; 2783 return;
2782 curr = curr->parent(); 2784 curr = curr->parent();
2783 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n()) 2785 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2784 curr = toLayoutBlock(curr)->continuation(); 2786 curr = toLayoutBlock(curr)->continuation();
2785 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node())))); 2787 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2786 2788
2787 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element). 2789 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2788 if (decorations && curr) { 2790 if (decorations && curr) {
2789 styleToUse = curr->style(firstlineStyle); 2791 styleToUse = curr->style(firstlineStyle);
2790 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor); 2792 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2791 if (decorations & TextDecorationUnderline) { 2793 if (decorations & TextDecorationUnderline) {
2792 underline.color = resultColor; 2794 underline.setColor(resultColor);
2793 underline.style = resultStyle; 2795 underline.setStyle(resultStyle);
2794 } 2796 }
2795 if (decorations & TextDecorationOverline) { 2797 if (decorations & TextDecorationOverline) {
2796 overline.color = resultColor; 2798 overline.setColor(resultColor);
2797 overline.style = resultStyle; 2799 overline.setStyle(resultStyle);
2798 } 2800 }
2799 if (decorations & TextDecorationLineThrough) { 2801 if (decorations & TextDecorationLineThrough) {
2800 linethrough.color = resultColor; 2802 linethrough.setColor(resultColor);
2801 linethrough.style = resultStyle; 2803 linethrough.setStyle(resultStyle);
2802 } 2804 }
2803 } 2805 }
2804 } 2806 }
2805 2807
2806 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2808 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2807 { 2809 {
2808 // Convert the style regions to absolute coordinates. 2810 // Convert the style regions to absolute coordinates.
2809 if (style()->visibility() != VISIBLE || !isBox()) 2811 if (style()->visibility() != VISIBLE || !isBox())
2810 return; 2812 return;
2811 2813
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3218 { 3220 {
3219 if (object1) { 3221 if (object1) {
3220 const blink::LayoutObject* root = object1; 3222 const blink::LayoutObject* root = object1;
3221 while (root->parent()) 3223 while (root->parent())
3222 root = root->parent(); 3224 root = root->parent();
3223 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3225 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3224 } 3226 }
3225 } 3227 }
3226 3228
3227 #endif 3229 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698