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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 17450016: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Implementation of CSS3 nav-up/down/left/right properties from CSS3 UI Created 7 years, 6 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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
11 * Copyright (C) 2012 Google Inc. All rights reserved. 11 * Copyright (C) 2012 Google Inc. All rights reserved.
12 * Copyright (C) 2013 Opera Software ASA. All rights reserved.
12 * 13 *
13 * This library is free software; you can redistribute it and/or 14 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 15 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 16 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 17 * version 2 of the License, or (at your option) any later version.
17 * 18 *
18 * This library is distributed in the hope that it will be useful, 19 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 22 * Library General Public License for more details.
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 case CSSPropertyWebkitMaskRepeat: 2689 case CSSPropertyWebkitMaskRepeat:
2689 case CSSPropertyWebkitTextEmphasis: 2690 case CSSPropertyWebkitTextEmphasis:
2690 case CSSPropertyWebkitTextStroke: 2691 case CSSPropertyWebkitTextStroke:
2691 case CSSPropertyWebkitTransition: 2692 case CSSPropertyWebkitTransition:
2692 case CSSPropertyWebkitTransformOrigin: 2693 case CSSPropertyWebkitTransformOrigin:
2693 ASSERT(isExpandedShorthand(id)); 2694 ASSERT(isExpandedShorthand(id));
2694 ASSERT_NOT_REACHED(); 2695 ASSERT_NOT_REACHED();
2695 break; 2696 break;
2696 2697
2697 // CSS3 Properties 2698 // CSS3 Properties
2699 case CSSPropertyNavDown:
2700 case CSSPropertyNavLeft:
2701 case CSSPropertyNavRight:
2702 case CSSPropertyNavUp: {
2703 NavDirSetter setter = getNavDirSetterForProperty(id);
2704
2705 if (isInitial) {
2706 (m_state.style()->*setter)(StyleNavigationValue());
2707 } else if (primitiveValue) {
2708 (m_state.style()->*setter)(StyleNavigationValue(primitiveValue->getS tringValue()));
2709 } else if (value->isValueList()) {
2710 AtomicString vals[2];
2711 CSSValueListIterator iterator = value;
2712
2713 for (int i = 0; i < 2 && iterator.hasMore(); iterator.advance()) {
2714 CSSValue* item = iterator.value();
2715 if (!item->isPrimitiveValue())
2716 continue;
2717 vals[i++] = (static_cast<CSSPrimitiveValue*>(item))->getStringVa lue();
2718 }
2719
2720 (m_state.style()->*setter)(StyleNavigationValue(vals[0], vals[1]));
esprehn 2013/06/20 19:45:10 You should do this the other way around instead of
Krzysztof Olczyk 2013/07/22 14:14:16 Done.
2721 }
2722 return;
2723 }
2698 case CSSPropertyTextShadow: 2724 case CSSPropertyTextShadow:
2699 case CSSPropertyBoxShadow: 2725 case CSSPropertyBoxShadow:
2700 case CSSPropertyWebkitBoxShadow: { 2726 case CSSPropertyWebkitBoxShadow: {
2701 if (isInherit) { 2727 if (isInherit) {
2702 if (id == CSSPropertyTextShadow) 2728 if (id == CSSPropertyTextShadow)
2703 return state.style()->setTextShadow(state.parentStyle()->textSha dow() ? adoptPtr(new ShadowData(*state.parentStyle()->textShadow())) : nullptr); 2729 return state.style()->setTextShadow(state.parentStyle()->textSha dow() ? adoptPtr(new ShadowData(*state.parentStyle()->textShadow())) : nullptr);
2704 return state.style()->setBoxShadow(state.parentStyle()->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->boxShadow())) : nullptr); 2730 return state.style()->setBoxShadow(state.parentStyle()->boxShadow() ? adoptPtr(new ShadowData(*state.parentStyle()->boxShadow())) : nullptr);
2705 } 2731 }
2706 if (isInitial || primitiveValue) // initial | none 2732 if (isInitial || primitiveValue) // initial | none
2707 return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nu llptr) : state.style()->setBoxShadow(nullptr); 2733 return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nu llptr) : state.style()->setBoxShadow(nullptr);
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 CSSShaderValue* shaderValue = static_cast<StylePendingShader *>(program->fragmentShader())->cssShaderValue(); 3559 CSSShaderValue* shaderValue = static_cast<StylePendingShader *>(program->fragmentShader())->cssShaderValue();
3534 program->setFragmentShader(shaderValue->cachedShader(cachedR esourceLoader)); 3560 program->setFragmentShader(shaderValue->cachedShader(cachedR esourceLoader));
3535 } 3561 }
3536 m_customFilterProgramCache->add(program); 3562 m_customFilterProgramCache->add(program);
3537 } 3563 }
3538 } 3564 }
3539 } 3565 }
3540 m_state.setHasPendingShaders(false); 3566 m_state.setHasPendingShaders(false);
3541 } 3567 }
3542 3568
3569 StyleResolver::NavDirSetter StyleResolver::getNavDirSetterForProperty(CSSPropert yID id)
3570 {
3571 switch (id) {
3572 case CSSPropertyNavDown:
3573 return &RenderStyle::setNavDown;
3574 case CSSPropertyNavLeft:
3575 return &RenderStyle::setNavLeft;
3576 case CSSPropertyNavRight:
3577 return &RenderStyle::setNavRight;
3578 case CSSPropertyNavUp:
3579 return &RenderStyle::setNavUp;
3580 default:
3581 ASSERT_NOT_REACHED();
3582 return 0;
3583 }
3584 }
3585
3586
3543 PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendin gImage) 3587 PassRefPtr<StyleImage> StyleResolver::loadPendingImage(StylePendingImage* pendin gImage)
3544 { 3588 {
3545 CachedResourceLoader* cachedResourceLoader = m_state.document()->cachedResou rceLoader(); 3589 CachedResourceLoader* cachedResourceLoader = m_state.document()->cachedResou rceLoader();
3546 3590
3547 if (pendingImage->cssImageValue()) { 3591 if (pendingImage->cssImageValue()) {
3548 CSSImageValue* imageValue = pendingImage->cssImageValue(); 3592 CSSImageValue* imageValue = pendingImage->cssImageValue();
3549 return imageValue->cachedImage(cachedResourceLoader); 3593 return imageValue->cachedImage(cachedResourceLoader);
3550 } 3594 }
3551 3595
3552 if (pendingImage->cssImageGeneratorValue()) { 3596 if (pendingImage->cssImageGeneratorValue()) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3720 info.addMember(m_state, "state"); 3764 info.addMember(m_state, "state");
3721 3765
3722 // FIXME: move this to a place where it would be called only once? 3766 // FIXME: move this to a place where it would be called only once?
3723 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3767 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3724 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3768 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3725 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3769 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3726 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3770 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3727 } 3771 }
3728 3772
3729 } // namespace WebCore 3773 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698