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

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

Issue 1328283005: Add support for multiple text decorations with same line positioning (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase again Created 5 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 | 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) 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 2854 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 if (root->type() == ShadowRootType::UserAgent) { 2865 if (root->type() == ShadowRootType::UserAgent) {
2866 if (Element* shadowHost = node()->shadowHost()) { 2866 if (Element* shadowHost = node()->shadowHost()) {
2867 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION)); 2867 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2868 } 2868 }
2869 } 2869 }
2870 } 2870 }
2871 2871
2872 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2872 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2873 } 2873 }
2874 2874
2875 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2876 {
2877 LayoutObject* curr = this;
2878 const ComputedStyle* styleToUse = nullptr;
2879 unsigned currDecs = TextDecorationNone;
2880 Color resultColor;
2881 TextDecorationStyle resultStyle;
2882 do {
2883 styleToUse = curr->style(firstlineStyle);
2884 currDecs = styleToUse->textDecoration();
2885 currDecs &= decorations;
2886 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2887 resultStyle = styleToUse->textDecorationStyle();
2888 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2889 if (currDecs) {
2890 if (currDecs & TextDecorationUnderline) {
2891 decorations &= ~TextDecorationUnderline;
2892 underline.color = resultColor;
2893 underline.style = resultStyle;
2894 }
2895 if (currDecs & TextDecorationOverline) {
2896 decorations &= ~TextDecorationOverline;
2897 overline.color = resultColor;
2898 overline.style = resultStyle;
2899 }
2900 if (currDecs & TextDecorationLineThrough) {
2901 decorations &= ~TextDecorationLineThrough;
2902 linethrough.color = resultColor;
2903 linethrough.style = resultStyle;
2904 }
2905 }
2906 if (curr->isRubyText())
2907 return;
2908 curr = curr->parent();
2909 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2910 curr = toLayoutBlock(curr)->continuation();
2911 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2912
2913 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2914 if (decorations && curr) {
2915 styleToUse = curr->style(firstlineStyle);
2916 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2917 if (decorations & TextDecorationUnderline) {
2918 underline.color = resultColor;
2919 underline.style = resultStyle;
2920 }
2921 if (decorations & TextDecorationOverline) {
2922 overline.color = resultColor;
2923 overline.style = resultStyle;
2924 }
2925 if (decorations & TextDecorationLineThrough) {
2926 linethrough.color = resultColor;
2927 linethrough.style = resultStyle;
2928 }
2929 }
2930 }
2931
2932 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2875 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2933 { 2876 {
2934 // Convert the style regions to absolute coordinates. 2877 // Convert the style regions to absolute coordinates.
2935 if (style()->visibility() != VISIBLE || !isBox()) 2878 if (style()->visibility() != VISIBLE || !isBox())
2936 return; 2879 return;
2937 2880
2938 if (style()->getDraggableRegionMode() == DraggableRegionNone) 2881 if (style()->getDraggableRegionMode() == DraggableRegionNone)
2939 return; 2882 return;
2940 2883
2941 LayoutBox* box = toLayoutBox(this); 2884 LayoutBox* box = toLayoutBox(this);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 const blink::LayoutObject* root = object1; 3396 const blink::LayoutObject* root = object1;
3454 while (root->parent()) 3397 while (root->parent())
3455 root = root->parent(); 3398 root = root->parent();
3456 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3399 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3457 } else { 3400 } else {
3458 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3401 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3459 } 3402 }
3460 } 3403 }
3461 3404
3462 #endif 3405 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698